Generate E2E Tests with Playwright or Cypress
Describing your user journeys in plain English and letting Claude write the full E2E test suite beats staring at Playwright docs for an hour.
Write a Playwright test for the checkout flow:
1. User visits /cart with 2 items already in it
2. Clicks "Proceed to Checkout"
3. Fills in name, email, and card details (use test card 4242 4242 4242 4242)
4. Submits the form and expects a success message containing an order ID
Claude will scaffold the full test file, handle async waits, and suggest where to add data-testid attributes to make selectors more robust.
import { test, expect } from '@playwright/test';
test('checkout flow completes successfully', async ({ page }) => {
await page.goto('/cart');
await page.click('[data-testid="checkout-button"]');
await page.fill('[name="email"]', 'test@example.com');
await page.fill('[name="card-number"]', '4242424242424242');
await page.click('[data-testid="submit-order"]');
await expect(page.locator('[data-testid="order-id"]')).toBeVisible();
});
You can also ask Claude to generate a full page object model if your test suite is growing, or follow up with "now add tests for the error states and empty cart edge cases."
Once Claude has the happy path, ask it to add error state tests and accessibility checks too.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.