Skip to main content

Configuration Reference

Praman uses a Zod-validated configuration system. All fields have defaults — an empty {} is valid.

Config File

Create praman.config.ts in your project root:

import { defineConfig } from 'playwright-praman';

export default defineConfig({
logLevel: 'info',
ui5WaitTimeout: 30_000,
controlDiscoveryTimeout: 10_000,
interactionStrategy: 'ui5-native',
discoveryStrategies: ['direct-id', 'recordreplay'],
auth: {
strategy: 'basic',
baseUrl: process.env.SAP_BASE_URL!,
username: process.env.SAP_USER!,
password: process.env.SAP_PASS!,
client: '100',
language: 'EN',
},
ai: {
provider: 'azure-openai',
apiKey: process.env.AZURE_OPENAI_KEY,
endpoint: process.env.AZURE_OPENAI_ENDPOINT,
deployment: 'gpt-4o',
},
telemetry: {
openTelemetry: false,
exporter: 'otlp',
endpoint: 'http://localhost:4318',
serviceName: 'sap-e2e-tests',
},
});

Top-Level Options

FieldTypeDefaultDescription
logLevel'error' | 'warn' | 'info' | 'debug' | 'verbose''info'Pino log level
ui5WaitTimeoutnumber30_000Max ms to wait for UI5 stability
controlDiscoveryTimeoutnumber10_000Max ms for control discovery
interactionStrategy'ui5-native' | 'dom-first' | 'opa5''ui5-native'How to interact with controls
discoveryStrategiesstring[]['direct-id', 'recordreplay']Ordered strategy chain
skipStabilityWaitbooleanfalseSkip waitForUI5Stable(), use brief DOM settle
preferVisibleControlsbooleantruePrefer visible controls over hidden ones
ignoreAutoWaitUrlsstring[][]Additional URL patterns to block (WalkMe, analytics)

Auth Sub-Schema

FieldTypeDefaultDescription
strategy'btp-saml' | 'basic' | 'office365' | 'custom''basic'Authentication strategy
baseUrlstring (URL)requiredSAP system base URL
usernamestringLogin username
passwordstringLogin password
clientstring'100'SAP client number
languagestring'EN'SAP logon language

AI Sub-Schema

FieldTypeDefaultDescription
provider'azure-openai' | 'openai' | 'anthropic''azure-openai'LLM provider
apiKeystringOpenAI / Azure OpenAI API key
anthropicApiKeystringAnthropic API key (separate for security)
modelstringModel name (e.g., 'gpt-4o', 'claude-sonnet-4-6')
temperaturenumber0.3LLM temperature (0-2)
maxTokensnumberMax tokens per response
endpointstring (URL)Azure OpenAI resource endpoint
deploymentstringAzure OpenAI deployment name
apiVersionstringAzure API version

Telemetry Sub-Schema

FieldTypeDefaultDescription
openTelemetrybooleanfalseEnable OpenTelemetry tracing
exporter'otlp' | 'azure-monitor' | 'jaeger''otlp'Trace exporter
endpointstring (URL)Exporter endpoint URL
serviceNamestring'playwright-praman'Service name in traces

Selectors Sub-Schema

FieldTypeDefaultDescription
defaultTimeoutnumber10_000Default selector timeout (ms)
preferVisibleControlsbooleantruePrefer visible controls
skipStabilityWaitbooleanfalseSkip stability wait for selectors

OPA5 Sub-Schema

FieldTypeDefaultDescription
interactionTimeoutnumber5_000OPA5 interaction timeout (ms)
autoWaitbooleantrueAuto-wait for OPA5 readiness
debugbooleanfalseEnable OPA5 debug mode

Environment Variable Overrides

Top-level config fields can be overridden via environment variables:

Environment VariableConfig Field
PRAMAN_LOG_LEVELlogLevel
PRAMAN_UI5_WAIT_TIMEOUTui5WaitTimeout
PRAMAN_CONTROL_DISCOVERY_TIMEOUTcontrolDiscoveryTimeout
PRAMAN_INTERACTION_STRATEGYinteractionStrategy
PRAMAN_SKIP_STABILITY_WAITskipStabilityWait

Precedence (highest to lowest):

  1. Per-call options (e.g., ui5.control({ ... }, { timeout: 5000 }))
  2. Selectors sub-schema config
  3. Top-level config
  4. Environment variable overrides
  5. Schema defaults

Complete playwright.config.ts Example

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: './tests/e2e',
timeout: 120_000,
expect: { timeout: 10_000 },
fullyParallel: false,
retries: 1,
workers: 1,
reporter: [
['html', { open: 'never' }],
['playwright-praman/reporters', { type: 'compliance', outputDir: 'reports' }],
],
use: {
baseURL: process.env.SAP_BASE_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{
name: 'setup',
testMatch: /auth-setup\.ts/,
teardown: 'teardown',
},
{
name: 'teardown',
testMatch: /auth-teardown\.ts/,
},
{
name: 'chromium',
dependencies: ['setup'],
use: {
...devices['Desktop Chrome'],
storageState: '.auth/sap-session.json',
},
},
],
});

Validation

Config is validated with Zod at load time. Invalid config fails fast:

import { loadConfig } from 'playwright-praman';

const config = await loadConfig();
// Throws ConfigError with ERR_CONFIG_INVALID if schema fails
// Returns Readonly<PramanConfig> — deeply frozen, mutation throws