Skip to content

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

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

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

Conversation

@adimoldovan

@adimoldovan adimoldovan commented Nov 11, 2026 •

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 in these specs 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 empty-list test now searches for a random UUID, so it checks an empty search result instead of an empty site.
  • 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.

Each Quick Draft test force-deletes its user's drafts when it ends. Without this, deleting the user would move the drafts to the trash.

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

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

Copy link
Copy Markdown
Author

Renamed in 55eb096.

The shared user fixture keeps its trunk teardown. The Quick Draft tests now force-delete their user's drafts, which user deletion would move to 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.

🟢 Approval recommended

No active review issues are reported for the E2E test-isolation and parallelization changes.

No open issues 🎉

Review effort: Balanced

@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.

Thanks for narrowing saved-draft cleanup to Quick Draft and restoring the shared user fixture. That addresses my remaining concern.

The 20 affected parallel tests passed locally with four workers and zero retries. The existing Quick Draft comparison confirmed that its saved draft is removed while unrelated content survives; failure probes confirmed cleanup errors remain visible. The two moved Empty Trash tests were not rerun locally, but both serial CI jobs passed. All four E2E CI jobs and the refreshed Copilot review are clear.

AI review · gpt-6

@lancewillett lancewillett moved this from In review to Ready in WordPress Project Build Tooling Nov 12, 2026
wporg-sync pushed a commit that referenced this pull request Nov 12, 2026
Scope post fixtures and list assertions to each test, and keep Empty Trash tests serial. Clean up saved drafts within Quick Draft's own tests.

Developed in: #15901

Props adrianmoldovanwp.
See #66392.


git-svn-id: https://develop.svn.wordpress.org/trunk@65412 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 12, 2026
Scope post fixtures and list assertions to each test, and keep Empty Trash tests serial. Clean up saved drafts within Quick Draft's own tests.

Developed in: WordPress/wordpress-develop#15901

Props adrianmoldovanwp.
See #66392.

Built from https://develop.svn.wordpress.org/trunk@65412


git-svn-id: http://core.svn.wordpress.org/trunk@64551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@lancewillett

Copy link
Copy Markdown
Member

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants