Skip to content

Commit 2b8a67a

Browse files
- feat: Create basic E2E Test suite.
- feat: Create GitHub Workflow to run E2E suite on PR creation/updates and merges to "main".
1 parent a20322b commit 2b8a67a

File tree

23 files changed

+443
-2
lines changed

23 files changed

+443
-2
lines changed

.github/workflows/deploy-builder-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
path: ~/.m2/repository
5151
key: ${{ runner.os }}-maven-${{ hashFiles('builder-api/pom.xml') }}
5252
restore-keys: |
53-
${{ runner.os }}-maven-
53+
${{ runner.os }}-maven-${{ hashFiles('builder-api/pom.xml') }}
5454
5555
# Configure Workload Identity Federation and generate an access token
5656
- id: 'auth'
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Run E2E Tests
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
env:
9+
PROJECT_ID: 'benefit-decision-toolkit-play'
10+
WORKLOAD_IDENTITY_PROVIDER: 'projects/1034049717668/locations/global/workloadIdentityPools/github-actions-google-cloud/providers/github'
11+
12+
jobs:
13+
run-e2e-tests:
14+
runs-on: 'ubuntu-latest'
15+
16+
# Add these permissions for Workload Identity Federation
17+
permissions:
18+
contents: read
19+
id-token: write
20+
21+
steps:
22+
# Bootstrapping #
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: lts/*
29+
30+
# 1) Devbox Setup #
31+
- name: 'Create .env file' # Devbox needs a .env file to exist, even if it's empty
32+
run: touch .env
33+
34+
- name: Rename env files
35+
run: |
36+
mv builder-frontend/.env.example builder-frontend/.env
37+
mv builder-api/.env.example builder-api/.env
38+
39+
- name: 'Install devbox' # Setup devbox which includes Node.js, Firebase CLI, and Google Cloud SDK
40+
uses: 'jetify-com/[email protected]'
41+
with:
42+
enable-cache: true
43+
44+
# 2) Prepare app dependencies #
45+
- name: 'Cache Maven dependencies'
46+
# Cache Maven dependencies to speed up builds
47+
uses: 'actions/cache@v4'
48+
with:
49+
path: ~/.m2/repository
50+
key: ${{ runner.os }}-maven-${{ hashFiles('builder-api/pom.xml') }}
51+
restore-keys: |
52+
${{ runner.os }}-maven-
53+
54+
- id: 'auth' # Configure Workload Identity Federation and generate an access token
55+
name: 'Authenticate to Google Cloud'
56+
uses: 'google-github-actions/auth@v2'
57+
with:
58+
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
59+
service_account: cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
60+
project_id: ${{ env.PROJECT_ID }}
61+
62+
- name: Cache node modules
63+
uses: actions/cache@v4
64+
with:
65+
path: builder-frontend/node_modules
66+
key: ${{ runner.os }}-node-${{ hashFiles('builder-frontend/package-lock.json') }}
67+
restore-keys: |
68+
${{ runner.os }}-node-
69+
70+
- name: Install frontend dependencies
71+
working-directory: builder-frontend
72+
run: devbox run install-builder-frontend-ci
73+
74+
- name: Load E2E emulator data
75+
run: |
76+
rm -rf emulator-data
77+
cp -r e2e/e2e-emulator-data emulator-data
78+
79+
# 3) Run App + E2E Test #
80+
- name: Run all Devbox services
81+
run: devbox services up -b
82+
continue-on-error: true
83+
84+
- name: Install Playwright dependencies
85+
run: npm ci
86+
working-directory: e2e
87+
88+
- name: Install Playwright Browsers
89+
run: npx playwright install --with-deps
90+
working-directory: e2e
91+
92+
- name: Wait for App to be available
93+
uses: nev7n/wait_for_response@v1
94+
with:
95+
url: 'http://localhost:5173/'
96+
responseCode: 200
97+
timeout: 90000
98+
interval: 1000
99+
continue-on-error: true
100+
101+
- name: Run Playwright tests
102+
run: npx playwright test
103+
working-directory: e2e
104+
continue-on-error: true
105+
106+
- uses: actions/upload-artifact@v4
107+
if: ${{ !cancelled() }}
108+
with:
109+
name: playwright-report
110+
path: e2e/playwright-report/
111+
retention-days: 30
112+
113+
# 4) Cleanup #
114+
- name: Stop all Devbox services
115+
run: devbox services stop
116+
continue-on-error: true

devbox.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"firebase-tools@latest",
88
"google-cloud-sdk@latest",
99
"nodejs@22",
10-
"bruno-cli@latest"
10+
"bruno-cli@latest",
11+
"process-compose@latest"
1112
],
1213
"env_from": ".env",
1314
"shell": {

devbox.lock

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,54 @@
314314
}
315315
}
316316
},
317+
"process-compose@latest": {
318+
"last_modified": "2025-11-23T21:50:36Z",
319+
"resolved": "github:NixOS/nixpkgs/ee09932cedcef15aaf476f9343d1dea2cb77e261#process-compose",
320+
"source": "devbox-search",
321+
"version": "1.78.0",
322+
"systems": {
323+
"aarch64-darwin": {
324+
"outputs": [
325+
{
326+
"name": "out",
327+
"path": "/nix/store/d00iad83k88x0fq045h5pzhfj9ibdd3a-process-compose-1.78.0",
328+
"default": true
329+
}
330+
],
331+
"store_path": "/nix/store/d00iad83k88x0fq045h5pzhfj9ibdd3a-process-compose-1.78.0"
332+
},
333+
"aarch64-linux": {
334+
"outputs": [
335+
{
336+
"name": "out",
337+
"path": "/nix/store/zx59c11mchqfjpl0yvv2fad87pf3p8mn-process-compose-1.78.0",
338+
"default": true
339+
}
340+
],
341+
"store_path": "/nix/store/zx59c11mchqfjpl0yvv2fad87pf3p8mn-process-compose-1.78.0"
342+
},
343+
"x86_64-darwin": {
344+
"outputs": [
345+
{
346+
"name": "out",
347+
"path": "/nix/store/hwipxpsgzpv8d51xvqdjyx3vbzaaf3rr-process-compose-1.78.0",
348+
"default": true
349+
}
350+
],
351+
"store_path": "/nix/store/hwipxpsgzpv8d51xvqdjyx3vbzaaf3rr-process-compose-1.78.0"
352+
},
353+
"x86_64-linux": {
354+
"outputs": [
355+
{
356+
"name": "out",
357+
"path": "/nix/store/vw9d8v9r0kp44lmizysj7idmqyf9747l-process-compose-1.78.0",
358+
"default": true
359+
}
360+
],
361+
"store_path": "/nix/store/vw9d8v9r0kp44lmizysj7idmqyf9747l-process-compose-1.78.0"
362+
}
363+
}
364+
},
317365
"quarkus@latest": {
318366
"last_modified": "2025-08-11T16:06:55Z",
319367
"resolved": "github:NixOS/nixpkgs/4e942f9ef5b35526597c354d1ded817d1c285ef1#quarkus",

e2e/.auth/user.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cookies": [],
3+
"origins": []
4+
}

e2e/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# Playwright
3+
node_modules/
4+
/test-results/
5+
/playwright-report/
6+
/blob-report/
7+
/playwright/.cache/
8+
/playwright/.auth/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"kind": "identitytoolkit#DownloadAccountResponse",
3+
"users": [
4+
{
5+
"localId": "E2uB0h1FpSUKq5rGObr9jvmbn15E",
6+
"lastLoginAt": "1766942325287",
7+
"emailVerified": false,
8+
"email": "[email protected]",
9+
"salt": "fakeSaltirMZBjlsDBLmp2MfKjTv",
10+
"passwordHash": "fakeHash:salt=fakeSaltirMZBjlsDBLmp2MfKjTv:password=testpassword123",
11+
"passwordUpdatedAt": 1766942325288,
12+
"validSince": "1766942325",
13+
"createdAt": "1766942325287",
14+
"providerUserInfo": [
15+
{
16+
"providerId": "password",
17+
"email": "[email protected]",
18+
"federatedId": "[email protected]",
19+
"rawId": "[email protected]"
20+
}
21+
],
22+
"lastRefreshAt": "2025-12-28T17:18:45.288Z"
23+
}
24+
]
25+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"signIn":{"allowDuplicateEmails":false},"emailPrivacyConfig":{"enableImprovedEmailPrivacy":false}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "14.11.2",
3+
"firestore": {
4+
"version": "1.19.8",
5+
"path": "firestore_export",
6+
"metadata_file": "firestore_export/firestore_export.overall_export_metadata"
7+
},
8+
"auth": {
9+
"version": "14.11.2",
10+
"path": "auth_export"
11+
},
12+
"storage": {
13+
"version": "14.11.2",
14+
"path": "storage_export"
15+
}
16+
}

0 commit comments

Comments
 (0)