How bobghosh91/cypress-reportportal-integration works
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)