Synthetic tests configurationedit

[beta] This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features. Synthetic tests support the configuration of dynamic parameters that can be used in the suites. In addition, the Synthetics agent, which is built on top of Playwright, supports configuring browser and context options that are available in Playwright specific methods, for example, ignoreHTTPSErrors, extraHTTPHeaders and viewport.

Global Synthetics Configurationedit

Create a synthetics.config.js or synthetics.config.ts file in the root of the synthetics project and specify the options:

import { SyntheticsConfig } from "@elastic/synthetics"

const config: SyntheticsConfig = {
  params: {
    url: "https://www.elastic.co"
  },
  playwrightOptions: {
    ignoreHTTPSErrors: true, // ignores all HTTPS errors during navigation
    extraHTTPHeaders: {
      "foo": "bar" // additional HTTP headers to be sent with every request
    }
  }
}

export default config;

The configuration file can either export an object, or a function that when called should return the generated configuration. To know more about configuring the tests based on environments, look at the dynamic configuration documentation.

Device emulationedit

Users can emulate a mobile device using the configuration file. The example configuration below runs tests in "Pixel 5" emulation mode.

import { SyntheticsConfig } from "@elastic/synthetics"
import { devices } from "playwright-chromium"

const config: SyntheticsConfig = {
  playwrightOptions: {
    ...devices['Pixel 5']
  }
}

export default config;

Synthetics tests configuration can only be used along with synthetics projects and is not available for inline suites.