Write an end-to-end test for one user flow
Writes one end-to-end browser test for a user flow in your own app, with stable selectors, clear waits and a comment per step.
Task:
Write one end-to-end browser test for the user flow below, in [test framework] and [language].
Context:
The flow is [user flow, for example sign up, add to cart, check out]. It runs against my own app at [local or staging address]. Test accounts and data are mine and are created for tests only.
Rules:
- Read the page code or markup I paste below first and use selectors that survive a redesign, such as roles, labels or test ids.
- Wait for visible states instead of fixed pauses.
- Assert at least one visible result at the end of the flow.
- Never put passwords, tokens or keys in the code. Read them from environment variables and tell me which names you used.
- If the markup does not show a selector you need, say which element is missing instead of guessing a selector.
Result:
One code block with the complete test and a one-line comment above each step. After the code, a list of at most four things I must set up before it runs.
Material:
[paste the relevant page markup or component code here]