public abstract class EyesBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.applitools.eyes.AgentConnector |
agentConnector |
static String |
DEFAULT_CHARSET_NAME |
protected static MatchLevel |
DEFAULT_MATCH_LEVEL |
protected EyesScreenshot |
lastScreenshot |
protected com.applitools.eyes.RunningSession |
runningSession |
protected com.applitools.eyes.SessionStartInfo |
sessionStartInfo |
protected RectangleSize |
viewportSize |
| Constructor and Description |
|---|
EyesBase(URI serverUrl,
boolean isDisabled)
Creates a new (possibly disabled) EyesBase instance that interacts with the
Eyes Server at the specified url.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortIfNotClosed()
If a test is running, aborts it.
|
protected void |
addMouseTrigger(MouseAction action,
Region control,
Location cursor)
Adds a mouse trigger.
|
protected void |
addTextTrigger(Region control,
String text)
Adds a keyboard trigger.
|
protected void |
addUserInput(com.applitools.eyes.Trigger trigger)
Adds a trigger to the current list of user inputs.
|
protected void |
checkWindow(BufferedImage image,
String tag,
boolean ignoreMismatch) |
protected void |
clearUserInputs()
Clears the user inputs list.
|
TestResults |
close()
Ends the test.
|
abstract String |
getAgentId() |
protected static String |
getApiKey()
Gets the currently set API key or
null if no key is set. |
static URI |
getDefaultServerUrl() |
protected com.applitools.eyes.AppEnvironment |
getEnvironment() |
FailureReports |
getFailureReports() |
protected abstract String |
getInferredEnvironment() |
boolean |
getIsDisabled() |
boolean |
getIsOpen() |
protected EyesScreenshot |
getLastScreenshot() |
boolean |
getSaveFailedTests() |
boolean |
getSaveNewTests() |
protected abstract String |
getTitle() |
protected com.applitools.eyes.Trigger[] |
getUserInputs()
Returns all user inputs.
|
protected RectangleSize |
getViewportSize() |
void |
open(String appName,
String testName,
RectangleSize viewportSize,
MatchLevel matchLevel,
FailureReports failureReports)
Starts a test.
|
protected static void |
setApiKey(String apiKey)
Sets the API key of your applitools Eyes account.
|
void |
setAppEnvironment(String hostOS,
String hostApp)
Sets the OS (e.g., Windows) and application (e.g., Chrome) that host the
application under test.
|
void |
setBatch(BatchInfo batch)
Sets the batch in which context future tests will run or
null
if tests are to run standalone. |
void |
setBranchName(String branchName)
Sets the branch in which the baseline for subsequent test runs resides.
|
protected void |
setLastScreenshot(EyesScreenshot screenshot) |
protected static void |
setLogHandler(LogHandler logHandler)
Sets a handler of log messages generated by this API.
|
void |
setParentBranchName(String branchName)
Sets the branch under which new branches are created.
|
void |
setSaveFailedTests(boolean saveFailedTests)
Set whether or not failed tests are saved by default.
|
void |
setSaveNewTests(boolean saveNewTests)
Set whether or not new tests are saved by default.
|
protected void |
setViewportSize(RectangleSize size) |
protected void |
startSession() |
protected static final MatchLevel DEFAULT_MATCH_LEVEL
public static final String DEFAULT_CHARSET_NAME
protected com.applitools.eyes.AgentConnector agentConnector
protected com.applitools.eyes.RunningSession runningSession
protected com.applitools.eyes.SessionStartInfo sessionStartInfo
protected RectangleSize viewportSize
protected EyesScreenshot lastScreenshot
public EyesBase(URI serverUrl, boolean isDisabled)
serverUrl - The Eyes server URL.isDisabled - If true, all interactions with this API will be
silently ignored.public abstract String getAgentId()
protected static void setLogHandler(LogHandler logHandler)
logHandler - Handles log messages generated by this API.protected static void setApiKey(String apiKey)
protected static String getApiKey()
null if no key is set.public boolean getIsDisabled()
public boolean getIsOpen()
public FailureReports getFailureReports()
public boolean getSaveNewTests()
public void setSaveNewTests(boolean saveNewTests)
saveNewTests - True if new tests should be saved by default.
False otherwise.public boolean getSaveFailedTests()
public void setSaveFailedTests(boolean saveFailedTests)
saveFailedTests - True if failed tests should be saved by
default, false otherwise.public void open(String appName, String testName, RectangleSize viewportSize, MatchLevel matchLevel, FailureReports failureReports)
appName - The name of the application under test.testName - The test name.viewportSize - The client's viewport size
(i.e., the visible part of the document's body) or
null to allow any viewport size.matchLevel - The test-wide match level to use when comparing
actual application outputs with expected outputs
(overrides stricter step-specific match levels).failureReports - Specifies how detected failures are reported.public TestResults close()
TestFailedException - Thrown if mismatches were found.public void abortIfNotClosed()
public void setBranchName(String branchName)
setParentBranchName(java.lang.String)).
Changes to the baseline or model of a branch do not propagate to other
branches.branchName - Branch name or null to specify the default
branch.public void setParentBranchName(String branchName)
branchName - Branch name or null to specify the default
branch.public void setAppEnvironment(String hostOS, String hostApp)
hostOS - The name of the OS hosting the application under test or
null to auto-detect.hostApp - The name of the application hosting the application under
test or null to auto-detect.public void setBatch(BatchInfo batch)
null
if tests are to run standalone.public static URI getDefaultServerUrl()
protected void setLastScreenshot(EyesScreenshot screenshot)
protected EyesScreenshot getLastScreenshot()
protected void checkWindow(BufferedImage image, String tag, boolean ignoreMismatch)
protected void addUserInput(com.applitools.eyes.Trigger trigger)
protected void clearUserInputs()
protected com.applitools.eyes.Trigger[] getUserInputs()
protected void addMouseTrigger(MouseAction action, Region control, Location cursor)
action - Mouse action.control - The control on which the trigger is activated
(location is relative to the window).cursor - The cursor's position relative to the control.protected void addTextTrigger(Region control, String text)
control - The control's position relative to the window.text - The trigger's text.protected RectangleSize getViewportSize()
protected void setViewportSize(RectangleSize size)
protected abstract String getInferredEnvironment()
null if none is available. The inferred string is in the
format "source:info" where source is either "useragent" or "pos".
Information associated with a "useragent" source is a valid browser user
agent string. Information associated with a "pos" source is a string of
the format "process-name;os-name" where "process-name" is the name of the
main module of the executed process and "os-name" is the OS name.protected abstract String getTitle()
protected com.applitools.eyes.AppEnvironment getEnvironment()
protected void startSession()
Copyright © 2013. All rights reserved.