Implement Atomic Design pattern and Storybook integration #119
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End-to-End Tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
e2e-tests: | |
name: Playwright E2E Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Validate authentication configuration | |
run: npm run validate:auth-config | |
# Ensures authentication setup is consistent across all CI workflows | |
- name: Install Playwright browsers | |
run: npx playwright install --with-deps | |
- name: Build application | |
run: npm run build | |
env: | |
# Ensure build completes even in test mode | |
NEXTAUTH_URL: http://localhost:3000 | |
NEXT_PUBLIC_GITHUB_APP_NAME: pulse-summarizer | |
NODE_ENV: production | |
- name: Setup Authentication Environment | |
id: auth-setup | |
uses: ./.github/actions/auth-setup | |
with: | |
auth_context: "e2e" | |
server_timeout: 120000 | |
health_check_timeout: 30000 | |
- name: Run Playwright tests | |
run: | | |
# Create log directory for debugging | |
mkdir -p e2e/logs | |
# Time the execution of the tests | |
echo "Starting Playwright tests at $(date)" | tee -a e2e/logs/test-run.log | |
# Run tests with more detailed options for CI environment | |
PWDEBUG=console time npm run test:e2e -- --reporter=list,html --timeout=120000 --retries=2 2>&1 | tee -a e2e/logs/test-run.log | |
TEST_EXIT_CODE=$? | |
echo "Completed Playwright tests at $(date) with exit code $TEST_EXIT_CODE" | tee -a e2e/logs/test-run.log | |
# Output the storage state file for debugging | |
if [ -f e2e/storageState.json ]; then | |
echo "--- Storage State Content ---" | tee -a e2e/logs/test-run.log | |
cat e2e/storageState.json | tee -a e2e/logs/test-run.log | |
else | |
echo "Warning: Storage state file not found" | tee -a e2e/logs/test-run.log | |
fi | |
# If tests failed, try running just the failing tests with more debugging | |
if [ $TEST_EXIT_CODE -ne 0 ]; then | |
echo "Some tests failed. Attempting to run only the failed tests with additional debugging..." | tee -a e2e/logs/test-run.log | |
PWDEBUG=console time npx playwright test --repeat-each=1 --workers=1 --retries=2 --max-failures=10 --reporter=list 2>&1 | tee -a e2e/logs/retry-run.log | |
fi | |
# Exit with the original test exit code | |
exit $TEST_EXIT_CODE | |
env: | |
# Additional debugging in CI | |
DEBUG: pw:api,pw:browser* | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Upload storage state (for debugging) | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: auth-storage-state | |
path: | | |
e2e/storageState.json | |
e2e/storageState-debug.json | |
retention-days: 7 | |
- name: Upload test screenshots on failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-screenshots | |
path: test-results/**/*.png | |
retention-days: 7 | |
- name: Upload test trace on failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-traces | |
path: test-results/**/*.zip | |
retention-days: 7 | |
- name: Generate test environment report | |
if: always() | |
run: | | |
# Create a directory for environment info | |
mkdir -p env-report | |
# Collect environment information | |
echo "Node version: $(node -v)" > env-report/node-info.txt | |
echo "npm version: $(npm -v)" >> env-report/node-info.txt | |
echo "Playwright version: $(npx playwright -V)" >> env-report/node-info.txt | |
# List installed packages | |
npm list --depth=0 > env-report/npm-packages.txt | |
# List browser versions | |
npx playwright --version > env-report/browser-versions.txt | |
# System info | |
uname -a > env-report/system-info.txt | |
# List environment variables (excluding secrets) | |
env | grep -v -E 'TOKEN|SECRET|PASSWORD|KEY' > env-report/env-vars.txt | |
# Collect server logs if available | |
if [ -f e2e/server.log ]; then | |
cp e2e/server.log env-report/server.log | |
fi | |
# List file permissions on key directories | |
ls -la e2e/ > env-report/e2e-files.txt | |
ls -la scripts/ > env-report/scripts-files.txt | |
- name: Upload test environment report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: env-report | |
path: env-report/ | |
retention-days: 7 | |
- name: Cleanup Authentication Environment | |
if: always() | |
uses: ./.github/actions/auth-cleanup | |
with: | |
server_pid: ${{ steps.auth-setup.outputs.server_pid }} | |
auth_context: "e2e" |