# ashraaf7/taf architecture

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

- Interactive diagram: https://gitdiagram.com/ashraaf7/taf
- Repository: https://github.com/ashraaf7/taf

## Overview

##### Project Type and Purpose
- This is a Test Automation Framework (TAF) written in Java, combining Selenium for UI testing and Rest Assured for API testing.
- It’s designed as an open-source, modular, data-driven, cross-browser test framework with CI/CD integration and custom reporting.

##### File Structure Analysis
- **Top-level modules and files:**
- pom.xml (Maven build)
- .github/workflows (CI pipeline definitions)
- **src/main/java/com/automationexercices:**
- apis (Builder, UserManagementAPI)
- drivers (AbstractDriver, Browser enum, BrowserFactory classes, WebDriverProvider, GUIDriver, UITest)
- pages & pages/components (Page Object Model classes, reusable UI components)
- listeners (TestNGListeners)
- media (ScreenshotsManager, ScreenRecordManager)
- utils (OSUtils, TerminalUtils, TimeManager, WaitManager, actions, dataReader, logs, report)
- validations (custom assertion wrappers)
- **src/test/java:**
- BaseTest scaffold, UI tests, API tests.
- **resources (environment configs, Allure/Log4j/driver extensions).**

##### README Insights
- Key features: modular design, POM, Factory & Builder patterns, parallel execution, data-driven JSON/Excel, custom listeners, custom reports (Allure), CI/CD (GitHub Actions).
- Supported technologies: Selenium, Rest Assured, TestNG, Maven, Log4j, Allure, Apache POI, Faker.

##### Main System Components
a. **Test Layer**
- UI Test Cases (CartTest, CheckoutTest, etc.)
- API Test Cases (RegisterTestAPI)
- BaseTest (initializes WebDriverProvider, TestNGListeners, environment config)
b. **Test Runner & Orchestration**
- TestNG/JUnit engine
- GitHub Actions workflow
c. **Core Framework Modules**
- **WebDriverProvider & DriverFactories** (ChromeFactory, FirefoxFactory, etc.) using Factory pattern
- **AbstractDriver & Browser** (singleton driver management)
- **Page Objects & UI Components** (POM classes)
- **API Clients** (Builder pattern for building API requests, UserManagementAPI)
- **Utilities**
- dataReader (JSON, Excel, properties)
- actions (ElementActions, BrowserActions, FrameActions, AlertActions)
- WaitManager, TimeManager, OSUtils, TerminalUtils
- **Media Managers** (ScreenshotsManager, ScreenRecordManager)
- **Logging & Reporting**
- LogsManager (Log4j2)
- AllureAttachmentManager, AllureReportGenerator, TestNGListeners
d. **External Services & Infrastructure**
- AUT Web Application under test
- API endpoints (e.g., user management service)
- Selenium Grid / Browser nodes (configured via seleniumGrid.properties)
- CI/CD runner (GitHub Actions)

##### Relationships and Data Flows
- Tests → TestNG → BaseTest → WebDriverProvider → DriverFactory → Browser instance → Selenium Grid or local browser → AUT
- UI Tests → Page Objects → ElementActions → WebDriver
- API Tests → Builder → Rest Assured → API service
- Utils & dataReader → provide test data/config to tests and framework
- Media Managers & Listeners → capture screenshots/videos, attach to Allure
- CI/CD → triggers TestNG suite → publishes Allure reports

##### Architectural Patterns & Principles
- Page Object Model for UI abstraction
- Factory pattern for browser instantiation
- Builder pattern for API request creation
- Singleton/WebDriverProvider for managing driver lifecycle
- Modular, layered structure for separation of concerns
- Data-driven approach (JSON/Excel)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Test Layer
    subgraph "Test Layer"
        direction TB
        UITests("UI Test Cases"):::test
        APITests("API Test Cases"):::test
        BaseTest("BaseTest (Test Setup & Orchestration)"):::test
    end

    %% Runner & Orchestration
    subgraph "Test Runner & CI/CD"
        direction TB
        TestNG("TestNG Engine"):::external
        CI("GitHub Actions Workflow"):::external
    end

    %% Core Framework Modules
    subgraph "Core Framework Modules"
        direction TB

        subgraph "Drivers" 
            direction TB
            WebDriverProvider("WebDriverProvider"):::core
            ChromeFactory("ChromeFactory"):::core
            FirefoxFactory("FirefoxFactory"):::core
            EdgeFactory("EdgeFactory"):::core
            SafariFactory("SafariFactory"):::core
            AbstractDriver("AbstractDriver"):::core
            BrowserEnum("Browser Enum"):::core
        end

        subgraph "Page Objects & UI Components"
            direction TB
            Pages("Pages (POM Classes)"):::core
            NavBar("NavigationBarComponent"):::core
        end

        subgraph "API Clients"
            direction TB
            Builder("Builder"):::core
            UserMgmtAPI("UserManagementAPI"):::core
        end
    end

    %% Utilities
    subgraph "Utilities"
        direction TB
        subgraph "Data Readers"
            direction TB
            JsonReader("JsonReader"):::utils
            ExcelReader("ExcelReader"):::utils
            PropertyReader("PropertyReader"):::utils
        end
        subgraph "Actions"
            direction TB
            ElementActions("ElementActions"):::utils
            BrowserActions("BrowserActions"):::utils
            FrameActions("FrameActions"):::utils
            AlertActions("AlertActions"):::utils
        end
        subgraph "Core Helpers"
            direction TB
            WaitManager("WaitManager"):::utils
            TimeManager("TimeManager"):::utils
            OSUtils("OSUtils"):::utils
            TerminalUtils("TerminalUtils"):::utils
        end
    end

    %% Media & Reporting
    subgraph "Media Managers & Reporting"
        direction TB
        Screenshots("ScreenshotsManager"):::media
        ScreenRecord("ScreenRecordManager"):::media
        TestNGListeners("TestNGListeners"):::media
        LogsMgr("LogsManager"):::media
        AllureAttach("AllureAttachmentManager"):::media
        AllureReport("AllureReportGenerator"):::media
        AllureEnvMgr("AllureEnvironmentManager"):::media
        AllureConst("AllureConstants"):::media
    end

    %% External Services & Infrastructure
    subgraph "External Services & Infrastructure"
        direction TB
        AUT("AUT Web Application"):::external
        APIService("API Service (User Management)"):::external
        SeleniumGrid("Selenium Grid / Browser Nodes"):::external
        CIServer("CI/CD Runner"):::external
        Configs("Configuration Files"):::external
    end

    %% Relationships
    UITests -->|"triggers"| BaseTest
    APITests -->|"triggers"| BaseTest
    BaseTest -->|"invokes"| WebDriverProvider
    WebDriverProvider -->|"factory uses"| ChromeFactory
    WebDriverProvider -->|"factory uses"| FirefoxFactory
    WebDriverProvider -->|"factory uses"| EdgeFactory
    WebDriverProvider -->|"factory uses"| SafariFactory
    ChromeFactory -->|"creates"| BrowserEnum
    FirefoxFactory -->|"creates"| BrowserEnum
    EdgeFactory -->|"creates"| BrowserEnum
    SafariFactory -->|"creates"| BrowserEnum
    BrowserEnum -->|"launches"| SeleniumGrid
    UITests -->|"uses"| Pages
    UITests -->|"uses"| NavBar
    Pages -->|"calls"| ElementActions
    ElementActions -->|"executes on"| WebDriverProvider
    APITests -->|"uses"| Builder
    Builder -->|"builds"| UserMgmtAPI
    UserMgmtAPI -->|"HTTP request"| APIService

    BaseTest -->|"reads from"| Configs
    JsonReader -->|"provides data to"| BaseTest
    ExcelReader -->|"provides data to"| BaseTest
    PropertyReader -->|"provides data to"| BaseTest

    TestNGListeners -->|"listens to"| TestNG
    Screenshots -->|"captures to"| AllureAttach
    ScreenRecord -->|"captures to"| AllureAttach
    AllureAttach -->|"attaches to"| AllureReport
    LogsMgr -->|"logs to"| TestNGListeners
    AllureEnvMgr -->|"configures"| AllureReport

    CI -->|"executes suite"| TestNG
    CIServer -->|"hosts"| CI
    TestNG -->|"runs tests"| BaseTest

    BaseTest -->|"uploads report"| AllureReport

    %% Click Events
    click UITests "https://github.com/ashraaf7/taf/tree/master/src/test/java/com/automationexercices/tests/ui"
    click APITests "https://github.com/ashraaf7/taf/blob/master/src/test/java/com/automationexercices/tests/api/RegisterTestAPI.java"
    click BaseTest "https://github.com/ashraaf7/taf/blob/master/src/test/java/com/automationexercices/tests/BaseTest.java"
    click CI "https://github.com/ashraaf7/taf/blob/master/.github/workflows/E2E Regression Pipeline.yml"
    click WebDriverProvider "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/WebDriverProvider.java"
    click ChromeFactory "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/ChromeFactory.java"
    click FirefoxFactory "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/FirefoxFactory.java"
    click EdgeFactory "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/EdgeFactory.java"
    click SafariFactory "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/SafariFactory.java"
    click AbstractDriver "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/AbstractDriver.java"
    click BrowserEnum "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/drivers/Browser.java"
    click Pages "https://github.com/ashraaf7/taf/tree/master/src/main/java/com/automationexercices/pages"
    click NavBar "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/pages/components/NavigationBarComponent.java"
    click Builder "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/apis/Builder.java"
    click UserMgmtAPI "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/apis/UserManagementAPI.java"
    click JsonReader "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/dataReader/JsonReader.java"
    click ExcelReader "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/dataReader/ExcelReader.java"
    click PropertyReader "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/dataReader/PropertyReader.java"
    click ElementActions "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/actions/ElementActions.java"
    click BrowserActions "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/actions/BrowserActions.java"
    click FrameActions "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/actions/FrameActions.java"
    click AlertActions "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/actions/AlertActions.java"
    click WaitManager "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/WaitManager.java"
    click TimeManager "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/TimeManager.java"
    click OSUtils "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/OSUtils.java"
    click TerminalUtils "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/TerminalUtils.java"
    click Screenshots "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/media/ScreenshotsManager.java"
    click ScreenRecord "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/media/ScreenRecordManager.java"
    click TestNGListeners "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/listeners/TestNGListeners.java"
    click LogsMgr "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/logs/LogsManager.java"
    click AllureAttach "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/report/AllureAttachmentManager.java"
    click AllureReport "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/report/AllureReportGenerator.java"
    click AllureEnvMgr "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/report/AllureEnvironmentManager.java"
    click AllureConst "https://github.com/ashraaf7/taf/blob/master/src/main/java/com/automationexercices/utils/report/AllureConstants.java"
    click Configs "https://github.com/ashraaf7/taf/tree/master/src/main/resources"
    click TestNG "https://github.com/ashraaf7/taf/blob/master/src/main/resources/META-INF/services/org.testng.ITestNGListener"

    %% Styles
    classDef core fill:#D6E5FF,stroke:#333,stroke-width:1px
    classDef utils fill:#E5FFE5,stroke:#333,stroke-width:1px
    classDef media fill:#FFE5CC,stroke:#333,stroke-width:1px
    classDef external fill:#F0F0F0,stroke:#333,stroke-width:1px
    classDef test fill:#FFF2CC,stroke:#333,stroke-width:1px
```
