Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: use new chatmodes location (#37973)

Pavel Feldmanb49143444832
diff --git a/examples/todomvc/.claude/agents/playwright-test-generator.agent.md b/examples/todomvc/.claude/agents/pwt-generator.md
similarity index 73%
rename from examples/todomvc/.claude/agents/playwright-test-generator.agent.md
rename to examples/todomvc/.claude/agents/pwt-generator.md
index 276b2d737f..0425618de1 100644
--- a/examples/todomvc/.claude/agents/playwright-test-generator.agent.md
+++ b/examples/todomvc/.claude/agents/pwt-generator.md
@@ -1,7 +1,7 @@
---
-name: playwright-test-generator
-description: Use this agent when you need to create automated browser tests using Playwright. Examples: <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 [email protected] 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></example>
-tools: Read, Glob, Grep, mcp__playwright-test__browser_click, mcp__playwright-test__browser_drag, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_file_upload, mcp__playwright-test__browser_handle_dialog, mcp__playwright-test__browser_hover, mcp__playwright-test__browser_navigate, mcp__playwright-test__browser_press_key, mcp__playwright-test__browser_select_option, mcp__playwright-test__browser_snapshot, mcp__playwright-test__browser_type, mcp__playwright-test__browser_verify_element_visible, mcp__playwright-test__browser_verify_list_visible, mcp__playwright-test__browser_verify_text_visible, mcp__playwright-test__browser_verify_value, mcp__playwright-test__browser_wait_for, mcp__playwright-test__generator_read_log, mcp__playwright-test__generator_setup_page, mcp__playwright-test__generator_write_test
+name: pwt-generator
+description: Use this agent when you need to create automated browser tests using Playwright. Examples: <example>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>
+tools: Glob, Grep, Read, mcp__playwright-test__browser_click, mcp__playwright-test__browser_drag, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_file_upload, mcp__playwright-test__browser_handle_dialog, mcp__playwright-test__browser_hover, mcp__playwright-test__browser_navigate, mcp__playwright-test__browser_press_key, mcp__playwright-test__browser_select_option, mcp__playwright-test__browser_snapshot, mcp__playwright-test__browser_type, mcp__playwright-test__browser_verify_element_visible, mcp__playwright-test__browser_verify_list_visible, mcp__playwright-test__browser_verify_text_visible, mcp__playwright-test__browser_verify_value, mcp__playwright-test__browser_wait_for, mcp__playwright-test__generator_read_log, mcp__playwright-test__generator_setup_page, mcp__playwright-test__generator_write_test
model: sonnet
color: blue
---
diff --git a/examples/todomvc/.claude/agents/playwright-test-healer.agent.md b/examples/todomvc/.claude/agents/pwt-healer.md
similarity index 74%
rename from examples/todomvc/.claude/agents/playwright-test-healer.agent.md
rename to examples/todomvc/.claude/agents/pwt-healer.md
index 18cd979974..347ba0bbd4 100644
--- a/examples/todomvc/.claude/agents/playwright-test-healer.agent.md
+++ b/examples/todomvc/.claude/agents/pwt-healer.md
@@ -1,7 +1,7 @@
---
-name: playwright-test-healer
-description: Use this agent when you need to debug and fix failing Playwright tests. Examples: <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>
-tools: Read, Glob, Grep, Write, Edit, MultiEdit, mcp__playwright-test__browser_console_messages, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_generate_locator, mcp__playwright-test__browser_network_requests, mcp__playwright-test__browser_snapshot, mcp__playwright-test__test_debug, mcp__playwright-test__test_list, mcp__playwright-test__test_run
+name: pwt-healer
+description: Use this agent when you need to debug and fix failing Playwright tests.
+tools: Glob, Grep, Read, Edit, MultiEdit, Write, mcp__playwright-test__browser_console_messages, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_generate_locator, mcp__playwright-test__browser_network_requests, mcp__playwright-test__browser_snapshot, mcp__playwright-test__test_debug, mcp__playwright-test__test_list, mcp__playwright-test__test_run
model: sonnet
color: red
---
diff --git a/examples/todomvc/.claude/agents/playwright-test-planner.agent.md b/examples/todomvc/.claude/agents/pwt-planner.md
similarity index 66%
rename from examples/todomvc/.claude/agents/playwright-test-planner.agent.md
rename to examples/todomvc/.claude/agents/pwt-planner.md
index 51ca3f36ff..a39464977a 100644
--- a/examples/todomvc/.claude/agents/playwright-test-planner.agent.md
+++ b/examples/todomvc/.claude/agents/pwt-planner.md
@@ -1,7 +1,7 @@
---
-name: playwright-test-planner
-description: Use this agent when you need to create comprehensive test plan for a web application or website. Examples: <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>
-tools: Read, Glob, Grep, Write, mcp__playwright-test__browser_click, mcp__playwright-test__browser_close, mcp__playwright-test__browser_console_messages, mcp__playwright-test__browser_drag, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_file_upload, mcp__playwright-test__browser_handle_dialog, mcp__playwright-test__browser_hover, mcp__playwright-test__browser_navigate, mcp__playwright-test__browser_navigate_back, mcp__playwright-test__browser_network_requests, mcp__playwright-test__browser_press_key, mcp__playwright-test__browser_select_option, mcp__playwright-test__browser_snapshot, mcp__playwright-test__browser_take_screenshot, mcp__playwright-test__browser_type, mcp__playwright-test__browser_wait_for, mcp__playwright-test__planner_setup_page
+name: pwt-planner
+description: Use this agent when you need to create comprehensive test plan for a web application or website.
+tools: Glob, Grep, Read, Edit, MultiEdit, Write, mcp__playwright-test__browser_click, mcp__playwright-test__browser_close, mcp__playwright-test__browser_console_messages, mcp__playwright-test__browser_drag, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_file_upload, mcp__playwright-test__browser_handle_dialog, mcp__playwright-test__browser_hover, mcp__playwright-test__browser_navigate, mcp__playwright-test__browser_navigate_back, mcp__playwright-test__browser_network_requests, mcp__playwright-test__browser_press_key, mcp__playwright-test__browser_select_option, mcp__playwright-test__browser_snapshot, mcp__playwright-test__browser_take_screenshot, mcp__playwright-test__browser_type, mcp__playwright-test__browser_wait_for, mcp__playwright-test__planner_setup_page
model: sonnet
color: green
---
diff --git a/examples/todomvc/.github/prompts/test-coverage.prompt.md b/examples/todomvc/.claude/prompts/pwt-coverage.md
similarity index 85%
rename from examples/todomvc/.github/prompts/test-coverage.prompt.md
rename to examples/todomvc/.claude/prompts/pwt-coverage.md
index 4cc7675436..04e4f811fb 100644
--- a/examples/todomvc/.github/prompts/test-coverage.prompt.md
+++ b/examples/todomvc/.claude/prompts/pwt-coverage.md
@@ -1,5 +1,5 @@
---
-mode: agent
+agent: default
description: Produce test coverage
---
@@ -8,7 +8,7 @@ Parameters:
- Seed file (optional): the seed file to use, defaults to `tests/seed.spec.ts`
- Test plan file (optional): the test plan file to write, under `specs/` folder.
-1. Call #🎭 planner subagent with prompt:
+1. Call #pwt-planner subagent with prompt:
<plan>
<task-text><!-- the task --></task-text>
@@ -16,7 +16,7 @@ Parameters:
<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 #🎭 generator subagent with prompt:
+2. For each test case from the test plan file (1.1, 1.2, ...), one after another, not in parallel, call #pwt-generator subagent with prompt:
<generate>
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
@@ -26,6 +26,6 @@ Parameters:
<body><!-- Test case content including steps and expectations --></body>
</generate>
-3. Call #🎭 healer subagent with prompt:
+3. Call #pwt-healer subagent with prompt:
<heal>Run all tests and fix the failing ones one after another.</heal>
diff --git a/examples/todomvc/.github/prompts/test-generate.prompt.md b/examples/todomvc/.claude/prompts/pwt-generate.md
similarity index 87%
rename from examples/todomvc/.github/prompts/test-generate.prompt.md
rename to examples/todomvc/.claude/prompts/pwt-generate.md
index 1de2430f2d..b92662678c 100644
--- a/examples/todomvc/.github/prompts/test-generate.prompt.md
+++ b/examples/todomvc/.claude/prompts/pwt-generate.md
@@ -1,5 +1,5 @@
---
-mode: 🎭 generator
+agent: pwt-generator
description: Generate test plan
---
diff --git a/examples/todomvc/.github/prompts/test-heal.prompt.md b/examples/todomvc/.claude/prompts/pwt-heal.md
similarity index 80%
rename from examples/todomvc/.github/prompts/test-heal.prompt.md
rename to examples/todomvc/.claude/prompts/pwt-heal.md
index 6f4f720e65..2fb1bc63ce 100644
--- a/examples/todomvc/.github/prompts/test-heal.prompt.md
+++ b/examples/todomvc/.claude/prompts/pwt-heal.md
@@ -1,5 +1,5 @@
---
-mode: 🎭 healer
+agent: pwt-healer
description: Fix tests
---
diff --git a/examples/todomvc/.github/prompts/test-plan.prompt.md b/examples/todomvc/.claude/prompts/pwt-plan.md
similarity index 90%
rename from examples/todomvc/.github/prompts/test-plan.prompt.md
rename to examples/todomvc/.claude/prompts/pwt-plan.md
index babb1c5f9f..32452abcd5 100644
--- a/examples/todomvc/.github/prompts/test-plan.prompt.md
+++ b/examples/todomvc/.claude/prompts/pwt-plan.md
@@ -1,5 +1,5 @@
---
-mode: 🎭 planner
+agent: pwt-planner
description: Create test plan
---
diff --git "a/examples/todomvc/.github/chatmodes/\360\237\216\255 generator.chatmode.md" b/examples/todomvc/.github/agents/pwt-generator.agent.md
similarity index 51%
rename from "examples/todomvc/.github/chatmodes/\360\237\216\255 generator.chatmode.md"
rename to examples/todomvc/.github/agents/pwt-generator.agent.md
index 6ada1226f4..71160e9324 100644
--- "a/examples/todomvc/.github/chatmodes/\360\237\216\255 generator.chatmode.md"
+++ b/examples/todomvc/.github/agents/pwt-generator.agent.md
@@ -1,6 +1,28 @@
---
-description: Use this agent when you need to create automated browser tests using Playwright.
-tools: ['search/fileSearch', 'search/textSearch', 'search/listDirectory', 'search/readFile', 'playwright-test/browser_click', 'playwright-test/browser_drag', 'playwright-test/browser_evaluate', 'playwright-test/browser_file_upload', 'playwright-test/browser_handle_dialog', 'playwright-test/browser_hover', 'playwright-test/browser_navigate', 'playwright-test/browser_press_key', 'playwright-test/browser_select_option', 'playwright-test/browser_snapshot', 'playwright-test/browser_type', 'playwright-test/browser_verify_element_visible', 'playwright-test/browser_verify_list_visible', 'playwright-test/browser_verify_text_visible', 'playwright-test/browser_verify_value', 'playwright-test/browser_wait_for', 'playwright-test/generator_read_log', 'playwright-test/generator_setup_page', 'playwright-test/generator_write_test']
+name: pwt-generator
+description: Use this agent when you need to create automated browser tests using Playwright. Examples: <example>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>
+tools:
+ - search
+ - playwright-test/browser_click
+ - playwright-test/browser_drag
+ - playwright-test/browser_evaluate
+ - playwright-test/browser_file_upload
+ - playwright-test/browser_handle_dialog
+ - playwright-test/browser_hover
+ - playwright-test/browser_navigate
+ - playwright-test/browser_press_key
+ - playwright-test/browser_select_option
+ - playwright-test/browser_snapshot
+ - playwright-test/browser_type
+ - playwright-test/browser_verify_element_visible
+ - playwright-test/browser_verify_list_visible
+ - playwright-test/browser_verify_text_visible
+ - playwright-test/browser_verify_value
+ - playwright-test/browser_wait_for
+ - playwright-test/generator_read_log
+ - playwright-test/generator_setup_page
+ - playwright-test/generator_write_test
+model: Claude Sonnet 4
---
You are a Playwright Test Generator, an expert in browser automation and end-to-end testing.
@@ -54,5 +76,3 @@ 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 [email protected] 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></example>
\ No newline at end of file
diff --git "a/examples/todomvc/.github/chatmodes/\360\237\216\255 healer.chatmode.md" b/examples/todomvc/.github/agents/pwt-healer.agent.md
similarity index 66%
rename from "examples/todomvc/.github/chatmodes/\360\237\216\255 healer.chatmode.md"
rename to examples/todomvc/.github/agents/pwt-healer.agent.md
index 936786a7cc..3c6eb6974f 100644
--- "a/examples/todomvc/.github/chatmodes/\360\237\216\255 healer.chatmode.md"
+++ b/examples/todomvc/.github/agents/pwt-healer.agent.md
@@ -1,6 +1,18 @@
---
+name: pwt-healer
description: Use this agent when you need to debug and fix failing Playwright tests.
-tools: ['edit/createFile', 'edit/createDirectory', 'edit/editFiles', 'search/fileSearch', 'search/textSearch', 'search/listDirectory', 'search/readFile', 'playwright-test/browser_console_messages', 'playwright-test/browser_evaluate', 'playwright-test/browser_generate_locator', 'playwright-test/browser_network_requests', 'playwright-test/browser_snapshot', 'playwright-test/test_debug', 'playwright-test/test_list', 'playwright-test/test_run']
+tools:
+ - search
+ - edit
+ - playwright-test/browser_console_messages
+ - playwright-test/browser_evaluate
+ - playwright-test/browser_generate_locator
+ - playwright-test/browser_network_requests
+ - playwright-test/browser_snapshot
+ - playwright-test/test_debug
+ - playwright-test/test_list
+ - playwright-test/test_run
+model: Claude Sonnet 4
---
You are the Playwright Test Healer, an expert test automation engineer specializing in debugging and
@@ -40,5 +52,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>
\ No newline at end of file
diff --git "a/examples/todomvc/.github/chatmodes/\360\237\216\255 planner.chatmode.md" b/examples/todomvc/.github/agents/pwt-planner.agent.md
similarity index 67%
rename from "examples/todomvc/.github/chatmodes/\360\237\216\255 planner.chatmode.md"
rename to examples/todomvc/.github/agents/pwt-planner.agent.md
index 6566e79920..29ff84014c 100644
--- "a/examples/todomvc/.github/chatmodes/\360\237\216\255 planner.chatmode.md"
+++ b/examples/todomvc/.github/agents/pwt-planner.agent.md
@@ -1,6 +1,28 @@
---
+name: pwt-planner
description: Use this agent when you need to create comprehensive test plan for a web application or website.
-tools: ['edit/createFile', 'edit/createDirectory', 'search/fileSearch', 'search/textSearch', 'search/listDirectory', 'search/readFile', 'playwright-test/browser_click', 'playwright-test/browser_close', 'playwright-test/browser_console_messages', 'playwright-test/browser_drag', 'playwright-test/browser_evaluate', 'playwright-test/browser_file_upload', 'playwright-test/browser_handle_dialog', 'playwright-test/browser_hover', 'playwright-test/browser_navigate', 'playwright-test/browser_navigate_back', 'playwright-test/browser_network_requests', 'playwright-test/browser_press_key', 'playwright-test/browser_select_option', 'playwright-test/browser_snapshot', 'playwright-test/browser_take_screenshot', 'playwright-test/browser_type', 'playwright-test/browser_wait_for', 'playwright-test/planner_setup_page']
+tools:
+ - search
+ - edit
+ - playwright-test/browser_click
+ - playwright-test/browser_close
+ - playwright-test/browser_console_messages
+ - playwright-test/browser_drag
+ - playwright-test/browser_evaluate
+ - playwright-test/browser_file_upload
+ - playwright-test/browser_handle_dialog
+ - playwright-test/browser_hover
+ - playwright-test/browser_navigate
+ - playwright-test/browser_navigate_back
+ - playwright-test/browser_network_requests
+ - playwright-test/browser_press_key
+ - playwright-test/browser_select_option
+ - playwright-test/browser_snapshot
+ - playwright-test/browser_take_screenshot
+ - playwright-test/browser_type
+ - playwright-test/browser_wait_for
+ - playwright-test/planner_setup_page
+model: Claude Sonnet 4
---
You are an expert web test planner with extensive experience in quality assurance, user experience testing, and test
@@ -92,5 +114,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>
\ No newline at end of file
diff --git a/examples/todomvc/.claude/prompts/test-coverage.prompt.md b/examples/todomvc/.github/prompts/pwt-coverage.prompt.md
similarity index 83%
rename from examples/todomvc/.claude/prompts/test-coverage.prompt.md
rename to examples/todomvc/.github/prompts/pwt-coverage.prompt.md
index 87146948e1..7fd4491384 100644
--- a/examples/todomvc/.claude/prompts/test-coverage.prompt.md
+++ b/examples/todomvc/.github/prompts/pwt-coverage.prompt.md
@@ -1,5 +1,5 @@
---
-mode: default
+agent: agent
description: Produce test coverage
---
@@ -8,7 +8,7 @@ Parameters:
- Seed file (optional): the seed file to use, defaults to `tests/seed.spec.ts`
- Test plan file (optional): the test plan file to write, under `specs/` folder.
-1. Call #playwright-test-planner subagent with prompt:
+1. Call #pwt-planner subagent with prompt:
<plan>
<task-text><!-- the task --></task-text>
@@ -16,7 +16,7 @@ Parameters:
<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:
+2. For each test case from the test plan file (1.1, 1.2, ...), one after another, not in parallel, call #pwt-generator subagent with prompt:
<generate>
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
@@ -26,6 +26,6 @@ Parameters:
<body><!-- Test case content including steps and expectations --></body>
</generate>
-3. Call #playwright-test-healer subagent with prompt:
+3. Call #pwt-healer subagent with prompt:
<heal>Run all tests and fix the failing ones one after another.</heal>
diff --git a/packages/playwright/src/agents/test-generate.prompt.md b/examples/todomvc/.github/prompts/pwt-generate.prompt.md
similarity index 85%
rename from packages/playwright/src/agents/test-generate.prompt.md
rename to examples/todomvc/.github/prompts/pwt-generate.prompt.md
index ef4b5cb458..b92662678c 100644
--- a/packages/playwright/src/agents/test-generate.prompt.md
+++ b/examples/todomvc/.github/prompts/pwt-generate.prompt.md
@@ -1,5 +1,5 @@
---
-mode: ${agentGenerator}
+agent: pwt-generator
description: Generate test plan
---
diff --git a/packages/playwright/src/agents/test-heal.prompt.md b/examples/todomvc/.github/prompts/pwt-heal.prompt.md
similarity index 78%
rename from packages/playwright/src/agents/test-heal.prompt.md
rename to examples/todomvc/.github/prompts/pwt-heal.prompt.md
index 51a7d3b480..2fb1bc63ce 100644
--- a/packages/playwright/src/agents/test-heal.prompt.md
+++ b/examples/todomvc/.github/prompts/pwt-heal.prompt.md
@@ -1,5 +1,5 @@
---
-mode: ${agentHealer}
+agent: pwt-healer
description: Fix tests
---
diff --git a/examples/todomvc/.claude/prompts/test-plan.prompt.md b/examples/todomvc/.github/prompts/pwt-plan.prompt.md
similarity index 85%
rename from examples/todomvc/.claude/prompts/test-plan.prompt.md
rename to examples/todomvc/.github/prompts/pwt-plan.prompt.md
index 7f0129ca40..32452abcd5 100644
--- a/examples/todomvc/.claude/prompts/test-plan.prompt.md
+++ b/examples/todomvc/.github/prompts/pwt-plan.prompt.md
@@ -1,5 +1,5 @@
---
-mode: playwright-test-planner
+agent: pwt-planner
description: Create test plan
---
diff --git a/packages/playwright/src/agents/generateAgents.ts b/packages/playwright/src/agents/generateAgents.ts
index c291c741a5..161c3710fd 100644
--- a/packages/playwright/src/agents/generateAgents.ts
+++ b/packages/playwright/src/agents/generateAgents.ts
@@ -32,7 +32,6 @@ interface AgentHeader {
}
interface Agent {
- source: string;
header: AgentHeader;
instructions: string;
examples: string[];
@@ -50,7 +49,7 @@ class AgentParser {
const source = await fs.promises.readFile(filePath, 'utf-8');
const { header, content } = this.extractYamlAndContent(source);
const { instructions, examples } = this.extractInstructionsAndExamples(content);
- return { source, header, instructions, examples };
+ return { header, instructions, examples };
}
static extractYamlAndContent(markdown: string): { header: AgentHeader; content: string } {
@@ -108,16 +107,20 @@ class AgentParser {
}
export class ClaudeGenerator {
- static async init(config: FullConfigInternal, projectName: string) {
+ static async init(config: FullConfigInternal, projectName: string, prompts: boolean) {
await initRepo(config, projectName, {
- promptsFolder: '.claude/prompts',
+ promptsFolder: prompts ? '.claude/prompts' : undefined,
});
const agents = await AgentParser.loadAgents();
await fs.promises.mkdir('.claude/agents', { recursive: true });
for (const agent of agents)
- await writeFile(`.claude/agents/${agent.header.name}.agent.md`, ClaudeGenerator.agentSpec(agent), 'πŸ€–', 'agent definition');
+ await writeFile(`.claude/agents/${agent.header.name}.md`, ClaudeGenerator.agentSpec(agent), 'πŸ€–', 'agent definition');
+
+ await deleteFile(`.claude/agents/playwright-test-planner.md`, 'legacy planner agent');
+ await deleteFile(`.claude/agents/playwright-test-generator.md`, 'legacy generator agent');
+ await deleteFile(`.claude/agents/playwright-test-healer.md`, 'legacy healer agent');
await writeFile('.mcp.json', JSON.stringify({
mcpServers: {
@@ -133,10 +136,8 @@ export class ClaudeGenerator {
static agentSpec(agent: Agent): string {
const claudeToolMap = new Map<string, string[]>([
- ['search', ['Glob', 'Grep']],
- ['read', ['Read']],
- ['edit', ['Edit', 'MultiEdit']],
- ['write', ['Write']],
+ ['search', ['Glob', 'Grep', 'Read']],
+ ['edit', ['Edit', 'MultiEdit', 'Write']],
]);
function asClaudeTool(tool: string): string {
@@ -146,10 +147,11 @@ export class ClaudeGenerator {
return `mcp__${first}__${second}`;
}
+ const examples = agent.examples.length ? ` Examples: ${agent.examples.map(example => `<example>${example}</example>`).join('')}` : '';
const lines: string[] = [];
lines.push(`---`);
lines.push(`name: ${agent.header.name}`);
- lines.push(`description: ${agent.header.description}. Examples: ${agent.examples.map(example => `<example>${example}</example>`).join('')}`);
+ lines.push(`description: ${agent.header.description}.${examples}`);
lines.push(`tools: ${agent.header.tools.map(tool => asClaudeTool(tool)).join(', ')}`);
lines.push(`model: ${agent.header.model}`);
lines.push(`color: ${agent.header.color}`);
@@ -161,10 +163,10 @@ export class ClaudeGenerator {
}
export class OpencodeGenerator {
- static async init(config: FullConfigInternal, projectName: string) {
+ static async init(config: FullConfigInternal, projectName: string, prompts: boolean) {
await initRepo(config, projectName, {
- agentDefault: 'Build',
- promptsFolder: '.opencode/prompts'
+ defaultAgentName: 'Build',
+ promptsFolder: prompts ? '.opencode/prompts' : undefined
});
const agents = await AgentParser.loadAgents();
@@ -173,8 +175,13 @@ export class OpencodeGenerator {
const prompt = [agent.instructions];
prompt.push('');
prompt.push(...agent.examples.map(example => `<example>${example}</example>`));
- await writeFile(`.opencode/prompts/${agent.header.name}.agent.md`, prompt.join('\n'), 'πŸ€–', 'agent definition');
+ await writeFile(`.opencode/prompts/${agent.header.name}.md`, prompt.join('\n'), 'πŸ€–', 'agent definition');
}
+
+ await deleteFile(`.opencode/prompts/playwright-test-planner.md`, 'legacy planner agent');
+ await deleteFile(`.opencode/prompts/playwright-test-generator.md`, 'legacy generator agent');
+ await deleteFile(`.opencode/prompts/playwright-test-healer.md`, 'legacy healer agent');
+
await writeFile('opencode.json', OpencodeGenerator.configuration(agents), 'πŸ”§', 'opencode configuration');
initRepoDone();
@@ -182,10 +189,8 @@ export class OpencodeGenerator {
static configuration(agents: Agent[]): string {
const opencodeToolMap = new Map<string, string[]>([
- ['search', ['ls', 'glob', 'grep']],
- ['read', ['read']],
- ['edit', ['edit']],
- ['write', ['write']],
+ ['search', ['ls', 'glob', 'grep', 'read']],
+ ['edit', ['edit', 'write']],
]);
const asOpencodeTool = (tools: Record<string, boolean>, tool: string) => {
@@ -210,7 +215,7 @@ export class OpencodeGenerator {
result['agent'][agent.header.name] = {
description: agent.header.description,
mode: 'subagent',
- prompt: `{file:.opencode/prompts/${agent.header.name}.agent.md}`,
+ prompt: `{file:.opencode/prompts/${agent.header.name}.md}`,
tools,
};
for (const tool of agent.header.tools)
@@ -226,69 +231,69 @@ export class OpencodeGenerator {
return JSON.stringify(result, null, 2);
}
}
-export class AgentGenerator {
- static async init(config: FullConfigInternal, projectName: string) {
- const agentsFolder = process.env.AGENTS_FOLDER;
- if (!agentsFolder) {
- console.error('AGENTS_FOLDER environment variable is not set');
- return;
- }
+export class CopilotGenerator {
+ static async init(config: FullConfigInternal, projectName: string, prompts: boolean) {
await initRepo(config, projectName, {
- promptsFolder: path.join(agentsFolder, 'prompts')
+ defaultAgentName: 'agent',
+ promptsFolder: prompts ? '.github/prompts' : undefined,
+ promptSuffix: 'prompt'
});
const agents = await AgentParser.loadAgents();
- await fs.promises.mkdir(agentsFolder, { recursive: true });
+ await fs.promises.mkdir('.github/agents', { recursive: true });
for (const agent of agents)
- await writeFile(`${agentsFolder}/agents/${agent.header.name}.md`, agent.source, 'πŸ€–', 'agent definition');
+ await writeFile(`.github/agents/${agent.header.name}.agent.md`, CopilotGenerator.agentSpec(agent), 'πŸ€–', 'agent definition');
- console.log('πŸ”§ MCP configuration');
- console.log(JSON.stringify({
- mcpServers: {
- 'playwright-test': {
- type: 'stdio',
- command: 'npx',
- args: [
- `--prefix=${path.resolve(process.cwd())}`,
- 'playwright',
- 'run-test-mcp-server',
- `--headless`,
- `--config=${path.resolve(process.cwd())}`,
- ],
- tools: ['*']
- }
- }
- }, null, 2));
+ await deleteFile(`.github/chatmodes/ 🎭 planner.chatmode.md`, 'legacy planner chatmode');
+ await deleteFile(`.github/chatmodes/🎭 generator.chatmode.md`, 'legacy generator chatmode');
+ await deleteFile(`.github/chatmodes/🎭 healer.chatmode.md`, 'legacy healer chatmode');
+
+ await VSCodeGenerator.appendToMCPJson();
initRepoDone();
}
+
+ static agentSpec(agent: Agent): string {
+ const examples = agent.examples.length ? ` Examples: ${agent.examples.map(example => `<example>${example}</example>`).join('')}` : '';
+ const lines: string[] = [];
+ lines.push(`---`);
+ lines.push(`name: ${agent.header.name}`);
+ lines.push(`description: ${agent.header.description}.${examples}`);
+ lines.push(`tools:\n${agent.header.tools.map(tool => ` - ${tool}`).join('\n')}`);
+ lines.push(`model: Claude Sonnet 4`);
+ lines.push(`---`);
+ lines.push('');
+ lines.push(agent.instructions);
+ lines.push('');
+ return lines.join('\n');
+ }
}
export class VSCodeGenerator {
static async init(config: FullConfigInternal, projectName: string) {
await initRepo(config, projectName, {
- agentDefault: 'agent',
- agentHealer: '🎭 healer',
- agentGenerator: '🎭 generator',
- agentPlanner: '🎭 planner',
- promptsFolder: '.github/prompts'
+ promptsFolder: undefined
});
const agents = await AgentParser.loadAgents();
const nameMap = new Map<string, string>([
- ['playwright-test-planner', '🎭 planner'],
+ ['playwright-test-planner', ' 🎭 planner'],
['playwright-test-generator', '🎭 generator'],
['playwright-test-healer', '🎭 healer'],
]);
- await deleteFile(`.github/chatmodes/ 🎭 planner.chatmode.md`, 'old planner chatmode');
-
await fs.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), 'πŸ€–', 'chatmode definition');
+ await VSCodeGenerator.appendToMCPJson();
+
+ initRepoDone();
+ }
+
+ static async appendToMCPJson() {
await fs.promises.mkdir('.vscode', { recursive: true });
const mcpJsonPath = '.vscode/mcp.json';
@@ -310,8 +315,6 @@ export class VSCodeGenerator {
args: ['playwright', 'run-test-mcp-server'],
};
await writeFile(mcpJsonPath, JSON.stringify(mcpJson, null, 2), 'πŸ”§', 'mcp configuration');
-
- initRepoDone();
}
static agentSpec(agent: Agent): string {
@@ -353,6 +356,7 @@ export class VSCodeGenerator {
for (const example of agent.examples)
lines.push(`<example>${example}</example>`);
+ lines.push('');
return lines.join('\n');
}
}
@@ -376,16 +380,14 @@ async function deleteFile(filePath: string, description: string) {
}
type RepoParams = {
- promptsFolder: string;
- agentDefault?: string;
- agentHealer?: string;
- agentGenerator?: string;
- agentPlanner?: string;
+ promptsFolder?: string;
+ promptSuffix?: string;
+ defaultAgentName?: string;
};
async function initRepo(config: FullConfigInternal, projectName: string, options: RepoParams) {
const project = seedProject(config, projectName);
- console.log(`🎭 Using project "${project.project.name}" as a primary project`);
+ console.log(`- 🎭 Using project "${project.project.name}" as a primary project`);
if (!fs.existsSync('specs')) {
await fs.promises.mkdir('specs');
@@ -401,13 +403,21 @@ This is a directory for test plans.
await writeFile(seedFile, seedFileContent, '🌱', 'default environment seed file');
}
- await fs.promises.mkdir(options.promptsFolder, { recursive: true });
-
- for (const promptFile of await fs.promises.readdir(__dirname)) {
- if (!promptFile.endsWith('.prompt.md'))
- continue;
- const content = await loadPrompt(promptFile, { ...options, seedFile: path.relative(process.cwd(), seedFile) });
- await writeFile(path.join(options.promptsFolder, promptFile), content, 'πŸ“', 'prompt template');
+ if (options.promptsFolder) {
+ await fs.promises.mkdir(options.promptsFolder, { recursive: true });
+
+ for (const promptFile of await fs.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: path.relative(process.cwd(), seedFile)
+ });
+ await writeFile(path.join(options.promptsFolder, fileName), content, 'πŸ“', 'prompt template');
+ }
}
}
@@ -416,16 +426,8 @@ function initRepoDone() {
}
async function loadPrompt(file: string, params: Record<string, string>) {
- const templateParams = {
- agentDefault: params.agentDefault ?? 'default',
- agentHealer: params.agentHealer ?? 'playwright-test-healer',
- agentGenerator: params.agentGenerator ?? 'playwright-test-generator',
- agentPlanner: params.agentPlanner ?? 'playwright-test-planner',
- seedFile: params.seedFile,
- };
-
const content = await fs.promises.readFile(path.join(__dirname, file), 'utf-8');
- return Object.entries(templateParams).reduce((acc, [key, value]) => {
+ return Object.entries(params).reduce((acc, [key, value]) => {
return acc.replace(new RegExp(`\\\${${key}}`, 'g'), value);
}, content);
}
diff --git a/packages/playwright/src/agents/test-coverage.prompt.md b/packages/playwright/src/agents/pwt-coverage.prompt.md
similarity index 84%
rename from packages/playwright/src/agents/test-coverage.prompt.md
rename to packages/playwright/src/agents/pwt-coverage.prompt.md
index 12923b36ac..b207d398d5 100644
--- a/packages/playwright/src/agents/test-coverage.prompt.md
+++ b/packages/playwright/src/agents/pwt-coverage.prompt.md
@@ -1,5 +1,5 @@
---
-mode: ${agentDefault}
+agent: ${defaultAgentName}
description: Produce test coverage
---
@@ -8,7 +8,7 @@ Parameters:
- 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 #${agentPlanner} subagent with prompt:
+1. Call #pwt-planner subagent with prompt:
<plan>
<task-text><!-- the task --></task-text>
@@ -16,7 +16,7 @@ Parameters:
<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 #${agentGenerator} subagent with prompt:
+2. For each test case from the test plan file (1.1, 1.2, ...), one after another, not in parallel, call #pwt-generator subagent with prompt:
<generate>
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
@@ -26,6 +26,6 @@ Parameters:
<body><!-- Test case content including steps and expectations --></body>
</generate>
-3. Call #${agentHealer} subagent with prompt:
+3. Call #pwt-healer subagent with prompt:
<heal>Run all tests and fix the failing ones one after another.</heal>
diff --git a/examples/todomvc/.claude/prompts/test-generate.prompt.md b/packages/playwright/src/agents/pwt-generate.prompt.md
similarity index 81%
rename from examples/todomvc/.claude/prompts/test-generate.prompt.md
rename to packages/playwright/src/agents/pwt-generate.prompt.md
index d50dcd3505..b92662678c 100644
--- a/examples/todomvc/.claude/prompts/test-generate.prompt.md
+++ b/packages/playwright/src/agents/pwt-generate.prompt.md
@@ -1,5 +1,5 @@
---
-mode: playwright-test-generator
+agent: pwt-generator
description: Generate test plan
---
diff --git a/packages/playwright/src/agents/generator.agent.md b/packages/playwright/src/agents/pwt-generator.agent.md
similarity index 73%
rename from packages/playwright/src/agents/generator.agent.md
rename to packages/playwright/src/agents/pwt-generator.agent.md
index 4a313bf56d..4956063a10 100644
--- a/packages/playwright/src/agents/generator.agent.md
+++ b/packages/playwright/src/agents/pwt-generator.agent.md
@@ -1,10 +1,9 @@
---
-name: playwright-test-generator
+name: pwt-generator
description: Use this agent when you need to create automated browser tests using Playwright
model: sonnet
color: blue
tools:
- - read
- search
- playwright-test/browser_click
- playwright-test/browser_drag
@@ -80,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 [email protected] 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>
diff --git a/examples/todomvc/.claude/prompts/test-heal.prompt.md b/packages/playwright/src/agents/pwt-heal.prompt.md
similarity index 72%
rename from examples/todomvc/.claude/prompts/test-heal.prompt.md
rename to packages/playwright/src/agents/pwt-heal.prompt.md
index c4b526deb7..2fb1bc63ce 100644
--- a/examples/todomvc/.claude/prompts/test-heal.prompt.md
+++ b/packages/playwright/src/agents/pwt-heal.prompt.md
@@ -1,5 +1,5 @@
---
-mode: playwright-test-healer
+agent: pwt-healer
description: Fix tests
---
diff --git a/packages/playwright/src/agents/healer.agent.md b/packages/playwright/src/agents/pwt-healer.agent.md
similarity index 75%
rename from packages/playwright/src/agents/healer.agent.md
rename to packages/playwright/src/agents/pwt-healer.agent.md
index 92e08e86fd..dd1b3a103b 100644
--- a/packages/playwright/src/agents/healer.agent.md
+++ b/packages/playwright/src/agents/pwt-healer.agent.md
@@ -1,12 +1,10 @@
---
-name: playwright-test-healer
+name: pwt-healer
description: Use this agent when you need to debug and fix failing Playwright tests
model: sonnet
color: red
tools:
- - read
- search
- - write
- edit
- playwright-test/browser_console_messages
- playwright-test/browser_evaluate
@@ -55,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>
diff --git a/packages/playwright/src/agents/test-plan.prompt.md b/packages/playwright/src/agents/pwt-plan.prompt.md
similarity index 88%
rename from packages/playwright/src/agents/test-plan.prompt.md
rename to packages/playwright/src/agents/pwt-plan.prompt.md
index b852859045..5fa1a6ad29 100644
--- a/packages/playwright/src/agents/test-plan.prompt.md
+++ b/packages/playwright/src/agents/pwt-plan.prompt.md
@@ -1,5 +1,5 @@
---
-mode: ${agentPlanner}
+agent: pwt-planner
description: Create test plan
---
diff --git a/packages/playwright/src/agents/planner.agent.md b/packages/playwright/src/agents/pwt-planner.agent.md
similarity index 81%
rename from packages/playwright/src/agents/planner.agent.md
rename to packages/playwright/src/agents/pwt-planner.agent.md
index cbc350ec7d..08a2231b98 100644
--- a/packages/playwright/src/agents/planner.agent.md
+++ b/packages/playwright/src/agents/pwt-planner.agent.md
@@ -1,12 +1,11 @@
---
-name: playwright-test-planner
+name: pwt-planner
description: Use this agent when you need to create comprehensive test plan for a web application or website
model: sonnet
color: green
tools:
- - read
- search
- - write
+ - edit
- playwright-test/browser_click
- playwright-test/browser_close
- playwright-test/browser_console_messages
@@ -116,23 +115,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>
diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.ts
index 707550c15a..22260277c7 100644
--- a/packages/playwright/src/program.ts
+++ b/packages/playwright/src/program.ts
@@ -37,7 +37,7 @@ import { ServerBackendFactory, runMainBackend } from './mcp/sdk/exports';
import { TestServerBackend } from './mcp/test/testBackend';
import { decorateCommand } from './mcp/program';
import { setupExitWatchdog } from './mcp/browser/watchdog';
-import { ClaudeGenerator, OpencodeGenerator, VSCodeGenerator, AgentGenerator } from './agents/generateAgents';
+import { ClaudeGenerator, OpencodeGenerator, VSCodeGenerator, CopilotGenerator } from './agents/generateAgents';
import type { ConfigCLIOverrides } from './common/ipc';
import type { TraceMode } from '../types/test';
@@ -183,22 +183,21 @@ function addInitAgentsCommand(program: Command) {
const command = program.command('init-agents');
command.description('Initialize repository agents');
const option = command.createOption('--loop <loop>', 'Agentic loop provider');
- option.choices(['vscode', 'claude', 'opencode', 'generic']);
+ option.choices(['claude', 'copilot', 'opencode', 'vscode', 'vscode-legacy']);
command.addOption(option);
command.option('-c, --config <file>', `Configuration file to find a project to use for seed test`);
command.option('--project <project>', 'Project to use for seed test');
+ command.option('--prompts', 'Whether to include prompts in the agent initialization');
command.action(async opts => {
const config = await loadConfigFromFile(opts.config);
if (opts.loop === 'opencode') {
- await OpencodeGenerator.init(config, opts.project);
- } else if (opts.loop === 'vscode') {
+ await OpencodeGenerator.init(config, opts.project, opts.prompts);
+ } else if (opts.loop === 'vscode-legacy') {
await VSCodeGenerator.init(config, opts.project);
} else if (opts.loop === 'claude') {
- await ClaudeGenerator.init(config, opts.project);
- } else if (opts.loop === 'generic') {
- await AgentGenerator.init(config, opts.project);
+ await ClaudeGenerator.init(config, opts.project, opts.prompts);
} else {
- command.help();
+ await CopilotGenerator.init(config, opts.project, opts.prompts);
return;
}
});
diff --git a/tests/mcp/init-agents.spec.ts b/tests/mcp/init-agents.spec.ts
index e2d09e3a97..5bfdb117a7 100644
--- a/tests/mcp/init-agents.spec.ts
+++ b/tests/mcp/init-agents.spec.ts
@@ -72,76 +72,3 @@ test('create seed file with --config', async ({ }) => {
});
expect(fs.existsSync(path.join(baseDir, 'custom', 'bar', 'e2e', 'seed.spec.ts'))).toBe(true);
});
-
-async function ensureFiles(baseDir: string, files: string[]) {
- for (const file of files)
- expect(fs.existsSync(path.join(baseDir, file))).toBe(true);
-}
-
-test('init claude agents', async ({ }) => {
- const baseDir = await writeFiles({
- 'playwright.config.ts': `
- module.exports = {};
- `,
- });
-
- await runInitAgents({
- cwd: baseDir,
- args: ['--loop', 'claude'],
- });
- await ensureFiles(baseDir, [
- '.claude/agents/playwright-test-planner.agent.md',
- '.claude/agents/playwright-test-generator.agent.md',
- '.claude/agents/playwright-test-healer.agent.md',
- '.claude/prompts/test-coverage.prompt.md',
- '.claude/prompts/test-plan.prompt.md',
- '.claude/prompts/test-generate.prompt.md',
- '.claude/prompts/test-heal.prompt.md',
- ]);
-});
-
-test('init vscode agents', async ({ }) => {
- const baseDir = await writeFiles({
- 'playwright.config.ts': `
- module.exports = {};
- `,
- });
-
- await runInitAgents({
- cwd: baseDir,
- args: ['--loop', 'vscode'],
- });
-
- await ensureFiles(baseDir, [
- '.github/chatmodes/🎭 generator.chatmode.md',
- '.github/chatmodes/🎭 planner.chatmode.md',
- '.github/chatmodes/🎭 healer.chatmode.md',
- '.github/prompts/test-plan.prompt.md',
- '.github/prompts/test-generate.prompt.md',
- '.github/prompts/test-heal.prompt.md',
- '.vscode/mcp.json',
- ]);
-});
-
-test('init opencode agents', async ({ }) => {
- const baseDir = await writeFiles({
- 'playwright.config.ts': `
- module.exports = {};
- `,
- });
-
- await runInitAgents({
- cwd: baseDir,
- args: ['--loop', 'opencode'],
- });
-
- await ensureFiles(baseDir, [
- '.opencode/prompts/playwright-test-planner.agent.md',
- '.opencode/prompts/playwright-test-generator.agent.md',
- '.opencode/prompts/playwright-test-healer.agent.md',
- '.opencode/prompts/test-plan.prompt.md',
- '.opencode/prompts/test-generate.prompt.md',
- '.opencode/prompts/test-heal.prompt.md',
- 'opencode.json',
- ]);
-});