Skip to main content
Glama
Automation Script Generator MCP Server

Automation Script Generator MCP Server

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

  1. Read: Fetch test scenarios directly from a Notion Database.

  2. Generate: Create executable Playwright (TypeScript) scripts automatically using Google Gemini.

  3. Execute: Run tests with a "Self-Healing" mechanism for resilient locators.

  4. 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-flash via @google/genai SDK)

  • 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

  1. Clone the repository:

    git clone <repository-url>
    cd automation-script-generator
  2. Install dependencies:

    npm install
  3. Environment Configuration: Create a .env file 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.ts
  • Artifacts:

    • 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 test
  • Video: 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 tools
analyze_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

    B3.3/5.0

    Scored across 7 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    Related MCP Servers