A Node.js CLI plugin for triggering Test Collab QA Copilot service from GitHub and GitLab CI pipelines.
This tool is designed to be integrated into CI/CD pipelines to automatically trigger the Test Collab QA Copilot service after a successful build. It streamlines the process of initiating automated testing by providing a simple CLI interface that passes build information to the Test Collab service.
The plugin works by:
- 🚀 Triggering a test run on the Test Collab QA Copilot service
- 🔑 Receiving a queue ID from the service
- 📊 Subscribing to a logs API to stream test execution logs in real-time
- ⏱️ Waiting for the test execution to complete and reporting results
npm install -g qa-copilot-ci
npm install --save-dev qa-copilot-ci
qac --build <build_id> --app_url <application_url> --tc_project_id <project_id> --api_key <api_key>
--build
- The build ID from your CI pipeline--app_url
- The URL of the application to be tested--tc_project_id
- The Test Collab project ID--api_key
- Your Test Collab API key for authentication
--api_url
- Custom API endpoint URL (defaults to environment variable or the built-in default)--test_mode
- Run in test mode without making actual API calls (useful for testing CI pipeline integration)
# Basic usage
qac --build 12345 --app_url https://staging.example.com --tc_project_id 678 --api_key abcdef123456
# Using test mode
qac --build 12345 --app_url https://staging.example.com --tc_project_id 678 --api_key abcdef123456 --test_mode
# Using custom API endpoint
qac --build 12345 --app_url https://staging.example.com --tc_project_id 678 --api_key abcdef123456 --api_url https://custom-api.example.com/webhook
The plugin can be configured through:
- Command-line arguments (highest priority)
- Environment variables (medium priority)
- Default values (lowest priority)
# .github/workflows/main.yml
name: CI/CD Pipeline
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Deploy to staging
id: deploy
run: |
# Your deployment script
echo "::set-output name=app_url::https://staging.example.com"
- name: Install QA Copilot CI
run: npm install -g qa-copilot-ci
- name: Trigger QA Tests
run: |
qac --build ${{ github.run_id }} \
--app_url ${{ steps.deploy.outputs.app_url }} \
--tc_project_id ${{ vars.TC_PROJECT_ID }} \
--api_key ${{ secrets.TESTCOLLAB_API_KEY }}
# .gitlab-ci.yml
stages:
- build
- deploy
- test
build:
stage: build
script:
- npm ci
- npm run build
artifacts:
paths:
- dist/
deploy:
stage: deploy
script:
- # Your deployment script
- echo "APP_URL=https://staging.example.com" >> deploy.env
artifacts:
reports:
dotenv: deploy.env
qa_tests:
stage: test
script:
- npm install -g qa-copilot-ci
- qac --build $CI_PIPELINE_ID --app_url $APP_URL --tc_project_id $TC_PROJECT_ID --api_key $QA_COPILOT_API_KEY
dependencies:
- deploy
To contribute to this project:
- Clone the repository
- Install dependencies:
npm install
- Make your changes
- Test your changes:
node bin/qac.js --help
- Test with mock mode:
npm run test-mode
MIT
A sample project is available to help you get started with qa-copilot-ci
quickly. It demonstrates a basic setup and integration for a Node.js application.
You can find the sample project here: https://github.com/AbhimanyuG/qac-sample-project/
Feel free to fork this repository and adapt it to your needs. It provides a practical example of how to configure and use qa-copilot-ci
in a CI/CD environment.
- Homepage: testcollab.com
- Repository: https://github.com/TCSoftInc/qa-copilot-ci
- Bug Reports: https://github.com/TCSoftInc/qa-copilot-ci/issues
- Demo Video: QA Copilot YouTube explainer