Dedicated test Agent responsible for managing all E2E tests for the webapp-test-docker-demo project...
This skill transforms Claude into a dedicated test Agent that can:
Project path: /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
Important: This skill defaults to remote test mode (test:remote), requires setting Docker service URL first.
Start Docker service on local machine or remote server:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
docker-compose up -d
Set environment variable in Claude:
Method A: Use host IP (recommended, same network)
# Find IP on local machine: ipconfig getifaddr en0 (macOS)
export DOCKER_SERVICE_URL=http://192.168.1.100:8080 # Replace with actual IP
Method B: Use port forwarding tool (different network)
# On local machine: npx localtunnel --port 8080
export DOCKER_SERVICE_URL=https://your-tunnel-url.loca.lt
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
npm run test:remote:ui # UI mode (recommended)
# or
npm run test:remote # Standard mode
Script will automatically check if Docker service is accessible, if unable to connect will provide detailed prompts.
When PM requests to list all tests, execute the following:
Method 1: Use Playwright command (recommended):
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
npx playwright test --list
Method 2: Use helper script:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
python scripts/list_tests.py
Method 3: Directly read test directory:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
ls -la tests/e2e/
Output format: When listing all tests, should provide:
Example output format:
š Test File List:
1. login.spec.ts
š Login Feature
- Successful login @smoke
- Login failure - wrong password @regression
2. logout.spec.ts
š Logout Feature
- Logout feature @smoke
3. shopping-cart.spec.ts
š Shopping Cart Feature
- Add item to cart @smoke
- Checkout feature @smoke
- Checkout with empty cart @regression
When PM requests "Run all current tests and give me report", execute the following complete flow:
Important: Default uses remote test mode (test:remote), will automatically check if Docker service is running.
Complete flow:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
# 1. Check and set Docker service URL
# If Docker runs locally, need to get host IP first (Sandbox cannot access localhost)
# On local machine execute: ipconfig getifaddr en0 (macOS) or hostname -I (Linux)
# Then set:
export DOCKER_SERVICE_URL=http://192.168.1.100:8080 # Replace with actual IP
# 2. Run all tests (will automatically check if Docker service is running)
npm run test:remote
# 3. Display test report
npx playwright show-report
Note:
Report content should include:
Test Summary:
Detailed Results:
HTML Report Path:
playwright-report/index.htmlTest Results Directory:
test-results/ - Contains screenshots and trace filesUsing Python script (recommended, automatically checks Docker):
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
export DOCKER_SERVICE_URL=http://192.168.1.100:8080 # Replace with actual IP
python scripts/run_tests_remote.py all
Specific test file:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
export DOCKER_SERVICE_URL=http://192.168.1.100:8080 # Replace with actual IP
python scripts/run_tests_remote.py all --test-file tests/e2e/login.spec.ts
UI mode (visual testing, recommended):
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
export DOCKER_SERVICE_URL=http://192.168.1.100:8080 # Replace with actual IP
npm run test:remote:ui
# or use Python script
python scripts/run_tests_remote.py ui
Debug mode:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
export DOCKER_SERVICE_URL=http://192.168.1.100:8080 # Replace with actual IP
npm run test:remote:debug
# or use Python script
python scripts/run_tests_remote.py debug
After tests complete, view results:
HTML Report:
cd /Users/dennis.liu/Documents/code_space/webapp-test-docker-demo
npx playwright show-report
Test Results Directory:
test-results/ - Test execution results and screenshotsplaywright-report/ - HTML test reportWhen PM requests to generate new tests:
Understand requirements: Ask PM what feature to test
Check existing tests: View existing tests in tests/e2e/ directory to avoid duplicates
login.spec.ts - Login feature testlogout.spec.ts - Logout feature testshopping-cart.spec.ts - Shopping cart feature testGenerate test file: Create new .spec.ts file in tests/e2e/ directory
Test file template:
Reference templates/test_template.spec.ts or use the following structure:
import { test, expect } from '@playwright/test';
test.describe('Feature Name', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
});
test('Test scenario description @smoke', async ({ page }) => {
// Arrange: Prepare test environment
// Act: Perform actions
// Assert: Verify results
});
});
Test tag explanation:
@smoke - Smoke tests (core functionality)@regression - Regression tests (edge cases)Test account information:
test@example.compassword123Common selectors:
page.getByRole('button', { name: 'Login' })page.locator('[data-testid="email-input"]')page.locator('[data-testid="password-input"]')page.locator('[data-testid="login-button"]')page.locator('.product-list')page.locator('#cart')When tests fail:
test-results/ directorynpm run test:remote:debug for debugging# Check Docker service on local machine
docker-compose ps
docker-compose logs
curl http://localhost:8080
npm run test:remote (will automatically check Docker service)npm run test:remote then npx playwright show-reportnpm run test:remote then npx playwright show-reportNote: Need to set DOCKER_SERVICE_URL environment variable before execution
python scripts/run_tests_remote.py all --test-file tests/e2e/login.spec.tspython scripts/run_tests_remote.py all --test-file tests/e2e/shopping-cart.spec.tsnpm run test:remote:ui (recommended, can see test process)webapp-test-docker-demo/
āāā SKILL.md # Skill main file
āāā scripts/ # Helper scripts
ā āāā run_tests.py # Test execution script
ā āāā list_tests.py # List tests script
āāā templates/ # Test templates
ā āāā test_template.spec.ts # Template for new tests
āāā tests/e2e/ # Test files directory
ā āāā login.spec.ts # Login test
ā āāā logout.spec.ts # Logout test
ā āāā shopping-cart.spec.ts # Shopping cart test
āāā src/ # Application source code
ā āāā public/index.html # Frontend page
ā āāā server.js # HTTP server
āāā playwright.config.ts # Playwright configuration
āāā docker-compose.yml # Docker Compose configuration
āāā package.json # Project configuration
Docker Service Check:
test:remote mode, will automatically check if Docker service is runninglocalhost, must use host IP or port forwarding toolDOCKER_SERVICE_URL environment variable pointing to Docker serviceConnection Methods:
# Find IP on local machine: ipconfig getifaddr en0 (macOS)
export DOCKER_SERVICE_URL=http://192.168.1.100:8080
# On local machine: npx localtunnel --port 8080
export DOCKER_SERVICE_URL=https://your-tunnel-url.loca.lt
Wait Time: Dynamic applications need to wait for networkidle state
Test Isolation: Each test should be independent, not dependent on other tests' state
Docker Service Management: Docker service runs in external environment, no need to start/stop in Sandbox
data-testid attributes as selectors (more stable)page.waitForLoadState('networkidle') to wait for page loadtemplates/test_template.spec.ts - Template for new teststests/e2e/login.spec.ts - Login test exampletests/e2e/logout.spec.ts - Logout test exampletests/e2e/shopping-cart.spec.ts - Shopping cart test example