GuidesUsing Endform

Test Netlify Deploy Previews

Run your Playwright suite on Endform automatically after every Netlify Deploy Preview publishes, with no separate CI workflow.

The Endform Netlify extension runs your Playwright suite on Endform automatically as soon as Netlify publishes a Deploy Preview. You do not need a separate CI workflow or manually managed API keys.

Working with a coding agent? Give it this prompt and it will prepare your Playwright config and tell you which clicks to make in Netlify:

Prompt for your coding agent
Prepare this Playwright project to test Netlify Deploy Previews with
Endform by following
https://endform.dev/docs/using-endform/netlify-deploy-previews.md.
Update playwright.config.ts to read BASE_URL, confirm @playwright/test
is installed in the Netlify project's package.json, and list the
Netlify dashboard steps I need to complete.

Set up the Netlify extension

Make sure @playwright/test is listed in the package.json of your Netlify project's base directory so the extension can invoke your suite after the build.

  1. Install and connect the Endform extension in Netlify

    Install the Endform extension on your Netlify team. You need to be an owner or admin of the Endform organization you connect.

    On the installed extension page, click Connect and sign in to link your Netlify team to your Endform organization.

  2. Configure your Netlify project

    Open your project in Netlify, go to Extensions → Endform, and click Configure project.

    Endform creates a dedicated per-project API key inside the extension's private configuration. Leave Playwright config path empty if playwright.config.ts is in the project's base directory, or set it to a relative folder or file path (for example e2e) if your suite lives in a subdirectory.

  3. Read BASE_URL in playwright.config.ts

    The extension sets BASE_URL to the published Deploy Preview URL automatically. Update playwright.config.ts so Endform uses process.env.BASE_URL on Deploy Previews and falls back to your local dev server locally:

    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,
      },
    });
  4. Confirm Deploy Preview visibility

    Endform's remote browsers open your Deploy Preview as external visitors. Check Project configuration → General → Visitor access → Project visibility in Netlify (Deploy Previews can be configured separately from production):

    • Public Deploy Previews: Ready to test with no extra code (production can remain private).
    • Password-protected Deploy Previews (Netlify Pro): Supported by exchanging the preview password for Netlify's session cookie in a Playwright fixture. See Private and password-protected Deploy Previews for the full code recipe.
    • Private Deploy Previews: Private previews require signing in with a Netlify account, and your Netlify team's default can make new projects private. Switch Deploy Preview visibility to public or password-protected so Endform's browsers can reach the preview.
  5. Connect the GitHub App for pull request checks (recommended)

    Install the Endform GitHub App on your repository so every Deploy Preview reports a commit check named Endform (<your-project-name>) and pull request comments:

    npx endform@latest connect github

Check that it worked

Open a pull request that triggers a Netlify Deploy Preview:

  • Netlify deploy log: Once the preview publishes, the deploy log prints the Endform run summary and a link to the full report in the Endform dashboard.
  • GitHub pull request check: With the GitHub App connected, Endform (<your-project-name>) moves from queued (during the build) to running (after publish) to passed or failed.
  • Blocking merges on failures: A failing test run logs a warning in Netlify without failing the Netlify deploy itself. To block pull request merges when tests fail, mark Endform (<your-project-name>) as a required status check in your GitHub branch protection rules.
  • Environment variables for tests: Add any credentials your tests read to Netlify's environment variables scoped to Deploy Previews (E2E_* variables are forwarded automatically). If Netlify's secrets scan flags a test secret cached by your build framework, add its name to SECRETS_SCAN_OMIT_KEYS. See the Netlify FAQ.

Last updated