Advanced configuration
There are 3 ways to specify test configuration:
- Arguments to
eyes.open()
- Environment variables
- The
applitools.config.js
file
The list above is also the order of precedence, which means that if you pass a property to eyes.open
it will override the environment variable, and the environment variable will override the value defined in the applitools.config.js
file.
Configuration properties
Property name | Default value | Description |
---|---|---|
testName | undefined | The test name |
browser | { width: 800, height: 600, name: 'chrome' } | The size and browser of the generated screenshots. This does not need to be the same as the browser that TestCafe is running. It could be a different size and browser. For more info and possible values, see the browser section below. Note: for best performance, if possible Eyes resizes the viewport to the given browser size. |
batchId | random | Provides ability to group tests into batches. For further information, see Grouping tests into batches with the SDK in the Eyes documentation. |
batchName | The name of the first test in the batch | Provides a name to the batch (for display purpose only). |
baselineEnvName | undefined | The name of the environment of the baseline. |
envName | undefined | A name for the environment in which the application under test is running. |
ignoreCaret | false | Whether to ignore or the blinking caret or not when comparing images. |
matchLevel | Strict | The method to use when comparing two screenshots, which expresses the extent to which the two images are expected to match. Possible values are Strict , Exact , Layout and IgnoreColors . For further information, see How to use Eyes match levels in the Eyes documentation. |
baselineBranchName | undefined | The name of the baseline branch. |
parentBranchName | undefined | Sets the branch under which new branches are created. |
saveFailedTests | false | Set whether or not failed tests are saved by default. |
saveNewTests | false | Set whether or not new tests are saved by default. |
properties | undefined | Custom properties for the eyes test. The format is an array of objects with name/value properties. For example: [{name: 'My prop', value:'My value'}] . |
ignoreDisplacements | false | Sets whether Test Manager should intially display mismatches for image features that have only been displaced, as opposed to real mismatches. |
compareWithParentBranch | false | If true , the test will take a baseline from the parent branch. If the parent branch does not have a baseline, a new baseline will be created in the current branch. |
ignoreBaseline | false | |
notifyOnCompletion | false | If true batch completion notifications are sent. |
accessibilityValidation | undefined | An object that specifies the accessibility level and guidelines version to use for the screenshots. Possible values for level are None , AA , and AAA , and possible values for guidelinesVersion are WCAG_2_0 and WCAG_2_1 . For example: {level: 'AA', guidelinesVersion: 'WCAG_2_0'} |
Global configuration properties
The following configuration properties cannot be defined using the first method of passing them to eyes.open
. They should be defined either in the applitools.config.js
file or as environment variables.
Property name | Default value | Description |
---|---|---|
apiKey | undefined | The API key used for working with the Applitools Eyes server. |
showLogs | false | Whether or not you want to see logs. Logs are written to the same output of the TestCafe process. Note that you can also use DEBUG=eyes* for debugging. |
serverUrl | Default Eyes server URL | The URL of Eyes server |
proxy | undefined | Sets the proxy settings to be used in network requests to Eyes server. This can be either a string to the proxy URI, or an object containing the URI, username, and password. For example: {url: 'https://myproxy.com:443', username: 'my_user', password: 'my_password', isHttpOnly: false} or: https://username:password@myproxy.com:443 |
isDisabled | false | If true , all api calls to Eyes-Testcafe are ignored. |
failTestcafeOnDiff | true | If true , then the TestCafe test fails if an eyes visual test fails. If false and an Eyes test fails, then the TestCafe test does not fail. |
tapDirPath | undefined | Directory path of a results file. If set, then a TAP file is created. in this directory when using the waitForResults command in your test. The tap file name is created with the name eyes< ISO-DATE>.tap and contains the Eyes test results Note that results are scoped per spec file, this means that the results file is created once for each fixture file). |
concurrency | 1 | The maximum number of tests that can run concurrently. The default value is the allowed amount for free accounts. For paid accounts, set this number to the quota set for your account. |
dontCloseBatches | false | If true , batches are not closed for notifyOnCompletion. |
disableBrowserFetching | false | If true , the SDK will fetch the resources needed for UFG rendering from outside of the browser (useful for sites with large payloads). |
Method 1: Arguments for eyes.open
Pass a config object as the only argument.
Example
eyes.open({
appName: 'My app',
batchName: 'My batch',
...
// all other configuration variables apply
})
Method 2: Environment variables
The name of the corresponding environment variable is in uppercase, with the APPLITOOLS_
prefix, and separating underscores instead of camel case:
APPLITOOLS_APP_NAME
APPLITOOLS_SHOW_LOGS
APPLITOOLS_BATCH_NAME
APPLITOOLS_CONCURRENCY
APPLITOOLS_SAVE_DEBUG_DATA
APPLITOOLS_BATCH_ID
APPLITOOLS_BATCH_NAME
APPLITOOLS_BASELINE_ENV_NAME
APPLITOOLS_ENV_NAME
APPLITOOLS_IGNORE_CARET
APPLITOOLS_IS_DISABLED
APPLITOOLS_MATCH_LEVEL
APPLITOOLS_MATCH_TIMEOUT
APPLITOOLS_BRANCH_NAME
APPLITOOLS_BASELINE_BRANCH_NAME
APPLITOOLS_PARENT_BRANCH_NAME
APPLITOOLS_SAVE_FAILED_TESTS
APPLITOOLS_SAVE_NEW_TESTS
APPLITOOLS_COMPARE_WITH_PARENT_BRANCH
APPLITOOLS_IGNORE_BASELINE
APPLITOOLS_SERVER_URL
APPLITOOLS_PROXY
APPLITOOLS_NOTIFY_ON_COMPLETION
Method 3: The applitools.config.js
file
You can have a file called applitools.config.js
at the same folder location as .testcaferc.json
. (The directory from which you run TestCafe. This is usually the project's root directory).
In this file specify the desired configuration, in a valid JSON format.
Example
module.exports = {
appName: 'My app',
showLogs: true,
batchName: 'My batch'
...
// all other configuration variables apply
}