Repository navigation
Build/Test Tools: Run the Media Library grid and media modal E2E specs in parallel. - #15903
adimoldovan wants to merge 4 commits into
Conversation
`media-new-client-side-upload.test.js` deleted all media and all posts after each test, so it had to run in the serial project. The new `attachments` fixture deletes only the attachments that a test uploads or tracks. The spec now reads each attachment by its own id, not the newest one, and creates its post with `postFactory`. See #66392.
Core sends `X-WP-Upload-Attachment-ID` after it saves the attachment and before it makes the sub-sizes. Reading it tracks an upload that fails with a 500 after the save, which the old check skipped. The header arrives before the body, so the id is tracked before teardown can run. See #66392.
…s in parallel. `media-library-client-side-upload.test.js` and `media-modal-client-side-upload.test.js` deleted all media after each test, so they had to run in the serial project. Each test now gives its uploads a unique name, finds its tiles by that name, and reads its attachments by id. The `attachments` fixture deletes only what the test uploaded. The modal spec creates its posts with `postFactory`. `trackUploads()` moves to `utils/media-pipeline.js`, so all three media specs share it. See #66392.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the changes isolating media-upload E2E tests for parallel execution.
No open issues 🎉
What changed in this PR
Builds on #15896 to make the Media Library grid and media modal upload E2E specs safe to run in parallel on a shared WordPress test site.
Changes:
- Uses unique upload filenames and response-provided attachment IDs to avoid matching other tests’ media.
- Replaces global cleanup with fixture-managed attachments and posts, and opens modal tests on existing posts.
- Shares upload-tracking utilities across all three client-side upload specs and moves the grid and modal specs into the parallel project.
| File | Description |
|---|---|
tests/e2e/utils/media-pipeline.js |
Adds unique-file and title helpers and centralizes upload tracking. |
tests/e2e/specs/media-new-client-side-upload.test.js |
Uses scoped fixtures, attachment IDs, and shared upload tracking. |
tests/e2e/specs/media-modal-client-side-upload.test.js |
Isolates uploads and uses fixture-created posts for modal tests. |
tests/e2e/specs/media-library-client-side-upload.test.js |
Scopes tile lookups, attachment assertions, and cleanup to each test. |
tests/e2e/README.md |
Documents attachment cleanup and shared-fixture placement. |
tests/e2e/playwright.config.js |
Removes client-side upload specs from the serial list. |
tests/e2e/fixtures/index.js |
Registers the attachments fixture. |
tests/e2e/fixtures/attachment.js |
Adds per-test attachment tracking and cleanup. |
Review effort: Balanced
|
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:
|
…al-parallel # Conflicts: # tests/e2e/fixtures/attachment.js # tests/e2e/playwright.config.js
lancewillett
left a comment
There was a problem hiding this comment.
The parallel migration is supported by the existing upload tests: with the proposed parallel configuration held fixed, two workers and three repetitions produced 2 failures/4 passes using the base specs, and 6 passes using this head, without retries. This comparison exercises the migration; it does not indicate a failure under the original serial configuration.
The changes preserve the upload assertions while giving each test its own attachment identity and cleanup. All four E2E CI jobs and type checking passed, and the refreshed Copilot review has no open issues.
AI review · gpt-6
Use unique upload names and per-test attachment and post cleanup. Developed in: #15903 Props adrianmoldovanwp. See #66392. git-svn-id: https://develop.svn.wordpress.org/trunk@65403 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #15903 landed in https://core.trac.wordpress.org/changeset/65403 |
Use unique upload names and per-test attachment and post cleanup. Developed in: WordPress/wordpress-develop#15903 Props adrianmoldovanwp. See #66392. Built from https://develop.svn.wordpress.org/trunk@65403 git-svn-id: http://core.svn.wordpress.org/trunk@64542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/66392
media-library-client-side-upload.test.jsandmedia-modal-client-side-upload.test.jsdeleted all media after each test, so they had to run in theserialproject. All their uploads also had the same file name, so a test found its tile by a name that other specs' uploads share. Inparallel, the cleanup would delete other workers' files, and the tile lookups and the "newest attachment" reads could match another spec's upload.Each test now:
X-WP-Upload-Attachment-IDheader;attachmentsfixture delete only what it uploaded.The modal spec creates its posts with
postFactoryand opens them onpost.php, so its tests no longer run onpost-new.php. Both specs move toparallel.trackUploads()moves totests/e2e/utils/media-pipeline.js, so the three client-side upload specs share it. A newuniqueFile()helper gives a test file a unique name:Testing Instructions
npm run env:cli -- post list --post_type=attachment --format=countand note the number.npm run test:e2e -- media-library-client-side-upload media-modal-client-side-upload. All 24 tests pass.npm run test:e2e -- --project=parallel --shuffle --repeat-each=2. Every run of the two specs passes.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.