Repository navigation
Fixes #431: Update e2e elements to match the new dashboard - #440
Conversation
…d clear cache Navigation detects collapsible groups from the DOM and expands them before clicking; clear cache uses the admin bar on WP Rocket 3.24+ (fail-closed version gate) and is unchanged on older versions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Note Generated by the AI delivery pipeline (lead-reviewer · Claude Sonnet 5.5). Review: ✅ PASS (re-review of 0ca3dc3; no blockers, old 3.23.x path unchanged) Nice-to-haves:
|
|
Note Generated by the AI delivery pipeline (qa-engineer · Claude Sonnet 5.5). QA:
Baseline (3.23.5.1) failures, 2 of 28: "WP Rocket is installed and activated" (strict-mode violation: Why there is no valid new-dashboard run: the 3.24-alpha2 zip used in the first attempt was built wrongly by the pipeline (nested Not run: What to check on the new dashboard: enable-all-features expands Page Optimization, Backend and Tools; |
…ache reuse Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ning or complete DB notice openNavItem read aria-expanded before the dashboard script opened the active group, so the following click closed it again. Wait for the active menu item (aria-current) and retry click + check as one unit. The database optimization assertion now accepts either the running or the complete message instead of failing strict mode when both are present. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…w dashboard Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
We no longer use copilot, I'm not sure how valid this instruction file is.
| /** | ||
| * Raised when opening a navigation item fails on a page whose items are nested in collapsible groups. | ||
| */ | ||
| export class NavGroupError extends Error { | ||
| constructor(message: string) { | ||
| super(message); | ||
| this.name = "NavGroupError"; | ||
| } | ||
| } |
There was a problem hiding this comment.
I'll prefer moving this to a new class file.


Fixes #431
Description
The e2e suite now works with the redesigned WP Rocket settings navigation (3.24-alpha) and keeps the old navigation flow for 3.23.x. Navigation items nested in collapsible groups are expanded before they are clicked, and clear cache now always goes through the admin bar, on every WP Rocket version.
Type of change
Detailed scenario
What was tested
Result: smoke suite passes on the new dashboard. The
@smokesuite was run by the issue owner with the redesigned-dashboard build installed asnew_release, and all scenarios passed with--retry 3.npm run lintclean;tsc --noEmitadds no errors vsdevelop;cucumber-js --dry-runparses all scenarios with no undefined or ambiguous steps (155 scenarios / 1544 steps for the default profile; 61 for@smoke or @llcssbg or @lcp).new_release),@smokewith--retry 3: all passed (retries may have masked flaky first attempts). This exercises the group-aware navigation, enable-all / disable-all and the admin-bar clear cache on the new dashboard.@smokewith--retry 0(earlier run on this branch): 26 of 28 scenarios passed. The 2 failures were not caused by this PR: "WP Rocket is installed and activated" (strict-mode violation ongetByText('Database optimization process is'), since fixed by accepting running or complete) and "Roll back from the tools tab" (click timeout ona[href*="action=rocket_rollback"]). A re-run of the old version after the latest commits is still pending.@cpcssscenarios are excluded fromtest:e2e(not @cpcss): the CPCSS banner was removed in the new dashboard, so those scenarios can no longer pass. They can still be run on demand withnpm run test:cpcss.lazy-load,ll-lcp, CDN / renewal / promo notices, Cloudflare and Sucuri pages, and the non-vacuous proof (neutering the group expansion).How to test
Prerequisites: a WordPress site with WP Rocket 3.23.5.1 (old dashboard) and a site with the redesigned-dashboard build installed as
new_release. Set the suite up against each site as usual (config/wp.config.ts).No new scenarios were added. Existing scenarios must keep passing on both versions (
--retry 0for the strictest check; the new-dashboard smoke run used--retry 3):node ./node_modules/@cucumber/cucumber/bin/cucumber-js -p default --retry 0 --tags "@smoke", then thelazy-loadandsettings-export-importfeatures. Results must match the pre-change baseline.npx cucumber-js -p default --dry-run(155 scenarios, 1544 steps, no undefined steps).Affected Features & Quality Assurance Scope
I save settings,I enable option,I click on '#wpr-nav-…',enable-all-features/disable-all-featureshelpers (disableAllOptions/enableAllOptions), and the export/import steps (settings-export-import,roll-back,upgrading-plugin).I clear cache,clear wpr cache,PageUtils.clearWPRCache): the 11 scenarios that use them (lazy-load, LCP beacon, LL/LCP, visual regression, Imagify, Cloudflare).PageUtils.importSettings,I export data).WP Rocket: Cache cleared.inclearWPRCachetoo (it assertedCache cleared.before).Technical description
Documentation
Sections.openNavItem(navId)(new, public): checks whether the nav item sits inside a.wpr-menuGroup. If it does, it expands the group only whenaria-expandedis not alreadytrue(clicking an open trigger would close it), waits for the expansion, then clicks the item. If there is no group wrapper (old dashboard, or a top-level item), it does the same plain click as before. Group membership is read from the DOM, not from a hardcoded map, so no version check is needed for navigation. Failures inside a group throwNavGroupError, andvisit()rethrows them. The old-DOM path keeps the existing swallow-and-continue behaviour.Sections.doesSectionExist(): for items inside a group, it checks presence (count()) instead of visibility, because collapsed items are hidden. Otherwise it keeps theisVisible()check. Without this, enable-all and disable-all would silently skip the sections hidden in collapsed groups.openNavItemanddoesSectionExistfirst wait (up to 3 s) for#wpr-nav-dashboardto be attached, so DOM detection does not run before the nav is rendered. If the nav never renders (for example on an invalid-licence page), the wait times out and the existing behaviour applies.I click on '#wpr-nav-…'routes throughopenNavItem. Other selectors are unchanged. The rollback branch andI export data/PageUtils.importSettingsuseopenNavItem('tools')instead of a raw click.PageUtils.clearCacheFromAdminBarAndAssert()runsgotoWpr()once, clicks the admin bar entry, and assertsWP Rocket: Cache cleared..clearWPRCache()and theI clear cachestep both call it. The old dashboard trash-button andClear and preloadflows were removed because the button no longer exists on the redesigned dashboard.clearCacheFromAdminBar()hovers the WP Rocket admin bar menu and clicks#wp-admin-bar-purge-all-all > a. If that does not exist, it clicks#wp-admin-bar-purge-all > a[href]. If neither exists it throws.New dependencies
None.
Risks
#wp-admin-bar-purge-all), which was not changed by the redesign. If an i18n plugin changes that markup, the helper throws rather than passing silently.@cpcssscenarios are skipped intest:e2euntil the banner is reintroduced or the feature is rewritten.Mandatory Checklist
Code validation
Code style
Unticked items justification
lazy-loadand the non-vacuous proof are not done yet. The owner will tick these once complete.Static checks run
npm run lint: clean.npx tsc --noEmit: no new errors compared withdevelop(1 pre-existing baseline error).npx cucumber-js -p default --dry-run: 155 scenarios, 1544 steps parsed, no undefined steps.Additional Checks