Skip to content

CLI test: add HTTP response check for created site#4000

Open
gavande1 wants to merge 4 commits into
trunkfrom
stu-1867-verify-http-200-create-e2e
Open

CLI test: add HTTP response check for created site#4000
gavande1 wants to merge 4 commits into
trunkfrom
stu-1867-verify-http-200-create-e2e

Conversation

@gavande1

@gavande1 gavande1 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude was used to write the code and explore the solution. The author reviewed it manually.

Proposed Changes

Follow-up to the CLI e2e tests in #3947. The site create test only asserted persisted state on disk. This adds a real check: after creating and starting a site, the test requests its homepage and confirms a 200 with HTML, so it now fails if a created site cannot be served.

This does not cover the custom-domain and HTTPS case, which cannot run in an isolated, headless test. See the discussion in #3947.

Testing Instructions

  1. Build the CLI with npm run cli:build.
  2. Run npm test -- apps/cli/commands/site/tests/create.e2e.test.ts --tagsFilter='e2e' and confirm both tests pass.
  3. Run the same with --tagsFilter='!e2e' and confirm the tests are skipped, so the fast suite is unaffected.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@gavande1 gavande1 changed the title Verify the created site serves its homepage in the CLI e2e test CLI test: add HTTP response check for created site Jun 30, 2026
@gavande1 gavande1 requested a review from gcsecsey June 30, 2026 08:48
@gavande1 gavande1 marked this pull request as ready for review June 30, 2026 08:49
@wpmobilebot

wpmobilebot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 44363d0 vs trunk

app-size

Metric trunk 44363d0 Diff Change
App Size (Mac) 1316.77 MB 1316.77 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 44363d0 Diff Change
load 1087 ms 1104 ms +17 ms ⚪ 0.0%

site-startup

Metric trunk 44363d0 Diff Change
siteCreation 6499 ms 6504 ms +5 ms ⚪ 0.0%
siteStartup 1865 ms 1862 ms 3 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@gavande1 gavande1 requested a review from fredrikekelund July 1, 2026 05:36
Comment on lines +46 to +57
[
'site',
'create',
'--name',
siteName,
'--path',
sitePath,
'--wp',
'latest',
'--skip-browser',
'--skip-log-details',
],

@gcsecsey gcsecsey Jul 1, 2026

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.

I got this flagged by Claude:

Because this command no longer passes --runtime sandbox, site create uses the CLI default native runtime. The e2e harness only provisions bundled WordPress, not php-bin, so this test can download PHP or fail in offline/release environments instead of staying hermetic like the other CLI e2e tests.

As a temporary measure, we could adjust the test to pass the --runtime sandbox parameter, but as a long-term solution, I think we should extend the e2e harness to download PHP as well.

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

Thanks for adding the HTTP checks @gavande1! 🙌

The new tests are working well:
Image

And they're skipped when filtered out as expected:
Image

I added a note about the PHP binary being available on CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants