Skip to main content

Configuration class

This class is used to create a configuration object that is used to configure an Eyes object by passing it to the Eyes.setConfiguration method.

You can use this configuration object instead of using the various Eyes methods and properties that set the same attributes. Typically you set up a Configuration object by calling its setXXXX methods chained with a '.' in a Fluent coding style. In this class, some attributes can be set by both a property and a set command. The properties allow you simple direct access to assign to and retrieve the attribute. The corresponding set method allows you to set multiple attributes using a Fluent style.

Require statement

const {Configuration} = require('@applitools/eyes-images');

Configuration method

Syntax

let config = new Configuration();

Parameters

This method does not take any parameters.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

addProperty method

Syntax

let configval = config.addProperty(property);

let configval = config.addProperty(propertyName, propertyValue);

Parameters

property

Type:

PropertyData|PropertyDataObject

An object of type PropertyData, or an object of the form {name: string, value: string}. The name and value of the added property are derived from the passed object.

Type definitions

PropertyDataObject

The type PropertyDataObject is defined as: {name:string,value:string}.

propertyName

Type: string

The name of the property.

propertyValue

Type: string

The value associated with the name.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

  • Set multiple properties by calling Eyes.addProperty or Configuration.addProperty multiple times with the same property name and with different values.
  • You should not assign a given value to a property more than once in a given test run.

cloneConfig method

Syntax

let configval = config.cloneConfig();

Parameters

This method does not take any parameters.

Return value

Type: Configuration

A cloned Configuration object.

getAccessibilityValidation method

Syntax

let configval = config.getAccessibilityValidation();

Parameters

This method does not take any parameters.

Return value

Type: AccessibilitySettings

Type definitions

AccessibilitySettings

The type AccessibilitySettings is defined as: {level:AccessibilityLevel,guidelinesVersion:AccessibilityGuidelinesVersion}

Remarks

For more information about the Contrast advisor feature see Contrast advisor.

getAgentId method

Syntax

let configval = config.getAgentId();

Parameters

This method does not take any parameters.

Return value

Type: string

getApiKey method

Syntax

let configval = config.getApiKey();

Parameters

This method does not take any parameters.

Return value

Type: string

getAppName method

Syntax

let configval = config.getAppName();

Parameters

This method does not take any parameters.

Return value

Type: string

getBaselineBranchName method

Syntax

let configval = config.getBaselineBranchName();

Parameters

This method does not take any parameters.

Return value

Type: string

getBaselineEnvName method

Syntax

let configval = config.getBaselineEnvName();

Parameters

This method does not take any parameters.

Return value

Type: string

getBatch method

Syntax

let configval = config.getBatch();

Parameters

This method does not take any parameters.

Return value

Type: BatchInfo

getBranchName method

Syntax

let configval = config.getBranchName();

Parameters

This method does not take any parameters.

Return value

Type: string

getDeviceInfo method

Syntax

let configval = config.getDeviceInfo();

Parameters

This method does not take any parameters.

Return value

Type: string

getHostApp method

Syntax

let configval = config.getHostApp();

Parameters

This method does not take any parameters.

Return value

Type: string

getHostOS method

Syntax

let configval = config.getHostOS();

Parameters

This method does not take any parameters.

Return value

Type: string

getIgnoreCaret method

Syntax

let configval = config.getIgnoreCaret();

Parameters

This method does not take any parameters.

Return value

Type: boolean

getIgnoreDisplacements method

Syntax

let configval = config.getIgnoreDisplacements();

Parameters

This method does not take any parameters.

Return value

Type: boolean

getIsDisabled method

Syntax

let configval = config.getIsDisabled();

Parameters

This method does not take any parameters.

Return value

Type: boolean

If true, then all calls to Eyes are ignored, if false then all calls to Eyes work as usual.

getMatchLevel method

Syntax

let configval = config.getMatchLevel();

Parameters

This method does not take any parameters.

Return value

Type: MatchLevel

Remarks

For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.

getParentBranchName method

Syntax

let configval = config.getParentBranchName();

Parameters

This method does not take any parameters.

Return value

Type: string

getProperties method

Syntax

let configval = config.getProperties();

Parameters

This method does not take any parameters.

Return value

Type: PropertyData[]

getProxy method

Syntax

let configval = config.getProxy();

Parameters

This method does not take any parameters.

Return value

Type: ProxySettings

getSaveDiffs method

Syntax

let configval = config.getSaveDiffs();

Parameters

This method does not take any parameters.

Return value

Type: boolean

getSaveNewTests method

Syntax

let configval = config.getSaveNewTests();

Parameters

This method does not take any parameters.

Return value

Type: boolean

getServerUrl method

Syntax

let configval = config.getServerUrl();

Parameters

This method does not take any parameters.

Return value

Type: string

getTestName method

Syntax

let configval = config.getTestName();

Parameters

This method does not take any parameters.

Return value

Type: string

getViewportSize method

Syntax

let configval = config.getViewportSize();

Parameters

This method does not take any parameters.

Return value

Type: RectangleSize

setAccessibilityValidation method

Syntax

let configval = config.setAccessibilityValidation(value);

Parameters

value

Type: AccessibilitySettings

The required accessibility settings. A value of null will disable accessibility checking.

Type definitions

AccessibilitySettings

The type AccessibilitySettings is defined as: {level:AccessibilityLevel,guidelinesVersion:AccessibilityGuidelinesVersion}

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

For more information about the Contrast advisor feature see Contrast advisor.

setAgentId method

Syntax

let configval = config.setAgentId(value);

Parameters

value

Type: string

The agent id to be configured.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setApiKey method

Syntax

let configval = config.setApiKey(value);

Parameters

value

Type: string

Your API key.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

Set this immediately after the Eyes object is created (before calling open). If you have an environment variable called APPLITOOLS_API_KEY that is set to the value of your API key, then you do not need to call this method, and Eyes will take the string from the environment value.

setAppName method

Syntax

let configval = config.setAppName(value);

Parameters

value

Type: string

The application name to be configured for the test.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

If you call this method, it must be called before the call to Eyes.open. In the call to Eyes.open, if you provide the application parameter, then it will override the value set here. If you don't provide the parameter or pass a null, then the value set here will be used.

setBaselineBranchName method

Syntax

let configval = config.setBaselineBranchName(value);

Parameters

value

Type: string

The baseline branch name to be configured.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setBaselineEnvName method

Syntax

let configval = config.setBaselineEnvName(value);

Parameters

value

Type: string

The name of the baseline environment.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setBatch method

Syntax

let configval = config.setBatch(value);

Parameters

value

Type:

BatchInfo|BatchInfoObject

An object that defines the batch configuration.

Type definitions

BatchInfoObject

The type BatchInfoObject is defined as: {id:(string|undefined),name:(string|undefined),startedAt:(Date|string|undefined),sequenceName:(string|undefined),notifyOnCompletion:(boolean|undefined)}.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setBranchName method

Syntax

let configval = config.setBranchName(value);

Parameters

value

Type: string

The branch name to be used by the configuration.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setDeviceInfo method

Syntax

let configval = config.setDeviceInfo(value);

Parameters

value

Type: string

The name of the device - this is displayed in the Device column in the Test Manager.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setHostApp method

Syntax

config.setHostApp(value);

Parameters

value

Type: string

The value to be used for the Host App property.

Return value

Type:

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setHostOS method

Syntax

config.setHostOS(value);

Parameters

value

Type: string

The value to be used for the Host OS Property.

Return value

Type:

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setIgnoreCaret method

Syntax

let configval = config.setIgnoreCaret(value);

Parameters

value

Type: boolean

If set to true, then Eyes does extra processing to eliminate artifacts introduced by blinking cursors.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setIgnoreDisplacements method

Syntax

let configval = config.setIgnoreDisplacements(value);

Parameters

value

Type: boolean

If a value of true is passed, then mismatches due to displaced content will not be displayed in the Test Manager. Otherwise, they will be displayed.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

Ignore displacements is only active when using a Match level of Strict or IgnoreColors

setIsDisabled method

Syntax

let configval = config.setIsDisabled(value);

Parameters

value

Type: boolean

If this has a value of true then all method calls to the SDK are ignored. Otherwise, all methods work as usual.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setMatchLevel method

Syntax

let configval = config.setMatchLevel(value);

Parameters

value

Type: MatchLevel

Available match level values are:

For a description of these match levels and the different ways to apply them to tests, checkpoints, and regions, see Eyes match levels.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

For a full description of the affect of each match levels and the different ways to apply them to tests, checkpoints and regions, How to use Eyes match levels.

setParentBranchName method

Syntax

let configval = config.setParentBranchName(value);

Parameters

value

Type: string

The parent branch name to be configured.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setProperties method

Syntax

let configval = config.setProperties(properties);

Parameters

properties

Type: PropertyData[]

List of propertydata objects.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

  • Set multiple properties by calling Eyes.addProperty or Configuration.addProperty multiple times with the same property name and with different values.
  • You should not assign a given value to a property more than once in a given test run.

setProxy method

Syntax

let configval = config.setProxy(value);

Parameters

value

Type:

ProxySettings|ProxySettingsObject|string|boolean

An object created from the ProxySettings class that contains the user name, password, URI and port.

Type definitions

ProxySettingsObject

The type ProxySettingsObject is defined as: {url:string,username:(string|undefined),password:(string|undefined)}.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setSaveDiffs method

Syntax

let configval = config.setSaveDiffs(value);

Parameters

value

Type: boolean

Set to true to configure Save Diffs functionality.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setSaveNewTests method

Syntax

let configval = config.setSaveNewTests(value);

Parameters

value

Type: boolean

If False, the user will need to save the baseline explicitly in the Test Manager for new tests to be saved to the baseline. If True, Eyes will automatically create a baseline for tests with a status of 'new' (the default behavior).

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setServerUrl method

Syntax

let configval = config.setServerUrl(value);

Parameters

value

Type: string

The URL of the Eyes server. Pass a value of null to use the default cloud server.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setTestName method

Syntax

let configval = config.setTestName(value);

Parameters

value

Type: string

The test name to be configured for the test.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

setViewportSize method

Syntax

let configval = config.setViewportSize(value);

Parameters

value

Type:

RectangleSize|RectangleSizeObject

An object that defines the width and height of the test browser viewport in pixels.

Type definitions

RectangleSizeObject

The type RectangleSizeObject is defined as: {width:number,height:number}.

Return value

Type: Configuration

The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.