Skip to content

Repair wp/6.3 branch Actions: Fix flaky Openverse image drag-and-drop e2e test - #551

Closed
desrosj wants to merge 1 commit into
fix-actions-6.3/fix-activate-theme-navigation-racefrom
fix-actions-6.3/fix-flaky-openverse-image-drag-and-drop-test
Closed

desrosj wants to merge 1 commit into
fix-actions-6.3/fix-activate-theme-navigation-racefrom
fix-actions-6.3/fix-flaky-openverse-image-drag-and-drop-test

Conversation

@desrosj

@desrosj desrosj commented Sep 28, 2026

Copy link
Copy Markdown
Owner

What?

Mocks the Openverse API in test/e2e/specs/editor/blocks/image.spec.js's "can be replaced by dragging-and-dropping images from the inserter" test, using page.route(): both the search request to api.openverse.engineering and the image files its results point to are served locally, from a fixture image already in test/e2e/assets.

Why?

The test drags an image from the inserter's Openverse media category, which fetched its results from the real, external Openverse API. That made the test depend on a third-party service's availability and response time, and it failed intermittently with TimeoutError: locator.dragTo: Timeout 10000ms exceeded when the results were slow or missing. Mocking the request the same way test/e2e/specs/editor/plugins/block-directory.spec.js already mocks the block directory API removes the network dependency.

This replaces #352 with the same change on a branch named for the specific problem it fixes.

Use of AI Tools

This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.

🤖 Generated with Claude Code

@desrosj desrosj self-assigned this Sep 28, 2026
@desrosj
desrosj added this pull request to stack #552 September 28, 2026 15:25
@desrosj
desrosj removed this pull request from stack #552 September 28, 2026 18:41
@desrosj
desrosj changed the base branch from fix-actions-6.3/fix-activate-theme-navigation-race to wp/6.3 September 28, 2026 18:43
@desrosj
desrosj force-pushed the fix-actions-6.3/fix-flaky-openverse-image-drag-and-drop-test branch from b3bfb2c to 46bcdea Compare September 28, 2026 18:45
@desrosj
desrosj changed the base branch from wp/6.3 to fix-actions-6.3/fix-activate-theme-navigation-race September 28, 2026 18:46
@desrosj
desrosj added this pull request to stack #563 September 28, 2026 18:46
`test/e2e/specs/editor/blocks/image.spec.js`'s "can be replaced by
dragging-and-dropping images from the inserter" test opens the
inserter's Openverse media tab and drags real search results onto an
image block. `packages/editor/src/components/media-categories/index.js`'s
Openverse `fetch()` calls the real, external
`https://api.openverse.engineering/v1/images/` API directly from the
browser, and `packages/block-editor/src/components/inserter/media-tab/media-preview.js`'s
`onMediaInsert()` makes a second real `window.fetch()` against the
dragged item's own URL to download the full-size image for upload to
the media library on drop. Depending on two live third-party network
calls makes `dragTo()` unreliable in CI, and ties test success to an
external service's uptime.

Mock both requests with `page.route()`, following this file's own
existing `page.route()` precedent (`test/e2e/specs/editor/plugins/nonce.spec.js`):
the search request is fulfilled with two fake Openverse-shaped
results, and the two fake image URLs those results reference are
fulfilled with the local `10x10_e2e_test_image_z9T8jK.png` fixture
already used elsewhere in this same file. Both mocked routes include
an `Access-Control-Allow-Origin: *` header, since this test's code
makes real cross-origin `fetch()` calls against both endpoints, which
the browser would otherwise block. The test no longer touches any live
external host.
@desrosj
desrosj removed this pull request from stack #563 September 28, 2026 19:03
@desrosj
desrosj changed the base branch from fix-actions-6.3/fix-activate-theme-navigation-race to wp/6.3 September 28, 2026 19:03
@desrosj
desrosj force-pushed the fix-actions-6.3/fix-flaky-openverse-image-drag-and-drop-test branch from 46bcdea to 13d4970 Compare September 28, 2026 19:03
@desrosj
desrosj changed the base branch from wp/6.3 to fix-actions-6.3/fix-activate-theme-navigation-race September 28, 2026 19:04
@desrosj
desrosj added this pull request to stack #566 September 28, 2026 19:04
@desrosj
desrosj marked this pull request as ready for review September 28, 2026 19:18
@desrosj

desrosj commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

Moved to WordPress#83714. The branch is left in place.

@desrosj desrosj closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant