Basic Usage
The Keystone CLI uses the following syntax for all commands:keystone-runner <command> [options]
Image: CLI command structure would go here
Commands
start
Start the Keystone test runner WebSocket server with various configuration options.
Image: Start command interface would go here
Options
| Option | Alias | Description | Default |
|---|---|---|---|
--port | -p | WebSocket server port | 9223 |
--headless | Run browser in headless mode | false | |
--debug | Enable verbose debug logging | false | |
--proxy | Enable proxy mode for cloud Studio | false | |
--api-key | API key for authentication | - | |
--backend-url | Backend URL | https://api.withkeystone.com | |
--base-url | Base URL for relative navigation | - | |
--chrome-path | Path to Chrome executable | Auto-detected | |
--chrome-args | Additional Chrome arguments | - |
Examples
Local Development: Start with default settings, custom port and debug mode, or with base URL for relative navigation. CI/CD Mode: Run in headless mode with API keys and environment-specific URLs for continuous integration. Proxy Mode: Connect to cloud Studio using API key and backend URL for remote testing. Custom Chrome: Specify custom Chrome executable path and additional browser arguments. Image: Command examples visualization would go herecheck-chrome
Verify Chrome installation and compatibility. This command checks for Chrome location, version compatibility, and executable permissions.
Image: Chrome check output example would go here
version
Display the installed Keystone version using either version command or --version flag.
Image: Version command output would go here
help
Display help information for all commands or specific command details.
Image: Help command output would go here
Environment Variables
Environment variables can be used instead of CLI options:| Variable | CLI Option | Description |
|---|---|---|
KEYSTONE_API_KEY | --api-key | API key for authentication |
KEYSTONE_API_URL | --backend-url | Backend API URL |
RUNNER_API_KEY | - | Runner-specific API key |
CHROME_PATH | --chrome-path | Chrome executable path |
PORT | --port | WebSocket server port |
BASE_URL | --base-url | Base URL for tests |
HEADLESS | --headless | Run in headless mode |
DEBUG | --debug | Enable debug logging |
Configuration File
Createkeystone.config.js in your project root to define default settings for server, browser, test execution, API connections, and recording options.
Image: Configuration file structure would go here
Configuration sections include:
- Server: Port and host settings
- Browser: Headless mode, Chrome path, and browser arguments
- Test: Base URL, timeouts, retries, and viewport dimensions
- API: Authentication keys and endpoint URLs
- Recording: Screenshot, video, network, and console capture settings
Advanced Usage
Custom Chrome Arguments
Pass multiple Chrome arguments:--no-sandbox- Disable sandbox (required in Docker)--disable-setuid-sandbox- Disable setuid sandbox--disable-gpu- Disable GPU hardware acceleration--disable-dev-shm-usage- Overcome limited resource problems--disable-web-security- Disable same-origin policy (testing only)--window-size=width,height- Set initial window size--user-data-dir=/path- Use specific Chrome profile
Debug Mode
Enable detailed logging:- WebSocket message flow
- Step execution details
- Browser events
- Network requests
- Error stack traces
Proxy Mode Details
Proxy mode allows cloud Studio to connect to your local runner:- Connect to Keystone backend via WebSocket
- Authenticate using your API key
- Forward messages between Studio and local browser
- Handle file provisioning and environment setup
Health Check Endpoint
The runner exposes a health check endpoint:Exit Codes
The CLI uses standard exit codes:| Code | Description |
|---|---|
0 | Success |
1 | General error |
2 | Chrome not found |
3 | Port already in use |
4 | Authentication failed |
5 | Configuration error |
Logging
Log Levels
Control log verbosity:Log Format
Logs use structured format:Log Files
Save logs to file:Tips and Best Practices
-
Use Configuration Files: For complex setups, use
keystone.config.jsinstead of many CLI flags - Environment-Specific Settings: Use environment variables for sensitive data and environment-specific values
- Debug Strategically: Enable debug mode only when troubleshooting to avoid log noise
-
Port Management: Use dynamic ports in CI to avoid conflicts:
-
Graceful Shutdown: The runner handles SIGINT and SIGTERM for clean shutdown:

