Skip to content

Commit 58cb330

Browse files
committed
playwright ci
1 parent 2de82de commit 58cb330

File tree

4 files changed

+103
-7
lines changed

4 files changed

+103
-7
lines changed

.github/workflows/playwright.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: "Run Playwright tests"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- 'releases/*'
9+
workflow_dispatch:
10+
schedule:
11+
- cron: '40 0 * * *' # Runs daily at 00:40 UTC
12+
13+
jobs:
14+
test-linux:
15+
name: Playwright@${{ matrix.playwright }} on ${{ matrix.os }} (headless=${{ matrix.headless }})
16+
runs-on: ubuntu-20.04 # Specify the Ubuntu version you prefer
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
headless: [true]
22+
23+
steps:
24+
# 1. Checkout the repository
25+
- uses: actions/checkout@v3
26+
27+
# 2. Setup Node.js
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: 18
32+
33+
# 3. Setup pnpm
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v2
36+
with:
37+
version: 7.x
38+
39+
# 4. Cache pnpm dependencies
40+
- name: Cache pnpm dependencies
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.pnpm-store
44+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-pnpm-store-
47+
48+
# 5. Install dependencies
49+
- name: Install dependencies
50+
run: pnpm install
51+
52+
# 6. Build the @instructure/idb-cache package
53+
- name: Build idb-cache package
54+
run: pnpm --filter @instructure/idb-cache build
55+
56+
# 7. Build the idb-cache-app
57+
- name: Build idb-cache-app
58+
run: pnpm --filter idb-cache-app build
59+
60+
# 8. Serve the idb-cache-app
61+
- name: Serve idb-cache-app
62+
run: pnpm --filter idb-cache-app preview -- --port 3000 &
63+
# The '&' runs the serve command in the background
64+
65+
# 9. Wait for the server to be ready
66+
- name: Wait for idb-cache-app to be ready
67+
run: |
68+
for i in {1..60}; do
69+
if curl -s http://localhost:3000 > /dev/null; then
70+
echo "Server is ready!"
71+
break
72+
fi
73+
echo "Waiting for server to be ready... ($i/60)"
74+
sleep 1
75+
done
76+
77+
# 10. Install Playwright with the specified version
78+
- name: Install Playwright
79+
run: |
80+
pnpm add -D playwright@${{ matrix.playwright }}
81+
npx playwright install
82+
83+
# 11. Run Playwright tests in headless mode
84+
- name: Run Playwright tests (Headless)
85+
if: ${{ matrix.headless == true }}
86+
run: npx playwright test
87+
88+
# 12. Run Playwright tests in headful mode on Linux
89+
- name: Run Playwright tests (Headful)
90+
if: ${{ matrix.headless == false }}
91+
run: |
92+
export HEADFUL=true
93+
xvfb-run --auto-servernum -- npx playwright test

packages/idb-cache-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"react-dom": "^18.3.1"
1515
},
1616
"devDependencies": {
17-
"@playwright/test": "^1.48.2",
1817
"@instructure/ui": "^9.9.0",
1918
"@instructure/ui-buttons": "^9.9.0",
2019
"@instructure/ui-flex": "^9.9.0",
@@ -23,12 +22,14 @@
2322
"@instructure/ui-number-input": "^9.9.0",
2423
"@instructure/ui-text-input": "^9.9.0",
2524
"@instructure/ui-view": "^9.9.0",
25+
"@playwright/test": "^1.48.2",
2626
"@rsbuild/core": "^1.0.19",
2727
"@rsbuild/plugin-react": "^1.0.6",
2828
"@types/random-seed": "^0.3.5",
2929
"@types/react": "^18.3.12",
3030
"@types/react-dom": "^18.3.1",
3131
"daisyui": "^4.12.14",
32+
"idb": "^8.0.0",
3233
"tailwindcss": "^3.4.15",
3334
"typescript": "^5.6.3"
3435
}

packages/idb-cache/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
"biome:check": "biome check . --write"
2727
},
2828
"peerDependencies": {
29-
"@rslib/core": "^0.0.15",
30-
"idb": "^8.0.0"
29+
"@rslib/core": "^0.0.15"
3130
},
3231
"devDependencies": {
3332
"@rslib/core": "^0.0.15",
3433
"@types/node": "^22.9.0",
34+
"idb": "^8.0.0",
3535
"typescript": "^5.6.3"
3636
}
3737
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)