An AI-powered test automation agent built with LangGraph, Playwright, and Google Gemini 1.5 Flash.
Give it a URL and a plain-English goal. It plans the steps, drives a real browser, observes what it finds, and generates a ready-to-run pytest file — autonomously. Completely free to run.
- Unzip the
AI-Test-Agentfolder - Double-click
AI-Test-Agent.exe - Paste your free Gemini API key (get one free at aistudio.google.com — no credit card)
- Hit Run Agent — the pre-filled SauceDemo login example works immediately
The browser window is shown by default so you can watch the agent work in real time.
User: "Test the login flow with valid and invalid credentials"
↓
┌───────────────────────────────────────────┐
│ LangGraph StateGraph │
│ │
│ plan ──► execute ──► execute ──► ... │
│ ↑ │ │
│ └───────────┘ │
│ ↓ │
│ generate │
└───────────────────────────────────────────┘
↓
test_login.py (complete pytest + Playwright file)
| Node | What it does |
|---|---|
| plan | Gemini breaks the goal into 4–6 ordered test steps |
| execute | Gemini reads the page, picks a browser action, Playwright runs it |
| generate | Gemini writes a complete pytest + Playwright test file from observations |
| Tool | Purpose |
|---|---|
| LangGraph | Stateful multi-step agent graph |
| LangChain | LLM abstraction layer |
| Gemini 1.5 Flash | Free AI reasoning (15 req/min, no credit card) |
| Playwright | Real browser automation |
| pytest | Generated test runner |
| CustomTkinter | Modern dark-mode GUI |
| PyInstaller | Windows EXE packaging |
- Go to aistudio.google.com
- Sign in with a Google account
- Click Get API Key → Create API Key
- Copy and paste it into the app
Free tier: 15 requests/minute, 1 million tokens/day. More than enough.
# 1. Clone the repo
git clone https://github.com/YOUR_USERNAME/ai-test-agent.git
cd ai-test-agent
# 2. Create a virtual environment
python -m venv venv
venv\Scripts\activate
# 3. Run the build script
build.batpip install -r requirements.txt
playwright install chromium
python main.pyThe app auto-reads GEMINI_API_KEY from your environment so you never have to paste it manually:
# Run once in PowerShell as admin
[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "your-key-here", "Machine")ai-test-agent/
├── main.py # CustomTkinter GUI and entry point
├── agent.py # LangGraph graph: plan → execute → generate
├── browser.py # Playwright wrapper (the agent's hands)
├── requirements.txt
├── build.bat # One-click Windows EXE builder
├── .gitignore # Keeps secrets and build output off GitHub
└── README.md
Generated pytest files are compatible with the test-automation framework.