Skip to main content
Playmatic uses a configuration file (playmatic.config.ts) to control two main categories of settings: Runtime Settings that affect how tests execute, and Test Environments that define the application instances your tests can target.

Runtime Settings

Runtime settings control the default behavior and performance characteristics of your test execution.
playmatic.config.ts
export default {
  defaultEnv: "development",
  cacheSettings: {
    actionTimeout: 30000, // 30 seconds
  },
  // environments defined below...
};

defaultEnv (string)

Specifies which environment to use when no environment is explicitly provided.

cacheSettings (object)

Performance configuration for test execution:
  • actionTimeout (number): Timeout in milliseconds for cached actions like .click(), .fill()
    • Default: 10000 (10 seconds)

Test Environments

Test environments define the different application instances your tests can target. Each environment includes a base URL and optional variables.

Test Environment Structure

Each test environment key (e.g., “production”, “staging”, “development”) contains:
  • baseUrl (string): The base URL for the application instance
  • vars (object, optional): Environment-specific variables accessible via env.vars in tests
playmatic.config.ts
export default {
  ...
  env: {
    production: {
      baseUrl: "https://playmatic.ai",
      vars: {
        TEST_USER_EMAIL: "test@playmatic.ai",
        TEST_USER_PASSWORD: "TestPass123!",
        ENVIRONMENT_NAME: "production",
      },
    },
    staging: {
      baseUrl: "https://staging.playmatic.ai",
      vars: {
        TEST_USER_EMAIL: "staging-test@playmatic.ai",
        TEST_USER_PASSWORD: "StagingPass123!",
        ENVIRONMENT_NAME: "staging",
      },
    },
    development: {
      baseUrl: "http://localhost:3000",
      vars: {
        TEST_USER_EMAIL: "dev@localhost",
        TEST_USER_PASSWORD: "DevPass123!",
        ENVIRONMENT_NAME: "development",
      },
    },
  },
};

Selecting Test Environments

Test environments can be selected when running tests:
  • Locally via CLI: Use the --env flag to override the default test environment
  • In CI: Configure the test environment in your GitHub Actions workflow file

Using Environment Variables

Access environment variables in your tests using env.vars:
await testStep('Login with test credentials', async () => {
  const testEmail = env.vars.TEST_USER_EMAIL;
  const testPassword = env.vars.TEST_USER_PASSWORD;

  await page.fill('[data-testid="email"]', testEmail);
  await page.fill('[data-testid="password"]', testPassword);
}, { page });

Next Steps