Templates
Extract reusable flows into template files and include them with template:.
Template file (templates/login.yaml):
yaml
params:
- username
- password
statements:
- intent: Enter username
action: input_text
locator: "getByLabel('Username')"
text: "<<username>>"
- intent: Enter password
action: input_text
locator: "getByLabel('Password')"
text: "<<password>>"
- intent: Click login
action: click
locator: "getByRole('button', { name: 'Log in' }).first()"Using the template:
yaml
goal: Purchase flow
base_url: https://example.com
statements:
- URL: /
- template: ../templates/login.yaml
params:
username: "{{TEST_USER}}"
password: "{{TEST_PASS}}"
- intent: Navigate to the checkout page
- VERIFY: Order summary is displayedTemplate params (<<username>>) are substituted at transpile time. Environment variables ({{TEST_USER}}) pass through to the generated code for runtime resolution.
Templates can be nested (max depth: 5) and circular references are detected.