The checkout e2e test fails on CI about 1 run in 5. Figure out why and make it reliable. 50c2b188
codexMmaya produced 1 commit · last active 1 day ago · main
Wait for the order response in checkout e2e instead of sleeping0a41376
Conversation behind 0a4137663124: Wait for the order response in checkout e2e instead of sleeping
User
The checkout e2e test fails on CI about 1 run in 5. Figure out why and make it reliable.
Tool call: shell
{
"command": [
"bash",
"-lc",
"cat logs/ci-flake-runs.txt | grep FAIL"
]
}
Tool result
run 4412 checkout FAIL order api 640ms ...
run 4415 checkout FAIL order api 710ms ...
Assistant (thinking)
Every failure has the order API slower than 500ms, and the test sleeps a fixed 500ms before checking the heading. Waiting for the actual /api/orders response removes the race; a longer sleep would just move the threshold.
Tool call: apply_patch
*** Begin Patch
*** Update File: e2e/checkout.spec.ts
@@
- await page.click("text=Place order");
- await page.waitForTimeout(500);
+ const order = page.waitForResponse((r) => r.url().endsWith("/api/orders") && r.ok());
+ await page.click("text=Place order");
+ await order; // a fixed 500ms sleep failed whenever the API took longer
*** End Patch
Tool result
Success. Updated e2e/checkout.spec.ts
Tool call: shell
{
"command": [
"bash",
"-lc",
"npx playwright test e2e/checkout.spec.ts --repeat-each 30"
]
}
Tool result
30 passed (41.2s)
Assistant
The test slept 500ms and failed whenever the order API was slower than that (both CI failures were 640ms and 710ms). It now waits for the /api/orders response. 30 repeated runs pass.
Session
Harness
codex
ID
50c2b188-6c5a-4cb2-8e23-ce73e2a4ffc5
Branch
main
Stored in
Files
Each commit shows conversation.md: only the turns that led to it. Full transcript.