Playwright
Playwright
Playwright is an end-to-end (e2e) testing framework to simulate real user interactions across an entire web app.
Microsoft's Playwright MCP server allows an agent to interact with a Playwright server so agents can automatically test.
Add Playwright MCP server:
claude mcp add playwright npx '@playwright/mcp@latest'
Instruct the agent to use Playwright: Use playwright mcp to open a browser to example.com
Example generated e2e test:
import { test, expect } from '@playwright/test';
test.describe('Task app E2E', () => {
test('user can log in, create a task, and log out', async ({ page }) => {
// 1. Go to the app
await page.goto('http://localhost:3000');
// 2. Log in
await page.getByLabel('Email').fill('andrew@example.com');
await page.getByLabel('Password').fill('SuperSecret');
await page.getByRole('button', { name: 'Sign in' }).click();
// 3. Verify dashboard loaded
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
// 4. Create a new task
await page.getByRole('button', { name: 'New Task' }).click();
await page.getByLabel('Task title').fill('Review PR');
await page.getByLabel('Description').fill('Make sure the end-to-end test covers a real flow');
await page.getByRole('button', { name: 'Save Task' }).click();
// 5. Verify success message
await expect(page.getByText('Task created successfully')).toBeVisible();
});
});
Related: MCP, Claude Chrome Extension