Created
September 4, 2020 13:19
-
-
Save kianaditya/3450c7e0dbdc1a153a365cfca91b022f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="Cypress" /> | |
describe('Tests todo list', () => { | |
it('Checks todo render', () => { | |
cy.customRoute( | |
{ | |
method: 'GET', | |
url: 'https://jsonplaceholder.typicode.com/todos', | |
response: 'fixture:todo.json', | |
}, | |
'getTodos' | |
) | |
cy.visit('/') | |
// You can check env variable status by console.log(Cypress.env('mock')) | |
cy.get('h3') | |
.should('have.length', Cypress.env('mock') ? 1 : 200) | |
.first() | |
.should( | |
'have.text', | |
Cypress.env('mock') ? 'Mocked Todo' : 'delectus aut autem' | |
) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment