-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 1.94 KB
/
browserstack-e2e.yml
File metadata and controls
73 lines (61 loc) · 1.94 KB
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
name: BrowserStack E2E
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
browserstack-e2e:
name: BrowserStack E2E
runs-on: ubuntu-latest
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
E2E_BASE_URL: http://bs-local.com:5173
steps:
- uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
cache-dependency-path: apps/web/package-lock.json
- name: Validate BrowserStack credentials
run: |
if [ -z "${BROWSERSTACK_USERNAME}" ] || [ -z "${BROWSERSTACK_ACCESS_KEY}" ]; then
echo "Missing BrowserStack credentials" >&2
exit 1
fi
- name: Install dependencies
run: |
cd apps/web
npm ci
npx playwright install --with-deps chromium
- name: Prepare env file
run: cp .env.example .env
- name: Start local stack
run: docker compose -f infra/docker-compose.yml up -d --build
- name: Wait for web
run: |
set -euo pipefail
for i in $(seq 1 90); do
if curl -fsS http://127.0.0.1:5173 >/dev/null; then
exit 0
fi
sleep 2
done
echo "web failed to start" >&2
exit 1
- name: Run BrowserStack matrix tests
run: |
cd apps/web
npx browserstack-node-sdk playwright test e2e/browserstack-core.spec.ts --config=playwright.config.ts --workers=1
- name: Logs on failure
if: failure()
run: docker compose -f infra/docker-compose.yml logs --no-color --tail=200 || true
- name: Teardown
if: always()
run: timeout 180 docker compose -f infra/docker-compose.yml down -v || true