Skip to content

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

Open
gavande1 wants to merge 2 commits into
trunkfrom
stu-1867-migrate-site-management-e2e-tests
Open

Add CLI e2e tests for site management (rename, PHP version, delete)#3989
gavande1 wants to merge 2 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 on lines +66 to +69
beforeAll( async () => {
env = setupCliEnv();
sitePath = await createStoppedSite( env, 'Editable E2E Site', 'editable-e2e-site' );
}, 120_000 );

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that Vitest runs afterAll even when beforeAll throws, and env is assigned before site creation, so cleanup still runs. The build-missing case is also guarded by describe.skipIf( ! cliE2ePrerequisitesMet() ), which skips the suite before beforeAll. Keeping this consistent with the existing start-stop.e2e.test.ts pattern.

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.

2 participants