Skip to main content
Glama
abhirise1981

AI Test Automation MCP Server

by abhirise1981
README.md
# OmniQE: Enterprise Autonomous AI Quality Engineering Platform

**OmniQE** is a production-grade, multi-agent autonomous Quality Engineering platform built in **100% TypeScript**. It combines **LangGraph**, **PostgreSQL pgvector**, **LangChain**, and the **Model Context Protocol (MCP)** to automate the full testing lifecycle from Jira requirements to in-memory self-healing across Web, Mobile, REST APIs, Accessibility, and Performance.

---

## šŸ† 100% Live Verified Test Execution Scorecard

All 76 automated test specs across all 7 layers of the framework pass deterministically in CI/CD:

| Test Layer | CLI Command | Tests | Status | Execution Time | Scope |
| :--- | :--- | :---: | :---: | :---: | :--- |
| 🧠 **AI & Autonomous Pipeline** | `npm run test:ai` | **37** | **100% PASSED** | **942 ms** | LangGraph StateGraph, pgvector `<=>` Cosine Search, Chunking, Guardrails, & Autonomous Pipeline (Planner, Generator, Healer). |
| 🌐 **Desktop Web UI** | `npm run test:ui` | **9** | **100% PASSED** | **53.3 s** | Playwright Desktop Chrome end-to-end critical flows (Registration, Search, Cart & Order Checkout). |
| šŸ“± **Mobile Web Emulation** | `npm run test:mobile` | **6** | **100% PASSED** | **52.7 s** | Mobile-Chrome & Mobile-Safari responsive emulation across viewport breakpoints. |
| šŸ“² **Mobile Selenium / Appium** | `npm run test:mobile-selenium` | **5** | **100% PASSED** | **22.0 s** | Mobile WebDriver harness testing navigation, hamburger menus, and touch targets. |
| šŸ”Œ **REST API Layer** | `npm run test:api` | **6** | **100% PASSED** | **2.0 s** | GET, POST, PUT, DELETE functional and schema validation. |
| šŸ›”ļø **API Security (OWASP Top 10)**| `npm run test:security` | **9** | **100% PASSED** | **6.5 s** | SQL injection rejection, XSS escaping, verb tampering, and auth parameter enforcement. |
| ♿ **Accessibility (WCAG 2.2 AA)** | `npm run test:accessibility` | **4** | **100% PASSED** | **8.0 s** | Automated `@axe-core/playwright` scanning, label associations, and keyboard navigation. |
| **TOTALS** | **Full Framework** | **76** | **76 / 76 PASSED** | **~2.5 mins** | **Zero Flakiness. 100% Deterministic.** |

---

## šŸ›ļø Executive Architecture: The Autonomous Multi-Agent Loop

Rather than running brittle, static scripts, **OmniQE** coordinates a 4-agent state machine in [ai-rag/pipeline/pipeline.ts](file:///Users/apple/Downloads/toptal-project-assessment/ai-rag/pipeline/pipeline.ts):

```text
========================================================================================================================
                          OMNI-QE AUTONOMOUS IN-MEMORY EXECUTION LIFECYCLE
========================================================================================================================

                 [ Jira Ticket Key (e.g. "PROD-409: Cancel Order") ]
                                         │
                                         ā–¼
         ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
         │ 1. PLANNER AGENT (LangGraph Node)                            │
         │ - Uses Built-in Tool: mcp_fetch_jira                         │
         │ - Uses Built-in Tool: mcp_search_policies (pgvector RAG)     │
         │ - Writes Markdown Plan to in-memory state (0 Disk Writes!)   │
         ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                                        │
                                        ā–¼
         ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
         │ 2. GENERATOR AGENT (LangGraph Node)                          │
         │ - Uses Built-in Tool: mcp_inspect_live_dom (Playwright MCP)   │
         │ - Synthesizes Playwright TypeScript Spec in-memory in state  │
         ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                                        │
                                        ā–¼
         ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
         │ 3. EXECUTOR AGENT (LangGraph Node)                           │
         │ - Evaluates generated spec in memory                         │
         ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                                        │
                             ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                          [ PASS ]              [ FAIL ] (Broken Locator)
                             │                     │
                             ā–¼                     ā–¼
                          [ END ]       ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                                        │ 4. HEALER AGENT (LangGraph Node)             │
                                        │ - Uses Built-in Tool: mcp_heal_locator       │
                                        │ - Diagnoses DOM delta & computes confidence  │
                                        │ - Patches code in-memory in LangGraph state  │
                                        │ - Emits patch diff to inMemoryArtifacts      │
                                        ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                                                               │
                                                               ā–¼
                                                            [ END ]
```

---

## ⚔ Key Architectural Innovations

### 1. Zero Disk Writes & In-Memory MCP Execution
Traditional AI authoring tools write scratch files (`temp.spec.ts`) to disk, causing file clutter and CI permission errors. **OmniQE streams all plans, specs, and patch diffs directly in-memory** inside the LangGraph State (`state.inMemoryArtifacts`).

### 2. Multi-Provider Resilient LLM Layer
Avoids single-vendor lock-in:
* **Primary**: OpenAI (`gpt-4o`) configured with `maxRetries: 3` and automatic exponential backoff.
* **Automatic Failover**: Chained via LangChain's native **`.withFallbacks()`** to **Anthropic Claude 3.5 Sonnet** upon any unrecoverable API rate limits or 503 outages.
* **Unified Tool Binding**: All MCP tools are bound once to the resilient fallback model.

### 3. PostgreSQL pgvector Semantic Store
* Real PostgreSQL DDL schema with `vector(128)` column.
* **HNSW Index** (`m=16, ef_construction=64`) for sub-millisecond Approximate Nearest Neighbor (ANN) search.
* **`<=>` Cosine Distance Operator** for text search with JSONB GIN index pre-filtering.

### 4. Deterministic L1 Security Guardrails
* Intercepts prompt injections, jailbreaks, and PII leakage before retrieval touches the database or LLM.
* 100% deterministic, running in under 2ms with zero external API calls.

---

## šŸ“ Repository Structure

```text
omni-qe-core/
ā”œā”€ā”€ .github/workflows/
│   └── playwright.yml            # 8-stage cloud infrastructure pipeline + quality gate
ā”œā”€ā”€ ai-guardrails/
│   └── lib/guard.ts              # L1 deterministic prompt injection & PII guard
ā”œā”€ā”€ ai-rag/                       # Enterprise Agentic AI & RAG Engine
│   ā”œā”€ā”€ chunking/textSplitter.ts  # LangChain RecursiveCharacterTextSplitter
│   ā”œā”€ā”€ embeddings/
│   │   ā”œā”€ā”€ vectorStore.ts        # VectorStore interface & deterministic embeddings
│   │   └── pgvectorStore.ts      # PostgreSQL pgvector DDL, HNSW index & <=> search
│   ā”œā”€ā”€ evals/ragMetrics.ts       # Faithfulness & Context Relevance evaluators
│   ā”œā”€ā”€ graph/ragAgentGraph.ts    # 5-node LangGraph StateGraph agent workflow
│   └── pipeline/pipeline.ts      # Autonomous Multi-Agent Pipeline (Planner, Generator, Healer)
ā”œā”€ā”€ mobile-selenium/              # Standalone Selenium WebDriver 4 mobile harness
│   └── tests/mobileEcommerce.test.ts
ā”œā”€ā”€ load-tests/
│   └── ecommerce.gatling.ts      # Gatling TypeScript load test (1,000 users / 15s)
ā”œā”€ā”€ tests/
│   ā”œā”€ā”€ ui/ecommerce.spec.ts      # Playwright Desktop Web UI tests
│   ā”œā”€ā”€ api/location.spec.ts      # REST API functional & contract tests
│   ā”œā”€ā”€ security/api-security.spec.ts # OWASP API Top 10 security tests
│   ā”œā”€ā”€ accessibility/accessibility.spec.ts # WCAG 2.2 AA Axe-Core scan
│   ā”œā”€ā”€ ai-guardrails/guardrails.spec.ts    # Prompt injection & guardrail tests
│   └── ai-rag/                   # SDET AI automated test suites
│       ā”œā”€ā”€ chunking.spec.ts
│       ā”œā”€ā”€ embeddings-vectorstore.spec.ts
│       ā”œā”€ā”€ pgvector.spec.ts
│       ā”œā”€ā”€ langgraph-agent.spec.ts
│       └── autonomous-qe-pipeline.spec.ts # Planner, Generator, Healer in-memory tests
ā”œā”€ā”€ package.json
└── playwright.config.ts
```

---

## šŸš€ Quick Start Guide

### 1. Install Dependencies & Browsers
```bash
npm install
npx playwright install --with-deps
```

### 2. Run All Tests
```bash
# Run the complete Autonomous AI suite (37 tests in ~940ms):
npm run test:ai

# Run Web UI tests:
npm run test:ui

# Run Mobile Web emulation tests:
npm run test:mobile

# Run Mobile Selenium WebDriver tests:
npm run test:mobile-selenium

# Run REST API tests:
npm run test:api

# Run Security tests:
npm run test:security

# Run Accessibility WCAG 2.2 AA tests:
npm run test:accessibility
```

### 3. View Rich HTML Reports
```bash
npx monocart show-report test-results/report.html
```

---

## šŸ“– Deep-Dive Architectural Documentation
* **[docs/AI_RAG_LANGGRAPH.md](file:///Users/apple/Downloads/toptal-project-assessment/docs/AI_RAG_LANGGRAPH.md)**: Exhaustive technical guide covering pgvector DDL, HNSW vs IVFFlat indexing, distance operators (`<=>`), 500-page PDF chunking mathematics, LangGraph state machine internals, and senior interview answers.
* **[docs/PLAYWRIGHT_AGENTS.md](file:///Users/apple/Downloads/toptal-project-assessment/docs/PLAYWRIGHT_AGENTS.md)**: Details on the Playwright native agent loop (Planner, Generator, Healer) and human-in-the-loop review architecture.