Skip to content

Instantly share code, notes, and snippets.

@nadvolod
Created September 11, 2020 15:39
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 nadvolod/b3479692492c1b8e9d70ee7868d881ef to your computer and use it in GitHub Desktop.
Save nadvolod/b3479692492c1b8e9d70ee7868d881ef to your computer and use it in GitHub Desktop.
Sample Cypress tests
context('Login page', ()=>{
beforeEach(()=> {
cy.visit('https://www.saucedemo.com/')
})
it('can open page', () => {
cy.title().should('eq', 'Swag Labs')
})
it('can login', () => {
cy.get('#user-name').type('standard_user')
cy.get('#password').type('secret_sauce')
cy.get('#login-button').click()
cy.get('#inventory_filter_container').should('exist')
})
it('can login with chaining', () => {
cy.get('#user-name').type('standard_user')
.get('#password').type('secret_sauce')
.get('#login-button').click()
.get('#inventory_filter_container').should('exist')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment