Skip to content

Admin shell e2e: Add Newsletter, Protect and Stats - #55610

Draft
kraftbj wants to merge 6 commits into
add/admin-shell-e2e-ci-JETPACK-3406from
add/admin-shell-e2e-newsletter-protect-stats
Draft

kraftbj wants to merge 6 commits into
add/admin-shell-e2e-ci-JETPACK-3406from
add/admin-shell-e2e-newsletter-protect-stats

Conversation

@kraftbj

@kraftbj kraftbj commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Part of JETPACK-3412

Proposed changes

Add Newsletter, Protect and the new Stats (packages/premium-analytics) to the admin shell e2e suite. Each one gets the navigation matrix and one test of its primary flow.

This is stacked on PR 54813 and stays a draft until that PR lands. It needs that PR's CI script, the e2e-admin-shell plugin and the one-worker phase. Trunk doesn't run this suite.

Expect the admin shell job to fail for now. See "Known failures" below. No existing check was changed or excluded to hide them.

What's covered

Dashboard Navigation matrix Primary flow Bug it catches
Newsletter To and from My Jetpack Switch to it, choose "Excerpt" for post emails, reload: still chosen A save that reports success but isn't stored
Protect To and from My Jetpack Switch to it, turn on the IP allow list, save an address, reload: both still there The list isn't stored
Stats To and from My Jetpack Switch to it: the exact view total for the last seven days Data that doesn't load, or loads wrong
  • Each matrix row catches its dashboard not joining the shell, or landing, highlighting the menu or setting the title or body class wrong. No existing test covers these dashboards in the shell.
  • The existing hover, stand-in header and shell-off tests now cover all three dashboards too.
  • The two settings tests start from known values and put the site's own values back. They change site-wide settings, so they run in the one-worker phase. No new test is tagged @smoke, but the matrix rows inherit the matrix's tag.
  • In CI, a missing dashboard fails. On other sites its tests skip. The Stats data test also skips outside CI without its helper plugin.

Suite changes

  • Stats is a top-level menu page. The helpers now handle its menu link, highlight and toplevel_page_ body class. When it's on screen, the Jetpack submenu is a closed flyout, so clickMenuLink() hovers over Jetpack first.
  • siteRest() replaces the REST call in feature-off. It uses the browser session rather than the page, so cleanup still works if the page is stuck.

Site setup and what it doesn't prove

  • Build: the e2e build script adds packages/newsletter, packages/protect and packages/premium-analytics.
  • Modules: CI activates subscriptions, protect-dashboard and stats.
  • Stats: e2e-admin-shell turns on jetpack-stats-classic-page-retired. It's now on by default on this PR's base too (PR 55286). CI also marks the Stats welcome dialog as seen.
  • Connection: the suite's stubbed connection, so these tests don't prove that a real connection, plan or WordPress.com sync works.
  • Stats data: the existing e2e-premium-analytics-helper plugin, unchanged, answers Stats requests with fixtures. It also stubs the connection with its own site ID. The proxy and dashboard are real, but this doesn't prove that WordPress.com returns correct data, or that paid or WooCommerce reports work.
  • Other helper answers: e2e-admin-shell used to replace every other e2e plugin's WordPress.com answers with an error. It now runs after them and keeps their answers, such as the Stats fixtures and the firewall rules. Requests that no plugin answers still fail at once.
  • Protect: in CI's Docker site, the web server couldn't write the firewall's rules when Protect saved. WP-CLI runs as root there, so it probably created those files. The script now gives the web server ownership of them, as Protect's own e2e test does. The firewall stays off, so this checks that the list is stored, not that the firewall or login protection uses it. Scan results need a connected site with Scan and aren't covered.
  • Newsletter: this checks the setting, not an email. It doesn't cover unsaved changes: PR 54813 removes that test, and this PR doesn't replace it.

Known failures

I reproduced the first three locally on a trunk build (449a6b0a9ef), both without PR 55406 (with the shell flag on) and with its default change.

  1. Stand-in header: Stats doesn't declare a header or opt out with false, and its title is a breadcrumb. The test fails on Stats, now in CI too: Stats has no declared header, and the test finds no standard header title once Stats loads. The other dashboards in that test pass. In a probe that delayed the first load, the title moved 3px (58px to 55px from the top) when Stats replaced the stand-in, in 6 of 6 runs without PR 55406's default and 5 of 5 with it. This is a product bug.
  2. Axe: with Stats on, My Jetpack's Stats section has two axe violations: list on its cards, and label-content-name-mismatch on "View detailed stats". A plain My Jetpack load has both with the shell off too, so the shell doesn't cause them. The test failed 5 of 5 times without PR 55406's default and 4 of 5 with it. Without Stats and its fixtures, it passed 5 of 5. The test probably records its baseline before that section has loaded.
  3. Stale nonce: flaky. My Jetpack's own late requests can use the test's fake nonce and add refreshes, which is a problem with the test. With Stats and its fixtures on, 4 of 20 runs failed without PR 55406's default and 2 of 20 with it. With only Newsletter and Protect added, 0 of 20 failed, the same as with PR 54813's site setup. Earlier, on a build from this PR's base under heavy load, 1 of 16 failed on PR 54813's site setup, so it can be flaky without these dashboards.
  4. Hover side effects: intermittent. It failed in the first CI run on a57461d8e50 and passed in the re-run. The test logged four option writes from Jetpack Sync during Podcast's guest request. Sync can send as any admin request ends, and after a failed send (every send fails on this site) it waits 60 seconds. The test ended 64 seconds after e2e-admin-shell was activated in the run that failed, and after 42, 51 and 44 seconds in three that passed. So the wait probably ended mid-test. The log doesn't show when it started. The flag change didn't cause this: in this phase, the plugin still turns the flag on. It can happen again on a slow runner.

PR 54813's fix for the shell-off smoke (47e78d2979f) is in this branch, and that test now passes with the shell off. After each click, it finds no shell on any of the other dashboards, including Newsletter, Protect and Stats.

PR 54813's branch now includes trunk at 9fadc44c2ee, and so does this one. That fixed two earlier problems: both saved-header tests now get past the saved-header check (the placeholder test passes, and the stand-in test fails only on Stats, as in item 1), and "Test plugin upgrades" passes.

The axe and stale nonce tests passed in all five CI runs, so the failures in items 2 and 3 have only happened locally.

CI results and added time

CI on a57461d8e50 (Chromium, WordPress latest) ran all nine new tests, in the first run and in one re-run of the job. They all passed both times, and none was skipped. The admin shell job still fails. Not counting the login setup:

Run Passed Failed Skipped Job time
First 59 2 (stand-in header on Stats, hover side effects) 4 544 seconds (9.1 minutes)
Re-run 60 1 (stand-in header on Stats) 4 374 seconds (6.2 minutes)

The skipped tests are the SEO and Boost rows. "Test plugin upgrades" passed.

The site's PHP log also has fatal errors from packages/videopress/src/class-stats.php, where http_response is null: 184 in the first run, and 170 on c85766173e9. The Stats fixtures are the likely cause, but I haven't confirmed that. No test failed because of them.

The coverage jobs passed, but "Code coverage requirement" is still pending. It says there's no summary data for the parent commit, 47e78d29.

The Protect test failed in this PR's first CI run. It has passed since I fixed the file ownership (see "Protect" above). On c88b3017f1b, before this branch had PR 55406, the shell-off test also passed, with the new dashboards included.

Based on the c88b3017f1b run, the new tests and setup add about 38 seconds to the full job:

  • About 5 seconds of extra setup and 11 seconds for the two settings tests, which run one at a time. These are measured.
  • About 22 seconds for the matrix rows and the Stats test. This is an estimate: they took 86 seconds in total, divided across four workers.

On smoke runs, I estimate about 23 seconds. The build's extra time isn't included, and I couldn't separate it from normal variation. That doesn't include the stand-in header test's extra time. It stopped early in that run. On a57461d8e50 it took 2.8 minutes in the first run and 1.7 in the re-run, compared with 1.6 on PR 54813's 47e78d2979f. I didn't compare whole job times, because they vary too much between runners.

Related product discussion/links

  • JETPACK-3412
  • PR 54813 runs the suite in CI. PR 55596 adds Monetize to the same member list, so whichever merges second may have a small conflict.

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • In the Jetpack admin shell e2e tests (WP latest) job, check that these ran and passed, rather than being skipped:

    • In the one-worker group: "Newsletter keeps how much of each post its emails include", "Protect keeps the IP addresses it always allows" and the hover test.
    • In the shell-on group: "a switch to Stats loads the last seven days of views", and six matrix rows (jetpack-newsletter, jetpack-protect and jetpack-premium-analytics-wp-admin, each in both directions).
    • In the shell-off group: the smoke test.
  • To run it yourself, use a build with those three packages, the modules and flag above, and the site in UTC. Turn the shell on, activate e2e-admin-shell and then e2e-premium-analytics-helper, and dismiss the Stats welcome dialog. Only use a disposable site, since these plugins replace its connection. In projects/plugins/jetpack/tests/e2e, run:

    ADMIN_SHELL_URL=... ADMIN_SHELL_USER=... ADMIN_SHELL_PASSWORD=... \
    pnpm exec playwright test -c playwright.admin-shell.config.ts --project='shell on: chromium' --grep 'newsletter|protect|premium-analytics|last seven days'

    Run the settings tests separately with ADMIN_SHELL_ALONE=1, --workers=1 and --grep 'Newsletter keeps|Protect keeps'.

What I ran, in Chromium on local WordPress Playground sites (WP 7.1.5, not Docker) with the trunk build above, without PR 55406:

  • All nine new tests pass. The hover, feature-off and shell-off tests pass too. Firefox, WebKit and WordPress 7.0 weren't run.
  • With the three modules off, the six matrix rows and the Stats test fail with CI=1 and skip without it. I didn't run the two settings tests this way, but they use the same check.
  • I broke a scratch copy of the product code, then restored it. All nine tests passed before and after:
    • Dashboards not joining the shell: with each dashboard's jetpack_admin_shell_members hook renamed, all six matrix rows failed.
    • Newsletter reporting a save it didn't make: after the reload, the option wasn't chosen, so the test failed.
    • Protect dropping the list: after the reload, the list was empty, so the test failed.
    • The Stats proxy dropping a day: it showed 159 views instead of 189, so the test failed.

Add the three dashboards to the member list, so the navigation matrix, hover and shell-off tests cover them, and add a test of each one's primary flow.

Part of JETPACK-3412
@kraftbj kraftbj added [Status] In Progress E2E Tests [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Nov 30, 2026
@kraftbj kraftbj self-assigned this Nov 30, 2026
@github-actions github-actions Bot added the Docs label Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/admin-shell-e2e-newsletter-protect-stats branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/admin-shell-e2e-newsletter-protect-stats

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@jp-launch-control

jp-launch-control Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit 47e78d2, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 47e78d2 is available.

Full summary · PHP report · JS report

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs E2E Tests [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant