Skip to content

Commit a92072b

Browse files
committed
Cache playwright browser
1 parent 986f85f commit a92072b

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,35 @@ jobs:
2424
- name: Install dependencies
2525
run: npm ci
2626

27-
- name: Install Playwright Browsers
27+
# https://github.com/microsoft/playwright/issues/7249#issuecomment-1385567519
28+
- name: Store Playwright's Version
29+
run: |
30+
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
31+
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
32+
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
33+
34+
- name: Cache Playwright Browsers for Playwright's Version
35+
id: cache-playwright-browsers
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.cache/ms-playwright
39+
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
40+
41+
- name: Setup Playwright
42+
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
2843
run: npx playwright install --with-deps
2944

45+
- name: Install system dependencies for WebKit
46+
# Some WebKit dependencies seem to lay outside the cache and will need to be installed separately
47+
if: ${{ steps.cache-playwright-browsers.outputs.cache-hit == 'true' }}
48+
run: npx playwright install-deps webkit
49+
3050
- name: Run Playwright tests
3151
run: npm run e2e
52+
53+
- uses: actions/upload-artifact@v4
54+
if: ${{ !cancelled() }}
55+
with:
56+
name: playwright-report
57+
path: playwright-report/
58+
retention-days: 30

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules/
22
dist
33
lib
44
test-results
5+
playwright-report

config/playwright.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export default defineConfig({
99
timeout: 60 * 1000,
1010
reuseExistingServer: !process.env.CI
1111
},
12+
reporter: !process.env.GITHUB_ACTIONS
13+
? [
14+
['list', { printSteps: true, forceColor: true }],
15+
['html', { open: 'never' }]
16+
]
17+
: 'html',
1218
projects: [
1319
{
1420
name: 'Chrome Desktop',

tests/common.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@playwright/test'
1+
import { expect, test } from '@playwright/test'
22

33
const providers = ['html5', 'youtube', 'vimeo', 'dailymotion']
44

tests/player.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@playwright/test'
1+
import { expect, test } from '@playwright/test'
22

33
test.describe('HTML5 Player Tests', () => {
44
test.beforeEach(async ({ page }) => {

0 commit comments

Comments
 (0)