webapp-testing — Claude Code command: test web apps with Playwright
A slash command that drives your local web app in a real browser through Playwright: clicks, forms, screenshots, console logs.
npx claude-code-templates@latest --command testing/webapp-testingWhat webapp-testing does
The webapp-testing command opens a page in a browser and checks that the UI behaves as intended. Navigation, form filling, dropdown selection, dialog handling — the agent does it and reports back. Handy when the frontend is already running locally and clicking through forms by hand is a chore.
Under the hood it uses Playwright automation: asserting element presence, text and visibility, validating URLs, taking screenshots, reading console logs and network requests. Ready-made patterns cover waiting for an element, checking existence, and catching errors with a screenshot. The command grants the agent only Bash and Read.
You need Node.js and a running local app before starting. Playwright installs automatically if missing. Native mobile apps are out of scope — the authors point to React Native Testing Library instead. Complex authentication flows may break, and some modern frameworks need extra configuration.
What it helps with
- verify a form submits and lands on the dashboard in a real browser
- capture a screenshot when a test fails
- read console logs and network requests
- confirm an element is visible and shows the right text
- start with a simple interaction before a complex flow
Example prompts for the agent
- run webapp-testing and check that the login form submits and goes to /dashboard
- take a screenshot of the home page with webapp-testing and show the console logs
- use webapp-testing: click the button, wait for the element, verify the URL
How to install webapp-testing
1claude-code-templates
npx claude-code-templates@latest --command testing/webapp-testing2Manually: put the files in place
.claude/commands/webapp-testing.mdCall it with /webapp-testing. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/webapp-testing.mdCall it with /prompts:webapp-testing. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/webapp-testing.prompt.mdManually: put the files in place
.gemini/commands/webapp-testing.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about webapp-testing
How do I install webapp-testing in Claude?
Run npx claude-code-templates@latest --command testing/webapp-testing. The command lands in .claude/commands/webapp-testing.md.
What does webapp-testing do?
It tests and debugs local web apps through Playwright: clicks, forms, element assertions, screenshots and browser logs.
What do I need for webapp-testing to work?
Node.js and a running local app or reachable URL. Playwright installs itself if it is not present.
Source text
webapp-testing.md · MIT
---
allowed-tools: Bash, Read
description: Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
---
# Web Application Testing
This skill enables comprehensive testing and debugging of local web applications using Playwright automation.
## When to Use This Skill
Use this skill when you need to:
- Test frontend functionality in a real browser
- Verify UI behavior and interactions
- Debug web application issues
- Capture screenshots for documentation or debugging
- Inspect browser console logs
- Validate form submissions and user flows
- Check responsive design across viewports
## Prerequisites
- Node.js installed on the system
- A locally running web application (or accessible URL)
- Playwright will be installed automatically if not present
## Core Capabilities
### 1. Browser Automation
- Navigate to URLs
- Click buttons and links
- Fill form fields
- Select dropdowns
- Handle dialogs and alerts
### 2. Verification
- Assert element presence
- Verify text content
- Check element visibility
- Validate URLs
- Test responsive behavior
### 3. Debugging
- Capture screenshots
- View console logs
- Inspect network requests
- Debug failed tests
## Usage Examples
### Example 1: Basic Navigation Test
```javascript
// Navigate to a page and verify title
await page.goto('http://localhost:3000');
const title = await page.title();
console.log('Page title:', title);
```
### Example 2: Form Interaction
```javascript
// Fill out and submit a form
await page.fill('#username', 'testuser');
await page.fill('#password', 'password123');
await page.click('button[type="submit"]');
await page.waitForURL('**/dashboard');
```
### Example 3: Screenshot Capture
```javascript
// Capture a screenshot for debugging
await page.screenshot({ path: 'debug.png', fullPage: true });
```
## Guidelines
1. **Always verify the app is running** - Check that the local server is accessible before running tests
2. **Use explicit waits** - Wait for elements or navigation to complete before interacting
3. **Capture screenshots on failure** - Take screenshots to help debug issues
4. **Clean up resources** - Always close the browser when done
5. **Handle timeouts gracefully** - Set reasonable timeouts for slow operations
6. **Test incrementally** - Start with simple interactions before complex flows
7. **Use selectors wisely** - Prefer data-testid or role-based selectors over CSS classes
## Common Patterns
### Pattern: Wait for Element
```javascript
await page.waitForSelector('#element-id', { state: 'visible' });
```
### Pattern: Check if Element Exists
```javascript
const exists = await page.locator('#element-id').count() > 0;
```
### Pattern: Get Console Logs
```javascript
page.on('console', msg => console.log('Browser log:', msg.text()));
```
### Pattern: Handle Errors
```javascript
try {
await page.click('#button');
} catch (error) {
await page.screenshot({ path: 'error.png' });
throw error;
}
```
## Limitations
- Requires Node.js environment
- Cannot test native mobile apps (use React Native Testing Library instead)
- May have issues with complex authentication flows
- Some modern frameworks may require specific configuration
© davila7 · MIT · davila7/claude-code-templates