Skip to content

Add e2e coverage for the Sandbox (Playground) runtime - #3893

Merged
bcotrim merged 5 commits into
trunkfrom
musing-babbage-62e598
Jun 22, 2026
Merged

Add e2e coverage for the Sandbox (Playground) runtime#3893
bcotrim merged 5 commits into
trunkfrom
musing-babbage-62e598

Conversation

@bcotrim

@bcotrim bcotrim commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Related issues

No linked issue. Addresses the gap where the Sandbox (WordPress Playground) runtime had no end-to-end coverage after Native PHP became the default site runtime in #3786.

How AI was used in this PR

Investigated the e2e harness, the Add Site modal UI, and the runtime plumbing, then wrote the test and page-object helpers with Claude Code (Opus 4.8). Selectors were checked against the real components (the #php-runtime-select dropdown and the Settings "PHP runtime" row), the additive completeOnboarding change was confirmed backward-compatible with all existing callers, and ESLint + tsc were run clean on the changed files.

Proposed Changes

Studio supports two per-site PHP runtimes: Native PHP (the default since #3786) and the Sandbox (WordPress Playground / PHP-WASM). Every existing e2e test runs against the default runtime, so the Sandbox path had zero end-to-end coverage — and site/blueprint creation on Playground lost the implicit coverage it had back when Playground was the default.

This adds a single e2e test that exercises the Sandbox runtime through the real UI:

  • Creates a site via onboarding with Sandbox selected under Advanced settings.
  • Verifies the site actually boots under Playground (waits for the "Running" state).
  • Verifies the Settings tab reports the site's PHP runtime as "Sandbox".

It runs as part of the normal e2e suite on every platform/arch — no dedicated CI job and no gating. The supporting page-object additions (runtime selection, the runtime display row) are reusable for future runtime-specific tests. No product code is changed.

Testing Instructions

  1. Build the app and run just this test:
    npm run e2e -- sandbox.test.ts
    
    (or npx playwright test sandbox.test.ts against an existing build)
  2. The test creates a Playground site, waits up to ~3 min for first-run asset downloads, then asserts the Settings tab shows PHP runtime = Sandbox.
  3. Requires network access — Playground downloads the PHP-WASM build and WordPress on first run.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors? — ESLint --fix and tsc are clean for the changed e2e files. The test is statically verified but not yet run green; please run it locally before merging.
@bcotrim
bcotrim marked this pull request as ready for review June 18, 2026 19:58
@bcotrim
bcotrim requested review from a team and fredrikekelund June 18, 2026 19:58

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

Good idea 👍 I suggest adding two HTTP requests to the site home page (one for each runtime), but other than that, this LGTM

Comment on lines +29 to +36
// The site boots under the Playground runtime.
const siteContent = new SiteContent( session.mainWindow, siteName );
await expect( siteContent.runningButton ).toBeAttached( { timeout: 180_000 } );
await expect( siteContent.siteNameHeading ).toHaveText( siteName );

// The Settings tab reports the site as running on the Sandbox runtime.
const settingsTab = await siteContent.navigateToTab( 'Settings' );
await expect( settingsTab.phpRuntimeDisplay ).toContainText( 'Sandbox' );

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.

Requesting the site home page and looking for a 200 HTTP status code response seems like a nice addition here.

@bcotrim
bcotrim merged commit 3d898ae into trunk Jun 22, 2026
11 checks passed
@bcotrim
bcotrim deleted the musing-babbage-62e598 branch June 22, 2026 14:36
bcotrim added a commit that referenced this pull request Jun 22, 2026
## Related issues

- Related to #3893 (introduced the failing test)

## How AI was used in this PR

Diagnosed the CI break with Claude Code (Opus 4.8): traced the Buildkite
**Lint** step's `npm run typecheck` failure to a cross-file overload
mismatch in the newly-added Sandbox e2e test, then verified the fix with
`tsc` and ESLint on the changed file.

## Proposed Changes

PR #3893 added the first e2e test for the Sandbox (Playground) runtime,
but it called `navigateToTab( 'Settings' )` with a capitalized label.
The `SiteContent` page object only accepts the lowercase tab ids
(`'settings'`, `'import-export'`, `'preview'`), so no overload matched
and typecheck failed — turning the **Lint** CI step (which runs `npm run
typecheck`) red on trunk:

```
sandbox.test.ts(35,56): error TS2769: No overload matches this call.
sandbox.test.ts(36,29): error TS2339: Property 'phpRuntimeDisplay' does not exist on type 'never'.
```

The second error cascaded from the first (no matching overload → `never`
return type). The capitalized value would also have failed at runtime,
since the tab selector resolves to `[role="tab"][id$="-settings"]`.

This restores a green build by using the correct lowercase `'settings'`
tab id. No product code changes.

## Testing Instructions

1. `npm run typecheck` — passes (no `sandbox.test.ts` errors).
2. `npx eslint apps/studio/e2e/sandbox.test.ts` — clean.
3. CI **Lint** + **E2E Tests** steps go green on this branch.

## Pre-merge Checklist

- [x] Have you checked for TypeScript, React or other console errors? —
`tsc` and ESLint are clean on the changed file; this PR specifically
fixes the TypeScript break.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants