GuidesUsing Endform

Test Vercel previews

Run your Playwright suite on Endform automatically against every pull request's Vercel preview deployment.

Endform integrates directly with Vercel and GitHub Actions so every pull request waits for its Vercel preview deployment, bypasses Vercel Deployment Protection automatically, runs your Playwright suite in parallel against the preview URL, and reports the result as a Vercel deployment check.

Vercel preview testing flow: pushing to a pull request starts both a Vercel preview build and a GitHub Actions workflow. The run-with-vercel-deployment action waits for the preview URL and bypass header, runs npx endform test against the preview, and reports results to the Vercel deployment check and GitHub pull request.

Working with a coding agent? Give it this prompt and it will configure your Playwright config and workflow for you:

Prompt for your coding agent
Set up Endform to test Vercel preview deployments by following
https://endform.dev/docs/using-endform/vercel-previews.md.
Update playwright.config.ts to read BASE_URL, create
.github/workflows/endform-e2e.yml using run-with-vercel-deployment,
and tell me the GitHub and Vercel connection commands to run.

Connect Vercel and run on pull requests

You need a GitHub repository deploying to Vercel, an existing Playwright suite, and a GitHub Actions workflow.

  1. Connect GitHub and Vercel to Endform

    Install both the Endform GitHub App and the Endform Vercel integration on the same Endform organization:

    npx endform@latest connect github
    npx endform@latest connect vercel

    You can also install Endform directly from the Vercel Marketplace and connect GitHub from Settings → Integrations in the Endform dashboard. Make sure the repository deploying to Vercel is selected in the GitHub App installation.

  2. Read BASE_URL in playwright.config.ts

    Configure use.baseURL to read process.env.BASE_URL when running against a Vercel preview, and fall back to your local dev server when BASE_URL is unset:

    playwright.config.ts
    import { defineConfig } from "@playwright/test";
    
    const baseURL = process.env.BASE_URL ?? "http://localhost:3000";
    
    export default defineConfig({
      webServer: process.env.BASE_URL
        ? undefined
        : {
            command: "npm run dev",
            url: "http://localhost:3000",
            reuseExistingServer: !process.env.CI,
          },
      use: {
        baseURL,
      },
    });

    With this setup, running npx endform@latest test locally still tests against your local server, while CI tests directly against the Vercel preview URL without starting webServer.

  3. Add the GitHub Actions workflow

    Create .github/workflows/endform-e2e.yml using endformdev/actions/run-with-vercel-deployment. Replace your-vercel-project-name with your exact Vercel project name (also listed in .vercel/project.json if linked locally):

    .github/workflows/endform-e2e.yml
    name: Endform Vercel Previews
    
    on:
      pull_request:
    
    permissions:
      contents: read
      id-token: write
    
    jobs:
      e2e:
        runs-on: ubuntu-latest
        steps:
          - name: Checkout repository
            uses: actions/checkout@v4
    
          - name: Set up Node.js
            uses: actions/setup-node@v4
            with:
              node-version: 22
    
          - name: Install dependencies
            run: npm ci
    
          - name: Wait for Vercel deployment
            uses: endformdev/actions/run-with-vercel-deployment@main
            with:
              project-name: your-vercel-project-name
              set-url-env-var: BASE_URL
    
          - name: Run Playwright suite on Endform
            run: npx endform@latest test

    run-with-vercel-deployment authenticates through GitHub OIDC (do not pass ENDFORM_API_KEY) and injects Vercel's Deployment Protection bypass header into Playwright browser contexts and request fixtures automatically.

  4. Open a pull request and check the result

    Push your changes on a branch and open a pull request. The GitHub Actions job waits for Vercel to finish building the preview, runs your suite on Endform, and reports:

    • A Vercel deployment check on the preview deployment with a link to the Endform run
    • A pull request summary comment (and inline comments on failing test lines in the diff) from the Endform GitHub App

For every action input, see the run-with-vercel-deployment reference. For skipped checks, action errors, or testing Vercel previews from another CI provider, see the Vercel FAQ.

Last updated