raiken
v0.5.1
Published
AI-powered E2E test generation, execution, and repair CLI
Maintainers
Readme
Raiken
AI-powered E2E test generation, execution, and repair.
Raiken is a developer-centric CLI tool that uses AI to automatically generate, run, and fix Playwright end-to-end tests. It understands your codebase through semantic analysis and generates tests with accurate selectors from your live application.
Features
- Natural Language Test Generation — Describe what you want to test, get working Playwright code
- Smart Codebase Understanding — AST parsing + embeddings understand your app structure
- Live DOM Capture — Captures real page elements for accurate, stable selectors
- Visual Dashboard — Modern UI for generating, viewing, and managing tests
- Self-Monitoring Tests — Automatically detects stale tests and suggests repairs
Installation
npm install -g raikenRequires Node.js 18+
Quick Start
1. Initialize in your project
cd your-project
raiken initThis creates a raiken.config.json and sets up the test directory.
2. Set your API key
Raiken uses OpenRouter to access AI models (Claude, GPT-4, etc.).
export OPENROUTER_API_KEY=your_api_key_hereOr add it to a .env file in your project root:
OPENROUTER_API_KEY=sk-or-v1-your-key-hereGet a free API key at openrouter.ai/keys
3. Start the dashboard
raiken startOpen http://localhost:7101 in your browser.
4. Generate your first test
In the dashboard chat, describe what you want to test:
"Test the login flow at localhost:3000 - enter email and password, click submit, verify redirect to dashboard"
Raiken will:
- Analyze your codebase for context
- Capture the live DOM from your running app
- Generate a Playwright test with real selectors
- Save it to your test directory
Commands
| Command | Description |
|---------|-------------|
| raiken init | Initialize Raiken in your project |
| raiken start | Start the server and dashboard on port 7101 |
| raiken start -p 8080 | Start on a custom port |
Configuration
Create raiken.config.json in your project root:
{
"testDirectory": "e2e",
"baseUrl": "http://localhost:3000",
"ai": {
"model": "anthropic/claude-sonnet-4.5"
}
}Configuration Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| testDirectory | string | "e2e" | Where to save generated tests |
| baseUrl | string | "http://localhost:3000" | Your app's development URL |
| ai.model | string | "anthropic/claude-sonnet-4.5" | OpenRouter model to use |
Supported AI Models
Any model available on OpenRouter, including:
anthropic/claude-sonnet-4.5(recommended)anthropic/claude-opus-4openai/gpt-4ogoogle/gemini-2.0-flashmeta-llama/llama-3.3-70b
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| OPENROUTER_API_KEY | Yes | Your OpenRouter API key |
| OPENROUTER_MODEL | No | Override the AI model |
| OPENROUTER_BASE_URL | No | Custom API endpoint |
How It Works
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Your Codebase │────▶│ Raiken Analyzer │────▶│ Code Graph DB │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
┌─────────────────┐ ┌──────────────────┐ │
│ Your Running │────▶│ DOM Capture │ │
│ Application │ │ (Playwright) │ │
└─────────────────┘ └──────────────────┘ │
│ │
▼ ▼
┌──────────────────────────────────┐
│ AI Test Generator │
│ (Claude/GPT-4 via OpenRouter) │
└──────────────────────────────────┘
│
▼
┌──────────────────────────────────┐
│ Generated Playwright Test │
│ saved to e2e/ │
└──────────────────────────────────┘Codebase Analysis — Raiken parses your source files, extracts functions, components, and routes, then creates embeddings for semantic search.
DOM Capture — When you describe a test, Raiken launches a headless browser, navigates to your app, and captures all interactive elements with their selectors.
Context Assembly — Relevant code snippets + live DOM elements are assembled into a rich context for the AI.
Test Generation — The AI generates a Playwright test using real selectors from your application.
Test Execution — Run generated tests with Playwright:
npx playwright test
Project Structure
After initialization, Raiken creates:
your-project/
├── raiken.config.json # Configuration
├── .raiken/
│ └── raiken.db # Local SQLite database (code graph, embeddings)
└── e2e/ # Generated tests (configurable)
└── login.spec.tsRunning Generated Tests
Raiken generates standard Playwright tests. Run them with:
# Run all tests
npx playwright test
# Run specific test
npx playwright test e2e/login.spec.ts
# Run with UI
npx playwright test --uiIf you don't have Playwright installed:
npm init playwright@latestTroubleshooting
"OPENROUTER_API_KEY not configured"
Set your API key:
export OPENROUTER_API_KEY=sk-or-v1-xxxxxOr add it to .env in your project root:
OPENROUTER_API_KEY=sk-or-v1-xxxxxDashboard not loading
Make sure port 7101 is available, or use a different port:
raiken start -p 8080DOM capture fails
Ensure your application is running at the URL you specify in your test prompt (e.g., "test login at localhost:3000").
License
MIT © Raiken Foundation
