Guest User

Untitled

a guest
Jan 22nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. // This is what you want...
  2. describe('Shopping Cart', () => {
  3. before(() => {
  4. cy.login('michael@example.com', 'password')
  5. })
  6.  
  7. beforeEach(() => {
  8. resetShoppingCart()
  9. })
  10.  
  11. it('add item to cart', () => {
  12. cy.visit('/products/fidget-spinner-1')
  13. cy.contains('Add To Cart').click()
  14. cy.contains('Show Cart').click()
  15.  
  16. expect(cy.contains('Shopping Cart'))
  17. expect(cy.contains('Fidget Spinner'))
  18. expect(cy.contains('$10.00'))
  19. })
  20. })
  21.  
  22. const resetShoppingCart = () => {
  23. cy.visit('/')
  24. cy.contains('Show Cart').click()
  25. cy.contains('Reset Cart').click()
  26. }
  27.  
  28. it('A Pro User logs in and sees a thank you message for the first time', () => {
  29. loginWith('new-pro@example.com', 'passsword')
  30.  
  31. expect(cy.contains('Thank you for supporting us!')).toBeTruthy
  32. })
  33.  
  34. it('A Pro User logs in and sees and sees a welcome message', () => {
  35. loginWith('old-pro@example.com', 'passsword')
  36.  
  37. expect(cy.contains('Welcome back John')).toBeTruthy
  38. })
Add Comment
Please, Sign In to add comment