2.8 KiB
2.8 KiB
description
| description |
|---|
| Test a webapp feature with Playwright |
--url --test-type
Test Webapp Feature
Run automated browser tests for your webapp using Playwright. Tests are saved to .web-tests/ in your current working directory.
Works from any directory - Saves test scripts and screenshots to your working directory's .web-tests/ folder.
How It Works
When you run /test, Claude will:
- Auto-detect running dev servers (or use the provided URL)
- Create a custom test script in
.web-tests/scripts/ - Execute the test with visible browser
- Save screenshots to
.web-tests/screenshots/ - Show results with console output
Usage
# Test specific feature
/test --test-type login
# Test with specific URL
/test --url http://localhost:3001 --test-type form
# Test responsive design
/test --test-type responsive
# Test page load
/test --url https://example.com --test-type page-load
Common Test Types
login- Test login flow and authenticationform- Test form filling and submissionresponsive- Test across multiple viewports (desktop, tablet, mobile)page-load- Test if page loads correctlynavigation- Test navigation and routingcustom- Claude will ask what to test
What Claude Will Do
- Auto-detect dev server (if testing localhost)
- Write test script to
.web-tests/scripts/test-{type}-{timestamp}.js - Execute test using:
CWD=$(pwd) cd <skill-dir> && node run.js .web-tests/scripts/test-*.js - Report results with any errors or successes
- Save screenshots automatically to
.web-tests/screenshots/
Output Structure
your-repo/
└── .web-tests/
├── scripts/
│ └── test-login-2025-10-23.js
└── screenshots/
├── login-page-2025-10-23T12-30-45.png
└── dashboard-2025-10-23T12-30-50.png
Environment Variables
Claude can use these environment variables:
CWD- Your current working directory (auto-set)HEADLESS- Set totruefor background execution (default:false)SLOW_MO- Slow down actions for debugging (default:0)
Examples
# Test login with credentials
/test --test-type login
# Test contact form
/test --test-type form --url http://localhost:3001/contact
# Test homepage across viewports
/test --test-type responsive --url http://localhost:3001
Tips
- Tests run with visible browser by default (easier to debug)
- Screenshots are automatic - saved to
.web-tests/screenshots/ - Test scripts are reusable - found in
.web-tests/scripts/ - Auto-detects servers - no need to specify URL for localhost
See Also
/screenshot- Take screenshots of pages/check- Check for broken links or issues