Skip to content

playwright base setup [WIP] #12

playwright base setup [WIP]

playwright base setup [WIP] #12

Workflow file for this run

name: 🎭 Playwright E2E Tests
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
e2e-tests:
name: πŸ§ͺ E2E Tests
timeout-minutes: 60
runs-on: ubuntu-22.04
env:
NODE_ENV: test
NEXTAUTH_SECRET: 'test-secret-for-ci-only'
NEXT_PUBLIC_EXAMPLE_VARIABLE: 'CI Test Variable'
PRIVATE_EXAMPLE_VARIABLE: 'Private CI Test Variable'
CI: true
steps:
- name: πŸ“₯ Checkout Repository
uses: actions/checkout@v4
- name: πŸ’» Node setup
uses: ./.github/actions/node-setup
- name: πŸ’Ύ Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: 🎭 E2E Setup
uses: ./.github/actions/e2e-setup
with:
browsers: 'chromium'
- name: πŸ—οΈ Build Frontend App
run: pnpm --filter @infinum/frontend build
shell: bash
- name: πŸš€ Start Frontend App (Background)
run: |
node apps/frontend/.next/standalone/apps/frontend/server.js &
echo "FRONTEND_PID=$!" >> $GITHUB_ENV
shell: bash
env:
NODE_ENV: production
NEXTAUTH_SECRET: 'test-secret-for-ci-only'
NEXT_PUBLIC_EXAMPLE_VARIABLE: 'CI Test Variable'
PRIVATE_EXAMPLE_VARIABLE: 'Private CI Test Variable'
- name: ⏳ Wait for Frontend to be Ready
run: |
echo "Waiting for frontend to start on http://localhost:3000..."
timeout 20s bash -c 'until curl -f http://localhost:3000 > /dev/null 2>&1; do
echo "Waiting for frontend..."
sleep 3
done'
echo "Frontend is ready!"
shell: bash
- name: πŸ” Health Check
run: |
echo "Running health check..."
curl -f http://localhost:3000 -I | head -5
echo "Health check passed!"
shell: bash
- name: πŸ§ͺ Run Playwright E2E Tests
run: |
echo "🎬 Starting Playwright E2E Tests..."
echo "================================================"
pnpm e2e
echo "================================================"
echo "βœ… E2E Tests completed!"
- name: πŸ›‘ Stop Frontend App
shell: bash
if: always()
run: |
if [ ! -z "$FRONTEND_PID" ]; then
kill $FRONTEND_PID || true
fi