Skip to content

Commit 365c84a

Browse files
committed
feat(ci): run ui tests in ci
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
1 parent 1f4eac2 commit 365c84a

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/netlify-deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
deploy-preview:
1818
name: Push Preview to Netlify
1919
runs-on: ubuntu-latest
20+
outputs:
21+
PREVIEW_URL: ${{ steps.deploy.outputs.PREVIEW_URL }}
2022
permissions:
2123
deployments: write # deployments
2224
statuses: write # commit statuses
@@ -63,6 +65,7 @@ jobs:
6365
run: npm install -g netlify-cli
6466

6567
- name: Deploy to Netlify
68+
id: deploy
6669
if: env.PR_NUMBER != ''
6770
env:
6871
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -85,6 +88,7 @@ jobs:
8588
echo "DEPLOY_URL=$DEPLOY_URL"
8689
echo "DEPLOY_ID=$DEPLOY_ID"
8790
} >>"$GITHUB_ENV"
91+
echo "PREVIEW_URL=$PREVIEW_URL" >> "$GITHUB_OUTPUT"
8892
8993
- name: Post PR Comment
9094
if: env.PR_NUMBER != ''
@@ -222,3 +226,31 @@ jobs:
222226
-f state="success" \
223227
-f environment_url="${{ env.DEPLOY_URL }}" \
224228
-f description="Preview is ready!"
229+
230+
e2e-staging:
231+
name: UI tests on Staging deployment (${{ matrix.project }})
232+
runs-on: ${{ matrix.os }}
233+
needs: deploy-preview
234+
if: needs.deploy-preview.result == 'success'
235+
strategy:
236+
fail-fast: false
237+
matrix:
238+
project: [chromium, firefox, mobile]
239+
os: [ubuntu-latest]
240+
steps:
241+
- name: Check out repository
242+
uses: actions/checkout@v6
243+
with:
244+
ref: ${{ github.event.workflow_run.head_sha }}
245+
246+
- name: Install Nix
247+
uses: cachix/install-nix-action@19effe9fe722874e6d46dd7182e4b8b7a43c4a99 # v31.10.0
248+
249+
- uses: cachix/cachix-action@v16
250+
with:
251+
name: ngi-forge
252+
253+
- name: Run Playwright tests
254+
run: nix develop -c playwright test -c ui/tests/e2e --project=${{ matrix.project }}
255+
env:
256+
BASE_URL: ${{ needs.deploy-preview.outputs.PREVIEW_URL }}

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ jobs:
3434
- name: Run checks
3535
run: nix flake check --accept-flake-config
3636

37+
e2e-local:
38+
name: UI tests (${{ matrix.project }})
39+
runs-on: ${{ matrix.os }}
40+
needs: test
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
project: [chromium, firefox, mobile]
45+
os: [ubuntu-latest]
46+
steps:
47+
- name: Check out repository
48+
uses: actions/checkout@v6
49+
50+
- name: Install Nix
51+
uses: cachix/install-nix-action@19effe9fe722874e6d46dd7182e4b8b7a43c4a99 # v31.10.0
52+
53+
- uses: cachix/cachix-action@v16
54+
with:
55+
name: ngi-forge
56+
57+
- name: Run Playwright tests
58+
run: nix develop -c playwright test -c ui/tests/e2e --project=${{ matrix.project }}
59+
3760
build-preview-ui:
3861
name: Build UI artifact
3962
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)