Skip to content

feat: first commit

feat: first commit #1

Workflow file for this run

name: E2E Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
name: Run E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Build Docusaurus
run: npm run build
- name: Run Playwright tests
run: |
npm run serve &
SERVER_PID=$!
# Wait for server to be ready
echo "Waiting for server to be ready..."
max_attempts=30
attempt=0
while [ $attempt -lt $max_attempts ]; do
if curl -s http://localhost:3000 > /dev/null 2>&1; then
echo "Server is ready!"
break
fi
attempt=$((attempt + 1))
sleep 1
done
# Run tests
export PLAYWRIGHT_JUNIT_OUTPUT_FILE=test-results/junit.xml
npx playwright test --reporter=junit,html,list || TEST_EXIT_CODE=$?
# Stop server
kill $SERVER_PID || true
# Exit with test result
exit ${TEST_EXIT_CODE:-0}
- name: Upload test results (JUnit XML)
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-junit
path: test-results/junit.xml
retention-days: 30
- name: Upload test results (HTML Report)
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-html
path: test-results/html/
retention-days: 30
- name: Upload test screenshots (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: test-results/
retention-days: 30
- name: Publish test results summary
if: always()
run: |
if [ -f test-results/junit.xml ]; then
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Extract test counts (basic parsing)
tests=$(grep -oP 'tests="\K[^"]+' test-results/junit.xml | head -1 || echo "N/A")
failures=$(grep -oP 'failures="\K[^"]+' test-results/junit.xml | head -1 || echo "N/A")
echo "- **Total Tests:** $tests" >> $GITHUB_STEP_SUMMARY
echo "- **Failures:** $failures" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📊 [View detailed HTML report in artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
fi