Skip to content

Playwright Tests

Playwright Tests #788

Workflow file for this run

name: Playwright Tests
on:
# Run after Vercel deployment completes
deployment_status:
# Run on pushes to main (after merge)
# push:
# branches: [main]
schedule:
# Run daily at 6 AM and 6 PM UTC
- cron: '0 6,18 * * *'
workflow_dispatch:
# Allow manual trigger
jobs:
test:
timeout-minutes: 30
runs-on: ubuntu-latest
# Only run on successful production deployments OR pushes to main OR scheduled/manual runs
if: |
(github.event_name == 'deployment_status' &&
github.event.deployment_status.state == 'success' &&
github.event.deployment_status.environment == 'Production') ||
github.event_name == 'push' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/db
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Wait for deployment propagation
if: github.event_name == 'push' || github.event_name == 'deployment_status'
run: sleep 30
- name: Run Playwright tests against production
env:
BASE_URL: https://qastudio.dev
QA_STUDIO_API_KEY: ${{ secrets.QA_STUDIO_API_KEY }}
QA_STUDIO_PROJECT_ID: ${{ secrets.QA_STUDIO_PROJECT_ID }}
PLAYWRIGHT_USER_EMAIL: ${{ secrets.PLAYWRIGHT_USER_EMAIL }}
PLAYWRIGHT_USER_PASSWORD: ${{ secrets.PLAYWRIGHT_USER_PASSWORD }}
CI: true
run: npm run test:e2e
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Upload test videos
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-videos
path: test-results/
retention-days: 7