Implements robust testing setup with Playwright global auth, reusable test helpers, Docker support, and CI/CD integration with Gitea Actions. ## Changes ### Playwright Setup - Add global auth setup with storage state reuse (tests/playwright/auth.setup.ts) - Fix auth setup to clear existing state before fresh login - Create reusable performOAuthLogin helper (tests/playwright/helpers.ts) - Configure dotenv loading for environment variables in playwright.config.ts ### Magnitude Configuration - Update to use Claude Sonnet 4.5 (claude-sonnet-4-5-20250514) - Create reusable loginFlow helper (tests/magnitude/helpers.ts) - Fix smoke test to check login page instead of non-existent homepage ### Docker Support - Add Dockerfile.playwright with non-root user (pwuser) for security - Uses official Playwright Docker image (mcr.microsoft.com/playwright:v1.49.1-noble) - Provides consistent testing environment across users and CI/CD ### CI/CD Integration - Add Gitea Actions workflow (.gitea/workflows/magnitude.yml) - Runs Magnitude tests on every push and PR - Starts SurrealDB and Next.js dev server automatically - Uploads test results as artifacts (30-day retention) ### Documentation - Add comprehensive testing setup docs to AGENTS.md: - Playwright Docker setup instructions - CI/CD with Gitea Actions - Testing framework separation (Playwright vs Magnitude) - Required secrets for CI/CD ### Testing Best Practices - Separate Playwright (manual + global auth) from Magnitude (automated E2E) - Reusable helpers reduce code duplication - Both frameworks work independently ## Testing - ✅ Playwright auth setup test passes (5.6s) - ✅ Magnitude smoke test passes - ✅ OAuth flow works correctly with helper function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
747 B
Docker
31 lines
747 B
Docker
# Dockerfile for Playwright testing environment
|
|
# Based on official Playwright Docker image with non-root user setup
|
|
|
|
FROM mcr.microsoft.com/playwright:v1.49.1-noble
|
|
|
|
# Create a non-root user for running tests
|
|
RUN useradd -ms /bin/bash pwuser && \
|
|
mkdir -p /home/pwuser/app && \
|
|
chown -R pwuser:pwuser /home/pwuser
|
|
|
|
# Switch to non-root user
|
|
USER pwuser
|
|
|
|
# Set working directory
|
|
WORKDIR /home/pwuser/app
|
|
|
|
# Copy package files
|
|
COPY --chown=pwuser:pwuser package.json pnpm-lock.yaml ./
|
|
|
|
# Install pnpm globally for the user
|
|
RUN npm install -g pnpm
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy the rest of the application
|
|
COPY --chown=pwuser:pwuser . .
|
|
|
|
# Run Playwright tests
|
|
CMD ["pnpm", "exec", "playwright", "test"]
|