-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Overview
Implement a mock authentication service to resolve authentication timeout issues occurring during E2E test execution.
Background and Purpose
Currently, E2E tests experience timeout issues in auth-helper.ts
because they depend on the actual authentication service (Supabase). To create a stable authentication flow in the test environment, we need to implement a mock authentication service.
Implementation Details
-
Create a Mock Authentication Service
- Create an
integration-tests/mocks/auth-api
directory - Implement a mock server using Express.js
- Provide basic authentication endpoints for login, signup, and token verification
- Create an
-
Update Docker Compose Configuration
- Add the mock authentication service to
docker-compose.test.yml
- Configure appropriate port settings and health checks
- Follow the same configuration pattern as existing mock services (Slack API, OpenRouter API)
- Add the mock authentication service to
-
Update Test Environment Settings
- Update environment variables to use the mock authentication service
- Implement a mechanism to auto-generate the frontend's
.env.local
file
-
Modify
auth-helper.ts
- Update the authentication helper to work with the mock service
- Add more robust error handling and debugging information
- Strengthen authentication state verification
-
Improve Test Fixtures
- Enhance the
authenticatedPage
fixture to improve authentication state stability - Strengthen error handling and cleanup procedures
- Enhance the
Related Documentation
Related Issues
- Set up CI/CD pipeline and development environment #1 Docker Compose Integration Testing Framework Structure
- Configure environment variables management #4 Implement End-to-End Tests with Playwright
- Configure environment variables management #5 Integrate Integration Tests with CI/CD Pipeline
Completion Criteria
- Mock authentication service is implemented and working in the Docker Compose environment
- E2E tests run successfully without authentication timeouts
- Test execution is stable in CI environments
- Test coverage is improved
Additional Notes
By using the same design pattern as existing mock services (Slack API, OpenRouter API), we can build a consistent test environment. The mock service should integrate with the TestDataHelper
class to provide consistent authentication flows for testing.
Run E2E test locally for confirming fixes