π Playwright Test Automation Framework
LocalAbout π Playwright Test Automation Framework
A Playwright and TypeScript test automation framework for organizing end-to-end tests with Page Object Model and external test data. It includes an example registration flow and uses @executeautomation/playwright-mcp-server for recording and playback.
Key features
- 01Page Object Model architecture
- 02Separate test data from test logic
- 03TypeScript support
- 04Reusable components and helpers
- 05MCP-based recording and playback
- 06Automated test script generation
Use cases
- 01Running data-driven registration scenarios
- 02Adding page objects and test scenarios
- 03Recording and replaying tests with MCP
MCP support
Integrates @executeautomation/playwright-mcp-server for test recording and playback.
Configuration
Local server config is the same for every client. Copy it into your clientβs MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEπ Playwright Test Automation Framework
π A powerful, data-driven test automation framework built with Playwright and TypeScript, leveraging @executeautomation/playwright-mcp-server for enhanced test recording and playback capabilities. Features Page Object Model design pattern for scalable and maintainable automated testing.
β¨ Highlights
- ποΈ Page Object Model - Clean and maintainable test architecture
- π Data-Driven Testing - Easily scale tests with external test data
- π§ TypeScript Support - Robust type checking and better IDE integration
- β»οΈ Reusable Components - Modular design for maximum code reuse
- π― Easy Maintenance - Centralized locators and data management
- π Scalable Design - Effortlessly add new test scenarios
- π₯ MCP Server Integration - Enhanced test recording and playback functionality
π Key Features
- Structured and organized test architecture
- Separation of test data from test logic
- Powerful helper methods for common operations
- Easy-to-follow page object pattern implementation
- Comprehensive test data management
- Ready-to-use registration flow example
- Test recording and playback using MCP Server
- Automated test script generation
Framework Structure
tests/
βββ data/ # Test Data Layer
β βββ interfaces/
β β βββ TestData.ts # Data type definitions
β βββ TestDataHelper.ts # Helper class for data management
β βββ testData.ts # Test scenarios data
βββ pages/ # Page Objects
β βββ BasePage.ts # Base page with common functionality
β βββ LoginPage.ts # Login page object
β βββ RegistrationPage.ts # Registration page object
βββ specs/ # Test Specifications
βββ registration.spec.ts # Test cases
Features
- Page Object Model: Separates test logic from page interactions
- Data-Driven Testing: Test data is separated from test logic
- TypeScript: Strong typing and better IDE support
- Reusable Components: Common functionality in base classes
- Easy Maintenance: Centralized locators and data management
- Scalable: Easy to add new test scenarios and page objects
Test Data Structure
The framework uses a structured approach to manage test data:
interface TestScenario {
name: string;
login: LoginData;
registration: RegistrationData;
}
Current test scenarios:
- Valid Registration Flow (Male user)
- Female User Registration
Setup
- Clone the repository:
git clone <repository-url>
cd playwrightMCP_Demo
- Install dependencies:
npm install
- Install Playwright browsers:
npx playwright install
Running Tests
Run all tests:
npx playwright test
Run specific test file:
npx playwright test tests/specs/registration.spec.ts
Run tests in headed mode:
npx playwright test --headed
Adding New Test Scenarios
- Add new test data in
tests/data/testData.ts:
{
name: 'Your Scenario Name',
login: {
email: '[email protected]'
},
registration: {
firstName: 'First',
lastName: 'Last',
address: 'Address',
email: '[email protected]',
phone: '1234567890',
gender: 'Male' | 'Female',
country: 'Country Name'
}
}
- The test will automatically execute for new scenarios.
Framework Components
Page Objects
- BasePage: Contains common methods and utilities
- LoginPage: Handles login functionality
- RegistrationPage: Manages registration form interactions
Data Management
- TestData.ts: Contains test scenarios
- TestDataHelper: Provides methods to access and manage test data
- Interfaces: Defines structure for test data
Best Practices
- Keep page objects focused on page-specific functionality
- Maintain test data separately from test logic
- Use meaningful scenario names
- Follow TypeScript naming conventions
- Keep tests independent and atomic
Contributing
- Create a new branch for your feature
- Add/Update tests and page objects
- Update test data if needed
- Submit a pull request
Dependencies
- Playwright
- TypeScript
- Node.js
- @executeautomation/playwright-mcp-server - For enhanced test recording and playback
- @playwright/test - Core testing framework
Support
For any questions or issues, please create a new issue in the repository.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.