Show HN: I built E2E Test Agent – describe tests in plain English,AI executes it
2 hours ago
1
AI-powered natural language end-to-end testing framework.
e2e-test-agent is an AI-powered testing framework that uses LLM agents to execute natural language test cases. Write tests in plain English and let AI agents interact with your applications to verify behavior.
Instead of writing brittle selector-based tests, you describe what you want to test in natural language, and the AI agent figures out how to do it.
# With tsx (recommended for development)
npx tsx run-tests.ts
# Or compile and run with Node
tsc run-tests.ts
node run-tests.js
Create .test files in your tests/ directory:
Example: tests/1.test
open playwright.dev
scroll all the way down,
click on "Get started",
check if the page side menu is visible.
Example: tests/2.test
navigate to github.com
search for "typescript"
click on the first repository
verify the repository has a README file
import{TestAgent}from"e2e-test-agent";consttestAgent=newTestAgent({modelName: "gpt-4o",apiKey: process.env.API_KEY!,baseURL: process.env.BASE_URL,testsDir: "./tests",maxSteps: 20,});// Run all testsconstresults=awaittestAgent.runAllTests();testAgent.printSummary(results);// Or run a specific testconstresult=awaittestAgent.runSingleTest("./tests/1.test",1);
Variable
Description
Default
MODEL_NAME
LLM model to use
gpt-4o
API_KEY
OpenAI API key
Required
BASE_URL
API base URL
OpenAI default
TESTS_DIR
Directory containing test files
./tests
consttestAgent=newTestAgent({apiKey: "...",mcpServers: {playwright: {command: "npx",args: ["@playwright/mcp@latest"]},filesystem: {command: "npx",args: ["@modelcontextprotocol/server-filesystem"],},// Add more MCP servers as needed},});
Test Agent provides detailed results for each test:
============================================================
Running Test #1: 1.test
============================================================
Test Content:
open playwright.dev
scroll all the way down,
click on "Get started",
check if the page side menu is visible.
Result: {
"success": true,
"steps_completed": [
"Opened playwright.dev",
"Scrolled to bottom",
"Clicked Get started button",
"Verified sidebar visibility"
],
"observations": "All steps completed successfully",
"final_status": "passed"
}
============================================================
TEST SUMMARY
============================================================
✅ PASSED - Test #1: 1.test
Total: 1 | Passed: 1 | Failed: 0
Contributions are welcome! This framework can be extended with:
More MCP servers (database access, API testing, etc.)