# itswale/qa-automation-plugin architecture

> Architecture diagram of the GitHub repository itswale/qa-automation-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itswale/qa-automation-plugin
- Repository: https://github.com/itswale/qa-automation-plugin

## Overview

##### Project type and purpose
- This is a Streamlit-based QA automation tool (“QA Automation Plugin”) with a plugin architecture.
- It provides a UI for launching unit, E2E, and custom tests; collects results in a database; and renders interactive reports.

##### File structure
- Top level:
- app.py / .streamlit/ : Streamlit UI entry point and config
- config.yaml         : runtime settings (test dirs, URLs, plugins)
- cleanup.py          : housekeeping (temporary files, old DB rows)
- Dockerfile          : container image definition
- qa_plugin/          : core Python package
– api.py            : optional programmatic API
– cli.py            : command-line interface
– core.py           : orchestrator (load config, schedule runs, plugin loader)
– database.py       : data access (store/retrieve test results)
– reports.py        : report generation logic
- tests/              : unit, sample, E2E test suites
- .github/workflows/qa.yml : CI/CD pipeline for QA checks
- Patterns: layered (UI / service / data), plugin extension points in core.py via config.yaml.

##### Extract README insights
- UI tabs: “Reports” (real-time & historical views), “History” (trends, filtering)
- Persist data for trend analysis
- Extend via custom plugins under “plugins/” and register in config.yaml

##### Main components & their interactions
a. Components
1. Streamlit UI (app.py + .streamlit/config.toml)
2. CLI interface (qa_plugin/cli.py)
3. Core orchestrator (qa_plugin/core.py)
4. Plugin loader (dynamically loads classes named in config.yaml)
5. Test runners (unit via pytest, E2E via Playwright, custom plugin methods)
6. Database (qa_plugin/database.py; e.g. SQLite or Postgres)
7. Reporting engine (qa_plugin/reports.py)
8. Cleanup service (cleanup.py)
9. External services: Playwright browsers, Streamlit Cloud, Docker container
10. CI/CD pipeline (GitHub Actions)

b. Interactions / Data flow
- User interacts with Streamlit UI or CLI → Core orchestrator
- Core reads config.yaml → resolves test directories & plugin classes
- Core invokes test runners → test results emitted
- Results written to Database via database.py
- Reports reads from Database → aggregates stats, generates charts
- UI polls Reports for real-time updates → renders graphs & tables
- Cleanup service periodically purges old results / temp files
- CI pipeline executes tests in Docker container, posts results

c. Architectural patterns & principles
- Layered architecture: Presentation (UI/CLI), Application (Core/API), Persistence (Database)
- Plugin pattern: decoupled extension points, dynamic loading via configuration
- Single responsibility: each module handles one concern (e.g. reports, DB, orchestration)
- Infrastructure as code: Dockerfile, CI workflows, config.yaml

d. Key technologies
- Python & Streamlit (UI)
- Pytest & Playwright (test execution)
- YAML (configuration)
- SQLite/Postgres (persistent storage)
- Docker & GitHub Actions (CI/CD)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        StreamlitUI["Streamlit UI\n(app.py)"]:::presentation
        ConfigUI["Streamlit Config\n(.streamlit/config.toml)"]:::presentation
        CLI["CLI Interface\n(qa_plugin/cli.py)"]:::presentation
        API["Programmatic API\n(qa_plugin/api.py)"]:::presentation
    end

    %% Application Core Layer
    subgraph "Core Service Layer"
        direction TB
        Config["Configuration\n(config.yaml)"]:::service
        Core["Core Orchestrator\n(qa_plugin/core.py)"]:::service
        PluginLoader["Plugin Loader"]:::service
    end

    %% Test Runner
    subgraph "Test Execution"
        direction TB
        UnitTests["Unit Tests\n(tests/unit/)"]:::service
        E2ETests["E2E Tests\n(tests/sample/test_e2e.py)"]:::service
        FunctionalTests["Functional Tests\n(tests/sample/test_functional.py)"]:::service
        AdditionalUnit["Additional Unit Tests\n(tests/sample/test_unit.py)"]:::service
        Playwright["Playwright Browsers"]:::external
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Database["Database\n(qa_plugin/database.py)"]:::data
        Reports["Reporting Engine\n(qa_plugin/reports.py)"]:::data
    end

    %% Maintenance & CI
    subgraph "Maintenance & CI"
        direction TB
        Cleanup["Cleanup Service\n(cleanup.py)"]:::service
        Docker["Docker Container\n(Dockerfile)"]:::external
        CI["CI/CD Pipeline\n(.github/workflows/qa.yml)"]:::external
        Req["Dependencies\n(requirements.txt,\npackages.txt)"]:::external
    end

    %% Relationships
    StreamlitUI -->|"uses"| Core
    ConfigUI -->|"configures UI"| StreamlitUI
    CLI -->|"invokes"| Core
    API -->|"calls"| Core
    Config -->|"loaded by"| Core
    Core -->|"loads plugins via"| PluginLoader
    PluginLoader -->|"executes"| UnitTests
    PluginLoader -->|"executes"| E2ETests
    PluginLoader -->|"executes"| FunctionalTests
    PluginLoader -->|"executes"| AdditionalUnit
    E2ETests -->|"drives"| Playwright
    UnitTests -->|"results to"| Database
    E2ETests -->|"results to"| Database
    FunctionalTests -->|"results to"| Database
    AdditionalUnit -->|"results to"| Database
    Database -->|"read by"| Reports
    Reports -->|"rendered in"| StreamlitUI
    Cleanup -->|"purges old data in"| Database
    CI -->|"runs in"| Docker
    Docker -->|"executes"| Core
    Core -->|"depends on"| Req

    %% Click Events
    click StreamlitUI "https://github.com/itswale/qa-automation-plugin/blob/main/app.py"
    click ConfigUI "https://github.com/itswale/qa-automation-plugin/blob/main/.streamlit/config.toml"
    click CLI "https://github.com/itswale/qa-automation-plugin/blob/main/qa_plugin/cli.py"
    click API "https://github.com/itswale/qa-automation-plugin/blob/main/qa_plugin/api.py"
    click Config "https://github.com/itswale/qa-automation-plugin/blob/main/config.yaml"
    click Core "https://github.com/itswale/qa-automation-plugin/blob/main/qa_plugin/core.py"
    click UnitTests "https://github.com/itswale/qa-automation-plugin/tree/main/tests/unit/"
    click E2ETests "https://github.com/itswale/qa-automation-plugin/blob/main/tests/sample/test_e2e.py"
    click FunctionalTests "https://github.com/itswale/qa-automation-plugin/blob/main/tests/sample/test_functional.py"
    click AdditionalUnit "https://github.com/itswale/qa-automation-plugin/blob/main/tests/sample/test_unit.py"
    click Database "https://github.com/itswale/qa-automation-plugin/blob/main/qa_plugin/database.py"
    click Reports "https://github.com/itswale/qa-automation-plugin/blob/main/qa_plugin/reports.py"
    click Cleanup "https://github.com/itswale/qa-automation-plugin/blob/main/cleanup.py"
    click Docker "https://github.com/itswale/qa-automation-plugin/tree/main/Dockerfile"
    click CI "https://github.com/itswale/qa-automation-plugin/blob/main/.github/workflows/qa.yml"
    click Req "https://github.com/itswale/qa-automation-plugin/blob/main/requirements.txt"

    %% Styles
    classDef presentation fill:#AED6F1,stroke:#2E86C1,color:#1B2631
    classDef service fill:#ABEBC6,stroke:#28B463,color:#1B2631
    classDef data fill:#F9E79F,stroke:#D68910,color:#1B2631
    classDef external fill:#D5DBDB,stroke:#7B7D7D,color:#1B2631
```
