@@ -181,8 +181,36 @@ jobs:
181181 with :
182182 name : cypress-screenshots
183183 path : dist/cypress/packages/playground/website/screenshots
184- test-e2e-playwright-prepare :
184+ # E2E Playwright tests - builds inline per runner for faster parallel execution
185+ # Previously used a prepare job + artifact sharing, but inline builds allow
186+ # all shards to start immediately in parallel, reducing total wall time.
187+ test-e2e-playwright :
185188 runs-on : ubuntu-latest
189+ strategy :
190+ fail-fast : false
191+ matrix :
192+ # 3 shards per browser for balanced parallel execution
193+ # (4 shards caused uneven distribution due to serial test files)
194+ # WebKit disabled - random failures, see PR #2475
195+ include :
196+ - browser : ' chromium'
197+ shard : ' 1/3'
198+ shard_name : ' 1-of-3'
199+ - browser : ' chromium'
200+ shard : ' 2/3'
201+ shard_name : ' 2-of-3'
202+ - browser : ' chromium'
203+ shard : ' 3/3'
204+ shard_name : ' 3-of-3'
205+ - browser : ' firefox'
206+ shard : ' 1/3'
207+ shard_name : ' 1-of-3'
208+ - browser : ' firefox'
209+ shard : ' 2/3'
210+ shard_name : ' 2-of-3'
211+ - browser : ' firefox'
212+ shard : ' 3/3'
213+ shard_name : ' 3-of-3'
186214 steps :
187215 - name : Free up runner disk space
188216 shell : bash
@@ -201,68 +229,33 @@ jobs:
201229 with :
202230 submodules : true
203231 - uses : ./.github/actions/prepare-playground
204- - name : Install Playwright Browsers
205- run : sudo npx playwright install --with-deps
206- - name : Prepare app deploy and offline mode
207- run : CORS_PROXY_URL=http://127.0.0.1:5263/cors-proxy.php? npx nx e2e:playwright:prepare-app-deploy-and-offline-mode playground-website
208- - name : Zip dist
209- run : zip -r dist.zip dist
210- - name : Upload dist
211- uses : actions/upload-artifact@v4
212- with :
213- name : playwright-dist
214- path : dist.zip
215- test-e2e-playwright :
216- runs-on : ubuntu-latest
217- needs : [test-e2e-playwright-prepare]
218- strategy :
219- fail-fast : false
220- matrix :
221- # WebKit runner is disabled in CI – it used to be enabled but the tests
222- # failed randomly without any obvious reason.
223- # @see https://github.com/WordPress/wordpress-playground/pull/2475
224- part : ['chromium', 'firefox']
225- steps :
226- - uses : actions/checkout@v4
227- with :
228- submodules : true
229- - uses : ./.github/actions/prepare-playground
230- - name : Download dist
231- uses : actions/download-artifact@v4
232- with :
233- name : playwright-dist
234- - name : Unzip dist
235- run : unzip dist.zip
236232 - name : Install Playwright Browser
237- run : sudo npx playwright install ${{ matrix.part }} --with-deps
238- - name : Run Playwright tests - ${{ matrix.part }}
233+ run : sudo npx playwright install ${{ matrix.browser }} --with-deps
234+ - name : Build app for E2E tests
235+ run : CORS_PROXY_URL=http://127.0.0.1:5263/cors-proxy.php? npx nx e2e:playwright:prepare-app-deploy-and-offline-mode playground-website
236+ - name : Run Playwright tests - ${{ matrix.browser }}${{ matrix.shard && format(' (shard {0})', matrix.shard) || '' }}
239237 run : |
240- if [ "${{ matrix.part }}" = "firefox" ]; then
241- sudo -E HOME=/root XDG_RUNTIME_DIR=/root CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.part }}
238+ SHARD_ARG=""
239+ if [ -n "${{ matrix.shard }}" ]; then
240+ SHARD_ARG="--shard=${{ matrix.shard }}"
241+ fi
242+ if [ "${{ matrix.browser }}" = "firefox" ]; then
243+ sudo -E HOME=/root XDG_RUNTIME_DIR=/root CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.browser }} $SHARD_ARG
242244 else
243- sudo CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.part }}
245+ sudo CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.browser }} $SHARD_ARG
244246 fi
245247 - uses : actions/upload-artifact@v4
246248 if : ${{ !cancelled() }}
247249 with :
248- name : playwright-report-${{ matrix.part }}
250+ name : playwright-report-${{ matrix.browser }}${{ matrix.shard_name && format('-shard-{0}', matrix.shard_name) || '' }}
249251 path : packages/playground/website/playwright-report/
250252 if-no-files-found : ignore
251253 - uses : actions/upload-artifact@v4
252254 if : ${{ !cancelled() }}
253255 with :
254- name : playwright-snapshots-${{ matrix.part }}
256+ name : playwright-snapshots-${{ matrix.browser }}${{ matrix.shard_name && format('-shard-{0}', matrix.shard_name) || '' }}
255257 path : packages/playground/website/playwright/e2e/deployment.spec.ts-snapshots/
256258 if-no-files-found : ignore
257- test-e2e-playwright-cleanup :
258- runs-on : ubuntu-latest
259- needs : [test-e2e-playwright]
260- steps :
261- - name : Delete playwright-dist artifact
262- uses : geekyeggo/delete-artifact@v5
263- if : ${{ success() }}
264- with :
265- name : playwright-dist
266259
267260 test-e2e-components :
268261 runs-on : ubuntu-latest
0 commit comments