app-testing
npx skills add https://github.com/alfredang/skills --skill app-testing
Agent 安装分布
Skill 文档
App Testing
Test application functionality and mobile responsiveness on localhost or remote live sites using Playwright MCP browser automation. Navigates pages, interacts with elements, validates content, tests mobile-friendliness across device viewports, and reports results.
Command
/test-app or test-app
Navigate
Testing & QA
Keywords
test app, test site, test my app, test my site, test localhost, test live site, functional test, ui test, smoke test, e2e test, end to end test, test buttons, test forms, test navigation, test links, playwright test, browser test, test functionality, qa test, test page, test deployed site, test production, verify app, check app works, test-app, test mobile, mobile friendly, responsive test, mobile view, mobile responsiveness, test on phone, mobile testing, responsive design test, viewport test
Description
Uses Playwright MCP to launch a browser, navigate to your app (localhost or remote URL), and systematically test functionality and mobile responsiveness. Takes snapshots to understand page structure, interacts with elements (clicks, types, selects), validates expected behavior, resizes the browser to mobile/tablet viewports to verify responsive design, and generates a test report with pass/fail results and screenshots of failures.
Execution
This skill runs using Claude Code with subscription plan. Requires the Playwright MCP server to be configured and available. All browser interactions use Playwright MCP tools (browser_navigate, browser_snapshot, browser_click, browser_type, etc.).
Response
I’ll test your app’s functionality using Playwright MCP!
The workflow includes:
| Step | Description |
|---|---|
| Discover | Determine target URL (localhost or remote) |
| Snapshot | Take accessibility snapshot to understand page structure |
| Plan | Identify testable elements and user flows |
| Execute | Run through test scenarios interacting with the app |
| Validate | Check expected outcomes after each interaction |
| Mobile | Test responsiveness across mobile and tablet viewports |
| Report | Generate test summary with pass/fail results |
Instructions
When executing /test-app, follow this workflow:
Phase 0: Determine Target URL
The user may provide a URL directly or you need to detect it:
-
If user provides a URL (e.g.,
test-app https://mysite.comortest-app localhost:3000):- Use the provided URL directly
- If just a domain without protocol, prepend
https:// - If
localhostwithout port, try common ports: 3000, 5173, 8080, 8000, 4321
-
If no URL provided, auto-detect:
- Check for running localhost servers by scanning common ports:
for port in 3000 5173 8080 8000 4321 8501 5000 9292; do lsof -ti:$port >/dev/null 2>&1 && echo "Found server on port $port" done - If exactly one server is found, use it
- If multiple servers found, ask the user which one to test
- If no server found, check for a deployed URL:
- Look for
vercel.json,.vercel/project.jsonfor Vercel deployments - Look for
CNAMEfile or.github/workflowsfor GitHub Pages - Check
package.jsonforhomepagefield
- Look for
- If nothing found, ask the user for the URL
- Check for running localhost servers by scanning common ports:
-
Validate the target is reachable:
curl -s -o /dev/null -w "%{http_code}" <URL> 2>/dev/null- If the response is not 2xx or 3xx, inform the user the target is unreachable
- For localhost, ensure the server is running first (suggest
/start-appif not)
Phase 1: Initial Page Load & Snapshot
Navigate to the target URL and capture the initial state:
-
Navigate to the app: Use
browser_navigateto open the target URL. -
Take accessibility snapshot: Use
browser_snapshotto get the full page structure. This returns a structured representation of all interactive elements, text content, links, buttons, forms, and navigation. -
Take a screenshot for visual reference: Use
browser_take_screenshotto capture the initial visual state. -
Analyze the page structure: From the snapshot, identify:
- Navigation menus and links
- Buttons and interactive elements
- Forms and input fields
- Main content areas
- Dynamic elements (dropdowns, modals, tabs)
- Error messages or broken elements
Phase 2: Plan Test Scenarios
Based on the page snapshot, plan test scenarios organized by priority:
2.1 Critical Path Tests (always run)
- Page loads successfully â no error states, main content renders
- Navigation works â all nav links are clickable and lead to valid pages
- No console errors â check
browser_console_messagesfor errors - No broken network requests â check
browser_network_requestsfor failed calls
2.2 Interactive Element Tests
- Buttons â click each visible button and verify expected behavior
- Links â verify internal links navigate correctly, external links exist
- Forms â fill in form fields and submit, verify validation messages
- Dropdowns/Selects â open and select options
- Tabs/Accordions â toggle and verify content changes
- Modals/Dialogs â trigger and verify they open/close properly
2.3 Content Validation Tests
- Text content â verify headings, paragraphs, and labels are present
- Images â verify images load (no broken image indicators)
- Lists/Tables â verify data renders correctly
- Dynamic content â verify content loads after API calls
2.4 User Flow Tests (if applicable)
Identify common user flows based on the app type:
- Auth apps â login/signup/logout flow
- E-commerce â browse/add to cart/checkout flow
- Forms â fill/validate/submit flow
- Dashboards â navigate between views, filter/sort data
- Landing pages â CTA buttons, anchor links, contact forms
Phase 3: Execute Tests
Run each test scenario using Playwright MCP tools. For each test:
- Snapshot before action â use
browser_snapshotto understand current state - Perform the action â use the appropriate Playwright MCP tool:
browser_clickâ for buttons, links, tabsbrowser_typeâ for text inputsbrowser_fill_formâ for multiple form fieldsbrowser_select_optionâ for dropdownsbrowser_press_keyâ for keyboard interactions (Enter, Escape, Tab)browser_hoverâ for hover states and tooltipsbrowser_navigateâ for direct URL navigationbrowser_navigate_backâ to return to previous page
- Snapshot after action â use
browser_snapshotto verify the result - Validate â check that the expected outcome occurred:
- Element appeared/disappeared
- Text changed
- Page navigated
- Form submitted successfully
- Error message displayed for invalid input
- Screenshot on failure â if a test fails, use
browser_take_screenshotto capture the failure state
Test Execution Rules
- Wait for dynamic content â use
browser_wait_forwhen expecting async changes - Handle dialogs â use
browser_handle_dialogif alerts/confirms appear - Check console â periodically use
browser_console_messagesto catch JS errors - Check network â use
browser_network_requeststo catch failed API calls - Navigate back â after testing a sub-page, navigate back to continue testing
- Use tabs â use
browser_tabsto manage multiple pages if needed
Phase 4: Multi-Page Testing
If the app has multiple pages/routes:
- Collect all navigation links from the snapshot
- Visit each page and run Phase 1 (snapshot + basic validation) on each
- Test cross-page flows (e.g., add to cart on page A, verify cart on page B)
- Test browser back/forward navigation
For single-page apps (SPAs):
- Test client-side routing by clicking nav elements
- Verify URL changes in the browser
- Test deep linking by navigating directly to routes
Phase 5: Mobile Responsiveness Testing
After desktop testing, resize the browser to test mobile-friendliness across common device viewports. This phase ensures the app works well on phones and tablets.
5.1 Define Test Viewports
Test at these standard device sizes (width x height):
| Device | Width | Height | Category |
|---|---|---|---|
| iPhone SE | 375 | 667 | Small phone |
| iPhone 14 / 15 | 390 | 844 | Standard phone |
| iPhone 14 Pro Max | 430 | 932 | Large phone |
| iPad Mini | 768 | 1024 | Small tablet |
| iPad Air / Pro | 820 | 1180 | Standard tablet |
At minimum, always test these 3 viewports:
- Small phone (375Ã667) â catches tight layout issues
- Standard phone (390Ã844) â most common mobile device
- Tablet (768Ã1024) â catches tablet breakpoint issues
5.2 Mobile Test Execution
For each viewport, perform the following:
-
Resize the browser: Use
browser_resizeto set the viewport dimensions:browser_resize(width: 375, height: 667) // iPhone SE -
Navigate to the main page: Use
browser_navigateto reload the app at the target URL (ensures fresh responsive layout). -
Take a screenshot: Use
browser_take_screenshotto capture the mobile layout for visual reference. -
Take an accessibility snapshot: Use
browser_snapshotto get the page structure at this viewport size. -
Check for mobile layout issues:
- Horizontal overflow â look for horizontal scrollbars or content extending beyond the viewport. Use
browser_evaluateto check:() => document.documentElement.scrollWidth > document.documentElement.clientWidth - Viewport meta tag â verify the page has a proper viewport meta tag. Use
browser_evaluate:() => { const meta = document.querySelector('meta[name="viewport"]'); return meta ? meta.getAttribute('content') : 'MISSING'; } - Touch target sizes â verify buttons and links are at least 44x44px for tap accessibility. Use
browser_evaluate:() => { const issues = []; document.querySelectorAll('a, button, [role="button"], input, select, textarea').forEach(el => { const rect = el.getBoundingClientRect(); if (rect.width > 0 && rect.height > 0 && (rect.width < 44 || rect.height < 44)) { issues.push({ tag: el.tagName, text: el.textContent?.slice(0, 30), width: Math.round(rect.width), height: Math.round(rect.height) }); } }); return issues.length > 0 ? issues : 'ALL PASS'; } - Text readability â check that body font size is at least 16px (prevents auto-zoom on iOS). Use
browser_evaluate:() => { const body = document.body; const fontSize = parseFloat(window.getComputedStyle(body).fontSize); const inputs = document.querySelectorAll('input, textarea, select'); const smallInputs = []; inputs.forEach(el => { const size = parseFloat(window.getComputedStyle(el).fontSize); if (size < 16) smallInputs.push({ tag: el.tagName, type: el.type, fontSize: size }); }); return { bodyFontSize: fontSize, inputsBelow16px: smallInputs.length > 0 ? smallInputs : 'NONE' }; }
- Horizontal overflow â look for horizontal scrollbars or content extending beyond the viewport. Use
-
Test mobile navigation:
- Hamburger menu â look for a hamburger/menu icon button in the snapshot. If found:
- Click it with
browser_click - Snapshot to verify the mobile nav menu opens
- Verify all navigation links are visible and clickable
- Click each nav link to verify it works
- Verify the menu can be closed (click hamburger again, click outside, or press Escape)
- Click it with
- Sticky/fixed headers â scroll down and verify header stays visible if sticky. Use
browser_evaluate:() => { window.scrollTo(0, 500); const header = document.querySelector('header, nav, [role="banner"]'); if (!header) return 'NO HEADER FOUND'; const rect = header.getBoundingClientRect(); return { isVisible: rect.top >= 0 && rect.bottom <= window.innerHeight, top: rect.top }; } - Bottom navigation â if a mobile bottom nav exists, verify it stays fixed at bottom
- Hamburger menu â look for a hamburger/menu icon button in the snapshot. If found:
-
Test mobile-specific interactions:
- Scroll behavior â use
browser_evaluateto scroll and verify smooth scrolling works:() => { window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); return 'scrolled to bottom'; } - Forms on mobile â verify form fields are usable (not hidden behind keyboard, proper input types)
- Modals/overlays â if tested in desktop phase, re-test that modals fit within mobile viewport
- Images â verify images scale down and don’t overflow the viewport
- Tables â check if tables have horizontal scroll wrappers or responsive alternatives
- Scroll behavior â use
-
Test content stacking:
- Verify multi-column layouts properly stack to single-column on mobile
- Check that sidebars collapse or move below main content
- Verify cards/grid items reflow properly
5.3 Responsive Breakpoint Transitions
After testing individual viewports, test the transition between breakpoints:
- Start at desktop (1280Ã800) with
browser_resize - Step down through breakpoints:
- 1024Ã768 (small desktop / landscape tablet)
- 768Ã1024 (tablet portrait)
- 390Ã844 (phone)
- At each step, take a snapshot and screenshot to verify:
- Layout transitions smoothly (no broken intermediate states)
- Navigation switches between desktop and mobile modes at an appropriate breakpoint
- Content remains accessible at every width
5.4 Restore Desktop Viewport
After mobile testing, restore the browser to desktop size:
browser_resize(width: 1280, height: 800)
Phase 6: Generate Test Report
After all tests complete, generate a structured report:
## Test Report
**Target:** <URL>
**Date:** <current date/time>
**Total Tests:** <count>
**Passed:** <count> | **Failed:** <count> | **Skipped:** <count>
### Results
| # | Test | Status | Details |
|---|------|--------|---------|
| 1 | Page loads successfully | PASS | Main content rendered in <X>ms |
| 2 | Navigation - Home link | PASS | Navigated to / |
| 3 | Navigation - About link | PASS | Navigated to /about |
| 4 | Login form submission | FAIL | Expected redirect, got validation error |
| 5 | Contact form - empty submit | PASS | Validation messages displayed |
| ... | ... | ... | ... |
### Failures
#### Test 4: Login form submission
- **Action:** Filled email/password and clicked Submit
- **Expected:** Redirect to dashboard
- **Actual:** Validation error "Invalid credentials"
- **Screenshot:** [captured]
### Console Errors
- [error] Failed to load resource: /api/users (404)
- [warning] React: Each child in a list should have a unique "key" prop
### Network Issues
- GET /api/users â 404 Not Found
- POST /api/login â 500 Internal Server Error
### Mobile Responsiveness
| Viewport | Status | Issues |
|----------|--------|--------|
| iPhone SE (375Ã667) | PASS/FAIL | Details |
| iPhone 14 (390Ã844) | PASS/FAIL | Details |
| iPad Mini (768Ã1024) | PASS/FAIL | Details |
#### Mobile Issues Found
- **Horizontal overflow** on iPhone SE â content extends 40px beyond viewport
- **Touch targets too small** â 3 buttons under 44px height on mobile nav
- **Missing viewport meta tag** â page does not have `<meta name="viewport">`
- **Input font size < 16px** â email input has 14px font (causes iOS auto-zoom)
- **Hamburger menu not functional** â menu icon present but click has no effect
### Recommendations
- Fix the /api/users endpoint returning 404
- Add proper error handling for login failures
- Add alt text to images on the homepage
- Add `<meta name="viewport" content="width=device-width, initial-scale=1">` if missing
- Increase touch target sizes to minimum 44Ã44px
- Set input font sizes to at least 16px to prevent iOS auto-zoom
- Add responsive breakpoints for mobile layouts
Phase 7: Cleanup
After testing:
- Close the browser with
browser_close - Display the test report to the user
- If failures were found, offer to:
- Investigate specific failures in more detail
- Re-run failed tests after fixes
- Take additional screenshots
Advanced Usage
Testing with Arguments
Users can pass specific test targets:
/test-appâ auto-detect URL, run all tests/test-app http://localhost:3000â test specific localhost/test-app https://mysite.comâ test remote site/test-app https://mysite.com/loginâ test specific page/test-app --formsâ focus on form testing/test-app --navâ focus on navigation testing/test-app --a11yâ focus on accessibility checks/test-app --mobileâ focus on mobile responsiveness testing only/test-app --responsiveâ run full responsive test across all viewports
Testing Remote vs Local
Localhost testing:
- Can test with hot-reload (changes reflect immediately)
- Can test authenticated flows with test credentials
- Can test API endpoints directly
Remote/live site testing:
- Tests the deployed production build
- Validates CDN, SSL, and production configs
- Can catch deployment-specific issues
- Respects rate limits and avoids destructive actions (no form submissions with real data unless explicitly requested)
Capabilities
- Navigate to any localhost or remote URL via Playwright MCP
- Take accessibility snapshots to understand full page structure
- Click buttons, links, tabs, and any interactive elements
- Fill and submit forms with test data
- Validate page content, navigation, and UI behavior
- Capture screenshots for visual verification and failure documentation
- Check browser console for JavaScript errors
- Monitor network requests for failed API calls
- Test multi-page flows and SPA client-side routing
- Handle browser dialogs (alerts, confirms, prompts)
- Test mobile responsiveness by resizing to phone/tablet viewports (iPhone SE, iPhone 14, iPad Mini, etc.)
- Detect mobile layout issues â horizontal overflow, small touch targets, missing viewport meta, font size issues
- Test mobile navigation â hamburger menus, sticky headers, bottom nav bars
- Verify responsive breakpoint transitions â layout changes smoothly from desktop to mobile
- Generate structured test reports with pass/fail results including mobile responsiveness section
Notes
- This skill requires Playwright MCP to be configured in Claude Code
- For localhost testing, ensure the app is running first (use
/start-appif needed) - The skill does NOT modify any application code â it only reads and interacts via the browser
- Remote site testing avoids destructive actions by default (no real purchases, account deletions, etc.)
- Form testing uses obviously fake test data (e.g., test@example.com, “Test User”)
- Screenshots are captured for failures to help debug issues
- Console and network errors are always checked even if not explicitly requested