Overview
When you deploy a preview environment with Vercel, you can automatically run Wundertest tests against that environment. This helps you catch issues before they reach production.Setup Instructions
- Follow the GitHub Actions integration guide to set up your API keys
- Create a new GitHub Actions workflow file specifically for Vercel deployments
- If you have protected deployments enabled, you need to create a protection bypass in Vercel.
Example GitHub Actions Workflow for Vercel
This example workflow will run on every successful deployment to Vercel. This means if you have branch deployments enabled, it will run the tests for every branch deployment. The--base-url parameter tells Wundertest to use the Vercel preview URL as the base for all tests.
Allowing Wundertest access to Protected Deployments
If you’re using Vercel’s Deployment Protection features (Password Protection, Vercel Authentication, or Trusted IPs), you’ll need to set up a protection bypass for your automated tests. For this you need to set up a HTTP header that will be added to all requests.Create a Protection Bypass in Vercel
- Go to your Vercel project settings
- Go to Deployment Protection
- Below the Vercel Authentication section you will see a Protection Bypass for Automation section.
- Click on Add Secret, then on Save, Vercel will generate a secret for you.
- After that copy the secret to your clipboard.
- Go to the Wundertest Settings
- Under Headers add a new header with the name
x-vercel-protection-bypassand the value being the protection bypass secret you copied from Vercel
You can learn more about creating protection bypasses in the Vercel
documentation.
Tutorial Video
How It Works
- When Vercel completes a deployment, it triggers a
deployment_statusevent in GitHub - The workflow checks if the deployment was successful
- If successful, it runs Wundertest tests against the preview URL
- The
--base-urlparameter tells Wundertest to use the Vercel preview URL as the base for all tests - On Pull Requests it will show a status for Wundertest tests