Diffie + CircleCI

Run Diffie tests in your CircleCI pipeline

Overview

Add Diffie to your CircleCI workflow to run browser tests on every push. The integration is a shell script using curl and jq — no orbs or special dependencies required. Just add a job to your config.yml and tests run automatically.

Setup Guide

1

Get your API token and Suite ID

In the Diffie dashboard, go to Settings → API Tokens to generate a token (DIFFIE_TOKEN). Then open the test suite you want to run and copy the Suite ID from the URL or settings page (DIFFIE_SUITE_ID).

2

Add environment variables to CircleCI

In your CircleCI project settings, go to Environment Variables. Add DIFFIE_TOKEN and DIFFIE_SUITE_ID.

3

Update your .circleci/config.yml

Add a Diffie test job that starts a suite run and polls for results.

version: 2.1

jobs:
  diffie-tests:
    docker:
      - image: alpine:latest
    environment:
      PREVIEW_URL: "https://your-app.example.com"
    steps:
      - run:
          name: Install dependencies
          command: apk add --no-cache curl jq
      - run:
          name: Run Diffie Tests
          command: |
            RESPONSE=$(curl -s -X POST \
              "https://api.diffie.ai/ci/suites/$DIFFIE_SUITE_ID/execute" \
              -H "Authorization: Bearer $DIFFIE_TOKEN" \
              -H "Content-Type: application/json" \
              -d "{\"baseUrl\": \"$PREVIEW_URL\"}")

            RUN_ID=$(echo $RESPONSE | jq -r '.suiteRunId')
            RUN_URL=$(echo $RESPONSE | jq -r '.url')

            if [ "$RUN_ID" = "null" ] || [ -z "$RUN_ID" ]; then
              echo "Failed to start suite run"
              echo "$RESPONSE"
              exit 1
            fi

            echo "Suite run started: $RUN_ID"
            echo "View results: $RUN_URL"

            while true; do
              STATUS_RESPONSE=$(curl -s \
                "https://api.diffie.ai/ci/suite-runs/$RUN_ID" \
                -H "Authorization: Bearer $DIFFIE_TOKEN")

              STATUS=$(echo $STATUS_RESPONSE | jq -r '.status')
              PASSED=$(echo $STATUS_RESPONSE | jq -r '.passed_tests')
              TOTAL=$(echo $STATUS_RESPONSE | jq -r '.total_tests')

              echo "Status: $STATUS ($PASSED/$TOTAL passed)"

              if [ "$STATUS" = "passed" ]; then
                echo "All tests passed!"
                exit 0
              elif [ "$STATUS" = "failed" ]; then
                echo "Tests failed! Details: $RUN_URL"
                exit 1
              elif [ "$STATUS" = "cancelled" ]; then
                echo "Run was cancelled"
                exit 1
              fi

              sleep 10
            done

workflows:
  test:
    jobs:
      - diffie-tests
4

Push and verify

Commit the configuration and push. Diffie tests will run as a job in your CircleCI workflow. If anything fails, click through to the Diffie dashboard for screenshots and error details.

Benefits

  • Native CircleCI workflow integration — no orbs required
  • No Node.js or browser installation needed — just curl and jq
  • Test results visible directly in the CircleCI dashboard
  • Easy to add to existing multi-job workflows
  • Just two API endpoints — start a run and check status

Ready to get started?

Create your first AI-powered browser test in minutes.

Other Integrations