diff options
| author | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
|---|---|---|
| committer | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
| commit | 82e03978b89938219958032efb1448cc76baa181 (patch) | |
| tree | 626f3e54d52ecd49be0ed3bee30abacc0453d081 /src/frontend/cypress/e2e/Checkout.cy.ts | |
Initial snapshot - OpenTelemetry demo 2.1.3 -f
Diffstat (limited to 'src/frontend/cypress/e2e/Checkout.cy.ts')
| -rw-r--r-- | src/frontend/cypress/e2e/Checkout.cy.ts | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/frontend/cypress/e2e/Checkout.cy.ts b/src/frontend/cypress/e2e/Checkout.cy.ts new file mode 100644 index 0000000..1feca43 --- /dev/null +++ b/src/frontend/cypress/e2e/Checkout.cy.ts @@ -0,0 +1,54 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +import { CypressFields, getElementByField } from '../../utils/Cypress'; + +describe.skip('Checkout Flow', () => { + before(() => { + cy.intercept('POST', '/api/cart*').as('addToCart'); + cy.intercept('GET', '/api/cart*').as('getCart'); + cy.intercept('POST', '/api/checkout*').as('placeOrder'); + }); + + beforeEach(() => { + cy.visit('/'); + }); + + it('should create an order with two items', () => { + getElementByField(CypressFields.ProductCard).first().click(); + getElementByField(CypressFields.ProductAddToCart).click(); + + cy.wait('@addToCart'); + cy.wait('@getCart', { timeout: 10000 }); + cy.wait(2000); + + cy.location('href').should('match', /\/cart$/); + getElementByField(CypressFields.CartItemCount).should('contain', '1'); + + cy.visit('/'); + + getElementByField(CypressFields.ProductCard).last().click(); + getElementByField(CypressFields.ProductAddToCart).click(); + + cy.wait('@addToCart'); + cy.wait('@getCart', { timeout: 10000 }); + cy.wait(2000); + + cy.location('href').should('match', /\/cart$/); + getElementByField(CypressFields.CartItemCount).should('contain', '2'); + + getElementByField(CypressFields.CartIcon).click({ force: true }); + getElementByField(CypressFields.CartGoToShopping).click(); + + cy.location('href').should('match', /\/cart$/); + + getElementByField(CypressFields.CheckoutPlaceOrder).click(); + + cy.wait('@placeOrder'); + + cy.location('href').should('match', /\/checkout/); + getElementByField(CypressFields.CheckoutItem).should('have.length', 2); + }); +}); + +export {}; |
