Skip to content

CI integration

Nijam is built to run in CI. You don’t pass commit, branch, PR, or author by hand - the Playwright reporter detects them automatically from your CI provider, so each run lands in history with full context.

Commit, branch, PR number, CI run id, CI run URL, and the git author (email + name). Resolution order, per field:

  1. CI-specific environment variables (see below)
  2. Generic GIT_* / BRANCH / COMMIT_SHA variables
  3. A git log / git rev-parse shell-out
  4. Empty (branch is left unset → the dashboard shows “No Branch Info”)

Detected from GITHUB_SHA, GITHUB_REF_NAME, GITHUB_HEAD_REF, GITHUB_RUN_ID, GITHUB_REPOSITORY, GITHUB_SERVER_URL.

.github/workflows/e2e.yml
name: e2e
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npm ci
- run: npx playwright install --with-deps
- run: npx playwright test
env:
NIJAM_API_KEY: ${{ secrets.NIJAM_API_KEY }}

Splitting a suite across CI jobs all clubs into one Nijam run (they share the CI run id), and a failure in any job flips that run to Failing right away. The dashboard shows running / failing live until the run completes - and how it completes depends on how you split:

  • --shard=i/N - auto-detected from config.shard. Each test is tagged with its 1-based shard index (i of N); each shard streams its results and reports when it finishes, and because Playwright knows the total, Nijam completes the run once every shard has reported. Nothing to configure - no extra step.
  • A matrix where each job runs different specs (no --shard - e.g. one spec file per job) - here Playwright reports no total, so you supply one. The simplest way: set NIJAM_SHARD_INDEX (this job’s shard number, 1 to N, unique per job) and NIJAM_SHARD_TOTAL (N) on each job. The reporter sends them as its shard, so Nijam knows the total, auto-completes once all N jobs report, and stamps each job’s machine - no post-matrix step. If you can’t assign unique indices, set autoComplete: false (or NIJAM_AUTO_COMPLETE=false) instead and add one post-matrix step that calls POST /v1/runs/complete.

Auto-detected - each shard self-reports and the run completes once all four are in. No autoComplete, no completion step.

.github/workflows/e2e.yml
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npm ci
- run: npx playwright install --with-deps
- run: npx playwright test --shard=${{ matrix.shard }}/4
env:
NIJAM_API_KEY: ${{ secrets.NIJAM_API_KEY }}

Only the manual-complete fallback calls /v1/runs/complete, and its ciRunId must equal the value the jobs sent - the same one the reporter detects (GITHUB_RUN_ID, CI_PIPELINE_ID, …), shared across every job in the run. On providers whose CI run id is job-level (e.g. CircleCI’s CIRCLE_BUILD_NUM), pass the shared workflow id through to the final step instead. Single-job, --shard, and NIJAM_SHARD_* runs need none of this - they complete on their own.

On a provider not listed above, set the generic variables and the reporter picks them up:

VariableMaps to
COMMIT_SHAcommit
BRANCHbranch
CI_RUN_IDCI run id
CI_URLCI run URL

If none are set, the reporter still falls back to git, so local runs are attributed too. The full variable list lives in the CI variables reference.

To send runs and reports to Nijam, the reporter needs two things - set both in playwright.config.ts:

  • projectId - which project to push to. Not a secret; it just identifies the project.
  • apiKey - the only secret. Store it as NIJAM_API_KEY in your CI secrets and reference it via the environment.

Everything else - commit, branch, PR, CI link, author - is detected automatically.