Principle:Getgauge Taiko Runtime Configuration
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Configuration |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Mechanism for dynamically adjusting automation behavior such as timeouts, retry intervals, and observation modes at runtime.
Description
Runtime configuration allows testers to tune automation behavior without modifying test scripts. Key configurable aspects include: navigation timeout (how long to wait for pages to load), retry interval and timeout (how aggressively to poll for elements), observation mode (slow-motion execution for visual debugging), and navigation waiting behavior (what constitutes a fully loaded page).
Configuration can be set programmatically in scripts or via environment variables, allowing the same tests to run differently in development (slow, headful) versus CI (fast, headless) environments. This separation of configuration from test logic follows the principle of externalizing environment-specific concerns.
The configuration system supports runtime modification, meaning settings can be changed mid-execution. This is useful for scenarios where certain test steps require longer timeouts (such as file uploads or complex page loads) while the overall test suite uses shorter defaults for speed.
Usage
Set configuration at the beginning of test scripts or in test framework setup hooks. Use environment variables (TAIKO_NAVIGATION_TIMEOUT, TAIKO_RETRY_TIMEOUT, TAIKO_BROWSER_ARGS) for CI/CD environments where code changes are not desired. Adjust observeTime during development to slow down execution and visually verify test behavior. Increase retryTimeout for tests targeting slow-loading applications or unreliable network conditions.
Theoretical Basis
Configuration management follows the centralized defaults pattern:
- A single configuration object holds all settings with sensible defaults, serving as the single source of truth for automation behavior.
- Runtime modifications update this central object via a setter function that validates input types and merges partial updates with existing values.
- All API functions read from the central configuration object at execution time, ensuring changes take effect immediately without requiring re-initialization.
- Environment variables take precedence during initialization, allowing external override of defaults before any test code executes.
- Type validation ensures configuration integrity by rejecting invalid values (such as non-numeric timeouts) and preserving the expected data types for each setting.
This pattern provides a clean separation between default behavior, programmatic overrides, and environment-level overrides, with a clear precedence order that makes the effective configuration predictable and debuggable.