AI-powered E2E test generation, execution, and repair CLI
npm install raikenAI-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.


---
- 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
---
``bash`
npm install -g raiken
Requires Node.js 18+
---
`bash`
cd your-project
raiken init
This creates a raiken.config.json and sets up the test directory.
Raiken uses OpenRouter to access AI models (Claude, GPT-4, etc.).
`bash`
export OPENROUTER_API_KEY=your_api_key_here
Or add it to a .env file in your project root:
``
OPENROUTER_API_KEY=sk-or-v1-your-key-here
Get a free API key at openrouter.ai/keys
`bash`
raiken start
Open http://localhost:7101 in your browser.
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:
1. Analyze your codebase for context
2. Capture the live DOM from your running app
3. Generate a Playwright test with real selectors
4. Save it to your test directory
---
| 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 |
---
Create raiken.config.json in your project root:
`json`
{
"testDirectory": "e2e",
"baseUrl": "http://localhost:3000",
"ai": {
"model": "anthropic/claude-sonnet-4.5"
}
}
| 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 |
Any model available on OpenRouter, including:
- anthropic/claude-sonnet-4.5 (recommended)anthropic/claude-opus-4
- openai/gpt-4o
- google/gemini-2.0-flash
- meta-llama/llama-3.3-70b
-
---
| 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 |
---
``
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ 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/ │
└──────────────────────────────────┘
1. Codebase Analysis — Raiken parses your source files, extracts functions, components, and routes, then creates embeddings for semantic search.
2. DOM Capture — When you describe a test, Raiken launches a headless browser, navigates to your app, and captures all interactive elements with their selectors.
3. Context Assembly — Relevant code snippets + live DOM elements are assembled into a rich context for the AI.
4. Test Generation — The AI generates a Playwright test using real selectors from your application.
5. Test Execution — Run generated tests with Playwright:
`bash`
npx playwright test
---
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.ts
---
Raiken generates standard Playwright tests. Run them with:
`bashRun all tests
npx playwright test
If you don't have Playwright installed:
`bash
npm init playwright@latest
`---
Troubleshooting
$3
Set your API key:
`bash
export OPENROUTER_API_KEY=sk-or-v1-xxxxx
`Or add it to
.env in your project root:
`
OPENROUTER_API_KEY=sk-or-v1-xxxxx
`$3
Make sure port 7101 is available, or use a different port:
`bash
raiken start -p 8080
``Ensure your application is running at the URL you specify in your test prompt (e.g., "test login at localhost:3000").
---
MIT © Raiken Foundation
---