Skip to content

Commit a833745

Browse files
author
Nick Campanini
committed
Merge branch 'main' into fix/DC-216-co-socure-config
2 parents 668110e + 0542246 commit a833745

6 files changed

Lines changed: 166 additions & 71 deletions

File tree

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Playwright E2E
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
pull_request:
10+
branches: ["main"]
11+
12+
jobs:
13+
e2e:
14+
name: E2E Tests
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
18+
services:
19+
mssql:
20+
image: mcr.microsoft.com/mssql/server:2022-latest
21+
env:
22+
ACCEPT_EULA: Y
23+
MSSQL_SA_PASSWORD: YourStrong@Passw0rd
24+
ports:
25+
- 1433:1433
26+
options: >-
27+
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P YourStrong@Passw0rd -Q 'SELECT 1' -C -b -o /dev/null || exit 1"
28+
--health-interval=10s
29+
--health-timeout=5s
30+
--health-retries=10
31+
--health-start-period=10s
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Determine state connector ref
38+
id: connector-ref
39+
run: |
40+
BRANCH="${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}"
41+
FALLBACK="${{ github.event_name == 'pull_request' && github.base_ref || 'main' }}"
42+
REPO_URL="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository_owner }}/sebt-self-service-portal-state-connector.git"
43+
if git ls-remote --exit-code --heads "$REPO_URL" "refs/heads/${BRANCH}" 1>/dev/null 2>&1; then
44+
echo "ref=${BRANCH}" >> "$GITHUB_OUTPUT"
45+
else
46+
echo "ref=${FALLBACK}" >> "$GITHUB_OUTPUT"
47+
fi
48+
49+
- name: Checkout state connector
50+
uses: actions/checkout@v4
51+
with:
52+
repository: codeforamerica/sebt-self-service-portal-state-connector
53+
ref: ${{ steps.connector-ref.outputs.ref }}
54+
path: state-connector
55+
56+
- name: Setup .NET
57+
uses: actions/setup-dotnet@v5
58+
with:
59+
dotnet-version: "10.0.200"
60+
61+
- name: Setup pnpm
62+
uses: pnpm/action-setup@v4
63+
with:
64+
version: "10"
65+
66+
- name: Setup Node.js
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: "24"
70+
cache: "pnpm"
71+
72+
- name: Install dependencies
73+
run: pnpm install --frozen-lockfile --prefer-offline
74+
75+
- name: Build backend
76+
run: ./.github/workflows/scripts/build-backend.sh --configuration Release
77+
78+
- name: Install Playwright browsers
79+
run: cd src/SEBT.Portal.Web && pnpm exec playwright install --with-deps chromium
80+
81+
- name: Install Chrome for Pa11y
82+
run: cd src/SEBT.Portal.Web && pnpm exec puppeteer browsers install chrome
83+
84+
- name: Run Pa11y and Playwright E2E tests
85+
env:
86+
CI: true
87+
SKIP_WEB_SERVER: "1"
88+
STATE: dc
89+
NEXT_PUBLIC_STATE: dc
90+
ASPNETCORE_ENVIRONMENT: Development
91+
ConnectionStrings__DefaultConnection: "Server=localhost,1433;Database=SebtPortal;User Id=sa;Password=YourStrong@Passw0rd;TrustServerCertificate=True;"
92+
JwtSettings__SecretKey: "ci-e2e-jwt-secret-at-least-32-characters-long"
93+
IdentifierHasher__SecretKey: "ci-e2e-identifier-hasher-key-32chars"
94+
Oidc__CompleteLoginSigningKey: "ci-e2e-oidc-signing-key-at-least-32-chars"
95+
UseMockHouseholdData: "true"
96+
run: |
97+
pnpm dev &
98+
echo "Waiting for server at http://localhost:3000..."
99+
for i in $(seq 1 90); do
100+
curl -sf --max-time 15 http://localhost:3000 > /dev/null && echo "Server ready" && break
101+
sleep 2
102+
done
103+
curl -sf --max-time 15 http://localhost:3000 > /dev/null || (echo "Server failed to start" && exit 1)
104+
echo "Running Pa11y accessibility tests..."
105+
pnpm ci:test:a11y
106+
echo "Running Playwright E2E tests..."
107+
pnpm ci:test:e2e
108+
109+
- name: Upload Playwright report
110+
uses: actions/upload-artifact@v4
111+
if: ${{ !cancelled() }}
112+
with:
113+
name: playwright-report
114+
path: src/SEBT.Portal.Web/playwright-report/
115+
retention-days: 7

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"ci:build:frontend": "./scripts/ci/build-frontend.sh",
1515
"ci:build:backend": "./scripts/ci/build-backend.sh",
1616
"ci:test": "./scripts/ci/test-backend.sh && ./scripts/ci/test-frontend.sh",
17+
"ci:test:e2e": "cd src/SEBT.Portal.Web && pnpm exec playwright test --project=chromium",
18+
"ci:test:e2e:all": "cd src/SEBT.Portal.Web && pnpm test:e2e",
19+
"ci:test:a11y": "cd src/SEBT.Portal.Web && pnpm test:a11y",
1720
"ci:test:frontend": "./scripts/ci/test-frontend.sh",
1821
"ci:test:backend": "./scripts/ci/test-backend.sh",
1922
"ci:list": "./act-test.sh list",

0 commit comments

Comments
 (0)