Skip to content

E2E: Mock Openverse in image drag-and-drop inserter test - #83842

Merged
talldan merged 1 commit into
trunkfrom
fix/e2e-image-openverse-mock
Sep 30, 2026
Merged

talldan merged 1 commit into
trunkfrom
fix/e2e-image-openverse-mock

Conversation

@manzoorwanijk

Copy link
Copy Markdown
Member

What?

Fixes the Image › can be replaced by dragging-and-dropping images from the inserter e2e test, which has been failing on trunk and every PR since 6fd2f58.

Why?

The test depended on live Openverse. In CI, the browser fetch of the first result (a live.staticflickr.com image) now fails with net::ERR_FAILED, so no upload happens and the image block stays empty. The same URL still loads outside CI, so the host is likely blocking or rate limiting GitHub runners.

How?

The test mocks the Openverse API with page.route and serves two fixture PNGs from test/e2e/assets under a fake openverse.test host. The drag, upload and replace flow under test is unchanged.

Testing Instructions

  1. npm run wp-env-test start
  2. npm run test:e2e -- test/e2e/specs/editor/blocks/image.spec.js -g "dragging-and-dropping images from the inserter" --repeat-each=3
  3. All runs pass, and no request reaches api.openverse.org.

Testing Instructions for Keyboard

N/A, test only.

Use of AI Tools

Claude Code diagnosed the CI failure and wrote the change; I reviewed it.

@manzoorwanijk manzoorwanijk added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Sep 30, 2026
@manzoorwanijk manzoorwanijk self-assigned this Sep 30, 2026
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review September 30, 2026 05:27
@github-actions

github-actions Bot commented Sep 30, 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. 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: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: 0 B

Total Size: 8.24 MB

c591943 Run

🏁 Flaky tests

Show the failures

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.

should update the URL from the last navigation if only varies in the URL fragment in /test/e2e/specs/interactivity/router-navigate.spec.ts, passed after 1 failed attempt.
Error: expect(locator).toHaveText(expected) failed

Locator:  getByTestId('title')
Expected: "Link 1"
Received: "Main"
Timeout:  5000ms

Call log:
  - Expect "toHaveText" getByTestId('title') with timeout 5000ms
  - waiting for getByTestId('title')
    14 × locator resolved to <h2 data-testid="title">Main</h2>
       - unexpected value "Main"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/router-navigate.spec.ts:160:25

c591943 Run

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I was just about to put up something similar. LGTM!

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

Makes sense and is better than skipping the test. IIRC, WP mocks similar requests a lot to make tests reliable.

@manzoorwanijk
manzoorwanijk enabled auto-merge (squash) September 30, 2026 05:35
@talldan
talldan disabled auto-merge September 30, 2026 05:38
@talldan
talldan merged commit 152498d into trunk Sep 30, 2026
89 of 102 checks passed
@talldan
talldan deleted the fix/e2e-image-openverse-mock branch September 30, 2026 05:38
@github-actions github-actions Bot added this to the Gutenberg 24.2 milestone Sep 30, 2026
@talldan

talldan commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

I don't think there's any advantage to waiting for the tests to pass, so I've force merged it.

widoz pushed a commit to widoz/gutenberg that referenced this pull request Oct 2, 2026
…3842)

Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants