tamash-playwright 0.7.0 → 0.8.0
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.
Potentially problematic release.
This version of tamash-playwright might be problematic. Click here for more details.
- package/.env.example +22 -6
- package/README.md +495 -431
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -10
- package/dist/cli/doctor.js.map +1 -1
- package/dist/healer/providers/claude-cli.d.ts +3 -0
- package/dist/healer/providers/claude-cli.d.ts.map +1 -0
- package/dist/healer/providers/claude-cli.js +122 -0
- package/dist/healer/providers/claude-cli.js.map +1 -0
- package/dist/healer/providers/claude-subscription.d.ts +3 -0
- package/dist/healer/providers/claude-subscription.d.ts.map +1 -0
- package/dist/healer/providers/claude-subscription.js +122 -0
- package/dist/healer/providers/claude-subscription.js.map +1 -0
- package/dist/healer/providers/copilot-cli.d.ts +3 -0
- package/dist/healer/providers/copilot-cli.d.ts.map +1 -0
- package/dist/healer/providers/copilot-cli.js +115 -0
- package/dist/healer/providers/copilot-cli.js.map +1 -0
- package/dist/healer/providers/copilot-subscription.d.ts +3 -0
- package/dist/healer/providers/copilot-subscription.d.ts.map +1 -0
- package/dist/healer/providers/copilot-subscription.js +118 -0
- package/dist/healer/providers/copilot-subscription.js.map +1 -0
- package/dist/healer/providers/index.d.ts.map +1 -1
- package/dist/healer/providers/index.js +12 -1
- package/dist/healer/providers/index.js.map +1 -1
- package/package.json +17 -3
- package/usage.md +4 -16
|
@@ -5,10 +5,15 @@ const ollama_1 = require("./ollama");
|
|
|
5
5
|
const openai_1 = require("./openai");
|
|
6
6
|
const anthropic_1 = require("./anthropic");
|
|
7
7
|
const gemini_1 = require("./gemini");
|
|
8
|
+
const claude_subscription_1 = require("./claude-subscription");
|
|
9
|
+
const copilot_subscription_1 = require("./copilot-subscription");
|
|
8
10
|
let cachedProvider;
|
|
9
11
|
// HEALER_PROVIDER picks which AI provider backs self-healing; each provider gracefully
|
|
10
12
|
// returns null (disabling healing for that action) if its own API key/model env vars
|
|
11
|
-
// aren't set, so switching providers is just an env change, no code change.
|
|
13
|
+
// aren't set, so switching providers is just an env change, no code change. The two
|
|
14
|
+
// subscription-based providers (claude-subscription, copilot-subscription) have no API key to
|
|
15
|
+
// check synchronously — they always construct successfully and instead return null per-call
|
|
16
|
+
// if the underlying SDK isn't installed or the CLI isn't authenticated.
|
|
12
17
|
function getHealProvider() {
|
|
13
18
|
if (cachedProvider !== undefined) {
|
|
14
19
|
return cachedProvider;
|
|
@@ -26,6 +31,12 @@ function getHealProvider() {
|
|
|
26
31
|
case 'gemini':
|
|
27
32
|
cachedProvider = (0, gemini_1.createGeminiProvider)();
|
|
28
33
|
break;
|
|
34
|
+
case 'claude-subscription':
|
|
35
|
+
cachedProvider = (0, claude_subscription_1.createClaudeSubscriptionProvider)();
|
|
36
|
+
break;
|
|
37
|
+
case 'copilot-subscription':
|
|
38
|
+
cachedProvider = (0, copilot_subscription_1.createCopilotSubscriptionProvider)();
|
|
39
|
+
break;
|
|
29
40
|
default:
|
|
30
41
|
cachedProvider = null;
|
|
31
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/healer/providers/index.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAChD,qCAAgD;AAChD,2CAAsD;AACtD,qCAAgD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/healer/providers/index.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAChD,qCAAgD;AAChD,2CAAsD;AACtD,qCAAgD;AAChD,+DAAyE;AACzE,iEAA2E;AAK3E,IAAI,cAA+C,CAAC;AAEpD,uFAAuF;AACvF,qFAAqF;AACrF,oFAAoF;AACpF,8FAA8F;AAC9F,4FAA4F;AAC5F,wEAAwE;AACxE;IACE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;QACpC,KAAK,QAAQ;YACX,cAAc,GAAG,IAAA,6BAAoB,GAAE,CAAC;YACxC,MAAM;QACR,KAAK,QAAQ;YACX,cAAc,GAAG,IAAA,6BAAoB,GAAE,CAAC;YACxC,MAAM;QACR,KAAK,WAAW;YACd,cAAc,GAAG,IAAA,mCAAuB,GAAE,CAAC;YAC3C,MAAM;QACR,KAAK,QAAQ;YACX,cAAc,GAAG,IAAA,6BAAoB,GAAE,CAAC;YACxC,MAAM;QACR,KAAK,qBAAqB;YACxB,cAAc,GAAG,IAAA,sDAAgC,GAAE,CAAC;YACpD,MAAM;QACR,KAAK,sBAAsB;YACzB,cAAc,GAAG,IAAA,wDAAiC,GAAE,CAAC;YACrD,MAAM;QACR;YACE,cAAc,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamash-playwright",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Plug and Play Self-healing for Playwright and automatically recovers broken selectors using an AI model (Ollama, OpenAI, Anthropic, or
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Plug and Play Self-healing for Playwright and automatically recovers broken selectors using an AI model (Ollama, OpenAI, Anthropic, Gemini, or a Claude/GitHub Copilot subscription).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -27,18 +27,32 @@
|
|
|
27
27
|
"ollama",
|
|
28
28
|
"openai",
|
|
29
29
|
"anthropic",
|
|
30
|
-
"gemini"
|
|
30
|
+
"gemini",
|
|
31
|
+
"claude-code",
|
|
32
|
+
"github-copilot"
|
|
31
33
|
],
|
|
32
34
|
"author": "QtpSudhakar / VibeTestQ",
|
|
33
35
|
"license": "SEE LICENSE IN LICENSE",
|
|
34
36
|
"peerDependencies": {
|
|
37
|
+
"@anthropic-ai/claude-agent-sdk": ">=0.3.0",
|
|
38
|
+
"@github/copilot-sdk": ">=1.0.0",
|
|
35
39
|
"@playwright/test": ">=1.40.0"
|
|
36
40
|
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"@anthropic-ai/claude-agent-sdk": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"@github/copilot-sdk": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
37
49
|
"dependencies": {
|
|
38
50
|
"@anthropic-ai/sdk": "^0.115.0",
|
|
39
51
|
"dotenv": "^16.0.1"
|
|
40
52
|
},
|
|
41
53
|
"devDependencies": {
|
|
54
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.241",
|
|
55
|
+
"@github/copilot-sdk": "^1.0.11",
|
|
42
56
|
"@playwright/test": "^1.62.1",
|
|
43
57
|
"@types/node": "^26.1.2",
|
|
44
58
|
"typescript": "^7.0.2"
|
package/usage.md
CHANGED
|
@@ -17,7 +17,6 @@ For a quicker, high-level overview see [README.md](README.md); this file is the
|
|
|
17
17
|
- [Finding elements by structure](#when-theres-no-name-to-match-finding-elements-by-structure)
|
|
18
18
|
- [When a fix needs a second look](#when-a-fix-needs-a-second-look)
|
|
19
19
|
- [Vision fallback](#when-text-alone-isnt-enough-vision-fallback)
|
|
20
|
-
- [Action recovery](#action-recovery-optional)
|
|
21
20
|
- [Not paying for the same heal twice](#not-paying-for-the-same-heal-twice)
|
|
22
21
|
- [Making a heal permanent: `apply-heals`](#making-a-heal-permanent-apply-heals)
|
|
23
22
|
- [Proving a fix works: `verify-heals.cjs`](#proving-a-fix-actually-works-verify-healscjs)
|
|
@@ -55,9 +54,6 @@ HEALER_ENABLED=true
|
|
|
55
54
|
# Pick one: ollama | openai | anthropic | gemini
|
|
56
55
|
HEALER_PROVIDER=ollama
|
|
57
56
|
|
|
58
|
-
# Optional, off by default — see "Action recovery" below.
|
|
59
|
-
# HEALER_ACTION_RECOVERY_ENABLED=true
|
|
60
|
-
|
|
61
57
|
# --- Ollama Cloud (https://ollama.com) ---
|
|
62
58
|
OLLAMA_MODEL=gpt-oss:120b
|
|
63
59
|
OLLAMA_API_KEY=
|
|
@@ -108,10 +104,9 @@ npx tamash-playwright doctor
|
|
|
108
104
|
|---|-------|---------------|
|
|
109
105
|
| 1 | AI connectivity | Confirms `HEALER_ENABLED`/`HEALER_PROVIDER` are set, and actually calls the provider to verify the key and model work. |
|
|
110
106
|
| 2 | `actionTimeout` | Reads `playwright.config.ts`; flags a missing or too-close-to-`timeout` value. |
|
|
111
|
-
| 3 |
|
|
112
|
-
| 4 |
|
|
113
|
-
| 5 |
|
|
114
|
-
| 6 | Inline locators | Flags locators written directly in test files rather than a Page Object class. |
|
|
107
|
+
| 3 | Vision capability | Checks by name whether your configured model is expected to support the screenshot fallback. |
|
|
108
|
+
| 4 | Missing `.describe()` | Scans `tests/` (or `--dir <path>`) for locators without a label, raw CSS/XPath first. |
|
|
109
|
+
| 5 | Inline locators | Flags locators written directly in test files rather than a Page Object class. |
|
|
115
110
|
|
|
116
111
|
If it finds issues, the fastest fix is to open the project in an AI coding assistant and ask it to address what's flagged — add `.describe()` calls, or extract locators into Page Objects. A standing rule in that assistant's instructions file (`CLAUDE.md`, `.cursor/rules`, etc.) keeps it doing both automatically going forward.
|
|
117
112
|
|
|
@@ -208,12 +203,6 @@ If the retry doesn't resolve either, healing falls through to the vision fallbac
|
|
|
208
203
|
|
|
209
204
|
Sometimes an element has nothing useful to match on by text — an icon-only button with no label, or several visually distinct elements that look identical in the accessibility tree. If your configured model supports image input (`gpt-4o`, `claude-haiku-4-5`, `gemini-3.6-flash`, …), `tamash-playwright` automatically falls back to a screenshot-based search after the normal text attempt fails — same provider, same key, no separate setup. Run `npx tamash-playwright doctor` to check whether your model is expected to support it.
|
|
210
205
|
|
|
211
|
-
## Action recovery (optional)
|
|
212
|
-
|
|
213
|
-
Occasionally a locator heals correctly — the AI found the right element — but the *action* on it still fails: covered by an overlay, needs scrolling into view first. Set `HEALER_ACTION_RECOVERY_ENABLED=true` to let the AI pick a tactic from a fixed, safe menu (scroll into view, bypass actionability checks, wait and retry, or dispatch the DOM event directly) before giving up.
|
|
214
|
-
|
|
215
|
-
Off by default — it's a second, more speculative layer beyond selector healing. The AI only ever picks from that fixed menu; it never decides how to interact with the page on its own.
|
|
216
|
-
|
|
217
206
|
## Not paying for the same heal twice
|
|
218
207
|
|
|
219
208
|
Once a locator heals successfully, `tamash-playwright` remembers the fix in `.tamash-playwright/heals.jsonl`. The next time that exact locator breaks the same way, it tries the previously-confirmed selector *first* — no ARIA snapshot, no AI call. Only if that no longer works does it fall through to a fresh snapshot-and-AI-call, exactly as before.
|
|
@@ -512,7 +501,6 @@ The same detail prints to the console as it happens:
|
|
|
512
501
|
|----------|---------|---------|
|
|
513
502
|
| `HEALER_ENABLED` | `true` | Master on/off switch. Any value other than `false`/`0` leaves healing on. |
|
|
514
503
|
| `HEALER_PROVIDER` | unset | `ollama` \| `openai` \| `anthropic` \| `gemini`. Unset or missing key/model still allows cache hits, just no fresh AI calls. |
|
|
515
|
-
| `HEALER_ACTION_RECOVERY_ENABLED` | `false` | Opt-in second-layer recovery for actionability failures on an already-correctly-healed locator. |
|
|
516
504
|
| `OLLAMA_MODEL` / `OLLAMA_API_KEY` | — | Ollama Cloud provider config. |
|
|
517
505
|
| `OPENAI_MODEL` / `OPENAI_API_KEY` | — | OpenAI provider config. |
|
|
518
506
|
| `ANTHROPIC_MODEL` / `ANTHROPIC_API_KEY` | — | Anthropic (Claude) provider config. |
|
|
@@ -522,7 +510,7 @@ The same detail prints to the console as it happens:
|
|
|
522
510
|
|
|
523
511
|
| Command | Flags | What it does |
|
|
524
512
|
|---------|-------|---------------|
|
|
525
|
-
| `npx tamash-playwright doctor` | `--dir <path>` | Pre-flight checks: AI connectivity, `actionTimeout`,
|
|
513
|
+
| `npx tamash-playwright doctor` | `--dir <path>` | Pre-flight checks: AI connectivity, `actionTimeout`, vision capability, missing `.describe()`, inline locators. |
|
|
526
514
|
| `npx tamash-playwright apply-heals` | `--dry-run` | Preview fixes without writing anything (including `verify-heals.cjs` — see below). |
|
|
527
515
|
| | `--logs-dir <path>` | Merge every `heals.jsonl` found under `<path>` (any nesting) instead of the local log — for sharded CI. |
|
|
528
516
|
|