-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (65 loc) · 2.83 KB
/
Copy pathe2e.yml
File metadata and controls
83 lines (65 loc) · 2.83 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
74
75
76
77
78
79
80
81
82
83
name: E2E Tests
on:
pull_request:
branches: ["master"]
permissions:
contents: read
env:
FRONTEND_PATH: ./Frontend/control-panel
jobs:
e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
name: E2E – ${{ matrix.browser }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: ${{ env.FRONTEND_PATH }}/package-lock.json
- name: Install frontend dependencies
run: npm ci
working-directory: ${{ env.FRONTEND_PATH }}
- name: Build backend
run: dotnet build Backend/DSB.StreamBackend/DSB.StreamBackend.csproj
- name: Build E2E test project
run: dotnet build tests/DSB.StreamTool.E2E/DSB.StreamTool.E2E.csproj
- name: Install Playwright browser (${{ matrix.browser }})
run: pwsh tests/DSB.StreamTool.E2E/bin/Debug/net9.0/playwright.ps1 install --with-deps ${{ matrix.browser }}
- name: Start backend
run: dotnet run --project Backend/DSB.StreamBackend/DSB.StreamBackend.csproj --launch-profile http > backend.log 2>&1 &
env:
ASPNETCORE_ENVIRONMENT: Development
- name: Start Angular dev server
run: npm start > frontend.log 2>&1 &
working-directory: ${{ env.FRONTEND_PATH }}
- name: Wait for services to be ready
run: |
echo "Waiting for backend (http://localhost:7000)..."
timeout 60 bash -c 'until curl -sf http://localhost:7000/api/broadcast/state > /dev/null 2>&1; do sleep 2; done'
echo "Backend is ready."
echo "Waiting for frontend (http://localhost:4200)..."
timeout 120 bash -c 'until curl -sf http://localhost:4200 > /dev/null 2>&1; do sleep 2; done'
echo "Frontend is ready."
- name: Run E2E tests
run: dotnet test --no-build --verbosity normal tests/DSB.StreamTool.E2E/DSB.StreamTool.E2E.csproj
env:
BROWSER: ${{ matrix.browser }}
- name: Upload service logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: service-logs-${{ matrix.browser }}
path: |
backend.log
Frontend/control-panel/frontend.log
retention-days: 7