# bobghosh91/cypress-reportportal-integration architecture

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

- Interactive diagram: https://gitdiagram.com/bobghosh91/cypress-reportportal-integration
- Repository: https://github.com/bobghosh91/cypress-reportportal-integration

## Overview

##### Project type and purpose
- This is an open-source integration framework that ties together Cypress (end-to-end test runner) with ReportPortal (test reporting & analytics) via Docker Compose.
- Its goal is to let QA/developers write Cypress tests locally or in CI and have detailed execution data sent automatically to a ReportPortal instance running in containers.

##### File structure
- Top-level artifacts:
- package.json / package-lock.json – Node.js project, defines Cypress, ReportPortal agent & helper scripts.
- docker-compose.yml – spins up ReportPortal server (API, UI, database, logging).
- cypress.config.js & cypress.env.json – Cypress runner configuration and ReportPortal agent settings.
- cypress/ directory – the test framework itself:
- e2e/functional_tests_suite.cy.js – actual test specs.
- fixtures/ – test data.
- pageObjects/ – encapsulated page interactions (ContactUsPage, HomePage, LoginPage).
- support/ – custom commands, utilities, and test setup/teardown logic.
- CI/Integration touchpoints: npx cypress run (invoked locally or by Jenkins), Docker Compose for ReportPortal.

##### Key insights from the README
- ReportPortal is launched via docker-compose on port 9090.
- After starting RP containers, Cypress uses the ReportPortal agent (configured in cypress.config.js) to push test logs, screenshots, and metadata to RP API.
- Tests can run locally or in a CI pipeline (e.g., Jenkins) without port conflicts.

##### Main components
a. Developer/CI environment
- Node.js runtime
- Cypress Test Runner (CLI & browser)
- Test code: specs, fixtures, page objects, support utilities
b. ReportPortal stack (containerized via Docker Compose)
- RP API Service
- RP UI Service
- Database(s) (e.g., Elasticsearch, MongoDB)
- (Optional) Redis or other dependencies as defined in the compose file
c. Network layer
- HTTP endpoints:
- Cypress→RP API (ingest test results)
- Browser (test runner) → AUT (application under test)
d. CI Orchestration (optional)
- Jenkins (or any CI) triggers “docker-compose up” and “npx cypress run”

##### Relationships and data flows
1. Developer/CI invokes `npx cypress run`.
2. Cypress spins up a browser, executes E2E tests.
3. During execution, the ReportPortal agent (configured in cypress.config.js) intercepts test events.
4. Agent sends HTTP requests containing logs, screenshots, and metadata to the RP API endpoint (http://localhost:9090/api/v1).
5. RP API stores data in its database backend.
6. User/QA visits http://localhost:9090/ui to view consolidated reports.

##### Architectural patterns & design principles
- Separation of concerns: test definitions (cypress/e2e) vs page abstractions (pageObjects) vs support utilities.
- Containerization: external service (ReportPortal) is isolated in Docker containers, simplifying environment configuration.
- Plugin/agent architecture: Cypress uses a pluggable agent to integrate with an external reporting service without modifying test code.

##### Elements
- Trigger tests
- Browser ↔ AUT
- Agent → RP API → Database
- User → RP UI
- Code artifacts (blue rectangles)
- External systems (gray clouds for CI, browsers)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer/CI Environment
    subgraph "Developer/CI Environment"
        direction TB
        DevNodeJS["Node.js Environment"]:::external
        Pkg1["package.json"]:::codeArtifacts
        Pkg2["package-lock.json"]:::codeArtifacts
        README["README.md"]:::codeArtifacts
        Prep1["npx cypress run (CLI)"]:::external
    end

    %% Test Execution Layer
    subgraph "Test Execution"
        direction TB
        CypressRunner["Cypress Test Runner"]:::services
        Config1["cypress.config.js"]:::codeArtifacts
        Config2["cypress.env.json"]:::codeArtifacts
        Specs["functional_tests_suite.cy.js"]:::codeArtifacts
        Fixtures["Test Fixtures"]:::codeArtifacts
        PO_Contact["ContactUsPage.js"]:::codeArtifacts
        PO_Home["HomePage.js"]:::codeArtifacts
        PO_Login["LoginPage.js"]:::codeArtifacts
        SupportCmds["commands.js"]:::codeArtifacts
        SupportE2E["e2e.js"]:::codeArtifacts
        SupportUtil["utilities.js"]:::codeArtifacts
        Browser["Browser (E2E)"]:::external
        AUT["Application Under Test"]:::external
    end

    %% Reporting Infrastructure
    subgraph "Reporting Infrastructure"
        direction TB
        DC["docker-compose.yml"]:::codeArtifacts
        RP_API["ReportPortal API Service"]:::services
        RP_UI_Service["ReportPortal UI Service"]:::services
        Redis["Redis"]:::services
        ES["Elasticsearch"]:::db
        Mongo["MongoDB"]:::db
    end

    %% RP UI Access
    subgraph "User/QA"
        direction TB
        RP_UI["ReportPortal UI (http://localhost:9090/ui)"]:::external
    end

    %% Connections
    DevNodeJS -->|uses| Pkg1
    DevNodeJS -->|uses| Pkg2
    DevNodeJS -->|reads| README
    DevNodeJS -->|triggers| Prep1

    Prep1 -->|CLI| CypressRunner
    CypressRunner -->|loads| Config1
    CypressRunner -->|loads| Config2
    CypressRunner -->|executes| Specs
    CypressRunner -->|reads| Fixtures
    CypressRunner -->|instantiates| PO_Contact
    CypressRunner -->|instantiates| PO_Home
    CypressRunner -->|instantiates| PO_Login
    CypressRunner -->|loads| SupportCmds
    CypressRunner -->|loads| SupportE2E
    CypressRunner -->|loads| SupportUtil
    CypressRunner -->|launches| Browser
    Browser -->|interacts via HTTP| AUT

    CypressRunner -->|agent HTTP| RP_API
    DC -->|starts| RP_API
    DC -->|starts| RP_UI_Service
    DC -->|starts| Redis
    DC -->|starts| ES
    DC -->|starts| Mongo

    RP_API -->|stores logs| ES
    RP_API -->|stores metadata| Mongo
    RP_API -->|caches| Redis

    RP_UI_Service -->|reads| RP_API
    RP_UI -->|visits| RP_UI_Service

    %% Click Events
    click Pkg1 "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/package.json"
    click Pkg2 "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/package-lock.json"
    click README "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/README.md"
    click Config1 "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress.config.js"
    click Config2 "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress.env.json"
    click Specs "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/e2e/functional_tests_suite.cy.js"
    click Fixtures "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/fixtures/testData.json"
    click PO_Contact "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/pageObjects/ContactUsPage.js"
    click PO_Home "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/pageObjects/HomePage.js"
    click PO_Login "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/pageObjects/LoginPage.js"
    click SupportCmds "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/support/commands.js"
    click SupportE2E "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/support/e2e.js"
    click SupportUtil "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/cypress/support/utilities.js"
    click DC "https://github.com/bobghosh91/cypress-reportportal-integration/blob/main/docker-compose.yml"

    %% Styles
    classDef codeArtifacts fill:#D0E1FF,stroke:#036,stroke-width:1px
    classDef services fill:#D1FFD1,stroke:#0A0,stroke-width:1px
    classDef db fill:#FFE0B2,stroke:#E65C00,stroke-width:1px
    classDef external fill:#EEEEEE,stroke:#666,stroke-width:1px
```
