AI-Powered Testing - **๐ MCP Server Integration** - Execute tests programmatically via Model Context Protocol - **๐ฌ AI Assistant Ready** - Claude Desktop, VS Code Copilot, and other MCP clients supported - **โก Smart Test Execution** - Intelligent test selection and execution via MCP tools
๐ญ Playwright + MCP Enterprise Kit Plus
Enterprise-grade E2E Testing Framework with AI-Powered Test Execution
Production-ready testing framework combining Playwright's power with MCP server integration for AI-driven test execution, comprehensive reporting, and enterprise integrations.
Features โข Quick Start โข MCP Integration โข Documentation โข Contributing
โจ Features
๐ค AI-Powered Testing
- ๐ MCP Server Integration - Execute tests programmatically via Model Context Protocol
- ๐ฌ AI Assistant Ready - Claude Desktop, VS Code Copilot, and other MCP clients supported
- โก Smart Test Execution - Intelligent test selection and execution via MCP tools
๐ Enterprise Reporting
- ๐ Allure Reports - Beautiful, comprehensive test analytics and history
- ๐ธ Visual Evidence - Automatic screenshots, videos, and traces on failures
- ๐ฏ JUnit/HTML Reports - Multi-format reporting for CI/CD pipelines
๐ Integration Ecosystem
- ๐ GitHub Issues - Auto-create issues from test failures with full context
- ๐ Jira Integration - Automatic ticket creation in Jira for failed tests
- ๐ก๏ธ OWASP ZAP - Security vulnerability scanning integration
- ๐ฆ Lighthouse CI - Automated performance and accessibility audits
๐ญ Testing Capabilities
- ๐ Multi-Browser - Chromium, Firefox, and WebKit support
- โฟ Accessibility - Built-in aXe-core accessibility testing
- ๐ Enterprise Ready - Extensible framework for testing enterprise applications
- ๐งช Smoke & Regression - Organized test suites for different testing levels
๐ Developer Experience
- ๐ฆ TypeScript First - Full type safety and IntelliSense support
- ๐๏ธ Page Object Model - Maintainable test architecture
- โ๏ธ CI/CD Ready - GitHub Actions workflows included
- ๐ Auto-Setup - One-command browser installation
๐ Prerequisites
Before you begin, ensure you have the following installed:
Optional (for specific features):
- Allure commandline for local report viewing
- Docker for ZAP security scanning
- Claude Desktop or other MCP client for AI-powered testing
๐ Quick Start
1๏ธโฃ Clone & Install
# Clone the repository
git clone https://github.com/YOUR-USERNAME/playwright-mcp-enterprise-kit-plus.git
cd playwright-mcp-enterprise-kit-plus
# Install dependencies
npm install
# Install Playwright browsers
npm run prepare
2๏ธโฃ Configure Environment
# Copy environment template
cp .env.example .env
# Edit .env with your credentials (use your favorite editor)
notepad .env # Windows
# or
nano .env # macOS/Linux
Minimal configuration (for basic testing):
BASE_URL=https://your-app.com
# Add your application-specific configuration here
3๏ธโฃ Run Your First Test
# Run all tests
npm test
# Run tests in interactive UI mode (recommended for first-time)
npm run test:ui
# Run specific test suite
npx playwright test src/tests/web
# Run in headed mode to watch tests execute
npx playwright test --headed
4๏ธโฃ View Results
# View Playwright HTML report
npm run test:report
# Generate and view Allure report
npm run allure:generate
npm run allure:open
๐ MCP Server Integration
What is MCP?
The Model Context Protocol (MCP) enables AI assistants to execute your tests programmatically. This allows tools like Claude Desktop, VS Code Copilot, or custom AI agents to run, debug, and analyze your test suite.
๐ฏ Quick Setup with Claude Desktop
๐ฏ Quick Setup with Claude Desktop
Step 1: Add to your Claude Desktop config:
{
"mcpServers": {
"playwright-enterprise": {
"command": "npm",
"args": ["run", "mcp:server"],
"cwd": "D:\\Plywright_MCP Server_Project\\playwright-mcp-enterprise-kit-plus"
}
}
}
Config location:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Step 2: Restart Claude Desktop
Step 3: Ask Claude to run your tests:
"Run the smoke tests"
"Execute all accessibility tests and show me the results"
"Run tests matching 'homepage' and create a report"
๐ ๏ธ Available MCP Tools
| Tool | Description | Example Use |
|------|-------------|-------------|
| run_playwright_tests | Execute tests with full configuration options | Run specific browsers, projects, or grep patterns |
| run_smoke_tests | Quick smoke test execution | Fast validation before deployments |
| get_test_config | Retrieve current configuration | Debug setup issues |
๐ก Usage Examples
๐ก Usage Examples
Run specific tests:
// Ask Claude: "Run tests matching 'login' in Chromium browser"
{
"grep": "login",
"project": "chromium"
}
Run tests and generate report:
// Ask Claude: "Run smoke tests and generate Allure report"
// MCP tool handles execution + reporting automatically
Standalone server mode:
# Start MCP server manually (for custom integrations)
npm run mcp:server
# Server listens on stdio for MCP protocol messages
๐ Full MCP documentation: MCP_USAGE.md
๐ Reporting & Analytics
๐ Allure Reports
Generate beautiful, interactive reports with historical trends and analytics:
# Generate report from latest test results
npm run allure:generate
# Open report in browser
npm run allure:open
Allure features:
- ๐ Historical trends and statistics
- ๐ธ Screenshots and video attachments
- ๐ Detailed step-by-step execution
- ๐ Flaky test detection
- ๐ท๏ธ Test categorization and tagging
๐ Auto-Create Issues from Failures
Automatically create detailed tickets when tests fail:
GitHub Issues Integration
# Set environment variables
export GH_TOKEN=ghp_xxxxxxxxxxxxx
export GH_OWNER=your-username
export GH_REPO=playwright-mcp-enterprise-kit-plus
# Create issues from failures
npm run issues:github
Created issues include:
- Test name and failure reason
- Screenshots and error traces
- Browser and environment details
- Direct links to test files
Jira Integration
# Configure Jira credentials
export JIRA_HOST=https://your-domain.atlassian.net
export JIRA_EMAIL=you@example.com
export JIRA_TOKEN=your-api-token
export JIRA_PROJECT_KEY=PROJ
# Create Jira tickets
npm run issues:jira
๐ Security & Performance Scans
# Run OWASP ZAP baseline security scan
npm run zap:baseline
# Run full ZAP scan (longer, more thorough)
npm run zap:full
# Run Lighthouse CI performance audit
npm run lhci:autorun
๐ง Available Scripts
| Category | Script | Description |
|----------|--------|-------------|
| Testing | npm test | Run all Playwright tests |
| | npm run test:ui | Run tests in interactive UI mode |
| | npm run test:report | View Playwright HTML report |
| | npm run test:a11y | Run accessibility tests only |
| MCP | npm run mcp:server | Start MCP server for AI-powered execution |
| Reports | npm run allure:generate | Generate Allure report from results |
| | npm run allure:open | Open Allure report in browser |
| Integrations | npm run issues:github | Create GitHub issues from test failures |
| | npm run issues:jira | Create Jira tickets from test failures |
| Security | npm run zap:baseline | Run OWASP ZAP baseline security scan |
| | npm run zap:full | Run comprehensive ZAP security scan |
| | npm run lhci:autorun | Run Lighthouse CI performance audit |
| Setup | npm run prepare | Install Playwright browsers (auto-runs on install) |
๐ป Direct Playwright Commands
# Run specific test file
npx playwright test src/tests/web/example.spec.ts
# Run tests matching pattern
npx playwright test --grep "dashboard"
# Run in headed mode (see browser)
npx playwright test --headed
# Run in debug mode
npx playwright test --debug
# Run specific browser
npx playwright test --project=chromium
# Run with UI mode (interactive)
npx playwright test --ui
# Update snapshots
npx playwright test --update-snapshots
๐ Project Structure
playwright-mcp-enterprise-kit-plus/
โ
โโโ ๐ src/
โ โโโ ๐ mcp/ # MCP Server Implementation
โ โ โโโ server.ts # Main MCP server entry point
โ โ โโโ types.ts # TypeScript interfaces and types
โ โ โโโ tools/
โ โ โโโ runPlaywright.ts # Test execution MCP tool
โ โ
โ โโโ ๐ tests/ # Core Test Suites
โ โ โโโ web/ # Web application tests
โ โ โ โโโ accessibility.spec.ts
โ โ โ โโโ ...
โ โ โโโ api/ # API tests
โ โ
โ โโโ ๐ framework/ # Test Framework
โ โโโ pages/ # Page Object Models
โ โโโ utils/ # Utility functions
โ
โโโ ๐ integrations/ # External Integrations
โ โโโ common/ # Shared utilities
โ โ โโโ parseJunitXml.ts # Test result parsing
โ โโโ github/ # GitHub Issues
โ โ โโโ reportFailuresToIssues.ts
โ โโโ jira/ # Jira Integration
โ โโโ reportFailuresToIssues.ts
โ
โโโ ๐ security/ # Security Testing
โ โโโ zap/ # OWASP ZAP integration
โ โโโ scripts/
โ
โโโ ๐ allure-results/ # Allure test results (generated)
โโโ ๐ allure-report/ # Allure HTML reports (generated)
โโโ ๐ playwright-report/ # Playwright HTML report (generated)
โโโ ๐ reports/ # JUnit XML reports (generated)
โโโ ๐ test-results/ # Test artifacts (generated)
โ
โโโ ๐ playwright.config.ts # Playwright configuration
โโโ ๐ tsconfig.json # TypeScript configuration
โโโ ๐ package.json # Dependencies and scripts
โโโ ๐ .env.example # Environment variables template
โโโ ๐ MCP_USAGE.md # MCP server documentation
โโโ ๐ QUICKSTART.md # Quick start guide
โโโ ๐ README.md # This file
๐ Documentation
| Document | Description | |----------|-------------| | README.md | Main documentation (you are here) | | QUICKSTART.md | Fast-track setup guide | | MCP_USAGE.md | Complete MCP server documentation | | PULL_REQUEST_TEMPLATE.md | PR guidelines and checklist |
โ๏ธ Environment Configuration
๐ Setting Up .env File
Copy the example and customize for your environment:
cp .env.example .env
๐ Required Variables
Application Configuration
BASE_URL=https://your-app.com
# Add your application-specific variables here
GitHub Integration (Optional)
GH_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GH_OWNER=your-github-username
GH_REPO=playwright-mcp-enterprise-kit-plus
Jira Integration (Optional)
JIRA_HOST=https://your-company.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_TOKEN=ATATTxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
JIRA_PROJECT_KEY=TEST
Playwright Configuration (Optional)
BASE_URL=https://your-app.com
PW_SLOWMO=100 # Slow down execution (ms)
PLAYWRIGHT_SLOWMO=100 # Alternative slowmo variable
CI=true # CI mode (enables retries)
๐ Security Best Practices
- โ
Never commit
.envfile to Git (already in.gitignore) - โ
Use environment-specific
.envfiles (.env.dev,.env.staging,.env.prod) - โ Store production secrets in CI/CD secret vaults (GitHub Secrets, Azure Key Vault, etc.)
- โ Rotate credentials regularly
- โ Use service accounts with minimal permissions for testing
๐ฆ CI/CD Integration
GitHub Actions Workflow
This project includes a ready-to-use GitHub Actions workflow that:
- โ Runs tests on every push and pull request
- โ Tests across multiple browsers (Chromium, Firefox, WebKit)
- โ Generates and uploads Allure reports
- โ Creates test artifacts (screenshots, videos, traces)
- โ Optionally deploys reports to GitHub Pages
- โ Runs on Ubuntu, Windows, and macOS (configurable)
๐ง Setup GitHub Actions
-
Enable GitHub Actions in your repository
-
Add secrets in repository settings:
Settings โ Secrets and variables โ Actions โ New repository secretAdd your application-specific secrets as needed.
-
Push to trigger workflow:
git push origin main -
View results in the Actions tab
๐ Sample Workflow Output
โ Install dependencies
โ Install Playwright browsers
โ Run Playwright tests (chromium)
โ Run Playwright tests (firefox)
โ Run Playwright tests (webkit)
โ Generate Allure report
โ Upload test artifacts
โ Deploy to GitHub Pages (optional)
๐ฏ Best Practices
โ Test Organization
- Group tests by feature/module in logical folders
- Use descriptive test names:
should display error when login fails - Tag tests appropriately:
@smoke,@regression,@critical - Keep test files focused (one feature per file)
โ Page Object Model
- Create page objects for all major pages/components
- Use selectors that are stable (data-testid preferred)
- Encapsulate page interactions in methods
- Return page objects for method chaining
โ Test Data Management
- Use environment variables for configuration
- Keep test data separate from test logic
- Use fixtures for complex test setup
- Avoid hard-coded values
โ Assertions
- Use specific, meaningful assertions
- Add custom error messages:
expect(value, 'User should be logged in').toBeTruthy() - Test both positive and negative scenarios
- Avoid flaky assertions (use
toBeVisible()with timeouts)
โ Performance
- Run tests in parallel (
fullyParallel: truein config) - Use
test.describe.configure({ mode: 'parallel' })for test groups - Share authentication state across tests
- Clean up test data after execution
๐ค Contributing
We welcome contributions! Here's how you can help:
๐ Bug Reports
- Check if the bug is already reported in Issues
- Create a new issue with:
- Clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Screenshots/logs if applicable
- Environment details (OS, Node version, browser)
โจ Feature Requests
- Search existing feature requests
- Open a new issue describing:
- The problem you're trying to solve
- Proposed solution
- Alternative solutions considered
- Additional context
๐ง Pull Requests
Quick contribution workflow:
# 1. Fork and clone
git clone https://github.com/YOUR-USERNAME/playwright-mcp-enterprise-kit-plus.git
cd playwright-mcp-enterprise-kit-plus
# 2. Create a feature branch
git checkout -b feature/amazing-feature
# 3. Make your changes
# ... code, code, code ...
# 4. Test your changes
npm test
# 5. Commit with clear message
git commit -m "feat: add amazing new feature"
# 6. Push to your fork
git push origin feature/amazing-feature
# 7. Open a Pull Request
PR Checklist:
- โ
Tests pass locally (
npm test) - โ Code follows existing style
- โ Added tests for new features
- โ Updated documentation if needed
- โ Commit messages are clear
- โ No sensitive data (credentials, tokens) in code
๐ Documentation Improvements
- Fix typos, improve clarity
- Add examples and use cases
- Improve code comments
- Update outdated information
โ FAQ & Troubleshooting
General Issues
Q: Tests are failing with "Browser not found" error
# Solution: Install Playwright browsers
npm run prepare
# or
npx playwright install --with-deps
Q: Getting "ECONNREFUSED" or timeout errors
# Check your application is running
# Verify BASE_URL in .env or playwright.config.ts
# Check network/firewall settings
Q: Tests are flaky (pass sometimes, fail sometimes)
// Solution: Add proper waits
await page.waitForLoadState('networkidle');
await expect(element).toBeVisible({ timeout: 10000 });
// Avoid hard waits
// โ await page.waitForTimeout(5000);
// โ
await page.waitForSelector('.my-element');
MCP Server Issues
Q: MCP server not connecting in Claude Desktop
# 1. Verify config location
# Windows: %APPDATA%\Claude\claude_desktop_config.json
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# 2. Check cwd path is correct (absolute path)
# 3. Restart Claude Desktop completely
# 4. Check logs in Claude Desktop developer tools
Q: MCP tools not showing up
# Verify server starts without errors
npm run mcp:server
# Check TypeScript compilation
npx tsc --noEmit
# Ensure all dependencies installed
npm install
Integration Issues
Q: GitHub issue creation fails
# Verify token has correct permissions (repo scope)
# Check GH_TOKEN, GH_OWNER, GH_REPO are set
# Run manually to see detailed error:
npm run issues:github
Q: Allure report is empty
# Make sure tests have run first
npm test
# Then generate report
npm run allure:generate
npm run allure:open
Performance Issues
Q: Tests are running slowly
// Enable parallel execution in playwright.config.ts
fullyParallel: true,
// Or in specific test file
test.describe.configure({ mode: 'parallel' });
Q: Need to debug a specific test
# Run in debug mode (opens inspector)
npx playwright test --debug
# Run in headed mode (see browser)
npx playwright test --headed
# Run specific test only
npx playwright test -g "test name"
๐ Acknowledgments
Built with these amazing technologies:
- Playwright - Modern end-to-end testing framework
- Model Context Protocol - AI assistant integration standard
- Allure - Beautiful test reporting
- TypeScript - JavaScript with types
- OWASP ZAP - Security testing
- aXe-core - Accessibility testing
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฌ Support & Contact
- ๐ซ Issues: GitHub Issues
- ๐ก Discussions: GitHub Discussions
- ๐ Documentation: Full Docs
- ๐ Star this repo if you find it helpful!
Made with โค๏ธ for the testing community
If this project helps you, please consider giving it a โญ!
Test Execution Issues
- Install browsers:
npm run prepare - Check environment variables in
.env - Verify network connectivity
- Review logs in
test-results/directory
Integration Issues
- Verify API tokens are valid and have proper permissions
- Check network connectivity to GitHub/Jira
- Ensure JUnit report exists:
reports/junit.xml