Skip to content

Add CLI e2e tests for site management (rename, PHP version, delete) - #3989

Merged
gavande1 merged 5 commits into
trunkfrom
stu-1867-migrate-site-management-e2e-tests
Jul 1, 2026
Merged

Add CLI e2e tests for site management (rename, PHP version, delete)#3989
gavande1 merged 5 commits into
trunkfrom
stu-1867-migrate-site-management-e2e-tests

Conversation

@gavande1

@gavande1 gavande1 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude was used to write the end-to-end tests, following the existing CLI e2e harness and patterns. The author directed the scope and approach, verified the tests locally by building the CLI and running the suite, and reviewed the code line by line before creating this PR.

Proposed Changes

Adds end-to-end CLI coverage for the remaining site-management operations that previously had only desktop-UI tests: renaming a site, changing its PHP version, updating the WordPress site title, and deleting a site with and without keeping its files on disk. The tests spawn the built CLI against an isolated config and daemon, so they exercise the real persisted state in cli.json and on disk rather than mocks.

Testing Instructions

npm run cli:build
npm test -- apps/cli/commands/site/tests/site-management.e2e.test.ts --tagsFilter='e2e'

Expect 5 passing tests. Without --tagsFilter='e2e' the suite is skipped by design (these are slower, real-CLI tests that run in the release/manual suite, not on every PR).

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@gavande1
gavande1 requested a review from Copilot June 29, 2026 14:26
@gavande1
gavande1 marked this pull request as ready for review June 29, 2026 14:26

Copilot AI 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.

Pull request overview

Adds Vitest-based end-to-end coverage for the Studio CLI “site management” flows by spawning the built CLI against an isolated config directory and asserting persisted cli.json + on-disk effects.

Changes:

  • Adds a new e2e test suite covering site set --name, site set --php, and updating the WordPress blogname option via wp option update/get.
  • Adds destructive-flow coverage for site delete with and without --no-files, including verifying on-disk behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/cli/commands/site/tests/site-management.e2e.test.ts

@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 tackling this @gavande1! 🙌 This looks good to me.

Image
@gavande1
gavande1 merged commit 4efd846 into trunk Jul 1, 2026
11 checks passed
@gavande1
gavande1 deleted the stu-1867-migrate-site-management-e2e-tests branch July 1, 2026 10:05
gcsecsey pushed a commit that referenced this pull request Jul 1, 2026
…) (#4029)

## Related issues

- Reverts #3961
- Reverts #4008

## Proposed Changes

Reverts two previously merged changes, combined into a single PR:

- **#3961** — removes the CLI integration test for creating a site from
a custom Blueprint, along with the appdata-isolation changes it made to
the e2e harness.
- **#4008** — re-enables the Windows Studio E2E Buildkite job, which had
been temporarily disabled.

The unrelated `STUDIO_PROCESS_MANAGER_HOME` env addition introduced by
#3989 is preserved in the e2e helper.

## Testing Instructions

- Confirm CI passes, including the re-enabled Windows E2E job.

## Pre-merge Checklist

- [x] Have you checked for TypeScript, React or other console errors?
gcsecsey added a commit that referenced this pull request Jul 13, 2026
…nt (#4124)

## Related issues

- Fixes STU-1871
- Re-adds #3961, reverted in #4029

## How AI was used in this PR

Claude investigated the revert history and the current e2e harness,
restored the test from git history, adapted it to the updated harness
conventions, and verified all suites locally. I reviewed all changes.

## Proposed Changes

PR #3961 added CLI e2e coverage for `studio site create --blueprint`,
but was reverted in #4029 as part of the AINFRA-2588 Windows E2E hang
investigation. The actual causes were later found and fixed in #4082.
The blueprint tests were not at fault, so this PR re-adds them, updated
for the harness as it exists today:

- The 4 original cases (installTheme, installPlugin, runPHP, wp-cli) now
create sites with `--runtime sandbox`, matching the other CLI e2e
suites: it keeps runs hermetic, since native PHP would download its
binary into the isolated config dir on first run.
- Applying a Blueprint boots the process-manager daemon even with
`--no-start`, and since #3989 each test env gets an isolated daemon — so
teardown now runs `site stop --all` before removing the env, like the
start/stop and site-management suites, to avoid orphaning a daemon per
case.
- Re-adds #3961's harness fix: `runCli` isolates the legacy Electron
appdata dir (`E2E` + `E2E_APP_DATA_PATH`). Without it, the
Studio-compatibility startup migration finds a developer's real
pre-split `appdata-v1.json` and exits 1, failing every CLI e2e suite
locally (CI passes only because agents have no legacy config). This also
stops e2e runs from bumping production stats.

## Testing Instructions

1. Build the CLI: `npm run cli:build`.
2. Run the new suite:
`npm test -- apps/cli/commands/site/tests/create-blueprint.e2e.test.ts
--tagsFilter='e2e'`
   Confirm all four tests pass.
3. Confirm the fast suite is unaffected: `npm test --
apps/cli/commands/site/tests --tagsFilter='!e2e'` — the e2e cases are
skipped.
4. Regression check for the harness fix — the sibling suites still pass:
`npm test -- apps/cli/commands/site/tests/create.e2e.test.ts
--tagsFilter='e2e'` (on a machine with a leftover `~/Library/Application
Support/Studio/appdata-v1.json`, this fails without the harness change
and passes with it).

## Pre-merge Checklist

- [x] Have you checked for TypeScript, React or other console errors?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants