-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (82 loc) · 3.06 KB
/
end-to-end-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
on:
workflow_call:
inputs:
project:
required: false
type: string
default: chromium
jobs:
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "21.0"
distribution: "temurin"
cache: gradle
- name: Start PostgreSQL
run: docker compose -f docker-compose-services.yaml up --detach
- name: Start backend # GitHub actions automatically keep the process running and output is streamed to pipeline logs
run: ./gradlew bootRun &
working-directory: ./backend
- name: Wait for backend to be fully up
timeout-minutes: 5
run: |
until curl --output /dev/null --silent --head --fail http://localhost:8080/actuator/health; do
echo "Waiting for backend to be fully up..."
sleep 1
done
working-directory: ./backend
- name: Restore node_modules
uses: actions/cache@v4
id: restore-node-modules
with:
path: ./frontend/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('frontend/package-lock.json') }}
- name: Get Playwright version
working-directory: ./frontend
run: echo "PLAYWRIGHT_VERSION=$(jq -r '.packages["node_modules/@playwright/test"].version' package-lock.json)" >> $GITHUB_ENV
- name: Restore Playwright browser binaries
uses: actions/cache@v4
id: restore-browser-binaries
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Run e2e tests in ${{ inputs.project }} against localhost
env:
E2E_BASE_URL: "http://localhost:5173"
TZ: "Europe/Berlin"
run: |
echo "Running e2e tests for ${{ inputs.project }}"
npm run build
npm run preview -- --port 5173 &
DEV_PID=$!
npm run test:e2e -- --project ${{ inputs.project }} --repeat-each 1
pkill -P $DEV_PID
working-directory: ./frontend
- name: Upload screenshots and traces of failed tests
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: failed-e2e-tests-${{ inputs.project }}
path: |
./frontend/test-results/**/*.png
./frontend/test-results/**/trace.zip
- name: Upload test result blobs reports
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-results-blob-e2e-${{ inputs.project }}
path: ./frontend/blob-report/test-report.zip
retention-days: 1
- name: Send status to Slack
uses: digitalservicebund/notify-on-failure-gha@66c485757701f8d5dbee32f24df38d904ca693ba
if: ${{ failure() && github.ref == 'refs/heads/main' }}
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}