
e2e-frontend-validation
PopularE2E validation workflow for frontend changes in playground packages using Playwright MCP
E2E validation workflow for frontend changes in playground packages using Playwright MCP
E2E Validation for Frontend Modifications
Prerequisites
Requires Playwright MCP server. If the browser_navigate tool is unavailable, instruct the user to add it:
claude mcp add playwright -- npx @playwright/mcp@latest
Validation Steps
After completing frontend changes:
- Build the CLI
pnpm build:cli
- Start the dev server
cd packages/playground/e2e/kitchen-sink && pnpm dev
-
Verify server is running
- URL: http://localhost:4111
- Wait for the server to be ready before proceeding
-
Identify impacted routes
- Routes are defined in
packages/playground/src/App.tsx - Browse them ALL to verify behavior
- Routes are defined in
-
Test with Playwright MCP
- Use
browser_navigateto visit each impacted route - Visually verify the changes render correctly
- Test any interactive elements modified
- Use
browser_screenshotto capture results for the user
- Use
-
Write E2E Tests
Write Playwright tests covering the validated behavior. Follow the conventions below.
File Placement
Map validated routes to test file paths under
packages/playground/e2e/tests/:Route pattern Test file /agentsagents/page.spec.ts/agents/:id/...agents/$agentId/page.spec.ts/agents/:id/chat/:chatIdagents/$agentId/stream.spec.ts(if streaming)/toolstools/page.spec.ts/tools/:idtools/$toolId/page.spec.ts/workflowsworkflows/page.spec.ts/workflows/:idworkflows/$workflowId/page.spec.ts/mcpsmcps/page.spec.ts/mcps/:id/tools/:toolIdmcps/$serverId/tools/$toolId/page.spec.ts- Layout/navigation tests →
page.spec.ts - Streaming/chat tests →
stream.spec.ts
New File vs Extend Existing
- If the spec file already exists, add new
test()blocks to it. - If it doesn't exist, create a new file with the full boilerplate (imports,
afterEachhook, etc.).
Fixture Decision Tree
- AI streaming responses (text-delta, tool calls, workflow execution) → use
selectFixture()+nanoid()for deterministic, isolated tests - Static UI, navigation, forms, deterministic tool execution → no fixture needed
Test Conventions
// Imports import { test, expect } from '@playwright/test'; import { resetStorage } from '../__utils__/reset-storage'; // Only for streaming tests: import { selectFixture } from '../__utils__/select-fixture'; import { nanoid } from 'nanoid';- Always call
resetStorage()intest.afterEach - For streaming tests, create a fresh browser context in
test.beforeEach:let page: Page; test.beforeEach(async ({ browser }) => { const context = await browser.newContext(); page = await context.newPage(); }); - Locator priority:
getByTestId>getByRole>getByLabel>locator('text=...') - Use
{ timeout: 20000 }for async/streaming content assertions - Use
nanoid()for unique chat session IDs in URLs - Verify memory persistence with
page.reload()where applicable - Use
toMatchAriaSnapshot()for stable layout assertions
Kitchen-Sink Extension
When the feature under test requires new fixtures or entities:
- New fixtures: Add to
e2e/kitchen-sink/fixtures/, create a<name>.fixture.tsfile, and register it infixtures/index.ts - Update types: Add the fixture name to the
Fixturesunion ine2e/kitchen-sink/types.tsande2e/tests/__utils__/select-fixture.ts - New tools/agents/workflows: Add to the corresponding files in
e2e/kitchen-sink/src/mastra/
- Layout/navigation tests →
-
Verify Tests Pass
cd packages/playground && pnpm test:e2eIf tests fail, fix them and re-run until green.
Quick Reference
| Step | Command/Action |
|---|---|
| Build | pnpm build:cli |
| Start | cd packages/playground/e2e/kitchen-sink && pnpm dev |
| App URL | http://localhost:4111 |
| Routes | @packages/playground/src/App.tsx |
| Run tests | cd packages/playground && pnpm test:e2e |
| Test dir | packages/playground/e2e/tests/ |
| Fixtures | packages/playground/e2e/kitchen-sink/fixtures/ |
| Kitchen-sink | packages/playground/e2e/kitchen-sink/src/mastra/ |
You Might Also Like
Related Skills

fix
Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.
facebook
frontend-testing
Generate Vitest + React Testing Library tests for Dify frontend components, hooks, and utilities. Triggers on testing, spec files, coverage, Vitest, RTL, unit tests, integration tests, or write/review test requests.
langgenius
frontend-code-review
Trigger when the user requests a review of frontend files (e.g., `.tsx`, `.ts`, `.js`). Support both pending-change reviews and focused file reviews while applying the checklist rules.
langgenius
code-reviewer
Use this skill to review code. It supports both local changes (staged or working tree) and remote Pull Requests (by ID or URL). It focuses on correctness, maintainability, and adherence to project standards.
google-gemini
session-logs
Search and analyze your own session logs (older/parent conversations) using jq.
moltbot
