---
title: Variables
description: "Reference runtime values in YAML E2E tests with {{VAR_NAME}}, defined in playwright.config.ts or saved during a run."
---

# Variables

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

Use <code v-pre>{{VAR_NAME}}</code> 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.
