A modern React todo application built specifically to demonstrate AI agent mode testing with Playwright MCP server. This repository showcases the evolution from naive test generation to production-level E2E testing practices using AI assistance.
This super todo app serves as a live demonstration platform for:
- AI-driven test generation using Playwright MCP server
- Progressive test development from basic scripts to production-ready suites
- Best practices implementation through AI agent collaboration
- Production-level E2E architecture with comprehensive testing rules
- Node.js 18+
- npm or pnpm
- Playwright MCP server configured in your AI environment
# Clone and install dependencies
npm install
# Start the development server
npm run dev
# App runs on http://localhost:3000
# Install Playwright browsers (if needed)
npx playwright installThis repository demonstrates a 3-stage progression of AI-assisted test development:
Goal: Generate basic functional tests with minimal guidance
# Ask AI to create a simple test
"Generate a Playwright test for Super-Todo that adds a todo and marks it complete"
# Run the generated test
npx playwright test e2e/add-and-complete.spec.ts --headedExpected Result: Working but basic test with hardcoded selectors and minimal architecture.
Goal: Refactor tests using production patterns with AI assistance
Ask AI to implement:
- Data-testid locators only (no text/role selectors)
- Page Object Model architecture
- Centralized test ID management
- Component-based test organization
# AI refactors the test using production patterns
"Refactor the test to use data-testid locators and extract actions into a TodosPage"
# Run the improved test
npm run test:e2eGoal: Full enterprise-ready testing suite with comprehensive patterns
The AI implements:
- Three-layer architecture (Specs → Pages → Components)
- Centralized TestID enums
- Comprehensive waiting strategies
- Error handling and reliability patterns
- Cross-platform compatibility
tests/
├── e2e/ # Test specifications (assertions only)
├── pages/ # Page objects (application pages)
├── components/ # E2E components (reusable UI elements)
└── constants/ # Test IDs and shared constants
-
Spec Files (
tests/e2e/*.spec.ts)- Ultra-short - only high-level actions and assertions
- Delegate all implementation to pages/components
- Focus on user journey verification
-
Page Objects (
tests/pages/*.page.ts)- Represent actual application pages
- Handle page-specific workflows
- Compose e2e-components as needed
-
E2E Components (
tests/components/*.ts)- Mirror
src/componentsstructure - Reusable across multiple pages
- Contain component-specific locators and actions
- Mirror
✅ Data-testid locators ONLY - never use text/role/CSS selectors
✅ Assertions only in specs - pages/components return data, don't assert
✅ TestID enums - centralized constants, no hardcoded strings
✅ Component hierarchy - respect ownership relationships
✅ Reliable waiting - proper state management and navigation handling
✅ Cross-platform compatibility - works on Linux and Windows
Frontend Framework:
- React 19 with TanStack Router for file-based routing
- TanStack Query for server state management
- TanStack Store for client state management
- Tailwind CSS 4 + Shadcn UI for styling
- TypeScript for type safety
Testing Stack:
- Playwright for E2E testing
- Vitest for unit testing
- Custom testing architecture with production-level patterns
Development Tools:
- Vite for blazing-fast development
- ESLint + Prettier for code quality
- Cursor AI with comprehensive testing rules
# Development
npm run dev # Start development server
npm run build # Production build
# Testing
npm run test # Run unit tests
npm run test:e2e # Run E2E tests headless
npm run test:e2e:ui # Run E2E tests with UI
npm run test:e2e:headed # Run E2E tests in headed mode
npm run test:e2e:debug # Debug E2E tests
# Code Quality
npm run lint # Run ESLint
npm run format # Run Prettier
npm run check # Format + lint fixThis is a demonstration repository. Feel free to:
- Fork and experiment with different AI testing approaches
- Submit issues for testing pattern improvements
- Share your own AI-generated testing experiences
- Contribute additional demo scenarios
MIT License - feel free to use this demonstration for learning and teaching AI-powered testing approaches.
Ready to see AI-powered testing in action?
Start with demo-instructions.md and watch as simple prompts evolve into production-ready test suites! 🚀