# m4rri4nne/self-healing-playwright architecture

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

- Interactive diagram: https://gitdiagram.com/m4rri4nne/self-healing-playwright
- Repository: https://github.com/m4rri4nne/self-healing-playwright

## Overview

Self-Healing Playwright wraps Playwright selectors: page-object actions enter through SelfHealingPage, which tries the original locator and delegates failures to a priority-ordered strategy engine. Successful recoveries and failures are recorded for reporting. The README also documents worker log aggregation, persistent history, and HTML trend reports; those reporting paths are retained, though their source excerpts were not provided, so documented links cite README.md.

Main entry points: [`src/core/createSelfHealingPage.ts`](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/createSelfHealingPage.ts) (Page factory), [`src/core/HealingEngine.ts`](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/HealingEngine.ts) (Healing engine), [`fixtures`](https://github.com/m4rri4nne/self-healing-playwright/tree/main/fixtures) (Test fixtures), [`src/core/SelfHealingPage.ts`](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/SelfHealingPage.ts) (Self-healing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Healing runtime"]
  node_selfhealing["Self-healing page<br/>[SelfHealingPage.ts]"]
  node_engine["Healing engine<br/>[HealingEngine.ts]"]
  node_factory["Page factory"]
  node_types["Selector contracts<br/>[index.ts]"]
end

subgraph group_strategies["Fallback strategies"]
  node_datatestid["Test ID fallback"]
  node_aria["ARIA label fallback"]
  node_placeholder["Placeholder fallback"]
  node_alttext["Alt text fallback<br/>[AltTextStrategy.ts]"]
  node_role["Role fallback<br/>[RoleStrategy.ts]"]
  node_text["Text fallback"]
  node_relative["Position fallback"]
end

subgraph group_testapi["Test integration"]
  node_pageobjects["Page objects"]
  node_fixtures["Test fixtures"]
end

subgraph group_reporting["Healing reports"]
  node_healinglog[("Healing log<br/>[HealingLog.ts]")]
  node_workerlogs[("Worker log files")]
  node_combinedlog[("Run healing log")]
  node_history[("Healing history")]
  node_htmlreport["HTML report"]
  node_reportgenerator["Report generator"]
  node_mockdata["Mock data generator"]
end

node_tester(("Test author"))
node_playwright["Playwright page"]

node_tester -->|"uses actions"| node_pageobjects
node_pageobjects -->|"calls actions"| node_selfhealing
node_selfhealing -->|"tries locator"| node_playwright
node_selfhealing -->|"delegates failures"| node_engine
node_selfhealing -->|"records outcome"| node_healinglog
node_factory -->|"constructs"| node_selfhealing
node_factory -->|"constructs"| node_engine
node_factory -->|"accepts log"| node_healinglog
node_factory -->|"registers"| node_datatestid
node_factory -->|"registers"| node_aria
node_factory -->|"registers"| node_placeholder
node_factory -->|"registers"| node_alttext
node_factory -->|"registers"| node_role
node_factory -->|"registers"| node_text
node_factory -->|"registers"| node_relative
node_engine -->|"tries strategies"| node_datatestid
node_engine -->|"tries strategies"| node_aria
node_engine -->|"tries strategies"| node_placeholder
node_engine -->|"tries strategies"| node_alttext
node_engine -->|"tries strategies"| node_role
node_engine -->|"tries strategies"| node_text
node_engine -->|"tries strategies"| node_relative
node_fixtures -->|"creates wrapper"| node_factory
node_fixtures -->|"provides log"| node_healinglog
node_healinglog -->|"writes per worker"| node_workerlogs
node_fixtures -->|"isolates workers"| node_workerlogs
node_fixtures -->|"merges entries"| node_combinedlog
node_fixtures -->|"appends entries"| node_history
node_fixtures -->|"invokes"| node_reportgenerator
node_reportgenerator -->|"reads run data"| node_combinedlog
node_reportgenerator -->|"reads trend data"| node_history
node_reportgenerator -->|"renders report"| node_htmlreport
node_mockdata -->|"writes sample data"| node_combinedlog
node_mockdata -->|"writes sample data"| node_history
node_mockdata -->|"invokes"| node_reportgenerator

click node_pageobjects "https://github.com/m4rri4nne/self-healing-playwright/tree/main/pages"
click node_selfhealing "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/SelfHealingPage.ts"
click node_engine "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/HealingEngine.ts"
click node_factory "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/createSelfHealingPage.ts"
click node_types "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/types/index.ts"
click node_datatestid "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/DataTestIdStrategy.ts"
click node_aria "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/AriaLabelStrategy.ts"
click node_placeholder "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/PlaceHolderStrategy.ts"
click node_alttext "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/AltTextStrategy.ts"
click node_role "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/RoleStrategy.ts"
click node_text "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/TextContentStrategy.ts"
click node_relative "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/RelativePositionStrategy.ts"
click node_healinglog "https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/HealingLog.ts"
click node_fixtures "https://github.com/m4rri4nne/self-healing-playwright/tree/main/fixtures"
click node_combinedlog "https://github.com/m4rri4nne/self-healing-playwright/tree/main/reports"
click node_history "https://github.com/m4rri4nne/self-healing-playwright/tree/main/reports"
click node_htmlreport "https://github.com/m4rri4nne/self-healing-playwright/tree/main/reports"
click node_reportgenerator "https://github.com/m4rri4nne/self-healing-playwright/blob/main/fixtures/generateHealingReport.ts"
click node_mockdata "https://github.com/m4rri4nne/self-healing-playwright/blob/main/scripts/generateMockData.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_selfhealing,node_engine,node_factory,node_types toneBlue
class node_datatestid,node_aria,node_placeholder,node_alttext,node_role,node_text,node_relative toneAmber
class node_pageobjects,node_fixtures toneMint
class node_healinglog,node_workerlogs,node_combinedlog,node_history,node_htmlreport,node_reportgenerator,node_mockdata toneRose
class node_tester,node_playwright toneIndigo
```

## Components

### Healing runtime

- [Self-healing page](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/SelfHealingPage.ts): `src/core/SelfHealingPage.ts`
- [Healing engine](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/HealingEngine.ts): `src/core/HealingEngine.ts`
- [Page factory](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/createSelfHealingPage.ts): `src/core/createSelfHealingPage.ts`
- [Selector contracts](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/types/index.ts): `src/types/index.ts`

### Fallback strategies

- [Test ID fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/DataTestIdStrategy.ts): `src/strategies/DataTestIdStrategy.ts`
- [ARIA label fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/AriaLabelStrategy.ts): `src/strategies/AriaLabelStrategy.ts`
- [Placeholder fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/PlaceHolderStrategy.ts): `src/strategies/PlaceHolderStrategy.ts`
- [Alt text fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/AltTextStrategy.ts): `src/strategies/AltTextStrategy.ts`
- [Role fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/RoleStrategy.ts): `src/strategies/RoleStrategy.ts`
- [Text fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/TextContentStrategy.ts): `src/strategies/TextContentStrategy.ts`
- [Position fallback](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/strategies/RelativePositionStrategy.ts): `src/strategies/RelativePositionStrategy.ts`

### Test integration

- [Page objects](https://github.com/m4rri4nne/self-healing-playwright/tree/main/pages): `pages`
- [Test fixtures](https://github.com/m4rri4nne/self-healing-playwright/tree/main/fixtures): `fixtures`

### Healing reports

- [Healing log](https://github.com/m4rri4nne/self-healing-playwright/blob/main/src/core/HealingLog.ts): `src/core/HealingLog.ts`
- **Worker log files**
- [Run healing log](https://github.com/m4rri4nne/self-healing-playwright/tree/main/reports): `reports`
- [Healing history](https://github.com/m4rri4nne/self-healing-playwright/tree/main/reports): `reports`
- [HTML report](https://github.com/m4rri4nne/self-healing-playwright/tree/main/reports): `reports`
- [Report generator](https://github.com/m4rri4nne/self-healing-playwright/blob/main/fixtures/generateHealingReport.ts): `fixtures/generateHealingReport.ts`
- [Mock data generator](https://github.com/m4rri4nne/self-healing-playwright/blob/main/scripts/generateMockData.ts): `scripts/generateMockData.ts`

### Other components

- **Test author**
- **Playwright page**

## Connections

- Test author → Page objects: uses actions (evidence: `README.md`)
- Page objects → Self-healing page: calls actions (evidence: `pages/HomePage.ts`)
- Self-healing page → Playwright page: tries locator (evidence: `src/core/SelfHealingPage.ts`)
- Self-healing page → Healing engine: delegates failures (evidence: `src/core/SelfHealingPage.ts`)
- Self-healing page → Healing log: records outcome (evidence: `src/core/SelfHealingPage.ts`)
- Page factory → Self-healing page: constructs (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Healing engine: constructs (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Healing log: accepts log (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Test ID fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → ARIA label fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Placeholder fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Alt text fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Role fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Text fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Page factory → Position fallback: registers (evidence: `src/core/createSelfHealingPage.ts`)
- Healing engine → Test ID fallback: tries strategies (evidence: `README.md`)
- Healing engine → ARIA label fallback: tries strategies (evidence: `README.md`)
- Healing engine → Placeholder fallback: tries strategies (evidence: `README.md`)
- Healing engine → Alt text fallback: tries strategies (evidence: `README.md`)
- Healing engine → Role fallback: tries strategies (evidence: `README.md`)
- Healing engine → Text fallback: tries strategies (evidence: `README.md`)
- Healing engine → Position fallback: tries strategies (evidence: `README.md`)
- Test fixtures → Page factory: creates wrapper (evidence: `README.md`)
- Test fixtures → Healing log: provides log (evidence: `README.md`)
- Healing log → Worker log files: writes per worker (evidence: `README.md`)
- Test fixtures → Worker log files: isolates workers (evidence: `README.md`)
- Test fixtures → Run healing log: merges entries (evidence: `README.md`)
- Test fixtures → Healing history: appends entries (evidence: `README.md`)
- Test fixtures → Report generator: invokes (evidence: `README.md`)
- Report generator → Run healing log: reads run data (evidence: `README.md`)
- Report generator → Healing history: reads trend data (evidence: `README.md`)
- Report generator → HTML report: renders report (evidence: `README.md`)
- Mock data generator → Run healing log: writes sample data (evidence: `scripts/generateMockData.ts`)
- Mock data generator → Healing history: writes sample data (evidence: `scripts/generateMockData.ts`)
- Mock data generator → Report generator: invokes (evidence: `scripts/generateMockData.ts`)
