Configuration Syntax: TestCafe

Please refer to the Common Configuration Syntax Referencefor information regarding fields such as apiVersion, kind, and sauce.

TestCafe Considerations#

Execution time for TestCafe tests is limited to a maximum of 30 minutes. If the limit is exceeded, the test terminates and Sauce Control uploads assets (videos, screenshots, logs, etc..) to the Sauce Labs platform.

Consider breaking up longer TestCafe tests to optimize performance and ensure you do not exceed this time limit.

Example Configuration#

.sauce/config.yml
loading...
See full example on GitHub

testcafe#

Description: Details specific to the testcafe project configuration.

Type: object

Example:

testcafe:
version: ##VERSION##

version#

Description: Version of testcafe to use during tests

Type: string

Example:

version: ##VERSION##

suites#

Description: Field for defining test suite details such as the suite name, desired browserName, and test configurations.

Type: object

Examples:

.sauce/config.yml
loading...
See full example on GitHub
.sauce/config.yml
loading...
See full example on GitHub

name#

Description: Name of the test suite.

Type: string

Example:

- name: "saucy test"

browserName#

Description: Name of desired browser. Although Testcafe supports triggering one test in multiple browsers, it is better here to split them into every suite to indicate each suite has its own test point.

Type: string

Example:

browserName: "chrome"

src#

Description: The explicit name, file glob, or location of the test files.

Type: object

Example:

src:
- "tests/test_file1.test.js"
- "tests/integrations"
- "*/*.test.js"

devices#

Sauce Cloud only

Description: Field for defining device details such as device name, platformName, platformVersions.

Type: object

Example:

devices:
- name: iPhone 12 Simulator
platformName: iOS
platformVersions:
- "14.3"

env#

Description: Environment variables. Substituted variables like $MY_VAR can be expanded.

Type: object

Example:

env:
hello: world
foo: $MY_BAR

screenshots#

Description: Screenshots settings for testcafe. See link in Testcafe.

Type: object

Example:

screenshots:
takeOnFails: true
fullPage: true

speed#

Description: Specifies the test execution speed. Tests are run at the maximum speed by default. You can use this option to slow the test down. Provide a number between 1 (the fastest) and 0.01 (the slowest).

Type: float64

Example:

speed: 1

platformName#

Sauce Cloud only

Description: Operating system on which the browser and test runs.

Type: string

Example:

platformName: "Windows 10"

screenResolution#

Sauce Cloud only

Description: Set browser window screen resolution.

Type: string

Example:

screenResolution: "1920x1080"

disableScreenshots#

Description: Prevents TestCafe from taking screenshots. TestCafe disableScreenshots definition.

Type: boolean

Example:

disableScreenshots: true

tsConfigPath#

Description: The absolute or relative path to the TypeScript configuration file. Relative paths are resolved against the current directory (the directory from which you run TestCafe).

Type: string

Example:

tsConfigPath: /path/to/file

clientScripts#

Description: Injects scripts into all pages visited during the test. TestCafe clientScripts definition.

Type: array

Example:

clientScripts: ["/path/to/file1", "/path/to/file2"]

skipJsErrors#

Description: Ignores JavaScript errors on a webpage. Testcafe skipJsErrors definition.

Type: boolean

Example:

skipJsErrors: true

quarantineMode#

Description: Enables the quarantine mode for tests that fail. Testcafe quarantineMode definition.

Type: boolean

Example:

quarantineMode: true

skipUncaughtErrors#

Description: Ignores uncaught errors and unhandled promise rejections in test code. Testcafe skipUncaughtErrors definition.

Type: boolean

Example:

skipUncaughtErrors: true

selectorTimeout#

Description: Specifies the time (in milliseconds) within which selectors attempt to return a node. Testcafe selectorTimeout definition.

Type: int

Example:

selectorTimeout: 1000

assertionTimeout#

Description: Specifies the time (in milliseconds) TestCafe attempts to successfully execute an assertion if a selector property or a client function was passed as an actual value. Testcafe assertionTimeout definition.

Type: int

Example:

assertionTimeout: 1000

pageLoadTimeout#

Description: Specifies the time (in milliseconds) passed after the DOMContentLoaded event, within which TestCafe waits for the window.load event to fire. Testcafe pageLoadTimeout definition.

Type: int

Example:

pageLoadTimeout: 1000

stopOnFirstFail#

Description: Stops a test run if a test fails. Testcafe stopOnFirstFail definition.

Type: boolean

Example:

stopOnFirstFail: true

disablePageCaching#

Description: Prevents the browser from caching page content. Testcafe disablePageCaching definition.

Type: boolean

Example:

disablePageCaching: true
Last updated on by Nancy Sweeney