# benediktst/cucumber-playwright-starter architecture

> Architecture diagram of the GitHub repository benediktst/cucumber-playwright-starter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/benediktst/cucumber-playwright-starter
- Repository: https://github.com/benediktst/cucumber-playwright-starter

## Overview

This repository is a TypeScript starter for running browser-based UI tests with Cucumber and Playwright. The workflow is: invoke Cucumber, load the project configuration and hooks, create a per-scenario world and browser context, run test steps, then collect failure artifacts and reports. The tree contains no feature files or step definitions, so those test-domain stages are represented only as external inputs. The sampled hooks show browser/API context setup and trace handling; broader test execution behavior comes from the README, and unsampled integrations are not expanded.

Main entry points: [`src/support/common-hooks.ts`](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts) (Scenario Hooks), [`cucumber.mjs`](https://github.com/benediktst/cucumber-playwright-starter/blob/main/cucumber.mjs) (Cucumber Setup), [`src/support/reporters/allure-reporter.ts`](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/reporters/allure-reporter.ts) (Allure Settings), [`src/support/custom-world.ts`](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/custom-world.ts) (Scenario World)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Test Runtime"]
  node_cucumber["Cucumber Setup<br/>[cucumber.mjs]"]
  node_hooks["Scenario Hooks<br/>[common-hooks.ts]"]
  node_world["Scenario World<br/>[custom-world.ts]"]
  node_config["Runtime Config<br/>[config.ts]"]
end

subgraph group_browser["Browser Support"]
  node_playwright["Playwright Browser<br/>[common-hooks.ts]"]
  node_api["API Context<br/>[common-hooks.ts]"]
end

subgraph group_results["Test Results"]
  node_reporting["Cucumber Reporting<br/>[cucumber.mjs]"]
  node_allure["Allure Settings<br/>[allure-reporter.ts]"]
  node_artifacts["Failure Artifacts<br/>[common-hooks.ts]"]
  node_reports["Test Reports"]
end

node_author(("Test Author"))
node_runner(("Test Runner"))
node_scenarios["Gherkin Scenarios"]
node_application["Application Under Test"]

node_author -->|"defines"| node_scenarios
node_runner -->|"runs tests"| node_cucumber
node_scenarios -->|"supplies tests"| node_cucumber
node_cucumber -->|"loads support"| node_hooks
node_hooks -->|"reads settings"| node_config
node_hooks -->|"uses scenario state"| node_world
node_hooks -->|"launches browser"| node_playwright
node_hooks -->|"creates context"| node_api
node_playwright -.->|"drives UI"| node_application
node_api -->|"targets API"| node_application
node_cucumber -->|"configures formats"| node_reporting
node_cucumber -.->|"loads optionally"| node_allure
node_hooks -->|"captures failures"| node_artifacts
node_reporting -->|"writes reports"| node_reports
node_allure -->|"sets results directory"| node_reports

click node_cucumber "https://github.com/benediktst/cucumber-playwright-starter/blob/main/cucumber.mjs"
click node_hooks "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts"
click node_world "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/custom-world.ts"
click node_config "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/config.ts"
click node_playwright "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts"
click node_api "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts"
click node_reporting "https://github.com/benediktst/cucumber-playwright-starter/blob/main/cucumber.mjs"
click node_allure "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/reporters/allure-reporter.ts"
click node_artifacts "https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cucumber,node_hooks,node_world,node_config toneBlue
class node_playwright,node_api toneAmber
class node_reporting,node_allure,node_artifacts,node_reports toneMint
class node_author,node_runner,node_scenarios,node_application toneIndigo
```

## Components

### Test Runtime

- [Cucumber Setup](https://github.com/benediktst/cucumber-playwright-starter/blob/main/cucumber.mjs): `cucumber.mjs`
- [Scenario Hooks](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts): `src/support/common-hooks.ts`
- [Scenario World](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/custom-world.ts): `src/support/custom-world.ts`
- [Runtime Config](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/config.ts): `src/support/config.ts`

### Browser Support

- [Playwright Browser](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts): `src/support/common-hooks.ts`
- [API Context](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts): `src/support/common-hooks.ts`

### Test Results

- [Cucumber Reporting](https://github.com/benediktst/cucumber-playwright-starter/blob/main/cucumber.mjs): `cucumber.mjs`
- [Allure Settings](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/reporters/allure-reporter.ts): `src/support/reporters/allure-reporter.ts`
- [Failure Artifacts](https://github.com/benediktst/cucumber-playwright-starter/blob/main/src/support/common-hooks.ts): `src/support/common-hooks.ts`
- **Test Reports**

### Other components

- **Test Author**
- **Test Runner**
- **Gherkin Scenarios**
- **Application Under Test**

## Connections

- Test Author → Gherkin Scenarios: defines (evidence: `README.md`)
- Test Runner → Cucumber Setup: runs tests (evidence: `README.md`)
- Gherkin Scenarios → Cucumber Setup: supplies tests (evidence: `README.md`)
- Cucumber Setup → Scenario Hooks: loads support (evidence: `cucumber.mjs`)
- Scenario Hooks → Runtime Config: reads settings (evidence: `src/support/common-hooks.ts`)
- Scenario Hooks → Scenario World: uses scenario state (evidence: `src/support/common-hooks.ts`)
- Scenario Hooks → Playwright Browser: launches browser (evidence: `src/support/common-hooks.ts`)
- Scenario Hooks → API Context: creates context (evidence: `src/support/common-hooks.ts`)
- Playwright Browser → Application Under Test: drives UI
- API Context → Application Under Test: targets API (evidence: `src/support/common-hooks.ts`)
- Cucumber Setup → Cucumber Reporting: configures formats (evidence: `cucumber.mjs`)
- Cucumber Setup → Allure Settings: loads optionally (evidence: `cucumber.mjs`)
- Scenario Hooks → Failure Artifacts: captures failures (evidence: `src/support/common-hooks.ts`)
- Cucumber Reporting → Test Reports: writes reports (evidence: `cucumber.mjs`)
- Allure Settings → Test Reports: sets results directory (evidence: `src/support/reporters/allure-reporter.ts`)
