developer-ai 1.0.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.
- package/README.md +241 -0
- package/bin/developer-ai.js +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +219 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +82 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +115 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +29 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/agent.d.ts +38 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +155 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +44 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/types.d.ts +42 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +13 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +202 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/providers/ollama.d.ts +13 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +60 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +9 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +40 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/skills/loader.d.ts +25 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +93 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/tests/tools.test.d.ts +2 -0
- package/dist/tests/tools.test.d.ts.map +1 -0
- package/dist/tests/tools.test.js +170 -0
- package/dist/tests/tools.test.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +19 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-files.d.ts +3 -0
- package/dist/tools/list-files.d.ts.map +1 -0
- package/dist/tools/list-files.js +60 -0
- package/dist/tools/list-files.js.map +1 -0
- package/dist/tools/read-file.d.ts +3 -0
- package/dist/tools/read-file.d.ts.map +1 -0
- package/dist/tools/read-file.js +46 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/registry.d.ts +24 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +37 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/run-command.d.ts +3 -0
- package/dist/tools/run-command.d.ts.map +1 -0
- package/dist/tools/run-command.js +114 -0
- package/dist/tools/run-command.js.map +1 -0
- package/dist/tools/search-text.d.ts +3 -0
- package/dist/tools/search-text.d.ts.map +1 -0
- package/dist/tools/search-text.js +103 -0
- package/dist/tools/search-text.js.map +1 -0
- package/dist/tools/utils.d.ts +6 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +14 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/tools/web-search.d.ts +3 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +80 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/write-file.d.ts +3 -0
- package/dist/tools/write-file.d.ts.map +1 -0
- package/dist/tools/write-file.js +66 -0
- package/dist/tools/write-file.js.map +1 -0
- package/package.json +54 -0
- package/skills/accessibility/SKILL.md +496 -0
- package/skills/api-design/SKILL.md +419 -0
- package/skills/code-review/SKILL.md +267 -0
- package/skills/debugging/SKILL.md +332 -0
- package/skills/documentation/SKILL.md +496 -0
- package/skills/error-handling/SKILL.md +504 -0
- package/skills/git-workflow/SKILL.md +448 -0
- package/skills/human-like-coding/SKILL.md +400 -0
- package/skills/performance-optimization/SKILL.md +412 -0
- package/skills/prompt-engineering/SKILL.md +362 -0
- package/skills/refactoring/SKILL.md +457 -0
- package/skills/security-audit/SKILL.md +453 -0
- package/skills/testing-strategy/SKILL.md +501 -0
- package/skills/webapp-testing/SKILL.md +309 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webapp-testing
|
|
3
|
+
description: Comprehensive toolkit for testing web applications. Use when testing frontend functionality, debugging UI behavior, writing test cases, setting up testing frameworks, or verifying browser compatibility. Includes strategies for unit tests, integration tests, E2E tests, and visual regression testing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Web Application Testing Skill
|
|
7
|
+
|
|
8
|
+
This skill provides guidance for comprehensive web application testing, from unit tests to end-to-end testing strategies.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Effective web testing requires a balanced approach across multiple testing layers. This skill helps you write better tests and choose the right testing strategy for each scenario.
|
|
13
|
+
|
|
14
|
+
## Testing Pyramid
|
|
15
|
+
|
|
16
|
+
### Unit Tests (Base - Most Tests)
|
|
17
|
+
- Test individual functions/components in isolation
|
|
18
|
+
- Fast execution, easy to debug
|
|
19
|
+
- Mock external dependencies
|
|
20
|
+
- Aim for 70-80% of total tests
|
|
21
|
+
|
|
22
|
+
### Integration Tests (Middle)
|
|
23
|
+
- Test component interactions
|
|
24
|
+
- Verify API integrations work correctly
|
|
25
|
+
- Test database operations
|
|
26
|
+
- Aim for 15-20% of total tests
|
|
27
|
+
|
|
28
|
+
### E2E Tests (Top - Fewest Tests)
|
|
29
|
+
- Test complete user flows
|
|
30
|
+
- Verify critical paths work
|
|
31
|
+
- Slower but most realistic
|
|
32
|
+
- Aim for 5-10% of total tests
|
|
33
|
+
|
|
34
|
+
## Testing Framework Setup
|
|
35
|
+
|
|
36
|
+
### React Testing (Vitest + Testing Library)
|
|
37
|
+
```javascript
|
|
38
|
+
// vitest.config.js
|
|
39
|
+
import { defineConfig } from 'vitest/config';
|
|
40
|
+
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
test: {
|
|
43
|
+
environment: 'jsdom',
|
|
44
|
+
globals: true,
|
|
45
|
+
setupFiles: './src/test/setup.js',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Vue Testing
|
|
51
|
+
```javascript
|
|
52
|
+
// vitest.config.js
|
|
53
|
+
import { defineConfig } from 'vitest/config';
|
|
54
|
+
import vue from '@vitejs/plugin-vue';
|
|
55
|
+
|
|
56
|
+
export default defineConfig({
|
|
57
|
+
plugins: [vue()],
|
|
58
|
+
test: {
|
|
59
|
+
environment: 'jsdom',
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### E2E Testing (Playwright)
|
|
65
|
+
```javascript
|
|
66
|
+
// playwright.config.js
|
|
67
|
+
import { defineConfig } from '@playwright/test';
|
|
68
|
+
|
|
69
|
+
export default defineConfig({
|
|
70
|
+
testDir: './e2e',
|
|
71
|
+
use: {
|
|
72
|
+
baseURL: 'http://localhost:3000',
|
|
73
|
+
screenshot: 'only-on-failure',
|
|
74
|
+
video: 'retain-on-failure',
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Component Testing Patterns
|
|
80
|
+
|
|
81
|
+
### Testing User Interactions
|
|
82
|
+
```javascript
|
|
83
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
84
|
+
import { Button } from './Button';
|
|
85
|
+
|
|
86
|
+
test('calls onClick when clicked', async () => {
|
|
87
|
+
const handleClick = vi.fn();
|
|
88
|
+
render(<Button onClick={handleClick}>Click me</Button>);
|
|
89
|
+
|
|
90
|
+
await fireEvent.click(screen.getByRole('button'));
|
|
91
|
+
|
|
92
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Testing Async Operations
|
|
97
|
+
```javascript
|
|
98
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
99
|
+
import { UserProfile } from './UserProfile';
|
|
100
|
+
|
|
101
|
+
test('loads and displays user data', async () => {
|
|
102
|
+
render(<UserProfile userId="123" />);
|
|
103
|
+
|
|
104
|
+
// Wait for loading to complete
|
|
105
|
+
await waitFor(() => {
|
|
106
|
+
expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
expect(screen.getByText('John Doe')).toBeInTheDocument();
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Testing Form Validation
|
|
114
|
+
```javascript
|
|
115
|
+
test('shows validation errors for invalid input', async () => {
|
|
116
|
+
render(<ContactForm />);
|
|
117
|
+
|
|
118
|
+
// Submit empty form
|
|
119
|
+
await fireEvent.click(screen.getByRole('button', { name: /submit/i }));
|
|
120
|
+
|
|
121
|
+
expect(screen.getByText('Email is required')).toBeInTheDocument();
|
|
122
|
+
expect(screen.getByText('Name is required')).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## E2E Testing Patterns
|
|
127
|
+
|
|
128
|
+
### Page Object Model
|
|
129
|
+
```javascript
|
|
130
|
+
// e2e/pages/LoginPage.js
|
|
131
|
+
export class LoginPage {
|
|
132
|
+
constructor(page) {
|
|
133
|
+
this.page = page;
|
|
134
|
+
this.emailInput = page.locator('[data-testid="email"]');
|
|
135
|
+
this.passwordInput = page.locator('[data-testid="password"]');
|
|
136
|
+
this.submitButton = page.locator('[data-testid="submit"]');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async login(email, password) {
|
|
140
|
+
await this.emailInput.fill(email);
|
|
141
|
+
await this.passwordInput.fill(password);
|
|
142
|
+
await this.submitButton.click();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Testing Critical User Flows
|
|
148
|
+
```javascript
|
|
149
|
+
import { test, expect } from '@playwright/test';
|
|
150
|
+
import { LoginPage } from './pages/LoginPage';
|
|
151
|
+
|
|
152
|
+
test('user can complete checkout flow', async ({ page }) => {
|
|
153
|
+
const loginPage = new LoginPage(page);
|
|
154
|
+
|
|
155
|
+
await page.goto('/');
|
|
156
|
+
await loginPage.login('user@example.com', 'password');
|
|
157
|
+
|
|
158
|
+
// Add item to cart
|
|
159
|
+
await page.click('[data-testid="add-to-cart"]');
|
|
160
|
+
await page.click('[data-testid="cart-icon"]');
|
|
161
|
+
|
|
162
|
+
// Proceed to checkout
|
|
163
|
+
await page.click('[data-testid="checkout-button"]');
|
|
164
|
+
|
|
165
|
+
// Verify order confirmation
|
|
166
|
+
await expect(page.locator('.order-confirmation')).toBeVisible();
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Accessibility Testing
|
|
171
|
+
|
|
172
|
+
### Automated A11y Checks
|
|
173
|
+
```javascript
|
|
174
|
+
import { test, expect } from '@playwright/test';
|
|
175
|
+
import AxeBuilder from '@axe-core/playwright';
|
|
176
|
+
|
|
177
|
+
test('page should be accessible', async ({ page }) => {
|
|
178
|
+
await page.goto('/');
|
|
179
|
+
|
|
180
|
+
const results = await new AxeBuilder({ page }).analyze();
|
|
181
|
+
|
|
182
|
+
expect(results.violations).toEqual([]);
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Manual A11y Checklist
|
|
187
|
+
- [ ] All images have alt text
|
|
188
|
+
- [ ] Form inputs have labels
|
|
189
|
+
- [ ] Color contrast meets WCAG AA
|
|
190
|
+
- [ ] Keyboard navigation works
|
|
191
|
+
- [ ] Focus indicators are visible
|
|
192
|
+
- [ ] Screen reader announces content correctly
|
|
193
|
+
|
|
194
|
+
## Visual Regression Testing
|
|
195
|
+
|
|
196
|
+
### Using Playwright Screenshots
|
|
197
|
+
```javascript
|
|
198
|
+
test('homepage visual regression', async ({ page }) => {
|
|
199
|
+
await page.goto('/');
|
|
200
|
+
|
|
201
|
+
await expect(page).toHaveScreenshot('homepage.png', {
|
|
202
|
+
maxDiffPixels: 100,
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## API Testing
|
|
208
|
+
|
|
209
|
+
### Testing API Endpoints
|
|
210
|
+
```javascript
|
|
211
|
+
import { test, expect } from '@playwright/test';
|
|
212
|
+
|
|
213
|
+
test('API returns user data', async ({ request }) => {
|
|
214
|
+
const response = await request.get('/api/users/123');
|
|
215
|
+
|
|
216
|
+
expect(response.ok()).toBeTruthy();
|
|
217
|
+
|
|
218
|
+
const data = await response.json();
|
|
219
|
+
expect(data).toHaveProperty('id', '123');
|
|
220
|
+
expect(data).toHaveProperty('email');
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Test Organization Best Practices
|
|
225
|
+
|
|
226
|
+
### File Structure
|
|
227
|
+
```
|
|
228
|
+
src/
|
|
229
|
+
├── components/
|
|
230
|
+
│ ├── Button/
|
|
231
|
+
│ │ ├── Button.jsx
|
|
232
|
+
│ │ ├── Button.test.jsx
|
|
233
|
+
│ │ └── Button.module.css
|
|
234
|
+
e2e/
|
|
235
|
+
├── pages/
|
|
236
|
+
│ └── LoginPage.js
|
|
237
|
+
├── tests/
|
|
238
|
+
│ └── auth.spec.js
|
|
239
|
+
└── fixtures/
|
|
240
|
+
└── users.json
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Naming Conventions
|
|
244
|
+
- Describe what is being tested
|
|
245
|
+
- Use clear, descriptive names
|
|
246
|
+
- Group related tests with `describe`
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
describe('Button component', () => {
|
|
250
|
+
describe('when clicked', () => {
|
|
251
|
+
test('calls onClick handler', () => {});
|
|
252
|
+
test('does not call handler when disabled', () => {});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
describe('accessibility', () => {
|
|
256
|
+
test('has correct ARIA attributes', () => {});
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Debugging Tests
|
|
262
|
+
|
|
263
|
+
### Common Issues and Solutions
|
|
264
|
+
|
|
265
|
+
**Flaky tests:**
|
|
266
|
+
- Add proper wait conditions
|
|
267
|
+
- Don't rely on timing
|
|
268
|
+
- Use data-testid for stable selectors
|
|
269
|
+
|
|
270
|
+
**Slow tests:**
|
|
271
|
+
- Mock external APIs
|
|
272
|
+
- Use test database snapshots
|
|
273
|
+
- Parallelize test execution
|
|
274
|
+
|
|
275
|
+
**Hard to debug:**
|
|
276
|
+
- Use trace viewer in Playwright
|
|
277
|
+
- Add descriptive error messages
|
|
278
|
+
- Log intermediate states
|
|
279
|
+
|
|
280
|
+
## CI/CD Integration
|
|
281
|
+
|
|
282
|
+
### GitHub Actions Example
|
|
283
|
+
```yaml
|
|
284
|
+
name: Tests
|
|
285
|
+
on: [push, pull_request]
|
|
286
|
+
|
|
287
|
+
jobs:
|
|
288
|
+
test:
|
|
289
|
+
runs-on: ubuntu-latest
|
|
290
|
+
steps:
|
|
291
|
+
- uses: actions/checkout@v4
|
|
292
|
+
- uses: actions/setup-node@v4
|
|
293
|
+
- run: npm ci
|
|
294
|
+
- run: npm test
|
|
295
|
+
- run: npx playwright install
|
|
296
|
+
- run: npm run test:e2e
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Summary Checklist
|
|
300
|
+
|
|
301
|
+
When setting up tests:
|
|
302
|
+
- [ ] Choose appropriate test types for each feature
|
|
303
|
+
- [ ] Set up testing frameworks correctly
|
|
304
|
+
- [ ] Follow testing pyramid proportions
|
|
305
|
+
- [ ] Use Page Object Model for E2E
|
|
306
|
+
- [ ] Include accessibility testing
|
|
307
|
+
- [ ] Add visual regression tests for critical UI
|
|
308
|
+
- [ ] Configure CI/CD integration
|
|
309
|
+
- [ ] Document testing approach for team
|