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.
Using statement
using Configuration = Applitools.Configuration;
Configuration method
Syntax
Configuration 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.
AccessibilityValidation property
Syntax
AccessibilitySettings configval; // give relevant initial value config.AccessibilityValidation = configval; configval = config.AccessibilityValidation
Type: AccessibilitySettings
Remarks
For more information about the Contrast advisor feature see Contrast advisor.
AgentId property
Syntax
string configval; // give relevant initial value config.AgentId = configval; configval = config.AgentId
Type: string
ApiKey property
Syntax
string configval; // give relevant initial value config.ApiKey = configval; configval = config.ApiKey
Type: string
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.
AppName property
Syntax
string configval; // give relevant initial value config.AppName = configval; configval = config.AppName
Type: string
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.
BaselineBranchName property
Syntax
string configval; // give relevant initial value config.BaselineBranchName = configval; configval = config.BaselineBranchName
Type: string
BaselineEnvName property
Syntax
string configval; // give relevant initial value config.BaselineEnvName = configval; configval = config.BaselineEnvName
Type: string
Batch property
Syntax
BatchInfo configval; // give relevant initial value config.Batch = configval; configval = config.Batch
Type: BatchInfo
BranchName property
Syntax
string configval; // give relevant initial value config.BranchName = configval; configval = config.BranchName
Type: string
HideCaret property
Syntax
bool configval; // give relevant initial value config.HideCaret = configval; configval = config.HideCaret
Type: bool
Remarks
We recommend using this method instead of Eyes.IgnoreCaret
, Configuration.SetIgnoreCaret
or CheckSettings.IgnoreCaret
, since this method/property eliminates cursor related artifacts instead of detecting and ignoring them.
HideScrollbars property
Syntax
bool configval; // give relevant initial value config.HideScrollbars = configval; configval = config.HideScrollbars
Type: bool
HostApp property
Syntax
string configval; // give relevant initial value config.HostApp = configval; configval = config.HostApp
Type: string
HostOS property
Syntax
string configval; // give relevant initial value config.HostOS = configval; configval = config.HostOS
Type: string
IgnoreCaret property
Syntax
bool configval; // give relevant initial value config.IgnoreCaret = configval; configval = config.IgnoreCaret
Type: bool
Remarks
We recommend using HideCaret
or SetHideCaret
since this eliminates cursor related artifacts instead of detecting and ignoring them.
IgnoreDisplacements property
Syntax
bool configval; // give relevant initial value config.IgnoreDisplacements = configval; configval = config.IgnoreDisplacements
Type: bool
Remarks
Ignore displacements is only active when using a Match level of Strict
or IgnoreColors
LayoutBreakpoints property
Syntax
int configval; // give relevant initial value config.LayoutBreakpoints = configval; configval = config.LayoutBreakpoints
Type: int
Remarks
This method sets the default for all checkpoints on all tests that are configured using this Configuration object. This default can be overridden for a specific checkpoint by using the CheckSettings.LayoutBreakpoints
method.
MatchLevel property
Syntax
MatchLevel configval; // give relevant initial value config.MatchLevel = configval; configval = config.MatchLevel
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.
MatchTimeout property
Syntax
TimeSpan configval; // give relevant initial value config.MatchTimeout = configval; configval = config.MatchTimeout
Type: TimeSpan
Remarks
You can override the default timeout set by this property for a specific set checkpoint by passing a timeout to one of the check_XXXX methods that support a timeout parameter, e.g. CheckWindow
. You can also override the timeout for a specific test using the check fluent Timeout method
ParentBranchName property
Syntax
string configval; // give relevant initial value config.ParentBranchName = configval; configval = config.ParentBranchName
Type: string
SaveDiffs property
Syntax
bool? configval; // give relevant initial value config.SaveDiffs = configval; configval = config.SaveDiffs
Type: bool?
SaveNewTests property
Syntax
bool configval; // give relevant initial value config.SaveNewTests = configval; configval = config.SaveNewTests
Type: bool
SendDom property
Syntax
bool configval; // give relevant initial value config.SendDom = configval; configval = config.SendDom
Type: bool
Remarks
Sending DOM information is enabled by default, so use this method only if you have to disable it.
ServerUrl property
Syntax
string configval; // give relevant initial value config.ServerUrl = configval; configval = config.ServerUrl
Type: string
StitchMode property
Syntax
StitchModes configval; // give relevant initial value config.StitchMode = configval; configval = config.StitchMode
Type: StitchModes
StitchOverlap property
Syntax
int configval; // give relevant initial value config.StitchOverlap = configval; configval = config.StitchOverlap
Type: int
TestName property
Syntax
string configval; // give relevant initial value config.TestName = configval; configval = config.TestName
Type: string
ViewportSize property
Syntax
RectangleSize configval; // give relevant initial value config.ViewportSize = configval; configval = config.ViewportSize
Type: RectangleSize
VisualGridOptions property
Syntax
VisualGridOption[] configval; // give relevant initial value config.VisualGridOptions = configval; configval = config.VisualGridOptions
Type: VisualGridOption
[]
Remarks
The following configuration key/value pairs are currently supported:
'chromeHeadless'
Normally, the Ultrafast Grid renders its images using Headless Chrome. There are cases where the behavior of Headless Chrome is different from that of regular Chrome browser, and if the baseline was created with a regular Chrome browser, the differences will be found. Set this option to a value of false to instruct the Ultrafast Grid to use a regular Chrome browser instead of the Headless Chrome browser, so as to eliminate differences that arise because of the different types of Chrome browser.
'polyfillAdoptedStyleSheets'
Adopted Stylesheets are a way to create and distribute reusable styles when using a Shadow DOM. Adopted Stylesheets are not supported by all browsers, so their use may cause mismatches when doing cross-browser validation. By default, when the Ultrafast Grid detects that a page being checked uses Adopted Stylesheets, it will not render that checkpoint, the check will fail, and the test will be aborted. In the Test Manager, the test results for that run will have an Aborted status, and the step that failed will have a Missing status.
To enable rendering of checkpoints that include Adopted Stylesheets, and to ensure that the test can complete successfully, you need to explicitly set the Ultrafast Grid option polyfillAdoptedStyleSheets to a value of true or false:
- Setting a value of true instructs the Ultrafast Grid to polyfill Adopted Stylesheets.
- Setting a value of false instructs the Ultrafast Grid to render the page without polyfilling Adopted Stylesheets.
You can set this option globally using the method Configuration.SetVisualGridOptions
You can override the global value for a given checkpoint using the method CheckSettings.VisualGridOptions
.
WaitBeforeScreenshots property
Syntax
int configval; // give relevant initial value config.WaitBeforeScreenshots = configval; configval = config.WaitBeforeScreenshots
Type: int
AddBrowser method
Syntax
IConfiguration configval = config.AddBrowser(desktopBrowserInfo);
IConfiguration configval = config.AddBrowser(emulationInfo);
IConfiguration configval = config.AddBrowser(deviceInfo);
IConfiguration configval = config.AddBrowser(width, height, browserType, baselineEnvName);
IConfiguration configval = config.AddBrowser(width, height, browserType);
Parameters
desktopBrowserInfo
Type: DesktopBrowserInfo
Which desktop browser type and viewport size to use.
C#
/* test suite setup */
suiteConfig = (Configuration) new Configuration()
.AddBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.EDGE_CHROMIUM))
/* ... other configurations */ ;
/*
* Assign the configuration to all newly created Eyes instances
*/
eyes = new Eyes(runner);
eyes.SetConfiguration(suiteConfig);
emulationInfo
Type: ChromeEmulationInfo
Which mobile device to emulate and its vertical or horizontal orientation.
C#
/* test suite setup /
suiteConfig = (Configuration) new Configuration()
.AddBrowser(new ChromeEmulationInfo(DeviceName.Galaxy_S5, ScreenOrientation.Landscape))
/ ... other configurations / ;
/
- Assign the configuration to all newly created Eyes instances */ eyes = new Eyes(runner); eyes.SetConfiguration(suiteConfig);
deviceInfo
Type: IosDeviceInfo
Defines the mobile device to be simulated and its vertical or horizontal orientation.
C#
/* test suite setup /
suiteConfig = (Configuration) new Configuration()
.AddBrowser(new IosDeviceInfo(IosDeviceName.iPhone_11, ScreenOrientation.Portrait))
/ ... other configurations / ;
/
- Assign the configuration to all newly created Eyes instances */ eyes = new Eyes(runner); eyes.SetConfiguration(suiteConfig);
width
Type: int
The width of the browser viewport for this target. The maximum viewport width for all browsers is 5120. If this limit is exceeded, then execution of the checkpoint will fail.
Use this in conjunction with the browserType parameter.
height
Type: int
The height of the browser viewport for this target. There is no height limit.
Use this in conjunction with the browserType parameter.
browserType
Type: BrowserType
The type of browser for this target.
C#
/* test suite setup /
suiteConfig = (Configuration) new Configuration()
/ ... other configurations / ;
/
- Assign the configuration to all newly created Eyes instances */ eyes = new Eyes(runner); eyes.SetConfiguration(suiteConfig);
baselineEnvName
Type: string [Optional : default = null ]
The name of the baseline environment. If provided, then the viewport, host app (browser), and OS that define the baseline are defined by the baseline environment name and not by the execution environment. The name should already be defined in the Test Manager. If it is not defined, then it will be created based on the execution environment of the first test that uses that name. For more information see Running cross-environment tests.
Use this in conjunction with the browserType parameter.
Return value
Type: IConfiguration
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
By default, the entire page is rendered. The viewport width and height parameters impact the baseline that is chosen, unless the baseline environment configuration or parameter has been provided. The viewport passed to the Eyes.Open
method does not impact the baseline used, but could impact the page layout if the page has any viewport size-sensitive factors such as HTML, CSS or Javascript.
AddBrowsers method
Syntax
IConfiguration configval = config.AddBrowsers(browsersInfo);
Parameters
browsersInfo
Type: IRenderBrowserInfo[]
One or more browser or device configuration definitions passed as an array or multiple parameters.
Define the browser or device configurations using instances of one or more of the following classes:
DesktopBrowserInfo
: to run the test on a desktop browser.IosDeviceInfo
: to run the test on a Simulated iOS mobile device.ChromeEmulationInfo
: to run the test using on an emulated mobile device.
Return value
Type: IConfiguration
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
You can use this method to pass a list of configurations instead of configuring each browser device individually using multiple calls to AddBrowser
.
Example
C#
/* test suite setup */
IRenderBrowserInfo[] browserList =
{
new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.FIREFOX),
new ChromeEmulationInfo(DeviceName.Galaxy_Note_3, ScreenOrientation.Landscape),
new IosDeviceInfo(IosDeviceName.iPhone_8, ScreenOrientation.Portrait)
};
suiteConfig = (Configuration) new Configuration()
.AddBrowsers(browserList)
/* ... other configurations */ ;
/*
* Assign the configuration to all newly created Eyes instances
*/
eyes = new Eyes(runner);
eyes.SetConfiguration(suiteConfig);
AddDeviceEmulation method
Syntax
IConfiguration configval = config.AddDeviceEmulation(deviceName, screenOrientation, baselineEnvName);
IConfiguration configval = config.AddDeviceEmulation(deviceName, screenOrientation);
IConfiguration configval = config.AddDeviceEmulation(deviceName);
Parameters
deviceName
Type: DeviceName
The name of the device, from the list of devices defined by DeviceName
.
screenOrientation
Type: ScreenOrientation
[Optional : default = ScreenOrientation.Portrait ]
Whether the device is in portrait or landscape mode.
baselineEnvName
Type: string [Optional : default = null ]
The name of the baseline environment. If provided, then the viewport, host app (browser), and OS that define the baseline are defined by the baseline environment name and not by the execution environment. The name should already be defined in the Test Manager. If it is not defined, then it will be created based on the execution environment of the first test that uses that name. For more information see Running cross-environment tests.
Return value
Type: IConfiguration
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.
Clone method
Syntax
Applitools.Configuration configval = config.Clone();
Parameters
This method does not take any parameters.
Return value
Type: Applitools.Configuration
A cloned Configuration
object.
SetAccessibilityValidation method
Syntax
IConfiguration configval = config.SetAccessibilityValidation(value); config.AccessibilityValidation = configval; = config.AccessibilityValidation;
Note that this feature is available as both a method and a property.
Parameters
value
Type: AccessibilitySettings
The required accessibility settings. A value of null will disable accessibility checking.
Return value
Type: IConfiguration
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
IConfiguration configval = config.SetAgentId(value); config.AgentId = configval; = config.AgentId;
Note that this feature is available as both a method and a property.
Parameters
value
Type: string
The agent id to be configured.
Return value
Type: IConfiguration
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
IConfiguration configval = config.SetApiKey(value); config.ApiKey = configval; = config.ApiKey;
Note that this feature is available as both a method and a property.
Parameters
value
Type: string
Your API key.
Return value
Type: IConfiguration
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
IConfiguration configval = config.SetAppName(value); config.AppName = configval; = config.AppName;
Note that this feature is available as both a method and a property.