Skip to content

Build/Test Tools: Run tests in one E2E spec file in parallel. - #15929

Closed
adimoldovan wants to merge 2 commits into
WordPress:trunkfrom
adimoldovan:e2e/fully-parallel
Closed

adimoldovan wants to merge 2 commits into
WordPress:trunkfrom
adimoldovan:e2e/fully-parallel

Conversation

@adimoldovan

Copy link
Copy Markdown

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

The parallel project ran the tests in one spec file in order, so only tests in different files ran at the same time. This PR turns on fullyParallel for that project, so tests in the same file also run at the same time. The serial and all projects do not change.

Two specs had tests that broke each other when they ran at the same time:

  • classic-menus.test.js deleted every menu before each test. Each test now creates menus with a unique name and deletes only those. Both tests hold a new NAV_MENU_LOCATIONS lock, because all menu locations are one shared theme setting. Assigning a menu and deleting any menu both write it.
  • In privacy.test.js, two runs of the privacy page test both wrote the page_for_privacy_policy setting. One run then read the other run's page ID. The test now holds a new PRIVACY_POLICY_PAGE lock, because one setting cannot be scoped to a test.

The README now says that tests in one file can also collide.

Testing Instructions

  1. Run npm run test:e2e -- --project=parallel --shuffle --repeat-each=3. All tests pass.
  2. Run grep -rn "{ lock:" tests/e2e/specs/. Each lock uses a constant from tests/e2e/utils/locks.js.

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.

Turn on `fullyParallel` for the `parallel` project, so Playwright can run tests from the same file at the same time.

Scope the classic menus to each test. Lock the tests that write the theme's menu locations or the privacy policy page setting, as this data cannot be scoped.

See #66392.
@adimoldovan adimoldovan self-assigned this Nov 12, 2026
@adimoldovan
adimoldovan marked this pull request as ready for review November 12, 2026 19:03
@adimoldovan
adimoldovan requested a review from a team November 12, 2026 19:03
@github-actions

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.

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 or WordPress.org 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.

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 remain for the change enabling same-file concurrency in the E2E parallel project.

No open issues 🎉

What changed in this PR

Enables tests within the same spec file to run concurrently in the E2E suite’s parallel project, while leaving serial and all unchanged.

Changes:

  • Enables fullyParallel for the parallel project.
  • Isolates classic-menu test data and adds locks for shared menu-location and privacy-page settings.
  • Updates guidance on same-file test collisions and describe-group locks.
File Description
tests/​e2e/​utils/​locks.js Adds menu-location and privacy-page lock constants.
tests/​e2e/​specs/​privacy.test.js Locks tests that change the privacy-page setting.
tests/​e2e/​specs/​classic-menus.test.js Uses unique menu names, scoped cleanup, and a menu-location lock.
tests/​e2e/​README.md Documents same-file concurrency and lock behavior.
tests/​e2e/​playwright.config.js Enables full parallelism in the parallel project.

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.

The targeted menu/privacy runs passed all 12 executions with four workers, three repetitions and zero retries. Scoped menu cleanup preserved an unrelated menu and its secondary location. Removing only the privacy lock reproduced competing-setting failures; restoring it passed.

The configuration keeps the serial and all projects unchanged, and the existing shared-setting locks cover the affected writes. All four E2E CI jobs passed, with no reported retries. No blockers found.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Nov 12, 2026
Enable `fullyParallel` for the parallel project. Scope classic menu fixtures to each test and lock shared menu-location and privacy-page settings.

Developed in: #15929

Props adrianmoldovanwp.
See #66392.


git-svn-id: https://develop.svn.wordpress.org/trunk@65439 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 12, 2026
Enable `fullyParallel` for the parallel project. Scope classic menu fixtures to each test and lock shared menu-location and privacy-page settings.

Developed in: WordPress/wordpress-develop#15929

Props adrianmoldovanwp.
See #66392.

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


git-svn-id: http://core.svn.wordpress.org/trunk@64578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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