Skip to content

Build/Test Tools: Cover theme activation and deletion. - #8082

Closed
juhi123 wants to merge 4 commits into
WordPress:trunkfrom
juhi123:add/theme-tests
Closed

juhi123 wants to merge 4 commits into
WordPress:trunkfrom
juhi123:add/theme-tests

Conversation

@juhi123

@juhi123 juhi123 commented Jan 3, 2025 •

Copy link
Copy Markdown

Adds two independent browser checks for theme management:

  • Activate an installed theme from its card, reload the screen, and verify that the same theme remains active through REST.
  • Open an inactive theme’s details, confirm deletion, reload the screen, and verify through REST that the theme is gone and the original theme remains active.

A tiny local ZIP fixture replaces the live Hello Elementor download. Setup uploads it separately for each case. Cleanup restores the previous active theme and removes only the fixture using its signed deletion URL, with REST checks afterward.

A preexisting fixture makes setup fail without deleting it. The fixed fixture slug assumes an environment not shared with another simultaneous test run, matching current CI. These cases cover single-site theme management; installation from the remote theme directory is outside this scope.

Trac ticket: https://core.trac.wordpress.org/ticket/52895

Verification

  • Both cases passed three local single-site Chromium repetitions without retries (6 checks, 33.5 seconds).
  • Scoped E2E plugin and five-steps audits found no blockers.
  • Syntax/whitespace checks passed; fixture regeneration is byte-identical.
  • Verified fixture removal, previous-theme restoration, and original local multisite configuration restoration.

Fixtures

The archives are committed, not built at test time. Trunk already keeps ZIP fixtures for tests, including a plugin archive for install tests at tests/phpunit/data/plugins/link-manager.zip. Building them in the spec would need a ZIP library that core does not declare. The note beside each archive lists its full contents and a script that rebuilds it byte for byte.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-6
Used for: Refreshing the tests, replacing the live theme dependency with a local fixture, and local validation and audits.

@github-actions

github-actions Bot commented Jan 3, 2025 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props juhise, lancewillett, lucatume.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

github-actions Bot commented Jan 3, 2025

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@lancewillett lancewillett changed the title Add Playwright E2E tests to add, activate and delete a theme Build/Test Tools: Cover theme activation and deletion. Oct 12, 2026
@lancewillett

Copy link
Copy Markdown
Member

Refreshed in a496b67. Two independent cases now cover activation from the theme card and confirmed deletion from theme details. A local fixture replaces the live theme-directory dependency.

Both cases verify visible results and persisted state after reload. Cleanup restores the previous theme and removes only the fixture. Six local checks passed without retries (33.5 seconds); scoped E2E and five-steps audits found no blockers.

CI and independent review are next. Fixture packaging is still under discussion alongside #8075: committed ZIPs versus archives generated in memory.

AI review · gpt-6

@lancewillett

Copy link
Copy Markdown
Member

Review of a496b67. No requested changes.

What I checked

  • Scope: one new spec with two cases: activate an installed theme from its card, and delete an inactive theme from its details view after confirming.
  • Why a browser test: the theme grid, the details view, and the delete request are all driven by the admin scripts. Each case checks the screen, reloads, and then confirms the saved state over REST.
  • Fixture: I listed the archive without extracting it. It is 2,524 bytes with three files: a style.css header, a two-line index.php that runs nothing, and a screenshot that is byte-identical to tests/phpunit/data/images/test-image.jpg. It matches the note in the PR.
  • Isolation: setup fails without touching anything if the fixture theme is already installed. Cleanup restores the theme that was active before, removes only the fixture, and then asserts both.

CI

Run 38282514842 is green. Both new cases passed on the first attempt in both E2E jobs.

One existing test was retried in each job: login-localize-script.test.js:45, the failure tracked in Trac 66290, which #14205 fixes. Not from this PR.

AI review · claude-opus-5-5

@lancewillett lancewillett moved this from In progress to In review in WordPress Project Build Tooling Oct 12, 2026

@lucatume lucatume left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A suggestion to improve the clean-up.

Comment thread tests/e2e/specs/themes.test.js Resolved
@lancewillett
lancewillett requested a review from lucatume October 20, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No blocking issues remain in the test flows, cleanup safeguards, or fixture documentation.

No open issues 🎉

What changed in this PR

Adds browser coverage for single-site theme activation and deletion, using a local fixture instead of a live theme download.

Changes:

  • Adds independent activation and deletion tests with reload and REST verification.
  • Restores the original active theme and removes only the test fixture during cleanup.
  • Documents the fixture contents and byte-for-byte archive regeneration.
File Description
tests/​e2e/​specs/​themes.test.js Adds theme-management tests with guarded setup and cleanup.
tests/​e2e/​assets/​e2e-test-theme.md Documents the minimal theme fixture and its regeneration script.

Review effort: Balanced

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

The cleanup is independent of the details overlay, and the local fixture regenerates byte-for-byte. Both cases passed three times in each SCRIPT_DEBUG mode (12 checks). Optional later improvement: install the fixture outside the browser to reduce repeated setup work.

Reviewed with the PR-scoped E2E and five-steps audits. No blockers found; local runs used one worker and zero retries. Current CI and Copilot review are clear.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 26, 2026
Add browser tests for activating and deleting a theme using a local ZIP fixture. Restore the original active theme and remove the fixture after each test.

Developed in: #8082

Props juhise, lucatume.
See #52895.


git-svn-id: https://develop.svn.wordpress.org/trunk@64736 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 26, 2026
Add browser tests for activating and deleting a theme using a local ZIP fixture. Restore the original active theme and remove the fixture after each test.

Developed in: WordPress/wordpress-develop#8082

Props juhise, lucatume.
See #52895.

Built from https://develop.svn.wordpress.org/trunk@64736


git-svn-id: http://core.svn.wordpress.org/trunk@63886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
wporg-sync pushed a commit that referenced this pull request Oct 26, 2026
Add `themes.test.js` and the fixture documentation from the reviewed patch. [64736] added the ZIP fixture but omitted these two files.

Developed in: #8082

Props juhise, lucatume.
See #52895.


git-svn-id: https://develop.svn.wordpress.org/trunk@64739 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 26, 2026
Add `themes.test.js` and the fixture documentation from the reviewed patch. [64736] added the ZIP fixture but omitted these two files.

Developed in: WordPress/wordpress-develop#8082

Props juhise, lucatume.
See #52895.

Built from https://develop.svn.wordpress.org/trunk@64739


git-svn-id: http://core.svn.wordpress.org/trunk@63889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants