Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Playwright E2E Tests

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
e2e:
name: Run Playwright E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Create .env file from secrets (if available)
run: |
if [ -f ".env.example" ]; then
# Copy example env as base; CI-specific values will override below
cp .env.example .env.local
fi
# Override with GitHub Secrets when available
echo "NEXT_PUBLIC_FIREBASE_API_KEY=${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}" >> .env.local
echo "NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}" >> .env.local
echo "NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}" >> .env.local
echo "NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}" >> .env.local
echo "NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}" >> .env.local
echo "NEXT_PUBLIC_FIREBASE_APP_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}" >> .env.local
Comment thread
Aditya948351 marked this conversation as resolved.
continue-on-error: true

- name: Run Playwright E2E tests
run: npm run test:e2e
env:
CI: true
E2E_TEST: true

- name: Upload Playwright HTML report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7

- name: Upload Playwright test results on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: test-results/
retention-days: 7
7 changes: 6 additions & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import type { NextConfig } from 'next';

// When running Playwright E2E tests, the dev server must not use
// `output: 'export'` because static export mode is incompatible with
// middleware and the `npm run dev` server that Playwright spins up.
const isE2E = process.env.E2E_TEST === 'true';

const nextConfig: NextConfig = {
/* config options here */
output: 'export',
...(isE2E ? {} : { output: 'export' }),
devIndicators: {
// @ts-ignore - buildActivity is valid but missing in type definition
buildActivity: false,
Expand Down
Loading
Loading