Skip to content

Implement End-to-End (E2E) Testing to Simulate User Workflows #48

@KirilMT

Description

@KirilMT

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.
  • 3. Implement a Core User Workflow Test (e.g., Login)

    • Create the first E2E test to automate the user login process.
    • The test should:
      1. Navigate to the application's home page.
      2. Find and click the "Login" button.
      3. Fill in the username and password fields.
      4. Submit the login form.
      5. 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.
  • 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.md or a new TESTING.md file.
    • The documentation should explain how to run the E2E tests locally.
    • Include any necessary setup steps or commands (e.g., pytest --headed to watch the tests run in a browser).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3-LowLow priority issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions