# automationsolutionz/zeuz_python_node architecture

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

- Interactive diagram: https://gitdiagram.com/automationsolutionz/zeuz_python_node
- Repository: https://github.com/automationsolutionz/zeuz_python_node

## Overview

##### Project Type and Purpose
- This is a Python-based, client-side automation engine (Zeuz Node) that runs test cases delivered by a remote Deploy Service.
- It exposes a CLI (`node_cli.py`) and can run as a daemon (`daemon.sh`).

##### File Structure
- Top level:
- `node_cli.py`, `settings.py`, `pyproject.toml`, `Framework/`, `Drivers/`, `Apps/`, `server/`, `reporting/`, `tests/`
- Framework layer (`Framework/`):
- `deploy_handler/` (connect & long-poll adapter)
- `MainDriverApi.py` (entry to test execution)
- `Built_In_Automation/` plugins (Desktop, Mobile, Web, Performance, Security, etc.)
- `edge_module/` (Edge/Selenium integration)
- `easyocr/` (OCR module)
- `Utilities/` for config, logging, file I/O, etc.
- Drivers (`Drivers/`): abstractions for OS-level automation hooks.
- Apps (`Apps/`): pre-built binaries and scripts for various platforms (Windows, Mac, Mobile, Web).
- Reporting (`reporting/`): JUnit and HTML report generators.
- Server folder (`server/`): local test/development server utilities (not part of production node).

##### README
- Explains core flows, flags, and target Python version.

a. Main Components (blocks)
1. Client CLI Layer
- node_cli.py (Entry point)
2. Deploy Handler / Network Layer
- `Framework/deploy_handler/adapter.py`
- `long_poll_handler.py`
- External Zeuz Deploy Service (REST/gRPC)
3. Test-Case Adapter & Persistence
- ProtoAdapter → `save_json` → local JSON file
4. Core Execution Engine
- `MainDriverApi.py`
5. Plugin/Automation Modules
- Built_In_Automation (Desktop, Mobile, Web, Performance, Security, Sequential Actions)
- edge_module (Edge/Selenium)
- easyocr (OCR)
6. Drivers & External Tools
- `Drivers/` Python wrappers
- Binaries and scripts under `Apps/`
7. Reporting & Artifacts
- `reporting/junit_report.py`
- Artifacts uploader (screenshots, logs)
8. Configuration & Utilities
- `Framework/Utilities/ConfigModule.py`, logging, decorators
9. (Optional) Local Dev Server
- `server/` folder—excluded from production flow

b. Relationships and Data Flow
- CLI invokes Deploy Handler → establishes connection to Zeuz Deploy Service
- Server pushes test-case payloads → Deploy Handler callbacks → ProtoAdapter → persisted JSON
- MainDriverApi reads JSON → hands off to plugin modules (Built_In_Automation, edge_module, easyocr)
- Plugin modules call Drivers and external executables in `Apps/`
- Execution results and artifacts flow back to Reporter and Artifacts Uploader → Deploy Service

c. Architectural Patterns & Principles
- Layered Architecture: CLI → Network → Adapter → Core → Plugins → Drivers
- Plugin/Strategy Pattern: each Built_In_Automation submodule implements a common interface
- State Machine: the node’s lifecycle (connect → receive → execute → report → reconnect)
- Separation of Concerns: networking, parsing, execution, and reporting are distinct layers

d. Key Technologies & Frameworks
- Python 3.8
- HTTP/REST or gRPC for service communication
- Selenium / Appium (via edge_module & Built_In_Automation modules)
- easyOCR for OCR tasks
- Locust for performance testing

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client CLI Layer"
        CLI["node_cli.py"]:::cli
    end

    subgraph "Deploy Handler / Network Layer"
        Adapter["adapter.py"]:::network
        Poller["long_poll_handler.py"]:::network
        DeployService["Zeuz Deploy Service"]:::external
    end

    subgraph "Test-Case Adapter & Persistence"
        ProtoAdapter["ProtoAdapter (adapter.py)"]:::network
        JSONStore["Local JSON Store"]:::storage
    end

    subgraph "Core Execution Engine"
        Core["MainDriverApi.py"]:::core
    end

    subgraph "Plugin/Automation Modules"
        subgraph "Built-In Automation"
            Desktop["Desktop Automation"]:::plugin
            Mobile["Mobile Automation"]:::plugin
            Web["Web Automation"]:::plugin
            Performance["Performance Testing"]:::plugin
            Security["Security Testing"]:::plugin
            Sequential["Sequential Actions"]:::plugin
            XML["XML Automation"]:::plugin
            SharedRes["Shared Resources"]:::plugin
            UtilPlugins["Utility Plugins"]:::plugin
        end
        OCR["easyocr Module"]:::plugin
        Edge["Edge/Selenium Integration"]:::plugin
    end

    subgraph "Drivers & External Tools"
        Drivers["Drivers/"]:::external
        Apps["Apps/"]:::external
    end

    subgraph "Reporting & Artifacts"
        JUnit["junit_report.py"]:::external
        HTML["HTML Report Templates"]:::external
    end

    subgraph "Configuration & Utilities"
        Config["ConfigModule.py"]:::util
        CommonUtil["CommonUtil.py"]:::util
        FileUtil["FileUtilities.py"]:::util
        Decorators["decorators.py"]:::util
    end

    CLI -->|"invokes"| Adapter
    Adapter -->|"starts long-poll"| Poller
    Poller -->|"connect/request"| DeployService
    DeployService -->|"push test-case"| Poller
    Poller -->|"callback payload"| ProtoAdapter
    ProtoAdapter -->|"save_json"| JSONStore
    JSONStore -->|"load tests"| Core
    Core -->|"execute"| Desktop
    Core -->|"execute"| Mobile
    Core -->|"execute"| Web
    Core -->|"execute"| Performance
    Core -->|"execute"| Security
    Core -->|"execute"| Sequential
    Core -->|"execute"| XML
    Core -->|"use shared"| SharedRes
    Core -->|"use util"| UtilPlugins
    Core -->|"execute"| OCR
    Core -->|"execute"| Edge
    Desktop -.->|"calls"| Drivers
    Mobile -.->|"calls"| Drivers
    Web -.->|"calls"| Drivers
    Performance -.->|"calls"| Drivers
    Security -.->|"calls"| Drivers
    Sequential -.->|"calls"| Drivers
    XML -.->|"calls"| Drivers
    OCR -.->|"calls"| Apps
    Edge -.->|"drives"| Apps
    Core -->|"generate report"| JUnit
    Core -->|"generate report"| HTML
    JUnit -->|"upload results"| DeployService
    HTML -->|"upload artifacts"| DeployService

    subgraph "State Machine"
        Login --> Connect --> Receive --> Execute --> Report --> Reconnect
    end

    classDef cli fill:#FFCDD2,stroke:#b71c1c,stroke-width:1px
    classDef network fill:#BBDEFB,stroke:#0d47a1,stroke-width:1px
    classDef core fill:#C8E6C9,stroke:#1b5e20,stroke-width:1px
    classDef plugin fill:#FFE0B2,stroke:#e65100,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#424242,stroke-width:1px
    classDef storage fill:#FFF9C4,stroke:#f57f17,stroke-width:1px
    classDef util fill:#D1C4E9,stroke:#4a148c,stroke-width:1px

    click CLI "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/node_cli.py"
    click Adapter "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/deploy_handler/adapter.py"
    click Poller "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/deploy_handler/long_poll_handler.py"
    click JSONStore "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/test_cases_data.json"
    click Core "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/MainDriverApi.py"
    click Desktop "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Desktop/"
    click Mobile "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Mobile/"
    click Web "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Web/"
    click Performance "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Performance_Testing/"
    click Security "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Security/"
    click Sequential "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Sequential_Actions/"
    click XML "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/XML/"
    click SharedRes "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Shared_Resources/"
    click UtilPlugins "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/Built_In_Automation/Built_In_Utility/"
    click OCR "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/easyocr/"
    click Edge "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Framework/edge_module/"
    click Drivers "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Drivers/"
    click Apps "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/Apps/"
    click JUnit "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/reporting/junit_report.py"
    click HTML "https://github.com/automationsolutionz/zeuz_python_node/tree/dev/reporting/html_templates/"
    click Config "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/Utilities/ConfigModule.py"
    click CommonUtil "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/Utilities/CommonUtil.py"
    click FileUtil "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/Utilities/FileUtilities.py"
    click Decorators "https://github.com/automationsolutionz/zeuz_python_node/blob/dev/Framework/Utilities/decorators.py"
```
