Playwright end-to-end tests for a signup and checkout flow
Writes a Playwright test suite for a web app's most important user journeys, such as signup, login, add to cart and checkout, with stable selectors, test data set up through the API, mobile and desktop runs and a CI config. Use it when manual testing before each release takes hours and still misses broken buttons.
The output this prompt produced, unedited.
The prompt
Constraints first
Select elements by role, label or a data-testid; never by CSS classes or position.
Each test sets up its own data and does not depend on another test running first.
No fixed waits; rely on Playwright's auto-waiting and web-first assertions.
Use a payment provider's test mode and its published test cards only; never real payment details.
Read base URLs and test account secrets from environment variables.
Inputs
App and stack: [e.g. a Next.js store with a PHP API]
Journeys to cover: [e.g. sign up, log in, search, add to cart, apply coupon, pay, see order confirmation]
Page structure or HTML for each step: [paste, or describe the fields and buttons]
Test environment URL and how to create test data: [e.g. a staging site, a seed endpoint or SQL fixtures]
CI system: [e.g. GitHub Actions]
Output format
playwright.config with a desktop Chrome project and a mobile project at 360 pixels wide, retries only in CI, and traces on first retry.
A page object for each screen with its locators and actions.
One test file per journey, each with a happy path and two failure cases, such as a wrong password or an expired coupon.
A fixture that creates and cleans up test users and orders through the API.
A CI workflow that installs browsers, runs the suite and uploads the report on failure.
A list of data-testid attributes to add to the app where no good role or label exists.
playwright testsend to end testinge2e test suitecheckout flow testingtest automationci browser tests
How to run this
Copy the prompt and paste it into Gemini, then set the aspect ratio to 3:4. No reference photo is needed for this one.
The prompt is written in Markdown with each part under its own heading, which is what the copy action hands over. Change one section at a time, keeping the rest intact, so you can tell which change did the work.