Skip to content

test(e2e): wait for the byline save before reading custom fields back - #4684

Merged
swissky merged 2 commits into
emdash-cms:mainfrom
swissky:test/3250-byline-fields-wait-for-save
Nov 6, 2026
Merged

swissky merged 2 commits into
emdash-cms:mainfrom
swissky:test/3250-byline-fields-wait-for-save

Conversation

@swissky

@swissky swissky commented Nov 6, 2026

Copy link
Copy Markdown
Member

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 customFields came back empty. The test now waits for a successful PUT /_emdash/api/admin/bylines/{id} before reading, the same pattern bylines.spec.ts uses for its save.

This takes the test change from the bot's candidate branch bot/fix-3250, without its regenerated e2e/fixture/emdash-env.d.ts and explanatory comment.

Type of change

  • Bug fix
  • Feature (requires an accepted feature plan or RFC)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Your connection to this change

  • I use EmDash and ran into the problem this PR addresses
  • I maintain a tool, dependency, or service that EmDash uses, and this change concerns that integration
  • A Maintainer approved this specific change before I opened the PR

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to their merged design PR: https://github.com/emdash-cms/emdash/pull/...
  • I have included screenshots below if this PR changes the UI

AI assistance disclosure

  • This PR includes AI-generated code or text — model/tool: Claude Opus 5.5

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.route in the test:

  • On main: fails with the issue's error, Expected: "Editor", Received: undefined.
  • With this change: passes.

The changed spec passes 10/10 with --repeat-each=5 on the Node target and 6/6 on EMDASH_E2E_TARGET=cloudflare. pnpm build, pnpm lint:quick, pnpm lint:json (0 diagnostics) and pnpm typecheck pass. In pnpm test, only the workerd test "waits for setup readiness through crash backoff" fails, and it fails the same way on unchanged main.

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d481d14

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added review/needs-review No maintainer or bot review yet size/XS cla: signed labels Nov 6, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@emdashbot emdashbot Bot added review/needs-review No maintainer or bot review yet and removed review/needs-review No maintainer or bot review yet labels Nov 6, 2026
@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Nov 6, 2026
@swissky
swissky merged commit 31d2c01 into emdash-cms:main Nov 6, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: signed review/approved Approved; no new commits since size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky E2E: byline-fields.spec.ts "custom field value round-trips through the API end to end" (Cloudflare target)

2 participants