Skip to content

Closes #1346: Respect WP_ENV_PORT in dev-start.sh and test-e2e.sh - #1354

Merged
remyperona merged 1 commit into
developfrom
fix/1346-wp-env-port-scripts
Nov 20, 2026
Merged

remyperona merged 1 commit into
developfrom
fix/1346-wp-env-port-scripts

Conversation

@remyperona

Copy link
Copy Markdown
Contributor

Description

Closes #1346

Follow-up to #1351, which made bin/dev-up.sh print the port wp-env really runs on. Two local-dev scripts still hardcoded 8888:

  • bin/dev-start.sh printed http://localhost:8888 Site/Admin URLs even when started with WP_ENV_PORT=8950.
  • bin/test-e2e.sh checked that wp-env was reachable at http://localhost:8888. With a custom port, the check failed. Even without the check, Playwright would have run against the default IMAGIFY_BASE_URL (http://localhost:8888), which is the wrong site.

Developers only see a difference when they run wp-env on a non-default port. Without WP_ENV_PORT, both scripts behave as before.

Type of change

  • Chore

Detailed scenario

What was tested

Manual runs. Another wp-env was already using 8888 on the test machine, so docker, npx, composer and npm were replaced on PATH by stand-ins that do nothing. The scripts' own logic ran for real; no containers were started and nothing was installed.

Run Result
bin/dev-start.sh --no-seed Site: http://localhost:8888, Admin: http://localhost:8888/wp-admin (unchanged)
WP_ENV_PORT=8950 bin/dev-start.sh --no-seed Site: http://localhost:8950, Admin: http://localhost:8950/wp-admin
bin/dev-start.sh --help prints the header exactly, ending with the new override lines
bin/test-e2e.sh specs/smoke (8888 up) check passes; Playwright gets IMAGIFY_BASE_URL=http://localhost:8888
WP_ENV_PORT=8950 bin/test-e2e.sh (nothing on 8950) exits 1: wp-env doesn't seem to be running on http://localhost:8950
WP_ENV_PORT=8895 bin/test-e2e.sh (8895 up) check passes; Playwright gets IMAGIFY_BASE_URL=http://localhost:8895
WP_ENV_PORT=8950 IMAGIFY_BASE_URL=http://localhost:8888 bin/test-e2e.sh explicit IMAGIFY_BASE_URL wins: 8888

bash -n passes on both scripts. shellcheck was not available.

How to test

  1. Start wp-env on another port: WP_ENV_PORT=8950 WP_ENV_TESTS_PORT=8951 bin/dev-start.sh --no-seed. The closing message must show http://localhost:8950.
  2. Run WP_ENV_PORT=8950 bin/test-e2e.sh specs/smoke. The suite must run against port 8950.
  3. Without WP_ENV_PORT, both scripts must use 8888 as before.

Affected Features & Quality Assurance Scope

Local development scripts only (bin/dev-start.sh, bin/test-e2e.sh) and docs/E2E_TESTING.md. No plugin code. CI does not call these scripts.

Technical description

Documentation

  • bin/dev-start.sh: same pattern as bin/dev-up.sh in Closes #1346: Print the actual wp-env port in dev-up.sh #1351. It sets WP_ENV_PORT="${WP_ENV_PORT:-8888}" once, without exporting it, because wp-env reads the variable on its own. The closing URLs use it. The header documents the override, and the --help line range now covers the whole header.
  • bin/test-e2e.sh: Playwright reads its base URL from IMAGIFY_BASE_URL (Tests/e2e/playwright.config.ts). When that variable is unset, the script now builds it from WP_ENV_PORT (default 8888) and exports it, so the reachability check and the Playwright run use the same URL. If IMAGIFY_BASE_URL is set, it is used unchanged.
  • docs/E2E_TESTING.md: adds WP_ENV_PORT to the environment-variables table.

New dependencies

None.

Risks

None for users. Without WP_ENV_PORT and IMAGIFY_BASE_URL, the default behaviour is the same as before.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

There are no automated tests: the repo has no test harness for its shell scripts. The changes were verified with the manual runs above.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.)
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

🤖 Generated with Claude Code

dev-start.sh prints the real Site/Admin port, and test-e2e.sh builds and exports IMAGIFY_BASE_URL from WP_ENV_PORT, so the reachability check and Playwright use the same site. The default stays 8888.

Refs #1346

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage

Metric Results
Coverage variation Report missing for 89848811
Diff coverage ✅ ∅ diff coverage (50.00%)

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (8984881) Report Missing Report Missing Report Missing
Head commit (6b86404) 20602 2948 14.31%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1354) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@remyperona remyperona self-assigned this Nov 20, 2026
@remyperona
remyperona marked this pull request as ready for review November 20, 2026 18:43
@remyperona
remyperona added this pull request to the merge queue Nov 20, 2026
Merged via the queue into develop with commit de447fc Nov 20, 2026
14 checks passed
@remyperona
remyperona deleted the fix/1346-wp-env-port-scripts branch November 20, 2026 18:44
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.

Print the actual wp-env port in bin/dev-up.sh closing message

1 participant