Variables
Use {{VAR_NAME}} to reference variables at runtime. Variables come from two sources: the project's pre-defined variables in playwright.config.ts, or values saved during the test run (e.g., via save_variable or Extract actions).
yaml
statements:
- intent: Type username
action: input_text
text: "{{TEST_USER}}"
locator: "getByLabel('Username')"Define variables in playwright.config.ts:
ts
// playwright.config.ts
export default defineConfig({
projects: [
{
name: "default",
use: {
variables: {
TEST_USER: process.env.TEST_USER || "admin",
TEST_PASS: { value: process.env.TEST_PASS || "secret", sensitive: true },
},
},
},
],
});Variables marked sensitive: true are masked in logs and reports.
To override variables for one run without editing the config, pass --vars or --vars-file to shiplight test:
bash
bun run shiplight test --vars TEST_USER=standard_user
bun run shiplight test --vars-file ./local-vars.jsonOverrides take precedence over the config and keep its sensitive setting. See shiplight test.