Created
January 21, 2019 20:33
-
-
Save yagudaev/8b13571fafcc5fef1c8303ccff36018d 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
// This is what you want... | |
describe('Shopping Cart', () => { | |
before(() => { | |
cy.login('[email protected]', 'password') | |
}) | |
beforeEach(() => { | |
resetShoppingCart() | |
}) | |
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')) | |
}) | |
}) | |
const resetShoppingCart = () => { | |
cy.visit('/') | |
cy.contains('Show Cart').click() | |
cy.contains('Reset Cart').click() | |
} | |
it('A Pro User logs in and sees a thank you message for the first time', () => { | |
loginWith('[email protected]', 'passsword') | |
expect(cy.contains('Thank you for supporting us!')).toBeTruthy | |
}) | |
it('A Pro User logs in and sees and sees a welcome message', () => { | |
loginWith('[email protected]', 'passsword') | |
expect(cy.contains('Welcome back John')).toBeTruthy | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment