Make WordPress Core

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#66035 closed enhancement (fixed)

E2E workflow installs Playwright browsers and deps that no test uses

Reported by: adrianmoldovanwp Owned by: lancewillett
Priority: normal Milestone: 7.2
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch
Cc: Focuses: tests

Description

The end-to-end tests workflow does two pieces of Playwright setup that nothing uses.

The browser install runs twice

.github/workflows/reusable-end-to-end-tests.yml installs Chromium:

npm exec --no -- playwright install --with-deps chromium

The test step then runs npm run test:e2e, which is wp-scripts test-playwright. Before it starts the tests, that script runs playwright install with no browser argument:

if ( ! getAsBooleanFromENV( 'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD' ) ) {
        const result = spawn( 'npx', [ 'playwright', 'install' ], {
                stdio: 'inherit',
        } );
}

(@wordpress/scripts 33.0.0, scripts/test-playwright.js)

With no argument, playwright install installs Chromium, Firefox, and WebKit. The earlier step already cached Chromium, so each job downloads Firefox and WebKit and then never opens them.

Nothing in the repository runs on those two browsers. Every Playwright config under tests/ spreads the @wordpress/scripts base config, which declares one project:

projects: [ { name: 'chromium', use: { ...devices[ 'Desktop Chrome' ] } } ]

--with-deps installs only fonts

On ubuntu-24.04, every shared library Chromium needs reports already the newest version. The flag installs nine packages, and all nine are fonts: fonts-ipafont-gothic, fonts-freefont-ttf, fonts-tlwg-loma-otf, fonts-unifont, fonts-wqy-zenhei, xfonts-encodings, xfonts-utils, xfonts-cyrillic, xfonts-scalable.

Those fonts cover CJK, Thai, Cyrillic, and the X core fonts. No spec in tests/e2e uses those scripts, the workflow installs only de_DE, and no spec asserts on a screenshot.

Proposed change

Set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD on the test step, and drop --with-deps from the install step.

Change History (4)

This ticket was mentioned in ​PR #13369 on ​WordPress/wordpress-develop by ​@adrianmoldovanwp.


2 months ago
#1

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/66035

The E2E workflow does two pieces of Playwright setup that nothing uses.

A second browser install. wp-scripts test-playwright runs npx playwright install with no browser argument, which installs Chromium, Firefox, and WebKit. An earlier step already installed Chromium, so every job downloads Firefox and WebKit and never opens them. Setting PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD on the Run E2E tests step makes wp-scripts skip it.

--with-deps. On ubuntu-24.04, every shared library Chromium needs reports already the newest version. The flag installs nine font packages instead, covering CJK, Thai, Cyrillic, and the X core fonts. No spec in tests/e2e uses those scripts, the workflow installs only de_DE, and no spec asserts on a screenshot.

Before, on ​trunk run 33649288756:

Install Playwright browsers
  0 upgraded, 9 newly installed, 0 to remove and 86 not upgraded.
  Need to get 21.1 MB of archives.

Run E2E tests
  Downloading Firefox 151.0 (playwright firefox v1532) ...
  Downloading WebKit 26.5 (playwright webkit v2311) ...
  Playwright Host validation warning:
  ║ Host system is missing dependencies to run browsers. ║

After, on ​run 33661004598 for this branch: none of those lines appear, Chromium and the headless shell still install, and both jobs pass 27 tests, the same count as the trunk run. Each job finished about a minute sooner. A single pair of runs makes that figure noisy; the removed work accounts for roughly 36 seconds of it.

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Reviewing these changes against the CI job logs and the @wordpress/scripts source.

​@ugyensupport commented on ​PR #13369:


2 months ago
#2

Verified: reviewed the workflow diff and confirmed the gating logic (PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD is only set when install-playwright is true, so the fallback path for install-playwright: false callers is unaffected). Checked the PR's own CI run (#62141) directly: all 16 checks pass, both E2E matrix jobs succeed with 27/27 tests (26 passed + 1 flaky-then-passed) in each job, matching the trunk baseline count — confirming no coverage is lost by dropping --with-deps and skipping the redundant Firefox/WebKit download. LGTM.

#3 @lancewillett
2 months ago

  • Owner set to lancewillett
  • Resolution → fixed
  • Status new → closed

In 63446:

Build/Test Tools: Remove redundant Playwright setup from E2E CI.

The workflow installs Chromium before running the suite. Prevent wp-scripts test-playwright from installing Chromium, Firefox, and WebKit again when that setup has already run.

Also stop passing --with-deps, which only adds unused fonts on the current Ubuntu runner.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13369

Props adrianmoldovanwp, swissspidy, ugyensupport.
Fixes #66035.

#4 @lancewillett
2 months ago

  • Milestone Awaiting Review → 7.2
Note: See TracTickets for help on using tickets.