- Add Vitest unit tests for AiChatWidget component - Add Playwright E2E tests: ai-chat-widget, api, security, guardrails - Add AI guardrails tests validating no phone/email leaks from Ollama - Add security tests: auth, rate limiting, input validation, token handling - Add API tests for AI endpoints and authentication - Fix playwright.config.ts reporter path conflict - Update CompanyJobsPage with AI generate buttons (orange icon, loading state) - Fix AiChatWidget accessibility (role=dialog, aria-label, aria-modal) - Add app.css spin animation for AI loading spinner - Add Gitea Actions workflow for nightly CI tests - Add TESTING.md documentation
191 lines
No EOL
5.8 KiB
YAML
191 lines
No EOL
5.8 KiB
YAML
name: nightly-tests
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "30 2 * * *" # 2:30 AM daily
|
|
workflow_dispatch: # Manual trigger
|
|
|
|
env:
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
|
|
jobs:
|
|
# ── Unit Tests ────────────────────────────────────────────────────────────────
|
|
unit-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run unit tests
|
|
run: npm run test
|
|
env:
|
|
CI: "true"
|
|
|
|
- name: Upload Vitest coverage
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: vitest-coverage
|
|
path: test-results/vitest-coverage/
|
|
|
|
# ── E2E Tests ─────────────────────────────────────────────────────────────────
|
|
e2e-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install chromium --with-deps
|
|
|
|
- name: Start dev server
|
|
run: npm run dev &
|
|
env:
|
|
PORT: 3000
|
|
shell: bash
|
|
|
|
- name: Wait for server
|
|
run: npx wait-on http://localhost:3000 --timeout 60000
|
|
|
|
- name: Run E2E tests
|
|
run: npx playwright test --config=playwright.config.ts
|
|
env:
|
|
CI: "true"
|
|
|
|
- name: Upload Playwright report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: test-results/
|
|
|
|
- name: Upload test videos
|
|
uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-videos
|
|
path: test-videos/
|
|
|
|
# ── Accessibility Tests ────────────────────────────────────────────────────────
|
|
a11y-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install chromium --with-deps
|
|
|
|
- name: Start dev server
|
|
run: npm run dev &
|
|
env:
|
|
PORT: 3000
|
|
shell: bash
|
|
|
|
- name: Wait for server
|
|
run: npx wait-on http://localhost:3000 --timeout 60000
|
|
|
|
- name: Run accessibility tests
|
|
run: npx playwright test --config=playwright.a11y.config.ts
|
|
env:
|
|
CI: "true"
|
|
|
|
- name: Upload a11y report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-a11y-report
|
|
path: test-results/
|
|
|
|
# ── Visual Tests ──────────────────────────────────────────────────────────────
|
|
visual-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install chromium --with-deps
|
|
|
|
- name: Start dev server
|
|
run: npm run dev &
|
|
env:
|
|
PORT: 3000
|
|
shell: bash
|
|
|
|
- name: Wait for server
|
|
run: npx wait-on http://localhost:3000 --timeout 60000
|
|
|
|
- name: Run visual tests
|
|
run: npx playwright test --config=playwright.visual.config.ts
|
|
env:
|
|
CI: "true"
|
|
|
|
- name: Upload visual diffs
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-visual-diffs
|
|
path: test-results/visual/
|
|
|
|
# ── Test Summary ──────────────────────────────────────────────────────────────
|
|
test-summary:
|
|
runs-on: ubuntu-latest
|
|
needs: [unit-tests, e2e-tests, a11y-tests]
|
|
if: always()
|
|
steps:
|
|
- name: Test results summary
|
|
run: |
|
|
echo "## Nightly Test Results" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
|
|
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Unit Tests | ${{ needs.unit-tests.result }} |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| E2E Tests | ${{ needs.e2e-tests.result }} |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Accessibility Tests | ${{ needs.a11y-tests.result }} |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Visual Tests | ${{ needs.visual-tests.result }} |" >> $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Notify on failure
|
|
if: needs.unit-tests.result == 'failure' || needs.e2e-tests.result == 'failure' || needs.a11y-tests.result == 'failure'
|
|
run: |
|
|
echo "⚠️ Some tests failed. Check the artifacts for details." |