specweave 0.23.14 → 0.23.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +11 -0
- package/CLAUDE.md +77 -7
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +57 -0
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +3 -0
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/core/progress/progress-tracker.d.ts +4 -1
- package/dist/src/core/progress/progress-tracker.d.ts.map +1 -1
- package/dist/src/core/progress/progress-tracker.js +33 -4
- package/dist/src/core/progress/progress-tracker.js.map +1 -1
- package/dist/src/core/spec-content-sync.d.ts +1 -1
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/core/spec-detector.d.ts +5 -0
- package/dist/src/core/spec-detector.d.ts.map +1 -1
- package/dist/src/core/spec-detector.js +91 -33
- package/dist/src/core/spec-detector.js.map +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.js +39 -7
- package/dist/src/integrations/ado/ado-dependency-loader.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh +1 -1
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh.bak +245 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
- package/plugins/specweave/hooks/lib/sync-spec-content.sh.bak +149 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +34 -4
- package/plugins/specweave/hooks/lib/validate-spec-status.sh +1 -1
- package/plugins/specweave/hooks/lib/validate-spec-status.sh.bak +163 -0
- package/plugins/specweave/hooks/post-first-increment.sh +1 -1
- package/plugins/specweave/hooks/post-first-increment.sh.bak +61 -0
- package/plugins/specweave/hooks/post-spec-update.sh +1 -1
- package/plugins/specweave/hooks/post-spec-update.sh.bak +158 -0
- package/plugins/specweave/hooks/post-user-story-complete.sh +1 -1
- package/plugins/specweave/hooks/post-user-story-complete.sh.bak +179 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +1 -1
- package/plugins/specweave/hooks/pre-command-deduplication.sh.bak +83 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
- package/plugins/specweave/hooks/user-prompt-submit.sh.bak +386 -0
- package/plugins/specweave/skills/specweave-framework/SKILL.md +1 -1
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-multi-project-mapper/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-sync-judge/AGENT.md +23 -0
- package/plugins/specweave-backend/agents/database-optimizer/AGENT.md +23 -0
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +23 -0
- package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +23 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +15 -1
- package/plugins/specweave-github/agents/github-manager/AGENT.md +23 -0
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +25 -0
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +25 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +16 -0
- package/plugins/specweave-github/hooks/post-task-completion.sh +53 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.js +49 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +67 -0
- package/plugins/specweave-infrastructure/agents/devops/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/network-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/performance-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/sre/AGENT.md +26 -0
- package/plugins/specweave-jira/agents/jira-manager/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +26 -0
- package/plugins/specweave-kubernetes/agents/kubernetes-architect/AGENT.md +26 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +2 -2
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/mlops-engineer/AGENT.md +26 -0
- package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +26 -0
- package/plugins/specweave-payments/agents/payment-integration/AGENT.md +26 -0
- package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +19 -0
- package/plugins/specweave-plugin-dev/skills/plugin-expert/SKILL.md +1231 -0
- package/plugins/specweave-release/agents/release-manager/AGENT.md +27 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +24 -0
- package/plugins/specweave/skills/plugin-expert/SKILL.md +0 -340
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +0 -21
- package/plugins/specweave-alternatives/skills/bmad-method-expert/SKILL.md +0 -626
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/analyze-project.js +0 -318
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/check-setup.js +0 -208
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/generate-template.js +0 -1149
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/validate-documents.js +0 -340
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +0 -1010
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +0 -20
- package/plugins/specweave-cost-optimizer/skills/cost-optimizer/SKILL.md +0 -190
- package/plugins/specweave-docs/.claude-plugin/plugin.json +0 -19
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +0 -613
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/README.md +0 -264
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +0 -439
- package/plugins/specweave-docs/skills/spec-driven-debugging/README.md +0 -479
- package/plugins/specweave-docs/skills/spec-driven-debugging/SKILL.md +0 -652
- package/plugins/specweave-figma/.claude-plugin/.mcp.json +0 -12
- package/plugins/specweave-figma/.claude-plugin/plugin.json +0 -20
- package/plugins/specweave-figma/ARCHITECTURE.md +0 -453
- package/plugins/specweave-figma/README.md +0 -728
- package/plugins/specweave-figma/skills/figma-to-code/SKILL.md +0 -632
- package/plugins/specweave-figma/skills/figma-to-code/test-1-token-generation.yaml +0 -29
- package/plugins/specweave-figma/skills/figma-to-code/test-2-component-generation.yaml +0 -27
- package/plugins/specweave-figma/skills/figma-to-code/test-3-typescript-generation.yaml +0 -28
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +0 -21
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +0 -107
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +0 -177
- package/plugins/specweave-frontend/skills/nextjs/SKILL.md +0 -176
- package/plugins/specweave-testing/.claude-plugin/plugin.json +0 -20
- package/plugins/specweave-testing/skills/e2e-playwright/README.md +0 -506
- package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +0 -457
- package/plugins/specweave-testing/skills/e2e-playwright/execute.js +0 -373
- package/plugins/specweave-testing/skills/e2e-playwright/lib/utils.js +0 -514
- package/plugins/specweave-testing/skills/e2e-playwright/package.json +0 -33
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +0 -19
- package/plugins/specweave-tooling/skills/skill-creator/LICENSE.txt +0 -202
- package/plugins/specweave-tooling/skills/skill-creator/SKILL.md +0 -209
- package/plugins/specweave-tooling/skills/skill-creator/scripts/init_skill.py +0 -303
- package/plugins/specweave-tooling/skills/skill-creator/scripts/package_skill.py +0 -110
- package/plugins/specweave-tooling/skills/skill-creator/scripts/quick_validate.py +0 -65
- package/plugins/specweave-tooling/skills/skill-router/SKILL.md +0 -479
- package/plugins/specweave-ui/.claude-plugin/plugin.json +0 -26
- package/plugins/specweave-ui/.mcp.json +0 -10
- package/plugins/specweave-ui/README.md +0 -492
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +0 -676
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
# E2E Playwright Skill
|
|
2
|
-
|
|
3
|
-
End-to-end browser automation and testing skill for SpecWeave using Playwright.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This skill enables autonomous browser testing and automation through natural language. Simply describe what you want to test, and Claude will generate custom Playwright code, execute it, and return results.
|
|
8
|
-
|
|
9
|
-
**Key Features**:
|
|
10
|
-
- 🎭 **Auto-Detection**: Automatically activates when you mention E2E testing, browser automation, or UI testing
|
|
11
|
-
- 🔷 **SpecWeave-Aware**: Detects SpecWeave projects and generates reports in increment folders
|
|
12
|
-
- 👁️ **Visible by Default**: Tests run with visible browser for better debugging
|
|
13
|
-
- 🛠️ **Helper Utilities**: Pre-built functions for common testing patterns
|
|
14
|
-
- 📸 **Screenshot Capture**: Timestamped screenshots for visual verification
|
|
15
|
-
- ♿ **Accessibility Checks**: Basic a11y validation built-in
|
|
16
|
-
- 📊 **Test Reports**: Generates structured reports in Markdown format
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
### Prerequisites
|
|
21
|
-
|
|
22
|
-
- Node.js >= 14.0.0
|
|
23
|
-
- npm or yarn
|
|
24
|
-
|
|
25
|
-
### Setup
|
|
26
|
-
|
|
27
|
-
1. **Install the skill** (if not already installed via SpecWeave):
|
|
28
|
-
```bash
|
|
29
|
-
cd ~/.claude/skills/e2e-playwright
|
|
30
|
-
npm run setup
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
This will:
|
|
34
|
-
- Install Playwright package
|
|
35
|
-
- Download Chromium browser
|
|
36
|
-
- Set up all dependencies
|
|
37
|
-
|
|
38
|
-
2. **Verify installation**:
|
|
39
|
-
```bash
|
|
40
|
-
node execute.js --version
|
|
41
|
-
# Output: e2e-playwright v1.0.0
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
### Basic Usage
|
|
47
|
-
|
|
48
|
-
Simply ask Claude to test something:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
User: Test the homepage at localhost:3000
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Claude will:
|
|
55
|
-
1. Detect available dev servers
|
|
56
|
-
2. Generate a Playwright test script
|
|
57
|
-
3. Execute it and show results
|
|
58
|
-
4. Capture screenshots if needed
|
|
59
|
-
|
|
60
|
-
### Example Commands
|
|
61
|
-
|
|
62
|
-
#### Basic Navigation
|
|
63
|
-
```
|
|
64
|
-
Test if localhost:3000 loads successfully
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### Form Testing
|
|
68
|
-
```
|
|
69
|
-
Test the login form - use email test@example.com and password testpass123
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
#### Responsive Design
|
|
73
|
-
```
|
|
74
|
-
Take screenshots of the homepage across mobile, tablet, and desktop viewports
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
#### Link Validation
|
|
78
|
-
```
|
|
79
|
-
Check for broken links on the homepage
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
#### Accessibility Testing
|
|
83
|
-
```
|
|
84
|
-
Run accessibility checks on the signup page
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
#### User Flow
|
|
88
|
-
```
|
|
89
|
-
Test the complete checkout flow - add item to cart, fill shipping info, and complete payment
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## How It Works
|
|
93
|
-
|
|
94
|
-
### 1. Automatic Activation
|
|
95
|
-
|
|
96
|
-
The skill activates when you use keywords like:
|
|
97
|
-
- E2E test, browser test, UI test
|
|
98
|
-
- Playwright, web automation
|
|
99
|
-
- Test login, test form, test website
|
|
100
|
-
- Screenshot, visual test
|
|
101
|
-
- Accessibility test, a11y check
|
|
102
|
-
|
|
103
|
-
### 2. Code Generation
|
|
104
|
-
|
|
105
|
-
Claude generates custom Playwright code based on your request:
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
const { chromium } = require('playwright');
|
|
109
|
-
|
|
110
|
-
(async () => {
|
|
111
|
-
const browser = await chromium.launch({
|
|
112
|
-
headless: false, // Visible browser
|
|
113
|
-
slowMo: 100 // Slowed for clarity
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const page = await browser.newPage();
|
|
117
|
-
await page.goto('http://localhost:3000');
|
|
118
|
-
|
|
119
|
-
// Your test logic here...
|
|
120
|
-
|
|
121
|
-
await browser.close();
|
|
122
|
-
})();
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### 3. Execution
|
|
126
|
-
|
|
127
|
-
The executor (`execute.js`) handles:
|
|
128
|
-
- Module resolution (runs from skill directory)
|
|
129
|
-
- Dependency verification
|
|
130
|
-
- Code wrapping (if needed)
|
|
131
|
-
- Error handling
|
|
132
|
-
- SpecWeave context detection
|
|
133
|
-
|
|
134
|
-
### 4. Results
|
|
135
|
-
|
|
136
|
-
You'll see:
|
|
137
|
-
- Real-time browser execution (visible by default)
|
|
138
|
-
- Console output with step-by-step progress
|
|
139
|
-
- Screenshots saved to `/tmp/`
|
|
140
|
-
- Test reports (in SpecWeave projects)
|
|
141
|
-
|
|
142
|
-
## Helper Utilities
|
|
143
|
-
|
|
144
|
-
The skill provides pre-built utilities in `lib/utils.js`:
|
|
145
|
-
|
|
146
|
-
### detectServers()
|
|
147
|
-
Auto-detect running dev servers:
|
|
148
|
-
```javascript
|
|
149
|
-
const servers = await detectServers();
|
|
150
|
-
// [{ port: 3000, url: 'http://localhost:3000', name: 'Next.js' }]
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### safeClick(page, selector, options)
|
|
154
|
-
Click with automatic wait and retry:
|
|
155
|
-
```javascript
|
|
156
|
-
await safeClick(page, 'button[type="submit"]');
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### safeType(page, selector, text, options)
|
|
160
|
-
Type with automatic focus and validation:
|
|
161
|
-
```javascript
|
|
162
|
-
await safeType(page, 'input[name="email"]', 'test@example.com');
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### captureScreenshot(page, name, options)
|
|
166
|
-
Timestamped screenshots:
|
|
167
|
-
```javascript
|
|
168
|
-
await captureScreenshot(page, 'login-form');
|
|
169
|
-
// Saves: /tmp/login-form-2025-10-27-14-30-45.png
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### checkAccessibility(page)
|
|
173
|
-
Basic accessibility validation:
|
|
174
|
-
```javascript
|
|
175
|
-
const issues = await checkAccessibility(page);
|
|
176
|
-
console.log('Accessibility issues:', issues);
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### waitForStableDOM(page, timeout)
|
|
180
|
-
Wait for dynamic content to settle:
|
|
181
|
-
```javascript
|
|
182
|
-
await waitForStableDOM(page, 2000);
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
**See SKILL.md for complete API reference**
|
|
186
|
-
|
|
187
|
-
## SpecWeave Integration
|
|
188
|
-
|
|
189
|
-
### Context Detection
|
|
190
|
-
|
|
191
|
-
When running in a SpecWeave project, the skill:
|
|
192
|
-
- Detects `.specweave/` directory
|
|
193
|
-
- Identifies active increment (in-progress status)
|
|
194
|
-
- Saves test reports to `.specweave/increments/{id}/reports/`
|
|
195
|
-
|
|
196
|
-
### Test Report Generation
|
|
197
|
-
|
|
198
|
-
Generate structured test reports:
|
|
199
|
-
|
|
200
|
-
```javascript
|
|
201
|
-
const { generateTestReport, saveTestReport } = require('./lib/utils.js');
|
|
202
|
-
|
|
203
|
-
const results = {
|
|
204
|
-
tests: [
|
|
205
|
-
{ name: 'TC-001: Login', status: '✅ Passed', duration: '3.2s' }
|
|
206
|
-
],
|
|
207
|
-
summary: { total: 1, passed: 1, failed: 0 },
|
|
208
|
-
performance: { 'Page Load': '1.2s' },
|
|
209
|
-
accessibility: []
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
const report = generateTestReport(results, '0003-user-auth');
|
|
213
|
-
saveTestReport(report, '/path/to/increment', 'e2e-test-report.md');
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Report format follows SpecWeave conventions with sections for:
|
|
217
|
-
- Test Summary
|
|
218
|
-
- Individual Results
|
|
219
|
-
- Performance Metrics
|
|
220
|
-
- Accessibility Issues
|
|
221
|
-
- Recommendations
|
|
222
|
-
|
|
223
|
-
## Examples
|
|
224
|
-
|
|
225
|
-
### Example 1: Basic Page Test
|
|
226
|
-
|
|
227
|
-
**Request**: "Test if the homepage loads"
|
|
228
|
-
|
|
229
|
-
**Generated Code**:
|
|
230
|
-
```javascript
|
|
231
|
-
const { chromium } = require('playwright');
|
|
232
|
-
|
|
233
|
-
(async () => {
|
|
234
|
-
const browser = await chromium.launch({ headless: false, slowMo: 100 });
|
|
235
|
-
const page = await browser.newPage();
|
|
236
|
-
|
|
237
|
-
await page.goto('http://localhost:3000');
|
|
238
|
-
await page.waitForLoadState('networkidle');
|
|
239
|
-
|
|
240
|
-
const title = await page.title();
|
|
241
|
-
console.log('✅ Page loaded. Title:', title);
|
|
242
|
-
|
|
243
|
-
await captureScreenshot(page, 'homepage');
|
|
244
|
-
await browser.close();
|
|
245
|
-
})();
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Example 2: Form Interaction
|
|
249
|
-
|
|
250
|
-
**Request**: "Test the login form with email test@example.com"
|
|
251
|
-
|
|
252
|
-
**Generated Code**:
|
|
253
|
-
```javascript
|
|
254
|
-
const { chromium } = require('playwright');
|
|
255
|
-
|
|
256
|
-
(async () => {
|
|
257
|
-
const browser = await chromium.launch({ headless: false, slowMo: 100 });
|
|
258
|
-
const page = await browser.newPage();
|
|
259
|
-
|
|
260
|
-
await page.goto('http://localhost:3000/login');
|
|
261
|
-
|
|
262
|
-
await safeType(page, 'input[name="email"]', 'test@example.com');
|
|
263
|
-
await safeType(page, 'input[name="password"]', 'password123');
|
|
264
|
-
|
|
265
|
-
await captureScreenshot(page, 'login-filled');
|
|
266
|
-
|
|
267
|
-
await Promise.all([
|
|
268
|
-
page.waitForNavigation(),
|
|
269
|
-
safeClick(page, 'button[type="submit"]')
|
|
270
|
-
]);
|
|
271
|
-
|
|
272
|
-
console.log('✅ Login successful. URL:', page.url());
|
|
273
|
-
await captureScreenshot(page, 'after-login');
|
|
274
|
-
|
|
275
|
-
await browser.close();
|
|
276
|
-
})();
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Example 3: Responsive Testing
|
|
280
|
-
|
|
281
|
-
**Request**: "Test responsive design across mobile, tablet, and desktop"
|
|
282
|
-
|
|
283
|
-
**Generated Code**:
|
|
284
|
-
```javascript
|
|
285
|
-
const { chromium, devices } = require('playwright');
|
|
286
|
-
|
|
287
|
-
(async () => {
|
|
288
|
-
const browser = await chromium.launch({ headless: false });
|
|
289
|
-
|
|
290
|
-
const viewports = [
|
|
291
|
-
{ name: 'Mobile', width: 375, height: 667 },
|
|
292
|
-
{ name: 'Tablet', width: 768, height: 1024 },
|
|
293
|
-
{ name: 'Desktop', width: 1920, height: 1080 }
|
|
294
|
-
];
|
|
295
|
-
|
|
296
|
-
for (const viewport of viewports) {
|
|
297
|
-
const page = await browser.newPage();
|
|
298
|
-
await page.setViewportSize(viewport);
|
|
299
|
-
|
|
300
|
-
await page.goto('http://localhost:3000');
|
|
301
|
-
await page.waitForLoadState('networkidle');
|
|
302
|
-
|
|
303
|
-
await captureScreenshot(page, `homepage-${viewport.name.toLowerCase()}`);
|
|
304
|
-
console.log(`✅ ${viewport.name} screenshot captured`);
|
|
305
|
-
|
|
306
|
-
await page.close();
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
await browser.close();
|
|
310
|
-
})();
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
## Advanced Features
|
|
314
|
-
|
|
315
|
-
### Network Interception
|
|
316
|
-
|
|
317
|
-
Mock API responses:
|
|
318
|
-
```javascript
|
|
319
|
-
await page.route('**/api/users', route => {
|
|
320
|
-
route.fulfill({
|
|
321
|
-
status: 200,
|
|
322
|
-
body: JSON.stringify([{ id: 1, name: 'Test User' }])
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Video Recording
|
|
328
|
-
|
|
329
|
-
Record test execution:
|
|
330
|
-
```javascript
|
|
331
|
-
const context = await browser.newContext({
|
|
332
|
-
recordVideo: { dir: '/tmp/videos/' }
|
|
333
|
-
});
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### Context Persistence
|
|
337
|
-
|
|
338
|
-
Save and restore browser state:
|
|
339
|
-
```javascript
|
|
340
|
-
// Save
|
|
341
|
-
await context.storageState({ path: '/tmp/auth-state.json' });
|
|
342
|
-
|
|
343
|
-
// Restore
|
|
344
|
-
const context = await browser.newContext({
|
|
345
|
-
storageState: '/tmp/auth-state.json'
|
|
346
|
-
});
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## Testing the Skill
|
|
350
|
-
|
|
351
|
-
Run test cases to verify functionality:
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
# Verify installation
|
|
355
|
-
node execute.js --version
|
|
356
|
-
|
|
357
|
-
# Test basic execution
|
|
358
|
-
echo "console.log('Hello, Playwright!')" | node execute.js
|
|
359
|
-
|
|
360
|
-
# Run from file
|
|
361
|
-
echo "const { chromium } = require('playwright'); console.log('✅ Playwright loaded');" > /tmp/test.js
|
|
362
|
-
node execute.js /tmp/test.js
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
**Automated Test Cases**:
|
|
366
|
-
- `TC-001-basic-navigation.yaml` - Basic browser launch and navigation
|
|
367
|
-
- `TC-002-form-interaction.yaml` - Form filling with helper utilities
|
|
368
|
-
- `TC-003-specweave-integration.yaml` - SpecWeave context detection and reporting
|
|
369
|
-
- `TC-004-accessibility-check.yaml` - Accessibility validation
|
|
370
|
-
|
|
371
|
-
## Troubleshooting
|
|
372
|
-
|
|
373
|
-
### Issue: "Cannot find module 'playwright'"
|
|
374
|
-
|
|
375
|
-
**Solution**: Run setup script
|
|
376
|
-
```bash
|
|
377
|
-
cd ~/.claude/skills/e2e-playwright
|
|
378
|
-
npm run setup
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### Issue: "Browser not found"
|
|
382
|
-
|
|
383
|
-
**Solution**: Install Chromium browser
|
|
384
|
-
```bash
|
|
385
|
-
npx playwright install chromium
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### Issue: "ECONNREFUSED on localhost:3000"
|
|
389
|
-
|
|
390
|
-
**Solution**: Make sure your dev server is running
|
|
391
|
-
```bash
|
|
392
|
-
# Detect running servers
|
|
393
|
-
const servers = await detectServers();
|
|
394
|
-
console.log(servers);
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
### Issue: "Test times out"
|
|
398
|
-
|
|
399
|
-
**Solution**: Increase timeout in test script
|
|
400
|
-
```javascript
|
|
401
|
-
await page.waitForSelector('button', { timeout: 30000 });
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
### Issue: "Screenshots not saving"
|
|
405
|
-
|
|
406
|
-
**Solution**: Check `/tmp/` directory permissions
|
|
407
|
-
```bash
|
|
408
|
-
ls -la /tmp/
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
## Best Practices
|
|
412
|
-
|
|
413
|
-
1. **Start with visible browser**: Use `headless: false` during development
|
|
414
|
-
2. **Add slow motion**: Use `slowMo: 100` for better visibility
|
|
415
|
-
3. **Wait for network idle**: Always wait for page to fully load
|
|
416
|
-
4. **Capture screenshots**: Take screenshots before and after key actions
|
|
417
|
-
5. **Use helper utilities**: Leverage `safeClick`, `safeType` for reliability
|
|
418
|
-
6. **Clean up resources**: Always close browser in `finally` blocks
|
|
419
|
-
7. **Test incrementally**: Break complex flows into smaller tests
|
|
420
|
-
8. **Check accessibility**: Run `checkAccessibility()` regularly
|
|
421
|
-
|
|
422
|
-
## Performance
|
|
423
|
-
|
|
424
|
-
- **Chromium**: Fastest, recommended for development
|
|
425
|
-
- **Firefox**: Good compatibility, slightly slower
|
|
426
|
-
- **WebKit**: Safari engine, use for cross-browser testing
|
|
427
|
-
- **Headless mode**: 2-3x faster, use in CI/CD
|
|
428
|
-
- **Parallel tests**: Run independent tests concurrently
|
|
429
|
-
|
|
430
|
-
## CI/CD Integration
|
|
431
|
-
|
|
432
|
-
Run tests in headless mode:
|
|
433
|
-
|
|
434
|
-
```bash
|
|
435
|
-
HEADLESS=true node execute.js test-suite.js
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
Example GitHub Actions:
|
|
439
|
-
```yaml
|
|
440
|
-
- name: Run E2E Tests
|
|
441
|
-
run: |
|
|
442
|
-
cd ~/.claude/skills/e2e-playwright
|
|
443
|
-
npm run setup
|
|
444
|
-
HEADLESS=true node execute.js tests/e2e-suite.js
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
## Comparison with Original
|
|
448
|
-
|
|
449
|
-
This skill is **inspired by** [lackeyjb/playwright-skill](https://github.com/lackeyjb/playwright-skill) but with significant enhancements:
|
|
450
|
-
|
|
451
|
-
### Key Differences
|
|
452
|
-
|
|
453
|
-
| Feature | Original | SpecWeave Version |
|
|
454
|
-
|---------|----------|-------------------|
|
|
455
|
-
| **Name** | `playwright-skill` | `e2e-playwright` |
|
|
456
|
-
| **Executor** | `run.js` | `execute.js` |
|
|
457
|
-
| **Helpers** | `lib/helpers.js` | `lib/utils.js` |
|
|
458
|
-
| **SpecWeave Integration** | ❌ No | ✅ Yes (context detection, reports) |
|
|
459
|
-
| **Test Cases** | ❌ None | ✅ 4 YAML test cases |
|
|
460
|
-
| **Accessibility** | ❌ Basic | ✅ Comprehensive `checkAccessibility()` |
|
|
461
|
-
| **Report Generation** | ❌ No | ✅ Markdown reports in increments |
|
|
462
|
-
| **Dependencies** | MCP optional | ❌ No MCP required |
|
|
463
|
-
|
|
464
|
-
### What's Enhanced
|
|
465
|
-
|
|
466
|
-
1. **SpecWeave-Aware**: Auto-detects SpecWeave projects and generates reports in increment folders
|
|
467
|
-
2. **More Utilities**: Additional helpers like `waitForStableDOM`, `scrollToElement`, `countElements`
|
|
468
|
-
3. **Better Error Handling**: Clearer error messages with context
|
|
469
|
-
4. **Test Report Format**: Structured Markdown reports following SpecWeave conventions
|
|
470
|
-
5. **Test Cases**: Comprehensive YAML test cases for validation
|
|
471
|
-
6. **Documentation**: More extensive examples and troubleshooting
|
|
472
|
-
|
|
473
|
-
### Credit
|
|
474
|
-
|
|
475
|
-
Original concept by [@lackeyjb](https://github.com/lackeyjb). This is a reimagined version specifically for SpecWeave workflows.
|
|
476
|
-
|
|
477
|
-
## Contributing
|
|
478
|
-
|
|
479
|
-
Contributions welcome! Please:
|
|
480
|
-
1. Add test cases for new features
|
|
481
|
-
2. Follow SpecWeave conventions
|
|
482
|
-
3. Update documentation
|
|
483
|
-
4. Test with both SpecWeave and non-SpecWeave projects
|
|
484
|
-
|
|
485
|
-
## License
|
|
486
|
-
|
|
487
|
-
MIT License - See LICENSE file for details
|
|
488
|
-
|
|
489
|
-
## Support
|
|
490
|
-
|
|
491
|
-
- **Documentation**: See SKILL.md for complete API reference
|
|
492
|
-
- **Issues**: Report bugs or request features via GitHub issues
|
|
493
|
-
- **SpecWeave**: See [SpecWeave documentation](https://github.com/anton-abyzov/specweave) for framework details
|
|
494
|
-
|
|
495
|
-
## Version History
|
|
496
|
-
|
|
497
|
-
- **1.0.0** (2025-10-27)
|
|
498
|
-
- Initial release
|
|
499
|
-
- SpecWeave integration
|
|
500
|
-
- 4 comprehensive test cases
|
|
501
|
-
- Enhanced helper utilities
|
|
502
|
-
- Test report generation
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
**Happy Testing! 🎭**
|