-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (83 loc) · 2.85 KB
/
playwright.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: "CI"
on:
pull_request:
push:
branches:
- main
- 'releases/*'
workflow_dispatch:
schedule:
- cron: '40 0 * * *' # Runs daily at 00:40 UTC
jobs:
test-linux:
name: Playwright@${{ matrix.playwright }} on ${{ matrix.os }} (headless=${{ matrix.headless }})
runs-on: ubuntu-20.04 # Specify the Ubuntu version you prefer
strategy:
fail-fast: false
matrix:
playwright: [1.8.0, 1.12.0, 1.18.0, next, beta]
headless: [true, false]
exclude:
# Add any exclusions if certain Playwright versions are incompatible
# For example, if headful mode isn't supported in older versions:
- playwright: 1.8.0
headless: false
- playwright: 1.12.0
headless: false
steps:
# 1. Checkout the repository
- uses: actions/checkout@v3
# 2. Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18 # Ensure this matches your project's Node.js version
# 3. Setup pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 7.x # Specify the pnpm version you want to use
# 4. Cache pnpm dependencies
- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
# 5. Install dependencies
- name: Install dependencies
run: pnpm install
# 6. Build the idb-cache-app
- name: Build idb-cache-app
run: pnpm --filter idb-cache-app build
# 7. Serve the idb-cache-app
- name: Serve idb-cache-app
run: pnpm --filter idb-cache-app preview -- --port 3000 &
# The '&' runs the serve command in the background
# 8. Wait for the server to be ready
- name: Wait for idb-cache-app to be ready
run: |
for i in {1..60}; do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Waiting for server to be ready... ($i/60)"
sleep 1
done
# 9. Install Playwright with the specified version
- name: Install Playwright
run: |
pnpm add -D playwright@${{ matrix.playwright }}
npx playwright install
# 10. Run Playwright tests in headless mode
- name: Run Playwright tests (Headless)
if: ${{ matrix.headless == true }}
run: npx playwright test
# 11. 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 -- npx playwright test