Vercel
Integrate TestDriver with Vercel deployments using GitHub Actions.
This guide explains how to integrate TestDriver with Vercel deployments using the GitHub Actions workflow. By combining these tools, you can automatically test your Vercel preview deployments or production builds to ensure they meet your quality standards before merging or releasing.
Workflow overview
- Trigger Vercel Deployment: Use Vercel’s GitHub integration to deploy your application on every pull request or push to the main branch.
- Run Tests on the Deployment URL: Use the TestDriver GitHub Action to test the deployed application using the Vercel deployment URL.
- Report Results: View test results in the GitHub Actions dashboard or as comments on the pull request.
Prerequisites
- Vercel GitHub Integration: Ensure your repository is connected to Vercel for automatic deployments.
- TestDriver API Key: Store your API key as a GitHub secret (for example,
TD_API_KEY
). - Vercel Deployment URL: Use the
VERCEL_URL
environment variable provided by Vercel to access the deployment.
GitHub Actions workflow
Here’s a complete workflow to test Vercel deployments with TestDriver:
Workflow file: .github/workflows/test-vercel.yaml
Workflow steps explained
1. Wait for Vercel deployment
The amondnet/vercel-action
waits for the Vercel deployment to complete and retrieves the deployment URL. This URL is stored in the steps.vercel.outputs.url
variable.
2. Run tests with TestDriver
The TestDriver GitHub Action runs tests on the deployed application using the deployment URL. The prompt
field specifies the test steps to execute.
Example TestDriver prompt
The prompt
field in the TestDriver action specifies the steps to test the Vercel deployment. For example:
Secrets configuration
Add the following secrets to your GitHub repository:
TD_API_KEY
: Your TestDriver API key.VERCEL_TOKEN
: Your Vercel API token.VERCEL_ORG_ID
: Your Vercel organization ID.VERCEL_PROJECT_ID
: Your Vercel project ID.
Benefits of this workflow
- Automated Deployment Testing: Automatically test every Vercel deployment, including preview and production builds.
- Early Issue Detection: Catch issues in pull requests before merging.
- Detailed Feedback: View test results directly in the GitHub Actions dashboard.
- Seamless Integration: Combine Vercel’s deployment capabilities with TestDriver’s testing power.
Example output
GitHub Actions dashboard:
- ✅ Test Vercel Deployment: All tests passed.
- ❌ Test Vercel Deployment: 1 test failed. View logs for details.
TestDriver logs:
- Step 1: Opened the deployment URL.
- Step 2: Verified the homepage loaded correctly.
- Step 3: Clicked the “Sign Up” button.
- Step 4: Filled out the registration form.
- Step 5: Failed to verify the success message.
By integrating TestDriver with Vercel deployments, you can ensure that every deployment is thoroughly tested, reducing the risk of bugs reaching production and improving the overall quality of your application.