chinmaybhatk/trackflow-testwright-mcp
If you are the rightful owner of trackflow-testwright-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
TrackFlow TestWright MCP Server is an MCP server that integrates TestWright (Playwright) with Frappe-based applications for automated testing.
TrackFlow TestWright MCP Server
An MCP (Model Context Protocol) server that integrates TestWright (Playwright) with Frappe-based applications for automated testing.
Features
- Run Playwright tests against Frappe applications
- Create and manage test files
- Authenticate with Frappe
- Make API calls to Frappe backend
- Run test suites
Installation
- Clone this repository:
git clone https://github.com/chinmaybhatk/trackflow-testwright-mcp.git
cd trackflow-testwright-mcp
- Install dependencies:
npm install
- Install Playwright browsers:
npx playwright install
Usage
As MCP Server
- Start the MCP server:
npm start
- Configure your MCP client (like Claude) to connect to this server.
Running Tests Directly
# Run all tests
npm test
# Run tests with UI
npm run test:ui
# Run tests in headed mode
npm run test:headed
Available MCP Tools
1. run_playwright_test
Runs a single Playwright test against your Frappe application.
Parameters:
testName
: Name of the testurl
: URL of the Frappe applicationtestCode
: JavaScript code for the testheadless
: Whether to run in headless mode (default: true)
2. create_test_file
Creates a new test file in the tests directory.
Parameters:
fileName
: Name of the test filetestContent
: Content of the test file
3. frappe_login
Logs into a Frappe application and returns session cookies.
Parameters:
url
: Frappe application URLusername
: Usernamepassword
: Password
4. frappe_api_call
Makes API calls to Frappe backend.
Parameters:
url
: Frappe application URLmethod
: HTTP method (GET, POST, PUT, DELETE)endpoint
: API endpointdata
: Request data (optional)cookies
: Session cookies (optional)
5. run_test_suite
Runs all tests matching a pattern.
Parameters:
pattern
: Test file pattern (default: '*.spec.js')headless
: Whether to run in headless mode (default: true)
Environment Variables
FRAPPE_URL
: Base URL of your Frappe application (default: http://localhost:8000)FRAPPE_USER
: Default username for testsFRAPPE_PASSWORD
: Default password for tests
Example Test
import { test, expect } from '@playwright/test';
test('should create a new document', async ({ page }) => {
// Login
await page.goto('/login');
await page.fill('input[name="usr"]', 'administrator');
await page.fill('input[name="pwd"]', 'admin');
await page.click('button[type="submit"]');
// Navigate to DocType
await page.goto('/app/your-doctype');
// Create new document
await page.click('button:has-text("New")');
await page.fill('input[name="field_name"]', 'Test Value');
await page.click('button:has-text("Save")');
// Verify
await expect(page.locator('.toast-message')).toContainText('Saved');
});
Integration with Claude
To use this MCP server with Claude:
- Add the server configuration to your MCP settings
- Claude can then use the tools to:
- Write and execute tests
- Debug test failures
- Create test suites
- Interact with your Frappe application
License
MIT