Playwright E2E testing patterns — web-first assertions, user-visible locators, network interception, fixtures, authentication, and parallel execution
98
99%
Does it follow best practices?
Impact
98%
1.81xAverage score across 5 eval scenarios
Passed
No known issues
An e-commerce app has a multi-step checkout flow: cart review, shipping address, payment, and order confirmation. Write Playwright E2E tests that cover the happy path (completing checkout) and key error cases.
The app runs on http://localhost:3000 and has these pages:
/cart -- shows items in cart with quantities and a "Proceed to Checkout" button/checkout/shipping -- shipping address form (name, address, city, zip) with a "Continue" button/checkout/payment -- payment form (card number, expiry, CVV) with a "Place Order" button/checkout/confirmation -- shows order number and summaryThe app has a REST API:
POST /api/orders -- creates an order (returns 201 with order ID)GET /api/orders/:id -- retrieves order detailsProduce:
playwright.config.ts -- Playwright configuratione2e/checkout.spec.ts -- E2E test file for the checkout flowpackage.json -- with @playwright/test dependency listedYou may create additional files if needed for good test organization (e.g., page objects, fixtures).