Skip to content

fix(e2e): make the suite target the actual wp-env instance - #1358

Merged
Soare-Robert-Daniel merged 1 commit into
developmentfrom
fix/e2e-local-env
Jul 30, 2026
Merged

fix(e2e): make the suite target the actual wp-env instance#1358
Soare-Robert-Daniel merged 1 commit into
developmentfrom
fix/e2e-local-env

Conversation

@Soare-Robert-Daniel

Copy link
Copy Markdown
Contributor

Summary

The e2e suite failed 38/49 locally with no product regression behind it. Three independent environment breakages:

  1. Wrong site under test. @wordpress/scripts' Playwright config hardcodes http://localhost:8889. A checkout that pins another port in .wp-env.override.json (8889 is routinely taken by a second checkout) ran every spec against an unrelated WordPress site — all 38 failures were rest_no_route. The config now resolves WP_ENV_TESTS_PORT.wp-env.override.json8889, and points webServer.port at the same value.
  2. Dead mu-plugin mounts. The two e2e helpers were mapped as individual files. Docker Desktop single-file bind mounts go stale the moment an editor saves atomically, so the container saw 0-byte files and the lazy-render / database-source specs silently ran without their helpers. Mapping the directory (wp-content/mu-pluginstests/e2e/config/mu-plugins, the Gutenberg pattern) fixes it; the files moved accordingly.
  3. Racy assertion in lazy-render. It waited for the data-visualizer-script placeholders to be attached, but the loader legitimately swaps them on the first user interaction — and Chromium fires a real mouseover right after navigation whenever the cursor sits over the page. At failure the chart was already fully rendered. It now asserts lazy mode via the persistent .visualizer-lazy-render container class, which is not transient.

Also gitignores .wp-env.override.json, which was untracked but not ignored — one git add . away from being committed.

CI is unaffected by the port change: with no override file and no env var, it resolves to 8889 exactly as before.

Will affect visual aspect of the product

NO — test/infra only, no plugin code touched.

Test instructions

  • npx wp-env start && npm run test:e2e:playwright → 49 passed, 0 failed.
  • npm run gutenberg:build && npm run d3renderer:build first if you've never built locally (CI already does this).
  • For the flake specifically: npx wp-scripts test-playwright --config tests/e2e/playwright.config.js --grep "Lazy rendered charts" --repeat-each=3 → 6/6.
  • To exercise the port resolution, put {"testsPort": 8890} in .wp-env.override.json and re-run; before this PR every spec fails with rest_no_route.

Check before Pull Request is ready:

  • I have written a test and included it in this PR — n/a, this fixes existing tests
  • I have run all tests and they pass
  • The code passes when running the PHP CodeSniffer — n/a, no PHP changed
  • Code meets WordPress Coding Standards for PHP, HTML, CSS and JS
  • Security and Sanitization requirements have been followed — n/a
  • I have assigned a reviewer or two to review this PR

🤖 Generated with Claude Code

Three unrelated local-env breakages, all of which made the suite fail
without any product regression:

- The port was hardcoded to 8889 by the @wordpress/scripts defaults, so a
  checkout that pins another port in .wp-env.override.json (8889 is often
  taken by a second checkout) ran every spec against an unrelated site.
  Resolve WP_ENV_TESTS_PORT -> .wp-env.override.json -> 8889; CI is
  unchanged as it has neither.
- The two e2e mu-plugins were mapped as individual files. Docker Desktop
  single-file bind mounts go stale when an editor saves atomically, so
  the container saw 0-byte helpers and the lazy-render / database-source
  specs silently ran without them. Map the directory instead.
- lazy-render waited for the `data-visualizer-script` placeholders, but
  the loader legitimately swaps them on the first user interaction, and
  Chromium fires a real `mouseover` right after navigation. Assert lazy
  mode via the persistent container class instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pirate-bot pirate-bot added the pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label) label Jul 30, 2026
@pirate-bot

Copy link
Copy Markdown
Contributor

💂‍♂️ PR Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for ab80f7e is ready 🛎️!

@Soare-Robert-Daniel
Soare-Robert-Daniel merged commit 827e278 into development Jul 30, 2026
6 of 10 checks passed
@Soare-Robert-Daniel
Soare-Robert-Daniel deleted the fix/e2e-local-env branch July 30, 2026 07:44
@pirate-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.0.7 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label) released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants