Diffie + GitHub Actions

Run Diffie tests in your GitHub Actions pipeline

Overview

Run your Diffie test suites automatically on every pull request with GitHub Actions. The integration uses two API calls — one to start a suite run, one to poll for results. No plugins or complex configuration required.

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 secrets to GitHub

In your GitHub repository, go to Settings → Secrets and variables → Actions. Add two repository secrets: DIFFIE_TOKEN and DIFFIE_SUITE_ID.

3

Create the workflow file

Add a workflow file at .github/workflows/diffie.yml. The script starts a suite run via the API, then polls for results every 10 seconds until the run passes, fails, or is cancelled.

name: Diffie Tests

on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  diffie-tests:
    name: diffie-e2e-tests
    runs-on: ubuntu-latest

    steps:
      - name: Run Diffie Test Suite
        env:
          DIFFIE_TOKEN: ${{ secrets.DIFFIE_TOKEN }}
          DIFFIE_SUITE_ID: ${{ secrets.DIFFIE_SUITE_ID }}
          PREVIEW_URL: https://your-app.example.com
        run: |
          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
4

Push and verify

Commit and push the workflow file. Open a pull request and Diffie tests will run as a status check. If anything fails, click through to the Diffie dashboard to see screenshots and error details.

Benefits

  • Catch browser bugs on every pull request before merging
  • No additional infrastructure to manage — tests run in Diffie's cloud
  • Test results appear as GitHub status checks with direct links to reports
  • Works with dynamic preview URLs from Vercel, Netlify, and Cloudflare Pages
  • Just two API endpoints — start a run and check status

Want a deeper walkthrough? Read the full guide →

Ready to get started?

Create your first AI-powered browser test in minutes.

Other Integrations