Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Created September 4, 2020 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kianaditya/3450c7e0dbdc1a153a365cfca91b022f to your computer and use it in GitHub Desktop.
Save kianaditya/3450c7e0dbdc1a153a365cfca91b022f to your computer and use it in GitHub Desktop.
/// <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