How mukeshbhol325/playwright-rag-ai-self-healing works
This repository combines a Playwright framework for OpenCart flows with a FastAPI locator-healing service. Page objects use keyed selectors; when an interaction fails, HealingPage requests candidates, validates them in the live page, retries, and sends feedback. After test runs, the reporter submits failures for triage. The service combines learned repairs, DOM heuristics, retrieval, and optional LLM reranking. The README documents the cross-service workflow; source excerpts and the SOURCE INDEX support the internal links shown. Other unsampled implementation details are omitted where their relationships are not established.
Main entry points: container.py Service container · HealingPage.ts HealingPage · main.py FastAPI app · rag_healer.py RAG healer
Components 22
Playwright Framework
- OpenCart page objects
tests-ts/src/pages/BasePage.ts - HealingPage
tests-ts/src/healing/HealingPage.ts - Locator registry
tests-ts/src/healing/LocatorRegistry.ts - Candidate validator
tests-ts/src/healing/LocatorValidator.ts - DOM snapshot
tests-ts/src/utils/domSnapshot.ts - Healer REST client
tests-ts/src/api/HealerClient.ts - Healing reporter
tests-ts/src/reporters/healingReporter.ts
Healer API
- FastAPI app
healer-service/app/main.py - Heal endpoint
healer-service/app/api/heal.py - Feedback endpoint
healer-service/app/api/feedback.py - Failure endpoint
healer-service/app/api/failures.py - Health endpoint
healer-service/app/api/health.py - Service container
healer-service/app/core/container.py
Healing Engine
- RAG healer
healer-service/app/services/rag_healer.py - DOM heuristics
healer-service/app/services/heuristic_healer.py
Knowledge and Analysis
- Chroma knowledge base
healer-service/app/rag/vector_store.py - Failure analyzer
healer-service/app/services/failure_analyzer.py - RAG prompts
healer-service/app/rag/prompts.py
Model Providers
- LLM provider factory
healer-service/app/llm/factory.py
Other components
- Playwright test run
- OpenCart demo
- LLM provider
healer-service/app/llm/base.py
Connections 30
- Playwright test run → OpenCart page objects: runs flows
- OpenCart page objects → HealingPage: uses interactions
tests-ts/src/pages/BasePage.ts - OpenCart page objects → OpenCart demo: drives browser
- HealingPage → Locator registry: resolves selectors
tests-ts/src/healing/HealingPage.ts - HealingPage → DOM snapshot: captures DOM
tests-ts/src/healing/HealingPage.ts - HealingPage → Candidate validator: validates candidates
tests-ts/src/healing/HealingPage.ts - HealingPage → Healer REST client: requests healing
tests-ts/src/healing/HealingPage.ts - Healer REST client → FastAPI app: REST requests
- HealingPage → OpenCart demo: retries actions
- Healing reporter → Healer REST client: reports failures
tests-ts/src/reporters/healingReporter.ts - FastAPI app → Heal endpoint: registers route
healer-service/app/main.py - FastAPI app → Feedback endpoint: registers route
healer-service/app/main.py - FastAPI app → Failure endpoint: registers route
healer-service/app/main.py - FastAPI app → Health endpoint: registers route
healer-service/app/main.py - Heal endpoint → Service container: gets services
healer-service/app/api/heal.py - Feedback endpoint → Service container: gets services
healer-service/app/api/feedback.py - Failure endpoint → Service container: gets services
healer-service/app/api/failures.py - Health endpoint → Service container: gets services
healer-service/app/api/health.py - Service container → RAG healer: builds healer
healer-service/app/core/container.py - Service container → Failure analyzer: builds analyzer
healer-service/app/core/container.py - Service container → Chroma knowledge base: builds knowledge base
healer-service/app/core/container.py - Service container → LLM provider factory: selects provider
healer-service/app/core/container.py - RAG healer → Chroma knowledge base: looks up repairs
healer-service/app/services/rag_healer.py - RAG healer → DOM heuristics: scores DOM
healer-service/app/services/rag_healer.py - RAG healer → RAG prompts: builds rerank prompt
healer-service/app/services/rag_healer.py - RAG healer → LLM provider: reranks candidates
healer-service/app/services/rag_healer.py - Failure analyzer → Chroma knowledge base: retrieves cases
healer-service/app/services/failure_analyzer.py - Failure analyzer → RAG prompts: uses analysis prompt
healer-service/app/services/failure_analyzer.py - Failure analyzer → LLM provider: requests analysis
healer-service/app/services/failure_analyzer.py - LLM provider factory → LLM provider: creates provider
healer-service/app/llm/factory.py