GitHub Actions & CI/CD Integration
There are two ways to connect a CI pipeline to Agnox. This guide uses GitHub Actions; the same pattern works on GitLab CI, Azure DevOps, Jenkins, Bitbucket Pipelines and any other CI system. Tests that aren't Playwright (Maestro, Pytest, Selenium, WebdriverIO, Jest…) report through Option A too, by uploading their JUnit XML or Allure results.
| Option A — External CI (Reporter) | Option B — Agnox Hosted Run | |
|---|---|---|
| Where tests run | In your CI job | In an Agnox container, from your Docker image |
| What you need | @agnox/playwright-reporter in your Playwright project | A Docker image of your tests (Docker setup →) |
| Counts toward | External CI Runs | Agnox Hosted Runs |
Prerequisites
- Generate an API key in Settings → Profile → API Access (shown only once).
- Add it as a CI secret, e.g.
AGNOX_API_KEY. - Copy your Project ID from Settings → Run Settings → Execution Defaults and store it as
AGNOX_PROJECT_ID.
| Secret | Description |
|---|---|
AGNOX_API_KEY | Your Agnox API key |
AGNOX_PROJECT_ID | Your project ID |
TARGET_URL | (Option B, optional) Base URL of the application under test |
Option A: External CI with the Playwright Reporter
Run tests in your own job and stream results — plus screenshots, videos and traces of failed tests — to Agnox.
npm install -D @agnox/playwright-reporter
Add it to playwright.config.ts (see Native Playwright Reporter →), then:
name: E2E Tests (External CI)
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npx playwright install --with-deps
- name: Run Playwright tests
env:
AGNOX_API_KEY: ${{ secrets.AGNOX_API_KEY }}
AGNOX_PROJECT_ID: ${{ secrets.AGNOX_PROJECT_ID }}
run: npx playwright test
Branch, commit, PR number and the job link are detected automatically. Artifacts of failed tests upload by default (uploadArtifacts: 'failed-only', 25 MB per file, 150 MB per run).
Every job and shard of one workflow run is grouped automatically as <workflow name> #<run number> (here E2E Tests (External CI) #42), so a sharded or multi-job pipeline appears as one group in the Dashboard's Grouped view. Set AGNOX_GROUP_NAME (or the reporter's groupName) to choose another name, and AGNOX_ENVIRONMENT: qa to label the runs with the QA environment. On a pull request from a fork, where secrets are empty, the reporter prints one warning and the tests still run.
Other frameworks: upload JUnit XML or Allure results
Any tool that writes JUnit XML or Allure results reports with agnox report upload, which calls POST /api/v1/reports. Upload each platform as its own run, so Android and iOS are counted separately, and let both join the workflow run's group:
name: Mobile E2E
on: [push, pull_request]
jobs:
mobile:
runs-on: macos-latest
strategy:
matrix:
platform: [android, ios]
steps:
- uses: actions/checkout@v4
# ...install Maestro and start the Android emulator or iOS simulator for matrix.platform...
- run: maestro test flows/ --format junit --output report-${{ matrix.platform }}.xml
- name: Upload results to Agnox
if: always() # upload failed runs too
run: npx -y @agnox/mcp-server@latest report upload report-${{ matrix.platform }}.xml --tool maestro --run-name ${{ matrix.platform }} --env qa
env:
AGNOX_API_KEY: ${{ secrets.AGNOX_API_KEY }}
AGNOX_PROJECT_ID: ${{ vars.AGNOX_PROJECT_ID }}
Both uploads are grouped as Mobile E2E #<run number>, the same group the Playwright reporter uses, so a pipeline that runs Playwright in one job and Maestro in another shows as one group. --group (or AGNOX_GROUP_NAME) sets another name. Branch, commit and PR are read from the workflow. See JUnit XML & Allure Report Ingestion → for every option.
Option B: Trigger an Agnox Hosted Run
Agnox pulls your image and runs the tests in its own container — your CI job only sends one request:
name: E2E Tests via Agnox
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Trigger Agnox Test Run
run: |
curl -sS --fail-with-body -X POST https://api.agnox.dev/api/ci/trigger \
-H "Content-Type: application/json" \
-H "x-api-key: ${{ secrets.AGNOX_API_KEY }}" \
-d '{
"projectId": "${{ secrets.AGNOX_PROJECT_ID }}",
"image": "your-dockerhub-user/my-tests:latest",
"command": "npx playwright test",
"folder": "tests/e2e",
"config": {
"environment": "staging",
"baseUrl": "${{ secrets.TARGET_URL }}"
},
"ciContext": {
"source": "github",
"repository": "${{ github.repository }}",
"prNumber": ${{ github.event.number || 0 }},
"commitSha": "${{ github.sha }}"
}
}'
The response is 201 with { "success": true, "data": { "taskId": "...", "status": "PENDING" } }. The run is recorded under Executions; add "createCycle": true to also create a Test Cycle (the response then includes cycleId), or "cycleId": "<id>" to add it to an existing cycle.
The full request schema and error codes are in the CI & Webhooks API →.
Hosted runs above your plan's concurrency limit wait in the queue (
PENDING) and start as earlier runs finish. When the monthly Agnox Hosted Runs quota is reached, the request is rejected until the next month or an upgrade.
Gate the release
After your test jobs, add a job that asks Agnox whether the release is ready. It fails when the verdict is BLOCKED and writes a summary table to the job page:
release-gate:
needs: [e2e]
if: always()
runs-on: ubuntu-latest
steps:
- run: npx -y @agnox/mcp-server@latest gate check --group "${{ github.workflow }} #${{ github.run_number }}" --format markdown >> "$GITHUB_STEP_SUMMARY"
env:
AGNOX_API_KEY: ${{ secrets.AGNOX_API_KEY }}
AGNOX_PROJECT_ID: ${{ vars.AGNOX_PROJECT_ID }}
See Release Readiness Gate → for the checks, the policy and the exit codes.
Audit the tests in a pull request
Catch a .only, a new skip, a fixed sleep, a forced click or a deleted assertion before it merges. The PR Test Auditor reads the pull request diff, needs no API key, and annotates the changed lines:
pr-test-audit:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: npx -y @agnox/mcp-server@latest audit pr --base "origin/$BASE_REF" --head HEAD --format markdown --fail-on never >> "$GITHUB_STEP_SUMMARY"
env:
BASE_REF: ${{ github.base_ref }}
- run: npx -y @agnox/mcp-server@latest audit pr --base "origin/$BASE_REF" --head HEAD --format github
env:
BASE_REF: ${{ github.base_ref }}
The first step writes a summary table to the job page; the second adds inline annotations and fails the job on errors. --head HEAD compares the pull request's commits with its base branch, and fetch-depth: 0 gives the job that history. In a repository that holds only tests, add --ignore-missing-tests. See PR Test Auditor → for the rules, Maestro flows, suppression comments and exit codes.
Smart PR Routing
Enable Smart PR Routing in Settings → Features to let Agnox pick the test folder to run from the files changed in a push or pull request. Point your repository's webhook at:
https://api.agnox.dev/api/webhooks/ci/pr?token=<organizationId>&projectId=<projectId>
projectId is highly recommended for organizations with several projects — without it the oldest project's run settings are used. Every delivery must be signed with (or carry) your Webhook Secret from Settings → Run Settings. See Smart PR Routing → for GitHub, GitLab, Bitbucket and Azure DevOps setup.