Skip to content

Commit

Permalink
Tests against Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshaf committed Nov 16, 2024
1 parent 0047f47 commit f620def
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ on:

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

strategy:
fail-fast: false
matrix:
headless: [true]
browser: [chromium, firefox]

steps:
# 1. Checkout the repository
Expand Down Expand Up @@ -50,9 +51,9 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package.json', '**/playwright.config.*') }}
key: ${{ runner.os }}-playwright-${{ matrix.browser }}-${{ hashFiles('**/package.json', '**/playwright.config.*') }}
restore-keys: |
${{ runner.os }}-playwright-
${{ runner.os }}-playwright-${{ matrix.browser }}-
# 6. Install dependencies
- name: Install dependencies
Expand Down Expand Up @@ -86,7 +87,7 @@ jobs:

# 11. Install Playwright browsers
- name: Install Playwright browsers
run: pnpm --filter idb-cache-app exec playwright install
run: pnpm --filter idb-cache-app exec playwright install ${{ matrix.browser }}

# 12. Serve the idb-cache-app
- name: Serve idb-cache-app
Expand All @@ -107,14 +108,6 @@ jobs:
echo "Server failed to start in time."
exit 1
# 14. Run Playwright tests in headless mode
- name: Run Playwright tests (Headless)
if: ${{ matrix.headless == true }}
run: pnpm --filter idb-cache-app test

# 15. Run Playwright tests in headful mode on Linux
- name: Run Playwright tests (Headful)
if: ${{ matrix.headless == false }}
run: |
export HEADFUL=true
xvfb-run --auto-servernum -- pnpm --filter idb-cache-app test
# 14. Run Playwright tests
- name: Run Playwright tests
run: pnpm --filter idb-cache-app test -- --project=${{ matrix.browser }} --headless
1 change: 1 addition & 0 deletions packages/idb-cache-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@playwright/test": "^1.48.2",
"@rsbuild/core": "^1.0.19",
"@rsbuild/plugin-react": "^1.0.6",
"@types/node": "^22.9.0",
"@types/random-seed": "^0.3.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
Expand Down
17 changes: 9 additions & 8 deletions packages/idb-cache-app/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="node" />
import { defineConfig, devices } from "@playwright/test";

/**
Expand Down Expand Up @@ -39,15 +40,15 @@ export default defineConfig({
use: { ...devices["Desktop Chrome"] },
},

// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
// {
Expand Down
1 change: 1 addition & 0 deletions packages/idb-cache-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"types": ["node"],
"lib": ["DOM", "ES2020"],
"jsx": "react-jsx",
"target": "ES2020",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f620def

Please sign in to comment.