Tests: Preload spec — track query strings and use an existing draft#78343
Conversation
Two related changes:
- Track the full query string when capturing REST routes so the spec
distinguishes (e.g.) `templates/lookup?slug=front-page` from
`templates/lookup?slug=single-post`. Drop the always-present `_locale`
arg since it carries no signal.
- Use `requestUtils.createPost` + `admin.editPost` instead of
`admin.createNewPost`. The REST-created draft has a known post ID up
front so it can be interpolated into the expected
`comments?post=…` / `posts/{id}` URLs without normalising them to a
placeholder. (Adds `POST /wp/v2/posts/{id}` to the expected list, an
initial autosave fired by the editor when opening the draft.)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 7.97 MB ℹ️ View Unchanged
|
- Move the site-editor preload coverage to `test/e2e/specs/site-editor/preload.spec.js`, keeping the post-editor spec focused on the post editor. - Restructure the existing site-editor "root" test to use the same pattern as the new tests: wait for any block to render in the canvas iframe, then assert against the full captured request set (rather than only what fires before iframe-blob). - Add a "Editing a page" test that creates a page via REST, opens it via `?p=/page&postId=…&canvas=edit`, and asserts the resulting startup REST traffic. - Share `recordRequests` between tests; both specs now capture full query strings (minus `_locale`). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Move both preload specs into `test/e2e/specs/preload/` and extract the duplicated `recordRequests` helper into a sibling module: - `test/e2e/specs/preload/post-editor.spec.js` (was `editor/various/preload.spec.js`) - `test/e2e/specs/preload/site-editor.spec.js` (was `site-editor/preload.spec.js`) - `test/e2e/specs/preload/record-requests.js` Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The post-editor's templates/lookup currently fires with `slug=front-page` on trunk (the unconditional `getHomePage()` call in `getTemplateId`). My local was running with #78338's fix applied which changes this to `slug=single-post`, but trunk's behaviour is still `front-page`. Match trunk for now; #78338 will flip this to `single-post`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Flaky tests detected in aa4349c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25923687379
|
Best reviewed without whitespace.
What, Why & How
Track query strings when capturing REST routes, so e.g.
templates/lookup?slug=front-pageis no longer collapsed withtemplates/lookup?slug=single-post._localeis stripped (added uniformly, no signal).Use
requestUtils.createPost+admin.editPostin the post-editor spec. Gives us the post ID up front so it can be interpolated into expected URLs directly. Adds one expected entry —POST /wp/v2/posts/{id}— the initial autosave the editor fires when opening the draft.Group both preload specs under
test/e2e/specs/preload/and extract the sharedrecordRequestshelper into a sibling module.Restructure the site-editor "root" test to use the same wait-for-block + assert-full-captured-set pattern as the new tests, and add an "Editing a page" test that opens a REST-created page through
?p=/page&postId=…&canvas=edit.Testing Instructions
npm run test:e2e -- test/e2e/specs/preload/— both spec files pass.Use of AI Tools
Authored by Claude (Opus 4.7) in collaboration with @ellatrix.