-
Notifications
You must be signed in to change notification settings - Fork 14
93 lines (77 loc) · 2.61 KB
/
test_e2e.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
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: 'Test: E2E'
on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/test_e2e.yml'
- 'e2e/**'
- 'services/.env.example'
- 'services/**'
- '!services/**.test.ts'
- '!services/**.spec.ts'
- 'interfaces/Portal/**'
- '!interfaces/Portal/**.test.ts'
- '!interfaces/Portal/**.spec.ts'
- '!**.md'
env:
e2eTestsPath: 'e2e/'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: '${{ env.e2eTestsPath }}/.node-version'
cache: 'npm'
cache-dependency-path: '${{ env.e2eTestsPath }}/package-lock.json'
- name: Set ENV-variables for test-environment
run: |
cp ./services/.env.example services/.env
- name: Run Services with Docker
working-directory: ./services
run: |
docker --log-level 'warn' compose -f docker-compose.yml up -d --quiet-pull --wait --wait-timeout 300
- name: Start Portal
working-directory: ./interfaces/Portal
env:
NG_URL_121_SERVICE_API: http://localhost:3000/api
run: |
npm install
npm run start:debug-production > portal-server-logs.txt 2>&1 &
- name: Install e2e dependencies
working-directory: ${{ env.e2eTestsPath }}
run: |
npm ci --omit=optional --no-fund --no-audit
npx playwright install chromium --with-deps
- name: Lint e2e tests
working-directory: ${{ env.e2eTestsPath }}
run: 'npm run lint'
- name: Install service dependencies
# This step is necessary because the tests run functions in this folder
working-directory: ./services/121-service
run: |
npm install
- name: Wait for Portal
run: |
timeout 90s sh -c 'until curl http://localhost:8088 -I; do echo "Waiting for the Portal to be running..."; sleep 1; done'
- name: Run e2e tests with Playwright
working-directory: ./e2e
env:
BASE_URL: http://localhost:8088
run: |
npm test
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-result-artifacts
path: |
./e2e/test-results/
./interfaces/Portal/portal-server-logs.txt
retention-days: 30
- name: Docker logs
if: always()
uses: jwalton/gh-docker-logs@v2