Testing infrastructure, fix truncating of dataURLs #1
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| backend-tests: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install backend dependencies | |
| run: | | |
| cd backend | |
| npm ci | |
| - name: Generate Prisma client | |
| run: | | |
| cd backend | |
| npx prisma generate | |
| - name: Run backend tests | |
| run: | | |
| cd backend | |
| npm test | |
| frontend-unit-tests: | |
| name: Frontend Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Run frontend tests | |
| run: | | |
| cd frontend | |
| npm test | |
| e2e-tests: | |
| name: E2E Browser Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install backend dependencies | |
| run: | | |
| cd backend | |
| npm ci | |
| - name: Generate Prisma client | |
| run: | | |
| cd backend | |
| npx prisma generate | |
| - name: Setup backend database | |
| run: | | |
| cd backend | |
| npx prisma db push | |
| env: | |
| DATABASE_URL: file:./prisma/e2e-test.db | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Install E2E test dependencies | |
| run: | | |
| cd e2e | |
| npm ci | |
| - name: Install Playwright browsers | |
| run: | | |
| cd e2e | |
| npx playwright install chromium --with-deps | |
| - name: Start backend server | |
| run: | | |
| cd backend | |
| DATABASE_URL="file:./prisma/e2e-test.db" FRONTEND_URL="http://localhost:5173" npm run dev & | |
| sleep 10 | |
| curl --retry 10 --retry-delay 2 --retry-all-errors http://localhost:8000/health | |
| - name: Start frontend server | |
| run: | | |
| cd frontend | |
| npm run dev -- --host & | |
| sleep 5 | |
| curl --retry 10 --retry-delay 2 --retry-all-errors http://localhost:5173 | |
| - name: Run E2E tests | |
| run: | | |
| cd e2e | |
| NO_SERVER=true CI=true npx playwright test | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: e2e/playwright-report/ | |
| retention-days: 7 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test-results | |
| path: e2e/test-results/ | |
| retention-days: 7 | |
| # Security tests for data sanitization | |
| security-tests: | |
| name: Security Sanitization Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install backend dependencies | |
| run: | | |
| cd backend | |
| npm ci | |
| - name: Generate Prisma client | |
| run: | | |
| cd backend | |
| npx prisma generate | |
| - name: Run security tests | |
| run: | | |
| cd backend | |
| npx ts-node src/securityTest.ts |