Skip to content

Build/Test Tools: Run the post list E2E specs in parallel. - #15901

Open
adimoldovan wants to merge 5 commits into
WordPress:trunkfrom
adimoldovan:e2e/post-list-parallel
Open

adimoldovan wants to merge 5 commits into
WordPress:trunkfrom
adimoldovan:e2e/post-list-parallel

Conversation

@adimoldovan

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/66392

cache-control-headers-directives.test.js, dashboard.test.js, edit-posts.test.js and empty-trash-restore-trashed-posts.test.js ran in the serial project. 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 parallel project.

  • The edit-posts tests create posts with postFactory and a unique title, then search the post list for that title.
  • The Quick Draft tests sign in as their own user. The Recent Drafts widget and the post list (edit.php?author=<id>) then show only that user's drafts.
  • The two Empty Trash tests move to a new empty-trash.test.js, which stays in serial. Emptying the trash deletes every trashed post, so no scope can make these tests safe in parallel.

userFactory teardown 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

  1. Run npm run test:e2e -- cache-control edit-posts empty-trash dashboard. All 22 tests pass.
  2. Run npm run test:e2e -- --project=serial empty-trash. Both tests pass.
  3. Run npm run test:e2e -- --project=parallel --shuffle --repeat-each=3 cache-control edit-posts empty-trash-restore dashboard. All tests pass.
  4. Run npm run env:cli -- post list --post_type=post --post_status=any,trash --fields=post_title,post_status. No post has Quick Draft test title or 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.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Comment thread tests/e2e/fixtures/user.js Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the changes isolating post-related end-to-end tests for parallel execution.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@adimoldovan
adimoldovan marked this pull request as ready for review November 11, 2026 14:15
@adimoldovan
adimoldovan requested a review from a team November 11, 2026 14:15
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

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:

Props adrianmoldovanwp, lancewillett.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@adimoldovan

Copy link
Copy Markdown
Author

Renamed in 55eb096.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants