Implementation:Getgauge Taiko Gauge Env Properties
| Knowledge Sources | |
|---|---|
| Domains | Testing, Configuration, Environment |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete mechanism for managing environment-specific test settings through Gauge property files and Taiko's setConfig() runtime API.
Description
Gauge uses .properties files in the env/ directory to configure test execution behavior. The Taiko repository's functional test suite demonstrates this with three property files under test/functional-tests/env/default/:
- default.properties — Framework configuration: report directory, screenshot behavior, spec directory, log directory.
- headless.properties — Browser display mode:
headless = true. - js.properties — Runner settings:
test_timeout = 240000,DEBUG = false.
All properties become environment variables at runtime. The hooks.ts lifecycle hooks read these values:
const headless = process.env.headless.toLowerCase() === "true";
Additionally, Taiko's own environment variables control browser behavior:
TAIKO_BROWSER_ARGS— Browser launch argumentsTAIKO_BROWSER_PATH— Custom browser binary pathTAIKO_NAVIGATION_TIMEOUT— Navigation timeout in msTAIKO_RETRY_TIMEOUT— Element retry timeout in ms
The setConfig() API in @BeforeSuite() hooks provides programmatic runtime configuration:
@BeforeSuite()
public async beforeSuite() {
await startServer();
setConfig({ navigationTimeout: 60000 });
}
Usage
This implementation is used when configuring different test execution environments (local development, CI/CD, Docker). Create additional environment directories (e.g., env/ci/) and select them with gauge run --env ci.
Code Reference
Source Location
- Repository: Taiko
- Reference Files:
test/functional-tests/env/default/— Property filestest/functional-tests/tests/hooks.ts(L53-56) — BeforeSuite with setConfigtest/functional-tests/manifest.json— Gauge manifestlib/config.js(L1-47) — Taiko config defaults reading env vars
I/O Contract
Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| .properties files | Key-value text | Yes | — | Gauge property files in env/{envName}/ directories.
|
| Environment variables | System env | No | — | TAIKO_* environment variables overriding Taiko defaults.
|
| setConfig options | Object | No | — | Runtime config object passed to setConfig() in lifecycle hooks.
|
Outputs
| Name | Type | Description |
|---|---|---|
| Runtime configuration | Environment state | Properties loaded as environment variables; Taiko config object updated with specified values. |
Related Pages
Implements Principle
Requires Environment
See Also
- Getgauge_Taiko_Gauge_Init — Project scaffold creating the env/ directory
- Getgauge_Taiko_Gauge_Step_Decorators — Lifecycle hooks consuming configuration
- Getgauge_Taiko_Gauge_Run — Execution selecting the active environment
- Getgauge_Taiko_SetConfig — The Taiko setConfig() API used in hooks