Repository navigation
Conversation
Add a matrix entry that runs the suite on PRs touching admin-ui, My Jetpack, Forms or the suite itself, against the e2e Docker site with the shell on and then off. Build admin-ui for the jetpack-core e2e group, since the shell client never loads without it.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Spec-only PRs now select the admin shell entry by changed path instead of mapping suite files to admin-ui, which every e2e plugin depends on and so ran the whole matrix. The runner activates the contact-form module, since the unconnected CI site never auto-activates it, and the README names the decrypted-config prerequisite.
Code Coverage SummaryCoverage changed in 1 file.
|
In CI the admin shell config adds the CTRF and github reporters the other e2e suites use, writing each run's CTRF file to its own folder. The runner no longer exports the site URL for the shell-on run and leaves that to the config default.
…e nonce loop Add the members from PR 54768 that register on the unconnected CI site to the suite, each paired with My Jetpack as host and guest. Activate the Podcast module and build its package in CI. Add a regression for JETPACK-3673: after My Jetpack, Settings and Jetpack AI, a stale REST nonce refreshes once and the request succeeds. Activity Log, Newsletter, Protect and VideoPress need a WordPress.com connection, which the CI site doesn't have.
…n run The e2e site is on localhost, so Jetpack runs in offline mode, where My Jetpack skips registering as a shell member and the shell never turns on.
' into add/admin-shell-e2e-ci-JETPACK-3406
Taking the unconnected localhost site out of offline mode alone left only Podcast registered: Forms, Jetpack AI and Settings need a connection or offline mode, and My Jetpack redirects to onboarding. The helper plugin now stubs a connection on activation and fails WordPress.com requests at once, and the shell-off run toggles the flag by option so the two runs differ only by the flag.
…l on - Park the mouse off the admin bar before the first load. It starts on the WordPress logo, whose hover menu covered the Jetpack submenu and timed out sidebar clicks in every browser. - Activate the ai module once the connection is stubbed, so Jetpack AI has its sidebar item. - Expect Settings to land on its HashRouter route. - Mark the Back-with-a-modal announcement test as failing in Firefox and WebKit, where no announcement of My Jetpack is heard. - Share one login helper between the setup and the nonce test, and print the recorded frames when too few were recorded.
- Hide admin bar hover menus in test documents. Parking the mouse wasn't enough: the WordPress logo menu still opened over the Jetpack submenu in Chromium on WP 7.0 and swallowed sidebar clicks. - Scroll the document directly in the scroll round-trip test. In Firefox and WebKit the wheel landed on an inner scroller and left scrollY at 0. - Check that the frame recording saw the switch, instead of counting frames: headless WebKit only runs animation frames while it paints. - Treat the Back-with-a-modal announcement as an intermittent spike bug. It passed in Firefox and WebKit on one WordPress version and failed on the other.
In Firefox a background request hit the stale nonce first and refreshed it before the test started counting, so the probe succeeded with no refresh seen.
A modal hides the rest of the document with aria-hidden and only restores it in an effect cleanup, which can run after the modal has left the document. The shell waited only for the dialog to disconnect, so after Back it could focus the heading and speak while #wpwrap and the live regions were still aria-hidden, and the announcement went unheard in Firefox and WebKit. Also wait until #wpwrap and the live regions are no longer hidden.
The shell now waits for a closed modal to give the page back before it announces, so the test no longer needs the intermittent-bug wrapper.
The axe test slept a fixed 8 s before each of its four scans. Wait instead until the page has gone a second with no DOM change and no request in flight, still capped at 8 s, so a page that settles early is scanned early.
Playwright kept both workers busy for nearly the whole run, so wall time tracked total test time over two. The specs only read site state.
With three workers the runner's CPU saturated: each test ran 45-90% slower, so the Playwright run only went from about 850 s to 785 s, and the timing-sensitive specs got less headroom. Keep two until the jobs get a bigger runner.
JETPACK-3406 # Conflicts: # projects/plugins/jetpack/tests/e2e/helpers/admin-shell-helper.ts
The test fails intermittently in WebKit and Firefox in CI: the shell focuses My Jetpack's heading, but the probe never hears its title. Record what the probe skipped as unheard, when #wpwrap's aria-hidden changes, when the dialog leaves and when Back starts, so a failure shows whether the title was spoken while the document was still hidden.
CI does stub a WordPress.com connection now; the members are left out because their modules stay off and the stub can't fetch their data.
The matrix expands targets with their dependencies, and plugins/jetpack requires admin-ui, my-jetpack, forms and podcast directly.
Poll for the expected view events and stop after a second without new ones. Only the check that no foreign view arrives keeps the fixed wait.
Install and run only the comma-separated browsers it lists. The default stays chromium, firefox and webkit.
Post-merge runs against the jetpack-production mirror and manual runs keep all three browsers.
…al fails" This reverts commit 8dbe31b.
A background request that hits the stale nonce at the same time refreshes it too, so CI saw two refreshes. Check that a refresh happened and that the probe request was sent at most twice; a middleware loop still fails both that and the 15 s timeout.
|
I've knocked it down to ~9 min in PRs but still looking. |
# Conflicts: # projects/packages/admin-ui/src/admin-shell/overlays.js # projects/packages/admin-ui/tests/js/admin-shell/overlays.test.js # projects/plugins/jetpack/tests/e2e/helpers/admin-shell-helper.ts # projects/plugins/jetpack/tests/e2e/specs/admin-shell/tracks.test.ts
On pull requests the suite now runs against WordPress latest only. It runs in full when the PR changes admin-ui, my-jetpack, jitm or a dashboard package, and only the tests tagged @smoke otherwise. Post-merge and manual runs are unchanged. - Drop tests that never ran in CI (leave-guard, the Forms Tracks rows, hidden-apps Tracks) and rows that repeat other specs (history full loads, per-member fallback rows, per-step focus and announce rows). - Point the memory spec at members the CI site has, so it runs there. - Add a hover side-effects test: the e2e plugin logs option and user meta writes made while serving the shell's guest request, and hovering must make none. - Run with four workers and fullyParallel, the shell-off logins with one. - Cache Playwright browsers, and skip system packages for a Chromium-only run.
- Run the full suite when a PR changes the Jetpack plugin's Settings or AI dashboards, the shell wiring, the suite itself, its CI files, or the e2e environment. Drop Boost from the list: it can't reach this entry. - Drop the Playwright browser cache: on pull requests it only served reruns. - Add the hover project only with ADMIN_SHELL_HOVER=1 and Chromium, which the CI script sets for its own run, and fail rather than skip in CI. - Save the guest write log at the end of shutdown, after other shutdown saves.
case() needs a boolean predicate, and only the admin shell entry sets smoke, so every other e2e job failed to start its test step.
…er run - Delete log rows in a loop, not array_map(), and pass a real status code. - Run the hover project only when Chromium is among the browsers, since the config only defines it then. - Say that a change to only the e2e workflow files doesn't queue the entry.
- feature-off switches Forms off for the whole site, and the hover test watches site-wide writes, so both now run first with one worker (ADMIN_SHELL_ALONE=1), and the parallel run leaves them out. - feature-off posted to /wp-json/, which on a site without pretty permalinks serves the home page with a 200, so Forms never switched off. Use ?rest_route= and require a JSON answer.
Settings and AI dashboard changes, and the shell wiring in the Jetpack plugin, no longer select the full suite on pull requests.
…wser Run the full suite on pull requests that change Monetize, Premium Analytics or wp-build-polyfills, and add the Back/Forward test to the smoke set. After merge, run Chromium against WordPress latest on each push to the jetpack-production trunk. Run every browser on both WordPress versions daily. The schedule has its own concurrency group, so pushes can't cancel it, and its failures use the existing Slack job. In CI, fail the Tracks tests when a full load records no views instead of skipping them. Switch Forms back on after the one-worker specs, in case their cleanup fails. Part of JETPACK-3406
PR 55202 on trunk moved saved headers from one localStorage key per dashboard to one sessionStorage entry that lists every page. hasSavedHeader() still looked for the old keys, so the header placeholder and stand-in header tests failed in CI, which tests this branch merged with trunk. Look the page up in the new entry instead. Part of JETPACK-3406
The flag is now on by default, so the option has to filter it to false. Leaving out the filter that turned it on no longer turns the shell off.
Fixes JETPACK-3406
Proposed changes
The admin shell regression suite only ran by hand. This runs it in the e2e workflow, sized so that most pull requests pay little for it.
When it runs
Add a
Jetpack admin shellmatrix entry targetingplugins/jetpack. A PR queues it by touching the Jetpack plugin or any project it depends on.jetpack-productiontrunk (after merge)jetpack-productionrelease branches and tagsA PR runs the full suite when it changes one of these itself:
packages/admin-ui,my-jetpack,jitmorwp-build-polyfills(the shell imports its view transitions).forms,podcast,protect,search,backup,activity-log,publicize,newsletter,seo,videopress,monetizeorpremium-analytics.The smoke set (tests tagged
@smoke) is the navigation matrix, Back and Forward, the contract hooks and events, the guest endpoint failure, one stale-nonce tour and the shell-off smoke. A PR that changes only the Jetpack plugin's Settings or AI dashboard gets the smoke set.e2e-matrix.jsdecides from the projects and files the PR changes itself, not from their dependents. It sets the browsers for each run and passesADMIN_SHELL_SMOKEto the job.A passing PR means its Chromium tests passed. It doesn't mean Firefox, WebKit or the minimum WordPress version passed, and on a smoke PR it doesn't mean the full suite passed.
After merge:
Let a matrix entry name its own test script (
testScript). Every other entry keepstest:run.How it runs
bin/admin-shell-ci.sh(pnpm test:admin-shell:ci), which runs against the e2e Docker site:e2e-admin-shellhelper plugin. The plugin keeps the site out of offline mode, stubs a WordPress.com connection (most members need one, and My Jetpack only joins the shell once setup is done) and fails WordPress.com requests at once. Then it activates the AI module, which needs that connection.feature-off, which switches Forms off, and the hover side-effects test (ADMIN_SHELL_ALONE=1). Then it runs the shell-on projects with four workers andfullyParallel, leaving those specs out. Then it sets an option that makes the helper plugin turn the flag off, and runs the shell-off smoke with one worker, since two logins at once on one site can stall. Each run writes its own results folder.feature-offdidn't clean up.packages/admin-uiandpackages/podcastfor thejetpack-coree2e group.What it tests
jetpack_forms_classic_state. It can't catch the Settings hover writes: those need WordPress.com answers that this site never gets, and the Settings PHP unit test covers them.feature-offspec on the CI site. It posted to/wp-json/, which on a site without pretty permalinks serves the home page with a 200, so Forms never switched off and both tests failed. It now uses?rest_route=and requires a JSON answer.leave-guard: Newsletter isn't on the site, and the Jest tests inadmin-uicover the guard.isolationand theadmin-uiadapter test still cover a hidden app's router.history.navigation-matrixnow checks each member's full-load landing.?jetpack_admin_shell=0rows.aria-hidden, so the announcement went unheard. A@wordpress/componentsmodal restoresaria-hiddenin an effect cleanup that can run after the modal has left the document, and the shell only waited for the modal to leave.closeDialogsOf()now also waits until#wpwrapand the live regions are no longer hidden (alongside trunk's longer wait for a dialog's exit animation), with a Jest test for that order of events.What's still untested
buildscript. For dashboard packages that aren't in it, including Monetize and Premium Analytics, those runs don't test their JavaScript. Monetize tests are separate work (JETPACK-3978).packages/jetpack-mu-wpcomalso registers members, but changing only that package doesn't queue this suite.e2e-matrix.jsoutput, workflow conditions and concurrency groups were checked for those events, but there hasn't been a real run or Slack message. The encrypted Slack rules, and who sees the alerts, weren't checked. All three browsers on four workers haven't been timed, so they might not fit in the job's 25-minute limit.Cost per pull request
The full-suite times come from seven passing Chromium jobs on this PR: six from November 18 to 20, and one on
c57ef3ca996. Only the last four used the one-worker setup: 387, 417, 433 and 512 seconds. Failed runs aren't included. The smoke time is an estimate because that set hasn't run in CI. CI can't run it on this PR, which changes the suite itself.Latest commit (
47e78d2979f): the admin shell job passes, and so does every other check. It ran the full suite in 444 seconds (7.4 minutes). Not counting the login setup, 52 tests passed, none failed and 4 were skipped (the SEO and Boost navigation rows, which aren't on the CI site). Forms was switched back on. Both saved-header tests passed. This run isn't one of the seven in the table.On the previous commit,
e3b7ec9f42b(which merged trunk at9fadc44c2ee), 51 tests passed, 1 failed and 4 were skipped, in 417 seconds. The failure was the shell-off smoke. PR 55406 had turnedjetpack-admin-shellon by default, ande2e_admin_shell_offonly stoppede2e-admin-shellfrom forcing the flag on. Now the plugin filters the flag to false when that option is set, and to true when it isn't.The shell-off smoke now runs with the shell off. The same check that found the shell active on
e3b7ec9f42bfinds none after each click to Forms, Jetpack AI, Settings and Podcast, and each page has its own body class and app container. The test doesn't mark the page to prove that it reloaded. The shell-on tests still fail if the shell isn't active.On
c57ef3ca996, before PR 55406 merged, the job passed in 512 seconds (8.5 minutes): 52 passed, none failed and 4 were skipped. Setting up the test environment took 151 seconds, compared with 53 in the previous commit's first run.On the commit before that, the header placeholder test in
accessibilityand the test inheader-stand-infailed in all three runs. PR 55202, now in trunk, moved saved headers fromlocalStoragetosessionStorage.hasSavedHeader()now looks there, and both tests ran and passed. This branch now includes PR 55202. Both tests will fail on a build without it.Still to fix:
header-stand-instill clears saved headers only fromlocalStoragebefore each first visit, so headers from dashboards it visited earlier stay insessionStorage. Later dashboards might borrow those headers. This pass doesn't fully check a first visit for them.The job starts only after every queued e2e build finishes. On
c57ef3ca996, it was the last e2e test job to finish, 15.2 minutes after the workflow's first job was created. The next-to-last finished at 14.6 minutes. Build finished at 13.5 minutes and Tests at 10.6. WordPress.com Tests finished last, at 21.9 minutes, not counting WPCOMSH, which had to be re-run.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Check the
Jetpack admin shell e2e tests (WP latest)job on this PR. It should run the one-worker group (feature-offand hover side effects), the shell-on group and the shell-off group, in Chromium, with the full suite (this PR changes the suite, so it isn't smoke). It should also switch Forms back on before the shell-on group. There is no WP 7.0 admin shell job on pull requests any more.To check the gating without a PR, run the matrix script against a fake event for a single commit. Look at the
Jetpack admin shellentry'ssmokevalue:A Jetpack plugin change gives
smoke: true, whether it is a Memberships change (a652ca2cde4) or a Settings dashboard change (4f46b7187d8). So does a Jetpack AI change (8d5ae5181bc). Changes toadmin-ui(b6147ce07aa), Forms (51d7bec552b), Monetize (7c442b6fe72), Premium Analytics (41254ae27e2) or onlywp-build-polyfills(35083a2f8b7) givesmoke: false. A change to only mu-wpcom (bd730b9e95d) or Boost (4366a7945cd) has no entry.To check the other runs, run the same script with
GITHUB_EVENT_NAME=schedule. It should queue only this suite, once per WordPress version, with nobrowsersvalue (so all three). Then useGITHUB_EVENT_NAME=repository_dispatch DISPATCH_REPO=Automattic/jetpack-production DISPATCH_REF_TYPE=branch DISPATCH_REF_NAME=trunk. The admin shell should have one entry, withbrowsers: chromiumand WordPress latest. With a release branch or tag, it should have two entries and nobrowsersvalue.To check that the hover test catches a real bug, restore the Forms dashboard class from before the hover fix (
git show 51d7bec552b^:projects/packages/forms/src/dashboard/class-dashboard.php) on an e2e site running this branch. Then runADMIN_SHELL_ALONE=1 ADMIN_SHELL_BROWSERS=chromium playwright test -c playwright.admin-shell.config.ts --project='hover side effects'. It should fail onoption:jetpack_forms_classic_state, and pass with the fix back.This PR touches
tools/docker/and.github/files/e2e-tests/, so every e2e suite runs on it. The other suites should be unaffected: the newtestScript,smoke,browsersandADMIN_SHELL_*settings only change the admin shell entry, and thee2e-admin-shellplugin is mounted on every e2e site but only this suite activates it.