Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
17e4445
Admin shell e2e: Run the regression suite in CI
kraftbj Nov 11, 2026
f3aa110
Admin shell e2e: Trigger on suite paths and activate Forms in CI
kraftbj Nov 11, 2026
9c7cdeb
Admin shell e2e: Send CI results to the CTRF report and annotate PRs
kraftbj Nov 11, 2026
588e2f7
Merge remote-tracking branch 'origin/trunk' into HEAD
kraftbj Nov 11, 2026
a61984a
Admin shell e2e: Cover Jetpack AI, Settings and Podcast, and the stal…
kraftbj Nov 11, 2026
3ff5c13
Admin shell e2e: Report why the shell isn't running on a member
kraftbj Nov 11, 2026
2e26e0f
Admin shell e2e: Take the CI site out of offline mode for the shell-o…
kraftbj Nov 11, 2026
17d4750
Merge remote-tracking branch 'origin/add/admin-shell-e2e-ci-JETPACK-3…
kraftbj Nov 11, 2026
a53da27
Admin shell e2e: Stub a connection for the CI site
kraftbj Nov 11, 2026
567f6fd
Admin shell e2e: Fix the CI failures from the first run with the shel…
kraftbj Nov 11, 2026
5c23732
Admin shell e2e: Fix the remaining browser-specific CI failures
kraftbj Nov 11, 2026
d495db4
Admin shell e2e: Count nonce refreshes from the second login on
kraftbj Nov 11, 2026
08e8033
Admin shell: Announce only after a closed modal gives the page back
kraftbj Nov 12, 2026
0d5da3a
Admin shell e2e: Run the Back-with-a-modal test as a normal test again
kraftbj Nov 12, 2026
9d81f1e
Admin shell e2e: Fill the login form only after wp-login.php's autofo…
kraftbj Nov 12, 2026
af0a342
E2E matrix: Drop the admin shell paths trigger
kraftbj Nov 12, 2026
54865c7
Admin shell e2e: Wait for the page to go quiet before each axe scan
kraftbj Nov 12, 2026
e4cce17
Admin shell e2e: Run the CI suite on three workers
kraftbj Nov 12, 2026
f534761
Admin shell e2e: Go back to two CI workers
kraftbj Nov 12, 2026
fec2c21
Merge remote-tracking branch 'origin/trunk' into add/admin-shell-e2e-…
kraftbj Nov 13, 2026
8dbe31b
Admin shell e2e: Attach an a11y timeline when Back with a modal fails
kraftbj Nov 13, 2026
36b34ba
Admin shell e2e: Say why the members list skips four members
kraftbj Nov 13, 2026
65680c5
E2E matrix: Target only plugins/jetpack for the admin shell suite
kraftbj Nov 13, 2026
5886ded
Admin shell e2e: Wait for Tracks views instead of sleeping
kraftbj Nov 13, 2026
46b8814
Admin shell e2e: Pick the browsers with ADMIN_SHELL_BROWSERS
kraftbj Nov 13, 2026
19bcc88
Admin shell e2e: Run only Chromium on pull requests
kraftbj Nov 13, 2026
999c8d2
Revert "Admin shell e2e: Attach an a11y timeline when Back with a mod…
kraftbj Nov 13, 2026
5df2600
Admin shell e2e: Count the nonce probe's own tries, not every refresh
kraftbj Nov 13, 2026
83dc8d3
Merge remote-tracking branch 'origin/trunk' into pr-54813-merge
kraftbj Nov 17, 2026
924f88b
Merge remote-tracking branch 'origin/trunk' into shell-e2e-work
kraftbj Nov 18, 2026
8f9e3a9
Admin shell e2e: Run a smoke set on most PRs, and trim the suite
kraftbj Nov 18, 2026
f03ddaa
Admin shell e2e: Widen full-suite triggers, and isolate the hover test
kraftbj Nov 18, 2026
f7cfba4
Admin shell e2e: Fix the smoke flag for matrix entries without one
kraftbj Nov 18, 2026
a7cdcdb
Admin shell e2e: Fix Phan issues in the e2e plugin, and guard the hov…
kraftbj Nov 18, 2026
8340e14
Merge remote-tracking branch 'origin/trunk' into shell-e2e-work
kraftbj Nov 18, 2026
f66e016
Admin shell e2e: Run site-wide state specs alone, fix feature-off
kraftbj Nov 18, 2026
9c5df68
Admin shell e2e: Run the smoke set for Jetpack plugin dashboard changes
kraftbj Nov 18, 2026
6fb57ef
Merge remote-tracking branch 'origin/trunk' into add/admin-shell-e2e-…
kraftbj Nov 20, 2026
8f75401
Admin shell e2e: Widen the full-suite triggers and schedule every bro…
kraftbj Nov 30, 2026
c57ef3c
Admin shell e2e: Look for saved headers in session storage
kraftbj Nov 30, 2026
e3b7ec9
Merge branch 'trunk' into add/admin-shell-e2e-ci-JETPACK-3406
kraftbj Nov 30, 2026
47e78d2
Admin shell e2e: Turn the shell off when e2e_admin_shell_off is set
kraftbj Nov 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 113 additions & 3 deletions .github/files/e2e-tests/e2e-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,48 @@ const projects = [
targets: [ 'plugins/jetpack', 'packages/comments' ],
buildGroup: 'jetpack-core',
},
{
project: 'Jetpack admin shell',
path: 'projects/plugins/jetpack/tests/e2e',
testScript: 'test:admin-shell:ci',
testArgs: [],
targets: [ 'plugins/jetpack' ],
buildGroup: 'jetpack-core',
// On pull requests: WordPress latest only, and only the @smoke tests unless the PR itself changes one of these projects or files.
pullRequest: {
wpVersions: [ 'latest' ],
browsers: 'chromium',
fullSuiteFor: [
'packages/admin-ui',
'packages/my-jetpack',
'packages/jitm',
'packages/forms',
'packages/podcast',
'packages/protect',
'packages/search',
'packages/backup',
'packages/activity-log',
'packages/publicize',
'packages/newsletter',
'packages/seo',
'packages/videopress',
'packages/monetize',
'packages/premium-analytics',
// The shell imports its view transitions.
'packages/wp-build-polyfills',
],
// The suite itself, and its CI files (when the PR also reaches the plugin).
fullSuiteForFiles: new RegExp(
[
'^projects/plugins/jetpack/tests/e2e/(specs/admin-shell/|helpers/admin-shell|plugins/e2e-admin-shell|bin/admin-shell|playwright\\.admin-shell)',
'^\\.github/(workflows/e2e-tests\\.yml|files/e2e-tests/)',
].join( '|' )
),
},
// On pushes to the mirror's trunk. The scheduled run covers the other browsers and WordPress version.
mirrorTrunk: { wpVersions: [ 'latest' ], browsers: 'chromium' },
scheduled: true,
},
{
project: 'Jetpack sync',
path: 'projects/plugins/jetpack/tests/e2e',
Expand Down Expand Up @@ -174,6 +216,44 @@ function minWpVersion() {

const matrix = [];

/**
* The pull request's diff range, for `git diff`.
*
* @return {string} `base...head`.
*/
function pullRequestDiff() {
const event = JSON.parse( fs.readFileSync( process.env.GITHUB_EVENT_PATH, 'utf8' ) );
return `${ event.pull_request.base.sha }...${ event.pull_request.head.sha }`;
}

/**
* Files the pull request changes.
*
* @return {string[]} Paths from the repository root.
*/
function changedFiles() {
return execSync( `git diff --name-only ${ pullRequestDiff() }` )
.toString()
.split( '\n' )
.filter( Boolean );
}

/**
* Projects the pull request changes itself, without the projects that only depend on them.
*
* @return {Set<string>} Project slugs, e.g. 'packages/admin-ui'.
*/
function directlyChangedProjects() {
const diff = pullRequestDiff();
return new Set(
// `--extra=e2e`: a change to the e2e environment counts as a change to every project.
execSync( `pnpm jetpack dependencies list --extra=e2e --git-changed=${ diff }` )
.toString()
.split( '\n' )
.filter( Boolean )
);
}

/**
* Queue a project against both the latest WordPress release and the oldest one we still support,
* so a change that only breaks the minimum version is caught while it's still in review.
Expand Down Expand Up @@ -210,8 +290,20 @@ switch ( process.env.GITHUB_EVENT_NAME ) {
}
const targets = dependencyCache.get( command );

if ( Object.keys( changedProjects ).some( target => targets.includes( target ) ) ) {
if ( ! Object.keys( changedProjects ).some( target => targets.includes( target ) ) ) {
continue;
}
if ( ! project.pullRequest || process.env.GITHUB_EVENT_NAME !== 'pull_request' ) {
pushBothVersions( project );
continue;
}
const { wpVersions, browsers, fullSuiteFor, fullSuiteForFiles } = project.pullRequest;
const direct = directlyChangedProjects();
const smoke =
! fullSuiteFor.some( slug => direct.has( slug ) ) &&
! changedFiles().some( file => fullSuiteForFiles.test( file ) );
for ( const wpVersion of wpVersions ) {
matrix.push( { ...project, wpVersion, browsers, smoke } );
}
}
break;
Expand Down Expand Up @@ -239,17 +331,32 @@ switch ( process.env.GITHUB_EVENT_NAME ) {
}
break;
}
case 'schedule':
for ( const project of projects.filter( ( { scheduled } ) => scheduled ) ) {
pushBothVersions( project );
}
break;
case 'repository_dispatch':
if ( process.env.DISPATCH_REPO ) {
const repoName = process.env.DISPATCH_REPO.split( '/' )[ 1 ];
const isTrunk =
process.env.DISPATCH_REF_TYPE === 'branch' && process.env.DISPATCH_REF_NAME === 'trunk';

for ( const project of projects ) {
const packageJson = JSON.parse(
fs.readFileSync( `${ project.path }/package.json`, 'utf8' )
);

if ( packageJson?.ci?.mirrorName === repoName ) {
if ( packageJson?.ci?.mirrorName !== repoName ) {
continue;
}
if ( ! isTrunk || ! project.mirrorTrunk ) {
pushBothVersions( project );
continue;
}
const { wpVersions, browsers } = project.mirrorTrunk;
for ( const wpVersion of wpVersions ) {
matrix.push( { ...project, wpVersion, browsers } );
}
}
} else {
Expand All @@ -260,4 +367,7 @@ switch ( process.env.GITHUB_EVENT_NAME ) {
console.error( `Unsupported GITHUB_EVENT_NAME ${ process.env.GITHUB_EVENT_NAME }.` );
}

console.log( JSON.stringify( matrix ) );
// These are input for this script, not for the workflow.
console.log(
JSON.stringify( matrix.map( ( { pullRequest, mirrorTrunk, scheduled, ...entry } ) => entry ) )
);
28 changes: 23 additions & 5 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- '**/changelog/**'
repository_dispatch:
types: [ 'e2e tests**' ]
schedule:
# Daily, for the projects marked `scheduled` in e2e-matrix.js.
- cron: '43 4 * * *'
workflow_dispatch:
inputs:
wp_version:
Expand All @@ -16,6 +19,7 @@ on:

concurrency:
# wp_version keeps concurrent dispatches for different WordPress versions from cancelling each other.
# The event name keeps pushes, which arrive as repository_dispatch, from cancelling scheduled runs.
group: e2e-tests-${{ github.event_name }}-${{ github.ref }}-${{ case( github.event_name == 'repository_dispatch', github.event.action, '' ) }}-${{ inputs.wp_version }}
cancel-in-progress: true

Expand All @@ -35,7 +39,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5 # 2025-11-20: The pnpm install may take a few minutes on cache miss.
# Only run tests in the main repository
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
if: >
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name &&
( github.event_name != 'schedule' || github.repository == 'Automattic/jetpack' )
outputs:
matrix: ${{ steps.evaluate.outputs.matrix }}
build-matrix: ${{ steps.evaluate.outputs.build-matrix }}
Expand All @@ -61,6 +67,8 @@ jobs:
id: evaluate
env:
DISPATCH_REPO: ${{ github.event.client_payload.repository }}
DISPATCH_REF_NAME: ${{ github.event.client_payload.ref_name }}
DISPATCH_REF_TYPE: ${{ github.event.client_payload.ref_type }}
WP_VERSION: ${{ inputs.wp_version }}
run: |
MATRIX="$(node .github/files/e2e-tests/e2e-matrix.js)"
Expand Down Expand Up @@ -165,6 +173,8 @@ jobs:
# Used in tests for enhanced reporting of global projects. The WordPress version is part of the
# name so the two runs of a project are distinguishable in the report.
PROJECT_NAME: '${{ matrix.project }} WP ${{ matrix.wpVersion }}'
# Admin shell suite: every browser, unless e2e-matrix.js narrows it.
ADMIN_SHELL_BROWSERS: ${{ matrix.browsers || 'chromium,firefox,webkit' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -270,9 +280,12 @@ jobs:
working-directory: ${{ matrix.path }}
env:
JSON_ARGS: ${{ toJSON(matrix.testArgs) }}
TEST_SCRIPT: ${{ matrix.testScript || 'test:run' }}
# Set by e2e-matrix.js on pull requests that don't change the admin shell or a dashboard it switches to.
ADMIN_SHELL_SMOKE: ${{ case( matrix.smoke == true, '1', '' ) }}
run: |
mapfile -t TEST_ARGS < <(jq -r '.[]' <<<"$JSON_ARGS")
pnpm run test:run "${TEST_ARGS[@]}"
pnpm run "$TEST_SCRIPT" "${TEST_ARGS[@]}"

- name: Test environment tear-down
if: ${{ always() }}
Expand Down Expand Up @@ -341,9 +354,14 @@ jobs:
actions: read
# actions/checkout, actions/download-artifact
contents: read
# Only mirror-repo dispatches notify. PR feedback is already in the GitHub Checks UI, and a manual
# dispatch has a human watching it who doesn't need the channel told.
if: ${{ always() && needs.e2e-tests.result != 'cancelled' && github.event_name == 'repository_dispatch' }}
# Only mirror-repo dispatches and scheduled runs notify. PR feedback is already in the GitHub Checks UI,
# and a manual dispatch has a human watching it who doesn't need the channel told.
# A timed-out job counts as cancelled. No push replaces a scheduled run, so there that's worth reporting.
if: >
always() && (
github.event_name == 'repository_dispatch' && needs.e2e-tests.result != 'cancelled' ||
github.event_name == 'schedule' && github.repository == 'Automattic/jetpack'
)
needs: [e2e-tests]

steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Admin shell: Wait for a closed modal to give the page back before announcing the next page.
8 changes: 7 additions & 1 deletion projects/packages/admin-ui/src/admin-shell/overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,17 @@ export async function closeDialogsOf( slug ) {
.flatMap( el => [ el, ...el.querySelectorAll( DIALOGS ) ] )
.filter( el => el.matches( DIALOGS ) );
dialogs.filter( d => ! escaped.has( d ) ).forEach( pressEscape );
// A modal gives the document back in an effect cleanup, which can run after it has left it.
const documentHidden = () =>
[ ...document.querySelectorAll( '#wpwrap, .a11y-speak-region' ) ].some( el =>
el.closest( '[aria-hidden="true"]' )
);
const open = () => dialogs.some( d => d.isConnected ) || ( dialogs.length && documentHidden() );
const start = performance.now();
const timeout = () =>
dialogs.some( d => d.isConnected && d.closest( CLOSING ) ) ? EXIT_TIMEOUT : CLOSE_TIMEOUT;
// Timers, not frames: a Back in a background tab gets no animation frames.
while ( dialogs.some( d => d.isConnected ) && performance.now() - start < timeout() ) {
while ( open() && performance.now() - start < timeout() ) {
await new Promise( resolve => setTimeout( resolve, 16 ) );
}
// One that stayed open, such as behind a confirm, gets Escape again the next time.
Expand Down
16 changes: 16 additions & 0 deletions projects/packages/admin-ui/tests/js/admin-shell/overlays.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ describe( 'overlays', () => {
expect( otherModal ).toBeInTheDocument();
} );

it( 'waits for a closed modal to give the document back', async () => {
const wrap = await addToBody( '' );
wrap.id = 'wpwrap';
wrap.setAttribute( 'aria-hidden', 'true' );
const modal = await addToBody( '<div role="dialog"></div>' );
modal.addEventListener( 'keydown', () => {
setTimeout( () => modal.remove(), 50 );
// unmodalize() runs in an effect cleanup, after React has removed the modal.
setTimeout( () => wrap.removeAttribute( 'aria-hidden' ), 120 );
} );

await closeDialogsOf( 'my-jetpack' );

expect( wrap ).not.toHaveAttribute( 'aria-hidden' );
} );

const animatingOut = dialog => dialog.parentElement.classList.add( 'is-animating-out' );
const endingStyle = dialog => dialog.setAttribute( 'data-ending-style', '' );

Expand Down
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/add-admin-shell-e2e-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Run the admin shell e2e suite in CI: a smoke set on most pull requests, the full suite when the shell or a dashboard changes.


15 changes: 15 additions & 0 deletions projects/plugins/jetpack/tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,25 @@ pnpm test:admin-shell
- `ADMIN_SHELL_URL` (default `http://localhost:8889`) must have `jetpack_admin_shell_enabled` on. Members marked `optional` in `helpers/admin-shell-helper.ts` need site setup, noted on each entry, and tests that use one skip where the site's admin menu lacks it. SEO, for example, shows only with the `seo-admin-ui` plan feature or the `rsm_jetpack_seo` filter, and with the `seo-tools` module on.
- `ADMIN_SHELL_OFF_URL` is optional: a site with the shell off, for the `shell off` smoke projects. Without it they are skipped.
- `ADMIN_SHELL_STANDALONE_URL` (with `ADMIN_SHELL_STANDALONE_USER` / `ADMIN_SHELL_STANDALONE_PASSWORD`) is optional: a site with the shell on and only standalone plugins, such as Backup, Social and VideoPress, without the Jetpack plugin (JETPACK-3419). It adds the `standalone` projects; without it there are none. Run it again after installing standalone plugins built against different Admin UI versions.
- `ADMIN_SHELL_BROWSERS` (default `chromium,firefox,webkit`) is a comma-separated list of the browsers to install and run.
- `ADMIN_SHELL_SMOKE=1` runs only the tests tagged `@smoke`.
- `ADMIN_SHELL_ALONE=1` runs only the specs that change or watch site-wide state (`ALONE` in the config: `feature-off`, and the Chromium `hover side effects` project, which needs `plugins/e2e-admin-shell.php`). Without it, those specs are left out. Run them with `--workers=1`, apart from the rest.
- Add `--project='shell on: chromium'` to run one browser.

Tests read shell state only through `readShell()` in `helpers/admin-shell-helper.ts`, which uses the `data-shell-page` / `data-shell-state` hooks. A document without the shell (shell off, or `?jetpack_admin_shell=0`) never has those hooks, so `readShell()` reads it from the `jetpack_page_<slug>` body class and that page's mount element; keep that path after the rewrite. `switchTo()` fails if a switch reloads the document, so tests that expect a full load click `menuLink()` instead.

In CI, the `Jetpack admin shell` entry in `.github/files/e2e-tests/e2e-matrix.js` runs it on PRs that touch the Jetpack plugin or any project it depends on (which covers `admin-ui` and every member), or the suite itself. `pnpm test:admin-shell:ci` (`bin/admin-shell-ci.sh`) runs it against the Docker site from `pnpm env:up`, reading the login from the decrypted config (`pnpm config:decrypt`). It activates the Forms and Podcast modules, then the `e2e-admin-shell` plugin, which keeps the site out of offline mode, stubs a WordPress.com connection (most members need one) and fails WordPress.com requests at once, and then the AI module, which needs that connection. It runs the `ALONE` specs first, with one worker, and makes sure Forms is on again. Then it runs the shell-on projects, then sets the `e2e_admin_shell_off` option and runs the shell-off smoke, so the two runs differ only by the flag. The standalone projects don't run in CI.

Pull requests run it in Chromium, against WordPress latest only. A pull request that changes `admin-ui`, `my-jetpack`, `jitm`, `wp-build-polyfills`, a dashboard package, the e2e environment or this suite (`fullSuiteFor` and `fullSuiteForFiles` in `e2e-matrix.js`) runs the whole suite (a change to only the e2e workflow files doesn't queue the entry at all); any other pull request that reaches the Jetpack plugin, including one that changes only its Settings or AI dashboard, runs only the tests tagged `@smoke` (`ADMIN_SHELL_SMOKE=1`).

The full suite opens only the dashboards in `helpers/admin-shell-helper.ts` that the CI site has. Pull request, scheduled and manual runs also build only the packages in this project's `build` script. For a dashboard package that isn't in it, such as `monetize` or `premium-analytics`, these runs don't test its JavaScript.

Every other run uses the whole suite:

- Each push to `jetpack-production` trunk runs it in Chromium, against WordPress latest. Its release branches and tags use all three browsers, on WordPress latest and the minimum supported version.
- A daily scheduled run builds monorepo trunk (not the mirror's full production build) and runs only this suite, in all three browsers, on both WordPress versions. New pushes can't cancel it. Failures go to Slack through the same notification job as the mirror runs.
- Manual runs use all three browsers, on one WordPress version.

Known bugs are `test.fail()` with a reason, so a fix shows up as an unexpected pass: remove the marker in the same PR. Intermittent bugs can't use `test.fail()`. Wrap those tests in `intermittentSpikeBug()`, which adds the `intermittent spike bug` annotation and the only retries in the config, so they report as flaky and anything else that fails intermittently still fails.

## CI Configuration
Expand Down
62 changes: 62 additions & 0 deletions projects/plugins/jetpack/tests/e2e/bin/admin-shell-ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash

# Runs the admin shell suite against the e2e Docker site from `pnpm env:up`: site-wide state specs, shell on, then shell off.
# Extra arguments go to every Playwright run. ADMIN_SHELL_SMOKE=1 runs only the @smoke tests.

set -uo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 1

WP=( pnpm jetpack docker --type e2e --name t1 wp -- )

ADMIN_SHELL_USER=$( node -p 'require( "./config/local.cjs" ).testSites.default.username' ) || exit 1
ADMIN_SHELL_PASSWORD=$( node -p 'require( "./config/local.cjs" ).testSites.default.password' ) || exit 1
export ADMIN_SHELL_USER ADMIN_SHELL_PASSWORD
# The shell-off run points ADMIN_SHELL_OFF_URL at the same site; this matches the config's default.
SITE_URL=${ADMIN_SHELL_URL:-http://localhost:8889}

# Comma-separated; playwright.admin-shell.config.ts runs the same list.
IFS=, read -ra BROWSERS <<<"${ADMIN_SHELL_BROWSERS:-chromium,firefox,webkit}"
# The runner image already has what Chromium needs; Firefox and WebKit need system packages.
if [[ "${BROWSERS[*]}" == chromium ]]; then
playwright install chromium || exit 1
else
playwright install --with-deps "${BROWSERS[@]}" || exit 1
fi

# The site is never connected, so default modules (including the Forms and Podcast members) aren't auto-activated.
# Do this before e2e-admin-shell takes the site out of offline mode, where an unconnected site refuses activation.
for module in contact-form podcast; do
"${WP[@]}" jetpack module activate "$module" || exit 1
done

STATUS=0
# A 4-core runner: the browsers and the site share it.
export PLAYWRIGHT_WORKERS=${PLAYWRIGHT_WORKERS:-4}

echo "::group::Shell on"
"${WP[@]}" plugin activate e2e-admin-shell || exit 1
# Jetpack AI's sidebar item shows only with the ai module on, and it needs the stubbed connection to activate.
"${WP[@]}" jetpack module activate ai || exit 1
"${WP[@]}" option delete e2e_admin_shell_off >/dev/null 2>&1
# The specs that need the site to themselves (ALONE in the config), first and one at a time.
if [[ "${ADMIN_SHELL_SMOKE:-}" != 1 ]]; then
ALONE_PROJECTS=( --project='shell on: *' )
# The config defines the hover project only for Chromium.
[[ " ${BROWSERS[*]} " == *" chromium "* ]] && ALONE_PROJECTS+=( --project='hover side effects' )
ADMIN_SHELL_RUN=alone ADMIN_SHELL_ALONE=1 PLAYWRIGHT_WORKERS=1 \
playwright test -c playwright.admin-shell.config.ts "${ALONE_PROJECTS[@]}" "$@" || STATUS=1
# feature-off switches Forms off. If its cleanup failed, every later Forms test would fail too.
"${WP[@]}" jetpack module activate contact-form || exit 1
fi
ADMIN_SHELL_RUN=shell-on playwright test -c playwright.admin-shell.config.ts --project='shell on: *' "$@" || STATUS=1
echo "::endgroup::"

echo "::group::Shell off"
"${WP[@]}" option update e2e_admin_shell_off 1 || exit 1
# One worker: both logins run here, and two at once on one site can stall each other.
ADMIN_SHELL_RUN=shell-off PLAYWRIGHT_WORKERS=1 ADMIN_SHELL_OFF_URL="$SITE_URL" \
ADMIN_SHELL_OFF_USER="$ADMIN_SHELL_USER" ADMIN_SHELL_OFF_PASSWORD="$ADMIN_SHELL_PASSWORD" \
playwright test -c playwright.admin-shell.config.ts --project='shell off: *' "$@" || STATUS=1
echo "::endgroup::"

exit $STATUS
Loading
Loading