Repository navigation
test(e2e): wait for the byline save before reading custom fields back - #4684
Conversation
|
There was a problem hiding this comment.
The approach is sound. The test now registers page.waitForResponse before clicking Save and awaits the PUT before reading the byline back over REST. That removes the race described in #3250 and matches the save-wait pattern in bylines.spec.ts. Both reviewers approved with no findings. One checked that the predicate matches the admin client's PUT request, and the other traced the route, handler and repository to confirm the response only returns after the custom-field writes finish. No changeset is needed because only a test changed.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
What does this PR do?
Closes #3250
The byline custom-field E2E test clicked Save and read the byline back over the REST API right away, so on slower targets the read could land before the PUT had written the custom field and
customFieldscame back empty. The test now waits for a successfulPUT /_emdash/api/admin/bylines/{id}before reading, the same patternbylines.spec.tsuses for its save.This takes the test change from the bot's candidate branch
bot/fix-3250, without its regeneratede2e/fixture/emdash-env.d.tsand explanatory comment.Type of change
Your connection to this change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI assistance disclosure
Screenshots / test output
Not applicable (test-only change: no UI, no strings, no published package, so no changeset).
To reproduce the flake deterministically, I delayed the save PUT by 2 seconds with
page.routein the test:main: fails with the issue's error,Expected: "Editor",Received: undefined.The changed spec passes 10/10 with
--repeat-each=5on the Node target and 6/6 onEMDASH_E2E_TARGET=cloudflare.pnpm build,pnpm lint:quick,pnpm lint:json(0 diagnostics) andpnpm typecheckpass. Inpnpm test, only the workerd test "waits for setup readiness through crash backoff" fails, and it fails the same way on unchangedmain.