Created
January 21, 2019 20:30
-
-
Save yagudaev/21baf902c132a022e8f43394708f843c to your computer and use it in GitHub Desktop.
Testing Your Frontend with Cypress.io Framework
This file contains 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
// not great... | |
describe('Shopping Cart', () => { | |
before(() => { | |
cy.login('[email protected]', 'password') | |
}) | |
it('add item to cart', () => { | |
cy.visit('/products/fidget-spinner-1') | |
cy.contains('Add To Cart').click() | |
cy.contains('Show Cart').click() | |
expect(cy.contains('Shopping Cart')) | |
expect(cy.contains('Fidget Spinner')) | |
expect(cy.contains('$10.00')) | |
}) | |
after(() => { | |
// not guranteed to be called if you quit before test completes (e.g auto reload) | |
restShoppingCart() | |
}) | |
}) | |
const resetShoppingCart = () => { | |
cy.visit('/') | |
cy.contains('Show Cart').click() | |
cy.contains('Reset Cart').click() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment