Skip to content

Automation

CI and GitHub Actions

Run your suite against every preview deployment.

All documentation

Run your suite against each preview deployment and fail the build when a test fails. Every CI run is recorded with its commit and branch.

Before you start

  1. Create an API key with the read and run scopes and store it as a CI secret.
  2. Allow your preview hosts on the environment, for example *.vercel.app or *.preview.example.com, so runs can target them with baseUrl.
  3. Tag the tests that should gate a merge, for example smoke.

GitHub Actions

.github/workflows/inspect.ymlyaml
name: Browser tests
on:
  deployment_status:
jobs:
  inspect:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      - name: Run the Aback Inspect suite against the preview
        env:
          ABACK_INSPECT_API_KEY: ${{ secrets.ABACK_INSPECT_API_KEY }}
          PREVIEW_URL: ${{ github.event.deployment_status.environment_url }}
        run: |
          curl -sS --fail-with-body -X POST \
            "https://abackinspect.com/api/v1/projects/YOUR_PROJECT_ID/runs?wait=300&source=ci" \
            -H "Authorization: Bearer $ABACK_INSPECT_API_KEY" \
            -H "Content-Type: application/json" \
            -H "Idempotency-Key: gh-${{ github.run_id }}-${{ github.run_attempt }}" \
            -d "{\"baseUrl\": \"$PREVIEW_URL\", \"tag\": \"smoke\", \"metadata\": {\"commit\": \"${{ github.sha }}\", \"branch\": \"${{ github.ref_name }}\", \"source\": \"github-actions\"}}" \
            -o result.json
          BATCH=$(jq -r '.batch.id' result.json)
          curl -sS "https://abackinspect.com/api/v1/batches/$BATCH/junit" -H "Authorization: Bearer $ABACK_INSPECT_API_KEY" -o aback-inspect.xml
          curl -sS "https://abackinspect.com/api/v1/batches/$BATCH/summary.md" -H "Authorization: Bearer $ABACK_INSPECT_API_KEY" >> "$GITHUB_STEP_SUMMARY"
          jq -e '.batch.status == "passed"' result.json

wait=300 holds the request until the runs finish (up to five minutes), so one call returns the result. Larger suites can poll GET /api/v1/batches/:id instead. The Idempotency-Key makes a retried job reuse the same runs instead of paying for new ones.

Any other CI

bash
curl -sS -X POST "https://abackinspect.com/api/v1/projects/$PROJECT_ID/runs?wait=300" \
  -H "Authorization: Bearer $ABACK_INSPECT_API_KEY" \
  -H "x-aback-trigger: ci" \
  -H "Content-Type: application/json" \
  -d '{"baseUrl": "https://preview.example.com"}'

The response contains the batch with its status (passed, failed, running or cancelled) and every run. JUnit XML and a Markdown summary are available for each batch, and for single runs at /api/v1/runs/:id/junit.