Skip to content

Commit f620def

Browse files
committed
Tests against Firefox
1 parent 0047f47 commit f620def

File tree

5 files changed

+22
-23
lines changed

5 files changed

+22
-23
lines changed

.github/workflows/playwright.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ on:
1010

1111
jobs:
1212
test-linux:
13-
name: Playwright tests on Linux (headless=${{ matrix.headless }})
13+
name: Playwright tests on Linux (headless=${{ matrix.headless }}, browser=${{ matrix.browser }})
1414
runs-on: ubuntu-22.04
1515

1616
strategy:
1717
fail-fast: false
1818
matrix:
1919
headless: [true]
20+
browser: [chromium, firefox]
2021

2122
steps:
2223
# 1. Checkout the repository
@@ -50,9 +51,9 @@ jobs:
5051
uses: actions/cache@v3
5152
with:
5253
path: ~/.cache/ms-playwright
53-
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package.json', '**/playwright.config.*') }}
54+
key: ${{ runner.os }}-playwright-${{ matrix.browser }}-${{ hashFiles('**/package.json', '**/playwright.config.*') }}
5455
restore-keys: |
55-
${{ runner.os }}-playwright-
56+
${{ runner.os }}-playwright-${{ matrix.browser }}-
5657
5758
# 6. Install dependencies
5859
- name: Install dependencies
@@ -86,7 +87,7 @@ jobs:
8687

8788
# 11. Install Playwright browsers
8889
- name: Install Playwright browsers
89-
run: pnpm --filter idb-cache-app exec playwright install
90+
run: pnpm --filter idb-cache-app exec playwright install ${{ matrix.browser }}
9091

9192
# 12. Serve the idb-cache-app
9293
- name: Serve idb-cache-app
@@ -107,14 +108,6 @@ jobs:
107108
echo "Server failed to start in time."
108109
exit 1
109110
110-
# 14. Run Playwright tests in headless mode
111-
- name: Run Playwright tests (Headless)
112-
if: ${{ matrix.headless == true }}
113-
run: pnpm --filter idb-cache-app test
114-
115-
# 15. Run Playwright tests in headful mode on Linux
116-
- name: Run Playwright tests (Headful)
117-
if: ${{ matrix.headless == false }}
118-
run: |
119-
export HEADFUL=true
120-
xvfb-run --auto-servernum -- pnpm --filter idb-cache-app test
111+
# 14. Run Playwright tests
112+
- name: Run Playwright tests
113+
run: pnpm --filter idb-cache-app test -- --project=${{ matrix.browser }} --headless

packages/idb-cache-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@playwright/test": "^1.48.2",
2727
"@rsbuild/core": "^1.0.19",
2828
"@rsbuild/plugin-react": "^1.0.6",
29+
"@types/node": "^22.9.0",
2930
"@types/random-seed": "^0.3.5",
3031
"@types/react": "^18.3.12",
3132
"@types/react-dom": "^18.3.1",

packages/idb-cache-app/playwright.config.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="node" />
12
import { defineConfig, devices } from "@playwright/test";
23

34
/**
@@ -39,15 +40,15 @@ export default defineConfig({
3940
use: { ...devices["Desktop Chrome"] },
4041
},
4142

42-
// {
43-
// name: 'firefox',
44-
// use: { ...devices['Desktop Firefox'] },
45-
// },
43+
{
44+
name: "firefox",
45+
use: { ...devices["Desktop Firefox"] },
46+
},
4647

47-
// {
48-
// name: 'webkit',
49-
// use: { ...devices['Desktop Safari'] },
50-
// },
48+
{
49+
name: "webkit",
50+
use: { ...devices["Desktop Safari"] },
51+
},
5152

5253
/* Test against mobile viewports. */
5354
// {

packages/idb-cache-app/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"types": ["node"],
34
"lib": ["DOM", "ES2020"],
45
"jsx": "react-jsx",
56
"target": "ES2020",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)