Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .github/actions/install-playwright/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ inputs:
cwd:
description: 'The working directory to run Playwright in.'
default: '.'
installed-version:
description:
'A Playwright version that an earlier run of this action already installed. Skips the install if it matches.'
default: ''

outputs:
version:
description: 'The resolved Playwright version, empty if Playwright is not installed or the install was skipped.'
value: ${{ steps.playwright-version.outputs.version }}

runs:
using: 'composite'
Expand All @@ -18,8 +27,11 @@ runs:
id: playwright-version
run: |
version=$(node -e "let v = ''; try { v = require('@playwright/test/package.json').version; } catch {} process.stdout.write(String(v));")
if [ "$version" = "$INSTALLED_VERSION" ]; then version=''; fi
echo "version=$version" >> "$GITHUB_OUTPUT"
shell: bash
env:
INSTALLED_VERSION: ${{ inputs.installed-version }}
working-directory: ${{ inputs.cwd }}

- name: Restore cached playwright binaries
Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,16 @@ jobs:
name: build-layer-output
path: ${{ env.BUILD_LAYER_PATH }}

# Installs the root workspace's Playwright version while the app builds. Most apps use the same version.
# The app's own version is only known after its build, so it gets installed then if it differs.
# Started after the artifact downloads: starting next to them made `download-artifact` fail to read the event file.
- name: Install Playwright
id: install-playwright
background: true
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Prepare e2e tests
run: yarn test:prepare
working-directory: dev-packages/e2e-tests
Expand All @@ -1116,11 +1126,14 @@ jobs:
env:
SENTRY_E2E_WORKSPACE_ROOT: ${{ github.workspace }}

- name: Install Playwright
- wait: [install-playwright]

- name: Install Playwright for the app's version
uses: ./.github/actions/install-playwright
with:
browsers: chromium
cwd: ${{ runner.temp }}/test-application
installed-version: ${{ steps.install-playwright.outputs.version }}

- name: Run E2E test
working-directory: ${{ runner.temp }}/test-application
Expand Down Expand Up @@ -1220,6 +1233,16 @@ jobs:
name: build-tarball-output
path: ${{ env.TARBALL_ARTIFACT_DOWNLOAD_PATH }}

# Installs the root workspace's Playwright version while the app builds. Most apps use the same version.
# The app's own version is only known after its build, so it gets installed then if it differs.
# Started after the artifact downloads: starting next to them made `download-artifact` fail to read the event file.
- name: Install Playwright
id: install-playwright
background: true
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Prepare E2E tests
run: yarn test:prepare
working-directory: dev-packages/e2e-tests
Expand All @@ -1243,11 +1266,14 @@ jobs:
timeout-minutes: 7
run: ${{ matrix.build-command || 'pnpm test:build' }}

- name: Install Playwright
- wait: [install-playwright]

- name: Install Playwright for the app's version
uses: ./.github/actions/install-playwright
with:
browsers: chromium
cwd: ${{ runner.temp }}/test-application
installed-version: ${{ steps.install-playwright.outputs.version }}

- name: Run E2E test
working-directory: ${{ runner.temp }}/test-application
Expand Down
Loading