mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
- Added deterministic API key and environment variables in e2e-tests.yml to ensure consistent test behavior. - Refactored CodexProvider tests to improve type safety and mock handling, ensuring reliable test execution. - Updated provider-factory tests to mock installation detection for CodexProvider, enhancing test isolation. - Adjusted Playwright configuration to conditionally use external backend, improving flexibility in test environments. - Enhanced kill-test-servers script to handle external server scenarios, ensuring proper cleanup of test processes. These changes improve the reliability and maintainability of the testing framework, leading to a more stable development experience.
88 lines
2.5 KiB
YAML
88 lines
2.5 KiB
YAML
name: E2E Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup project
|
|
uses: ./.github/actions/setup-project
|
|
with:
|
|
check-lockfile: 'true'
|
|
rebuild-node-pty-path: 'apps/server'
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install --with-deps chromium
|
|
working-directory: apps/ui
|
|
|
|
- name: Build server
|
|
run: npm run build --workspace=apps/server
|
|
|
|
- name: Start backend server
|
|
run: npm run start --workspace=apps/server &
|
|
env:
|
|
PORT: 3008
|
|
NODE_ENV: test
|
|
# Use a deterministic API key so Playwright can log in reliably
|
|
AUTOMAKER_API_KEY: test-api-key-for-e2e-tests
|
|
# Reduce log noise in CI
|
|
AUTOMAKER_HIDE_API_KEY: 'true'
|
|
# Avoid real API calls during CI
|
|
AUTOMAKER_MOCK_AGENT: 'true'
|
|
# Simulate containerized environment to skip sandbox confirmation dialogs
|
|
IS_CONTAINERIZED: 'true'
|
|
|
|
- name: Wait for backend server
|
|
run: |
|
|
echo "Waiting for backend server to be ready..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:3008/api/health > /dev/null 2>&1; then
|
|
echo "Backend server is ready!"
|
|
exit 0
|
|
fi
|
|
echo "Waiting... ($i/30)"
|
|
sleep 1
|
|
done
|
|
echo "Backend server failed to start!"
|
|
exit 1
|
|
|
|
- name: Run E2E tests
|
|
# Playwright automatically starts the Vite frontend via webServer config
|
|
# (see apps/ui/playwright.config.ts) - no need to start it manually
|
|
run: npm run test --workspace=apps/ui
|
|
env:
|
|
CI: true
|
|
VITE_SERVER_URL: http://localhost:3008
|
|
VITE_SKIP_SETUP: 'true'
|
|
# Keep UI-side login/defaults consistent
|
|
AUTOMAKER_API_KEY: test-api-key-for-e2e-tests
|
|
|
|
- name: Upload Playwright report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: apps/ui/playwright-report/
|
|
retention-days: 7
|
|
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: test-results
|
|
path: apps/ui/test-results/
|
|
retention-days: 7
|