-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (82 loc) · 2.24 KB
/
e2e-tests.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
98
name: E2E test
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.7
options: --privileged
# ports:
# - 5432:5432 # Example port for a service
# - 8080:8080
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.17.0'
- name: Install dependencies
working-directory: './client'
run: npm install
- name: Install browser dependencies
working-directory: './client'
run: |
sudo apt-get update
sudo apt-get install -y \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libdbus-1-3 \
libxkbcommon0 \
libgbm1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libasound2 \
libpango1.0-0 \
libcairo2 \
libatspi2.0-0 \
libwayland-client0 \
libwayland-cursor0 \
libwayland-egl1 \
libpci3
- name: Install Playwright browsers
working-directory: './client'
run: npx playwright install --with-deps
- name: Start Next.js app
working-directory: './client'
run: npm run dev &
env:
NODE_ENV: test
- name: Wait for start up
run: |
sleep 60
- name: Set up Docker Compose
run: |
docker-compose -f ./e2e-docker-compose.yaml up -d
- name: Wait for service initialisation
run: |
sleep 120
- name: Run Playwright tests
working-directory: './client'
run: npx playwright test try.spec.tsx
- name: Upload test report
uses: actions/upload-artifact@v2
with:
name: test-report
path: ./client/playwright-report/
- name: Clean up
run: |
docker-compose -f ./e2e-docker-compose.yaml down
pkill -f 'npm run dev'