Automation Script Generator MCP Server
This server automates the generation of WebDriverIO (WDIO) test automation code from test scenarios, with pattern analysis and AI-powered code review capabilities.
Core Capabilities:
Process Complete Test Scenarios - Generate all required WDIO test files (features, steps, pages, components) from a single test scenario with Gherkin syntax, selectors, and test data in one operation
Analyze Repository Patterns - Scan existing codebases to identify and learn from established testing patterns, formats, and validation rules for consistency
Generate Individual Test Files - Create specific WDIO files:
Feature files with Gherkin syntax and test ID tags
Step definition files that implement Gherkin steps and reuse existing functions
Page object files with element selectors and reusable page functions
Component files containing test data collections and configurations
Review and Enhance Code - Automatically analyze and improve generated code with:
Documentation and comments
Page Object Model (POM) pattern enforcement
Reusable and utility function extraction
Proper formatting
Integration with existing step definitions
Customize Output - Specify output directories and paths for generated files, allowing seamless integration into existing project structures
Implements robust input validation using AJV (Another JSON Schema Validator) to validate all tool inputs against defined schemas before execution, providing type checking, required field validation, and detailed error messages.
Supports environment configuration through .env files for setting parameters like repository paths, output paths, and WDIO configuration paths.
Requires Node.js 18+ as a runtime environment for the MCP server operation.
Fetches test scenarios from Notion databases, including scenario titles, tags, Gherkin syntax, selectors, and data items for test generation.
Generates complete test suites with the WebDriverIO framework, including feature files (Gherkin syntax), step definition files, Page Object Model files, and component files for automated testing.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Automation Script Generator MCP Server generate a test for user login with 2FA"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Automation Script Generator
š Project Mission: Hybrid AI Automation Framework (Notion -> Playwright)
This project creates an autonomous end-to-end testing framework that bridges the gap between manual test case management and automated execution. It leverages Generative AI to automatically generate robust Playwright test scripts from Notion test tickets.
Related MCP server: Playwright Wizard MCP Server
šÆ Objectives
Read: Fetch test scenarios directly from a Notion Database.
Generate: Create executable Playwright (TypeScript) scripts automatically using Google Gemini.
Execute: Run tests with a "Self-Healing" mechanism for resilient locators.
Report: Generate detailed reports via Allure and reflect status updates back to Notion.
š ļø Tech Stack
Language: TypeScript, Node.js (v20+)
Framework: Playwright
AI Model: Google Gemini (
gemini-2.0-flashvia@google/genaiSDK)Integration: Notion API (
@notionhq/client)Reporting: Allure Report
š Directory Structure
/
āāā .agent/rules/ # Antigravity context rules
āāā config/ # Configuration files
ā āāā notion.config.ts # Notion API keys and DB IDs
āāā src/
ā āāā generator/ # THE BUILDER
ā ā āāā fetcher.ts # Pulls from Notion
ā ā āāā translator.ts # Gemini Agent (Notion -> TS Code)
ā ā āāā writer.ts # Saves .spec.ts files
ā āāā framework/ # THE RUNNER
ā ā āāā pages/ # Page Objects (POM)
ā ā āāā actions/ # Self-healing wrappers
ā āāā tests/ # Generated Spec files live here
āāā playwright.config.ts
āāā .env # Contains API Keys
āāā package.jsonāļø Setup & Installation
Clone the repository:
git clone <repository-url> cd automation-script-generatorInstall dependencies:
npm installEnvironment Configuration: Create a
.envfile in the root directory and add your keys:GEMINI_API_KEY=your_google_gemini_api_key NOTION_TOKEN=your_notion_integration_token NOTION_DATABASE_ID=your_notion_database_id
š Usage
1. Generate Tests
To fetch "Ready for Automation" tickets from Notion and generate Playwright test files with strict Page Object Model separation:
npx ts-node src/generator/main.tsArtifacts:
src/framework/pages/*.page.ts: Page Objects (private selectors, public methods).src/tests/[module]/[module].data.ts: Shared test data per module.src/tests/[module]/[id]...spec.ts: Clean test specs.
2. Run Tests
To execute the generated Playwright tests:
npm testVideo: Recorded for ALL runs (available in Allure report).
Screenshots: Captured only on failure.
3. View Reports
To generate and view the Allure test report:
npm run test:report # Generates report (cleans old results)
npm run test:open # Opens report in browserš§ Smart Actions (Self-Healing)
The framework includes a SmartPage wrapper that handles flaky selectors. If a primary selector fails, it attempts to "heal" by using fallback strategies (like text hints) and logs the event, preventing brittle test failures.
Available Tools
7 toolsanalyze_repository_patternsC
Read and analyze repository for existing patterns, formats, and validation rules
Inputs: repo_path (required), pattern_types.
generate_component_fileC
Generate component file with collection of data items (only if needed)
Inputs: scenario_title (required), data_items (required), output_path (required).
generate_feature_fileC
Generate WDIO feature file with Gherkin syntax (Given, When, Then)
Inputs: scenario_title (required), gherkin_syntax (required), output_path (required), tags.
generate_page_fileC
Generate WDIO page object file with general functions and element selectors
Inputs: scenario_title (required), selectors (required), output_path (required), page_functions.
generate_steps_fileB
Generate WDIO step definitions file with functions to execute Gherkin syntax
Inputs: scenario_title (required), gherkin_syntax (required), output_path (required), selectors, +1 more.
process_test_scenarioB
Process a test scenario provided directly by the user and generate complete WDIO test files
Inputs: scenario_title (required), gherkin_syntax (required), selectors (required), output_directory (required), +3 more.
review_and_enhance_codeC
Review generated code and enhance it with improvements, documentation, validation, POM patterns, and reusable functions
Inputs: file_paths (required), review_criteria, repo_path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 7 tools
Most tools have distinct purposes targeting different file types or stages in the test automation workflow. However, 'process_test_scenario' could overlap with the individual file generation tools, as it generates complete WDIO test files which might include components the other tools create separately. The descriptions help clarify but some ambiguity remains.
All tool names follow a consistent verb_noun pattern with snake_case, using clear action verbs like 'analyze', 'generate', 'process', and 'review'. The naming is predictable and readable throughout the set, with no deviations in style or convention.
With 7 tools, this server is well-scoped for generating WDIO automation scripts. Each tool serves a specific role in the workflow, from analysis to file generation and enhancement, making the count appropriate and efficient for the domain without being overwhelming or insufficient.
The tool set covers the core lifecycle of test automation generation, including analysis, file creation for components, features, pages, and steps, processing scenarios, and code review. A minor gap exists in lacking explicit tools for updating or deleting generated files, but agents can work around this by regenerating or using the review tool for modifications.
Related MCP Connectors
Generate and run tests, manage test cases, and inspect results from your AI assistant.
Write, run and check natural-language browser tests of your web app from your AI assistant.
Find your recorded end-to-end web tests, run them and read step-by-step results.
Run browser journeys on the app you build with AI, and manage test cases, launches and defects.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables migration of test automation projects from WebDriverIO to Playwright using AST-based transformations. Provides tools for analyzing tests, converting syntax, refactoring to Page Object Model, and generating migration reports.9MIT
- AlicenseAqualityDmaintenanceGuides users through creating professional Playwright test suites with a step-by-step wizard workflow, including analysis, planning, setup, and implementation.1556 npm7MIT
- AlicenseNot gradedqualityDmaintenanceGenerates Playwright visual testing scripts from CSV data with advanced configuration management and environment switching capabilities.ISC
- AlicenseAqualityDmaintenanceGenerates structured, comprehensive test cases from user stories, API specs, or raw text, with automatic Excel export and Playwright automation code generation.61MIT