Skip to content

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

chore: generate loop-specific prompts (#37911)

Pavel Feldman7498e6abb0b9
diff --git a/examples/todomvc/.claude/agents/playwright-test-generator.md b/examples/todomvc/.claude/agents/playwright-test-generator.agent.md
similarity index 100%
rename from examples/todomvc/.claude/agents/playwright-test-generator.md
rename to examples/todomvc/.claude/agents/playwright-test-generator.agent.md
diff --git a/examples/todomvc/.claude/agents/playwright-test-healer.md b/examples/todomvc/.claude/agents/playwright-test-healer.agent.md
similarity index 100%
rename from examples/todomvc/.claude/agents/playwright-test-healer.md
rename to examples/todomvc/.claude/agents/playwright-test-healer.agent.md
diff --git a/examples/todomvc/.claude/agents/playwright-test-planner.md b/examples/todomvc/.claude/agents/playwright-test-planner.agent.md
similarity index 97%
rename from examples/todomvc/.claude/agents/playwright-test-planner.md
rename to examples/todomvc/.claude/agents/playwright-test-planner.agent.md
index afca58af3a..51ca3f36ff 100644
--- a/examples/todomvc/.claude/agents/playwright-test-planner.md
+++ b/examples/todomvc/.claude/agents/playwright-test-planner.agent.md
@@ -45,6 +45,7 @@ You will:
- Executive summary of the tested page/application
- Individual scenarios as separate sections
- Each scenario formatted with numbered steps
+ - Each test case with proposed file name for implementation
- Clear expected results for verification
<example-spec>
@@ -69,6 +70,9 @@ application features:
**Seed:** `tests/seed.spec.ts`
#### 1.1 Add Valid Todo
+
+**File** `tests/adding-new-todos/add-valid-todo.spec.ts`
+
**Steps:**
1. Click in the "What needs to be done?" input field
2. Type "Buy groceries"
diff --git a/examples/todomvc/.claude/prompts/test-coverage.prompt.md b/examples/todomvc/.claude/prompts/test-coverage.prompt.md
new file mode 100644
index 0000000000..87146948e1
--- /dev/null
+++ b/examples/todomvc/.claude/prompts/test-coverage.prompt.md
@@ -0,0 +1,31 @@
+---
+mode: default
+description: Produce test coverage
+---
+
+Parameters:
+- Task: the task to perform
+- 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:
+
+<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>
diff --git a/examples/todomvc/.claude/prompts/test-generate.prompt.md b/examples/todomvc/.claude/prompts/test-generate.prompt.md
new file mode 100644
index 0000000000..d50dcd3505
--- /dev/null
+++ b/examples/todomvc/.claude/prompts/test-generate.prompt.md
@@ -0,0 +1,8 @@
+---
+mode: 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`
diff --git a/examples/todomvc/.claude/prompts/test-heal.prompt.md b/examples/todomvc/.claude/prompts/test-heal.prompt.md
new file mode 100644
index 0000000000..c4b526deb7
--- /dev/null
+++ b/examples/todomvc/.claude/prompts/test-heal.prompt.md
@@ -0,0 +1,6 @@
+---
+mode: playwright-test-healer
+description: Fix tests
+---
+
+Run all my tests and fix the failing ones.
diff --git a/examples/todomvc/.claude/prompts/test-plan.prompt.md b/examples/todomvc/.claude/prompts/test-plan.prompt.md
new file mode 100644
index 0000000000..7f0129ca40
--- /dev/null
+++ b/examples/todomvc/.claude/prompts/test-plan.prompt.md
@@ -0,0 +1,9 @@
+---
+mode: playwright-test-planner
+description: Create test plan
+---
+
+Create test plan for "add to cart" functionality of my app.
+
+- Seed file: `tests/seed.spec.ts`
+- Test plan: `specs/coverage.plan.md`
diff --git "a/examples/todomvc/.github/chatmodes/ \360\237\216\255 planner.chatmode.md" "b/examples/todomvc/.github/chatmodes/\360\237\216\255 planner.chatmode.md"
similarity index 97%
rename from "examples/todomvc/.github/chatmodes/ \360\237\216\255 planner.chatmode.md"
rename to "examples/todomvc/.github/chatmodes/\360\237\216\255 planner.chatmode.md"
index ed3dc5e018..6566e79920 100644
--- "a/examples/todomvc/.github/chatmodes/ \360\237\216\255 planner.chatmode.md"
+++ "b/examples/todomvc/.github/chatmodes/\360\237\216\255 planner.chatmode.md"
@@ -42,6 +42,7 @@ You will:
- Executive summary of the tested page/application
- Individual scenarios as separate sections
- Each scenario formatted with numbered steps
+ - Each test case with proposed file name for implementation
- Clear expected results for verification
<example-spec>
@@ -66,6 +67,9 @@ application features:
**Seed:** `tests/seed.spec.ts`
#### 1.1 Add Valid Todo
+
+**File** `tests/adding-new-todos/add-valid-todo.spec.ts`
+
**Steps:**
1. Click in the "What needs to be done?" input field
2. Type "Buy groceries"
diff --git a/examples/todomvc/.github/prompts/test-coverage.prompt.md b/examples/todomvc/.github/prompts/test-coverage.prompt.md
new file mode 100644
index 0000000000..4cc7675436
--- /dev/null
+++ b/examples/todomvc/.github/prompts/test-coverage.prompt.md
@@ -0,0 +1,31 @@
+---
+mode: agent
+description: Produce test coverage
+---
+
+Parameters:
+- Task: the task to perform
+- 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:
+
+<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 #🎭 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 #🎭 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/.github/prompts/test-generate.prompt.md
new file mode 100644
index 0000000000..1de2430f2d
--- /dev/null
+++ b/examples/todomvc/.github/prompts/test-generate.prompt.md
@@ -0,0 +1,8 @@
+---
+mode: 🎭 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`
diff --git a/examples/todomvc/.github/prompts/test-heal.prompt.md b/examples/todomvc/.github/prompts/test-heal.prompt.md
new file mode 100644
index 0000000000..6f4f720e65
--- /dev/null
+++ b/examples/todomvc/.github/prompts/test-heal.prompt.md
@@ -0,0 +1,6 @@
+---
+mode: 🎭 healer
+description: Fix tests
+---
+
+Run all my tests and fix the failing ones.
diff --git a/examples/todomvc/.github/prompts/test-plan.prompt.md b/examples/todomvc/.github/prompts/test-plan.prompt.md
new file mode 100644
index 0000000000..babb1c5f9f
--- /dev/null
+++ b/examples/todomvc/.github/prompts/test-plan.prompt.md
@@ -0,0 +1,9 @@
+---
+mode: 🎭 planner
+description: Create test plan
+---
+
+Create test plan for "add to cart" functionality of my app.
+
+- Seed file: `tests/seed.spec.ts`
+- Test plan: `specs/coverage.plan.md`
diff --git a/examples/todomvc/.vscode/mcp.json b/examples/todomvc/.vscode/mcp.json
index df015d2ffa..f0c78a8aab 100644
--- a/examples/todomvc/.vscode/mcp.json
+++ b/examples/todomvc/.vscode/mcp.json
@@ -6,8 +6,7 @@
"args": [
"playwright",
"run-test-mcp-server"
- ],
- "cwd": "${workspaceFolder}"
+ ]
}
},
"inputs": []
diff --git a/examples/todomvc/prompts/test-coverage.md b/examples/todomvc/prompts/test-coverage.md
deleted file mode 100644
index 09d36ebaed..0000000000
--- a/examples/todomvc/prompts/test-coverage.md
+++ /dev/null
@@ -1,29 +0,0 @@
-
-# Produce test coverage
-
-Parameters:
-- Task: the task to perform
-- 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:
-
-<plan>
- <task><!-- the task --></task>
- <seed-file><!-- seed file param --></seed-file>
- <plan-file><!-- test plan file --></plan-file>
-</plan>
-
-2. For each test case from the test plan file (1.1, 1.2, ...), Call #generator subagent with prompt:
-
-<generate>
- <test-file><!-- Name of the file to save the test into, should be unique for test --></test-file>
- <test-suite><!-- Name of the top level test spec w/o ordinal--></test-suite>
- <test-name><!--Name of the test case without the ordinal --></test-name>
- <seed-file><!-- Seed file from test plan --></seed-file>
- <body><!-- Test case content including steps and expectations --></body>
-</generate>
-
-3. Call #healer subagent with prompt:
-
-<heal>Run all tests and fix the failing ones one after another.</heal>
diff --git a/examples/todomvc/specs/basic-operations.md b/examples/todomvc/specs/basic-operations.md
deleted file mode 100644
index 0adc624bdd..0000000000
--- a/examples/todomvc/specs/basic-operations.md
+++ /dev/null
@@ -1,468 +0,0 @@
-# TodoMVC Application - Basic Operations Test Plan
-
-## Application Overview
-
-The TodoMVC application is a React-based todo list manager that demonstrates standard todo application functionality. The application provides comprehensive task management capabilities with a clean, intuitive interface. Key features include:
-
-- **Task Management**: Add, edit, complete, and delete individual todos
-- **Bulk Operations**: Mark all todos as complete/incomplete and clear all completed todos
-- **Filtering System**: View todos by All, Active, or Completed status with URL routing support
-- **Real-time Counter**: Display of active (incomplete) todo count
-- **Interactive UI**: Hover states, edit-in-place functionality, and responsive design
-- **State Persistence**: Maintains state during session navigation
-
-## 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 Add Multiple Todos
-
-**Steps:**
-1. Add first todo: "Buy groceries" and press Enter
-2. Add second todo: "Walk the dog" and press Enter
-3. Add third todo: "Call dentist" and press Enter
-
-**Expected Results:**
-- All three todos appear in the list in the order added
-- Counter shows "3 items left"
-- Each todo has its own unchecked checkbox
-- Input field remains active and cleared after each addition
-
-#### 1.3 Add Todo with Special Characters
-
-**Steps:**
-1. Type "Buy coffee & donuts (2-3 pieces) @$5.99!" in input field
-2. Press Enter
-
-**Expected Results:**
-- Todo appears exactly as typed with all special characters preserved
-- Counter shows "1 item left"
-- No encoding or display issues with special characters
-
-#### 1.4 Add Empty Todo (Negative Test)
-
-**Steps:**
-1. Click in input field but don't type anything
-2. Press Enter
-
-**Expected Results:**
-- No todo is added to the list
-- List remains empty
-- No counter appears
-- Input field remains focused and empty
-
-#### 1.5 Add Todo with Only Whitespace (Negative Test)
-
-**Steps:**
-1. Type only spaces " " in input field
-2. Press Enter
-
-**Expected Results:**
-- No todo is added to the list
-- List remains empty
-- Input field is cleared
-- No counter appears
-
-### 2. Marking Todos Complete/Incomplete
-
-#### 2.1 Mark Single Todo Complete
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Click the checkbox next to "Buy groceries"
-
-**Expected Results:**
-- Checkbox becomes checked
-- Todo text may show strikethrough or completed styling
-- Counter shows "0 items left"
-- "Clear completed" button appears
-- Delete button (Γ—) becomes visible on hover
-
-#### 2.2 Mark Multiple Todos Complete
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Click checkbox for "Buy groceries"
-3. Click checkbox for "Call dentist"
-
-**Expected Results:**
-- Two todos show as completed
-- Counter shows "1 item left" (for "Walk the dog")
-- "Clear completed" button appears
-- Only "Walk the dog" remains unchecked
-
-#### 2.3 Toggle Todo Back to Incomplete
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Click checkbox to mark complete
-3. Click checkbox again to mark incomplete
-
-**Expected Results:**
-- Checkbox becomes unchecked
-- Completed styling is removed
-- Counter shows "1 item left"
-- "Clear completed" button disappears if no other completed todos exist
-
-#### 2.4 Mark All Todos Complete
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Click the "Mark all as complete" checkbox
-
-**Expected Results:**
-- All todo checkboxes become checked
-- Counter shows "0 items left"
-- "Clear completed" button appears
-- "Mark all as complete" checkbox shows as checked
-
-#### 2.5 Toggle All Todos Back to Incomplete
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-2. Click "Mark all as complete" checkbox
-3. Click "Mark all as complete" checkbox again
-
-**Expected Results:**
-- All todo checkboxes become unchecked
-- Counter shows "2 items left"
-- "Clear completed" button disappears
-- "Mark all as complete" checkbox shows as unchecked
-
-### 3. Editing Todos
-
-#### 3.1 Edit Todo Text
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Double-click on the todo text "Buy groceries"
-3. Clear text and type "Buy organic groceries"
-4. Press Enter
-
-**Expected Results:**
-- Todo enters edit mode with text selected
-- Text changes to "Buy organic groceries"
-- Todo exits edit mode
-- Counter remains "1 item left"
-
-#### 3.2 Cancel Edit with Escape
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Double-click on the todo text
-3. Change text to "Buy organic groceries"
-4. Press Escape key
-
-**Expected Results:**
-- Todo exits edit mode
-- Text reverts to original "Buy groceries"
-- No changes are saved
-- Todo remains in its original state
-
-#### 3.3 Edit Todo to Empty Text (Negative Test)
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Double-click on the todo text
-3. Clear all text
-4. Press Enter
-
-**Expected Results:**
-- Todo should be deleted/removed from list
-- Counter decrements appropriately
-- List becomes empty if this was the only todo
-
-#### 3.4 Edit Multiple Todos
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-2. Double-click "Buy groceries", change to "Buy organic groceries", press Enter
-3. Double-click "Walk the dog", change to "Walk the cat", press Enter
-
-**Expected Results:**
-- Both todos are updated with new text
-- Counter remains "2 items left"
-- Both todos maintain their completion state
-
-### 4. Deleting Todos
-
-#### 4.1 Delete Single Todo
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Hover over the todo item
-3. Click the delete button (Γ—)
-
-**Expected Results:**
-- Todo is removed from the list
-- List becomes empty
-- Counter disappears
-- Todo controls (filters, mark all) disappear
-
-#### 4.2 Delete Multiple Todos
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Hover over "Walk the dog" and click delete (Γ—)
-3. Hover over "Call dentist" and click delete (Γ—)
-
-**Expected Results:**
-- Only "Buy groceries" remains in the list
-- Counter shows "1 item left"
-- List controls remain visible
-
-#### 4.3 Delete Completed Todo
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-2. Mark "Buy groceries" as complete
-3. Hover over "Buy groceries" and click delete (Γ—)
-
-**Expected Results:**
-- "Buy groceries" is removed from list
-- Only "Walk the dog" remains
-- Counter shows "1 item left"
-- "Clear completed" button disappears
-
-#### 4.4 Clear All Completed Todos
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Mark "Buy groceries" and "Call dentist" as complete
-3. Click "Clear completed" button
-
-**Expected Results:**
-- Both completed todos are removed
-- Only "Walk the dog" remains
-- Counter shows "1 item left"
-- "Clear completed" button disappears
-
-### 5. Filtering Todos
-
-#### 5.1 Filter by All
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Mark "Buy groceries" as complete
-3. Click "All" filter link
-
-**Expected Results:**
-- All todos are visible (both completed and active)
-- URL shows "#/"
-- "All" filter appears active/highlighted
-- Counter shows "2 items left"
-
-#### 5.2 Filter by Active
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Mark "Buy groceries" as complete
-3. Click "Active" filter link
-
-**Expected Results:**
-- Only incomplete todos are visible ("Walk the dog", "Call dentist")
-- Completed todo "Buy groceries" is hidden
-- URL shows "#/active"
-- "Active" filter appears active/highlighted
-- Counter shows "2 items left"
-
-#### 5.3 Filter by Completed
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Mark "Buy groceries" and "Walk the dog" as complete
-3. Click "Completed" filter link
-
-**Expected Results:**
-- Only completed todos are visible ("Buy groceries", "Walk the dog")
-- Active todo "Call dentist" is hidden
-- URL shows "#/completed"
-- "Completed" filter appears active/highlighted
-- Counter still shows "1 item left" (maintains global count)
-
-#### 5.4 Navigate Between Filters
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-2. Mark "Buy groceries" as complete
-3. Click "Active" filter
-4. Click "Completed" filter
-5. Click "All" filter
-
-**Expected Results:**
-- Each filter shows appropriate todos
-- URL updates correctly for each filter
-- Active filter is highlighted appropriately
-- Counter remains consistent across filters
-- Todos maintain their state when switching views
-
-### 6. Counter and Status Display
-
-#### 6.1 Counter with Single Item
-
-**Steps:**
-1. Add one todo "Buy groceries"
-
-**Expected Results:**
-- Counter displays "1 item left" (singular form)
-- Counter updates immediately when todo is added
-
-#### 6.2 Counter with Multiple Items
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-
-**Expected Results:**
-- Counter displays "2 items left" (plural form)
-- Counter shows correct count
-
-#### 6.3 Counter Updates with Completion
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Mark "Buy groceries" as complete
-3. Mark "Walk the dog" as complete
-
-**Expected Results:**
-- Counter starts at "3 items left"
-- After first completion: "2 items left"
-- After second completion: "1 item left"
-- Counter updates immediately with each change
-
-#### 6.4 Counter with All Items Complete
-
-**Steps:**
-1. Add todo "Buy groceries"
-2. Mark it as complete
-
-**Expected Results:**
-- Counter shows "0 items left"
-- "Clear completed" button is visible
-- Filter links remain functional
-
-### 7. Bulk Operations
-
-#### 7.1 Mark All Complete When None Completed
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Click "Mark all as complete" checkbox
-
-**Expected Results:**
-- All todos become checked/completed
-- Counter shows "0 items left"
-- "Clear completed" button appears
-- "Mark all as complete" checkbox shows as checked
-
-#### 7.2 Mark All Incomplete When All Completed
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-2. Mark both todos as complete individually
-3. Click "Mark all as complete" checkbox
-
-**Expected Results:**
-- All todos become unchecked/incomplete
-- Counter shows "2 items left"
-- "Clear completed" button disappears
-- "Mark all as complete" checkbox shows as unchecked
-
-#### 7.3 Mark All with Mixed State
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
-2. Mark "Buy groceries" as complete
-3. Click "Mark all as complete" checkbox
-
-**Expected Results:**
-- All todos become completed (including the already completed one)
-- Counter shows "0 items left"
-- "Mark all as complete" checkbox shows as checked
-
-### 8. Edge Cases and Error Handling
-
-#### 8.1 Very Long Todo Text
-
-**Steps:**
-1. Type a very long todo text (200+ characters)
-2. Press Enter
-
-**Expected Results:**
-- Todo is added successfully
-- Text wraps appropriately in the display
-- Interface remains usable
-- Edit functionality works with long text
-
-#### 8.2 Rapid Sequential Actions
-
-**Steps:**
-1. Quickly add multiple todos by typing and pressing Enter rapidly
-2. Quickly toggle completion states
-3. Rapidly switch between filters
-
-**Expected Results:**
-- All actions are processed correctly
-- Counter updates accurately
-- No todos are lost or duplicated
-- Interface remains responsive
-
-#### 8.3 Direct URL Navigation
-**Steps:**
-1. Navigate directly to `{base_url}#/active`
-1. Navigate directly to `{base_url}#/completed`
-2. Navigate directly to `{base_url}#/`
-
-**Expected Results:**
-- Page loads correctly for each URL
-- Appropriate filter is active
-- Interface is fully functional
-- No JavaScript errors occur
-
-#### 8.4 Todo Operations Across Filters
-
-**Steps:**
-1. Add todos: "Buy groceries", "Walk the dog"
-2. Navigate to "Active" filter
-3. Mark "Buy groceries" as complete
-4. Navigate to "Completed" filter
-5. Delete "Buy groceries"
-
-**Expected Results:**
-- Operations work correctly across filter views
-- Todo states are maintained when switching filters
-- Counter updates appropriately
-- UI remains consistent
-
-## Test Data Considerations
-
-- **Todo Text Variations**: Test with short text, long text, special characters, Unicode characters, HTML entities
-- **Volume Testing**: Test with 1, 2, 10, 50+ todos to ensure performance
-- **State Combinations**: Test all combinations of completed/incomplete todos with different filters
-- **Boundary Values**: Test edge cases like exactly 0 items, exactly 1 item, maximum reasonable todo count
-
-## Success Criteria
-
-All test scenarios should pass without:
-- JavaScript console errors
-- Visual layout issues
-- Incorrect counter displays
-- Lost or corrupted todo data
-- Non-functional UI elements
-- Accessibility violations
-
-The application should maintain consistent behavior across all supported browsers and provide a smooth, intuitive user experience for basic todo management operations.
diff --git a/examples/todomvc/specs/basic-operations.plan.md b/examples/todomvc/specs/basic-operations.plan.md
new file mode 100644
index 0000000000..192dde995b
--- /dev/null
+++ b/examples/todomvc/specs/basic-operations.plan.md
@@ -0,0 +1,723 @@
+# TodoMVC Application - Basic Operations Test Plan
+
+## Application Overview
+
+The TodoMVC application is a React-based todo list manager accessible at https://demo.playwright.dev/todomvc. The application provides comprehensive task management functionality with the following features:
+
+- **Task Creation**: Add new todos via input field
+- **Task Completion**: Mark individual todos as complete/incomplete via checkboxes
+- **Task Editing**: Double-click to edit todo text inline
+- **Task Deletion**: Remove individual todos via delete button
+- **Bulk Operations**: Mark all todos as complete/incomplete and clear all completed todos
+- **Filtering**: View todos by All, Active, or Completed status with URL routing support
+- **Counter Display**: Real-time count of active (incomplete) todos
+- **Input Validation**: Prevents empty or whitespace-only todos
+
+## Test Scenarios
+
+### 1. Adding New Todos
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 1.1 Add Single Valid Todo
+
+**File:** `tests/adding-new-todos/add-single-valid-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Click in the "What needs to be done?" input field
+3. Type "Buy groceries"
+4. Press Enter key
+
+**Expected Results:**
+- Todo appears in the list with an unchecked checkbox
+- Todo text displays as "Buy groceries"
+- Counter shows "1 item left"
+- Input field is cleared and ready for next entry
+- "Mark all as complete" checkbox becomes visible
+
+#### 1.2 Add Multiple Todos
+
+**File:** `tests/adding-new-todos/add-multiple-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add first todo: "Buy groceries" (type and press Enter)
+3. Add second todo: "Walk the dog" (type and press Enter)
+4. Add third todo: "Read a book" (type and press Enter)
+
+**Expected Results:**
+- All three todos appear in the list in order of creation
+- Each todo has an unchecked checkbox
+- Counter shows "3 items left" (plural)
+- Input field is cleared after each addition
+
+#### 1.3 Reject Empty Todo
+
+**File:** `tests/adding-new-todos/reject-empty-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Click in the "What needs to be done?" input field
+3. Press Enter without typing any text
+
+**Expected Results:**
+- No todo is added to the list
+- Todo list remains empty
+- Counter is not displayed
+- Input field remains focused
+
+#### 1.4 Reject Whitespace-Only Todo
+
+**File:** `tests/adding-new-todos/reject-whitespace-only-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Click in the "What needs to be done?" input field
+3. Type only spaces (e.g., " ")
+4. Press Enter
+
+**Expected Results:**
+- No todo is added to the list
+- Todo list remains empty
+- Counter is not displayed
+- Input field is cleared
+
+#### 1.5 Add Todo with Special Characters
+
+**File:** `tests/adding-new-todos/add-todo-with-special-characters.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Type "Test with special chars: @#$%^&*()"
+3. Press Enter
+
+**Expected Results:**
+- Todo is successfully added
+- Special characters are displayed correctly
+- Counter shows "1 item left"
+
+#### 1.6 Add Todo with Long Text
+
+**File:** `tests/adding-new-todos/add-todo-with-long-text.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Type a very long text (e.g., "This is a very long todo item to test the character limit and see how the application handles extremely long text inputs that might break the layout or cause other issues")
+3. Press Enter
+
+**Expected Results:**
+- Todo is successfully added
+- Long text is displayed (may wrap or truncate depending on design)
+- Counter shows "1 item left"
+- Layout remains intact
+
+### 2. Completing Todos
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 2.1 Complete Single Todo
+
+**File:** `tests/completing-todos/complete-single-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Click the checkbox next to "Buy groceries"
+
+**Expected Results:**
+- Checkbox becomes checked
+- Todo text may show visual indication of completion (strikethrough or style change)
+- Counter shows "0 items left"
+- "Clear completed" button appears
+- Delete button becomes visible on hover
+
+#### 2.2 Complete Multiple Todos
+
+**File:** `tests/completing-todos/complete-multiple-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Click the checkbox next to "Buy groceries"
+4. Click the checkbox next to "Read a book"
+
+**Expected Results:**
+- Both selected todos show as completed
+- Counter shows "1 item left" (only "Walk the dog" remaining)
+- "Clear completed" button appears
+- One todo remains active
+
+#### 2.3 Uncomplete Todo
+
+**File:** `tests/completing-todos/uncomplete-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Click the checkbox to complete it
+4. Click the checkbox again to uncomplete it
+
+**Expected Results:**
+- Checkbox becomes unchecked
+- Todo returns to active state
+- Counter shows "1 item left"
+- "Clear completed" button disappears
+
+#### 2.4 Mark All as Complete
+
+**File:** `tests/completing-todos/mark-all-as-complete.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Click the "Mark all as complete" checkbox (chevron icon)
+
+**Expected Results:**
+- All todos show as completed
+- All individual checkboxes are checked
+- "Mark all as complete" checkbox is checked
+- Counter shows "0 items left"
+- "Clear completed" button appears
+
+#### 2.5 Unmark All as Complete
+
+**File:** `tests/completing-todos/unmark-all-as-complete.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Click the "Mark all as complete" checkbox to complete all
+4. Click the "Mark all as complete" checkbox again
+
+**Expected Results:**
+- All todos return to active state
+- All individual checkboxes are unchecked
+- "Mark all as complete" checkbox is unchecked
+- Counter shows "3 items left"
+- "Clear completed" button disappears
+
+### 3. Editing Todos
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 3.1 Edit Todo Successfully
+
+**File:** `tests/editing-todos/edit-todo-successfully.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Double-click on the todo text "Buy groceries"
+4. Clear the existing text
+5. Type "Buy groceries and milk"
+6. Press Enter
+
+**Expected Results:**
+- Todo enters edit mode (input field appears)
+- Original text is pre-populated in the edit field
+- After pressing Enter, todo text updates to "Buy groceries and milk"
+- Todo exits edit mode
+- Todo remains in the same state (active/completed)
+
+#### 3.2 Cancel Edit with Escape
+
+**File:** `tests/editing-todos/cancel-edit-with-escape.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Double-click on the todo text
+4. Type "Changed text"
+5. Press Escape key
+
+**Expected Results:**
+- Todo exits edit mode
+- Original text "Buy groceries" is preserved
+- Changes are discarded
+- Todo remains in the same state
+
+#### 3.3 Delete Todo by Clearing Text
+
+**File:** `tests/editing-todos/delete-todo-by-clearing-text.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Double-click on the todo text
+4. Clear all text (delete all characters)
+5. Press Enter
+
+**Expected Results:**
+- Todo is removed from the list
+- Counter decrements appropriately
+- If no todos remain, counter and controls disappear
+
+#### 3.4 Edit Completed Todo
+
+**File:** `tests/editing-todos/edit-completed-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Click the checkbox to complete it
+4. Double-click on the todo text
+5. Type "Buy groceries and milk"
+6. Press Enter
+
+**Expected Results:**
+- Todo enters edit mode
+- Todo text is successfully updated
+- Todo remains in completed state after editing
+- Checkbox remains checked
+
+### 4. Deleting Todos
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 4.1 Delete Single Active Todo
+
+**File:** `tests/deleting-todos/delete-single-active-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Hover over the todo to reveal the delete button
+4. Click the delete button (Γ—)
+
+**Expected Results:**
+- Todo is immediately removed from the list
+- Counter decrements to "0 items left" or disappears
+- Todo list controls disappear if no todos remain
+
+#### 4.2 Delete Single Completed Todo
+
+**File:** `tests/deleting-todos/delete-single-completed-todo.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Click the checkbox to complete it
+4. Hover over the todo to reveal the delete button
+5. Click the delete button (Γ—)
+
+**Expected Results:**
+- Todo is immediately removed from the list
+- "Clear completed" button disappears
+- Todo list controls disappear if no todos remain
+
+#### 4.3 Delete Multiple Todos Individually
+
+**File:** `tests/deleting-todos/delete-multiple-todos-individually.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Delete "Walk the dog" by clicking its delete button
+4. Delete "Buy groceries" by clicking its delete button
+
+**Expected Results:**
+- After first deletion, counter shows "2 items left"
+- After second deletion, counter shows "1 item left"
+- Only "Read a book" remains in the list
+
+#### 4.4 Clear All Completed Todos
+
+**File:** `tests/deleting-todos/clear-all-completed-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Complete "Buy groceries" and "Walk the dog" by clicking their checkboxes
+4. Click the "Clear completed" button
+
+**Expected Results:**
+- Both completed todos are removed from the list
+- Only "Read a book" (active) remains
+- Counter shows "1 item left"
+- "Clear completed" button disappears
+
+#### 4.5 Clear Completed When All Are Completed
+
+**File:** `tests/deleting-todos/clear-completed-when-all-are-completed.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Click "Mark all as complete" checkbox
+4. Click "Clear completed" button
+
+**Expected Results:**
+- All todos are removed from the list
+- Todo list becomes empty
+- Counter and controls disappear
+- Only the input field remains visible
+
+### 5. Filtering Todos
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 5.1 View All Todos (Default)
+
+**File:** `tests/filtering-todos/view-all-todos-default.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Complete "Walk the dog" by clicking its checkbox
+4. Verify the "All" filter is selected by default
+
+**Expected Results:**
+- All three todos are visible (both active and completed)
+- "All" link appears selected/highlighted
+- URL shows "/#/" or "/#"
+- Counter shows "2 items left"
+
+#### 5.2 Filter Active Todos
+
+**File:** `tests/filtering-todos/filter-active-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Complete "Walk the dog" by clicking its checkbox
+4. Click the "Active" filter link
+
+**Expected Results:**
+- Only active todos are visible ("Buy groceries" and "Read a book")
+- Completed todo "Walk the dog" is hidden
+- "Active" link appears selected/highlighted
+- URL changes to "/#/active"
+- Counter shows "2 items left"
+
+#### 5.3 Filter Completed Todos
+
+**File:** `tests/filtering-todos/filter-completed-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Complete "Walk the dog" and "Buy groceries" by clicking their checkboxes
+4. Click the "Completed" filter link
+
+**Expected Results:**
+- Only completed todos are visible ("Walk the dog" and "Buy groceries")
+- Active todo "Read a book" is hidden
+- "Completed" link appears selected/highlighted
+- URL changes to "/#/completed"
+- Counter still shows "1 item left" (total active count)
+- "Clear completed" button is visible
+
+#### 5.4 Switch Between Filters
+
+**File:** `tests/filtering-todos/switch-between-filters.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Complete "Walk the dog"
+4. Click "Active" filter
+5. Click "Completed" filter
+6. Click "All" filter
+
+**Expected Results:**
+- Each filter shows appropriate todos
+- Filter selection updates correctly
+- URL updates with each filter change
+- Counter remains consistent across filter changes
+
+#### 5.5 Add Todo While Filtered
+
+**File:** `tests/filtering-todos/add-todo-while-filtered.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Complete it by clicking its checkbox
+4. Click "Active" filter (should show no todos)
+5. Add a new todo: "Walk the dog"
+
+**Expected Results:**
+- New todo appears in the list (as it's active)
+- Counter updates to "1 item left"
+- Todo is visible because it matches the active filter
+
+#### 5.6 Complete Todo While on Active Filter
+
+**File:** `tests/filtering-todos/complete-todo-while-on-active-filter.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add two todos: "Buy groceries" and "Walk the dog"
+3. Click "Active" filter
+4. Complete "Buy groceries" by clicking its checkbox
+
+**Expected Results:**
+- "Buy groceries" disappears from the active view
+- Only "Walk the dog" remains visible
+- Counter updates to "1 item left"
+- Completed todo is not deleted, just filtered out
+
+#### 5.7 Delete Todo While Filtered
+
+**File:** `tests/filtering-todos/delete-todo-while-filtered.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add two todos: "Buy groceries" and "Walk the dog"
+3. Complete "Buy groceries"
+4. Click "Completed" filter
+5. Delete "Buy groceries" using the delete button
+
+**Expected Results:**
+- "Buy groceries" is removed from the list
+- Completed filter shows no todos
+- Counter shows "1 item left" (for the active todo)
+- "Clear completed" button disappears
+
+### 6. Counter Display
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 6.1 Counter Shows Correct Singular Form
+
+**File:** `tests/counter-display/counter-shows-singular-form.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a single todo: "Buy groceries"
+
+**Expected Results:**
+- Counter displays "1 item left" (singular "item")
+
+#### 6.2 Counter Shows Correct Plural Form
+
+**File:** `tests/counter-display/counter-shows-plural-form.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add two todos: "Buy groceries" and "Walk the dog"
+
+**Expected Results:**
+- Counter displays "2 items left" (plural "items")
+
+#### 6.3 Counter Updates When Completing Todo
+
+**File:** `tests/counter-display/counter-updates-when-completing.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+3. Complete "Walk the dog"
+4. Complete "Buy groceries"
+
+**Expected Results:**
+- Initially shows "3 items left"
+- After first completion shows "2 items left"
+- After second completion shows "1 item left"
+
+#### 6.4 Counter Shows Zero When All Completed
+
+**File:** `tests/counter-display/counter-shows-zero-when-all-completed.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add two todos: "Buy groceries" and "Walk the dog"
+3. Click "Mark all as complete" checkbox
+
+**Expected Results:**
+- Counter displays "0 items left"
+- Counter remains visible even at zero
+
+### 7. UI Controls Visibility
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 7.1 Controls Hidden When No Todos
+
+**File:** `tests/ui-controls-visibility/controls-hidden-when-no-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Verify the initial state with no todos
+
+**Expected Results:**
+- "Mark all as complete" checkbox is not visible
+- Counter is not displayed
+- Filter links are not displayed
+- Only the input field and header are visible
+
+#### 7.2 Controls Appear When First Todo Added
+
+**File:** `tests/ui-controls-visibility/controls-appear-when-first-todo-added.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+
+**Expected Results:**
+- "Mark all as complete" checkbox becomes visible
+- Counter appears showing "1 item left"
+- Filter links (All/Active/Completed) appear
+- Footer with controls is displayed
+
+#### 7.3 Controls Disappear When Last Todo Removed
+
+**File:** `tests/ui-controls-visibility/controls-disappear-when-last-todo-removed.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Delete it using the delete button
+
+**Expected Results:**
+- All controls disappear
+- View returns to initial empty state
+- Only input field remains visible
+
+#### 7.4 Clear Completed Button Visibility
+
+**File:** `tests/ui-controls-visibility/clear-completed-button-visibility.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add two todos: "Buy groceries" and "Walk the dog"
+3. Complete "Buy groceries"
+4. Complete "Walk the dog"
+5. Uncomplete "Walk the dog"
+
+**Expected Results:**
+- "Clear completed" button appears after first completion
+- Button remains visible while at least one todo is completed
+- Button disappears when no todos are completed
+
+### 8. Edge Cases and Error Handling
+
+**Seed:** `tests/seed.spec.ts`
+
+#### 8.1 Rapidly Add Multiple Todos
+
+**File:** `tests/edge-cases/rapidly-add-multiple-todos.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Quickly add 10 todos by typing and pressing Enter rapidly
+
+**Expected Results:**
+- All 10 todos are successfully added
+- Counter shows "10 items left"
+- Todos appear in the order they were added
+- No todos are lost or duplicated
+
+#### 8.2 Rapidly Toggle Todo Completion
+
+**File:** `tests/edge-cases/rapidly-toggle-todo-completion.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Rapidly click the checkbox multiple times (5-10 clicks)
+
+**Expected Results:**
+- Todo state toggles correctly with each click
+- Final state is predictable (checked or unchecked)
+- Counter updates correctly
+- No UI glitches occur
+
+#### 8.3 Edit During Filter View
+
+**File:** `tests/edge-cases/edit-during-filter-view.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Click "Active" filter
+4. Double-click to edit the todo
+5. Change text to "Buy groceries and milk"
+6. Press Enter
+
+**Expected Results:**
+- Todo successfully enters edit mode
+- Edit is saved correctly
+- Todo remains visible in Active filter
+- No filter state is lost
+
+#### 8.4 Navigate Directly to Filtered URL
+
+**File:** `tests/edge-cases/navigate-directly-to-filtered-url.spec.ts`
+
+**Steps:**
+1. Navigate directly to "https://demo.playwright.dev/todomvc/#/active"
+2. Add a todo: "Buy groceries"
+3. Complete it
+
+**Expected Results:**
+- Application loads with Active filter pre-selected
+- New active todo is visible
+- When completed, todo disappears from view
+- Filter state is maintained
+
+#### 8.5 Multiple Browser Tabs (Session Isolation)
+
+**File:** `tests/edge-cases/multiple-browser-tabs-session-isolation.spec.ts`
+
+**Steps:**
+1. Open TodoMVC in first tab
+2. Add a todo: "Buy groceries" in first tab
+3. Open TodoMVC in second tab
+4. Verify todo list in second tab
+
+**Expected Results:**
+- Second tab either shows the same todo (if using persistence) or starts empty (if session-based)
+- Each tab operates independently without conflicts
+- No errors occur from multiple instances
+
+#### 8.6 Hover States Work Correctly
+
+**File:** `tests/edge-cases/hover-states-work-correctly.spec.ts`
+
+**Steps:**
+1. Navigate to the TodoMVC application
+2. Add a todo: "Buy groceries"
+3. Hover over the todo item
+4. Move mouse away
+
+**Expected Results:**
+- Delete button (Γ—) appears on hover
+- Delete button disappears when not hovering
+- Hover state does not interfere with editing or clicking
+
+## Testing Notes
+
+### Assumptions
+- All tests assume a fresh/blank application state at the start (provided by seed file)
+- Tests are designed to be independent and can run in any order
+- No persistence testing is included (refresh behavior not covered)
+
+### Browser Compatibility
+- Tests should be run across all major browsers (Chromium, Firefox, WebKit)
+- UI controls may have slight visual differences across browsers
+
+### Performance Considerations
+- Application should handle at least 100 todos without performance degradation
+- Filtering should be instantaneous even with many todos
+- No memory leaks should occur with repeated operations
+
+### Accessibility Considerations
+- All interactive elements should be keyboard accessible
+- Screen readers should announce todo state changes
+- Focus management should be logical during editing
+
+## Test Coverage Summary
+
+This test plan covers:
+- **47 individual test scenarios** across 8 major functional areas
+- Happy path scenarios for all core features
+- Edge cases and boundary conditions
+- Input validation and error prevention
+- UI state management and visibility
+- Filter functionality and URL routing
+- Counter accuracy and formatting
+- Bulk operations and individual actions
+
+Each test is independent, clearly documented, and designed for automation using Playwright.
diff --git a/examples/todomvc/tests/adding-new-todos/add-multiple-todos.spec.ts b/examples/todomvc/tests/adding-new-todos/add-multiple-todos.spec.ts
new file mode 100644
index 0000000000..234cdb43f0
--- /dev/null
+++ b/examples/todomvc/tests/adding-new-todos/add-multiple-todos.spec.ts
@@ -0,0 +1,34 @@
+// spec: Adding New Todos - should add multiple todos
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Adding New Todos', () => {
+ test('should add multiple todos', async ({ page }) => {
+ // Add first todo: "Buy groceries" (type and press Enter)
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Add second todo: "Walk the dog" (type and press Enter)
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Walk the dog');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Add third todo: "Read a book" (type and press Enter)
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Read a book');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Verify all three todos appear in the list in order of creation
+ await expect(page.locator('body')).toMatchAriaSnapshot(`
+- list:
+ - listitem: "Buy groceries"
+ - listitem: "Walk the dog"
+ - listitem: "Read a book"
+`);
+
+ // Verify counter shows "3 items left" (plural)
+ await expect(page.getByText('3 items left')).toBeVisible();
+
+ // Verify input field is cleared after each addition
+ await expect(page.getByRole('textbox', { name: 'What needs to be done?' })).toHaveValue('');
+ });
+});
diff --git a/examples/todomvc/tests/adding-new-todos/add-single-valid-todo.spec.ts b/examples/todomvc/tests/adding-new-todos/add-single-valid-todo.spec.ts
new file mode 100644
index 0000000000..5ba7c100a8
--- /dev/null
+++ b/examples/todomvc/tests/adding-new-todos/add-single-valid-todo.spec.ts
@@ -0,0 +1,31 @@
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Adding New Todos', () => {
+ test('should add single valid todo', async ({ page }) => {
+ // Click in the "What needs to be done?" input field
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
+
+ // Type "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+
+ // Press Enter key
+ await page.keyboard.press('Enter');
+
+ // Todo appears in the list with an unchecked checkbox
+ await expect(page.getByTestId('todo-item')).toBeVisible();
+
+ // Todo text displays as "Buy groceries"
+ await expect(page.getByText('Buy groceries')).toBeVisible();
+
+ // Counter shows "1 item left"
+ await expect(page.getByText('1 item left')).toBeVisible();
+
+ // Input field is cleared and ready for next entry
+ await expect(page.getByRole('textbox', { name: 'What needs to be done?' })).toHaveValue('');
+
+ // "Mark all as complete" checkbox becomes visible
+ await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/adding-new-todos/add-todo-with-long-text.spec.ts b/examples/todomvc/tests/adding-new-todos/add-todo-with-long-text.spec.ts
new file mode 100644
index 0000000000..b0297040fe
--- /dev/null
+++ b/examples/todomvc/tests/adding-new-todos/add-todo-with-long-text.spec.ts
@@ -0,0 +1,17 @@
+import { test, expect } from '../fixtures';
+
+test.describe('Adding New Todos', () => {
+ test('should add todo with long text', async ({ page }) => {
+ // Type a very long text (e.g., "This is a very long todo item to test the character limit and see how the application handles extremely long text inputs that might break the layout or cause other issues")
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('This is a very long todo item to test the character limit and see how the application handles extremely long text inputs that might break the layout or cause other issues');
+
+ // Press Enter
+ await page.keyboard.press('Enter');
+
+ // Todo is successfully added - Long text is displayed (may wrap or truncate depending on design)
+ await expect(page.getByText('This is a very long todo item to test the character limit and see how the application handles extremely long text inputs that might break the layout or cause other issues')).toBeVisible();
+
+ // Counter shows "1 item left"
+ await expect(page.getByText('1 item left')).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/adding-new-todos/add-todo-with-special-characters.spec.ts b/examples/todomvc/tests/adding-new-todos/add-todo-with-special-characters.spec.ts
new file mode 100644
index 0000000000..0850735af5
--- /dev/null
+++ b/examples/todomvc/tests/adding-new-todos/add-todo-with-special-characters.spec.ts
@@ -0,0 +1,20 @@
+// spec: Adding New Todos - should add todo with special characters
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Adding New Todos', () => {
+ test('should add todo with special characters', async ({ page }) => {
+ // Type "Test with special chars: @#$%^&*()"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Test with special chars: @#$%^&*()');
+
+ // Press Enter
+ await page.keyboard.press('Enter');
+
+ // Verify todo is successfully added and special characters are displayed correctly
+ await expect(page.getByText('Test with special chars: @#$%^&*()')).toBeVisible();
+
+ // Verify counter shows "1 item left"
+ await expect(page.getByText('1 item left')).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/adding-new-todos/reject-empty-todo.spec.ts b/examples/todomvc/tests/adding-new-todos/reject-empty-todo.spec.ts
new file mode 100644
index 0000000000..74edbeb2b6
--- /dev/null
+++ b/examples/todomvc/tests/adding-new-todos/reject-empty-todo.spec.ts
@@ -0,0 +1,21 @@
+// spec: Adding New Todos
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Adding New Todos', () => {
+ test('should reject empty todo', async ({ page }) => {
+ // Click in the "What needs to be done?" input field
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
+
+ // Press Enter without typing any text
+ await page.keyboard.press('Enter');
+
+ // Verify no todo is added to the list and counter is not displayed
+ await expect(page.locator('.todo-list')).not.toBeVisible();
+ await expect(page.locator('.todo-count')).not.toBeVisible();
+
+ // Verify input field remains focused
+ await expect(page.getByRole('textbox', { name: 'What needs to be done?' })).toBeFocused();
+ });
+});
diff --git a/examples/todomvc/tests/adding-new-todos/reject-whitespace-only-todo.spec.ts b/examples/todomvc/tests/adding-new-todos/reject-whitespace-only-todo.spec.ts
new file mode 100644
index 0000000000..3267557aaa
--- /dev/null
+++ b/examples/todomvc/tests/adding-new-todos/reject-whitespace-only-todo.spec.ts
@@ -0,0 +1,31 @@
+// spec: Adding New Todos
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Adding New Todos', () => {
+ test('should reject whitespace-only todo', async ({ page }) => {
+ // 1. Navigate to the TodoMVC application
+ // (handled by seed)
+
+ // 2. Click in the "What needs to be done?" input field
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
+
+ // 3. Type only spaces (e.g., " ")
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill(' ');
+
+ // 4. Press Enter
+ await page.keyboard.press('Enter');
+
+ // Expected Results:
+ // - No todo is added to the list
+ // - Todo list remains empty
+ await expect(page.getByRole('list')).not.toBeVisible();
+
+ // - Counter is not displayed
+ await expect(page.getByText(/\d+ items? left/)).not.toBeVisible();
+
+ // - Input field retains the whitespace (application doesn't clear it)
+ await expect(page.getByRole('textbox', { name: 'What needs to be done?' })).toHaveValue(' ');
+ });
+});
diff --git a/examples/todomvc/tests/completing-todos/complete-multiple-todos.spec.ts b/examples/todomvc/tests/completing-todos/complete-multiple-todos.spec.ts
new file mode 100644
index 0000000000..d3dd381e87
--- /dev/null
+++ b/examples/todomvc/tests/completing-todos/complete-multiple-todos.spec.ts
@@ -0,0 +1,38 @@
+import { test, expect } from '../fixtures';
+
+test.describe('Completing Todos', () => {
+ test('should complete multiple todos', async ({ page }) => {
+ // Add first todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Add second todo: "Walk the dog"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Walk the dog');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Add third todo: "Read a book"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Read a book');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Click the checkbox next to "Buy groceries"
+ await page.getByRole('listitem').filter({ hasText: 'Buy groceries' }).getByLabel('Toggle Todo').click();
+
+ // Click the checkbox next to "Read a book"
+ await page.getByRole('listitem').filter({ hasText: 'Read a book' }).getByLabel('Toggle Todo').click();
+
+ // Verify "Buy groceries" is completed
+ await expect(page.getByRole('listitem').filter({ hasText: 'Buy groceries' }).getByLabel('Toggle Todo')).toBeChecked();
+
+ // Verify "Read a book" is completed
+ await expect(page.getByRole('listitem').filter({ hasText: 'Read a book' }).getByLabel('Toggle Todo')).toBeChecked();
+
+ // Verify counter shows "1 item left"
+ await expect(page.getByText('1 item left')).toBeVisible();
+
+ // Verify "Clear completed" button appears
+ await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
+
+ // Verify "Walk the dog" remains active (unchecked)
+ await expect(page.getByRole('listitem').filter({ hasText: 'Walk the dog' }).getByLabel('Toggle Todo')).not.toBeChecked();
+ });
+});
diff --git a/examples/todomvc/tests/completing-todos/complete-single-todo.spec.ts b/examples/todomvc/tests/completing-todos/complete-single-todo.spec.ts
new file mode 100644
index 0000000000..dee8cb1966
--- /dev/null
+++ b/examples/todomvc/tests/completing-todos/complete-single-todo.spec.ts
@@ -0,0 +1,27 @@
+// spec: Completing Todos - should complete single todo
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Completing Todos', () => {
+ test('should complete single todo', async ({ page }) => {
+ // Add a todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Click the checkbox next to "Buy groceries"
+ await page.getByRole('checkbox', { name: 'Toggle Todo' }).click();
+
+ // Verify checkbox becomes checked
+ await expect(page.getByRole('checkbox', { name: 'Toggle Todo' })).toBeChecked();
+
+ // Verify counter shows "0 items left"
+ await expect(page.getByText('0 items left')).toBeVisible();
+
+ // Verify "Clear completed" button appears
+ await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
+
+ // Verify delete button becomes visible
+ await expect(page.getByRole('button', { name: 'Delete' })).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/completing-todos/mark-all-as-complete.spec.ts b/examples/todomvc/tests/completing-todos/mark-all-as-complete.spec.ts
new file mode 100644
index 0000000000..363d7c2d8f
--- /dev/null
+++ b/examples/todomvc/tests/completing-todos/mark-all-as-complete.spec.ts
@@ -0,0 +1,27 @@
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Completing Todos', () => {
+ test('should mark all as complete', async ({ page }) => {
+ // Add three todos: "Buy groceries", "Walk the dog", "Read a book"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Walk the dog');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Read a book');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Click the "Mark all as complete" checkbox (chevron icon)
+ await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
+
+ // Verify "Mark all as complete" checkbox is checked
+ await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).toBeChecked();
+
+ // Verify counter shows "0 items left"
+ await expect(page.getByText('0')).toBeVisible();
+
+ // Verify "Clear completed" button appears
+ await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/completing-todos/uncomplete-todo.spec.ts b/examples/todomvc/tests/completing-todos/uncomplete-todo.spec.ts
new file mode 100644
index 0000000000..9b26a22cdf
--- /dev/null
+++ b/examples/todomvc/tests/completing-todos/uncomplete-todo.spec.ts
@@ -0,0 +1,24 @@
+// spec: Completing Todos - should uncomplete todo
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Completing Todos', () => {
+ test('should uncomplete todo', async ({ page }) => {
+ // Add a todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Click the checkbox to complete it
+ await page.getByRole('checkbox', { name: 'Toggle Todo' }).click();
+
+ // Click the checkbox again to uncomplete it
+ await page.getByRole('checkbox', { name: 'Toggle Todo' }).click();
+
+ // Verify checkbox becomes unchecked
+ await expect(page.getByRole('checkbox', { name: 'Toggle Todo' })).not.toBeChecked();
+
+ // Verify counter shows "1 item left"
+ await expect(page.getByText('1 item left')).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/completing-todos/unmark-all-as-complete.spec.ts b/examples/todomvc/tests/completing-todos/unmark-all-as-complete.spec.ts
new file mode 100644
index 0000000000..afff06aebe
--- /dev/null
+++ b/examples/todomvc/tests/completing-todos/unmark-all-as-complete.spec.ts
@@ -0,0 +1,37 @@
+// spec: Completing Todos - should unmark all as complete
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Completing Todos', () => {
+ test('should unmark all as complete', async ({ page }) => {
+ // Add first todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Add second todo: "Walk the dog"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Walk the dog');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Add third todo: "Read a book"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Read a book');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Click the "Mark all as complete" checkbox to complete all
+ await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
+
+ // Click the "Mark all as complete" checkbox again
+ await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
+
+ // Verify "Mark all as complete" checkbox is unchecked
+ await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).not.toBeChecked();
+
+ // Verify all individual checkboxes are unchecked
+ await expect(page.getByRole('listitem').filter({ hasText: 'Buy groceries' }).getByLabel('Toggle Todo')).not.toBeChecked();
+ await expect(page.getByRole('listitem').filter({ hasText: 'Walk the dog' }).getByLabel('Toggle Todo')).not.toBeChecked();
+ await expect(page.getByRole('listitem').filter({ hasText: 'Read a book' }).getByLabel('Toggle Todo')).not.toBeChecked();
+
+ // Verify counter shows "3 items left"
+ await expect(page.getByText('3 items left')).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/create/add-empty-todo.spec.ts b/examples/todomvc/tests/create/add-empty-todo.spec.ts
deleted file mode 100644
index 1ed79f985b..0000000000
--- a/examples/todomvc/tests/create/add-empty-todo.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Adding New Todos', () => {
- test('Add Empty Todo (Negative Test)', async ({ page }) => {
- // 1. Click in input field but don't type anything
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
- await todoInput.click();
-
- // 2. Press Enter
- await todoInput.press('Enter');
-
- // Expected Results:
- // - No todo is added to the list
- await expect(page.locator('.todo-list li')).toHaveCount(0);
-
- // - List remains empty
- await expect(page.locator('.todo-list')).not.toBeVisible();
-
- // - No counter appears
- await expect(page.getByText(/\d+ items? left/)).not.toBeVisible();
-
- // - Input field remains focused and empty
- await expect(todoInput).toBeFocused();
- await expect(todoInput).toHaveValue('');
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/create/add-multiple-todos.spec.ts b/examples/todomvc/tests/create/add-multiple-todos.spec.ts
deleted file mode 100644
index a698ca5546..0000000000
--- a/examples/todomvc/tests/create/add-multiple-todos.spec.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Adding New Todos', () => {
- test('Add Multiple Todos', async ({ page }) => {
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
-
- // 1. Add first todo: "Buy groceries" and press Enter
- await todoInput.fill('Buy groceries');
- await todoInput.press('Enter');
-
- // 2. Add second todo: "Walk the dog" and press Enter
- await todoInput.fill('Walk the dog');
- await todoInput.press('Enter');
-
- // 3. Add third todo: "Call dentist" and press Enter
- await todoInput.fill('Call dentist');
- await todoInput.press('Enter');
-
- // Expected Results:
- // - All three todos appear in the list in the order added
- const todoItems = page.getByTestId('todo-item');
- await expect(todoItems).toHaveCount(3);
-
- await expect(todoItems.nth(0)).toContainText('Buy groceries');
- await expect(todoItems.nth(1)).toContainText('Walk the dog');
- await expect(todoItems.nth(2)).toContainText('Call dentist');
-
- // - Counter shows "3 items left"
- await expect(page.getByText('3 items left')).toBeVisible();
-
- // - Each todo has its own unchecked checkbox
- const todoCheckboxes = page.getByRole('checkbox', { name: 'Toggle Todo' });
- await expect(todoCheckboxes).toHaveCount(3);
-
- for (let i = 0; i < 3; i++) {
- await expect(todoCheckboxes.nth(i)).toBeVisible();
- await expect(todoCheckboxes.nth(i)).not.toBeChecked();
- }
-
- // - Input field remains active and cleared after each addition
- await expect(todoInput).toHaveValue('');
- await expect(todoInput).toBeFocused();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/create/add-todo-with-only-whitespace.spec.ts b/examples/todomvc/tests/create/add-todo-with-only-whitespace.spec.ts
deleted file mode 100644
index 6a7b70d89d..0000000000
--- a/examples/todomvc/tests/create/add-todo-with-only-whitespace.spec.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Adding New Todos', () => {
- test('Add Todo with Only Whitespace (Negative Test)', async ({ page }) => {
- // 1. Type only spaces " " in input field
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
- await todoInput.fill(' ');
-
- // 2. Press Enter
- await todoInput.press('Enter');
-
- // Expected Results:
- // - No todo is added to the list
- await expect(page.locator('.todo-list li')).toHaveCount(0);
-
- // - List remains empty
- await expect(page.locator('.todo-list')).not.toBeVisible();
-
- // - Input field retains the whitespace (actual behavior differs from spec)
- await expect(todoInput).toHaveValue(' ');
-
- // - No counter appears
- await expect(page.getByText(/\d+ items? left/)).not.toBeVisible();
-
- // - Input field remains focused
- await expect(todoInput).toBeFocused();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/create/add-todo-with-special-characters.spec.ts b/examples/todomvc/tests/create/add-todo-with-special-characters.spec.ts
deleted file mode 100644
index 3b6bcaf427..0000000000
--- a/examples/todomvc/tests/create/add-todo-with-special-characters.spec.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Adding New Todos', () => {
- test('Add Todo with Special Characters', async ({ page }) => {
- // 1. Type "Buy coffee & donuts (2-3 pieces) @$5.99!" in input field
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
- await todoInput.fill('Buy coffee & donuts (2-3 pieces) @$5.99!');
-
- // 2. Press Enter
- await todoInput.press('Enter');
-
- // Expected Results:
- // - Todo appears exactly as typed with all special characters preserved
- await expect(page.getByText('Buy coffee & donuts (2-3 pieces) @$5.99!')).toBeVisible();
-
- // - Counter shows "1 item left"
- await expect(page.getByText('1 item left')).toBeVisible();
-
- // - No encoding or display issues with special characters
- const todoCheckbox = page.getByRole('checkbox', { name: 'Toggle Todo' });
- await expect(todoCheckbox).toBeVisible();
- await expect(todoCheckbox).not.toBeChecked();
-
- // Verify input field is cleared
- await expect(todoInput).toHaveValue('');
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/create/add-valid-todo.spec.ts b/examples/todomvc/tests/create/add-valid-todo.spec.ts
deleted file mode 100644
index 0353dba82e..0000000000
--- a/examples/todomvc/tests/create/add-valid-todo.spec.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Adding New Todos', () => {
- test('Add Valid Todo', async ({ page }) => {
- // 1. Click in the "What needs to be done?" input field
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
- await todoInput.click();
-
- // 2. Type "Buy groceries"
- await todoInput.fill('Buy groceries');
-
- // 3. Press Enter key
- await todoInput.press('Enter');
-
- // Expected Results:
- // - Todo appears in the list with unchecked checkbox
- await expect(page.getByText('Buy groceries')).toBeVisible();
- const todoCheckbox = page.getByRole('checkbox', { name: 'Toggle Todo' });
- await expect(todoCheckbox).toBeVisible();
- await expect(todoCheckbox).not.toBeChecked();
-
- // - Counter shows "1 item left"
- await expect(page.getByText('1 item left')).toBeVisible();
-
- // - Input field is cleared and ready for next entry
- await expect(todoInput).toHaveValue('');
- await expect(todoInput).toBeFocused();
-
- // - Todo list controls become visible (Mark all as complete checkbox)
- await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).toBeVisible();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/edit/cancel-edit-with-escape.spec.ts b/examples/todomvc/tests/edit/cancel-edit-with-escape.spec.ts
deleted file mode 100644
index 9fc5ad164b..0000000000
--- a/examples/todomvc/tests/edit/cancel-edit-with-escape.spec.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Editing Todos', () => {
- test('Cancel Edit with Escape', async ({ page }) => {
- // 1. Add todo "Buy groceries"
- await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- // Verify todo was added
- await expect(page.getByTestId('todo-title')).toHaveText('Buy groceries');
- await expect(page.locator('.todo-count')).toHaveText('1 item left');
-
- // 2. Double-click on the todo text
- await page.getByTestId('todo-title').dblclick();
-
- // Verify todo enters edit mode with text selected
- const editInput = page.getByRole('textbox', { name: 'Edit' });
- await expect(editInput).toBeVisible();
- await expect(editInput).toHaveValue('Buy groceries');
- await expect(editInput).toBeFocused();
-
- // 3. Change text to "Buy organic groceries"
- await editInput.fill('Buy organic groceries');
-
- // Verify text was changed in edit input
- await expect(editInput).toHaveValue('Buy organic groceries');
-
- // 4. Press Escape key
- await page.keyboard.press('Escape');
-
- // Expected results:
- // - Todo exits edit mode
- await expect(editInput).not.toBeVisible();
-
- // - Text reverts to original "Buy groceries"
- await expect(page.getByTestId('todo-title')).toHaveText('Buy groceries');
-
- // - No changes are saved (verified by text reversion above)
- // - Todo remains in its original state
- await expect(page.locator('.todo-count')).toHaveText('1 item left');
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/edit/edit-multiple-todos.spec.ts b/examples/todomvc/tests/edit/edit-multiple-todos.spec.ts
deleted file mode 100644
index 643921ed7d..0000000000
--- a/examples/todomvc/tests/edit/edit-multiple-todos.spec.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Editing Todos', () => {
- test('Edit Multiple Todos', async ({ page }) => {
- // 1. Add todos: "Buy groceries", "Walk the dog"
- await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Walk the dog');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- // Verify both todos were added
- await expect(page.getByText('Buy groceries')).toBeVisible();
- await expect(page.getByText('Walk the dog')).toBeVisible();
- await expect(page.locator('.todo-count')).toHaveText('2 items left');
-
- // 2. Double-click "Buy groceries", change to "Buy organic groceries", press Enter
- await page.getByText('Buy groceries').dblclick();
-
- const editInput = page.getByRole('textbox', { name: 'Edit' });
- await expect(editInput).toBeVisible();
- await expect(editInput).toHaveValue('Buy groceries');
-
- await editInput.fill('Buy organic groceries');
- await page.keyboard.press('Enter');
-
- // 3. Double-click "Walk the dog", change to "Walk the cat", press Enter
- await page.getByText('Walk the dog').dblclick();
-
- const editInput2 = page.getByRole('textbox', { name: 'Edit' });
- await expect(editInput2).toBeVisible();
- await expect(editInput2).toHaveValue('Walk the dog');
-
- await editInput2.fill('Walk the cat');
- await page.keyboard.press('Enter');
-
- // Expected results:
- // - Both todos are updated with new text
- await expect(page.getByText('Buy organic groceries')).toBeVisible();
- await expect(page.getByText('Walk the cat')).toBeVisible();
-
- // - Counter remains "2 items left"
- await expect(page.locator('.todo-count')).toHaveText('2 items left');
-
- // - Both todos maintain their completion state (uncompleted)
- const todo1Checkbox = page.getByText('Buy organic groceries').locator('..').getByRole('checkbox', { name: 'Toggle Todo' });
- const todo2Checkbox = page.getByText('Walk the cat').locator('..').getByRole('checkbox', { name: 'Toggle Todo' });
-
- await expect(todo1Checkbox).not.toBeChecked();
- await expect(todo2Checkbox).not.toBeChecked();
-
- // Verify edit inputs are no longer visible
- await expect(editInput).not.toBeVisible();
- await expect(editInput2).not.toBeVisible();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/edit/edit-todo-text.spec.ts b/examples/todomvc/tests/edit/edit-todo-text.spec.ts
deleted file mode 100644
index f0629ba745..0000000000
--- a/examples/todomvc/tests/edit/edit-todo-text.spec.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Editing Todos', () => {
- test('Edit Todo Text', async ({ page }) => {
- // 1. Add todo "Buy groceries"
- await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- // Verify todo was added
- await expect(page.getByTestId('todo-title')).toHaveText('Buy groceries');
- await expect(page.locator('.todo-count')).toHaveText('1 item left');
-
- // 2. Double-click on the todo text "Buy groceries"
- await page.getByTestId('todo-title').dblclick();
-
- // Verify todo enters edit mode with text selected
- const editInput = page.getByRole('textbox', { name: 'Edit' });
- await expect(editInput).toBeVisible();
- await expect(editInput).toHaveValue('Buy groceries');
- await expect(editInput).toBeFocused();
-
- // 3. Clear text and type "Buy organic groceries"
- await editInput.fill('Buy organic groceries');
-
- // 4. Press Enter
- await page.keyboard.press('Enter');
-
- // Expected results:
- // - Text changes to "Buy organic groceries"
- await expect(page.getByTestId('todo-title')).toHaveText('Buy organic groceries');
-
- // - Todo exits edit mode
- await expect(editInput).not.toBeVisible();
-
- // - Counter remains "1 item left"
- await expect(page.locator('.todo-count')).toHaveText('1 item left');
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/edit/edit-todo-to-empty-text.spec.ts b/examples/todomvc/tests/edit/edit-todo-to-empty-text.spec.ts
deleted file mode 100644
index 961e3e3921..0000000000
--- a/examples/todomvc/tests/edit/edit-todo-to-empty-text.spec.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Editing Todos', () => {
- test('Edit Todo to Empty Text (Negative Test)', async ({ page }) => {
- // 1. Add todo "Buy groceries"
- await page.getByRole('textbox', { name: 'What needs to be done?' }).click();
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- // Verify todo was added
- await expect(page.getByTestId('todo-title')).toHaveText('Buy groceries');
- await expect(page.locator('.todo-count')).toHaveText('1 item left');
-
- // 2. Double-click on the todo text
- await page.getByTestId('todo-title').dblclick();
-
- // Verify todo enters edit mode
- const editInput = page.getByRole('textbox', { name: 'Edit' });
- await expect(editInput).toBeVisible();
- await expect(editInput).toHaveValue('Buy groceries');
-
- // 3. Clear all text
- await editInput.fill('');
-
- // 4. Press Enter
- await page.keyboard.press('Enter');
-
- // Expected results:
- // - Todo should be deleted/removed from list
- await expect(page.getByTestId('todo-title')).not.toBeVisible();
-
- // - Counter decrements appropriately (disappears when no todos)
- await expect(page.locator('.todo-count')).not.toBeVisible();
-
- // - List becomes empty if this was the only todo
- await expect(page.locator('.todo-list')).not.toBeVisible();
-
- // - Only the main input should remain visible
- await expect(page.getByRole('textbox', { name: 'What needs to be done?' })).toBeVisible();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/editing-todos/cancel-edit-with-escape.spec.ts b/examples/todomvc/tests/editing-todos/cancel-edit-with-escape.spec.ts
new file mode 100644
index 0000000000..9a7d57f07c
--- /dev/null
+++ b/examples/todomvc/tests/editing-todos/cancel-edit-with-escape.spec.ts
@@ -0,0 +1,24 @@
+// spec: Editing Todos - Cancel edit with escape
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Editing Todos', () => {
+ test('should cancel edit with escape', async ({ page }) => {
+ // Add a todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Double-click on the todo text
+ await page.getByTestId('todo-title').dblclick();
+
+ // Type "Changed text"
+ await page.getByRole('textbox', { name: 'Edit' }).fill('Changed text');
+
+ // Press Escape key
+ await page.keyboard.press('Escape');
+
+ // Verify original text "Buy groceries" is preserved
+ await expect(page.getByText('Buy groceries')).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/editing-todos/delete-todo-by-clearing-text.spec.ts b/examples/todomvc/tests/editing-todos/delete-todo-by-clearing-text.spec.ts
new file mode 100644
index 0000000000..312002502d
--- /dev/null
+++ b/examples/todomvc/tests/editing-todos/delete-todo-by-clearing-text.spec.ts
@@ -0,0 +1,24 @@
+// spec: Editing Todos - should delete todo by clearing text
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Editing Todos', () => {
+ test('should delete todo by clearing text', async ({ page }) => {
+ // Add a todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Double-click on the todo text
+ await page.getByTestId('todo-title').dblclick();
+
+ // Clear all text (delete all characters)
+ await page.getByRole('textbox', { name: 'Edit' }).fill('');
+
+ // Press Enter
+ await page.keyboard.press('Enter');
+
+ // Verify the input field is still visible
+ await expect(page.getByRole('textbox', { name: 'What needs to be done?' })).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/editing-todos/edit-completed-todo.spec.ts b/examples/todomvc/tests/editing-todos/edit-completed-todo.spec.ts
new file mode 100644
index 0000000000..20d79b95d6
--- /dev/null
+++ b/examples/todomvc/tests/editing-todos/edit-completed-todo.spec.ts
@@ -0,0 +1,28 @@
+// spec: Editing Todos - Edit Completed Todo
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Editing Todos', () => {
+ test('should edit completed todo', async ({ page }) => {
+ // Add a todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Click the checkbox to complete it
+ await page.getByRole('checkbox', { name: 'Toggle Todo' }).click();
+
+ // Double-click on the todo text
+ await page.getByTestId('todo-title').dblclick();
+
+ // Type "Buy groceries and milk" and press Enter
+ await page.getByRole('textbox', { name: 'Edit' }).fill('Buy groceries and milk');
+ await page.getByRole('textbox', { name: 'Edit' }).press('Enter');
+
+ // Verify todo text is successfully updated
+ await expect(page.getByText('Buy groceries and milk')).toBeVisible();
+
+ // Verify checkbox remains checked (todo remains in completed state)
+ await expect(page.getByRole('checkbox', { name: 'Toggle Todo' })).toBeChecked();
+ });
+});
diff --git a/examples/todomvc/tests/editing-todos/edit-todo-successfully.spec.ts b/examples/todomvc/tests/editing-todos/edit-todo-successfully.spec.ts
new file mode 100644
index 0000000000..a9e9fcbfe0
--- /dev/null
+++ b/examples/todomvc/tests/editing-todos/edit-todo-successfully.spec.ts
@@ -0,0 +1,24 @@
+// spec: Editing Todos - should edit todo successfully
+// seed: tests/seed.spec.ts
+
+import { test, expect } from '../fixtures';
+
+test.describe('Editing Todos', () => {
+ test('should edit todo successfully', async ({ page }) => {
+ // Add a todo: "Buy groceries"
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
+ await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
+
+ // Double-click on the todo text "Buy groceries"
+ await page.getByTestId('todo-title').dblclick();
+
+ // Clear the existing text and type "Buy groceries and milk"
+ await page.getByRole('textbox', { name: 'Edit' }).fill('Buy groceries and milk');
+
+ // Press Enter to save the edited todo
+ await page.keyboard.press('Enter');
+
+ // Verify that todo text updates to "Buy groceries and milk"
+ await expect(page.getByText('Buy groceries and milk')).toBeVisible();
+ });
+});
diff --git a/examples/todomvc/tests/integration.spec.ts b/examples/todomvc/tests/integration.spec.ts
deleted file mode 100644
index f41b0a2d58..0000000000
--- a/examples/todomvc/tests/integration.spec.ts
+++ /dev/null
@@ -1,427 +0,0 @@
-/* eslint-disable notice/notice */
-
-import { test, expect } from './fixtures';
-import type { Page } from '@playwright/test';
-
-test.describe.configure({ mode: 'parallel' });
-
-const TODO_ITEMS = [
- 'buy some cheese',
- 'feed the cat',
- 'book a doctors appointment'
-];
-
-test.describe('New Todo', () => {
- test('should allow me to add todo items', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
- // Create 1st todo.
- await newTodo.fill(TODO_ITEMS[0]);
- await newTodo.press('Enter');
-
- // Make sure the list only has one todo item.
- await expect(page.getByTestId('todo-title')).toHaveText([
- TODO_ITEMS[0]
- ]);
-
- // Create 2nd todo.
- await newTodo.fill(TODO_ITEMS[1]);
- await newTodo.press('Enter');
-
- // Make sure the list now has two todo items.
- await expect(page.getByTestId('todo-title')).toHaveText([
- TODO_ITEMS[0],
- TODO_ITEMS[1],
- ]);
-
- await checkNumberOfTodosInLocalStorage(page, 2);
- });
-
- test('should clear text input field when an item is added', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- // Create one todo item.
- await newTodo.fill(TODO_ITEMS[0]);
- await newTodo.press('Enter');
-
- // Check that input is empty.
- await expect(newTodo).toBeEmpty();
- await checkNumberOfTodosInLocalStorage(page, 1);
- });
-
- test('should append new items to the bottom of the list', async ({ page }) => {
- // Create 3 items.
- await createDefaultTodos(page);
-
- // Check test using different methods.
- await expect(page.getByText('3 items left')).toBeVisible();
- await expect(page.getByTestId('todo-count')).toHaveText('3 items left');
- await expect(page.getByTestId('todo-count')).toContainText('3');
- await expect(page.getByTestId('todo-count')).toHaveText(/3/);
-
- // Check all items in one call.
- await expect(page.getByTestId('todo-title')).toHaveText(TODO_ITEMS);
- await checkNumberOfTodosInLocalStorage(page, 3);
- });
-
- test('should show #main and #footer when items added', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- await newTodo.fill(TODO_ITEMS[0]);
- await newTodo.press('Enter');
-
- await expect(page.locator('.main')).toBeVisible();
- await expect(page.locator('.footer')).toBeVisible();
- await checkNumberOfTodosInLocalStorage(page, 1);
- });
-});
-
-test.describe('Mark all as completed', () => {
- test.beforeEach(async ({ page }) => {
- await createDefaultTodos(page);
- await checkNumberOfTodosInLocalStorage(page, 3);
- });
-
- test.afterEach(async ({ page }) => {
- await checkNumberOfTodosInLocalStorage(page, 3);
- });
-
- test('should allow me to mark all items as completed', async ({ page }) => {
- // Complete all todos.
- await page.getByLabel('Mark all as complete').check();
-
- // Ensure all todos have 'completed' class.
- await expect(page.getByTestId('todo-item')).toHaveClass(['completed', 'completed', 'completed']);
- await checkNumberOfCompletedTodosInLocalStorage(page, 3);
- });
-
- test('should allow me to clear the complete state of all items', async ({ page }) => {
- const toggleAll = page.getByLabel('Mark all as complete');
- // Check and then immediately uncheck.
- await toggleAll.check();
- await toggleAll.uncheck();
-
- // Should be no completed classes.
- await expect(page.getByTestId('todo-item')).toHaveClass(['', '', '']);
- });
-
- test('complete all checkbox should update state when items are completed / cleared', async ({ page }) => {
- const toggleAll = page.getByLabel('Mark all as complete');
- await toggleAll.check();
- await expect(toggleAll).toBeChecked();
- await checkNumberOfCompletedTodosInLocalStorage(page, 3);
-
- // Uncheck first todo.
- const firstTodo = page.getByTestId('todo-item').nth(0);
- await firstTodo.getByRole('checkbox').uncheck();
-
- // Reuse toggleAll locator and make sure its not checked.
- await expect(toggleAll).not.toBeChecked();
-
- await firstTodo.getByRole('checkbox').check();
- await checkNumberOfCompletedTodosInLocalStorage(page, 3);
-
- // Assert the toggle all is checked again.
- await expect(toggleAll).toBeChecked();
- });
-});
-
-test.describe('Item', () => {
-
- test('should allow me to mark items as complete', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- // Create two items.
- for (const item of TODO_ITEMS.slice(0, 2)) {
- await newTodo.fill(item);
- await newTodo.press('Enter');
- }
-
- // Check first item.
- const firstTodo = page.getByTestId('todo-item').nth(0);
- await firstTodo.getByRole('checkbox').check();
- await expect(firstTodo).toHaveClass('completed');
-
- // Check second item.
- const secondTodo = page.getByTestId('todo-item').nth(1);
- await expect(secondTodo).not.toHaveClass('completed');
- await secondTodo.getByRole('checkbox').check();
-
- // Assert completed class.
- await expect(firstTodo).toHaveClass('completed');
- await expect(secondTodo).toHaveClass('completed');
- });
-
- test('should allow me to un-mark items as complete', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- // Create two items.
- for (const item of TODO_ITEMS.slice(0, 2)) {
- await newTodo.fill(item);
- await newTodo.press('Enter');
- }
-
- const firstTodo = page.getByTestId('todo-item').nth(0);
- const secondTodo = page.getByTestId('todo-item').nth(1);
- await firstTodo.getByRole('checkbox').check();
- await expect(firstTodo).toHaveClass('completed');
- await expect(secondTodo).not.toHaveClass('completed');
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
-
- await firstTodo.getByRole('checkbox').uncheck();
- await expect(firstTodo).not.toHaveClass('completed');
- await expect(secondTodo).not.toHaveClass('completed');
- await checkNumberOfCompletedTodosInLocalStorage(page, 0);
- });
-
- test('should allow me to edit an item', async ({ page }) => {
- await createDefaultTodos(page);
-
- const todoItems = page.getByTestId('todo-item');
- const secondTodo = todoItems.nth(1);
- await secondTodo.dblclick();
- await expect(secondTodo.getByRole('textbox', { name: 'Edit' })).toHaveValue(TODO_ITEMS[1]);
- await secondTodo.getByRole('textbox', { name: 'Edit' }).fill('buy some sausages');
- await secondTodo.getByRole('textbox', { name: 'Edit' }).press('Enter');
-
- // Explicitly assert the new text value.
- await expect(todoItems).toHaveText([
- TODO_ITEMS[0],
- 'buy some sausages',
- TODO_ITEMS[2]
- ]);
- await checkTodosInLocalStorage(page, 'buy some sausages');
- });
-});
-
-test.describe('Editing', () => {
- test.beforeEach(async ({ page }) => {
- await createDefaultTodos(page);
- await checkNumberOfTodosInLocalStorage(page, 3);
- });
-
- test('should hide other controls when editing', async ({ page }) => {
- const todoItem = page.getByTestId('todo-item').nth(1);
- await todoItem.dblclick();
- await expect(todoItem.getByRole('checkbox')).not.toBeVisible();
- await expect(todoItem.locator('label', {
- hasText: TODO_ITEMS[1],
- })).not.toBeVisible();
- await checkNumberOfTodosInLocalStorage(page, 3);
- });
-
- test('should save edits on blur', async ({ page }) => {
- const todoItems = page.getByTestId('todo-item');
- await todoItems.nth(1).dblclick();
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).fill('buy some sausages');
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).dispatchEvent('blur');
-
- await expect(todoItems).toHaveText([
- TODO_ITEMS[0],
- 'buy some sausages',
- TODO_ITEMS[2],
- ]);
- await checkTodosInLocalStorage(page, 'buy some sausages');
- });
-
- test('should trim entered text', async ({ page }) => {
- const todoItems = page.getByTestId('todo-item');
- await todoItems.nth(1).dblclick();
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).fill(' buy some sausages ');
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).press('Enter');
-
- await expect(todoItems).toHaveText([
- TODO_ITEMS[0],
- 'buy some sausages',
- TODO_ITEMS[2],
- ]);
- await checkTodosInLocalStorage(page, 'buy some sausages');
- });
-
- test('should remove the item if an empty text string was entered', async ({ page }) => {
- const todoItems = page.getByTestId('todo-item');
- await todoItems.nth(1).dblclick();
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).fill('');
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).press('Enter');
-
- await expect(todoItems).toHaveText([
- TODO_ITEMS[0],
- TODO_ITEMS[2],
- ]);
- });
-
- test('should cancel edits on escape', async ({ page }) => {
- const todoItems = page.getByTestId('todo-item');
- await todoItems.nth(1).dblclick();
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).fill('buy some sausages');
- await todoItems.nth(1).getByRole('textbox', { name: 'Edit' }).press('Escape');
- await expect(todoItems).toHaveText(TODO_ITEMS);
- });
-});
-
-test.describe('Counter', () => {
- test('should display the current number of todo items', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- await newTodo.fill(TODO_ITEMS[0]);
- await newTodo.press('Enter');
- await expect(page.getByTestId('todo-count')).toContainText('1');
-
- await newTodo.fill(TODO_ITEMS[1]);
- await newTodo.press('Enter');
- await expect(page.getByTestId('todo-count')).toContainText('2');
-
- await checkNumberOfTodosInLocalStorage(page, 2);
- });
-});
-
-test.describe('Clear completed button', () => {
- test.beforeEach(async ({ page }) => {
- await createDefaultTodos(page);
- });
-
- test('should display the correct text', async ({ page }) => {
- await page.locator('.todo-list li .toggle').first().check();
- await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
- });
-
- test('should remove completed items when clicked', async ({ page }) => {
- const todoItems = page.getByTestId('todo-item');
- await todoItems.nth(1).getByRole('checkbox').check();
- await page.getByRole('button', { name: 'Clear completed' }).click();
- await expect(todoItems).toHaveCount(2);
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);
- });
-
- test('should be hidden when there are no items that are completed', async ({ page }) => {
- await page.locator('.todo-list li .toggle').first().check();
- await page.getByRole('button', { name: 'Clear completed' }).click();
- await expect(page.getByRole('button', { name: 'Clear completed' })).toBeHidden();
- });
-});
-
-test.describe('Persistence', () => {
- test('should persist its data', async ({ page }) => {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- for (const item of TODO_ITEMS.slice(0, 2)) {
- await newTodo.fill(item);
- await newTodo.press('Enter');
- }
-
- const todoItems = page.getByTestId('todo-item');
- await todoItems.nth(0).getByRole('checkbox').check();
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]);
- await expect(todoItems).toHaveClass(['completed', '']);
-
- // Ensure there is 1 completed item.
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
-
- // Now reload.
- await page.reload();
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]);
- await expect(todoItems).toHaveClass(['completed', '']);
- });
-});
-
-test.describe('Routing', () => {
- test.beforeEach(async ({ page }) => {
- await createDefaultTodos(page);
- // make sure the app had a chance to save updated todos in storage
- // before navigating to a new view, otherwise the items can get lost :(
- // in some frameworks like Durandal
- await checkTodosInLocalStorage(page, TODO_ITEMS[0]);
- });
-
- test('should allow me to display active items', async ({ page }) => {
- await page.locator('.todo-list li .toggle').nth(1).check();
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
- await page.getByRole('link', { name: 'Active' }).click();
- await expect(page.getByTestId('todo-item')).toHaveCount(2);
- await expect(page.getByTestId('todo-item')).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);
- });
-
- test('should respect the back button', async ({ page }) => {
- await page.locator('.todo-list li .toggle').nth(1).check();
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
-
- await test.step('Showing all items', async () => {
- await page.getByRole('link', { name: 'All' }).click();
- await expect(page.getByTestId('todo-item')).toHaveCount(3);
- });
-
- await test.step('Showing active items', async () => {
- await page.getByRole('link', { name: 'Active' }).click();
- });
-
- await test.step('Showing completed items', async () => {
- await page.getByRole('link', { name: 'Completed' }).click();
- });
-
- await expect(page.getByTestId('todo-item')).toHaveCount(1);
- await page.goBack();
- await expect(page.getByTestId('todo-item')).toHaveCount(2);
- await page.goBack();
- await expect(page.getByTestId('todo-item')).toHaveCount(3);
- });
-
- test('should allow me to display completed items', async ({ page }) => {
- await page.locator('.todo-list li .toggle').nth(1).check();
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
- await page.getByRole('link', { name: 'Completed' }).click();
- await expect(page.getByTestId('todo-item')).toHaveCount(1);
- });
-
- test('should allow me to display all items', async ({ page }) => {
- await page.locator('.todo-list li .toggle').nth(1).check();
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
- await page.getByRole('link', { name: 'Active' }).click();
- await page.getByRole('link', { name: 'Completed' }).click();
- await page.getByRole('link', { name: 'All' }).click();
- await expect(page.getByTestId('todo-item')).toHaveCount(3);
- });
-
- test('should highlight the currently applied filter', async ({ page }) => {
- await expect(page.getByRole('link', { name: 'All' })).toHaveClass('selected');
- await page.getByRole('link', { name: 'Active' }).click();
- // Page change - active items.
- await expect(page.getByRole('link', { name: 'Active' })).toHaveClass('selected');
- await page.getByRole('link', { name: 'Completed' }).click();
- // Page change - completed items.
- await expect(page.getByRole('link', { name: 'Completed' })).toHaveClass('selected');
- });
-});
-
-async function createDefaultTodos(page) {
- // create a new todo locator
- const newTodo = page.getByPlaceholder('What needs to be done?');
-
- for (const item of TODO_ITEMS) {
- await newTodo.fill(item);
- await newTodo.press('Enter');
- }
-}
-
-async function checkNumberOfTodosInLocalStorage(page: Page, expected: number) {
- return await page.waitForFunction(e => {
- return JSON.parse(localStorage['react-todos']).length === e;
- }, expected);
-}
-
-async function checkNumberOfCompletedTodosInLocalStorage(page: Page, expected: number) {
- return await page.waitForFunction(e => {
- return JSON.parse(localStorage['react-todos']).filter((todo: any) => todo.completed).length === e;
- }, expected);
-}
-
-async function checkTodosInLocalStorage(page: Page, title: string) {
- return await page.waitForFunction(t => {
- return JSON.parse(localStorage['react-todos']).map((todo: any) => todo.title).includes(t);
- }, title);
-}
diff --git a/examples/todomvc/tests/toggle/mark-all-todos-complete.spec.ts b/examples/todomvc/tests/toggle/mark-all-todos-complete.spec.ts
deleted file mode 100644
index 3bd89cb4df..0000000000
--- a/examples/todomvc/tests/toggle/mark-all-todos-complete.spec.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Marking Todos Complete/Incomplete', () => {
- test('Mark All Todos Complete', async ({ page }) => {
- // 1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
- const newTodoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
-
- await newTodoInput.fill('Buy groceries');
- await newTodoInput.press('Enter');
-
- await newTodoInput.fill('Walk the dog');
- await newTodoInput.press('Enter');
-
- await newTodoInput.fill('Call dentist');
- await newTodoInput.press('Enter');
-
- // 2. Click the "Mark all as complete" checkbox
- await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
-
- // Expected results to verify:
- // - All todo checkboxes become checked
- const todoCheckboxes = page.getByRole('checkbox', { name: 'Toggle Todo' });
- await expect(todoCheckboxes.nth(0)).toBeChecked();
- await expect(todoCheckboxes.nth(1)).toBeChecked();
- await expect(todoCheckboxes.nth(2)).toBeChecked();
-
- // - Counter shows "0 items left"
- await expect(page.getByText('0 items left')).toBeVisible();
-
- // - "Clear completed" button appears
- await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
-
- // - "Mark all as complete" checkbox shows as checked
- await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).toBeChecked();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/toggle/mark-multiple-todos-complete.spec.ts b/examples/todomvc/tests/toggle/mark-multiple-todos-complete.spec.ts
deleted file mode 100644
index 4a6ed1a2da..0000000000
--- a/examples/todomvc/tests/toggle/mark-multiple-todos-complete.spec.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Marking Todos Complete/Incomplete', () => {
- test('Mark Multiple Todos Complete', async ({ page }) => {
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
-
- // 1. Add todos: "Buy groceries", "Walk the dog", "Call dentist"
- await todoInput.click();
- await todoInput.fill('Buy groceries');
- await todoInput.press('Enter');
-
- await todoInput.fill('Walk the dog');
- await todoInput.press('Enter');
-
- await todoInput.fill('Call dentist');
- await todoInput.press('Enter');
-
- // Verify all todos are added
- await expect(page.getByText('3 items left')).toBeVisible();
-
- // 2. Click checkbox for "Buy groceries"
- await page.getByRole('listitem').filter({ hasText: 'Buy groceries' }).getByLabel('Toggle Todo').click();
-
- // 3. Click checkbox for "Call dentist"
- await page.getByRole('listitem').filter({ hasText: 'Call dentist' }).getByLabel('Toggle Todo').click();
-
- // Expected Results:
- // - Two todos show as completed
- const buyGroceriesCheckbox = page.getByRole('listitem').filter({ hasText: 'Buy groceries' }).getByLabel('Toggle Todo');
- const callDentistCheckbox = page.getByRole('listitem').filter({ hasText: 'Call dentist' }).getByLabel('Toggle Todo');
- const walkDogCheckbox = page.getByRole('listitem').filter({ hasText: 'Walk the dog' }).getByLabel('Toggle Todo');
-
- await expect(buyGroceriesCheckbox).toBeChecked();
- await expect(callDentistCheckbox).toBeChecked();
-
- // - Counter shows "1 item left" (for "Walk the dog")
- await expect(page.getByText('1 item left')).toBeVisible();
-
- // - "Clear completed" button appears
- await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
-
- // - Only "Walk the dog" remains unchecked
- await expect(walkDogCheckbox).not.toBeChecked();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/toggle/mark-single-todo-complete.spec.ts b/examples/todomvc/tests/toggle/mark-single-todo-complete.spec.ts
deleted file mode 100644
index b76a25f412..0000000000
--- a/examples/todomvc/tests/toggle/mark-single-todo-complete.spec.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Marking Todos Complete/Incomplete', () => {
- test('Mark Single Todo Complete', async ({ page }) => {
- // 1. Add todo "Buy groceries"
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
- await todoInput.click();
- await todoInput.fill('Buy groceries');
- await todoInput.press('Enter');
-
- // Verify todo was added successfully
- await expect(page.getByText('Buy groceries')).toBeVisible();
- await expect(page.getByText('1 item left')).toBeVisible();
-
- // 2. Click the checkbox next to "Buy groceries"
- const todoCheckbox = page.getByRole('checkbox', { name: 'Toggle Todo' });
- await todoCheckbox.click();
-
- // Expected Results:
- // - Checkbox becomes checked
- await expect(todoCheckbox).toBeChecked();
-
- // - Todo text may show strikethrough or completed styling (verified by checking the todo is still visible)
- await expect(page.getByText('Buy groceries')).toBeVisible();
-
- // - Counter shows "0 items left"
- await expect(page.getByText('0 items left')).toBeVisible();
-
- // - "Clear completed" button appears
- await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
-
- // - Delete button (Γ—) becomes visible on hover
- await page.getByText('Buy groceries').hover();
- await expect(page.getByRole('button', { name: 'Delete' })).toBeVisible();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/toggle/toggle-all-todos-incomplete.spec.ts b/examples/todomvc/tests/toggle/toggle-all-todos-incomplete.spec.ts
deleted file mode 100644
index 11ec10d227..0000000000
--- a/examples/todomvc/tests/toggle/toggle-all-todos-incomplete.spec.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Marking Todos Complete/Incomplete', () => {
- test('Toggle All Todos Back to Incomplete', async ({ page }) => {
- // 1. Add todos: "Buy groceries", "Walk the dog"
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Buy groceries');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- await page.getByRole('textbox', { name: 'What needs to be done?' }).fill('Walk the dog');
- await page.getByRole('textbox', { name: 'What needs to be done?' }).press('Enter');
-
- // 2. Click "Mark all as complete" checkbox
- await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
-
- // 3. Click "Mark all as complete" checkbox again
- await page.getByRole('checkbox', { name: '❯Mark all as complete' }).click();
-
- // Verify: All todo checkboxes become unchecked
- const buyGroceriesCheckbox = page.getByRole('listitem').filter({ hasText: 'Buy groceries' }).getByRole('checkbox', { name: 'Toggle Todo' });
- const walkDogCheckbox = page.getByRole('listitem').filter({ hasText: 'Walk the dog' }).getByRole('checkbox', { name: 'Toggle Todo' });
-
- await expect(buyGroceriesCheckbox).not.toBeChecked();
- await expect(walkDogCheckbox).not.toBeChecked();
-
- // Verify: Counter shows "2 items left"
- await expect(page.locator('text=2 items left')).toBeVisible();
-
- // Verify: "Clear completed" button disappears
- await expect(page.getByRole('button', { name: 'Clear completed' })).not.toBeVisible();
-
- // Verify: "Mark all as complete" checkbox shows as unchecked
- await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).not.toBeChecked();
- });
-});
\ No newline at end of file
diff --git a/examples/todomvc/tests/toggle/toggle-todo-incomplete.spec.ts b/examples/todomvc/tests/toggle/toggle-todo-incomplete.spec.ts
deleted file mode 100644
index 4f775fed38..0000000000
--- a/examples/todomvc/tests/toggle/toggle-todo-incomplete.spec.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// spec: specs/basic-operations.md
-// seed: tests/seed.spec.ts
-
-import { test, expect } from '../fixtures';
-
-test.describe('Marking Todos Complete/Incomplete', () => {
- test('Toggle Todo Back to Incomplete', async ({ page }) => {
- // 1. Add todo "Buy groceries"
- const todoInput = page.getByRole('textbox', { name: 'What needs to be done?' });
- await todoInput.click();
- await todoInput.fill('Buy groceries');
- await todoInput.press('Enter');
-
- // Verify todo was added
- const todoItem = page.getByText('Buy groceries');
- await expect(todoItem).toBeVisible();
- await expect(page.getByText('1 item left')).toBeVisible();
-
- // 2. Click checkbox to mark complete
- const todoCheckbox = page.getByRole('checkbox', { name: 'Toggle Todo' });
- await todoCheckbox.click();
-
- // Verify todo is marked complete
- await expect(todoCheckbox).toBeChecked();
- await expect(page.getByText('0 items left')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();
-
- // 3. Click checkbox again to mark incomplete
- await todoCheckbox.click();
-
- // Expected results to verify:
- // - Checkbox becomes unchecked
- await expect(todoCheckbox).not.toBeChecked();
-
- // - Completed styling is removed (checkbox is unchecked indicates this)
- // - Counter shows "1 item left"
- await expect(page.getByText('1 item left')).toBeVisible();
-
- // - "Clear completed" button disappears if no other completed todos exist
- await expect(page.getByRole('button', { name: 'Clear completed' })).not.toBeVisible();
-
- // Additional verification that the todo is still present and functional
- await expect(todoItem).toBeVisible();
- await expect(page.getByRole('checkbox', { name: '❯Mark all as complete' })).not.toBeChecked();
- });
-});
\ No newline at end of file
diff --git a/packages/playwright/src/agents/generateAgents.ts b/packages/playwright/src/agents/generateAgents.ts
index 0145c29acc..ad9cd951d3 100644
--- a/packages/playwright/src/agents/generateAgents.ts
+++ b/packages/playwright/src/agents/generateAgents.ts
@@ -43,7 +43,7 @@ interface Agent {
class AgentParser {
static async loadAgents(): Promise<Agent[]> {
const files = await fs.promises.readdir(__dirname);
- return Promise.all(files.filter(file => file.endsWith('.md')).map(file => AgentParser.parseFile(path.join(__dirname, file))));
+ return Promise.all(files.filter(file => file.endsWith('.agent.md')).map(file => AgentParser.parseFile(path.join(__dirname, file))));
}
static async parseFile(filePath: string): Promise<Agent> {
@@ -109,13 +109,15 @@ class AgentParser {
export class ClaudeGenerator {
static async init(config: FullConfigInternal, projectName: string) {
- await initRepo(config, projectName);
+ await initRepo(config, projectName, {
+ promptsFolder: '.claude/prompts',
+ });
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}.md`, ClaudeGenerator.agentSpec(agent), 'πŸ€–', 'agent definition');
+ await writeFile(`.claude/agents/${agent.header.name}.agent.md`, ClaudeGenerator.agentSpec(agent), 'πŸ€–', 'agent definition');
await writeFile('.mcp.json', JSON.stringify({
mcpServers: {
@@ -160,16 +162,18 @@ export class ClaudeGenerator {
export class OpencodeGenerator {
static async init(config: FullConfigInternal, projectName: string) {
- await initRepo(config, projectName);
+ await initRepo(config, projectName, {
+ agentDefault: 'Build',
+ promptsFolder: '.opencode/prompts'
+ });
const agents = await AgentParser.loadAgents();
- await fs.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/${agent.header.name}.md`, prompt.join('\n'), 'πŸ€–', 'agent definition');
+ await writeFile(`.opencode/prompts/${agent.header.name}.agent.md`, prompt.join('\n'), 'πŸ€–', 'agent definition');
}
await writeFile('opencode.json', OpencodeGenerator.configuration(agents), 'πŸ”§', 'opencode configuration');
@@ -206,7 +210,7 @@ export class OpencodeGenerator {
result['agent'][agent.header.name] = {
description: agent.header.description,
mode: 'subagent',
- prompt: `{file:.opencode/prompts/${agent.header.name}.md}`,
+ prompt: `{file:.opencode/prompts/${agent.header.name}.agent.md}`,
tools,
};
for (const tool of agent.header.tools)
@@ -230,7 +234,9 @@ export class AgentGenerator {
return;
}
- await initRepo(config, projectName);
+ await initRepo(config, projectName, {
+ promptsFolder: path.join(agentsFolder, 'prompts')
+ });
const agents = await AgentParser.loadAgents();
@@ -262,15 +268,23 @@ export class AgentGenerator {
export class VSCodeGenerator {
static async init(config: FullConfigInternal, projectName: string) {
- await initRepo(config, projectName);
+ await initRepo(config, projectName, {
+ agentDefault: 'agent',
+ agentHealer: '🎭 healer',
+ agentGenerator: '🎭 generator',
+ agentPlanner: '🎭 planner',
+ promptsFolder: '.github/prompts'
+ });
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');
@@ -349,7 +363,27 @@ async function writeFile(filePath: string, content: string, icon: string, descri
await fs.promises.writeFile(filePath, content, 'utf-8');
}
-async function initRepo(config: FullConfigInternal, projectName: string) {
+async function deleteFile(filePath: string, description: string) {
+ try {
+ if (!fs.existsSync(filePath))
+ return;
+ } catch {
+ return;
+ }
+
+ console.log(`- βœ‚οΈ ${path.relative(process.cwd(), filePath)} ${colors.dim('- ' + description)}`);
+ await fs.promises.unlink(filePath);
+}
+
+type RepoParams = {
+ promptsFolder: string;
+ agentDefault?: string;
+ agentHealer?: string;
+ agentGenerator?: string;
+ agentPlanner?: 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`);
@@ -361,56 +395,37 @@ This is a directory for test plans.
`, 'πŸ“', 'directory for test plans');
}
- if (!fs.existsSync('prompts')) {
- await fs.promises.mkdir('prompts');
- await writeFile(path.join('prompts', 'README.md'), `# Prompts
-
-This is a directory for useful prompts.
-`, 'πŸ“', 'useful prompts');
- }
-
let seedFile = await findSeedFile(project);
if (!seedFile) {
seedFile = defaultSeedFile(project);
await writeFile(seedFile, seedFileContent, '🌱', 'default environment seed file');
}
- const coveragePromptFile = path.join('prompts', 'test-coverage.md');
- if (!fs.existsSync(coveragePromptFile))
- await writeFile(coveragePromptFile, coveragePrompt(seedFile), 'πŸ“', 'test coverage prompt');
+ 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');
+ }
}
function initRepoDone() {
console.log('βœ… Done.');
}
-const coveragePrompt = (seedFile: string) => `
-# Produce test coverage
-
-Parameters:
-- Task: the task to perform
-- Seed file (optional): the seed file to use, defaults to ${path.relative(process.cwd(), seedFile)}
-- Test plan file (optional): the test plan file to write, under specs/ folder.
-
-1. Call #playwright-test-planner subagent with prompt:
-
-<plan>
- <task><!-- the task --></task>
- <seed-file><!-- seed file param --></seed-file>
- <plan-file><!-- test plan file --></plan-file>
-</plan>
-
-2. For each test case from the test plan file (1.1, 1.2, ...), Call #playwright-test-generator subagent with prompt:
-
-<generate>
- <test-file><!-- Name of the file to save the test into, should be unique for test --></test-file>
- <test-suite><!-- Name of the top level test spec w/o ordinal--></test-suite>
- <test-name><!--Name of the test case without the ordinal --></test-name>
- <seed-file><!-- Seed file 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>
-`;
+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 acc.replace(new RegExp(`\\\${${key}}`, 'g'), value);
+ }, content);
+}
diff --git a/packages/playwright/src/agents/generator.md b/packages/playwright/src/agents/generator.agent.md
similarity index 100%
rename from packages/playwright/src/agents/generator.md
rename to packages/playwright/src/agents/generator.agent.md
diff --git a/packages/playwright/src/agents/healer.md b/packages/playwright/src/agents/healer.agent.md
similarity index 100%
rename from packages/playwright/src/agents/healer.md
rename to packages/playwright/src/agents/healer.agent.md
diff --git a/packages/playwright/src/agents/planner.md b/packages/playwright/src/agents/planner.agent.md
similarity index 97%
rename from packages/playwright/src/agents/planner.md
rename to packages/playwright/src/agents/planner.agent.md
index ae58a7bfeb..cbc350ec7d 100644
--- a/packages/playwright/src/agents/planner.md
+++ b/packages/playwright/src/agents/planner.agent.md
@@ -66,6 +66,7 @@ You will:
- Executive summary of the tested page/application
- Individual scenarios as separate sections
- Each scenario formatted with numbered steps
+ - Each test case with proposed file name for implementation
- Clear expected results for verification
<example-spec>
@@ -90,6 +91,9 @@ application features:
**Seed:** `tests/seed.spec.ts`
#### 1.1 Add Valid Todo
+
+**File** `tests/adding-new-todos/add-valid-todo.spec.ts`
+
**Steps:**
1. Click in the "What needs to be done?" input field
2. Type "Buy groceries"
diff --git a/packages/playwright/src/agents/test-coverage.prompt.md b/packages/playwright/src/agents/test-coverage.prompt.md
new file mode 100644
index 0000000000..12923b36ac
--- /dev/null
+++ b/packages/playwright/src/agents/test-coverage.prompt.md
@@ -0,0 +1,31 @@
+---
+mode: ${agentDefault}
+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 #${agentPlanner} 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 #${agentGenerator} 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 #${agentHealer} 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/packages/playwright/src/agents/test-generate.prompt.md
new file mode 100644
index 0000000000..ef4b5cb458
--- /dev/null
+++ b/packages/playwright/src/agents/test-generate.prompt.md
@@ -0,0 +1,8 @@
+---
+mode: ${agentGenerator}
+description: Generate test plan
+---
+
+Generate tests for the test plan's bullet 1.1 Add item to card.
+
+Test plan: `specs/coverage.plan.md`
diff --git a/packages/playwright/src/agents/test-heal.prompt.md b/packages/playwright/src/agents/test-heal.prompt.md
new file mode 100644
index 0000000000..51a7d3b480
--- /dev/null
+++ b/packages/playwright/src/agents/test-heal.prompt.md
@@ -0,0 +1,6 @@
+---
+mode: ${agentHealer}
+description: Fix tests
+---
+
+Run all my tests and fix the failing ones.
diff --git a/packages/playwright/src/agents/test-plan.prompt.md b/packages/playwright/src/agents/test-plan.prompt.md
new file mode 100644
index 0000000000..b852859045
--- /dev/null
+++ b/packages/playwright/src/agents/test-plan.prompt.md
@@ -0,0 +1,9 @@
+---
+mode: ${agentPlanner}
+description: Create test plan
+---
+
+Create test plan for "add to cart" functionality of my app.
+
+- Seed file: `${seedFile}`
+- Test plan: `specs/coverage.plan.md`
diff --git a/tests/mcp/init-agents.spec.ts b/tests/mcp/init-agents.spec.ts
index cedb2bd91d..e2d09e3a97 100644
--- a/tests/mcp/init-agents.spec.ts
+++ b/tests/mcp/init-agents.spec.ts
@@ -73,6 +73,11 @@ 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': `
@@ -84,9 +89,15 @@ test('init claude agents', async ({ }) => {
cwd: baseDir,
args: ['--loop', 'claude'],
});
- expect(fs.existsSync(path.join(baseDir, '.claude', 'agents', 'playwright-test-planner.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.claude', 'agents', 'playwright-test-generator.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.claude', 'agents', 'playwright-test-healer.md'))).toBe(true);
+ 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 ({ }) => {
@@ -100,10 +111,16 @@ test('init vscode agents', async ({ }) => {
cwd: baseDir,
args: ['--loop', 'vscode'],
});
- expect(fs.existsSync(path.join(baseDir, '.github', 'chatmodes', '🎭 generator.chatmode.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.github', 'chatmodes', ' 🎭 planner.chatmode.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.github', 'chatmodes', '🎭 healer.chatmode.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.vscode', 'mcp.json'))).toBe(true);
+
+ 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 ({ }) => {
@@ -117,8 +134,14 @@ test('init opencode agents', async ({ }) => {
cwd: baseDir,
args: ['--loop', 'opencode'],
});
- expect(fs.existsSync(path.join(baseDir, '.opencode', 'prompts', 'playwright-test-planner.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.opencode', 'prompts', 'playwright-test-generator.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, '.opencode', 'prompts', 'playwright-test-healer.md'))).toBe(true);
- expect(fs.existsSync(path.join(baseDir, 'opencode.json'))).toBe(true);
+
+ 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',
+ ]);
});