Add SPA session validation and buglist, update migration docs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-03 21:28:08 +00:00
parent 9be3dfc14e
commit cff287e870
24169 changed files with 10223 additions and 7120 deletions

34
node_modules/playwright/lib/agents/copilot-setup-steps.yml generated vendored Executable file
View File

@@ -0,0 +1,34 @@
name: "Copilot Setup Steps"
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
# Customize this step as needed
- name: Build application
run: npx run build

462
node_modules/playwright/lib/agents/generateAgents.js generated vendored Normal file → Executable file
View File

@@ -28,18 +28,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var generateAgents_exports = {};
__export(generateAgents_exports, {
initClaudeCodeRepo: () => initClaudeCodeRepo,
initOpencodeRepo: () => initOpencodeRepo,
initVSCodeRepo: () => initVSCodeRepo
ClaudeGenerator: () => ClaudeGenerator,
CopilotGenerator: () => CopilotGenerator,
OpencodeGenerator: () => OpencodeGenerator,
VSCodeGenerator: () => VSCodeGenerator
});
module.exports = __toCommonJS(generateAgents_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_utils = require("playwright-core/lib/utils");
var import_seed = require("../mcp/test/seed");
class AgentParser {
static async loadAgents() {
const files = await import_fs.default.promises.readdir(__dirname);
return Promise.all(files.filter((file) => file.endsWith(".agent.md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
}
static async parseFile(filePath) {
const rawMarkdown = await import_fs.default.promises.readFile(filePath, "utf-8");
const { header, content } = this.extractYamlAndContent(rawMarkdown);
const source = await import_fs.default.promises.readFile(filePath, "utf-8");
const { header, content } = this.extractYamlAndContent(source);
const { instructions, examples } = this.extractInstructionsAndExamples(content);
return { header, instructions, examples };
}
@@ -84,180 +91,305 @@ class AgentParser {
return { instructions, examples };
}
}
const claudeToolMap = /* @__PURE__ */ new Map([
["ls", ["Glob"]],
["grep", ["Grep"]],
["read", ["Read"]],
["edit", ["Edit", "MultiEdit"]],
["write", ["Write"]]
]);
const commonMcpServers = {
playwrightTest: {
type: "local",
command: "npx",
args: ["playwright", "run-test-mcp-server"]
class ClaudeGenerator {
static async init(config, projectName, prompts) {
await initRepo(config, projectName, {
promptsFolder: prompts ? ".claude/prompts" : void 0
});
const agents = await AgentParser.loadAgents();
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
for (const agent of agents)
await writeFile(`.claude/agents/${agent.header.name}.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
await writeFile(".mcp.json", JSON.stringify({
mcpServers: {
"playwright-test": {
command: "npx",
args: ["playwright", "run-test-mcp-server"]
}
}
}, null, 2), "\u{1F527}", "mcp configuration");
initRepoDone();
}
};
function saveAsClaudeCode(agent) {
function asClaudeTool(tool) {
const [first, second] = tool.split("/");
if (!second)
return (claudeToolMap.get(first) || [first]).join(", ");
return `mcp__${first}__${second}`;
}
const lines = [];
lines.push(`---`);
lines.push(`name: playwright-test-${agent.header.name}`);
lines.push(`description: ${agent.header.description}. Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}`);
lines.push(`tools: ${agent.header.tools.map((tool) => asClaudeTool(tool)).join(", ")}`);
lines.push(`model: ${agent.header.model}`);
lines.push(`color: ${agent.header.color}`);
lines.push(`---`);
lines.push("");
lines.push(agent.instructions);
return lines.join("\n");
}
const opencodeToolMap = /* @__PURE__ */ new Map([
["ls", ["ls", "glob"]],
["grep", ["grep"]],
["read", ["read"]],
["edit", ["edit"]],
["write", ["write"]]
]);
function saveAsOpencodeJson(agents) {
function asOpencodeTool(tools, tool) {
const [first, second] = tool.split("/");
if (!second) {
for (const tool2 of opencodeToolMap.get(first) || [first])
tools[tool2] = true;
} else {
tools[`${first}*${second}`] = true;
static agentSpec(agent) {
const claudeToolMap = /* @__PURE__ */ new Map([
["search", ["Glob", "Grep", "Read", "LS"]],
["edit", ["Edit", "MultiEdit", "Write"]]
]);
function asClaudeTool(tool) {
const [first, second] = tool.split("/");
if (!second)
return (claudeToolMap.get(first) || [first]).join(", ");
return `mcp__${first}__${second}`;
}
}
const result = {};
result["$schema"] = "https://opencode.ai/config.json";
result["mcp"] = {};
result["tools"] = {
"playwright*": false
};
result["agent"] = {};
for (const agent of agents) {
const tools = {};
result["agent"]["playwright-test-" + agent.header.name] = {
description: agent.header.description,
mode: "subagent",
prompt: `{file:.opencode/prompts/playwright-test-${agent.header.name}.md}`,
tools
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
const lines = [];
const header = {
name: agent.header.name,
description: agent.header.description + examples,
tools: agent.header.tools.map((tool) => asClaudeTool(tool)).join(", "),
model: agent.header.model,
color: agent.header.color
};
for (const tool of agent.header.tools)
asOpencodeTool(tools, tool);
lines.push(`---`);
lines.push(import_utilsBundle.yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
lines.push("");
lines.push(agent.instructions);
return lines.join("\n");
}
const server = commonMcpServers.playwrightTest;
result["mcp"]["playwright-test"] = {
type: server.type,
command: [server.command, ...server.args],
enabled: true
};
return JSON.stringify(result, null, 2);
}
async function loadAgents() {
const files = await import_fs.default.promises.readdir(__dirname);
return Promise.all(files.filter((file) => file.endsWith(".md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
class OpencodeGenerator {
static async init(config, projectName, prompts) {
await initRepo(config, projectName, {
defaultAgentName: "Build",
promptsFolder: prompts ? ".opencode/prompts" : void 0
});
const agents = await AgentParser.loadAgents();
for (const agent of agents) {
const prompt = [agent.instructions];
prompt.push("");
prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
await writeFile(`.opencode/prompts/${agent.header.name}.md`, prompt.join("\n"), "\u{1F916}", "agent definition");
}
await writeFile("opencode.json", OpencodeGenerator.configuration(agents), "\u{1F527}", "opencode configuration");
initRepoDone();
}
static configuration(agents) {
const opencodeToolMap = /* @__PURE__ */ new Map([
["search", ["ls", "glob", "grep", "read"]],
["edit", ["edit", "write"]]
]);
const asOpencodeTool = (tools, tool) => {
const [first, second] = tool.split("/");
if (!second) {
for (const tool2 of opencodeToolMap.get(first) || [first])
tools[tool2] = true;
} else {
tools[`${first}*${second}`] = true;
}
};
const result = {};
result["$schema"] = "https://opencode.ai/config.json";
result["mcp"] = {};
result["tools"] = {
"playwright*": false
};
result["agent"] = {};
for (const agent of agents) {
const tools = {};
result["agent"][agent.header.name] = {
description: agent.header.description,
mode: "subagent",
prompt: `{file:.opencode/prompts/${agent.header.name}.md}`,
tools
};
for (const tool of agent.header.tools)
asOpencodeTool(tools, tool);
}
result["mcp"]["playwright-test"] = {
type: "local",
command: ["npx", "playwright", "run-test-mcp-server"],
enabled: true
};
return JSON.stringify(result, null, 2);
}
}
async function writeFile(filePath, content) {
console.log(`Writing file: ${filePath}`);
class CopilotGenerator {
static async init(config, projectName, prompts) {
await initRepo(config, projectName, {
defaultAgentName: "agent",
promptsFolder: prompts ? ".github/prompts" : void 0,
promptSuffix: "prompt"
});
const agents = await AgentParser.loadAgents();
await import_fs.default.promises.mkdir(".github/agents", { recursive: true });
for (const agent of agents)
await writeFile(`.github/agents/${agent.header.name}.agent.md`, CopilotGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
await deleteFile(`.github/chatmodes/ \u{1F3AD} planner.chatmode.md`, "legacy planner chatmode");
await deleteFile(`.github/chatmodes/\u{1F3AD} generator.chatmode.md`, "legacy generator chatmode");
await deleteFile(`.github/chatmodes/\u{1F3AD} healer.chatmode.md`, "legacy healer chatmode");
await deleteFile(`.github/agents/ \u{1F3AD} planner.agent.md`, "legacy planner agent");
await deleteFile(`.github/agents/\u{1F3AD} generator.agent.md`, "legacy generator agent");
await deleteFile(`.github/agents/\u{1F3AD} healer.agent.md`, "legacy healer agent");
await VSCodeGenerator.appendToMCPJson();
const mcpConfig = { mcpServers: CopilotGenerator.mcpServers };
if (!import_fs.default.existsSync(".github/copilot-setup-steps.yml")) {
const yaml2 = import_fs.default.readFileSync(import_path.default.join(__dirname, "copilot-setup-steps.yml"), "utf-8");
await writeFile(".github/workflows/copilot-setup-steps.yml", yaml2, "\u{1F527}", "GitHub Copilot setup steps");
}
console.log("");
console.log("");
console.log(" \u{1F527} TODO: GitHub > Settings > Copilot > Coding agent > MCP configuration");
console.log("------------------------------------------------------------------");
console.log(JSON.stringify(mcpConfig, null, 2));
console.log("------------------------------------------------------------------");
initRepoDone();
}
static agentSpec(agent) {
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
const lines = [];
const header = {
"name": agent.header.name,
"description": agent.header.description + examples,
"tools": agent.header.tools,
"model": "Claude Sonnet 4",
"mcp-servers": CopilotGenerator.mcpServers
};
lines.push(`---`);
lines.push(import_utilsBundle.yaml.stringify(header) + `---`);
lines.push("");
lines.push(agent.instructions);
lines.push("");
return lines.join("\n");
}
static {
this.mcpServers = {
"playwright-test": {
"type": "stdio",
"command": "npx",
"args": [
"playwright",
"run-test-mcp-server"
],
"tools": ["*"]
}
};
}
}
class VSCodeGenerator {
static async init(config, projectName) {
await initRepo(config, projectName, {
promptsFolder: void 0
});
const agents = await AgentParser.loadAgents();
const nameMap = /* @__PURE__ */ new Map([
["playwright-test-planner", " \u{1F3AD} planner"],
["playwright-test-generator", "\u{1F3AD} generator"],
["playwright-test-healer", "\u{1F3AD} healer"]
]);
await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
for (const agent of agents)
await writeFile(`.github/chatmodes/${nameMap.get(agent.header.name)}.chatmode.md`, VSCodeGenerator.agentSpec(agent), "\u{1F916}", "chatmode definition");
await VSCodeGenerator.appendToMCPJson();
initRepoDone();
}
static async appendToMCPJson() {
await import_fs.default.promises.mkdir(".vscode", { recursive: true });
const mcpJsonPath = ".vscode/mcp.json";
let mcpJson = {
servers: {},
inputs: []
};
try {
mcpJson = JSON.parse(import_fs.default.readFileSync(mcpJsonPath, "utf8"));
} catch {
}
if (!mcpJson.servers)
mcpJson.servers = {};
mcpJson.servers["playwright-test"] = {
type: "stdio",
command: "npx",
args: ["playwright", "run-test-mcp-server"]
};
await writeFile(mcpJsonPath, JSON.stringify(mcpJson, null, 2), "\u{1F527}", "mcp configuration");
}
static agentSpec(agent) {
const vscodeToolMap = /* @__PURE__ */ new Map([
["search", ["search/listDirectory", "search/fileSearch", "search/textSearch"]],
["read", ["search/readFile"]],
["edit", ["edit/editFiles"]],
["write", ["edit/createFile", "edit/createDirectory"]]
]);
const vscodeToolsOrder = ["edit/createFile", "edit/createDirectory", "edit/editFiles", "search/fileSearch", "search/textSearch", "search/listDirectory", "search/readFile"];
const vscodeMcpName = "playwright-test";
function asVscodeTool(tool) {
const [first, second] = tool.split("/");
if (second)
return `${vscodeMcpName}/${second}`;
return vscodeToolMap.get(first) || first;
}
const tools = agent.header.tools.map(asVscodeTool).flat().sort((a, b) => {
const indexA = vscodeToolsOrder.indexOf(a);
const indexB = vscodeToolsOrder.indexOf(b);
if (indexA === -1 && indexB === -1)
return a.localeCompare(b);
if (indexA === -1)
return 1;
if (indexB === -1)
return -1;
return indexA - indexB;
}).map((tool) => `'${tool}'`).join(", ");
const lines = [];
lines.push(`---`);
lines.push(`description: ${agent.header.description}.`);
lines.push(`tools: [${tools}]`);
lines.push(`---`);
lines.push("");
lines.push(agent.instructions);
for (const example of agent.examples)
lines.push(`<example>${example}</example>`);
lines.push("");
return lines.join("\n");
}
}
async function writeFile(filePath, content, icon, description) {
console.log(` ${icon} ${import_path.default.relative(process.cwd(), filePath)} ${import_utilsBundle.colors.dim("- " + description)}`);
await (0, import_utils.mkdirIfNeeded)(filePath);
await import_fs.default.promises.writeFile(filePath, content, "utf-8");
}
async function initClaudeCodeRepo() {
const agents = await loadAgents();
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
for (const agent of agents)
await writeFile(`.claude/agents/playwright-test-${agent.header.name}.md`, saveAsClaudeCode(agent));
await writeFile(".mcp.json", JSON.stringify({
mcpServers: {
"playwright-test": {
command: commonMcpServers.playwrightTest.command,
args: commonMcpServers.playwrightTest.args
}
}
}, null, 2));
}
const vscodeToolMap = /* @__PURE__ */ new Map([
["ls", ["search/listDirectory", "search/fileSearch"]],
["grep", ["search/textSearch"]],
["read", ["search/readFile"]],
["edit", ["edit/editFiles"]],
["write", ["edit/createFile", "edit/createDirectory"]]
]);
const vscodeToolsOrder = ["edit/createFile", "edit/createDirectory", "edit/editFiles", "search/fileSearch", "search/textSearch", "search/listDirectory", "search/readFile"];
const vscodeMcpName = "playwright-test";
function saveAsVSCodeChatmode(agent) {
function asVscodeTool(tool) {
const [first, second] = tool.split("/");
if (second)
return `${vscodeMcpName}/${second}`;
return vscodeToolMap.get(first) || first;
}
const tools = agent.header.tools.map(asVscodeTool).flat().sort((a, b) => {
const indexA = vscodeToolsOrder.indexOf(a);
const indexB = vscodeToolsOrder.indexOf(b);
if (indexA === -1 && indexB === -1)
return a.localeCompare(b);
if (indexA === -1)
return 1;
if (indexB === -1)
return -1;
return indexA - indexB;
}).map((tool) => `'${tool}'`).join(", ");
const lines = [];
lines.push(`---`);
lines.push(`description: ${agent.header.description}.`);
lines.push(`tools: [${tools}]`);
lines.push(`---`);
lines.push("");
lines.push(agent.instructions);
for (const example of agent.examples)
lines.push(`<example>${example}</example>`);
return lines.join("\n");
}
async function initVSCodeRepo() {
const agents = await loadAgents();
await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
for (const agent of agents)
await writeFile(`.github/chatmodes/${agent.header.name === "planner" ? " " : ""}\u{1F3AD} ${agent.header.name}.chatmode.md`, saveAsVSCodeChatmode(agent));
await import_fs.default.promises.mkdir(".vscode", { recursive: true });
const mcpJsonPath = ".vscode/mcp.json";
let mcpJson = {
servers: {},
inputs: []
};
async function deleteFile(filePath, description) {
try {
mcpJson = JSON.parse(import_fs.default.readFileSync(mcpJsonPath, "utf8"));
if (!import_fs.default.existsSync(filePath))
return;
} catch {
return;
}
if (!mcpJson.servers)
mcpJson.servers = {};
mcpJson.servers["playwright-test"] = {
type: "stdio",
command: commonMcpServers.playwrightTest.command,
args: commonMcpServers.playwrightTest.args
};
await writeFile(mcpJsonPath, JSON.stringify(mcpJson, null, 2));
console.log(` \u2702\uFE0F ${import_path.default.relative(process.cwd(), filePath)} ${import_utilsBundle.colors.dim("- " + description)}`);
await import_fs.default.promises.unlink(filePath);
}
async function initOpencodeRepo() {
const agents = await loadAgents();
await import_fs.default.promises.mkdir(".opencode/prompts", { recursive: true });
for (const agent of agents) {
const prompt = [agent.instructions];
prompt.push("");
prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
await writeFile(`.opencode/prompts/playwright-test-${agent.header.name}.md`, prompt.join("\n"));
async function initRepo(config, projectName, options) {
const project = (0, import_seed.seedProject)(config, projectName);
console.log(` \u{1F3AD} Using project "${project.project.name}" as a primary project`);
if (!import_fs.default.existsSync("specs")) {
await import_fs.default.promises.mkdir("specs");
await writeFile(import_path.default.join("specs", "README.md"), `# Specs
This is a directory for test plans.
`, "\u{1F4DD}", "directory for test plans");
}
await writeFile("opencode.json", saveAsOpencodeJson(agents));
let seedFile = await (0, import_seed.findSeedFile)(project);
if (!seedFile) {
seedFile = (0, import_seed.defaultSeedFile)(project);
await writeFile(seedFile, import_seed.seedFileContent, "\u{1F331}", "default environment seed file");
}
if (options.promptsFolder) {
await import_fs.default.promises.mkdir(options.promptsFolder, { recursive: true });
for (const promptFile of await import_fs.default.promises.readdir(__dirname)) {
if (!promptFile.endsWith(".prompt.md"))
continue;
const shortName = promptFile.replace(".prompt.md", "");
const fileName = options.promptSuffix ? `${shortName}.${options.promptSuffix}.md` : `${shortName}.md`;
const content = await loadPrompt(promptFile, {
defaultAgentName: "default",
...options,
seedFile: import_path.default.relative(process.cwd(), seedFile)
});
await writeFile(import_path.default.join(options.promptsFolder, fileName), content, "\u{1F4DD}", "prompt template");
}
}
}
function initRepoDone() {
console.log(" \u2705 Done.");
}
async function loadPrompt(file, params) {
const content = await import_fs.default.promises.readFile(import_path.default.join(__dirname, file), "utf-8");
return Object.entries(params).reduce((acc, [key, value]) => {
return acc.replace(new RegExp(`\\\${${key}}`, "g"), value);
}, content);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
initClaudeCodeRepo,
initOpencodeRepo,
initVSCodeRepo
ClaudeGenerator,
CopilotGenerator,
OpencodeGenerator,
VSCodeGenerator
});

View File

@@ -0,0 +1,31 @@
---
agent: ${defaultAgentName}
description: Produce test coverage
---
Parameters:
- Task: the task to perform
- Seed file (optional): the seed file to use, defaults to `${seedFile}`
- Test plan file (optional): the test plan file to write, under `specs/` folder.
1. Call #playwright-test-planner subagent with prompt:
<plan>
<task-text><!-- the task --></task-text>
<seed-file><!-- path to seed file --></seed-file>
<plan-file><!-- path to test plan file to generate --></plan-file>
</plan>
2. For each test case from the test plan file (1.1, 1.2, ...), one after another, not in parallel, call #playwright-test-generator subagent with prompt:
<generate>
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
<test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name>
<test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file>
<seed-file><!-- Seed file path from test plan --></seed-file>
<body><!-- Test case content including steps and expectations --></body>
</generate>
3. Call #playwright-test-healer subagent with prompt:
<heal>Run all tests and fix the failing ones one after another.</heal>

View File

@@ -0,0 +1,8 @@
---
agent: playwright-test-generator
description: Generate test plan
---
Generate tests for the test plan's bullet 1.1 Add item to card.
Test plan: `specs/coverage.plan.md`

View File

@@ -1,12 +1,10 @@
---
name: generator
name: playwright-test-generator
description: Use this agent when you need to create automated browser tests using Playwright
model: sonnet
color: blue
tools:
- ls
- grep
- read
- search
- playwright-test/browser_click
- playwright-test/browser_drag
- playwright-test/browser_evaluate
@@ -81,22 +79,10 @@ application behavior.
</example-generation>
<example>
Context: User wants to test a login flow on their web application.
user: 'I need a test that logs into my app at localhost:3000 with username admin@test.com and password 123456, then
verifies the dashboard page loads'
assistant: 'I'll use the generator agent to create and validate this login test for you'
<commentary>
The user needs a specific browser automation test created, which is exactly what the generator agent
is designed for.
</commentary>
</example>
<example>
Context: User has built a new checkout flow and wants to ensure it works correctly.
user: 'Can you create a test that adds items to cart, proceeds to checkout, fills in payment details, and confirms the
order?'
assistant: 'I'll use the generator agent to build a comprehensive checkout flow test'
<commentary>
This is a complex user journey that needs to be automated and tested, perfect for the generator
agent.
</commentary>
Context: User wants to generate a test for the test plan item.
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
<test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name>
<test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file>
<seed-file><!-- Seed file path from test plan --></seed-file>
<body><!-- Test case content including steps and expectations --></body>
</example>

View File

@@ -0,0 +1,6 @@
---
agent: playwright-test-healer
description: Fix tests
---
Run all my tests and fix the failing ones.

View File

@@ -1,13 +1,10 @@
---
name: healer
name: playwright-test-healer
description: Use this agent when you need to debug and fix failing Playwright tests
color: red
model: sonnet
color: red
tools:
- ls
- grep
- read
- write
- search
- edit
- playwright-test/browser_console_messages
- playwright-test/browser_evaluate
@@ -24,8 +21,8 @@ resolving Playwright test failures. Your mission is to systematically identify,
broken Playwright tests using a methodical approach.
Your workflow:
1. **Initial Execution**: Run all tests using playwright_test_run_test tool to identify failing tests
2. **Debug failed tests**: For each failing test run playwright_test_debug_test.
1. **Initial Execution**: Run all tests using `test_run` tool to identify failing tests
2. **Debug failed tests**: For each failing test run `test_debug`.
3. **Error Investigation**: When the test pauses on errors, use available Playwright MCP tools to:
- Examine the error details
- Capture page snapshot to understand the context
@@ -56,23 +53,3 @@ Key principles:
of the expected behavior.
- Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test.
- Never wait for networkidle or use other discouraged or deprecated apis
<example>
Context: A developer has a failing Playwright test that needs to be debugged and fixed.
user: 'The login test is failing, can you fix it?'
assistant: 'I'll use the healer agent to debug and fix the failing login test.'
<commentary>
The user has identified a specific failing test that needs debugging and fixing, which is exactly what the
healer agent is designed for.
</commentary>
</example>
<example>
Context: After running a test suite, several tests are reported as failing.
user: 'Test user-registration.spec.ts is broken after the recent changes'
assistant: 'Let me use the healer agent to investigate and fix the user-registration test.'
<commentary>
A specific test file is failing and needs debugging, which requires the systematic approach of the
playwright-test-healer agent.
</commentary>
</example>

View File

@@ -0,0 +1,9 @@
---
agent: playwright-test-planner
description: Create test plan
---
Create test plan for "add to cart" functionality of my app.
- Seed file: `${seedFile}`
- Test plan: `specs/coverage.plan.md`

View File

@@ -1,13 +1,10 @@
---
name: planner
name: playwright-test-planner
description: Use this agent when you need to create comprehensive test plan for a web application or website
model: sonnet
color: green
tools:
- ls
- grep
- read
- write
- search
- playwright-test/browser_click
- playwright-test/browser_close
- playwright-test/browser_console_messages
@@ -26,6 +23,7 @@ tools:
- playwright-test/browser_type
- playwright-test/browser_wait_for
- playwright-test/planner_setup_page
- playwright-test/planner_save_plan
---
You are an expert web test planner with extensive experience in quality assurance, user experience testing, and test
@@ -38,7 +36,7 @@ You will:
- Invoke the `planner_setup_page` tool once to set up page before using any other tools
- Explore the browser snapshot
- Do not take screenshots unless absolutely necessary
- Use browser_* tools to navigate and discover interface
- Use `browser_*` tools to navigate and discover interface
- Thoroughly explore the interface, identifying all interactive elements, forms, navigation paths, and functionality
2. **Analyze User Flows**
@@ -63,48 +61,7 @@ You will:
5. **Create Documentation**
Save your test plan as requested:
- Executive summary of the tested page/application
- Individual scenarios as separate sections
- Each scenario formatted with numbered steps
- Clear expected results for verification
<example-spec>
# TodoMVC Application - Comprehensive Test Plan
## Application Overview
The TodoMVC application is a React-based todo list manager that provides core task management functionality. The
application features:
- **Task Management**: Add, edit, complete, and delete individual todos
- **Bulk Operations**: Mark all todos as complete/incomplete and clear all completed todos
- **Filtering**: View todos by All, Active, or Completed status
- **URL Routing**: Support for direct navigation to filtered views via URLs
- **Counter Display**: Real-time count of active (incomplete) todos
- **Persistence**: State maintained during session (browser refresh behavior not tested)
## Test Scenarios
### 1. Adding New Todos
**Seed:** `tests/seed.spec.ts`
#### 1.1 Add Valid Todo
**Steps:**
1. Click in the "What needs to be done?" input field
2. Type "Buy groceries"
3. Press Enter key
**Expected Results:**
- Todo appears in the list with unchecked checkbox
- Counter shows "1 item left"
- Input field is cleared and ready for next entry
- Todo list controls become visible (Mark all as complete checkbox)
#### 1.2
...
</example-spec>
Submit your test plan using `planner_save_plan` tool.
**Quality Standards**:
- Write steps that are specific enough for any tester to follow
@@ -113,23 +70,3 @@ application features:
**Output Format**: Always save the complete test plan as a markdown file with clear headings, numbered steps, and
professional formatting suitable for sharing with development and QA teams.
<example>
Context: User wants to test a new e-commerce checkout flow.
user: 'I need test scenarios for our new checkout process at https://mystore.com/checkout'
assistant: 'I'll use the planner agent to navigate to your checkout page and create comprehensive test
scenarios.'
<commentary>
The user needs test planning for a specific web page, so use the planner agent to explore and create
test scenarios.
</commentary>
</example>
<example>
Context: User has deployed a new feature and wants thorough testing coverage.
user: 'Can you help me test our new user dashboard at https://app.example.com/dashboard?'
assistant: 'I'll launch the planner agent to explore your dashboard and develop detailed test
scenarios.'
<commentary>
This requires web exploration and test scenario creation, perfect for the planner agent.
</commentary>
</example>