@healflow/playwright 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +131 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # @healflow/playwright
2
+
3
+ Runtime auto-healing Playwright plugin — detect failures, heal at runtime, and write local artifacts.
4
+
5
+ ## Overview
6
+
7
+ Wraps Playwright's `page` and `locator` APIs to automatically retry failed actions (selectors, timing, overlays, iframes, auth, and more). Writes run summaries to `.healflow/` after each test run.
8
+
9
+ Works **local-first** — no backend or dashboard required.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @healflow/playwright @healflow/cli @playwright/test
15
+ npx healflow init
16
+ ```
17
+
18
+ > **Playwright version:** Test against `@playwright/test@1.58.2`. Newer versions (e.g. 1.60+) may break the custom reporter until compatibility is updated.
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ npx playwright test
24
+ npx healflow report # opens .healflow/report.html
25
+ ```
26
+
27
+ ### Manual config
28
+
29
+ ```typescript
30
+ // playwright.config.ts
31
+ import { defineConfig } from '@playwright/test';
32
+ import { withHealFlow } from '@healflow/playwright/auto';
33
+
34
+ export default withHealFlow(
35
+ defineConfig({
36
+ testDir: './tests',
37
+ reporter: [['html'], ['@healflow/playwright']],
38
+ }),
39
+ );
40
+ ```
41
+
42
+ ### Healing fixtures
43
+
44
+ Import from generated fixtures (created by `healflow init`):
45
+
46
+ ```typescript
47
+ import { test, expect } from './healflow.fixtures';
48
+ ```
49
+
50
+ Or wire manually:
51
+
52
+ ```typescript
53
+ import { test as base } from '@playwright/test';
54
+ import { healflowFixture } from '@healflow/playwright';
55
+
56
+ export const test = base.extend(healflowFixture());
57
+ ```
58
+
59
+ ## Local artifacts
60
+
61
+ After each run, `.healflow/` contains:
62
+
63
+ | File | Purpose |
64
+ | ---- | ------- |
65
+ | `report.html` | Human-readable heal summary |
66
+ | `heals.json` | Runtime heals applied during the run |
67
+ | `fixes.json` | AST fix proposals (dry-run) |
68
+ | `run.json` | Full run metadata |
69
+
70
+ ## Configuration
71
+
72
+ Set options in `healflow.yml`:
73
+
74
+ ```yaml
75
+ mode: local
76
+ output: verbose
77
+
78
+ healing:
79
+ selector: true
80
+ timing: true
81
+ overlay: true
82
+ iframe: true
83
+
84
+ # Optional cloud sync
85
+ backend:
86
+ url: https://api.healflow.example
87
+ organizationId: my-org
88
+ repositoryId: my-repo
89
+ token: hf_...
90
+ ```
91
+
92
+ Environment variables: `HEALFLOW_API_URL`, `HEALFLOW_ORG_ID`, `HEALFLOW_REPO_ID`, `HEALFLOW_TOKEN`.
93
+
94
+ ## Exports
95
+
96
+ | Subpath | Purpose |
97
+ | ------- | ------- |
98
+ | `@healflow/playwright` | `healflowFixture`, `wrapPage`, plugin options |
99
+ | `@healflow/playwright/auto` | `withHealFlow()` config wrapper |
100
+ | `@healflow/playwright/reporter` | Custom Playwright reporter |
101
+ | `@healflow/playwright/setup-global` | Global setup hook |
102
+
103
+ ## Runtime healing categories
104
+
105
+ - **Selector** — stale locators, `getByTestId` fallbacks
106
+ - **Timing** — wait for element stability before retry
107
+ - **Overlay** — dismiss cookie banners and modals
108
+ - **Iframe / Shadow DOM** — context switching
109
+ - **Auth / Session** — storage-state refresh (when configured)
110
+
111
+ Product bugs and assertion failures are never auto-fixed.
112
+
113
+ ## Cloud sync (optional)
114
+
115
+ When `backend` is configured, the reporter syncs heals to the HealFlow API after each run. See [`@healflow/cli`](../cli) for `healflow ingest`.
116
+
117
+ ## Development
118
+
119
+ ```bash
120
+ pnpm --filter @healflow/playwright build
121
+ pnpm --filter @healflow/playwright typecheck
122
+ ```
123
+
124
+ ## Related packages
125
+
126
+ - [`@healflow/cli`](../cli) — `healflow init`, `doctor`, `report`
127
+ - [`@healflow/classification`](../classification) — runtime error classification
128
+
129
+ ## License
130
+
131
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healflow/playwright",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Runtime auto-healing Playwright plugin for HealFlow",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -33,8 +33,8 @@
33
33
  "@playwright/test": ">=1.40.0"
34
34
  },
35
35
  "dependencies": {
36
- "@healflow/classification": "^0.1.0",
37
- "@healflow/shared": "^0.1.0"
36
+ "@healflow/classification": "^0.1.1",
37
+ "@healflow/shared": "^0.1.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@playwright/test": "1.58.2",