Test Types
E2E Tests
End-to-end tests that simulate complete user journeys through your application.
What Are E2E Tests?
E2E tests simulate real user behavior from start to finish. They test complete user journeys like purchasing a product, from browsing to checkout to confirmation.
Example Generated Test
test_purchase_flow.spec.ts
1import { test, expect } from '@playwright/test';2 3test.describe('Complete Purchase Flow', () => {4 test('should complete purchase from browse to confirmation', async ({ page }) => {5 // Browse products6 await page.goto('/products');7 await page.click('[data-testid="product-card"]:first-child');8 9 // View product details10 await expect(page.locator('h1.product-title')).toBeVisible();11 12 // Add to cart13 await page.click('[data-testid="add-to-cart"]');14 await expect(page.locator('.cart-count')).toContainText('1');15 16 // Go to cart17 await page.click('[data-testid="cart-icon"]');18 await expect(page).toHaveURL('/cart');19 20 // Proceed to checkout21 await page.click('[data-testid="checkout-button"]');22 23 // Fill shipping info24 await page.fill('[name="address"]', '123 Main St');25 await page.fill('[name="city"]', 'New York');26 await page.fill('[name="zip"]', '10001');27 28 // Fill payment info29 await page.fill('[name="cardNumber"]', '4242424242424242');30 await page.fill('[name="expiry"]', '12/25');31 await page.fill('[name="cvc"]', '123');32 33 // Complete purchase34 await page.click('[data-testid="place-order"]');35 36 // Verify confirmation37 await expect(page).toHaveURL(/\/order\/confirmation/);38 await expect(page.locator('.order-success')).toBeVisible();39 });40});User Journeys Tested
E-commerce
Browse → Cart → Checkout → Confirmation
SaaS Onboarding
Signup → Setup → First Action → Success
Content Creation
Create → Edit → Preview → Publish
User Management
Invite → Accept → Setup → Collaborate
Generate E2E Tests
bash
1curl -X POST http://localhost:3000/api/brain/generate-test \2 -H "Content-Type: application/json" \3 -d '{4 "type": "e2e",5 "target": "Complete purchase flow from product browse to order confirmation"6 }'