AI-Powered E2E Test Generation Platform

July 12, 2026 · View on GitHub

AI-Powered E2E Test Generation Platform

Translate natural language requirements into production-ready end-to-end tests.

Enterprise-grade platform to generate and execute Cypress, Playwright, WebdriverIO, and Appium end-to-end tests from natural language requirements. (Appium is experimental and requires external mobile infrastructure.)

This project combines LLM-driven generation, LangGraph workflow orchestration, and vector-based pattern learning to improve test authoring speed while maintaining repeatability and CI/CD readiness.

CI EU AI Act Stars Last Commit DOI Python Node.js License OpenAI Anthropic Google

Cypress Playwright WebdriverIO LangChain LangGraph FAISS SQLite Sentence-Transformers

Docker GHCR Grafana OpenTelemetry Loki

Website

Hugging Face Spaces


Try It Live

ai-natural-language-tests on Hugging Face Spaces — Try the platform directly in your browser without installation.


Table of Contents

SectionLinks
Getting StartedProduct Preview
Overview
Quick Start (5 Minutes)
Business Value
Core Capabilities
Platform DesignArchitecture
Workflow
Technology Stack
Setup and ConfigurationRepository Structure
Prerequisites
Installation
GitHub Registry (GHCR)
Configuration
Using the PlatformUsage
Test Code Review (AI Judge)
CI/CD Integration
OperationsSecurity and Compliance Guidance
Troubleshooting
Compliance and Data Handling
Operational Expectations
Support Matrix
Project InfoDocumentation Map
Versioning and Release Policy
Support and Security Reporting
Changelog

Overview

The platform translates natural language requirements into executable E2E tests for:

flowchart LR
  A[AI-Powered E2E Test Generation]
  A --> C[Cypress<br/>.cy.js<br/>Traditional and prompt-powered]
  A --> P[Playwright<br/>.spec.ts<br/>TypeScript async/await]
  A --> W[WebdriverIO<br/>.spec.js<br/>Mocha with Jest-like expect]
  A --> M["Appium ⚠️<br/>.spec.js<br/>Mobile/iOS/Android"]

  style A fill:#e3f2fd,color:#333333,stroke:#666666
  style C fill:#c8e6c9,color:#333333,stroke:#666666
  style P fill:#ffcdd2,color:#333333,stroke:#666666
  style W fill:#ffe0b2,color:#333333,stroke:#666666
  style M fill:#f8bbd0,color:#333333,stroke:#666666
FrameworkOutputStyle
Cypress.cy.jsTraditional & prompt-powered
Playwright.spec.tsTypeScript async/await
WebdriverIO.spec.jsMocha runner with Jest-like expect
Appium (Experimental).spec.jsMobile WebdriverIO + async/await

It supports both local engineering workflows and automated pipeline execution. The generator uses contextual data from live HTML analysis and historical pattern matching to produce stable, maintainable test assets.

Quick Start (5 Minutes)

git clone https://github.com/aiqualitylab/ai-natural-language-tests.git
cd ai-natural-language-tests
python -m venv .venv
# Windows PowerShell: .\.venv\Scripts\Activate.ps1
# macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt
npm ci
npx playwright install chromium

Create .env and set at least one provider key:

OPENAI_API_KEY=your_key

Generate and run one Playwright test:

python qa_automation.py "Test login with valid credentials" --url https://the-internet.herokuapp.com/login --framework playwright --run

Business Value

Note

  • Reduces manual test authoring effort and onboarding time.
  • Standardizes generated test structure across teams.
  • Improves reuse through vector-based pattern memory.
  • Supports enterprise delivery with CI/CD and Docker workflows.
  • Enables faster root-cause diagnosis using AI-assisted failure analysis.

Core Capabilities

CapabilityDetail
Test GenerationNatural language to executable E2E test generation
Conversational RefinementMulti-turn natural language refinement of generated tests
OrchestrationLangGraph-based multi-step orchestration
LangChain RunnablesRunnableLambda wrappers for workflow invocation in CLI/UI paths
URL AnalysisDynamic URL analysis and fixture generation
Structured ParsingLangChain BaseOutputParser classes for code fences, HTML JSON, and failure output
Pattern MemoryPattern storage and semantic retrieval using FAISS + SQLite
Code ReviewAI-powered test quality review on four dimensions (assertions, selectors, structure, determinism) with concrete issue detection
LLM SupportMulti-provider: OpenAI, Anthropic, Google
Cypress ModesTraditional mode and Cypress prompt-powered mode
PlaywrightTypeScript generation
WebdriverIOJavaScript .spec.js generation with Mocha and Chrome runner support
Appium (Experimental)JavaScript .spec.js generation with WebdriverIO + async/await for Android/iOS
HITLOptional human approval gate with --approve
ReplayHTML snapshot replay with --list-html-replays and --replay-html-analysis
ExecutionOptional immediate test execution after generation
TracingOpenTelemetry trace export to Grafana Tempo
LoggingOptional log shipping to Grafana Loki

Important

Appium Experimental Status: Appium support is production-ready in code generation but requires:

  • External Appium Server: Running separately (e.g., appium --port 4723)
  • Mobile Infrastructure: Android emulator/device OR iOS simulator/device
  • Platform SDKs: Android SDK, Xcode (iOS), or connected devices
  • Environment Setup: ANDROID_HOME, platform-tools, emulator

Test generation works immediately; test execution depends on infrastructure availability.

Architecture

graph TB
    subgraph "User Input"
        A[Natural Language<br/>Requirements]
        B[URL/HTML Data<br/>--url flag]
    C[CLI Requirement Text<br/>one or more prompts]
    end

    subgraph "AI & Workflow Engine"
        D[LangGraph Workflow<br/>5-Step Process]
        E[Multi-Provider LLM<br/>OpenAI / Anthropic / Google]
        F[Vector Store<br/>Pattern Learning<br/>FAISS + SQLite]
    end

    subgraph "Framework Generation"
        G{Cypress Framework}
        H{Playwright Framework}
        W{WebdriverIO Framework}
        I[Cypress Tests<br/>.cy.js files<br/>Traditional & cy.prompt&#40;&#41;]
        J[Playwright Tests<br/>.spec.ts files<br/>TypeScript]
        X[WebdriverIO Tests<br/>.spec.js files<br/>Mocha + expect]
    end

    subgraph "Execution & Analysis"
        K[Cypress Runner<br/>npx cypress run]
        L[Playwright Runner<br/>npx playwright test]
        M[AI Failure Analyzer<br/>--analyze flag<br/>Multi-Provider LLM]
        P[WebdriverIO Runner<br/>npx wdio run]
    end

    A --> D
    B --> D
    C --> D
    D --> E
    E --> F
    F --> D
    D --> G
    D --> H
    D --> W
    G --> I
    H --> J
    W --> X
    I --> K
    J --> L
    X --> P
    K --> M
    L --> M
    P --> M

    style D fill:#e3f2fd,color:#333333,stroke:#666666
    style E fill:#f3e5f5,color:#333333,stroke:#666666
    style F fill:#fff3e0,color:#333333,stroke:#666666
    style G fill:#c8e6c9,color:#333333,stroke:#666666
    style H fill:#ffcdd2,color:#333333,stroke:#666666
    style W fill:#ffe0b2,color:#333333,stroke:#666666
High-Level Components
  • CLI entrypoint (qa_automation.py)
    • Parses arguments, selects mode, and orchestrates actions.
    • Calls workflow create_workflow() and handles result output.
  • Configuration and prompts (qa_config.py)
    • Defines framework metadata, LLM settings, and prompt loading utilities.
    • Handles model provider fallback and YAML template parsing.
  • Runtime services (qa_runtime.py)
    • Logging/tracing setup (OpenTelemetry, Grafana Loki) and persistent objects.
    • Non-blocking Loki handler with suppressed transient transport tracebacks.
    • FAISS + SQLite pattern store lifecycle and query helpers.
    • HTML analysis replay and parser-backed failure analysis formatting.
  • LangGraph workflow (qa_workflow.py)
    • Defines TestState and step nodes (fetch, pattern search, generate, run).
    • Uses LangChain runnables/parsers for generation input/output shaping.
    • Builds workflow graph with conditional transitions and checkpointer.
  • Conversational refinement (qa_refinement.py)
    • Multi-turn natural language refinement of generated tests.
    • Panel-based state management: code + instruction → revised code.
    • Safety rules: file integrity, no empty sections, disk-only writes, error recovery.
    • Zero heavy dependencies: imports only from qa_config (not qa_workflow or qa_runtime).
  • Observability layer (OpenTelemetry + Loki)

Workflow

flowchart TD
    A[Start: User Input<br/>Requirements + Framework] --> C[Step 2: Fetch Test Data<br/>Analyze URL/HTML<br/>Extract Selectors<br/>Generate Fixtures]
    C --> D[Step 3: Search Similar Patterns<br/>Query Vector Store<br/>Find Matching Test Patterns<br/>From Past Generations]
    D --> E[Step 4: Generate Tests<br/>Use AI + Patterns<br/>Create Framework-Specific Code<br/>Cypress, Playwright, or WebdriverIO]
    E --> H[HITL Approval<br/>Optional --approve before save]
    H --> F[Step 5: Run Tests<br/>Execute via Framework Runner<br/>Optional --run flag]
    F --> R[Replay Snapshot<br/>--list-html-replays / --replay-html-analysis]
    R --> G[End: Tests Executed<br/>Ready for CI/CD]

    style A fill:#e1f5fe,color:#333333,stroke:#666666
    style C fill:#c8e6c9,color:#333333,stroke:#666666
    style D fill:#ffcdd2,color:#333333,stroke:#666666
    style E fill:#f3e5f5,color:#333333,stroke:#666666
    style F fill:#e8f5e8,color:#333333,stroke:#666666
    style G fill:#f3e5f5,color:#333333,stroke:#666666

Generation follows a deterministic five-step flow:

StepNameDescription
2Fetch Test DataAnalyze URL/HTML, extract selectors, generate fixtures
3Search Similar PatternsQuery vector store for matching historical patterns
4Generate TestsUse AI + patterns to create framework-specific code, optionally HITL-gated via --approve
5Run TestsOptionally execute via framework runner (--run)
ReplayDebug HTML AnalysisReplay stored HTML snapshots via CLI (--list-html-replays, --replay-html-analysis)

Technology Stack

LayerTechnology
OrchestrationPython CLI orchestration
WorkflowLangChain + LangGraph
Prompt and Output HandlingLangChain PromptTemplate + BaseOutputParser
Vector StoreFAISS + SQLite
Embeddingslangchain-huggingface (preferred) with langchain-community fallback
LLM BackendsOpenAI / Anthropic / Google
Test RunnersCypress, Playwright, and WebdriverIO runners
ObservabilityOpenTelemetry SDK and OTLP exporter
LoggingLoki logging handler (optional)

Repository Structure

View repository tree
ai-natural-language-tests/
|-- .github/
|-- docs/
|-- cypress/
|   |-- e2e/
|   |   |-- generated/
|   |   `-- prompt-powered/
|   `-- fixtures/
|-- tests/
|   `-- generated/
|-- webdriverio/
|   `-- tests/
|       `-- generated/
|-- web/
|-- webdriverio/
|   `-- tests/
|       |-- generated/
|       |-- appium-tests/
|       `-- prompt-powered/
|-- prompt_specs/
|-- skills/
|-- services/
|-- knowledge/
|-- generated_exports/
|-- rag_failure_analysis/
|-- vector_db/
|-- qa_automation.py
|-- qa_config.py
|-- qa_runtime.py
|-- qa_workflow.py
|-- qa_refinement.py
|-- test_qa_refinement.py
|-- ragas_evaluator.py
|-- ragas_nlp_evaluator.py
|-- cypress.config.js
|-- playwright.config.ts
|-- wdio.conf.js
|-- package.json
|-- package-lock.json
|-- requirements.txt
|-- Dockerfile
|-- docker-compose.yml
|-- agent.yaml
|-- SOUL.md
|-- RULES.md
|-- PROMPT_UPDATE_GUIDE.md
|-- CONTRIBUTING.md
|-- CHANGELOG.md
`-- README.md

Prerequisites

RequirementVersion / Notes
Python3.10+
Node.js22+
npmCurrent stable release
GitCurrent stable release
Playwright browsersnpx playwright install chromium

Installation

Local Setup
git clone https://github.com/aiqualitylab/ai-natural-language-tests.git
cd ai-natural-language-tests
python -m venv .venv
# Windows PowerShell: .\.venv\Scripts\Activate.ps1
# macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt
npm ci
npx playwright install chromium

Create .env from .env.example, then set at least one provider key:

OPENAI_API_KEY=your_key

PowerShell quick set for current session:

$env:OPENAI_API_KEY = "your_key"

Optional: GitAgent (Repo-Specific)

This repository includes a targeted gitagent setup for its QA automation workflow:

  • agent.yaml (manifest)
  • SOUL.md and RULES.md (behavior and constraints)
  • knowledge/ (framework and repo references)

In short: agent.yaml defines the repo agent, SOUL.md and RULES.md define how it should behave, and knowledge/ gives it project-specific framework guidance.

Quick commands:

npm run gitagent:validate
npm run gitagent:info
npm run gitagent:export
Docker Setup
git clone https://github.com/aiqualitylab/ai-natural-language-tests.git
cd ai-natural-language-tests
docker compose build

Docker Compose loads .env and now explicitly forwards observability variables for Tempo and Loki to the container runtime.

Run in container:

docker compose run --rm test-generator "Test login" --url https://the-internet.herokuapp.com/login

Run with observability enabled:

docker compose run --rm test-generator \
  "Test login" --url https://the-internet.herokuapp.com/login --framework playwright --run

GitHub Registry (GHCR)

Pre-built Docker images are published to GitHub Container Registry. No local clone or build required.

Without GHCRWith GHCR
Clone → install → build → rundocker run — done
Each user builds their own imageOne image built once, shared everywhere
"Works on my machine" problemsIdentical environment for every user

Pull and run

docker pull ghcr.io/aiqualitylab/ai-natural-language-tests:latest

docker run --rm \
  -e OPENAI_API_KEY=your_key \
  ghcr.io/aiqualitylab/ai-natural-language-tests:latest \
  "Test login" --url https://the-internet.herokuapp.com/login

Image tags

TagUse case
latestAlways the most recently published version — use for quick runs
v5.1.0Pinned to a specific release — use in CI/CD for reproducibility

For publishing and release management, see CONTRIBUTING.md.

Configuration

Core API Keys (Cloud Providers)
OPENAI_API_KEY=your_key
ANTHROPIC_API_KEY=your_key
GOOGLE_API_KEY=your_key
Local LLM Endpoints (Ollama, vLLM, LM Studio)

Use local LLM endpoints to generate tests without sending HTML data to cloud APIs. Supports:

  • Ollama (run locally: ollama serve)
  • vLLM (high-throughput inference)
  • LM Studio (simple GUI setup)

For complete setup, CI/CD workflows, model recommendations, and troubleshooting, see LOCAL_PROVIDER_GUIDE.md

# Ollama (default: http://localhost:11434/v1)
OLLAMA_BASE_URL=http://localhost:11434/v1
OLLAMA_MODEL=llama2

# OpenAI-compatible endpoint (vLLM, LM Studio)
LOCAL_OPENAI_BASE_URL=http://localhost:8000/v1
LOCAL_OPENAI_MODEL=gpt-3.5-turbo

CLI Usage:

python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --llm ollama
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --llm local-openai

UI Usage: Set endpoint URLs in Settings tab, then select provider in Generate TestsLLM Provider dropdown.

OpenTelemetry (Grafana Tempo)
OTEL_PROVIDER=grafana
OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp-gateway-prod-eu-north-0.grafana.net/otlp
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic <base64(instance_id:api_token)>
Loki Logging (Optional)
GRAFANA_LOKI_URL=https://logs-prod-eu-north-0.grafana.net
GRAFANA_INSTANCE_ID=<instance_id>
GRAFANA_API_TOKEN=<logs_write_token>

Tip

Privacy-first setup:

  • Use an LLM provider account/plan that guarantees no training or zero-retention for API data.
  • Keep OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GRAFANA_LOKI_URL, GRAFANA_INSTANCE_ID, and GRAFANA_API_TOKEN unset to avoid telemetry/log shipping.
  • Use masked or synthetic test data for sensitive fields.

Tip

Need to support a new URL and tune prompts safely? Follow the step-by-step guide in PROMPT_UPDATE_GUIDE.md.

Usage

Quick Reference

ModeCommand
Cypress (default)python qa_automation.py "requirement" --url <url>
Playwrightpython qa_automation.py "requirement" --url <url> --framework playwright
WebdriverIOpython qa_automation.py "requirement" --url <url> --framework webdriverio
Appium Android (Experimental)python qa_automation.py "requirement" --url <url> --framework appium
Appium iOS (Experimental)APP_PLATFORM=ios python qa_automation.py "requirement" --url <url> --framework appium
Prompt-powered Cypresspython qa_automation.py "requirement" --url <url> --use-prompt
Appium Prompt-Powered (Experimental)python qa_automation.py "requirement" --url <url> --framework appium --use-prompt
Generate + Executepython qa_automation.py "requirement" --url <url> --run
Failure Analysispython qa_automation.py --analyze "error message"
Pattern Inventorypython qa_automation.py --list-patterns

Demo & Test URLs

Use these URLs to try the platform immediately:

AppURLBest For
The Internet (login form)https://the-internet.herokuapp.com/loginLogin tests, form validation, error handling
The Internet (dynamic loading)https://the-internet.herokuapp.com/dynamic_loading/1Wait/timing tests, dynamic content
The Internet (tables)https://the-internet.herokuapp.com/tablesData extraction, table assertions
The Internet (file download)https://the-internet.herokuapp.com/downloadFile handling, downloads
The Internet (drag & drop)https://the-internet.herokuapp.com/drag_and_dropComplex interactions

Quick test command:

python qa_automation.py "Test login with valid credentials" \
  --url https://the-internet.herokuapp.com/login \
  --framework playwright \
  --run

Tip

If your global python misses project dependencies, run with the repository virtual environment:

  • PowerShell: .\.venv\Scripts\python.exe qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework playwright --run
  • Bash: ./.venv/Scripts/python.exe qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework playwright --run

Note

The current CLI supports URL-driven generation via --url. A direct --data JSON input flag is not implemented in this repository yet.

Natural Language Prompt Examples

What you typeWhat AI generates
"Test login with valid credentials"Login form fill + submit + success assertion
"Test login fails with wrong password"Negative test with error message assertion
"Test contact form submission"Form field detection + submit + confirmation
"Test search returns results"Search input + trigger + results count assertion
"Test signup with missing fields"Validation error coverage for required fields
"Test logout clears session"Post-login logout + redirect assertion

Tip

Writing effective AI requirements

  • Be specific about the action: "Test login" vs "Test login with valid credentials and verify dashboard loads"
  • Mention the expected outcome when it matters: "...and verify error message appears"
  • Use --url to give the AI real page context — it reads the HTML and picks the right selectors automatically
  • Chain multiple requirements in one run: "Test login" "Test logout" --url <url>

Generate Cypress Test

Show command
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login

Generate Playwright Test

Show command
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework playwright

Generate WebdriverIO Test

Show command
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework webdriverio

Generate Appium Test (Experimental)

Warning

Appium test generation works immediately, but execution requires external Appium server + mobile device/emulator running.

Show command
# Start Appium server in separate terminal
appium --port 4723 &

# Generate test (works without device)
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework appium

Appium Setup & Execution (Experimental)

Prerequisites & First-Run Setup

Install Appium globally:

npm install -g appium@latest
appium driver install uiautomator2   # Android
appium driver install xcuitest       # iOS

Environment Variables:

# Windows PowerShell
$env:ANDROID_HOME = "C:\Users\YourUser\AppData\Local\Android\Sdk"
$env:PATH += ";$env:ANDROID_HOME\platform-tools"

# macOS/Linux
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools

Create Android Emulator (Android Studio GUI):

  1. Open Android Studio → Device Manager
  2. Click Create Device → Select Pixel 5 → Android 14 API 34
  3. Click Play to start emulator
  4. Verify with: adb devices

Generate + Run Test:

# Terminal 1: Start Appium server
appium --port 4723

# Terminal 2: Generate and run test
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework appium --run

iOS Testing (macOS only):

APP_PLATFORM=ios python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework appium --run

Prompt-Powered Cypress Mode

Show command
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --use-prompt

Generate and Execute

Show command
python qa_automation.py "Test login" --url https://the-internet.herokuapp.com/login --framework playwright --run

Conversational Test Refinement

Refine generated tests in the UI with natural language instructions — multi-turn refinement supported.

  1. Generate tests using the "Generate" button
  2. Describe your refinement in the "Refine (describe the change)" textbox
  3. Click "Refine" to apply the refinement
  4. Repeat for multi-turn refinement

Refinement Examples:

InstructionWhat Happens
"add an assertion for the success toast message"LLM revises test to include toast validation
"add error case test for empty password"LLM adds a negative test case
"add explicit wait before clicking submit"LLM adds cy.wait() or page.waitForLoadState()
"verify response status is 200"LLM adds network assertion
"use data-testid selectors instead of CSS classes"LLM updates all selectors to use data attributes

Safety Guarantees:

  • File integrity: LLM cannot add, remove, or rename files
  • No empty tests: Every file must have runnable code
  • No panel corruption: If refinement fails, original code is preserved
  • Multi-turn support: Each refinement builds on the previous output

How It Works:

  1. Generated code panel displays with // FILE: <path> headers
  2. User enters refinement instruction (e.g., "also test the error message")
  3. System sends current code + instruction to LLM
  4. LLM returns complete revised code (never diffs or fragments)
  5. Panel updates and files written to disk (if originals had headers)
  6. Repeat for additional refinements

Tip

Best Practices for Refinements

  • Start with generation, then refine iteratively
  • Be specific: "add assertion for button text" vs "improve the test"
  • One instruction per refinement (easier for LLM to apply correctly)
  • Use the same LLM provider throughout a refinement session for consistency

Failure Analysis

Show commands
python qa_automation.py --analyze "CypressError: Element not found"
python qa_automation.py --analyze -f error.log

Note

The AI failure analyzer returns a structured diagnosis:

FieldDescription
CATEGORYError type: SELECTOR, TIMING, ASSERTION, NETWORK, STATE, NAVIGATION, INTERACTION, CONFIGURATION, ENVIRONMENT, or DYNAMIC_URL
REASONRoot cause explanation in plain English
FIXSuggested code change or configuration fix

Test Code Review (AI Judge)

Review generated test code quality before execution. The AI judge scores tests on four dimensions and suggests concrete improvements.

Available in Gradio UI:

  1. Generate tests using the "Generate" button
  2. Review generated code in the "Generated Test Code" panel
  3. Click "Review (AI judge)" button
  4. Read scores and issues in "Review Scores" panel

Review Dimensions

DimensionDescriptionCriteria
AssertionsTests verify meaningful outcomesText content, state changes, navigation verified (not just visibility)
SelectorsSelector robustnessPrefer data-testid, roles, labels over brittle patterns (nth-child, deep CSS chains)
StructureCode organizationClear describe/it blocks, no duplication, good naming, framework idioms
DeterminismTest stabilityNo fixed sleeps, no order dependence, no reliance on pre-existing state

Scoring & Verdict

  • Each dimension scored 0–5
  • "needs_work" verdict if ANY dimension scores ≤ 2
  • "approve" verdict if all dimensions score > 2
  • Issues list: up to 5 concrete problems, most important first
  • Refinement suggestion: one-sentence fix for the biggest issue

Example Review Output

{
  "scores": {
    "assertions": 4,
    "selectors": 3,
    "structure": 5,
    "determinism": 2
  },
  "verdict": "needs_work",
  "issues": [
    "Add explicit waits before assertions to ensure determinism",
    "Use data-testid attributes instead of nth-child selectors",
    "Add error case assertion for failed login"
  ],
  "refinement_instruction": "Replace hardcoded timeouts with proper element waits and data-testid selectors."
}

Works with all frameworks

Code review applies uniformly to Cypress, Playwright, WebdriverIO, and Appium tests. The AI understands framework syntax from the framework context and provides actionable feedback.

Pattern Inventory

Show command
python qa_automation.py --list-patterns

AI Quality Evaluation (Ragas)

The project ships two evaluation scripts that measure whether the AI-generated tests are actually grounded in the page under test. They run automatically in CI but can also be run locally at any time.


Why these scripts exist

Generating test code from natural language is only useful if the generated tests match what the page actually contains. Without evaluation, you have no signal on whether GPT-4o-mini produced a test that talks about the right form fields, the right URL, or the right expected outcomes. These two scripts give that signal using Ragas, a framework designed to evaluate LLM outputs.


ragas_nlp_evaluator.py — No API key needed

This script compares the AI's generated text against reference answers using three classical NLP metrics that run fully offline.

MetricWhat it measures
ROUGERecall-oriented word overlap between response and reference
SIMNon-LLM string similarity (edit-distance based)

The overall score for each sample is the average of all.

Run locally:

pip install ragas==0.4.3 sacrebleu rapidfuzz rouge-score
python ragas_nlp_evaluator.py

By default it reads test_dataset.json. Each entry in that file needs:

{
  "name": "login valid",
  "response": "The generated text from the AI",
  "reference": "The expected correct answer"
}

Pass a custom dataset or threshold:

python ragas_nlp_evaluator.py --dataset my_dataset.json --threshold 0.60

The script exits with code 1 if any sample scores below the threshold, which lets CI block on low-quality output. It also prints min, max, and overall average at the end.


ragas_evaluator.py — Requires OPENAI_API_KEY

This script evaluates the generated test file against the live page HTML using four LLM-based Ragas metrics.

MetricWhat it measures
FaithfulnessIs the answer consistent with the page HTML?
Answer RelevancyDoes the answer address the requirement?
Context PrecisionIs the retrieved HTML focused on what matters?
Context RecallDoes the HTML contain everything needed to answer?

It fetches the page, asks GPT-4o-mini to answer the requirement using page HTML, and scores how well that answer holds up.

Run locally:

python ragas_evaluator.py "Test user login with valid credentials" \
  --test cypress/e2e/generated/login.cy.js \
  --url https://the-internet.herokuapp.com/login

How they fit into CI

CI runs ragas_nlp_evaluator.py first (no API key, fast) as a quality gate. If it passes, the three framework jobs run in parallel — each generates tests, then calls ragas_evaluator.py against every generated file before running the tests themselves.

nlp-baseline job
  1. Install nlp dependencies
  2. Run ragas dataset baseline on test_dataset.json

if baseline passes
  test matrix jobs run in parallel
  1. Install dependencies
  2. Generate tests
  3. Run ragas generated test evaluation per file
  4. Run tests
  5. AI failure analysis if tests fail

CI/CD Integration

flowchart TD
  A[Code changes pushed to repo] --> B[Pipeline starts]
  B --> C[Install dependencies]
  C --> D[Run ragas dataset baseline]
  D --> E[Generate tests]
  E --> F[Run ragas generated test evaluation]
  F --> G[Run tests]
  G --> H[Tests pass]
  G --> I[Tests fail]
  H --> J[Deploy application]
  I --> K[Analyze failures]
  K --> L[Regenerate tests]
  L --> G
  K --> M[Notify developers]

Recommended pipeline stages:

StageAction
1Install Python and Node dependencies
2Validate environment variables and secrets injection
3Run Ragas dataset baseline on test dataset
4Generate tests from requirements
5Run Ragas evaluation on generated tests
6Execute generated tests
7Publish artifacts and reports
8Export telemetry to observability stack

Security and Compliance Guidance

Important

  • Store secrets only in secure secret managers (never commit .env).
  • Use scoped API tokens with least-privilege access.
  • Rotate provider keys and Grafana tokens on a fixed cadence.
  • Keep generated tests and reports free of sensitive production data.
  • Apply repository protection rules and mandatory CI checks.

Troubleshooting

Warning

Traces Not Visible in Grafana Tempo

  • Verify OTLP endpoint region and datasource selection.
  • Verify Authorization=Basic <base64(instance_id:api_token)> format.
  • Query with:
{resource.service.name="ai-natural-language-tests"}

Note

Loki Authentication Errors

  • Ensure token has logs:write scope.
  • Confirm instance ID and logs endpoint match the same Grafana stack.

Note

Loki 5xx Transport Errors (for example, 502)

  • Test generation continues; logging transport failures are treated as non-blocking.
  • The runtime suppresses traceback spam and emits a throttled warning instead.
  • Investigate Grafana stack health/network path if these warnings persist.

Tip

Docker Observability Validation

  • Confirm .env includes OTLP and Loki keys before docker compose run.
  • Use docker compose config to verify environment interpolation.
  • In Grafana Explore, query Tempo with service.name="ai-natural-language-tests".
  • In Grafana Loki, query labels: {service_name="ai-natural-language-tests"}.

Tip

Switching to Headed Mode for Debugging

Tests run headless by default. To debug interactively, switch your framework config:

Cypress:

  • Edit cypress.config.js and add headed: true after browser: 'chrome'
  • Or run: npx cypress run --headed --spec 'cypress/e2e/generated/*.cy.js'

Playwright:

  • Edit playwright.config.ts and change headless: trueheadless: false
  • Or run: npx playwright test --headed tests/generated/

WebdriverIO:

  • Edit wdio.conf.js and comment out '--headless=new' from the args array

Docker Headed Mode (with X11 forwarding):

docker build --target debug -t ai-tests:debug .
docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix ai-tests:debug
  • Optional: mainly for Linux visual debugging.
  • Retry with generated single-spec command from logs.

Documentation Map

DocumentPurpose
README.mdPlatform overview, setup, usage, and operations
CONTRIBUTING.mdContribution standards, review checks, and branch/PR flow
CHANGELOG.mdRelease history and notable changes
PROMPT_UPDATE_GUIDE.mdPrompt and URL-tuning workflow
RULES.mdRepository automation and behavior constraints

Versioning and Release Policy

Policy AreaGuidance
Release modelChangelog-driven, documented in CHANGELOG.md
Production pinningPrefer version tags such as v5.1.0 instead of latest
latest usageUse for local exploration, not for controlled CI/CD
Upgrade notesBreaking changes and upgrade guidance are captured per release

Support and Security Reporting

TopicRecommended Action
Usage and feature requestsOpen a GitHub issue with reproduction steps and environment details
Vulnerability reportingAvoid public exploit details; share minimal impact + repro details privately
Exposed credentialsRevoke and rotate tokens before sharing logs or artifacts

Compliance and Data Handling

Control AreaGuidance
Data minimizationUse synthetic or masked data in prompts, fixtures, and generated tests
Secret hygieneKeep keys in secret managers; never commit secrets
Telemetry controlKeep OpenTelemetry and Loki export optional and environment-driven
Access controlUse least-privilege tokens for providers and observability
AuditabilityUse pinned image tags and changelog-referenced releases

For implementation details and contribution controls, see CONTRIBUTING.md.

Note

This project follows EU AI Act readiness practices. See MODEL_CARD.md and INCIDENT_RESPONSE.md.

Operational Expectations

These are practical runbook-style expectations for delivery teams. They are operational targets, not contractual SLAs.

AreaTargetNotes
Deterministic generation flowStable multi-step workflow executionUses fixed workflow stages with optional HITL gate
CI pipeline repeatabilityReproducible runs with pinned dependenciesPrefer pinned Docker/image tags and locked dependency files
Failure triageFast first-pass diagnosisUse --analyze output for CATEGORY, REASON, and FIX guidance
Incident containmentRapid credential isolationRevoke and rotate provider/observability tokens if exposed

Support Matrix

The matrix below reflects currently configured and documented project baselines.

ComponentBaseline
Python3.10+
Node.js22+
Cypress15.8.1+
Playwright1.58.1+
WebdriverIO8.46.0+
Chromedriver145.0.6+
Environment GuidanceRecommendation
Shell compatibilityUse documented commands for both Windows PowerShell and Unix-like shells
Playwright runtimeInstall Chromium browsers before first Playwright execution
Enterprise rolloutPin versions and run smoke tests in each target environment

Changelog

Release notes are maintained in CHANGELOG.md, following the Keep a Changelog format.


Production-focused AI-assisted E2E test generation for modern QA teams.

© 2026 AI Quality Lab / Sreekanth Harigovindan
tests.aiqualitylab.org