Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web-Based QA Agent

AI-assisted workflow for exploring websites, designing tests, generating Playwright code, and running tests from a Streamlit chat UI.

Features

  • Explore: Playwright crawls the target URL, parses DOM with BeautifulSoup, and gathers interactive elements plus inferred flows (login, contact, cart, etc.).
  • Plan: LLM proposes structured JSON test plans from exploration data.
  • Refine plan: Natural-language edits (add/remove/change tests) before code generation.
  • Generate code: Single-file Python tests using Playwright + pytest + expect().
  • Run: Executes generated scripts with streamed stdout; saves logs and optional recordings under evidence/.
  • Observability: Sidebar shows estimated tokens, call counts, last latency, and phase durations.

Tech stack

Python, Streamlit, Playwright, LangChain (Groq / Ollama / Gemini), BeautifulSoup, pandas, pytest.

Prerequisites

  • Python 3.10+ recommended
  • Playwright Chromium installed

Setup

cd gen-ai
python -m venv .venv
.venv\Scripts\activate          # Windows
# source .venv/bin/activate       # macOS / Linux

pip install -r requirements.txt
playwright install chromium

Create a .env file (same folder as app.py):

# Provider: google | ollama | groq
LLM_PROVIDER=google

# Google Gemini
GOOGLE_API_KEY=your_key
GEMINI_MODEL=gemini-2.0-flash

# Ollama (local)
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=deepseek-coder

# Groq
GROQ_API_KEY=your_key
GROQ_MODEL=llama-3.3-70b-versatile

Run

streamlit run app.py

Set Target URL in the sidebar, then use the chat, for example:

  1. Explore
  2. Plan
  3. Optional: Add a test for … / Remove TC…
  4. Generate Code
  5. Run
  6. On failure: Fix Errors or describe changes (Change locator …)

Project layout

gen-ai/
├── app.py                 # Streamlit UI and command routing
├── modules/
│   ├── explorer.py       # Site crawl + element extraction
│   ├── generator.py      # Plan/code generation + refine/update
│   ├── verifier.py       # Run script, stream logs, evidence
│   └── llm.py            # LLM wrapper + setup_llm()
├── evidence/             # Logs / recordings (created at runtime)
├── requirements.txt
└── README.md

Notes

  • Free-tier LLMs: Configure Gemini free tier, Groq free tier, or local Ollama per course constraints.
  • Generated tests open a visible browser by default (headless=False); verifier patches code when needed.
  • For large sites, exploration truncates elements per page (see explorer.py).

License

Academic / course use unless otherwise specified.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages