How vijayarjun7/ai-qe-agent works
1. What this repository is
- This is a TypeScript-based AI quality engineering pipeline, not an application under test.
- Its main job is to generate, review, run, and heal Playwright test assets using Claude, plus optionally generate a demo app to test against.
2. Top-level execution boundary
- The entry point is the CLI in src/cli/index.ts.
- The CLI dispatches into the orchestration layer in src/orchestrator/QEPipeline.ts, which sequences the multi-step QE workflow.
- Most features are exposed as commands that operate on files and test artifacts rather than serving a runtime API.
3. AI agent subsystem
- src/agent/ contains the core functional units:
- AIDevAgent generates the demo app.
- ManualTestGenerator produces structured manual test suites from requirements.
- QAReviewAgent reviews manual tests and automation outputs.
- AutomationScriptGenerator creates Playwright UI/API/mobile specs.
- AIMobileTester expands coverage across device profiles and scenarios.
- SelfHealingAgent repairs broken selectors from DOM analysis.
- ChangeDetector watches for file changes and classifies them.
- ReviewQueueManager writes review tickets for requirement changes.
- ReportGenerator summarizes execution into reports.
- AITestGenerator, APITester, and PageAnalyzer support URL/page-driven generation flows.
4. AI and browser integration points
- src/utils/ClaudeClient.ts is the single external AI boundary for Anthropic Claude calls.
- Playwright is the browser/runtime boundary for page analysis, UI automation, mobile emulation, and report generation.
- The repo therefore has two major external dependencies: Claude for reasoning/generation and Playwright for execution/inspection.
5. Primary data flow through the pipeline
- Requirements or page state are ingested first.
- Manual tests are generated into structured JSON/Markdown artifacts.
- QA review consumes the manual test suite, scores it, and flags or approves cases.
- Approved test cases are turned into automation scripts.
- Those scripts are executed by Playwright, then summarized into reports.
- This is a file-driven pipeline: each stage writes artifacts that become input to the next stage.
6. Change management and self-healing path
- ChangeDetector watches the generated demo app and classifies changes as locator, requirement, logic, style, or unknown.
- Locator changes go to SelfHealingAgent, which rewrites affected test files using DOM evidence.
- Requirement changes go to ReviewQueueManager, which creates human-review tickets under tests/review-queue/.
- This creates a clear split between safe auto-repair and changes that require manual approval.
7. Generated-demo-app boundary
- The repository includes a generated target application under demo-app/, separated from the QE engine itself.
- The demo app is a full-stack Task Manager with a React/Vite frontend and an Express/SQLite/JWT backend, running on separate ports.
- The QE pipeline uses this app as the canonical target for generation, review, automation, and healing demos.
8. Test artifact layout
- tests/examples/ contains hand-authored reference specs.
- tests/generated/ is the output target for AI-generated Playwright scripts.
- tests/manual/ stores generated manual test suite JSON/MD artifacts.
- tests/reviews/ stores review reports.
- samples/ mirrors real pipeline outputs for documentation and validation.
- These directories define the repo’s artifact contract and make the workflow easy to diagram.
9. Reporting and observability
- Playwright outputs are collected into reports/ as HTML, JSON, and JUnit XML.
- src/utils/Logger.ts provides structured logging for the pipeline stages.
- Reporting is a terminal stage, but it is also used as a feedback loop for failures, screenshots, and videos.
10. Configuration and runtime
- The repo runs as a Node.js/TypeScript project with tsconfig.json and package.json as the main build/runtime descriptors.
- Environment variables control model selection, base URLs, and output directories, especially ANTHROPIC_API_KEY, BASE_URL, API_BASE_URL, and GENERATED_TESTS_DIR.
- playwright.config.ts defines the multi-project execution matrix for desktop, mobile, and API-oriented runs.
11. Important architectural pattern
- The system is strongly decoupled by artifact boundaries: each agent reads and writes files rather than sharing hidden in-memory state.
- That makes the pipeline reproducible, inspectable, and easy to restart at any stage.
- It also means the repo’s architecture diagram should emphasize file inputs/outputs between stages more than service-to-service calls.
12. Legacy/compatibility code
- The nested src/core/src/core/ path suggests an older or compatibility layer that mirrors some core functionality such as APITester and PageAnalyzer.
- For an architecture diagram, treat this as supporting code rather than the primary flow unless you need to show legacy/internal reuse paths.
13. Best way to draw the system
- Show the CLI as the entry point.
- Show Claude and Playwright as two external engines underneath the agent layer.
- Show a left-to-right pipeline: requirements/demo-app input → manual tests → QA review → automation generation → execution/reporting.
- Add a side loop for change detection and self-healing, with a separate branch to the review queue for requirement deltas.
Main entry points: QEPipeline.ts QE Pipeline · PageAnalyzer.ts Page Analyzer · AutomationScriptGenerator.ts Automation · ClaudeClient.ts Claude
Components 23
Entry
CLI entry and orchestration boundary
- CLI · Command-line entry that dispatches QE workflows
src/cli/index.ts - QE Pipeline · Sequences the end-to-end quality engineering workflow
src/orchestrator/QEPipeline.ts
Agents
Core AI and pipeline workers
- Dev Agent · Generates the demo target application used by the QE pipeline
src/agent/AIDevAgent.ts - Manual Tests · Creates structured manual test suites from requirements
src/agent/ManualTestGenerator.ts - QA Review · Scores and approves manual tests and automation outputs
src/agent/QAReviewAgent.ts - Automation · Produces Playwright UI, API, and mobile specs
src/agent/AutomationScriptGenerator.ts - Mobile Tests · Expands coverage across device profiles and scenarios
src/agent/AIMobileTester.ts - API Tester · URL- and endpoint-driven API test generation flow
src/agent/APITester.ts - Page Analyzer · Inspects page state to support generation and healing
src/agent/PageAnalyzer.ts - Test Generator · Support flow for generating tests from page or URL context
src/agent/AITestGenerator.ts - Self Heal · Repairs broken selectors from DOM evidence
src/agent/SelfHealingAgent.ts - Change Detector · Classifies file changes as locator, requirement, logic, style, or unknown
src/agent/ChangeDetector.ts - Review Queue · Routes requirement changes into human-review artifacts
src/agent/ReviewQueueManager.ts - Reports · Summarizes execution into HTML, JSON, and JUnit outputs
src/agent/ReportGenerator.ts
Engines
External reasoning and browser runtimes
- Claude · Single Anthropic Claude integration used by generation and review agents
src/utils/ClaudeClient.ts - Playwright · Execution and inspection runtime for UI, mobile, and API-oriented runs
playwright.config.ts
Artifacts
File-driven outputs and samples
- Sample Manual · Reference manual test suite artifacts
samples/manual-tests/sample-manual-test-suite.json - Sample Auto · Reference generated Playwright artifacts
samples/generated-tests/automation-bundle.json - Sample Reviews · Reference QA review reports
samples/qa-reviews/sample-qa-review-report.json
Support
Shared utilities and compatibility code
- Logger · Structured logging for pipeline stages and failures
src/utils/Logger.ts - Files · File and artifact IO helpers
src/utils/FileUtils.ts - Core API · Compatibility copy of API tester logic
src/core/src/core/APITester.ts - Core Page · Compatibility copy of page analyzer logic
src/core/src/core/PageAnalyzer.ts
Connections 34
- CLI → QE Pipeline: dispatches · CLI hands execution to the orchestration layer
- QE Pipeline → Dev Agent: demo app · Can generate the target application used for validation
- QE Pipeline → Manual Tests: requirements · Starts manual test generation from requirements or context
- Manual Tests → Claude: prompting · Uses Claude to synthesize structured test cases
- Manual Tests → Sample Manual: writes · Emits manual test suite artifacts
- QE Pipeline → QA Review: review · Passes generated manual tests into QA review
- QA Review → Claude: scoring · Uses Claude to review and score test quality
- QA Review → Sample Reviews: writes · Produces review reports as artifacts
- QE Pipeline → Automation: automation · Converts approved tests into Playwright specs
- Automation → Claude: generation · Uses Claude to draft automation scripts
- Automation → Playwright: targets · Produces specs aligned to the Playwright execution matrix
- Automation → Sample Auto: writes · Emits generated automation bundles and specs
- QE Pipeline → Mobile Tests: mobile coverage · Expands coverage across mobile scenarios and profiles
- Mobile Tests → Playwright: executes · Relies on Playwright mobile projects and emulation
- QE Pipeline → API Tester: api flow · Supports endpoint-driven API generation and execution
- API Tester → Playwright: executes · Uses Playwright as the test runtime boundary
- QE Pipeline → Page Analyzer: inspect · Analyzes page state for generation and repair
- Page Analyzer → Playwright: inspects · Reads DOM and browser state through Playwright
- QE Pipeline → Test Generator: assist · Helper path for page or URL driven generation
- Test Generator → Claude: generation · Uses Claude for structured test synthesis
- Test Generator → Page Analyzer: context · Combines URL/page analysis with generation
- QE Pipeline → Change Detector: watch · Monitors generated demo app and artifact changes
- Change Detector → Self Heal: locator drift · Routes locator changes to automated repair
- Self Heal → Page Analyzer: dom evidence · Uses page analysis evidence to rewrite selectors
- Self Heal → Files: rewrites · Updates affected test files on disk
- Change Detector → Review Queue: requirements drift · Routes requirement changes to human review
- Review Queue → Files: writes queue · Creates review artifacts for manual approval
- QE Pipeline → Reports: summarize · Collects execution results into terminal reports
- Reports → Logger: records · Uses structured logs as reporting input
- Reports → Files: writes · Persists HTML, JSON, and JUnit outputs
- QE Pipeline → Logger: logs · Pipeline stages emit structured execution logs
- QE Pipeline → Files: artifacts · Coordinates file-based handoffs between stages
- Core API → API Tester: legacy copy · Supports the main API testing flow
- Core Page → Page Analyzer: legacy copy · Supports the main page analysis flow