1.3.0 • Published 8 months ago
@labnex/cli v1.3.0
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 listAI 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) | local |
--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 |
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.3.0 (Current)
- Added main function execution to fix CLI initialization
- Improved AI-powered element finding for better test reliability
- Enhanced error reporting for failed test steps
- Added verification script for quick CLI testing
- Updated documentation for production release
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
In Development / Coming Soon
- Cloud execution mode (currently only local execution is supported)
- Test run monitoring for specific run IDs
- Advanced modal handling for complex UI components
- File upload testing improvements
- Cross-browser test execution
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.