Guidelines: Add e2e tests based on the Settings page testing instructions#77192
Guidelines: Add e2e tests based on the Settings page testing instructions#77192
Conversation
|
@iamchughmayank or @aagam-shah, I would appreciate your feedback on the proposed tests. |
|
Size Change: 0 B Total Size: 7.74 MB ℹ️ View Unchanged
|
|
Pulled this branch into my local #77147 branch (CPT slug rename) and ran the suite: The tests are passing. Confirms the e2e tests work across both the current I'd be happy to rebase my PR on top of this when this lands. |
Follow-up to #77147. That PR renames the Guidelines CPT slug but the feature has no end-to-end coverage, so there is no regression signal for changes that touch the CPT, REST controller, or admin page boot-up. This adds three Playwright specs that drive the UI the same way the PR's "Testing Instructions" do. See also #76390. This partially covers the scope of that issue on the e2e level. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
7dc6fbb to
d527ed4
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
iamchughmayank
left a comment
There was a problem hiding this comment.
Validated the tests with the PR #77147 and the tests passed correctly.
What?
Adds three Playwright end-to-end tests for the experimental Guidelines settings page (test/e2e/specs/admin/guidelines.spec.js):
shows a Guidelines link in the Settings menu— asserts theSettings → Guidelinessubmenu link and itshref.opens the Guidelines page from the Settings menu— clicks through the submenu, waits for the React app to hydrate, and confirms the page title and both Copy and Images accordion triggers render.persists Copy and Images guidelines entered through the UI across a refresh— expands each accordion, fills the textarea, clicksSave guidelines, waits for theGuidelines saved.snackbar, reloads the page, re-expands each accordion, and asserts the textareas are rehydrated with the values that were saved.Follow-up to #77147. See #76390 — this partially covers the scope of that issue on the e2e level.
Why?
The Guidelines feature had no end-to-end coverage before this PR. While reviewing #77147 (which renames the custom post type slug from
wp_content_guidelinetowp_guideline), I noticed there was no regression signal for changes that touch the CPT, REST controller, or admin-page boot-up. The only existing automated test is a PHPUnit test for the REST controller; UI wiring, the experiment gate, and the save/refresh round-trip were untested.How?
The test coverage is modelled directly on the manual steps listed in #77147's Testing Instructions:
The spec drives the real UI for every step: toggling the experiment, clicking through the submenu, filling the Copy and Images textareas, saving, reloading, and asserting the rehydrated values. REST is only used by a
deleteAllGuidelinesscaffolding helper to reset the singleton guideline post between tests.The tests exercise the full stack the Guidelines feature touches: the experiment gate, the admin submenu, the React app fetch of
/wp/v2/content-guidelines, the REST controller, thewp_guidelineCPT storage, and the app rehydration on reload. A regression in any of those layers will fail at least one of these tests.Testing Instructions
npm run wp-env-test start(e2e environment on port8889by default; passWP_ENV_PORTandWP_BASE_URLto override).npm run test:e2e -- test/e2e/specs/admin/guidelines.spec.jsAll three tests should pass in under ~10 seconds.
Testing Instructions for Keyboard
No UI changes — this PR only adds tests.
Screenshots or screencast
No visual changes.
Use of AI Tools
This PR was drafted with help from Claude Opus 4.6 during a review of #77147 — identified the missing e2e coverage, discovered the DOM selectors by reading build/routes/content-guidelines/content.js, and drafted the spec. All code was reviewed and tested by the author before opening this PR.
🤖 Generated with Claude Code