Eyes class
This class provides the main methods used to execute tests and checkpoints.
Using statementβ
using Applitools.Appium;
Eyes methodβ
Syntaxβ
Eyes eyes = new Eyes();
Parametersβ
This method does not take any parameters.
Return valueβ
Type: Eyes
Use the object returned to call the various methods provided by the Eyes class.
IsOpen propertyβ
Syntaxβ
bool value = eyes.IsOpen;
Type: bool
Return true if the Eyes.Open method has been called on an eyes instance, and Eyes.Close, Eyes.Abort, Eyes.AbortAsync or Eyes.AbortIfNotClosed have not yet been called.
AgentId propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.AgentId = value;
value = eyes.AgentId
Type: string
Remarksβ
To take effect, this property must be assigned before the call to Open.
ApiKey propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.ApiKey = value;
value = eyes.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 value; // give relevant initial value
eyes.AppName = value;
value = eyes.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 value; // give relevant initial value
eyes.BaselineBranchName = value;
value = eyes.BaselineBranchName
Type: string
BaselineEnvName propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.BaselineEnvName = value;
value = eyes.BaselineEnvName
Type: string
Batch propertyβ
Syntaxβ
eyes.Batch = new BatchInfo(name)
Type: BatchInfo
Remarksβ
Set this property once before the calls to the Open method for all tests that are supposed to be part of this batch.
BranchName propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.BranchName = value;
value = eyes.BranchName
Type: string
HostApp propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.HostApp = value;
value = eyes.HostApp
Type: string
HostOS propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.HostOS = value;
value = eyes.HostOS
Type: string
IgnoreCaret propertyβ
Syntaxβ
bool value; // give relevant initial value
eyes.IgnoreCaret = value;
value = eyes.IgnoreCaret
Type: bool
IsDisabled propertyβ
Syntaxβ
bool value; // give relevant initial value
eyes.IsDisabled = value;
value = eyes.IsDisabled
Type: bool
MatchLevel propertyβ
Syntaxβ
MatchLevel value; // give relevant initial value
eyes.MatchLevel = value;
value = eyes.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 value; // give relevant initial value
eyes.MatchTimeout = value;
value = eyes.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
BranchName propertyβ
Syntaxβ
string value; // give relevant initial value
eyes.ParentBranchName = value;
value = eyes.ParentBranchName
Type: string
Proxy propertyβ
Syntaxβ
WebProxy value; // give relevant initial value
eyes.Proxy = value;
value = eyes.Proxy
Type: WebProxy
SaveDiffs propertyβ
Syntaxβ
bool? value; // give relevant initial value
eyes.SaveDiffs = value;
value = eyes.SaveDiffs
Type: bool?
SaveNewTests propertyβ
Syntaxβ
bool value; // give relevant initial value
eyes.SaveNewTests = value;
value = eyes.SaveNewTests
Type: bool
ScaleRatio propertyβ
Syntaxβ
double value; // give relevant initial value
eyes.ScaleRatio = value;
value = eyes.ScaleRatio
Type: double
ServerUrl propertyβ
Syntaxβ
eyes.ServerUrl = new System.Uri('https://myEyesServer'); //setter
System.Uri uri = eyes.ServerUrl; //getter
Type: string
Abort methodβ
Syntaxβ
TestResults value = eyes.Abort();
Parametersβ
This method does not take any parameters.
Return valueβ
Type: TestResults
Remarksβ
If you call this method on a test that was opened but not closed, then then test will have an aborted status in the Eyes Test Manager. If you call it after the test has been successfully closed, then the call is ignored.
AbortAsync methodβ
Syntaxβ
eyes.AbortAsync();
Parametersβ
This method does not take any parameters.
Return valueβ
Type: void
Remarksβ
If you call this method on a test that was opened but not closed, then then test will have an aborted status in the Eyes Test Manager. If you call it after the test has been successfully closed, then the call is ignored.
AbortIfNotClosed methodβ
Syntaxβ
TestResults value = eyes.AbortIfNotClosed();
Parametersβ
This method does not take any parameters.
Return valueβ
Type: TestResults
Remarksβ
If you call this method on a test that was opened but not closed, then then test will have an aborted status in the Eyes Test Manager. If you call it after the test has been successfully closed, then the call is ignored.
AddProperty methodβ
Syntaxβ
eyes.AddProperty(name, value);
Parametersβ
name
Type: string
The name of the property.
value
Type: string
The value associated with the name.
Return valueβ
Type: void
Remarksβ
- You should not assign a given value to a property more than once in a given test run.
- You can also associate properties with a batch using BatchInfo.AddProperty.
Check methodβ
Syntaxβ
eyes.Check(checkSettings);
eyes.Check(name, checkSettings);
Parametersβ
checkSettings
Type: ICheckSettings
The fluent API calls, starting with one of the Target methods.
name
Type: string
The tag defines a name for the checkpoint in the Eyes Test Manager. The name may be any string and serves to identify the step to the user in the Test manager. You may change the tag value without impacting testing in any way since Eyes does not use the tag to identify the baseline step that corresponds to the checkpoint - Eyes matches steps based on their content and position in the sequences of images of the test. See How Eyes compares checkpoints and baseline images for details.
Return valueβ
Type: void
Remarksβ
For a detailed description of how to use this method see The Eyes SDK check Fluent API.
CheckWindow methodβ
Syntaxβ
eyes.CheckWindow(name);
Parametersβ
name
Type: string
The tag defines a name for the checkpoint in the Eyes Test Manager. The name may be any string and serves to identify the step to the user in the Test manager. You may change the tag value without impacting testing in any way since Eyes does not use the tag to identify the baseline step that corresponds to the checkpoint - Eyes matches steps based on their content and position in the sequences of images of the test. See How Eyes compares checkpoints and baseline images for details.
Return valueβ
Type: void
ClearProperties methodβ
Syntaxβ
eyes.ClearProperties();
Parametersβ
This method does not take any parameters.
Return valueβ
Type: void
Close methodβ
Syntaxβ
TestResults result = eyes.Close();
TestResults result = eyes.Close(throwEx);
Parametersβ
throwEx
Type: bool
If this parameter has a value of true, then if there are new, missing, or mismatched steps, an exception will be thrown. If the parameter is set to false, then an exception will not be thrown for the above cases. If the parameter is not passed, then it is as if a true value was passed.
Return valueβ
Type: TestResults
The result of the test can be obtained from the object returned. See TestResults class for a list of what information can be obtained from this object. See TestResults class for a list of what information can be obtained from this object.
GetConfiguration methodβ
Syntaxβ
Configuration value = eyes.GetConfiguration();
Parametersβ
This method does not take any parameters.
Return valueβ
Type: Configuration
Open methodβ
Syntaxβ
RemoteWebDriver outdriver = eyes.Open(driver, appName, testName);
Parametersβ
driver
Type: RemoteWebDriver
The web driver.
appName
Type: string
The application name. This may be any string. You can set the application name for all tests using the Configuration.SetAppName method or Eyes.AppName property. If you do so, then set this parameter to a value of null to indicate that the configuration default should be used.
testName
Type: string
The name of the test. This name must be unique within the scope of the application name. It may be any string.
Return valueβ
Type: RemoteWebDriver
The returned web driver is a clone of the driver passed as a parameter. It is recommended that you use the web driver object returned by this method in all further calls to the web driver. This allows Eyes to record these interactions and play them back in the Eyes Test Manager.
Remarksβ
After making a call to this method, you must eventually terminate the test by calling Eyes.Close (in case of a normal completion) or Eyes.AbortAsync (in case of an aborted test). If you want to run another test, then it is recommended to do this with a newly created Eyes instance to avoid side effects. However, in principle, it is legal to call Eyes.Open again to start a new test on the same Eyes instance.
SetConfiguration methodβ
Syntaxβ
eyes.SetConfiguration(configuration);
Parametersβ
configuration
Type: IConfiguration
A configuration object that has the various properties/methods set to the required values.
Return valueβ
Type: void
Remarksβ
The typical sequence for configuring a test is:
- Create a Configuration object.
- Assign to the properties you want to set up, and call the various methods.
- Create an Eyes instance.
- Call the Eyes.SetConfiguration method with the configuration object.
- Call the Eyes.Open method to start the test session.
Once you've changed the configuration of an Eyes instance by calling Eyes.SetConfiguration or by setting a configuration directly on the Eyes instance, if you want to change the configuration, you must use the following sequence:
- Get the current configuration using Eyes.GetConfiguration to a local variable.
- Make changes to the local configuration value.
- Assign the local configuration object to the Eyes instance using Eyes.SetConfiguration.