ReferenceConfiguration

endform.config.ts

Every option of endform.config.ts, which sets the runner region, concurrency limits, environment variables, extra files and proxy hosts for a Playwright suite.

To configure Endform further, add an endform.config.ts or endform.config.js file to your repository. Where you put it decides what it applies to:

  • In the same folder as your Playwright suite, it applies to that suite.
  • In the root of your repository, it applies to every suite in the repository.

Endform uses the config closest to your Playwright config, so one next to a suite replaces the one in the repository root.

endform.config.ts
import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  environmentVariables: ["VERCEL_.*"],
  region: "eu",
});

If you already have an endform.jsonc or endform.json file, migrate it with:

npx endform@latest migrate-config

See endform.jsonc (legacy) for the old format.

Options

additionalFiles

An array of glob strings. Endform sends the matching files to your test machines. Patterns are relative to the directory of your Playwright config.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  additionalFiles: ["user-state/*"],
});

Files listed in storageState in your Playwright config are sent automatically, so you don't need to list them here. Use this option when your tests depend on other files implicitly.

concurrentTestLimits

Limits how many tests run at the same time. Each item has a scope, an optional label and a limit.

scope is one of:

  • "within-suite-run": limits concurrent tests within one suite run.
  • "across-all-runs": limits concurrent tests across every matching suite run your organization is running. This is a shared, global limit.

label selects the tests the limit applies to:

  • tag:@my-tag limits tests with that test tag.
  • project:project-name limits tests in that Playwright project.
  • lock:lock-name overrides the default scope or limit for tests sharing a Playwright test lock. By default, tests sharing a lock run one at a time (limit: 1) within a suite run across machines; adding a lock: entry lets you raise that limit or apply it across-all-runs.
  • Without a label, the limit applies to every test in the run.

limit is the maximum number of tests in that group that can run at the same time.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  concurrentTestLimits: [
    { scope: "within-suite-run", limit: 20 },
    { scope: "within-suite-run", label: "tag:@smoke", limit: 2 },
    { scope: "within-suite-run", label: "lock:payments", limit: 3 },
    { scope: "across-all-runs", label: "project:slow-backend", limit: 10 },
  ],
});

A test starts only when every limit that applies to it allows it. In this example:

  • Within the suite run, 20 tests can run at the same time, at most 2 of them are tagged @smoke, and up to 3 tests sharing the payments lock can run together instead of the default 1.
  • No more than 10 tests in the slow-backend project run at the same time, across every suite run in your organization.

environmentVariables

An array of regular expressions. Endform sends every environment variable whose name matches one of them to the remote runners.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  environmentVariables: ["VERCEL_.*"],
});

A pattern that starts with ! excludes the variables it matches, even ones Endform would send anyway. Patterns are not anchored, so add ^ to match only the start of a name.

Some variables are sent without being listed, such as those that start with E2E_. See What is sent to runners.

extraHttpHeaders

An object that maps header names to string values. Endform adds these headers to the Playwright browser contexts when tests run on remote runners.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  extraHttpHeaders: {
    "x-custom-auth": "my-secret-token",
    "x-bypass-protection": "token-value",
  },
});

The headers are merged into Playwright's extraHTTPHeaders option, in both the top-level use and each project's use. When your playwright.config.ts sets a header with the same name, the value from your Playwright config wins.

Override with an environment variable

The ENDFORM_EXTRA_HTTP_HEADERS environment variable overrides extraHttpHeaders. Set it to a JSON object of header names and values:

ENDFORM_EXTRA_HTTP_HEADERS='{"x-custom-auth":"env-token"}' npx endform test

When it is set, it replaces the extraHttpHeaders in endform.config.ts. The two are not merged.

organizationId

The organization this project runs in. The --organization-id flag overrides it. The suite run fails if the authenticated user has no access to the organization.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  organizationId: "my-organization-id",
});

otlpEndpoint

An OTLP/HTTP traces endpoint. Remote runners export Playwright OpenTelemetry traces to its url, with any headers you set, for example to authenticate with your tracing provider.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  otlpEndpoint: {
    url: "https://api.eu1.honeycomb.io/v1/traces",
    headers: {
      "x-honeycomb-team": process.env.HONEYCOMB_API_KEY!,
    },
  },
});

When otlpEndpoint or otlpEndpoints is set, Endform configures playwright-opentelemetry on the remote runners and propagates trace headers in browser and application traffic.

otlpEndpoints

Like otlpEndpoint, but a list, to export traces to more than one place.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  otlpEndpoints: [
    {
      url: "https://api.eu1.honeycomb.io/v1/traces",
      headers: { "x-honeycomb-team": process.env.HONEYCOMB_API_KEY! },
    },
    { url: "https://collector.internal.example/v1/traces" },
  ],
});

proxyNetworkHosts

The host names whose HTTP traffic the remote runners send to your CLI. This is the easiest way to test a local web app or API, and works by intercepting HTTP requests in Node and in the browser. The traffic travels encrypted over direct peer-to-peer connections. See Test against a local server.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  proxyNetworkHosts: ["*.test.internal-domain", "*.staging.internal-domain", "<loopback>"],
});

Each string is a match rule, one of:

  • A host name pattern, such as my-domain.com or *.internal.org
  • An IP address, such as 127.0.0.1
  • <loopback>, which matches localhost, *.localhost, 127.0.0.1 and [::1]

proxyNetworkPorts

The local loopback ports that accept raw TCP connections from the remote runners. Use this for databases and other clients that connect directly to 127.0.0.1:<port>. The traffic travels encrypted over direct peer-to-peer connections. See Test against a local server.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  proxyNetworkPorts: [5432, 6379],
});

region

The region your tests run in, "eu" or "us". By default, Endform picks the region closest to where the CLI runs. Set it when your test environment is in a different region from your CI jobs.

import { defineEndformConfig } from "endform";

export default defineEndformConfig({
  region: "eu",
});

Last updated