CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/cypress-testing

Cypress E2E testing patterns -- selectors, cy.intercept, cy.session, cy.clock, custom commands, test isolation, and anti-patterns

98

1.25x
Quality

99%

Does it follow best practices?

Impact

97%

1.25x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-4/

E2E Tests for Shopping Cart and Checkout

Problem/Feature Description

An e-commerce web application needs E2E tests for its shopping cart and checkout flow. Write Cypress tests for adding products to the cart, updating quantities, and completing checkout.

The app runs on http://localhost:3000 with these pages:

  • /products -- product listing with "Add to cart" buttons on each product card
  • /cart -- cart page showing items, quantities, subtotals, and a "Proceed to checkout" button
  • /checkout -- checkout form with shipping address fields, payment section, and "Place order" button
  • /orders/:id -- order confirmation page

The app has these API endpoints:

  • GET /api/products -- returns product list
  • POST /api/cart/items -- adds item to cart
  • PATCH /api/cart/items/:id -- updates item quantity
  • DELETE /api/cart/items/:id -- removes item from cart
  • GET /api/cart -- returns current cart contents
  • POST /api/orders -- creates an order from the cart

Output Specification

Produce:

  • cypress.config.ts -- Cypress configuration
  • cypress/e2e/cart.cy.ts -- tests for cart operations (add, update quantity, remove)
  • cypress/e2e/checkout.cy.ts -- tests for the checkout flow and form validation
  • cypress/support/commands.ts -- any reusable test helpers
  • cypress/fixtures/products.json -- fixture data for product API responses
  • package.json -- with cypress dependency listed

You may create additional files for good test organization.

evals

tile.json