Skip to content

Commit 63bd340

Browse files
WIP github action for running services.
1 parent ee8aa87 commit 63bd340

File tree

5 files changed

+154
-35
lines changed

5 files changed

+154
-35
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Run E2e Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
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+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: lts/*
28+
29+
# Devbox Setup #
30+
- name: 'Create .env file' # Devbox needs a .env file to exist, even if it's empty
31+
run: touch .env
32+
33+
- name: Rename env files
34+
run: |
35+
mv builder-frontend/.env.example builder-frontend/.env
36+
mv builder-api/.env.example builder-api/.env
37+
38+
- name: 'Install devbox' # Setup devbox which includes Node.js, Firebase CLI, and Google Cloud SDK
39+
uses: 'jetify-com/devbox-install-action@v0.12.0'
40+
with:
41+
enable-cache: true
42+
43+
- id: 'auth' # Configure Workload Identity Federation and generate an access token
44+
name: 'Authenticate to Google Cloud'
45+
uses: 'google-github-actions/auth@v2'
46+
with:
47+
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
48+
service_account: cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
49+
project_id: ${{ env.PROJECT_ID }}
50+
51+
- name: Cache node modules
52+
uses: actions/cache@v4
53+
with:
54+
path: builder-frontend/node_modules
55+
key: ${{ runner.os }}-node-${{ hashFiles('builder-frontend/package-lock.json') }}
56+
restore-keys: |
57+
${{ runner.os }}-node-
58+
59+
- name: Install frontend dependencies
60+
working-directory: builder-frontend
61+
run: devbox run install-builder-frontend-ci
62+
63+
- name: Run all Devbox services
64+
run: devbox services up -b
65+
continue-on-error: true
66+
67+
# E2E Testing #
68+
- name: Install Playwright dependencies
69+
run: npm ci
70+
working-directory: e2e
71+
72+
- name: Install Playwright Browsers
73+
run: npx playwright install --with-deps
74+
working-directory: e2e
75+
76+
- name: Wait for App to be available
77+
uses: nev7n/wait_for_response@v1
78+
with:
79+
url: 'http://localhost:5173/'
80+
responseCode: 200
81+
timeout: 90000
82+
interval: 1000
83+
continue-on-error: true
84+
85+
- name: Run Playwright tests
86+
run: npx playwright test
87+
working-directory: e2e
88+
continue-on-error: true
89+
90+
- uses: actions/upload-artifact@v4
91+
if: ${{ !cancelled() }}
92+
with:
93+
name: playwright-report
94+
path: e2e/playwright-report/
95+
retention-days: 30
96+
97+
# Devbox Cleanup #
98+
- name: Stop all Devbox services
99+
run: devbox services stop
100+
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/.github/workflows/playwright.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

e2e/tests/example.spec.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import { test, expect } from '@playwright/test';
22

33
test('has title', async ({ page }) => {
4-
await page.goto('https://playwright.dev/');
4+
await page.goto('http://localhost:5173/');
55

66
// Expect a title "to contain" a substring.
7-
await expect(page).toHaveTitle(/Playwright/);
7+
await expect(page).toHaveTitle(/Benefit Decision Toolkit/);
88
});
99

1010
test('get started link', async ({ page }) => {
11-
await page.goto('https://playwright.dev/');
11+
await page.goto('http://localhost:5173/');
1212

1313
// Click the get started link.
14-
await page.getByRole('link', { name: 'Get started' }).click();
15-
16-
// Expects page to have a heading with the name of Installation.
17-
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
14+
await page.getByRole('button', { name: "Continue with Google" });
1815
});

0 commit comments

Comments
 (0)