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 static int |
USE_DEFAULT_TIMEOUT |
protected RectangleSize |
viewportSize |
| 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.
|
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,
int retryTimeout)
Takes a snapshot of the application under test and matches it with the
expected output.
|
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() |
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() |
protected abstract String |
getInferredEnvironment() |
boolean |
getIsDisabled() |
boolean |
getIsOpen() |
LogHandler |
getLogHandler() |
MatchLevel |
getMatchLevel()
Deprecated.
Please use
getDefaultMatchSettings() instead. |
int |
getMatchTimeout() |
String |
getParentBranchName() |
protected PositionProvider |
getPositionProvider() |
ProxySettings |
getProxy() |
boolean |
getSaveDebugScreenshots() |
boolean |
getSaveFailedTests() |
boolean |
getSaveNewTests() |
double |
getScaleRatio() |
protected abstract EyesScreenshot |
getScreenshot() |
URI |
getServerUrl() |
protected abstract String |
getTitle() |
protected Trigger[] |
getUserInputs() |
protected abstract RectangleSize |
getViewportSize() |
void |
openBase(String appName,
String testName,
RectangleSize viewportSize,
SessionType sessionType)
Starts a test.
|
void |
setAgentId(String agentId) |
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) |
void |
setEnvName(String envName)
If not
null specifies a name for the environment in which the application under test is running. |
void |
setFailureReports(FailureReports failureReports) |
void |
setHostApp(String hostApp) |
void |
setHostOS(String hostOS) |
void |
setImageCut(CutProvider cutProvider) |
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) |
void |
setServerUrl(URI serverUrl)
Sets the current server URL used by the rest client.
|
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 RectangleSize viewportSize
protected EyesScreenshot lastScreenshot
protected PropertyHandler<ScaleProvider> scaleProviderHandler
protected PropertyHandler<CutProvider> cutProviderHandler
protected PositionProvider positionProvider
protected Logger logger
protected DebugScreenshotsProvider debugScreenshotsProvider
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)
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)
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)
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)
public void setScaleRatio(Double scaleRatio)
public double getScaleRatio()
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 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 (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.protected PositionProvider getPositionProvider()
protected void setPositionProvider(PositionProvider positionProvider)
positionProvider - The position provider to be used.protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch)
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 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.public 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.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.