Back to list
tienbm92

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📅 Jan 26, 2026

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

ActionDescription
NavigateGo to URLs
ClickButtons, links
FillForm fields
SelectDropdowns
HandleDialogs, alerts

2. Verification

CheckDescription
Element presenceAssert element exists
Text contentVerify text
VisibilityCheck element visible
URLsValidate navigation
ResponsiveTest viewports

3. Debugging

FeatureDescription
ScreenshotsCapture page state
Console logsView browser console
NetworkInspect requests
Failed testsDebug 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

  1. Always verify app is running - Check server accessible before tests
  2. Use explicit waits - Wait for elements/navigation before interacting
  3. Capture screenshots on failure - Help debug issues
  4. Clean up resources - Always close browser when done
  5. Handle timeouts gracefully - Set reasonable timeouts
  6. Test incrementally - Start simple before complex flows
  7. Use selectors wisely - Prefer data-testid hoặc role-based selectors

Common Selectors

TypeExampleBest For
Test ID[data-testid="login-btn"]Explicit test hooks
Rolerole=button[name="Submit"]Accessibility
Texttext=Click meVisible text
CSS.class-nameStyling hooks
ID#element-idUnique elements

Viewport Reference

NameWidthDevice
Mobile375pxiPhone SE/12 mini
Tablet768pxiPad
Desktop1280pxStandard PC
Wide1920pxLarge display

Limitations

  • Requires running web application
  • Cannot test native mobile apps
  • Network-dependent for external resources
  • Some interactions may need workarounds

Score

Total Score

70/100

Based on repository quality metrics

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

Reviews

💬

Reviews coming soon