GuidesUsing Endform

Test against a local server

Run your Playwright suite on Endform against an app running on your laptop, in a CI job, or inside a private network.

Endform runs your Playwright tests on remote browsers in Endform's cloud and reaches localhost and private networks over encrypted peer-to-peer tunnels through the Endform CLI — whether the CLI runs on your laptop, in a CI job, or on a machine connected to a VPN. If your playwright.config.ts already defines a webServer, Endform sets this tunnel up automatically with no extra configuration; for already-running servers, private hosts, or local databases, a few lines in endform.config.ts tell Endform which traffic to route through the CLI.

You need a Playwright suite connected to Endform (see Quickstart) and a local or private server your machine can reach.

Working with a coding agent? Give it this prompt and it will configure local proxying for you:

Prompt for your coding agent
Configure this Playwright project to test against our local server on Endform by following https://endform.dev/docs/using-endform/local-server.md.
Run the suite on Endform and confirm requests reach the local server.

How traffic reaches your server

Traffic flow between Endform cloud and your machine or private network: multiple remote browsers send matched hosts and ports over an encrypted peer-to-peer tunnel to the Endform CLI, which forwards requests to your local app (such as localhost:3000) and optionally private hosts or local databases. Unmatched public internet traffic goes directly from the remote browsers.

Only requests matching your webServer or configured hosts and ports travel through the CLI. Traffic to public domains — such as CDNs, fonts, or third-party APIs — goes directly from the remote browsers to the internet.

Configure your local target

Pick the option that matches how your server runs:

If your playwright.config.ts defines a webServer (or an array of servers), no extra Endform configuration is needed. Endform runs webServer locally on the machine running the CLI, omits it on the remote runners, and automatically proxies traffic for its host and port.

playwright.config.ts
import { defineConfig } from "@playwright/test";

export default defineConfig({
  webServer: {
    command: "npm run dev",
    url: "http://localhost:3000",
    reuseExistingServer: !process.env.CI,
  },
  use: {
    baseURL: "http://localhost:3000",
  },
});

Run and check that it worked

  1. Start your server

    Skip this step if Playwright starts the server via webServer. Otherwise, make sure the app or internal host is reachable from the machine running the CLI.

  2. Run your suite on Endform

    npx endform@latest test
  3. Verify traffic reached your server

    Watch your local server's logs for incoming requests while the run executes, then open the dashboard link printed by the CLI. Every test should pass and show your local app in its replay.

Keep your local server healthy under parallel load

Endform schedules every test on its own remote machine at the same time, so a 50-test suite sends 50 browsers to your single local server simultaneously. A single-threaded dev server (such as next dev or vite) or a small CI runner can start timing out under that burst.

  • Cap concurrency if your server saturates. Add concurrentTestLimits in endform.config.ts to match what your local server can serve cleanly:

    endform.config.ts
    import { defineEndformConfig } from "endform";
    
    export default defineEndformConfig({
      proxyNetworkHosts: ["<loopback>"],
      concurrentTestLimits: [{ scope: "within-suite-run", limit: 10 }],
    });
  • Use a production build in CI. When running a local server inside a CI job, build and start the production server (npm run build && npm run start) instead of a dev server with hot reloading. It handles concurrent requests faster and matches production behavior.

  • Keep local dev and deployed CI working in one config. Read BASE_URL when CI targets a staging or preview deployment, and start webServer only when BASE_URL is unset:

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

When to use a deployed environment instead

Proxying through the CLI is a fast way to iterate locally, test an app started inside a CI job, or reach internal hosts behind a VPN. Once your suite grows or you want full speed on every pull request, a deployed staging or preview environment is usually a better fit:

Local server proxyDeployed staging or preview
SetupZero infrastructure; works with webServer or proxyNetworkHostsNeeds a deployed URL or preview integration (Vercel, Netlify)
ParallelismBounded by your laptop or CI runner's CPU and memoryScales cleanly to full suite parallelism
LatencyExtra round-trip from remote runners through the CLI machineDirect connection from remote runners to your app
Best fitLocal iteration, CI-local Docker/app stacks, private/VPN hostsPull-request checks and large suites

Last updated