Skip to content

Commit 1bc3e1d

Browse files
authored
QACOE-212: Add a product into shopping cart test (#2)
* Add checkout test case * Fix requested change
1 parent 54fffc0 commit 1bc3e1d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// shopping-cart.spec.js created with Cypress
2+
//
3+
// Start writing your Cypress tests below!
4+
// If you're unfamiliar with how Cypress works,
5+
// check out the link below and learn how to write your first test:
6+
// https://on.cypress.io/writing-first-test
7+
/* ==== Test Created with Cypress Studio ==== */
8+
it('can add a product into cart', function() {
9+
/* ==== Generated with Cypress Studio ==== */
10+
cy.visit('https://www.saucedemo.com/');
11+
cy.get('[data-test="username"]').clear();
12+
cy.get('[data-test="username"]').type('standard_user');
13+
cy.get('[data-test="password"]').clear();
14+
cy.get('[data-test="password"]').type('secret_sauce');
15+
cy.get('[data-test="login-button"]').click();
16+
cy.get('.title').should('be.visible');
17+
cy.get('[data-test="add-to-cart-sauce-labs-backpack"]').click();
18+
cy.get('.shopping_cart_link').click();
19+
cy.get('.inventory_item_name').should('have.text', 'Sauce Labs Backpack');
20+
cy.get('.cart_quantity').should('have.text', '1');
21+
cy.get('.inventory_item_price').should('be.visible');
22+
cy.get('[data-test="checkout"]').click();
23+
cy.get('[data-test="firstName"]').clear();
24+
cy.get('[data-test="firstName"]').type('John');
25+
cy.get('[data-test="lastName"]').clear();
26+
cy.get('[data-test="lastName"]').type('Smith');
27+
cy.get('[data-test="postalCode"]').clear();
28+
cy.get('[data-test="postalCode"]').type('90001');
29+
cy.get('[data-test="continue"]').click();
30+
cy.get('[data-test="finish"]').click();
31+
cy.get('.complete-header').should('be.visible');
32+
cy.get('.complete-header').should('have.text', 'THANK YOU FOR YOUR ORDER');
33+
cy.get('.complete-text').should('have.text', 'Your order has been dispatched, and will arrive just as fast as the pony can get there!');
34+
cy.get('.pony_express').should('be.visible');
35+
/* ==== End Cypress Studio ==== */
36+
});

0 commit comments

Comments
 (0)