karthikraj22302

AI Test Agent Playwright — Testing skill for Claude Code

Testing community

I layer on Playwright (JavaScript): a Writer Agent that writes tests from plain English and a Healer Agent that fixes broken locators.

How to install AI Test Agent Playwright

This entry records only its repository, not the path inside it, so there is no exact command to give. Open karthikraj22302/AI-Test-Agent-Playwright and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What AI Test Agent Playwright does

I layer on Playwright (JavaScript): a Writer Agent that writes tests from plain English and a Healer Agent that fixes broken locators. Positive and negative cases. Works with Groq, OpenRouter, Ollama or Claude.

Alternatives in Testing

  • Jsbeeb — by mattgodbolt - Provides development guide for JavaScript BBC Micro emulator with build and testing instructi 382 ★
  • GAAI Framework — 95+ Drop-in governance layer (.gaai/ folder) -- backlog authorization, cross-session memory, decision tracking 113 ★
  • Asktube — AskTube - An AI-powered YouTube video summarizer and QA assistant powered by Retrieval Augmented Generation (R 87 ★

README

GEN AI AGENT for Playwright (Writer Agent + Healer Agent)

An AI layer on top of Playwright (JavaScript) that **reads a web page, writes the test script for you, and automatically repairs broken locators**. Positive and negative test cases are both supported. Free LLMs (Groq, OpenRouter, Ollama) work, and Claude/OpenAI are optional.


1. What this project does

Agent Job
Writer agent You give a one-line instruction. It opens the page, reads the elements, makes a plan, performs the steps, verifies the result, and saves a normal Playwright spec in tests/generated/.
Healer agent When a locator breaks (a button is renamed, an id changes), it finds the new element and continues the test, instead of failing.

Both agents live in one folder: `ai-agent/`.


2. Technology used

Item Details
Language JavaScript (Node.js, CommonJS modules)
Test framework Playwright Test (@playwright/test)
Runtime Node.js 18 or higher (built with Node 22)
LLM access Plain HTTP calls with Node fetch; no extra AI libraries
LLM providers Groq, OpenRouter, Ollama (free); Anthropic Claude, OpenAI (optional)
Editor VS Code
OS Ubuntu / Linux (also works on Windows and macOS)

3. Methods and techniques used

**Writer agent pipeline**

  1. Observe: take a snapshot of the page DOM. Each visible element gets a temporary data-ai-id.
  2. Plan: the LLM returns a JSON list of steps. If no LLM is available, an offline rule-based planner (heuristic-plan.js) builds the plan.
  3. Resolve: each element id is converted to a stable locator (role, label, placeholder, text, id, name).
  4. Execute: the steps run with the healer active.
  5. Verify: it reads the page for the success text (positive test) or for rejection evidence (negative test).
  6. Emit: it writes a plain Playwright spec to tests/generated/ that runs later with no AI.
  7. Cache: the plan is saved in `ai-ag