This repository was archived by the owner on Jul 17, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
101 lines (81 loc) · 2.6 KB
/
frontend-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
99
100
101
name: Frontend end-to-end tests
on:
push:
branches:
- saga
paths:
- 'frontend/**'
- '.github/workflows/frontend-e2e-tests.yml'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'frontend/**'
- '.github/workflows/frontend-e2e-tests.yml'
env:
DB_ENV: ci
jobs:
frontend-e2e-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: distributeaid_test
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install modules
run: yarn --frozen-lockfile
- name: Run codegen
run: yarn codegen
- name: Install frontend modules
working-directory: frontend
run: yarn --frozen-lockfile
- name: Install playwright (Firefox)
working-directory: frontend
run: npx playwright install firefox
- name: Build
working-directory: frontend
run: |
echo "REACT_APP_SERVER_URL=\"http://localhost:3000\"" > .env.production.local
yarn build
- name: Build TypeScript
run: yarn run build
- name: Initialize Database
run: npx sequelize-cli --env=ci db:migrate
- name: Run backend
run: node dist/src/server/dev.js > server.log 2>&1 &
- name: Wait for backend to be up
run: until nc -w 10 127.0.0.1 3000; do sleep 1; done
- name: Run tests (unauthenticated)
working-directory: frontend
run: npx playwright test tests/playwright/unauthenticated
- name: Run tests (user onboarding)
working-directory: frontend
run: npx playwright test tests/playwright/authenticated/user/onboarding
- name: Run tests (admin workflows)
working-directory: frontend
run: npx playwright test tests/playwright/authenticated/admin
- name: Run tests (user offer creation)
working-directory: frontend
run: npx playwright test tests/playwright/authenticated/user/offer
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-artifacts-${{ github.sha }}
path: |
frontend/test-session/
server.log