This repository demonstrates how to connect Playwright-based Python UI tests to MCP (Model Context Protocol) for intelligent testing flows.
- ✅ Browser automation with Playwright
- 🤖 AI-aware testing using MCP SDK
- 🧩 Configurable YAML for connecting to custom MCP servers
- 💡 Extendable design for adaptive and self-healing test logic
NOTE: pom.xml is for local-use only
This project is primarily a Python / Playwright / MCP framework. The file pom.xml was retained for local reference/legacy compatibility, but is not committed to this repository.
To keep it locally without committing:
- Add
pom.xmlto.gitignore(already included). - If
pom.xmlwas previously tracked, run:git rm --cached pom.xml git commit -m "Remove pom.xml from Git and ignore it"
- Create and activate virtual environment
python -m venv .venv .\.venv\Scripts\Activate.ps1
- Install dependencies
python -m pip install --upgrade pip python -m pip install -r requirements.txt playwright install
- Run tests manually
pytest -v --maxfail=1 --disable-warnings --html=report.html --self-contained-html
Instead of pytest, you can execute the main integration manually:
python main.pyThis runs the MCP + Playwright flow directly and prints progress to the console.
This project includes a cross-platform GitHub Actions workflow at:
.github/workflows/python-ci.yml-
Auto-runs on push and pull_request to main
-
Sets up Python 3.11 and caches dependencies
-
Creates a virtual environment automatically
-
Runs Playwright tests and uploads the HTML test report as an artifact
-
Compatible with both Linux (CI) and Windows (local)
The framework uses the following environment variable:
MCP_SERVER_URL=wss://mcp.openai.com/v1This enables bidirectional WebSocket communication with the MCP server for AI-assisted actions and validations.
graph TD
A[Git Commit / Push] --> B[GitHub Actions Trigger]
B --> C[Setup Python & Install Dependencies]
C --> D[Run Playwright + Pytest]
D --> E[Generate HTML Report]
E --> F[Upload Artifact to GitHub]
After each CI run:
-
Report artifact name: pytest-report
-
Accessible in the Actions tab → Artifacts section
-
Local report: report.html created in project root
-
Matrix build for Ubuntu + Windows
-
CodeQL security scan workflow
-
AI-based test case suggestion integration via MCP
-
Playwright parallel execution configuration
-
Automatic GitHub Pages publishing of HTML report
This framework demonstrates:
-
Seamless Playwright + MCP integration
-
Unified test setup for both local and CI environments
-
Intelligent, maintainable, and extensible Python automation architecture