Repository navigation
Build/Test Tools: Run the post list E2E specs in parallel. - #15901
adimoldovan wants to merge 5 commits into
Conversation
Four specs deleted every post or read the whole post list, so they ran in the serial project. Each test now creates, finds and deletes only its own posts. The Empty Trash tests move to their own serial spec, because emptying the trash deletes every trashed post. `userFactory` teardown now force-deletes all of the user's posts, not only auto-drafts, so Quick Draft posts do not stay in the trash. See #66392.
There was a problem hiding this comment.
🟡 Changes recommended
Fixture teardown deletes only the first 100 posts, so users with more posts leave content behind after deletion, violating the cleanup guarantee.
1 open issue
What changed in this PR
This PR prepares post-list E2E specs for parallel execution by isolating test data and keeping destructive, site-wide trash operations in the serial project.
Changes:
- Replace shared post cleanup with fixture-created posts and title-, ID-, or author-scoped checks.
- Move four specs to the parallel project and extract the Empty Trash group into a serial-only spec.
- Expand user-fixture cleanup to force-delete users’ posts and update the documentation.
| File | Description |
|---|---|
tests/e2e/specs/empty-trash.test.js |
Holds the extracted serial-only trash tests. |
tests/e2e/specs/empty-trash-restore-trashed-posts.test.js |
Removes the group requiring global post cleanup. |
tests/e2e/specs/edit-posts.test.js |
Uses fixture-owned posts and scoped list checks. |
tests/e2e/specs/dashboard.test.js |
Isolates Quick Draft tests by user and author. |
tests/e2e/specs/cache-control-headers-directives.test.js |
Uses a fixture-created post and its actual URL. |
tests/e2e/README.md |
Documents expanded user-fixture cleanup. |
tests/e2e/playwright.config.js |
Updates serial exclusions to enable parallel execution. |
tests/e2e/fixtures/user.js |
Broadens post cleanup before deleting fixture users. |
Review effort: Balanced
…first 100. See #66392.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
…llel # Conflicts: # tests/e2e/README.md
lancewillett
left a comment
There was a problem hiding this comment.
The scoped post reads and serial Empty Trash split look sound. One evidence question remains on the broader user-fixture cleanup, noted inline.
Small naming follow-up: the first edit-posts test now checks empty search results rather than an empty site; please update its name accordingly.
AI review · gpt-6
| @@ -43,18 +43,26 @@ async function findUserId( requestUtils, username ) { | |||
| } | |||
|
|
|||
| async function deleteUser( requestUtils, id ) { | |||
There was a problem hiding this comment.
Could you identify an existing test affected by the saved drafts left in trash, or separate this broader cleanup from the parallelization change?
I ran the existing Quick Draft “Title and Content” test twice, holding the new spec fixed and changing only user.js. Both runs passed. The old fixture left the saved draft in trash; this fixture removed it. That verifies the cleanup behavior, but not an isolation failure: the new readers use their own author IDs, and Empty Trash still clears posts before each test. I would like to establish that benefit before expanding the shared teardown.
No new test is needed solely to justify the cleanup.
AI review · gpt-6
There was a problem hiding this comment.
No existing test fails because of them. This PR creates the leak, though. Before, the Quick Draft tests ran as admin and called deleteAllPosts() before each test, which cleared the drafts from the last run. Now each test runs as its own user without that call, and deleting the user moves its saved drafts to the trash. Only the serial Empty Trash spec clears them, so every parallel run would add more. The cleanup replaces the deleteAllPosts() that this PR removes, so I would keep the two together.
There was a problem hiding this comment.
Thanks, that explains why the cleanup belongs with the Quick Draft changes. Our local comparison confirms that it removes the saved draft left in trash by user deletion.
One correction: global setup also calls deleteAllPosts() before each run. The pinned helper includes trash, although it fetches only 100 posts. So accumulation across ordinary runs is not yet established.
Could we scope the saved-draft cleanup to Quick Draft, rather than broadening teardown for every user-fixture consumer? That would preserve cleanup of the content this migration creates without relying on an unproven broader isolation benefit. The test-name correction looks good.
AI review · gpt-6
…llel # Conflicts: # tests/e2e/playwright.config.js
|
Renamed in 55eb096. |

Trac ticket: https://core.trac.wordpress.org/ticket/66392
cache-control-headers-directives.test.js,dashboard.test.js,edit-posts.test.jsandempty-trash-restore-trashed-posts.test.jsran in theserialproject. Their tests deleted every post, or checked the whole post list, so a test on another worker could break them.Each test that needs posts now creates its own, finds them by link, unique title or author, and deletes them when it ends. The specs move to the
parallelproject.postFactoryand a unique title, then search the post list for that title.edit.php?author=<id>) then show only that user's drafts.empty-trash.test.js, which stays inserial. Emptying the trash deletes every trashed post, so no scope can make these tests safe in parallel.userFactoryteardown now force-deletes all of the user's posts before it deletes the user. Before, it deleted only auto-drafts, and WordPress moved the user's Quick Drafts to the trash, where they stayed.Testing Instructions
npm run test:e2e -- cache-control edit-posts empty-trash dashboard. All 22 tests pass.npm run test:e2e -- --project=serial empty-trash. Both tests pass.npm run test:e2e -- --project=parallel --shuffle --repeat-each=3 cache-control edit-posts empty-trash-restore dashboard. All tests pass.npm run env:cli -- post list --post_type=post --post_status=any,trash --fields=post_title,post_status. No post hasQuick Draft test titleor a title from these specs followed by a UUID.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Code change, test runs and this description.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.