@raiken/cli
v0.3.19
Published
CLI tool for Raiken - AI-powered Playwright test generator
Maintainers
Readme
Raiken CLI
AI-powered Playwright test generator that integrates directly with your local development environment.
Installation
# Install globally
npm install -g @raiken/cli
# Or use with npx (no installation required)
npx @raiken/cli@latest startQuick Start
- Navigate to your project directory:
cd my-nextjs-app- Initialize Raiken (optional - sets up Playwright config and test directory):
raiken init- Start the Raiken web interface:
raiken startThis will:
- Auto-detect your project type (Next.js, React, Vue, etc.)
- Start a local server at
http://localhost:3460 - Open your browser to the Raiken interface
- Write generated tests directly to your project's test directory
Commands
raiken start
Start the Raiken web interface for the current project.
Options:
-p, --port <port>- Port to run the server on (default: 3460)--no-open- Don't open browser automatically
raiken start --port 4000 --no-openraiken init
Initialize Raiken in the current project. This will:
- Create a test directory (e.g.,
e2e/,tests/) - Set up Playwright configuration
- Add npm scripts for testing
- Create an example test file
Options:
--force- Overwrite existing configuration
raiken init --forceraiken info
Display information about the current project:
raiken infoOutput example:
🎭 Raiken Project Information
Project Name: my-nextjs-app
Project Type: nextjs
Test Directory: e2e
Package Manager: npm
✓ Playwright is configured
Test Command: npm run test:e2eProject Detection
Raiken automatically detects your project type and configures itself accordingly:
| Project Type | Detection | Default Test Dir | Default Port |
|--------------|-----------|------------------|--------------|
| Next.js | next dependency | e2e | 3000 |
| React | react dependency | tests | 3000 |
| Vue | vue dependency | tests | 3000 |
| Svelte | svelte dependency | tests | 5173 |
| Angular | @angular/core | e2e | 4200 |
| Nuxt | nuxt dependency | test | 3000 |
| Vite | vite dependency | tests | 5173 |
| Generic | Fallback | tests | 3000 |
Configuration
Raiken creates a raiken.config.json file in your project root:
{
"projectType": "nextjs",
"testDirectory": "e2e",
"playwrightConfig": "playwright.config.ts",
"outputFormats": ["typescript"],
"ai": {
"provider": "openrouter",
"model": "anthropic/claude-3.5-sonnet"
},
"features": {
"video": true,
"screenshots": true,
"tracing": false,
"network": true
},
"browser": {
"defaultBrowser": "chromium",
"headless": true,
"timeout": 30000,
"retries": 1
}
}Environment Variables
Create a .env.local file in your project root:
# Required for AI test generation
OPENROUTER_API_KEY=your_openrouter_api_key
# Optional: Custom AI model
OPENROUTER_MODEL=anthropic/claude-3.5-sonnetGenerated Files
Raiken creates files directly in your project:
my-project/
├── e2e/ # Test directory
│ ├── example.spec.ts # Example test (created by init)
│ └── homepage.spec.ts # Generated tests
├── playwright.config.ts # Playwright configuration
├── raiken.config.json # Raiken configuration
└── package.json # Updated with test scriptsPackage.json Scripts
Raiken adds these scripts to your package.json:
{
"scripts": {
"raiken": "raiken start",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:debug": "playwright test --debug"
}
}Integration Examples
Next.js Project
cd my-nextjs-app
raiken init # Creates e2e/ directory and config
raiken start # Open web interface
# Generate tests for your Next.js pages
npm run test:e2e # Run generated testsReact App
cd my-react-app
raiken init # Creates tests/ directory
# Raiken auto-detects React and configures accordingly
raiken startExisting Playwright Setup
cd my-app-with-playwright
raiken start # Uses existing configuration
# Raiken integrates with your existing setupFeatures
- 🔍 Project Auto-Detection - Automatically detects your framework and configures appropriately
- 📁 Smart File Placement - Creates tests in the right directory structure for your project
- 🎨 Local File System Integration - Writes tests directly to your project, no cloud storage needed
- 🤖 AI-Powered Generation - Uses advanced AI models to generate high-quality Playwright tests
- 🎭 Playwright Integration - Full Playwright feature support (video, screenshots, tracing)
- 📦 Package Manager Aware - Works with npm, yarn, pnpm, and bun
- 🔧 Zero Configuration - Works out of the box, but fully customizable
Troubleshooting
Port Already in Use
raiken start --port 4000Playwright Not Installed
npm install -D @playwright/test
npx playwright installPermission Errors
Make sure Raiken has write permissions to your project directory:
chmod -R 755 my-project/AI Generation Not Working
- Check your
OPENROUTER_API_KEYin.env.local - Verify internet connection
- Check API key permissions
Development
To contribute to Raiken CLI:
git clone https://github.com/yourusername/raiken.git
cd raiken/cli
npm install
npm run build
npm link # Use local version globallyLicense
MIT - see LICENSE file for details.
