Skip to main content
Integrate Wundertest with your GitHub workflow to automatically run tests after deployments. This guide will walk you through setting up GitHub Actions with Wundertest.

Setup Instructions

  1. Go to Settings on the Wundertest dashboard
  2. Create a new API Key, name it “GitHub Action”
  3. Copy your organization ID from the settings page and add it to your GitHub repository secrets as WUNDERTEST_ORG_ID
  4. Add the API Key to your GitHub repository secrets as WUNDERTEST_TOKEN
  5. Add a workflow that works for your deployment process.

Example GitHub Actions Workflow File

This workflow would run on every push to the main branch and can also be triggered manually.
name: Deploy and Test

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  deploy:
    # ... Your deploy workflow
  wundertest:
    needs: [deploy]
    runs-on: ubuntu-latest

    env:
      WUNDERTEST_TOKEN: ${{ secrets.WUNDERTEST_TOKEN }}
      WUNDERTEST_ORG_ID: ${{ secrets.WUNDERTEST_ORG_ID }}
    steps:
      - uses: actions/checkout@v3

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "18"

      - name: Install Wundertest CLI
        run: npm install -g wundertest@latest

      - name: Run Wundertest Tests
        run: |
          wundertest run

Vercel

If you are using Vercel with branch deployments, you might want to check out our guide for Vercel.

How It Works

This workflow will:
  1. Run after your deployment job completes
  2. Set up Node.js environment
  3. Install the latest version of the Wundertest CLI
  4. Run your Wundertest tests against the newly deployed environment
  5. The workflow will fail if any of the tests fail
If you don’t want to fail the deployment, you can use the wundertest run --trigger-only command. This will just trigger the tests but not fail the deployment.

Using the API Directly

If you have concerns with using the Wundertest CLI and you just want to trigger tests, you can send a request to our API directly:
- name: Run Wundertest
  run: |
    curl -X POST "https://api.wundertest.ai/api/test-runs" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer ${{ secrets.WUNDERTEST_TOKEN }}" \
      -d '{
        "organizationId": "${{ secrets.WUNDERTEST_ORG_ID }}",
        "testCaseIds": null
      }'
  env:
    WUNDERTEST_TOKEN: ${{ secrets.WUNDERTEST_TOKEN }}
    WUNDERTEST_ORG_ID: ${{ secrets.WUNDERTEST_ORG_ID }}
This approach is useful if you want to avoid installing Node.js and the CLI, or if you’re working in an environment where using the CLI is not practical.

References