playwright-test-agent 0.1.7 → 0.1.9
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.
package/package.json
CHANGED
|
@@ -7,19 +7,23 @@ description: Use first when a user asks to investigate or test a website, browse
|
|
|
7
7
|
|
|
8
8
|
Use Planner -> Generator -> Healer for durable tests. `AGENTS.md` or `CLAUDE.md` defines the platform-specific role routing. Generated role definitions use `playwright-cli` as their primary browser interface, so MCP tool injection is not required.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Fast start
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
When the request contains a test objective and deployed URL, enter Planner immediately and run:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```bash
|
|
15
|
+
playwright-cli open <deployed-url>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Before opening the page, do not inspect the local project and do not locate or read a seed file, Playwright config, test directory, agent definition, fixtures, source tree, or existing tests. Do not ask optional questions about roles, browsers, edge cases, expected results, or test data when Planner can discover or defer them.
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
Ask before Planner only when the objective or deployed URL itself is missing. During exploration, ask only when a real blocker is reached: required credentials, an invalid URL, ambiguous expected behavior that changes assertions, or authorization for a consequential action. Resume Planner after the answer. Do not guess credentials, probe nearby environments, bypass access controls, or wander through unrelated pages.
|
|
17
21
|
|
|
18
22
|
Keep credentials and tokens in environment variables or ignored secret files. Never copy them into plans, tests, screenshots, evidence, or chat.
|
|
19
23
|
|
|
20
24
|
## Planner
|
|
21
25
|
|
|
22
|
-
Planner investigates the live application with `playwright-cli` and saves a human-readable Markdown plan under `specs/`.
|
|
26
|
+
Planner investigates the live application with `playwright-cli` and saves a human-readable Markdown plan under `specs/`. Start with the supplied URL, then use compact `snapshot` or `find` output and refs for interaction. A seed is not a Planner prerequisite and must not be located before exploration.
|
|
23
27
|
|
|
24
28
|
The plan contains prerequisites, test data, independent scenarios, steps, observable expected results, exclusions, and intended output files. Reconnaissance must not mutate durable/shared data or perform consequential actions unless authorized.
|
|
25
29
|
|
|
@@ -17,20 +17,20 @@ Use the installed \`playwright-cli\` command as the primary browser interface. R
|
|
|
17
17
|
|
|
18
18
|
CLI replaces any conflicting requirement above to call Playwright Test MCP setup, browser, save, generation, or debug tools. Do not stop merely because \`planner_*\`, \`generator_*\`, \`test_*\`, or \`browser_*\` MCP tools are absent, and do not spawn a nested or same-role agent.
|
|
19
19
|
|
|
20
|
-
${role === 'planner' ? '
|
|
20
|
+
${role === 'planner' ? 'FAST START: when the request contains a test objective and deployed URL, immediately run `playwright-cli open <url>` and investigate. Do not first locate or read a seed file, Playwright config, test directory, agent definition, source tree, fixtures, or existing tests. Do not ask optional planning questions before opening the page. Ask only when exploration reaches a real blocker such as required credentials, missing/incorrect URL, ambiguous expected behavior that changes assertions, or authorization for a consequential action. Save the completed Markdown test plan directly under `specs/` using filesystem tools.' : ''}${role === 'generator' ? 'Use CLI to validate the confirmed plan against the live UI, then write executable Playwright test files directly with filesystem tools.' : ''}${role === 'healer' ? 'Run failures with `npx playwright test`, use CLI to inspect and reproduce the current UI, patch the tests directly, and rerun within the healer guardrails.' : ''}
|
|
21
21
|
|
|
22
22
|
${ROLE_BLOCK_END}`;
|
|
23
23
|
const CODEX_INSTRUCTIONS = `${BLOCK_START}
|
|
24
24
|
## Playwright Test Agent
|
|
25
25
|
|
|
26
|
-
For website, browser workflow, HTTP API, or application-feature testing, load \`.agents/skills/playwright-test-agent/SKILL.md\` first. Codex must not start Playwright subagents; the main agent performs Planner -> Generator -> Healer in this session. Use \`playwright-cli\` as the primary browser interface and
|
|
26
|
+
For website, browser workflow, HTTP API, or application-feature testing, load \`.agents/skills/playwright-test-agent/SKILL.md\` first. Codex must not start Playwright subagents; the main agent performs Planner -> Generator -> Healer in this session. Use \`playwright-cli\` as the primary browser interface. When the request contains a test objective and deployed URL, begin Planner immediately; do not first inspect the project or locate a seed, config, test directory, agent definition, fixtures, or existing tests. Ask only at a real access, expected-behavior, or safety blocker. Do not guess or create nested agents.
|
|
27
27
|
|
|
28
28
|
${BLOCK_END}`;
|
|
29
29
|
|
|
30
30
|
const CLAUDE_INSTRUCTIONS = `${BLOCK_START}
|
|
31
31
|
## Playwright Test Agent
|
|
32
32
|
|
|
33
|
-
For website, browser workflow, HTTP API, or application-feature testing, load \`.claude/skills/playwright-test-agent/SKILL.md\` first. Claude Code starts the official \`playwright-test-planner\`, \`playwright-test-generator\`, and \`playwright-test-healer\` directly. These roles use \`playwright-cli\` as their primary browser interface and must not create nested agents. Ask
|
|
33
|
+
For website, browser workflow, HTTP API, or application-feature testing, load \`.claude/skills/playwright-test-agent/SKILL.md\` first. Claude Code starts the official \`playwright-test-planner\`, \`playwright-test-generator\`, and \`playwright-test-healer\` directly. When the request contains a test objective and deployed URL, start Planner immediately; do not first inspect the project or locate a seed, config, test directory, agent definition, fixtures, or existing tests. These roles use \`playwright-cli\` as their primary browser interface and must not create nested agents. Ask only at a real access, expected-behavior, or safety blocker; do not guess.
|
|
34
34
|
|
|
35
35
|
${BLOCK_END}`;
|
|
36
36
|
|
|
@@ -126,13 +126,31 @@ function patchCodexRole(source, role) {
|
|
|
126
126
|
|
|
127
127
|
function patchClaudeRole(source, role) {
|
|
128
128
|
let updated = source;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
const frontmatter = updated.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
|
|
130
|
+
if (!frontmatter) throw new Error('YAML frontmatter was not found in a Claude role definition');
|
|
131
|
+
|
|
132
|
+
let header = frontmatter[1];
|
|
133
|
+
const inlineTools = header.match(/^tools:[ \t]*(\S.*?)[ \t]*$/m);
|
|
134
|
+
const blockTools = header.match(/^tools:[ \t]*$/m);
|
|
135
|
+
if (inlineTools) {
|
|
136
|
+
const tools = inlineTools[1].split(',').map((tool) => tool.trim());
|
|
137
|
+
if (!tools.includes('Bash')) tools.push('Bash');
|
|
138
|
+
header = header.replace(inlineTools[0], `tools: ${tools.join(', ')}`);
|
|
139
|
+
} else if (blockTools) {
|
|
140
|
+
const blockStart = blockTools.index + blockTools[0].length;
|
|
141
|
+
const remainder = header.slice(blockStart);
|
|
142
|
+
const nextKey = remainder.search(/\r?\n(?=[A-Za-z0-9_-]+:\s*)/);
|
|
143
|
+
const blockEnd = nextKey === -1 ? header.length : blockStart + nextKey;
|
|
144
|
+
const toolsBlock = header.slice(blockStart, blockEnd);
|
|
145
|
+
if (!/^\s*-\s+Bash\s*$/m.test(toolsBlock)) {
|
|
146
|
+
header = header.slice(0, blockStart) + '\n - Bash' +
|
|
147
|
+
header.slice(blockStart);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
header = `${header.trimEnd()}\ntools: Bash`;
|
|
135
151
|
}
|
|
152
|
+
updated = updated.slice(0, frontmatter.index) + `---\n${header}\n---` +
|
|
153
|
+
updated.slice(frontmatter.index + frontmatter[0].length);
|
|
136
154
|
return withRoleBlock(updated, role);
|
|
137
155
|
}
|
|
138
156
|
|