@labnex/cli
v1.4.0
Published
CLI for Labnex, an AI-Powered Testing Automation Platform
Maintainers
Readme
Labnex CLI
AI-Powered Testing Automation Platform Command Line Interface
Installation
# Install globally
npm install -g @labnex/cli
# Or use npx
npx @labnex/cli --helpAuthentication
Before using the CLI, you need to authenticate:
# Configure your API settings
labnex config set
# Log in with your credentials
labnex auth loginCommands
Running Tests
# Run all tests for a project
labnex run --project-id <PROJECT_ID>
# Run a specific test case
labnex run --project-id <PROJECT_ID> --test-id <TEST_ID>
# Run with AI optimization (recommended)
labnex run --project-id <PROJECT_ID> --optimize-ai
# Run in headless mode
labnex run --project-id <PROJECT_ID> --headless
# Run with verbose logging
labnex run --project-id <PROJECT_ID> --verboseManaging Projects
# List all projects
labnex list --projects
# List test cases for a project
labnex list --tests <PROJECT_ID>
# Create a new project
labnex projects create --name "My Project" --code PROJECT1 --description "Description"
# List all projects with details
labnex projects listLinting & Importing
# Static-analysis of raw step files
labnex lint-tests ./tests --json
# Convert raw steps into a Test Case
labnex create-test-case --project-id <PROJECT_ID> --file checkout.txtAI Features
# Generate a test case with AI
labnex ai generate --description "Test the login functionality with valid credentials"
# Optimize test selection with AI
labnex ai optimize --project <PROJECT_CODE>Analysis
# Analyze test failure
labnex analyze failure --run-id <RUN_ID>
# Check overall status
labnex status
# Check specific test run
labnex status --run-id <RUN_ID>Options
Global Options
| Option | Description |
|--------|-------------|
| --verbose | Enable detailed logging |
| --api-url <url> | Override API URL |
Run Command Options
| Option | Description | Default |
|--------|-------------|---------|
| -p, --project-id <id> | Project ID (required) | - |
| -t, --test-id <id> | Run specific test case by ID | - |
| -e, --environment <env> | Environment (staging/production) | staging |
| -m, --mode <mode> | Execution mode (local/cloud) | cloud |
| --optimize-ai | Enable AI optimization for element finding | false |
| --parallel <number> | Number of parallel workers (cloud mode) | 4 |
| --headless | Run in headless mode (local mode) | false |
| --timeout <ms> | Test timeout in milliseconds | 300000 |
| --base-url <url> | Base URL for relative navigation | - |
| --username <user> | Supply login username | - |
| --password <pass> | Supply login password | - |
Performance Features
- AI Element Optimization: Enables intelligent element finding and reduces flakiness
- Iframe Handling: Optimized iframe switching for complex web applications
- Smart Waits: Dynamic wait times based on element visibility
- Detailed Reporting: Step-by-step execution reports with timing
Changelog
Version 1.4.0 (Current)
- Cloud execution mode enabled by default (
--mode cloud) - Added
lint-testsandcreate-test-casecommands - New flags:
--base-url,--username,--password - Updated docs & examples across website and npm package
Status of Features
Working Features
- Core CLI commands and help system
- Project and test case listing
- Test execution with AI optimization
- Basic login flow testing on standard websites
- Status reporting and detailed logging
Recently Added
- Cloud execution mode (default) with live progress streaming
- Static test linter (
lint-tests) and interactive--fixflow - Raw step importer (
create-test-case) for quick Test Case creation
Known Issues
- Some complex UI interactions (like modals on certain websites) may require specific selectors
- File upload operations require test files to be present in the expected location
Troubleshooting
Authentication Issues
If you encounter authentication errors:
# Reset API configuration
labnex config set --reset
# Login again
labnex auth loginConnection Problems
If you cannot connect to the Labnex API:
# Check status
labnex status
# Configure custom API URL
labnex config set --api-url https://custom-api.labnex.comBrowser Execution Errors
If tests fail with browser-related errors:
# Update dependencies
npm update -g @labnex/cli
# Run with verbose logging
labnex run --project-id <ID> --verboseExamples
Example 1: Complete Test Workflow
# Create a new project
labnex projects create --name "E-commerce Site" --code ECOM --description "Testing for our e-commerce platform"
# Generate tests with AI
labnex ai generate --description "Test checkout process with credit card payment"
# Run all tests with optimization
labnex run --project-id <PROJECT_ID> --optimize-ai --headlessExample 2: Debugging Failed Tests
# Run specific test with detailed logging
labnex run --project-id <PROJECT_ID> --test-id <TEST_ID> --verbose
# Analyze failure reasons
labnex analyze failure --run-id <LATEST_RUN_ID>Documentation
For complete documentation, visit https://labnexdev.github.io/Labnex
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
