e2e-test.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. name: E2E Tests
  2. on:
  3. push:
  4. branches: [master, develop]
  5. pull_request:
  6. branches: [master, develop]
  7. jobs:
  8. e2e-test:
  9. name: Playwright E2E Tests
  10. runs-on: ubuntu-latest
  11. timeout-minutes: 30
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v4
  15. - name: Setup Node.js
  16. uses: actions/setup-node@v4
  17. with:
  18. node-version: '20'
  19. cache: 'npm'
  20. cache-dependency-path: package-lock.json
  21. - name: Install dependencies
  22. run: npm ci
  23. - name: Install Playwright browsers
  24. run: npx playwright install --with-deps chromium
  25. - name: Build server
  26. working-directory: server
  27. run: npm run build || true
  28. - name: Start server
  29. working-directory: server
  30. run: |
  31. npm run dev &
  32. SERVER_PID=$!
  33. echo "Server PID: $SERVER_PID"
  34. sleep 10
  35. curl -s http://localhost:3000 > /dev/null || echo "Server not ready yet"
  36. sleep 5
  37. - name: Wait for server to be ready
  38. run: |
  39. for i in {1..30}; do
  40. if curl -s http://localhost:3000 > /dev/null 2>&1; then
  41. echo "Server is ready"
  42. break
  43. fi
  44. echo "Waiting for server... ($i/30)"
  45. sleep 2
  46. done
  47. - name: Run smoke tests
  48. run: npx playwright test --project=smoke --config=tests/playwright.config.ts || true
  49. - name: Run critical journey tests
  50. run: npx playwright test --project=critical-journeys --config=tests/playwright.config.ts || true
  51. - name: Run regression tests
  52. if: always()
  53. run: npx playwright test --project=regression --config=tests/playwright.config.ts || true
  54. - name: Upload test results
  55. if: always()
  56. uses: actions/upload-artifact@v4
  57. with:
  58. name: playwright-report
  59. path: tests/test-results/
  60. retention-days: 7
  61. - name: Upload screenshots
  62. if: failure()
  63. uses: actions/upload-artifact@v4
  64. with:
  65. name: screenshots
  66. path: tests/test-results/screenshots/
  67. retention-days: 7
  68. - name: Stop server
  69. if: always()
  70. run: pkill -f "tsx.*app.ts" || true