specweave 0.23.18 → 0.24.0

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.
Files changed (167) hide show
  1. package/.claude-plugin/marketplace.json +93 -49
  2. package/CLAUDE.md +137 -4
  3. package/dist/src/cli/helpers/ado-area-path-mapper.d.ts +89 -0
  4. package/dist/src/cli/helpers/ado-area-path-mapper.d.ts.map +1 -0
  5. package/dist/src/cli/helpers/ado-area-path-mapper.js +213 -0
  6. package/dist/src/cli/helpers/ado-area-path-mapper.js.map +1 -0
  7. package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts +29 -0
  8. package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts.map +1 -0
  9. package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js +109 -0
  10. package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js.map +1 -0
  11. package/dist/src/cli/helpers/issue-tracker/ado.d.ts +1 -0
  12. package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
  13. package/dist/src/cli/helpers/issue-tracker/ado.js +2 -0
  14. package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
  15. package/dist/src/cli/helpers/smart-filter.d.ts +83 -0
  16. package/dist/src/cli/helpers/smart-filter.d.ts.map +1 -0
  17. package/dist/src/cli/helpers/smart-filter.js +265 -0
  18. package/dist/src/cli/helpers/smart-filter.js.map +1 -0
  19. package/dist/src/core/qa/quality-gate-decider.d.ts +1 -1
  20. package/dist/src/core/qa/quality-gate-decider.js +2 -2
  21. package/dist/src/core/qa/quality-gate-decider.js.map +1 -1
  22. package/dist/src/core/qa/risk-calculator.d.ts +2 -2
  23. package/dist/src/core/qa/risk-calculator.js +2 -2
  24. package/dist/src/core/validators/ac-presence-validator.d.ts +56 -0
  25. package/dist/src/core/validators/ac-presence-validator.d.ts.map +1 -0
  26. package/dist/src/core/validators/ac-presence-validator.js +149 -0
  27. package/dist/src/core/validators/ac-presence-validator.js.map +1 -0
  28. package/dist/src/integrations/ado/area-path-mapper.d.ts +137 -0
  29. package/dist/src/integrations/ado/area-path-mapper.d.ts.map +1 -0
  30. package/dist/src/integrations/ado/area-path-mapper.js +267 -0
  31. package/dist/src/integrations/ado/area-path-mapper.js.map +1 -0
  32. package/dist/src/integrations/jira/filter-processor.d.ts +126 -0
  33. package/dist/src/integrations/jira/filter-processor.d.ts.map +1 -0
  34. package/dist/src/integrations/jira/filter-processor.js +207 -0
  35. package/dist/src/integrations/jira/filter-processor.js.map +1 -0
  36. package/dist/src/integrations/jira/jira-client.d.ts +13 -0
  37. package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
  38. package/dist/src/integrations/jira/jira-client.js +33 -0
  39. package/dist/src/integrations/jira/jira-client.js.map +1 -1
  40. package/dist/src/utils/ac-embedder.d.ts +63 -0
  41. package/dist/src/utils/ac-embedder.d.ts.map +1 -0
  42. package/dist/src/utils/ac-embedder.js +217 -0
  43. package/dist/src/utils/ac-embedder.js.map +1 -0
  44. package/dist/src/utils/env-manager.d.ts +86 -0
  45. package/dist/src/utils/env-manager.d.ts.map +1 -0
  46. package/dist/src/utils/env-manager.js +188 -0
  47. package/dist/src/utils/env-manager.js.map +1 -0
  48. package/package.json +1 -1
  49. package/plugins/specweave/.claude-plugin/plugin.json +1 -1
  50. package/plugins/specweave/agents/AGENTS-INDEX.md +1 -1
  51. package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +9 -9
  52. package/plugins/specweave/commands/specweave-do.md +37 -0
  53. package/plugins/specweave/commands/specweave-done.md +159 -0
  54. package/plugins/specweave/commands/specweave-embed-acs.md +446 -0
  55. package/plugins/specweave/commands/specweave-next.md +148 -3
  56. package/plugins/specweave/commands/specweave-qa.md +2 -2
  57. package/plugins/specweave/hooks/pre-increment-start.sh +168 -0
  58. package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
  59. package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
  60. package/plugins/specweave-ado/commands/specweave-ado-import-projects.md +331 -0
  61. package/plugins/specweave-alternatives/.claude-plugin/plugin.json +10 -0
  62. package/plugins/specweave-alternatives/commands/alternatives-analyze.md +336 -0
  63. package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +651 -0
  64. package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +420 -0
  65. package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +487 -0
  66. package/plugins/specweave-backend/commands/api-scaffold.md +80 -0
  67. package/plugins/specweave-backend/commands/crud-generate.md +109 -0
  68. package/plugins/specweave-backend/commands/migration-generate.md +139 -0
  69. package/plugins/specweave-confluent/commands/connector-deploy.md +154 -0
  70. package/plugins/specweave-confluent/commands/ksqldb-query.md +179 -0
  71. package/plugins/specweave-confluent/commands/schema-register.md +123 -0
  72. package/plugins/specweave-core/.claude-plugin/plugin.json +21 -0
  73. package/plugins/specweave-core/commands/architecture-review.md +288 -0
  74. package/plugins/specweave-core/commands/code-review.md +213 -0
  75. package/plugins/specweave-core/commands/refactor-plan.md +249 -0
  76. package/plugins/specweave-core/skills/code-quality/SKILL.md +157 -0
  77. package/plugins/specweave-core/skills/design-patterns/SKILL.md +244 -0
  78. package/plugins/specweave-core/skills/software-architecture/SKILL.md +83 -0
  79. package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +22 -0
  80. package/plugins/specweave-cost-optimizer/commands/cost-analyze.md +360 -0
  81. package/plugins/specweave-cost-optimizer/commands/cost-optimize.md +480 -0
  82. package/plugins/specweave-cost-optimizer/skills/aws-cost-expert/SKILL.md +416 -0
  83. package/plugins/specweave-cost-optimizer/skills/cloud-pricing/SKILL.md +325 -0
  84. package/plugins/specweave-cost-optimizer/skills/cost-optimization/SKILL.md +337 -0
  85. package/plugins/specweave-diagrams/.claude-plugin/plugin.json +1 -1
  86. package/plugins/specweave-diagrams/commands/diagrams-generate.md +168 -0
  87. package/plugins/specweave-docs/.claude-plugin/plugin.json +10 -0
  88. package/plugins/specweave-docs/commands/docs-generate.md +441 -0
  89. package/plugins/specweave-docs/commands/docs-init.md +334 -0
  90. package/plugins/specweave-docs/skills/docusaurus/SKILL.md +581 -0
  91. package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +689 -0
  92. package/plugins/specweave-docs/skills/technical-writing/SKILL.md +1039 -0
  93. package/plugins/specweave-docs-preview/.claude-plugin/plugin.json +1 -1
  94. package/plugins/specweave-figma/.claude-plugin/plugin.json +23 -0
  95. package/plugins/specweave-figma/commands/figma-import.md +690 -0
  96. package/plugins/specweave-figma/commands/figma-to-react.md +834 -0
  97. package/plugins/specweave-figma/commands/figma-tokens.md +815 -0
  98. package/plugins/specweave-frontend/.claude-plugin/plugin.json +21 -0
  99. package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +387 -0
  100. package/plugins/specweave-frontend/agents/frontend-architect/README.md +385 -0
  101. package/plugins/specweave-frontend/agents/frontend-architect/examples.md +590 -0
  102. package/plugins/specweave-frontend/agents/frontend-architect/templates/component-template.tsx +152 -0
  103. package/plugins/specweave-frontend/agents/frontend-architect/templates/hook-template.ts +311 -0
  104. package/plugins/specweave-frontend/agents/frontend-architect/templates/page-template.tsx +228 -0
  105. package/plugins/specweave-frontend/commands/component-generate.md +510 -0
  106. package/plugins/specweave-frontend/commands/design-system-init.md +494 -0
  107. package/plugins/specweave-frontend/commands/frontend-scaffold.md +207 -0
  108. package/plugins/specweave-frontend/commands/nextjs-setup.md +396 -0
  109. package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +278 -0
  110. package/plugins/specweave-frontend/skills/frontend/SKILL.md +420 -0
  111. package/plugins/specweave-frontend/skills/nextjs/SKILL.md +546 -0
  112. package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
  113. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +194 -0
  114. package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +1 -1
  115. package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
  116. package/plugins/specweave-jira/commands/import-projects.js +183 -0
  117. package/plugins/specweave-jira/commands/import-projects.md +97 -0
  118. package/plugins/specweave-jira/commands/import-projects.ts +288 -0
  119. package/plugins/specweave-jira/commands/specweave-jira-import-projects.md +298 -0
  120. package/plugins/specweave-kafka/.claude-plugin/plugin.json +1 -1
  121. package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +1 -1
  122. package/plugins/specweave-kubernetes/commands/cluster-setup.md +262 -0
  123. package/plugins/specweave-kubernetes/commands/deployment-generate.md +242 -0
  124. package/plugins/specweave-kubernetes/commands/helm-scaffold.md +333 -0
  125. package/plugins/specweave-ml/.claude-plugin/plugin.json +1 -1
  126. package/plugins/specweave-mobile/commands/app-scaffold.md +233 -0
  127. package/plugins/specweave-mobile/commands/build-config.md +256 -0
  128. package/plugins/specweave-mobile/commands/screen-generate.md +289 -0
  129. package/plugins/specweave-n8n/.claude-plugin/plugin.json +1 -1
  130. package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +13 -12
  131. package/plugins/specweave-plugin-dev/commands/plugin-create.md +333 -0
  132. package/plugins/specweave-plugin-dev/commands/plugin-publish.md +339 -0
  133. package/plugins/specweave-plugin-dev/commands/plugin-test.md +293 -0
  134. package/plugins/specweave-plugin-dev/skills/claude-sdk/SKILL.md +162 -0
  135. package/plugins/specweave-plugin-dev/skills/marketplace-publishing/SKILL.md +263 -0
  136. package/plugins/specweave-plugin-dev/skills/plugin-development/SKILL.md +316 -0
  137. package/plugins/specweave-release/.claude-plugin/plugin.json +1 -1
  138. package/plugins/specweave-release/commands/specweave-release-npm.md +110 -0
  139. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +168 -0
  140. package/plugins/specweave-testing/.claude-plugin/plugin.json +21 -0
  141. package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +797 -0
  142. package/plugins/specweave-testing/agents/qa-engineer/README.md +443 -0
  143. package/plugins/specweave-testing/agents/qa-engineer/templates/playwright-e2e-test.ts +470 -0
  144. package/plugins/specweave-testing/agents/qa-engineer/templates/test-data-factory.ts +507 -0
  145. package/plugins/specweave-testing/agents/qa-engineer/templates/vitest-unit-test.ts +400 -0
  146. package/plugins/specweave-testing/agents/qa-engineer/test-strategies.md +726 -0
  147. package/plugins/specweave-testing/commands/e2e-setup.md +1081 -0
  148. package/plugins/specweave-testing/commands/test-coverage.md +979 -0
  149. package/plugins/specweave-testing/commands/test-generate.md +1156 -0
  150. package/plugins/specweave-testing/commands/test-init.md +409 -0
  151. package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +769 -0
  152. package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +934 -0
  153. package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +1011 -0
  154. package/plugins/specweave-tooling/.claude-plugin/plugin.json +22 -0
  155. package/plugins/specweave-tooling/commands/specweave-tooling-skill-create.md +691 -0
  156. package/plugins/specweave-tooling/commands/specweave-tooling-skill-package.md +751 -0
  157. package/plugins/specweave-tooling/commands/specweave-tooling-skill-validate.md +858 -0
  158. package/plugins/specweave-ui/.claude-plugin/plugin.json +10 -0
  159. package/plugins/specweave-ui/commands/ui-automate.md +199 -0
  160. package/plugins/specweave-ui/commands/ui-inspect.md +70 -0
  161. package/plugins/specweave-ui/skills/browser-automation/SKILL.md +314 -0
  162. package/plugins/specweave-ui/skills/ui-testing/SKILL.md +716 -0
  163. package/plugins/specweave-ui/skills/visual-regression/SKILL.md +728 -0
  164. package/plugins/specweave/commands/check-hooks.md +0 -257
  165. package/plugins/specweave/commands/specweave-archive-increments.md +0 -82
  166. package/plugins/specweave-plugin-dev/skills/plugin-expert/SKILL.md +0 -1231
  167. /package/plugins/specweave/{agents/code-reviewer.md → skills/code-reviewer/SKILL.md} +0 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "specweave-ui",
3
+ "version": "0.24.0",
4
+ "description": "Browser automation and UI tools - Element inspection, automated testing, Playwright integration",
5
+ "author": {
6
+ "name": "Anton Abyzov",
7
+ "email": "anton.abyzov@gmail.com"
8
+ },
9
+ "hooks": {}
10
+ }
@@ -0,0 +1,199 @@
1
+ # UI Automate - Browser Automation Workflows
2
+
3
+ Create and execute automated browser workflows using Playwright. Generate scripts for testing, web scraping, form automation, and UI interaction sequences.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /specweave-ui:ui-automate <workflow-name> [options]
9
+ ```
10
+
11
+ ## What I Do
12
+
13
+ 1. **Workflow Planning**: Define step-by-step browser automation sequences
14
+ 2. **Script Generation**: Create Playwright TypeScript/JavaScript code
15
+ 3. **MCP Integration**: Use Playwright MCP server for browser control
16
+ 4. **Error Handling**: Add retry logic, timeouts, and fallbacks
17
+ 5. **Output Collection**: Capture screenshots, data, and validation results
18
+
19
+ ## Workflow Types
20
+
21
+ ### 1. Form Automation
22
+ ```bash
23
+ /specweave-ui:ui-automate form-fill --url https://example.com/form \
24
+ --fields "email=test@example.com,name=John Doe"
25
+ ```
26
+
27
+ ### 2. Data Extraction
28
+ ```bash
29
+ /specweave-ui:ui-automate scrape --url https://example.com/products \
30
+ --selectors "title=h1.product-title,price=.price"
31
+ ```
32
+
33
+ ### 3. UI Testing Sequence
34
+ ```bash
35
+ /specweave-ui:ui-automate test-login --url https://example.com/login \
36
+ --steps "fill:email,fill:password,click:submit,wait:dashboard"
37
+ ```
38
+
39
+ ### 4. Screenshot Capture
40
+ ```bash
41
+ /specweave-ui:ui-automate screenshot --url https://example.com \
42
+ --fullPage --output screenshots/homepage.png
43
+ ```
44
+
45
+ ### 5. Multi-Page Navigation
46
+ ```bash
47
+ /specweave-ui:ui-automate navigate --start https://example.com \
48
+ --flow "home>products>cart>checkout"
49
+ ```
50
+
51
+ ## Options
52
+
53
+ ### General Options
54
+ - `--url <url>` - Starting URL for automation
55
+ - `--browser <browser>` - chromium, firefox, webkit (default: chromium)
56
+ - `--headless` - Run in headless mode (default: true)
57
+ - `--output <path>` - Output directory for artifacts
58
+
59
+ ### Workflow Options
60
+ - `--steps <steps>` - Comma-separated list of actions
61
+ - `--selectors <selectors>` - CSS selectors for elements
62
+ - `--fields <fields>` - Form field values (key=value pairs)
63
+ - `--wait <selector>` - Wait for element before proceeding
64
+ - `--timeout <ms>` - Max time to wait for operations (default: 30000)
65
+
66
+ ### Data Collection
67
+ - `--screenshot` - Capture screenshots at each step
68
+ - `--extract <selector>` - Extract text/attributes from elements
69
+ - `--save-html` - Save page HTML at key steps
70
+
71
+ ## Generated Script Features
72
+
73
+ ### TypeScript Example
74
+ ```typescript
75
+ import { chromium, Browser, Page } from 'playwright';
76
+
77
+ async function automateWorkflow() {
78
+ const browser: Browser = await chromium.launch({ headless: true });
79
+ const page: Page = await browser.newPage();
80
+
81
+ try {
82
+ // Step 1: Navigate
83
+ await page.goto('https://example.com', { waitUntil: 'networkidle' });
84
+
85
+ // Step 2: Fill form
86
+ await page.fill('#email', 'test@example.com');
87
+ await page.fill('#password', 'secure-password');
88
+
89
+ // Step 3: Submit
90
+ await page.click('button[type="submit"]');
91
+
92
+ // Step 4: Wait for navigation
93
+ await page.waitForSelector('.dashboard', { timeout: 5000 });
94
+
95
+ // Step 5: Capture result
96
+ await page.screenshot({ path: 'result.png', fullPage: true });
97
+
98
+ console.log('✓ Automation completed successfully');
99
+ } catch (error) {
100
+ console.error('✗ Automation failed:', error.message);
101
+ await page.screenshot({ path: 'error.png' });
102
+ throw error;
103
+ } finally {
104
+ await browser.close();
105
+ }
106
+ }
107
+
108
+ automateWorkflow();
109
+ ```
110
+
111
+ ## MCP Server Integration
112
+
113
+ Uses Playwright MCP server for enhanced capabilities:
114
+ - **Session Management**: Reuse browser contexts
115
+ - **Network Interception**: Mock APIs, block resources
116
+ - **Performance Metrics**: Collect timing data
117
+ - **Video Recording**: Capture automation runs
118
+ - **Parallel Execution**: Run multiple automations concurrently
119
+
120
+ ### MCP Configuration
121
+
122
+ Add to `.claude/mcp_server_config.json`:
123
+ ```json
124
+ {
125
+ "playwright": {
126
+ "command": "npx",
127
+ "args": ["playwright-mcp-server"],
128
+ "env": {
129
+ "PLAYWRIGHT_BROWSERS_PATH": "~/.cache/playwright"
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ ## Use Cases
136
+
137
+ ### 1. Regression Testing
138
+ Automate critical user flows to catch UI regressions early.
139
+
140
+ ### 2. Data Collection
141
+ Extract product information, prices, availability from multiple pages.
142
+
143
+ ### 3. Load Testing
144
+ Simulate multiple users interacting with the application.
145
+
146
+ ### 4. Visual Regression
147
+ Capture screenshots across environments to detect visual changes.
148
+
149
+ ### 5. Form Submission
150
+ Bulk-fill forms with test data for QA purposes.
151
+
152
+ ## Error Handling
153
+
154
+ ### Retry Logic
155
+ ```typescript
156
+ await page.click('button', { timeout: 5000 })
157
+ .catch(async () => {
158
+ console.log('Retrying click...');
159
+ await page.click('button', { force: true });
160
+ });
161
+ ```
162
+
163
+ ### Fallback Selectors
164
+ ```typescript
165
+ const selectors = ['#submit', '.submit-btn', 'button[type="submit"]'];
166
+ for (const selector of selectors) {
167
+ if (await page.locator(selector).count() > 0) {
168
+ await page.click(selector);
169
+ break;
170
+ }
171
+ }
172
+ ```
173
+
174
+ ## Best Practices
175
+
176
+ 1. **Use Stable Selectors**: Prefer data-testid attributes over CSS classes
177
+ 2. **Add Explicit Waits**: Don't rely on implicit timeouts
178
+ 3. **Handle Errors Gracefully**: Capture screenshots on failures
179
+ 4. **Clean Up Resources**: Always close browsers in finally blocks
180
+ 5. **Avoid Hardcoded Delays**: Use waitForSelector instead of setTimeout
181
+
182
+ ## Limitations
183
+
184
+ - Requires Playwright installation
185
+ - Cannot bypass CAPTCHAs or bot detection
186
+ - May fail on dynamically loaded content without proper waits
187
+ - Performance depends on network speed and page complexity
188
+
189
+ ## Related Commands
190
+
191
+ - `/specweave-ui:ui-inspect` - Inspect page elements for selectors
192
+ - `/specweave-testing:e2e-setup` - Set up full E2E testing framework
193
+ - `/specweave-testing:test-generate` - Generate test files from automation scripts
194
+
195
+ ## Environment Variables
196
+
197
+ - `PLAYWRIGHT_BROWSERS_PATH` - Custom browser binaries location
198
+ - `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` - Skip browser download on install
199
+ - `HEADLESS` - Default headless mode (true/false)
@@ -0,0 +1,70 @@
1
+ # UI Inspect - Browser Element Inspection
2
+
3
+ Inspect web page elements using browser automation tools. Helps identify selectors, attributes, and structure for automated testing and web scraping.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /specweave-ui:ui-inspect <url> [options]
9
+ ```
10
+
11
+ ## What I Do
12
+
13
+ 1. **Load Target Page**: Launch browser and navigate to the specified URL
14
+ 2. **Interactive Inspection**: Use browser DevTools to inspect elements
15
+ 3. **Extract Selectors**: Generate CSS/XPath selectors for identified elements
16
+ 4. **Element Properties**: Show attributes, text content, styles, and position
17
+ 5. **Accessibility Info**: Check ARIA labels, roles, and screen reader compatibility
18
+
19
+ ## Options
20
+
21
+ - `--selector <selector>` - Target a specific CSS selector
22
+ - `--screenshot` - Capture screenshot of the inspected page
23
+ - `--headless` - Run browser in headless mode (default: true)
24
+ - `--browser <browser>` - Choose browser: chromium, firefox, webkit (default: chromium)
25
+
26
+ ## Examples
27
+
28
+ ### Inspect a specific element
29
+
30
+ ```bash
31
+ /specweave-ui:ui-inspect https://example.com --selector "button.submit"
32
+ ```
33
+
34
+ ### Capture full-page screenshot
35
+
36
+ ```bash
37
+ /specweave-ui:ui-inspect https://example.com --screenshot
38
+ ```
39
+
40
+ ### Inspect with visible browser
41
+
42
+ ```bash
43
+ /specweave-ui:ui-inspect https://example.com --headless=false
44
+ ```
45
+
46
+ ## Output
47
+
48
+ Provides:
49
+ - **Element Details**: Tag, classes, IDs, data attributes
50
+ - **Selectors**: Multiple selector strategies (CSS, XPath, text-based)
51
+ - **Accessibility**: ARIA attributes, semantic HTML usage
52
+ - **Visual Info**: Dimensions, position, visibility status
53
+ - **Screenshot**: Optional full-page or element screenshot
54
+
55
+ ## Use Cases
56
+
57
+ - **Test Automation**: Find reliable selectors for Playwright/Selenium tests
58
+ - **Web Scraping**: Identify data extraction points
59
+ - **Accessibility Audit**: Check element accessibility
60
+ - **Bug Investigation**: Debug element behavior and properties
61
+
62
+ ## Requirements
63
+
64
+ - Playwright browser binaries (auto-installed on first use)
65
+ - Network access to target URL
66
+
67
+ ## Related Commands
68
+
69
+ - `/specweave-ui:ui-automate` - Create automated browser workflows
70
+ - `/specweave-testing:e2e-setup` - Set up E2E testing framework
@@ -0,0 +1,314 @@
1
+ ---
2
+ name: browser-automation
3
+ description: Browser automation expert using Playwright for UI testing, web scraping, form automation, screenshot capture, and automated workflows. Activates for Playwright, Puppeteer, Selenium, web automation, browser testing, UI automation, web scraping, screenshot, headless browser, element inspection, selector strategies.
4
+ ---
5
+
6
+ # Browser Automation Skill
7
+
8
+ Expert in browser automation using Playwright, Puppeteer, and Selenium. Specializes in UI testing, web scraping, form automation, and automated workflows.
9
+
10
+ ## Expertise Areas
11
+
12
+ ### 1. Playwright Automation
13
+ - **Browser Control**: Launch, navigate, interact with pages
14
+ - **Element Selection**: CSS selectors, XPath, text-based, data-testid
15
+ - **Actions**: Click, fill, select, hover, drag-and-drop
16
+ - **Waiting Strategies**: waitForSelector, waitForNavigation, waitForTimeout
17
+ - **Network Interception**: Mock APIs, block resources, modify requests
18
+ - **Screenshots & Videos**: Full page, element-specific, video recording
19
+
20
+ ### 2. Testing Frameworks
21
+ - **End-to-End Testing**: Playwright Test, Cypress-like workflows
22
+ - **Visual Regression**: Screenshot comparison, pixel diff analysis
23
+ - **Accessibility Testing**: ARIA validation, keyboard navigation
24
+ - **Performance Testing**: Page load times, Core Web Vitals
25
+ - **Mobile Testing**: Emulate devices, touch gestures
26
+
27
+ ### 3. Web Scraping
28
+ - **Data Extraction**: Parse HTML, extract structured data
29
+ - **Pagination**: Navigate through multi-page results
30
+ - **Dynamic Content**: Handle lazy loading, infinite scroll
31
+ - **Authentication**: Login flows, session management
32
+ - **Rate Limiting**: Throttle requests, respect robots.txt
33
+
34
+ ### 4. Form Automation
35
+ - **Input Fields**: Text, email, password, number inputs
36
+ - **Selections**: Dropdowns, radio buttons, checkboxes
37
+ - **File Uploads**: Single and multiple file uploads
38
+ - **Date Pickers**: Custom date widgets
39
+ - **Multi-Step Forms**: Wizard-style form flows
40
+
41
+ ## Code Examples
42
+
43
+ ### Basic Page Navigation
44
+ ```typescript
45
+ import { chromium } from 'playwright';
46
+
47
+ const browser = await chromium.launch({ headless: true });
48
+ const page = await browser.newPage();
49
+ await page.goto('https://example.com', { waitUntil: 'networkidle' });
50
+ await page.screenshot({ path: 'screenshot.png', fullPage: true });
51
+ await browser.close();
52
+ ```
53
+
54
+ ### Form Automation with Validation
55
+ ```typescript
56
+ // Fill and submit form
57
+ await page.fill('input[name="email"]', 'test@example.com');
58
+ await page.fill('input[name="password"]', 'SecurePass123!');
59
+ await page.click('button[type="submit"]');
60
+
61
+ // Wait for success message
62
+ const success = await page.waitForSelector('.success-message', { timeout: 5000 });
63
+ const message = await success.textContent();
64
+ console.log('Success:', message);
65
+ ```
66
+
67
+ ### Data Extraction from Multiple Pages
68
+ ```typescript
69
+ const products = [];
70
+ let page = 1;
71
+
72
+ while (page <= 10) {
73
+ await browser.goto(`https://example.com/products?page=${page}`);
74
+
75
+ const items = await browser.$$eval('.product-item', (elements) =>
76
+ elements.map((el) => ({
77
+ title: el.querySelector('.title')?.textContent,
78
+ price: el.querySelector('.price')?.textContent,
79
+ image: el.querySelector('img')?.src,
80
+ }))
81
+ );
82
+
83
+ products.push(...items);
84
+ page++;
85
+ }
86
+ ```
87
+
88
+ ### Network Interception
89
+ ```typescript
90
+ await page.route('**/api/analytics', (route) => route.abort());
91
+ await page.route('**/api/user', (route) =>
92
+ route.fulfill({
93
+ status: 200,
94
+ body: JSON.stringify({ id: 1, name: 'Test User' }),
95
+ })
96
+ );
97
+ ```
98
+
99
+ ### Visual Regression Testing
100
+ ```typescript
101
+ import { expect } from '@playwright/test';
102
+
103
+ // Capture baseline
104
+ await page.screenshot({ path: 'baseline.png' });
105
+
106
+ // After changes, compare
107
+ const screenshot = await page.screenshot();
108
+ expect(screenshot).toMatchSnapshot('homepage.png');
109
+ ```
110
+
111
+ ## Selector Strategies
112
+
113
+ ### 1. CSS Selectors (Preferred)
114
+ ```typescript
115
+ // ID selector (most reliable)
116
+ await page.click('#submit-button');
117
+
118
+ // Data attribute (best practice)
119
+ await page.click('[data-testid="login-button"]');
120
+
121
+ // Class selector
122
+ await page.click('.btn-primary');
123
+
124
+ // Combined selector
125
+ await page.click('button.submit[type="submit"]');
126
+ ```
127
+
128
+ ### 2. XPath (When CSS isn't enough)
129
+ ```typescript
130
+ // Text-based selection
131
+ await page.click('//button[contains(text(), "Submit")]');
132
+
133
+ // Complex hierarchy
134
+ await page.click('//div[@class="form"]//input[@name="email"]');
135
+ ```
136
+
137
+ ### 3. Playwright-Specific
138
+ ```typescript
139
+ // Text-based
140
+ await page.getByText('Submit').click();
141
+
142
+ // Role-based (accessibility)
143
+ await page.getByRole('button', { name: 'Submit' }).click();
144
+
145
+ // Label-based
146
+ await page.getByLabel('Email address').fill('test@example.com');
147
+
148
+ // Placeholder-based
149
+ await page.getByPlaceholder('Enter your email').fill('test@example.com');
150
+ ```
151
+
152
+ ## Best Practices
153
+
154
+ ### 1. Use Stable Selectors
155
+ ❌ **Bad**: `.css-4j6h2k-button` (auto-generated class)
156
+ ✅ **Good**: `[data-testid="submit-button"]`
157
+
158
+ ### 2. Add Explicit Waits
159
+ ❌ **Bad**: `await page.waitForTimeout(3000);`
160
+ ✅ **Good**: `await page.waitForSelector('.results', { state: 'visible' });`
161
+
162
+ ### 3. Handle Errors Gracefully
163
+ ```typescript
164
+ try {
165
+ await page.click('button', { timeout: 5000 });
166
+ } catch (error) {
167
+ await page.screenshot({ path: 'error.png' });
168
+ console.error('Click failed:', error.message);
169
+ throw error;
170
+ }
171
+ ```
172
+
173
+ ### 4. Clean Up Resources
174
+ ```typescript
175
+ try {
176
+ // automation code
177
+ } finally {
178
+ await browser.close();
179
+ }
180
+ ```
181
+
182
+ ### 5. Use Page Object Model (POM)
183
+ ```typescript
184
+ class LoginPage {
185
+ constructor(private page: Page) {}
186
+
187
+ async login(email: string, password: string) {
188
+ await this.page.fill('[data-testid="email"]', email);
189
+ await this.page.fill('[data-testid="password"]', password);
190
+ await this.page.click('[data-testid="submit"]');
191
+ }
192
+
193
+ async isLoggedIn() {
194
+ return this.page.locator('[data-testid="dashboard"]').isVisible();
195
+ }
196
+ }
197
+ ```
198
+
199
+ ## Common Pitfalls
200
+
201
+ ### 1. Race Conditions
202
+ ```typescript
203
+ // ❌ Race condition
204
+ await page.click('button');
205
+ const text = await page.textContent('.result'); // May fail!
206
+
207
+ // ✅ Wait for element
208
+ await page.click('button');
209
+ await page.waitForSelector('.result');
210
+ const text = await page.textContent('.result');
211
+ ```
212
+
213
+ ### 2. Stale Element References
214
+ ```typescript
215
+ // ❌ Element may become stale
216
+ const element = await page.$('button');
217
+ await page.reload();
218
+ await element.click(); // Error: element detached from DOM
219
+
220
+ // ✅ Re-query after page changes
221
+ await page.reload();
222
+ await page.click('button');
223
+ ```
224
+
225
+ ### 3. Timing Issues with Dynamic Content
226
+ ```typescript
227
+ // ❌ Assumes immediate load
228
+ await page.goto('https://example.com');
229
+ await page.click('.dynamic-content'); // May fail!
230
+
231
+ // ✅ Wait for dynamic content
232
+ await page.goto('https://example.com');
233
+ await page.waitForLoadState('networkidle');
234
+ await page.click('.dynamic-content');
235
+ ```
236
+
237
+ ## Debugging Tools
238
+
239
+ ### 1. Headful Mode
240
+ ```typescript
241
+ const browser = await chromium.launch({ headless: false, slowMo: 100 });
242
+ ```
243
+
244
+ ### 2. Screenshot on Failure
245
+ ```typescript
246
+ test.afterEach(async ({ page }, testInfo) => {
247
+ if (testInfo.status !== 'passed') {
248
+ await page.screenshot({ path: `failure-${testInfo.title}.png` });
249
+ }
250
+ });
251
+ ```
252
+
253
+ ### 3. Trace Recording
254
+ ```typescript
255
+ await context.tracing.start({ screenshots: true, snapshots: true });
256
+ await page.goto('https://example.com');
257
+ // ... automation steps
258
+ await context.tracing.stop({ path: 'trace.zip' });
259
+ ```
260
+
261
+ ### 4. Console Logs
262
+ ```typescript
263
+ page.on('console', (msg) => console.log('Browser log:', msg.text()));
264
+ ```
265
+
266
+ ## Performance Optimization
267
+
268
+ ### 1. Block Unnecessary Resources
269
+ ```typescript
270
+ await page.route('**/*.{png,jpg,jpeg,gif,svg,css}', (route) => route.abort());
271
+ ```
272
+
273
+ ### 2. Reuse Browser Contexts
274
+ ```typescript
275
+ const context = await browser.newContext();
276
+ const page1 = await context.newPage();
277
+ const page2 = await context.newPage();
278
+ // Share cookies, storage, etc.
279
+ ```
280
+
281
+ ### 3. Parallel Execution
282
+ ```typescript
283
+ await Promise.all([
284
+ page1.goto('https://example.com/page1'),
285
+ page2.goto('https://example.com/page2'),
286
+ page3.goto('https://example.com/page3'),
287
+ ]);
288
+ ```
289
+
290
+ ## Activation Keywords
291
+
292
+ Ask me about:
293
+ - "How do I automate browser testing with Playwright?"
294
+ - "Web scraping with Playwright/Puppeteer"
295
+ - "Screenshot automation and visual regression"
296
+ - "Form filling automation"
297
+ - "Element selection strategies"
298
+ - "Handling dynamic content in web automation"
299
+ - "Best practices for UI testing"
300
+ - "Debugging Playwright tests"
301
+
302
+ ## Related Skills
303
+
304
+ - **E2E Testing**: `e2e-playwright` skill
305
+ - **Frontend Development**: `frontend` skill for understanding DOM structure
306
+ - **API Testing**: `api-testing` skill for mocking network requests
307
+
308
+ ## Tools & Frameworks
309
+
310
+ - **Playwright**: Modern browser automation (recommended)
311
+ - **Puppeteer**: Chrome/Chromium-specific automation
312
+ - **Selenium**: Legacy cross-browser automation
313
+ - **Playwright Test**: Full testing framework
314
+ - **Cypress**: Alternative E2E testing framework