yaiqa
v1.0.1
Published
YAIQA CLI - AI-powered test automation from the command line
Readme
YAIQA CLI
A powerful command-line interface for YAIQA - AI-powered test automation platform. Run intelligent browser tests from your terminal with ease.
Installation
Global Installation
npm install -g yaiqaLocal Installation
npm install yaiqa
npx yaiqa --helpQuick Start
Authenticate with YAIQA (automatically sets up project config)
yaiqa loginList available tests
yaiqa listRun tests
yaiqa ai-check my-test
Commands
yaiqa login
Authenticate with the YAIQA platform.
yaiqa login
yaiqa login --api-key <your-api-key>Options:
-k, --api-key <key>- API key for authentication
Note: Project configuration is automatically set up during yaiqa login if no .yaiqa.config.json exists.
yaiqa list
List all available tests.
yaiqa list
yaiqa list --format jsonOptions:
-f, --format <format>- Output format (table, json)
yaiqa ai-check
Run AI-powered tests.
# Run specific tests
yaiqa ai-check test1 test2
# Run ad-hoc test
yaiqa ai-check --url https://example.com --prompt "Click the login button"
# Automatically waits for completion
yaiqa ai-check my-test
# Generate JUnit report
yaiqa ai-check my-test --reporter junit --output results.xmlOptions:
-u, --url <url>- URL to test (for ad-hoc tests)-p, --prompt <prompt>- Test instructions (for ad-hoc tests)-n, --name <name>- Test name (for ad-hoc tests)-d, --description <description>- Test description-t, --timeout <timeout>- Timeout in milliseconds (default: 300000)-w, --wait- Wait for test completion (deprecated - now automatic)--adhoc- Run as ad-hoc test (don't save to database)--reporter <reporter>- Output reporter (console, junit, json)-o, --output <file>- Output file for reports
Note: The yaiqa ai-check command automatically waits for test completion, so manual status checking is not needed.
Configuration
Global Configuration
The CLI stores configuration in your system's config directory:
- macOS/Linux:
~/.config/yaiqa/config.json - Windows:
%APPDATA%/yaiqa/config.json
Project Configuration
Create a .yaiqa.config.json file in your project root:
{
"project": {
"name": "My Project",
"description": "Project description"
},
"apiUrl": "https://api.yaiqa.com",
"defaultOptions": {
"timeout": 300000,
"retries": 3,
"verbose": false
}
}Environment Variables
YAIQA_API_KEY- Your API key (optional, can also useyaiqa login)YAIQA_VERBOSE- Enable verbose outputYAIQA_JSON_OUTPUT- Enable JSON output
Output Formats
Console Output (Default)
Colorized, human-readable output with status indicators and progress bars.
JSON Output
Machine-readable JSON format for integration with other tools:
yaiqa list --format json
yaiqa ai-check my-test --jsonJUnit XML
Generate JUnit-compatible XML reports for CI/CD integration:
yaiqa ai-check my-test --reporter junit --output results.xmlCI/CD Integration
GitHub Actions
name: YAIQA Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install -g yaiqa
- run: yaiqa login --api-key ${{ secrets.YAIQA_API_KEY }}
- run: yaiqa ai-check my-test --reporter junit --output results.xml
- uses: dorny/test-reporter@v1
if: always()
with:
name: YAIQA Test Results
path: results.xml
reporter: java-junitJenkins
pipeline {
agent any
stages {
stage('Test') {
steps {
sh 'npm install -g yaiqa'
sh 'yaiqa login --api-key ${YAIQA_API_KEY}'
sh 'yaiqa ai-check my-test --reporter junit --output results.xml'
}
}
}
post {
always {
junit 'results.xml'
}
}
}Advanced Usage
Development Workflow
For file watching during development, consider using IDE extensions or external tools like nodemon or chokidar.
Ad-hoc Testing
Run tests without saving to the database:
yaiqa ai-check --url https://example.com --prompt "Click the login button" --name "Login Test"Batch Testing
Run multiple tests in sequence:
yaiqa ai-check test1 test2 test3Custom Timeouts
Set custom timeouts for long-running tests:
yaiqa ai-check my-test --timeout 600000 # 10 minutesTroubleshooting
Authentication Issues
# Check if you're authenticated
yaiqa list
# Re-authenticate
yaiqa loginNetwork Issues
# Check API connectivity
yaiqa list --verbose
# If you need a custom API URL, contact supportTest Execution Issues
# Run with verbose output
yaiqa ai-check my-test --verbose
# The ai-check command automatically waits for completion
# No manual status checking neededExamples
Basic Test Execution
# List available tests
yaiqa list
# Run a specific test
yaiqa ai-check "Login Test"
# Run multiple tests
yaiqa ai-check "Login Test" "Checkout Test"Ad-hoc Testing
# Test a specific URL with custom instructions
yaiqa ai-check --url https://example.com --prompt "Navigate to the contact page and fill out the form"CI/CD Pipeline
# Run tests and generate JUnit report
yaiqa ai-check my-test --reporter junit --output test-results.xml
# Exit with appropriate code for CI
if [ $? -eq 0 ]; then
echo "All tests passed"
else
echo "Some tests failed"
exit 1
fiDevelopment Workflow
# Login (automatically sets up project config)
yaiqa login
# Run specific tests before commit
yaiqa ai-check critical-tests
# For file watching, use IDE extensions or external toolsAPI Reference
The CLI integrates with the YAIQA REST API:
- Authentication: Bearer token authentication
- Base URL: https://api.yaiqa.com (production)
- Endpoints:
GET /api/tests- List testsPOST /api/tests- Create testPOST /api/tests/:id/execute- Execute testGET /api/tests/execution/:id- Get execution statusGET /api/tests/executions/:id- Get execution resultsPOST /api/api-keys/validate- Validate API key
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
- Documentation: https://docs.yaiqa.com
- Issues: https://github.com/yaiqa/yaiqa/issues
- Discord: https://discord.gg/yaiqa
