Skip to content

Commit c379fb9

Browse files
authored
Merge pull request #133 from PMDevSolutions/ci/fix-e2e-webkit-cache
ci: reliably install WebKit for mobile Playwright e2e
2 parents 028f15c + 1726011 commit c379fb9

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ jobs:
3434
- name: Install dependencies
3535
run: pnpm install --frozen-lockfile
3636

37+
- name: Resolve Playwright version
38+
id: playwright-version
39+
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
40+
3741
- name: Cache Playwright browsers
3842
uses: actions/cache@v4
39-
id: playwright-cache
4043
with:
4144
path: ~/.cache/ms-playwright
42-
key: playwright-chromium-webkit-${{ runner.os }}-${{ hashFiles('widget/pnpm-lock.yaml') }}
45+
# Key on the resolved Playwright version: each version pins specific
46+
# browser builds (e.g. webkit-2272), so a bump auto-invalidates the cache.
47+
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
4348

44-
- name: Install Playwright browsers
45-
if: steps.playwright-cache.outputs.cache-hit != 'true'
49+
# Run unconditionally. `playwright install` is idempotent: it only downloads
50+
# browsers missing from the (possibly cached) ms-playwright dir, so a partial
51+
# or stale cache self-heals here instead of permanently skipping the binary
52+
# install. --with-deps re-applies system libraries, which are not cached.
53+
- name: Install Playwright browsers and system dependencies
4654
run: pnpm exec playwright install --with-deps chromium webkit
4755

48-
- name: Install Playwright system deps
49-
if: steps.playwright-cache.outputs.cache-hit == 'true'
50-
run: pnpm exec playwright install-deps chromium webkit
51-
5256
- name: Run E2E tests
5357
run: pnpm e2e
5458

widget/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"test:coverage": "vitest run --coverage",
6464
"e2e": "playwright test",
6565
"e2e:ui": "playwright test --ui",
66-
"e2e:install": "playwright install chromium",
66+
"e2e:install": "playwright install chromium webkit",
6767
"lint": "eslint src/",
6868
"lint:fix": "eslint src/ --fix",
6969
"format": "prettier --write \"src/**/*.{ts,tsx,css}\"",

widget/playwright.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export default defineConfig({
2828
testIgnore: ["**/mobile.spec.ts"],
2929
},
3030
{
31-
name: "chromium-mobile",
31+
// iPhone 13 emulation runs on WebKit (Mobile Safari), not Chromium —
32+
// name it accordingly so CI installs the right browser binary.
33+
name: "mobile-safari",
3234
use: { ...devices["iPhone 13"] },
3335
testMatch: ["**/mobile.spec.ts"],
3436
},

0 commit comments

Comments
 (0)