Run tests in CI
Run a project's tests after every deploy, fail the build when a check fails, and keep the result with the commit. One file, no dependencies, any CI.
Before you start#
- Create an API key. Settings → API keys → Create key, with "Run tests and read results". It is shown once.
- Store it as a secret named TESTSY_AI_API_KEY in your CI (GitHub: Settings → Secrets and variables → Actions; GitLab: a masked CI/CD variable).
- Find your project id. It starts with
p_and is in the address of the project page, or runnode testsy-ai.mjs projects. The app's Connect page shows these snippets with your project filled in.
Add the workflow#
Run it after your deploy finishes, so the tests see the new version: on GitHub, on deployment_status, or as the last step of your deploy job.

# .github/workflows/testsy-ai.yml
name: Testsy
on:
deployment_status:
workflow_dispatch:
jobs:
qa:
if: github.event_name == 'workflow_dispatch' || github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- name: Run Testsy tests
env:
TESTSY_AI_API_KEY: ${{ secrets.TESTSY_AI_API_KEY }}
TESTSY_AI_URL: https://app.testsy.dev
TARGET: ${{ github.event.deployment_status.environment_url }}
run: |
curl -fsSL "$TESTSY_AI_URL/cli/testsy-ai.mjs" -o testsy-ai.mjs
# On a deployment event the tests run against that deploy's address (a preview or staging of the same site).
node testsy-ai.mjs run --project p_your_project --junit testsy-ai-junit.xml ${TARGET:+--url "$TARGET"}
- uses: actions/upload-artifact@v4
if: always()
with: { name: testsy-ai-junit, path: testsy-ai-junit.xml }# .gitlab-ci.yml
include:
- remote: 'https://app.testsy.dev/integrations/testsy-ai.gitlab-ci.yml'
testsy-ai:
extends: .testsy-ai
stage: test # or a stage after your deploy
variables:
TESTSY_AI_PROJECT: p_your_projectexport TESTSY_AI_API_KEY=qa_… # from API keys
export TESTSY_AI_URL=https://app.testsy.dev
curl -fsSL "$TESTSY_AI_URL/cli/testsy-ai.mjs" -o testsy-ai.mjs
node testsy-ai.mjs run --project p_your_project # every test in the project
node testsy-ai.mjs run --test t_abc,t_def --junit out.xml # chosen tests
node testsy-ai.mjs projects
node testsy-ai.mjs tests --project p_your_projectOn GitHub the published action does the same with less to copy — uses: testsy-ai/testsy-action@v1 with api-key, project or tests, and the optional build, build-label, fingerprint, target-url, device, os-version, mode, timeout, fail-on, junit and url inputs; it exposes junit and watch-urls as outputs. Given fingerprint and no build, it only looks the build up and sets build-needed and build-id (skipping the build). Pin a commit SHA in production. The snippet above downloads the same CLI at run time instead, which works in any CI.
The GitLab template takes these variables: TESTSY_AI_PROJECT, TESTSY_AI_TESTS (test ids instead of a whole project), TESTSY_AI_MODE (auto), TESTSY_AI_TIMEOUT (45m), TESTSY_AI_FAIL_ON (failed,error), TESTSY_AI_BUILD (app builds: files, https links or ab_ ids, separated by spaces), TESTSY_AI_FINGERPRINT (stored with a single uploaded build), TESTSY_AI_URL, TESTSY_AI_TARGET_URL, TESTSY_AI_DEVICE and TESTSY_AI_OS_VERSION. Results appear in the merge request's test report.
watch-urls output. Runs from a public repository get a link only workspace members can open.Test a preview or staging deploy#
A test is saved with the address of your site. In CI you usually want the same test against *this* deploy — a pull request's preview, a review app, staging. Give the run the address and every website test starts there instead:
- CLI:
node testsy-ai.mjs run --project p_… --url "https://pr-42.preview.example.com" - GitHub Action:
target-url: ${{ github.event.deployment_status.environment_url }}(the workflow above does this ondeployment_status) - GitLab:
TESTSY_AI_TARGET_URL: $CI_ENVIRONMENT_URLon the.testsy-aijob - API / MCP:
urlon run a test or run a project
The run explores from that address (a learned path belongs to the saved one), the result shows the address it ran against, and app tests are unaffected — they run their build. Sign-in accounts and endpoints are the test's own; a preview that needs other credentials needs its own test.
App tests on another device#
Each app test is saved with its device and OS version (a phone on the latest version unless you chose otherwise). To run the suite on another one this time — an iPad, or an older Android — give the run the device, the version and/or the orientation at the start (default, portrait, landscape); the tests keep their own setting:
- CLI:
node testsy-ai.mjs run --project p_… --device tablet --os-version "iOS 26" --orientation landscape - GitHub Action:
device: tablet,os-version: iOS 26andorientation: landscape; amatrixof versions runs one job per version - GitLab:
TESTSY_AI_DEVICE: tablet,TESTSY_AI_OS_VERSION: "iOS 26"andTESTSY_AI_ORIENTATION: landscapeon the.testsy-aijob - API / MCP:
device,osVersionandorientationon run a test or run a project
A version applies to every app test of the run. In a project with both iPhone and Android tests, use latest or a device alone, or run each platform's tests separately (--test).
Versions: latest, or one of those list devices returns (iOS 27, 26, 18, 17; Android 16 to 10). Website tests are unaffected. A run on another device explores (a learned path belongs to the saved device), and its result says what it ran on.
When the build fails#
By default the build fails when a run fails or does not finish. Change it with --fail-on (GitLab: TESTSY_AI_FAIL_ON):
| Value | The run | Fails the build by default |
|---|---|---|
failed | A check failed. | Yes |
error | Did not finish because of a problem on our side. Not counted. | Yes |
blocked | The site stopped the tester, for example a bot wall. Not counted. | No |
inconclusive | The tester could not tell for sure. | No |
Exit codes#
| Code | Meaning |
|---|---|
0 | Every run passed, or none ended in a --fail-on verdict. |
1 | A run ended in a --fail-on verdict. |
2 | A setup or API problem: a missing key, an unknown project, no runs started, or a test that could not start. |
3 | Timed out (--timeout, default 45m). The JUnit file is still written. |
App builds#
Upload the build your pipeline just made and run the app's tests on it: see App builds from CI.