Version: 1.5

Test Settings

The TestSettings is used to configure how you want Element to behave during a test run, including wait timing, timeouts, browser agent, window size, and much more.

Settings are specified by exporting a const settings from your test script, and loaded when your test script is first evaluated by the test runner.

Example:

export const settings: TestSettings = {
loopCount: Infinity,
clearCache: true
}

See DEFAULT SETTINGS for a list of the default value for each setting.

Setting Properties#

actionDelay#

number (Optional) Specifies the time (in seconds) to wait between each action call.

Waiting between actions simulates the behaviour of a real user as they read, think and act on the page's content.

blockedDomains#

string\[] (Optional) Blocks requests to a list a domains. Accepts partial matches using * or any matcher accepted by Micromatch.

Matching is applied to the hostname only, unless the blocked domain contains a : in which case it will match against hostname and port.

Example: ["*.google-analytics.com", "*:1337"]

chromeVersion#

puppeteer or stable (Optional) Specifies a version of Google Chrome to run the test

clearCache#

false | true (Optional) Specifies whether Browser cache should be cleared after each test loop.

clearCookies#

false | true (Optional) Specifies whether cookies should be cleared after each test loop.

consoleFilter#

ConsoleMethod(Optional) Specify which console methods to filter out. By default no console methods are filtered.

This setting can be useful for very noisy tests. When a method is filtered, it still works as normal but the message will be omitted from the Element output.

description#

string (Optional) Speicifies the description of the test specified in the comments section

device#

string (Optional) Specifies a device to emulate with browser device emulation.

disableCache#

false | true (Optional) Disables browser request cache for all requests.

duration#

number (Optional) Maximum duration to run the test for.

Note that when running a load test via Flood, the duration of the load test takes precedence over this setting.

Defaults to -1 for no timeout.

extraHTTPHeaders#

Object (Optional) Specifies a set of extra HTTP headers to set before each test loop.
If this setting is undefined, the extra HTTP headers are left as-is between iterations.

export const settings: TestSettings = {
extraHTTPHeaders: { 'Accept-Language': 'en' },
}

ignoreHTTPSErrors#

false | true (Optional) Whether to ignore HTTPS errors during navigation. Defaults to false

incognito#

false | true (Optional) Controls whether each iteration should run within an Incognito window instead of a normal
window. The Incognito session will be destroyed between each loop.

launchArgs#

string[] Additional arguments to pass to the browser instance. The list of Chromium flags can be found here

loopCount#

number (Optional) Number of times to run this test.

Defaults to -1 (or Infinity) for an unlimited number of loops.

name#

string (Optional) Speicifies the name of the test specified in the comments section

responseTimeMeasurement#

ResponseTiming (Optional) Configures how we record response time for each step.

Possible values:

  • "page": Record the document loading response time. This is usually what you consider response time on paged web apps.
  • "network": Takes the mean response time of all network requests which occur during a step. This is useful for Single Page Application which don't actually trigger a navigation.
  • "step": (Default) Records the wall clock time of a step. This is useful for Single Page Application which don't actually trigger a navigation.
  • "stepWithThinkTime": Records the wall clock time of a step including actionDelay time.

screenshotOnFailure#

false | true (Optional) Take a screenshot of the page when a command fails, to aid in debugging.

Screenshots are saved to /flood/result/screenshots in the test archive.

stepDelay#

number (Optional) Specifies the time (in seconds) to wait after each step.

userAgent#

string (Optional) Specifies a custom User Agent (UA) string to send.

viewport#

Object Set the viewport with the below properties:

  • width number page width in pixels. Required.
  • height number page height in pixels. Required.
  • deviceScaleFactor number Specify device scale factor (can be thought of as dpr). Defaults to 1.
  • isMobile boolean Whether the meta viewport tag is taken into account. Defaults to false.
  • hasTouch boolean Specifies if viewport supports touch events. Defaults to false.
  • isLandscape boolean Specifies if viewport is in landscape mode. Defaults to false.

waitTimeout#

number (Optional) Global wait timeout applied to all wait tasks.

waitUntil : (Optional)#

  • present: only checks for presence in the DOM
  • visible: waits until the element is visible on the page and is painted
  • ready: waits until the element is painted and not disabled

Console Method#

Specifies a console method

"log" | "info" | "debug" | "warn" | "error"

ResponseTiming#

Specifies a method for recording response times.

literaldescription
step(Default) Records the wall clock time of a step. This is useful for Single Page Application which don't actually trigger a navigation.
pageRecord the document loading response time. This is usually what you consider response time on paged web apps.
network(Experimental) Takes the mean response time of all network requests which occur during a step. This is useful for Single Page Application which don't actually trigger a navigation.
stepWithThinkTime"stepWithThinkTime": Records the wall clock time of a step including actionDelay time.
"page" | "network" | "step" | "stepWithThinkTime"

setup(settings)#

  • settings <[TestSettings]>

  • returns: <void>

Declares the settings for the test, overriding the settings constant exported in the test script.

This is a secondary syntax for export const settings = {} which functions exactly the same way.

Example:

export default () => {
setup({ waitTimeout: 60 })
}

DEFAULT SETTINGS#

The default settings for a Test. Any settings you provide are merged into these defaults.

NameDefault ValueComment
actionDelay2
blockedDomains[]
chromeVersion"puppeteer"
clearCachefalse
clearCookiestrue
consoleFilter[]by default, don't filter any console messages from the browser
description""
device"Chrome Desktop Large"
disableCachefalse
duration-1
extraHTTPHeaders
ignoreHTTPSErrorsfalse
incognitofalse
loopCountInfinity
name"Element Test"
responseTimeMeasurement"step"
screenshotOnFailuretrue
stepDelay6
userAgentCustomDeviceDescriptors['Chrome Desktop Large'].userAgent
waitTimeout30
waitUntilfalse