You can use Vercel's webhooks with your Git provider to run an end-to-end test suite after your Vercel deployment has finished. This example will use GitHub Actions, but you can use any of our supported Git providers.
Configure a GitHub Action
- Connect your Git repository to your project. For new projects, you can follow these docs. For existing projects, visit your Git configuration in the Settings tab of your project dashboard.
- Create a GitHub workflow in
.github/workflows
with the following:
1# We are using Playwright but you may use your E2E framework of choice2name: Playwright Tests3
4on:5 deployment_status:6 7 run-e2es:8 if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'9 runs-on: ubuntu-latest10 steps:11 - uses: actions/checkout@v212 - name: Install dependencies13 run: npm ci && npx playwright install --with-deps14 - name: Run tests15 run: npx playwright test16 env:17 BASE_URL: ${{ github.event.deployment_status.target_url }}
A GitHub Action that runs an end-to-end test suite using Playwright, testing the Vercel Preview Deployment.