Skip to content

Transfer State to Remote Runners

Let’s breifly review endform’s architecture.

A diagram of endform's local CLI speaking to a remote coordination server, which then schedules tests on remote runners.

When you use endform to run your tests, they are are packaged, uploaded, and scheduled on many remote machines in the cloud.

This means that each test running on a remote machine might not have access to things that you have on your local machine, such as environment variables or files.

Your tests may depend on things like:

  • An environment variable that declares the url of your preview environment
  • A file that contains authentication credentials or cookies (storageState in your playwright config)
  • An image in your file system that is used as a screenshot reference

Endform will try to detect and transfer many commonly used pieces of state to the remote runners automatically. You may need to do some additional configuration to transfer more state, depending on your setup.

Endform can detect and transfer the following pieces of state automatically:

  • JS/TS files and dependencies - all js/ts files that are needed for your tests to run, including package.json’s, tsconfig.json’s, and node_modules dependencies
  • Your playwright config - for more information on supported options, see the requirements
  • storageState - any files that are listed in the storageState option of your playwright config

Environment variables are often highly sensitive in nature.

In order for endform to reduce it’s exposure to sensitive data, only some environment variables are automatically transferred to the remote runners.

  • E2E_* - any environment variables that start with E2E_ are transferred
  • Environment variables that are used / referenced from your tests via process.env are picked up.

The values of the environment variables are taken while running your playwright.config.ts so - using a package like dotenv in your playwright config is supported.

In order to get a better understanding of which environment variables are transferred, you can use the --debug flag when running your tests endform test --debug. This will print out the environment variables that are transferred to the remote runners.

Endform has two additional ways of transferring state to the remote runners:

  • Environment Variables - environmentVariables in your endform.jsonc config
  • Files - additionalFiles in your endform.jsonc config

For more information on these options, see the endform config reference.