Skip to content

Simplify playlist block edit tests - #81759

Open
scruffian wants to merge 1 commit into
trunkfrom
scruffian/fix/playlist-mocks
Open

scruffian wants to merge 1 commit into
trunkfrom
scruffian/fix/playlist-mocks

Conversation

@scruffian

@scruffian scruffian commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What?

Refactors Playlist and Playlist Track unit tests to use real block-editor components and stores instead of mocks.

Why?

The previous tests mocked too much of the editor environment, which made them unrepresentative of how the block actually behaves.

How?

The tests now use real components, and use a small editor.MediaUpload filter only to provide deterministic media selections.

Testing Instructions

  1. Run npm run test:unit packages/block-library/src/playlist/test/edit-component.js packages/block-library/src/playlist-track/test/edit.js -- --runInBand.
  2. Run npm run lint:js -- packages/block-library/src/playlist/test/edit-component.js packages/block-library/src/playlist-track/test/edit.js.

Testing Instructions for Keyboard

Not applicable; this PR only changes test code.

Screenshots or screencast

Not applicable.

Use of AI Tools

AI assistance was used to inspect the existing tests, refactor them, and run validation; the resulting changes were reviewed before submission.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Aug 17, 2026
@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 7.73 MB

compressed-size-action

@scruffian
scruffian force-pushed the scruffian/fix/playlist-mocks branch 2 times, most recently from d1b2aa2 to cfca7bd Compare August 17, 2026 18:33
@github-actions

Copy link
Copy Markdown

Flaky tests detected in cfca7bd.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/32055498135
📝 Reported tests:

should allow user to add and remove multiple local font files in /test/e2e/specs/admin/font-library.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByLabel('Exo 2 Semi-bold Italic')
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" with timeout 5000ms
  - waiting for getByLabel('Exo 2 Semi-bold Italic')

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/admin/font-library.spec.js:58:6

@scruffian
scruffian marked this pull request as ready for review August 17, 2026 21:12
@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. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: scruffian <scruffian@git.wordpress.org>

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

@scruffian scruffian self-assigned this Aug 17, 2026
@scruffian
scruffian requested a review from jeryj August 17, 2026 21:20
@scruffian scruffian added the [Type] Bug An existing feature does not function as intended label Aug 17, 2026
@scruffian
scruffian force-pushed the scruffian/fix/playlist-mocks branch from cfca7bd to d1946c4 Compare August 17, 2026 21:26
@jeryj
jeryj force-pushed the scruffian/fix/playlist-mocks branch from d1946c4 to 81748e5 Compare September 15, 2026 15:36

This branch has not been deployed

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

Labels

[Block] Playlist [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant