Frontend Testing Infrastructure
Establish comprehensive testing for the Angular frontend, covering unit tests, integration tests with mock API, and end-to-end tests.
Current State
- Frontend has no tests (no spec files)
- Karma + Jasmine are in devDependencies but unused
- No e2e framework configured
- No CI pipeline for frontend tests
Requirements
1. Unit Tests (Jasmine + Karma)
One spec file per component and service:
- Services: Mock HTTP responses, test all methods (success, error, empty)
- Components: Test rendering with various inputs, user interaction
- Pipes/Filters: Test transformation logic
- Minimum coverage: 80%
2. Integration Tests (Jasmine + HttpClientTestingModule)
- Test services against
HttpClientTestingModule
- Verify correct endpoints are called
- Verify request/response transformations
- Test error handling and retry logic
3. Component Tests (Jasmine + ComponentFixture)
- Test all components with:
- Loading state
- Empty state
- Error state
- Success state
- User interaction (click, input, submit)
4. End-to-End Tests (Cypress or Playwright)
- Setup: Install Cypress or Playwright
- Tests:
- Login/Auth flow
- Dashboard CRUD operations
- Key Explorer search, insert, delete
- Admin token management
- Stats page loading
- Navigation between pages
- CI Integration: Run e2e tests in GitHub Actions with Docker Compose
5. CI Pipeline
Add a frontend test job to .github/workflows/ci.yml:
frontend-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run test -- --watch=false --browsers=ChromeHeadless
- run: npm run build -- --configuration production
Acceptance Criteria
Parent Epic
#290
Frontend Testing Infrastructure
Establish comprehensive testing for the Angular frontend, covering unit tests, integration tests with mock API, and end-to-end tests.
Current State
Requirements
1. Unit Tests (Jasmine + Karma)
One spec file per component and service:
2. Integration Tests (Jasmine + HttpClientTestingModule)
HttpClientTestingModule3. Component Tests (Jasmine + ComponentFixture)
4. End-to-End Tests (Cypress or Playwright)
5. CI Pipeline
Add a frontend test job to
.github/workflows/ci.yml:Acceptance Criteria
Parent Epic
#290