Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Nov 13, 2025

What

Configure Playwright to read wp-env port and host from .wp-env.json or environment variables.

Why

  • Playwright was hardcoded to connect to port 8889 instead of the actual wp-env test port, which causes conflicts if you are running multiple projects in parallel (like Gutenberg).
  • BaseConfig's webServer was attempting to start wp-env automatically, which is unnecessary since GH actions already to it.

How

  • Reading port and host from environment variables (WP_BASE_URL, WP_ENV_TESTS_PORT, WP_ENV_TESTS_HOST) if set
  • Otherwise, reading testsPort and testsHost from .wp-env.json file
  • Overriding use.baseURL with the configured URL
  • Setting webServer: undefined to disable automatic server startup

Testing Instructions

Using .wp-env.json

  1. Change the testsPort in wp-env and start it
  2. Run tests: npm run test:e2e

Using environment variables

  1. Set custom URL: WP_BASE_URL=http://localhost:9999 npm run test:e2e

@github-actions
Copy link

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

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

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 1.17%. Comparing base (bf37e58) to head (3b478a2).
⚠️ Report is 3 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##             trunk    #238   +/-   ##
=======================================
  Coverage     1.17%   1.17%           
  Complexity    4416    4416           
=======================================
  Files          261     261           
  Lines        27017   27017           
=======================================
  Hits           318     318           
  Misses       26699   26699           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor priethor merged commit e870b55 into trunk Nov 13, 2025
9 checks passed
@priethor priethor deleted the tests/playwright-support-for-wpenv-settings branch November 26, 2025 17:46
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.

2 participants