← スキル一覧に戻る

webapp-testing
by tienbm92
Personal AI context base used for bootstrapping new projects and feature development. Acts as the backbone for architecture, domain rules, and reusable design patterns.
⭐ 0🍴 0📅 2026年1月26日
SKILL.md
name: webapp-testing description: 'Toolkit cho testing và debugging local web applications sử dụng Playwright. Hỗ trợ verify frontend functionality, debug UI behavior, capture screenshots, view browser logs.'
Web Application Testing Skill
Skill này enable comprehensive testing và debugging của web applications sử dụng Playwright automation.
Khi Nào Sử Dụng
- Test frontend functionality trong real browser
- Verify UI behavior và interactions
- Debug web application issues
- Capture screenshots cho documentation/debugging
- Inspect browser console logs
- Validate form submissions và user flows
- Check responsive design across viewports
Prerequisites
- Node.js installed
- Locally running web application (hoặc accessible URL)
- Playwright sẽ auto-install nếu chưa có
Core Capabilities
1. Browser Automation
| Action | Description |
|---|---|
| Navigate | Go to URLs |
| Click | Buttons, links |
| Fill | Form fields |
| Select | Dropdowns |
| Handle | Dialogs, alerts |
2. Verification
| Check | Description |
|---|---|
| Element presence | Assert element exists |
| Text content | Verify text |
| Visibility | Check element visible |
| URLs | Validate navigation |
| Responsive | Test viewports |
3. Debugging
| Feature | Description |
|---|---|
| Screenshots | Capture page state |
| Console logs | View browser console |
| Network | Inspect requests |
| Failed tests | Debug failures |
Usage Examples
Basic Navigation Test
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('http://localhost:3000');
await page.click('text=Login');
await page.fill('#email', 'test@example.com');
await page.fill('#password', 'password123');
await page.click('button[type="submit"]');
// Verify login success
await page.waitForSelector('.dashboard');
await browser.close();
})();
Screenshot Capture
await page.screenshot({ path: 'screenshot.png', fullPage: true });
Viewport Testing
const viewports = [
{ width: 375, height: 667, name: 'mobile' },
{ width: 768, height: 1024, name: 'tablet' },
{ width: 1280, height: 720, name: 'desktop' },
];
for (const vp of viewports) {
await page.setViewportSize({ width: vp.width, height: vp.height });
await page.screenshot({ path: `${vp.name}.png` });
}
Form Validation Test
// Test empty form submission
await page.click('button[type="submit"]');
const errorMessage = await page.textContent('.error');
expect(errorMessage).toBe('Email is required');
// Test invalid email
await page.fill('#email', 'invalid-email');
await page.click('button[type="submit"]');
const emailError = await page.textContent('.email-error');
expect(emailError).toBe('Please enter a valid email');
Testing Patterns
Page Object Model
class LoginPage {
constructor(page) {
this.page = page;
this.emailInput = '#email';
this.passwordInput = '#password';
this.submitButton = 'button[type="submit"]';
}
async login(email, password) {
await this.page.fill(this.emailInput, email);
await this.page.fill(this.passwordInput, password);
await this.page.click(this.submitButton);
}
}
Wait Strategies
// Wait for element
await page.waitForSelector('.element');
// Wait for navigation
await page.waitForNavigation();
// Wait for network idle
await page.waitForLoadState('networkidle');
// Custom timeout
await page.waitForSelector('.element', { timeout: 10000 });
Guidelines
- Always verify app is running - Check server accessible before tests
- Use explicit waits - Wait for elements/navigation before interacting
- Capture screenshots on failure - Help debug issues
- Clean up resources - Always close browser when done
- Handle timeouts gracefully - Set reasonable timeouts
- Test incrementally - Start simple before complex flows
- Use selectors wisely - Prefer data-testid hoặc role-based selectors
Common Selectors
| Type | Example | Best For |
|---|---|---|
| Test ID | [data-testid="login-btn"] | Explicit test hooks |
| Role | role=button[name="Submit"] | Accessibility |
| Text | text=Click me | Visible text |
| CSS | .class-name | Styling hooks |
| ID | #element-id | Unique elements |
Viewport Reference
| Name | Width | Device |
|---|---|---|
| Mobile | 375px | iPhone SE/12 mini |
| Tablet | 768px | iPad |
| Desktop | 1280px | Standard PC |
| Wide | 1920px | Large display |
Limitations
- Requires running web application
- Cannot test native mobile apps
- Network-dependent for external resources
- Some interactions may need workarounds
スコア
総合スコア
70/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です