Skip to content

Commit

Permalink
test: Skip double installing playwright in E2E tests (#14633)
Browse files Browse the repository at this point in the history
We do install this on CI separately before, so this should not be
necessary (esp. we do not need firefox, as we only run these tests on
chromium).

This should shave off about 20s of the `build` step for all the E2E
tests!
  • Loading branch information
mydea authored Dec 10, 2024
1 parent a9cfd11 commit a9dcdb8
Show file tree
Hide file tree
Showing 50 changed files with 95 additions and 86 deletions.
7 changes: 7 additions & 0 deletions .github/actions/install-playwright/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
browsers:
description: 'What browsers to install.'
default: 'chromium webkit firefox'
cwd:
description: 'The working directory to run Playwright in.'
default: '.'

runs:
using: "composite"
Expand All @@ -12,6 +15,8 @@ runs:
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
shell: bash
working-directory: ${{ inputs.cwd }}


- name: Restore cached playwright binaries
uses: actions/cache/restore@v4
Expand All @@ -26,11 +31,13 @@ runs:
run: npx playwright install chromium webkit firefox --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ inputs.cwd }}

- name: Install Playwright system dependencies only (cached)
run: npx playwright install-deps ${{ inputs.browsers || 'chromium webkit firefox' }}
if: steps.playwright-cache.outputs.cache-hit == 'true'
shell: bash
working-directory: ${{ inputs.cwd }}

# Only store cache on develop branch
- name: Store cached playwright binaries
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -920,11 +920,6 @@ jobs:
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Get node version
id: versions
run: |
Expand All @@ -945,6 +940,12 @@ jobs:
timeout-minutes: 7
run: pnpm ${{ matrix.build-command || 'test:build' }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium
cwd: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}

- name: Run E2E test
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
timeout-minutes: 10
Expand Down Expand Up @@ -984,7 +985,7 @@ jobs:

# - We skip optional tests on release branches
job_optional_e2e_tests:
name: E2E ${{ matrix.label || matrix.test-application }} Test
name: E2E ${{ matrix.label || matrix.test-application }} Test (optional)
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
# We need to add the `always()` check here because the previous step has this as well :(
# See: https://github.com/actions/runner/issues/2205
Expand Down Expand Up @@ -1039,11 +1040,6 @@ jobs:
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Get node version
id: versions
run: |
Expand All @@ -1064,6 +1060,12 @@ jobs:
timeout-minutes: 7
run: pnpm ${{ matrix.build-command || 'test:build' }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium
cwd: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}

- name: Run E2E test
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
timeout-minutes: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "playwright test",
"clean": "npx rimraf .angular node_modules pnpm-lock.yaml dist"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "playwright test",
"clean": "npx rimraf .angular node_modules pnpm-lock.yaml dist"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "playwright test",
"clean": "npx rimraf .angular node_modules pnpm-lock.yaml dist"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "TEST_ENV=production playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "TEST_ENV=production playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml .next",
"test:prod": "TEST_ENV=prod playwright test",
"test:dev": "TEST_ENV=dev playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-13": "pnpm install && pnpm add [email protected] && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-13": "pnpm install && pnpm add [email protected] && pnpm build",
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start": "cross-env NODE_ENV=production node ./server.mjs",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "cross-env NODE_ENV=production node ./server.mjs",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start": "cross-env NODE_ENV=production node ./server.mjs",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "remix-serve build",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test",
"test:assert-sourcemaps": "pnpm upload-sourcemaps"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "remix-serve build/index.js",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "NODE_OPTIONS='--require=./instrument.server.cjs' remix-serve build/index.js",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "NODE_OPTIONS='--require=./instrument.server.cjs' remix-serve build",
"typecheck": "tsc",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm playwright test",
"test:assert-sourcemaps": "pnpm upload-sourcemaps"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "node build.mjs",
"test": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"browserslist": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"build": "ember build --environment=production",
"start": "ember serve --prod",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add ember-source@latest && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-latest": "pnpm install && pnpm add ember-source@latest && pnpm build",
"test:assert": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml dist"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"build": "ember build --environment=production",
"start": "ember serve --prod",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add ember-source@latest && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-latest": "pnpm install && pnpm add ember-source@latest && pnpm build",
"test:assert": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml dist"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml .next",
"test:prod": "TEST_ENV=production playwright test",
"test:dev": "TEST_ENV=development playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm build",
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:prod": "TEST_ENV=production playwright test",
"test:dev": "TEST_ENV=development playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm build",
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:prod": "TEST_ENV=production playwright test",
"test:dev": "TEST_ENV=development playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
"//": "15.0.0-canary.194 is the canary release attached to Next.js RC 1. We need to use the canary version instead of the RC because PPR will not work without. The specific react version is also attached to RC 1.",
"test:build-latest": "pnpm install && pnpm add [email protected] && pnpm add [email protected] && pnpm add [email protected] && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add [email protected] && pnpm add [email protected] && pnpm add [email protected] && pnpm build",
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:prod": "TEST_ENV=production playwright test",
"test:dev": "TEST_ENV=development playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:test-build": "pnpm ts-node --script-mode assert-build.ts",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && npx playwright install && pnpm build",
"test:build-13": "pnpm install && pnpm add [email protected] && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm build",
"test:build-13": "pnpm install && pnpm add [email protected] && pnpm build",
"test:assert": "pnpm test:test-build && pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:prod": "TEST_ENV=production playwright test",
"test:dev": "TEST_ENV=development playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@rc && pnpm add react@beta && pnpm add react-dom@beta && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@rc && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:prod": "TEST_ENV=production playwright test",
"test:dev": "TEST_ENV=development playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@canary && pnpm add react-dom@canary && npx playwright install && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm add react@rc && pnpm add react-dom@rc && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@canary && pnpm add react-dom@canary && pnpm build",
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm add react@rc && pnpm add react-dom@rc && pnpm build",
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "node .output/server/index.mjs",
"clean": "npx nuxi cleanup",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"start:import": "node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs",
"clean": "npx nuxi cleanup",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "node .output/server/index.mjs",
"clean": "npx nuxi cleanup",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start:import": "node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs",
"clean": "npx nuxi cleanup",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start:import": "node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs",
"clean": "npx nuxi cleanup",
"test": "playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"start": "serve -s build",
"test": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build-ts3.8": "pnpm install && pnpm add [email protected] && npx playwright install && pnpm build",
"test:build-canary": "pnpm install && pnpm add react@canary react-dom@canary && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:build-ts3.8": "pnpm install && pnpm add [email protected] && pnpm build",
"test:build-canary": "pnpm install && pnpm add react@canary react-dom@canary && pnpm build",
"test:assert": "pnpm test"
},
"eslintConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"start": "serve -s build",
"test": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"eslintConfig": {
Expand Down
Loading

0 comments on commit a9dcdb8

Please sign in to comment.