-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently, our testing suite consists of unit and integration tests that verify backend components, API endpoints, and database operations (test_core.py, test_health.py). While these tests are crucial for ensuring the stability and correctness of individual parts of our application, they do not validate the application from a real user's perspective.
This issue proposes the introduction of an End-to-End (E2E) testing strategy. The goal is to create automated tests that simulate a user interacting with the application's user interface in a real browser. This will allow us to:
- Validate complete user workflows: Ensure that a user can perform key actions from start to finish (e.g., logging in, creating a task, viewing data).
- Ensure frontend-backend integration: Verify that the user interface and the backend services work together seamlessly.
- Catch UI/UX bugs: Identify issues in the user interface that unit tests cannot detect, such as broken buttons, incorrect form submissions, or display errors.
- Increase confidence in deployments: By simulating real user behavior, we can be more confident that new changes do not introduce regressions that impact the user experience.
Sub-tasks
-
1. Research and Select an E2E Testing Framework
- Evaluate options for browser automation in Python.
- Recommended frameworks:
- Playwright: A modern and powerful framework from Microsoft that offers a simple API, auto-waits, and excellent debugging tools.
- Selenium: A long-standing and widely-used framework with a large community and extensive documentation.
- Decision: Choose one framework to be used for all E2E tests.
-
2. Set Up the Testing Environment
- Add the chosen framework (e.g.,
pytest-playwright) to the project's development dependencies. - Install the necessary browser binaries (e.g.,
playwright install). - Configure a base test structure in a new file,
tests/test_e2e.py. This should include setup and teardown logic for managing the browser.
- Add the chosen framework (e.g.,
-
3. Implement a Core User Workflow Test (e.g., Login)
- Create the first E2E test to automate the user login process.
- The test should:
- Navigate to the application's home page.
- Find and click the "Login" button.
- Fill in the username and password fields.
- Submit the login form.
- Assert that the user is successfully redirected to the dashboard or main application page.
-
4. Develop E2E Tests for Key Application Features
- Based on the application's functionality, create tests for other critical user journeys. Examples include:
- Technician Management:
- Test viewing the list of technicians.
- Test creating a new technician and verifying it appears in the list.
- Test searching or filtering for a specific technician.
- Task Management:
- Test creating a new task.
- Test assigning required skills to a task.
- Skills and Technologies:
- Test assigning a technology skill to a technician.
- Technician Management:
- Based on the application's functionality, create tests for other critical user journeys. Examples include:
-
5. Integrate E2E Tests into the CI/CD Pipeline
- Update the CI/CD configuration (e.g., GitHub Actions workflow) to execute the E2E test suite.
- Ensure that the tests run in a headless browser environment to avoid performance overhead.
- The E2E tests should run on every pull request or push to the main branch.
-
6. Document the E2E Testing Process
- Add a section to the
README.mdor a newTESTING.mdfile. - The documentation should explain how to run the E2E tests locally.
- Include any necessary setup steps or commands (e.g.,
pytest --headedto watch the tests run in a browser).
- Add a section to the