Accessing data

All steps has access to the following variables:

  • env: An object containing any configured environment variables, as well as any dynamic variables set through setVariable during the test. The following variables are automatically set in the env object:
    • BASE_URL : the starting URL of the test.
    • CURRENT_URL : the current URL of the active page. This is updated after every step.

In a module

Modules have their own context that is independent from any tests that include them. They can also be passed data via inputs. This can be useful when you need to test similar scenarios with different inputs.

When editing a module, you can add inputs to the module definition and use them in the module steps using the {{ }} syntax. Reference module inputs using the following syntax {{ env.INPUT_NAME}}.

Updating data

You can use the special setVariable function within JavaScript steps to modify the env global object. Non-serializable values such as functions and circular objects will be rejected.

The function signature of setVariable function is as follows:

function setVariable(name: string, value: unknown);

In a module

Modules do automatically inherit all values on env from its parent test at the time of execution. However, you can modify the parent test context by modifying env inside a Module.