public abstract class EyesBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected PropertyHandler<CutProvider> |
cutProviderHandler |
protected DebugScreenshotsProvider |
debugScreenshotsProvider |
protected EyesScreenshot |
lastScreenshot |
protected Logger |
logger |
protected PositionProvider |
positionProvider |
protected RunningSession |
runningSession |
protected PropertyHandler<ScaleProvider> |
scaleProviderHandler |
protected ServerConnector |
serverConnector |
protected SessionStartInfo |
sessionStartInfo |
protected int |
stitchingOverlap |
protected static int |
USE_DEFAULT_TIMEOUT |
protected PropertyHandler<RectangleSize> |
viewportSizeHandler |
| Constructor and Description |
|---|
EyesBase(URI serverUrl)
Creates a new
EyesBaseinstance 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 |
addMouseTriggerBase(MouseAction action,
Region control,
Location cursor)
Adds a mouse trigger.
|
void |
addProperty(String name,
String value)
Adds a property to be sent to the server.
|
protected void |
addTextTriggerBase(Region control,
String text)
Adds a text trigger.
|
protected void |
addUserInput(Trigger trigger)
Adds a trigger to the current list of user inputs.
|
protected MatchResult |
checkWindowBase(RegionProvider regionProvider,
String tag,
boolean ignoreMismatch)
|
protected MatchResult |
checkWindowBase(RegionProvider regionProvider,
String tag,
boolean ignoreMismatch,
ICheckSettings checkSettings)
Takes a snapshot of the application under test and matches it with the
expected output.
|
protected MatchResult |
checkWindowBase(RegionProvider regionProvider,
String tag,
boolean ignoreMismatch,
int retryTimeout)
Takes a snapshot of the application under test and matches it with the
expected output.
|
void |
clearProperties()
Clears the list of custom properties.
|
protected void |
clearUserInputs()
Clears the user inputs list.
|
TestResults |
close()
See
close(boolean). |
TestResults |
close(boolean throwEx)
Ends the test.
|
protected void |
closeResponseTime(boolean isDeadlineExceeded)
Ends the test.
|
String |
getAgentId() |
String |
getApiKey() |
protected AppEnvironment |
getAppEnvironment()
Application environment is the environment (e.g., the host OS) which
runs the application under test.
|
String |
getAppName() |
protected abstract String |
getBaseAgentId() |
String |
getBaselineEnvName()
If not
null, determines the name of the environment of the baseline. |
String |
getBaselineName()
Deprecated.
Only available for backward compatibility. See
getBaselineEnvName(). |
BatchInfo |
getBatch() |
String |
getBranchName() |
String |
getDebugScreenshotsPath() |
String |
getDebugScreenshotsPrefix() |
DebugScreenshotsProvider |
getDebugScreenshotsProvider() |
ImageMatchSettings |
getDefaultMatchSettings() |
static URI |
getDefaultServerUrl() |
String |
getEnvName()
If not
null specifies a name for the environment in which the application under test is running. |
FailureReports |
getFailureReports() |
protected String |
getFullAgentId() |
String |
getHostApp() |
String |
getHostOS() |
boolean |
getIgnoreCaret() |
protected abstract String |
getInferredEnvironment() |
boolean |
getIsDisabled() |
boolean |
getIsOpen() |
LogHandler |
getLogHandler() |
MatchLevel |
getMatchLevel()
Deprecated.
Please use
getDefaultMatchSettings() instead. |
int |
getMatchTimeout() |
String |
getParentBranchName() |
PositionProvider |
getPositionProvider() |
ProxySettings |
getProxy() |
boolean |
getSaveDebugScreenshots() |
boolean |
getSaveFailedTests() |
boolean |
getSaveNewTests() |
double |
getScaleRatio() |
protected abstract EyesScreenshot |
getScreenshot() |
URI |
getServerUrl() |
int |
getStitchOverlap()
Returns the stitching overlap in pixels.
|
protected abstract String |
getTitle() |
protected Trigger[] |
getUserInputs() |
protected abstract RectangleSize |
getViewportSize() |
protected void |
openBase(String appName,
String testName,
RectangleSize viewportSize,
SessionType sessionType)
Starts a test.
|
void |
setAgentId(String agentId)
Sets the user given agent id of the SDK.
|
void |
setApiKey(String apiKey)
Sets the API key of your applitools Eyes account.
|
void |
setAppEnvironment(String hostOS,
String hostApp)
Deprecated.
|
void |
setAppName(String appName) |
void |
setBaselineEnvName(String baselineEnvName)
If not
null, determines the name of the environment of the baseline. |
void |
setBaselineName(String baselineName)
Deprecated.
Only available for backward compatibility. See
setBaselineEnvName(String). |
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.
|
void |
setDebugScreenshotsPath(String pathToSave) |
void |
setDebugScreenshotsPrefix(String prefix) |
void |
setDefaultMatchSettings(ImageMatchSettings defaultMatchSettings)
Updates the match settings to be used for the session.
|
void |
setEnvName(String envName)
If not
null specifies a name for the environment in which the application under test is running. |
void |
setExplicitViewportSize(RectangleSize explicitViewportSize)
Define the viewport size as
size without doing any actual action on the |
void |
setFailureReports(FailureReports failureReports) |
void |
setHostApp(String hostApp) |
void |
setHostOS(String hostOS) |
void |
setIgnoreCaret(boolean value)
Sets the ignore blinking caret value.
|
void |
setImageCut(CutProvider cutProvider)
Manually set the the sizes to cut from an image before it's validated.
|
void |
setIsDisabled(boolean isDisabled) |
void |
setLogHandler(LogHandler logHandler)
Sets a handler of log messages generated by this API.
|
void |
setMatchLevel(MatchLevel matchLevel)
This function is deprecated.
|
void |
setMatchTimeout(int ms)
Sets the maximum time (in ms) a match operation tries to perform a match.
|
void |
setParentBranchName(String branchName)
Sets the branch under which new branches are created.
|
protected void |
setPositionProvider(PositionProvider positionProvider) |
void |
setProxy(ProxySettings proxySettings)
Sets the proxy settings to be used by the rest client.
|
void |
setSaveDebugScreenshots(boolean saveDebugScreenshots) |
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.
|
void |
setScaleRatio(Double scaleRatio)
Manually set the scale ratio for the images being validated.
|
void |
setServerUrl(URI serverUrl)
Sets the current server URL used by the rest client.
|
void |
setStitchOverlap(int pixels)
Sets the stitching overlap in pixels.
|
protected abstract void |
setViewportSize(RectangleSize size) |
protected void |
startSession()
Start eyes session on the eyes server.
|
protected MatchWindowDataWithScreenshot |
testResponseTimeBase(RegionProvider regionProvider,
Runnable action,
int deadline,
int timeout,
long matchInterval)
Runs a timing test.
|
protected static final int USE_DEFAULT_TIMEOUT
protected ServerConnector serverConnector
protected RunningSession runningSession
protected SessionStartInfo sessionStartInfo
protected PropertyHandler<RectangleSize> viewportSizeHandler
protected EyesScreenshot lastScreenshot
protected PropertyHandler<ScaleProvider> scaleProviderHandler
protected PropertyHandler<CutProvider> cutProviderHandler
protected PositionProvider positionProvider
protected Logger logger
protected DebugScreenshotsProvider debugScreenshotsProvider
protected int stitchingOverlap
public EyesBase(URI serverUrl)
EyesBaseinstance that interacts with the Eyes
Server at the specified url.serverUrl - The Eyes server URL.public void setAgentId(String agentId)
null is referred to
as no id.agentId - The agent ID to set.public String getAgentId()
public void setApiKey(String apiKey)
apiKey - The api key to set.public String getApiKey()
null if no key is set.public void setServerUrl(URI serverUrl)
serverUrl - The URI of the rest server, or null to use
the default server.public URI getServerUrl()
public void setProxy(ProxySettings proxySettings)
proxySettings - The proxy settings to be used by the rest client.
If null then no proxy is set.public ProxySettings getProxy()
null if no proxy is set.public void setIsDisabled(boolean isDisabled)
isDisabled - If true, all interactions with this API will be
silently ignored.public boolean getIsDisabled()
public void setAppName(String appName)
appName - The name of the application under test.public String getAppName()
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 String getBranchName()
setBranchName(String)).public void setParentBranchName(String branchName)
setBranchName(String).branchName - Branch name or null to specify the default branch.public String getParentBranchName()
setParentBranchName(String)).protected void clearUserInputs()
protected Trigger[] getUserInputs()
checkWindowBase invocations.public void setMatchTimeout(int ms)
ms - Total number of ms to wait for a match.public int getMatchTimeout()
(RegionProvider, String, boolean, int) waits for a match.public void setSaveNewTests(boolean saveNewTests)
saveNewTests - True if new tests should be saved by default. False otherwise.public boolean getSaveNewTests()
public void setSaveFailedTests(boolean saveFailedTests)
saveFailedTests - True if failed tests should be saved by default, false otherwise.public boolean getSaveFailedTests()
public void setBatch(BatchInfo batch)
null
if tests are to run standalone.batch - The batch info to set.public BatchInfo getBatch()
public void setFailureReports(FailureReports failureReports)
failureReports - The failure reports setting.FailureReportspublic FailureReports getFailureReports()
public void setDefaultMatchSettings(ImageMatchSettings defaultMatchSettings)
defaultMatchSettings - The match settings to be used for the session.public ImageMatchSettings getDefaultMatchSettings()
public void setMatchLevel(MatchLevel matchLevel)
setDefaultMatchSettings(com.applitools.eyes.ImageMatchSettings) instead.
The test-wide match level to use when checking application screenshot with the expected output.
matchLevel - The match level setting.MatchLevelpublic MatchLevel getMatchLevel()
getDefaultMatchSettings() instead.protected abstract String getBaseAgentId()
protected String getFullAgentId()
public boolean getIsOpen()
public static URI getDefaultServerUrl()
public void setLogHandler(LogHandler logHandler)
logHandler - Handles log messages generated by this API.public LogHandler getLogHandler()
public void setImageCut(CutProvider cutProvider)
cutProvider - the provider doing the cut.public void setScaleRatio(Double scaleRatio)
scaleRatio - The scale ratio to use, or null to reset
back to automatic scaling.public double getScaleRatio()
public void addProperty(String name, String value)
name - The property name.value - The property value.public void clearProperties()
public void setSaveDebugScreenshots(boolean saveDebugScreenshots)
saveDebugScreenshots - If true, will save all screenshots to local directory.public boolean getSaveDebugScreenshots()
public void setDebugScreenshotsPath(String pathToSave)
pathToSave - Path where you want to save the debug screenshots.public String getDebugScreenshotsPath()
public void setDebugScreenshotsPrefix(String prefix)
prefix - The prefix for the screenshots' names.public String getDebugScreenshotsPrefix()
public DebugScreenshotsProvider getDebugScreenshotsProvider()
public boolean getIgnoreCaret()
public void setIgnoreCaret(boolean value)
value - The ignore value.public int getStitchOverlap()
public void setStitchOverlap(int pixels)
pixels - The width (in pixels) of the overlap.public TestResults close()
public TestResults close(boolean throwEx)
throwEx - If true, an exception will be thrown for failed/new tests.TestFailedException - if a mismatch was found and throwEx is true.NewTestException - if this is a new test was found and throwEx
is true.protected void closeResponseTime(boolean isDeadlineExceeded)
isDeadlineExceeded - If true the test will fail (unless
it's a new test).TestFailedExceptionNewTestExceptionpublic void abortIfNotClosed()
public void setHostOS(String hostOS)
hostOS - The host OS running the AUT.public String getHostOS()
public void setHostApp(String hostApp)
hostApp - The application running the AUT (e.g., Chrome).public String getHostApp()
public void setBaselineName(String baselineName)
setBaselineEnvName(String).baselineName - If specified, determines the baseline to compare
with and disables automatic baseline inference.public String getBaselineName()
getBaselineEnvName().public void setBaselineEnvName(String baselineEnvName)
null, determines the name of the environment of the baseline.baselineEnvName - The name of the baseline's environment.public String getBaselineEnvName()
null, determines the name of the environment of the baseline.null if no such name was set.public void setEnvName(String envName)
null specifies a name for the environment in which the application under test is running.envName - The name of the environment of the baseline.public String getEnvName()
null specifies a name for the environment in which the application under test is running.null if no such name was set.@Deprecated public void setAppEnvironment(String hostOS, String hostApp)
setHostOS(String) and setHostApp(String).
Sets the OS (e.g., Windows) and application (e.g., Chrome) that host the application under test.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 PositionProvider getPositionProvider()
protected void setPositionProvider(PositionProvider positionProvider)
positionProvider - The position provider to be used.protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch)
checkWindowBase(RegionProvider, String, boolean, int).
retryTimeout defaults to USE_DEFAULT_TIMEOUT.regionProvider - Returns the region to check or the empty rectangle to check the entire window.tag - An optional tag to be associated with the snapshot.ignoreMismatch - Whether to ignore this check if a mismatch is found.protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch, int retryTimeout)
regionProvider - Returns the region to check or the empty rectangle to check the entire window.tag - An optional tag to be associated with the snapshot.ignoreMismatch - Whether to ignore this check if a mismatch is found.retryTimeout - The amount of time to retry matching in milliseconds or a negative
value to use the default retry timeout.TestFailedException - Thrown if a mismatch is detected and immediate failure reports are enabled.protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch, ICheckSettings checkSettings)
regionProvider - Returns the region to check or the empty rectangle to check the entire window.tag - An optional tag to be associated with the snapshot.ignoreMismatch - Whether to ignore this check if a mismatch is found.checkSettings - The settings to use.TestFailedException - Thrown if a mismatch is detected and immediate failure reports are enabled.protected MatchWindowDataWithScreenshot testResponseTimeBase(RegionProvider regionProvider, Runnable action, int deadline, int timeout, long matchInterval)
regionProvider - Returns the region to check or the empty rectangle to check the entire window.action - An action to run in parallel to starting the test, or null if no such action is required.deadline - The expected amount of time until finding a match. (Seconds)timeout - The maximum amount of time to retry matching. (Seconds)matchInterval - The interval for testing for a match. (Milliseconds)null if no match was found.protected void openBase(String appName, String testName, RectangleSize viewportSize, SessionType sessionType)
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.sessionType - The type of test (e.g., Progression for timing
tests), or null to use the default.protected abstract RectangleSize getViewportSize()
protected abstract void setViewportSize(RectangleSize size)
size - The required viewport size.public void setExplicitViewportSize(RectangleSize explicitViewportSize)
size without doing any actual action on theexplicitViewportSize - The size of the viewport. null disables the explicit 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 EyesScreenshot getScreenshot()
protected abstract String getTitle()
protected void addUserInput(Trigger trigger)
trigger - The trigger to add to the user inputs list.protected void addTextTriggerBase(Region control, String text)
control - The control's position relative to the window.text - The trigger's text.protected void addMouseTriggerBase(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 AppEnvironment getAppEnvironment()
protected void startSession()
Copyright © 2017. All rights reserved.