Overview
Playmatic has an environment manager for storing and accessing test variables and data across different environments. Each test environment defines the different application instances your tests can target. Each environment includes a base URL and optional variables. Environments are stored in theplaymatic.config.ts file. When these variables are collected during the planning phase, the Playmatic agent will automatically write them in this file.
Each test environment key (e.g., “production”, “staging”, “development”) contains:
baseUrl(string): The base URL for the application instancevars(object, optional): Environment-specific variables accessible viaenv.varsin tests. Supports nested objects for organizing related configuration.
playmatic.config.ts
playwright.config.ts file, and afterwards, the baseUrl and vars will be accessible by any tests during runtime.
Using Test Environment Variables
To initialize your environment when running locally, use thesetEnvironment function in your playwright.config.ts file:
playwright.config.ts
env object. The baseUrl can be referenced via env.baseUrl, and any variables can be referenced using env.vars.variableName. Nested objects can be accessed via dot notation.
Next Steps
Running Tests Locally
Learn more about running tests locally.
AI actions
Learn more about AI actions.