name: E2E Tests on: schedule: # Run E2E tests daily at 2 AM UTC - cron: '0 2 * * *' workflow_dispatch: inputs: environment: description: 'Environment to test' required: true default: 'staging' type: choice options: - staging - production jobs: e2e-tests: name: E2E Tests - ${{ github.event.inputs.environment || 'staging' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Install Playwright run: | npm init -y npm install -D @playwright/test npx playwright install --with-deps - name: Create E2E test structure run: | mkdir -p e2e/tests cat > e2e/playwright.config.ts << 'EOF' import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ testDir: './tests', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: 'html', use: { baseURL: process.env.BASE_URL || 'https://staging.bsa.madeamess.online', trace: 'on-first-retry', screenshot: 'only-on-failure', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, { name: 'firefox', use: { ...devices['Desktop Firefox'] }, }, { name: 'webkit', use: { ...devices['Desktop Safari'] }, }, ], }); EOF - name: Create sample E2E test run: | cat > e2e/tests/auth.spec.ts << 'EOF' import { test, expect } from '@playwright/test'; test.describe('Authentication Flow', () => { test('should display login page', async ({ page }) => { await page.goto('/'); await expect(page).toHaveTitle(/VIP Coordinator/); await expect(page.locator('text=Sign in with Google')).toBeVisible(); }); test('should redirect to dashboard after login', async ({ page }) => { // This would require mocking Google OAuth or using test credentials // For now, just check that the login button exists await page.goto('/'); const loginButton = page.locator('button:has-text("Sign in with Google")'); await expect(loginButton).toBeVisible(); }); }); EOF - name: Run E2E tests env: BASE_URL: ${{ github.event.inputs.environment == 'production' && 'https://bsa.madeamess.online' || 'https://staging.bsa.madeamess.online' }} run: | cd e2e npx playwright test - name: Upload test results uses: actions/upload-artifact@v4 if: always() with: name: playwright-report path: e2e/playwright-report/ retention-days: 30 notify-results: name: Notify Results runs-on: ubuntu-latest needs: [e2e-tests] if: always() steps: - name: Send notification run: | echo "E2E tests completed with status: ${{ needs.e2e-tests.result }}" # Add notification logic here (Slack, email, etc.)