public abstract class EyesBase extends Object implements IEyesBase
| Modifier and Type | Field and Description |
|---|---|
protected String |
agentRunId |
protected PropertyHandler<CutProvider> |
cutProviderHandler |
protected DebugScreenshotsProvider |
debugScreenshotsProvider |
protected boolean |
isOpen |
protected EyesScreenshot |
lastScreenshot |
protected Logger |
logger |
protected PropertyHandler<PositionProvider> |
positionProviderHandler |
protected ClassicRunner0 |
runner |
protected RunningSession |
runningSession |
protected PropertyHandler<ScaleProvider> |
scaleProviderHandler |
protected ServerConnector |
serverConnector |
protected SessionStartInfo |
sessionStartInfo |
protected TestResultContainer |
testResultContainer |
protected static int |
USE_DEFAULT_TIMEOUT |
| Constructor and Description |
|---|
EyesBase() |
EyesBase(ClassicRunner0 runner) |
| Modifier and Type | Method and Description |
|---|---|
TestResults |
abort() |
void |
abortAsync() |
TestResults |
abortIfNotClosed() |
protected void |
addMouseTriggerBase(MouseAction action,
Region control,
Location cursor)
Adds a mouse trigger.
|
protected void |
addProperty(PropertyData property) |
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(Region region,
ICheckSettingsInternal checkSettingsInternal,
String source) |
protected MatchResult |
checkWindowBase(Region region,
ICheckSettings checkSettings,
String source)
Takes a snapshot of the application under test and matches it with the
expected output.
|
protected MatchResult |
checkWindowBase(Region region,
String tag,
ICheckSettings checkSettings) |
protected MatchResult |
checkWindowBase(Region region,
String tag,
int retryTimeout,
String source)
Takes a snapshot of the application under test and matches it with the
expected output.
|
protected MatchResult |
checkWindowBase(Region region,
String tag,
String source)
|
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.
|
void |
closeAsync() |
List<String> |
extractText(BaseOcrRegion... ocrRegions) |
Map<String,List<TextRegion>> |
extractTextRegions(TextRegionSettings textRegionSettings) |
protected ValidationInfo |
fireValidationWillStartEvent(String tag) |
Object |
getAgentSetup() |
String |
getApiKey() |
protected Object |
getAppEnvironment()
Application environment is the environment (e.g., the host OS) which
runs the application under test.
|
protected String |
getAppName() |
protected abstract void |
getAppOutputForOcr(BaseOcrRegion ocrRegion) |
protected abstract String |
getBaseAgentId() |
protected String |
getBaselineEnvName() |
Configuration |
getConfiguration() |
protected abstract Configuration |
getConfigurationInstance() |
String |
getDebugScreenshotsPath() |
String |
getDebugScreenshotsPrefix() |
DebugScreenshotsProvider |
getDebugScreenshotsProvider() |
static URI |
getDefaultServerUrl() |
Map<String,DeviceSize> |
getDevicesSizes(String path) |
String |
getFullAgentId() |
protected abstract String |
getInferredEnvironment() |
boolean |
getIsCutProviderExplicitlySet() |
Boolean |
getIsDisabled() |
boolean |
getIsOpen() |
boolean |
getIsScaleProviderExplicitlySet() |
Logger |
getLogger() |
LogHandler |
getLogHandler() |
Map<String,MobileDeviceInfo> |
getMobileDeviceInfo() |
PositionProvider |
getPositionProvider() |
AbstractProxySettings |
getProxy() |
RenderingInfo |
getRenderingInfo() |
boolean |
getSaveDebugScreenshots() |
double |
getScaleRatio() |
protected abstract EyesScreenshot |
getScreenshot(Region targetRegion,
ICheckSettingsInternal checkSettingsInternal) |
protected abstract ScreenshotProvider |
getScreenshotProvider() |
ServerConnector |
getServerConnector() |
URI |
getServerUrl() |
String |
getTestId() |
protected String |
getTestName() |
protected abstract String |
getTitle() |
Map<String,String> |
getUserAgents() |
protected Trigger[] |
getUserInputs() |
protected abstract RectangleSize |
getViewportSize() |
protected RectangleSize |
getViewportSizeForOpen() |
boolean |
isCompleted() |
Boolean |
isSendDom() |
void |
logSessionResultsAndThrowException(boolean throwEx,
TestResults results) |
protected void |
openBase() |
void |
openCompleted(RunningSession result) |
protected void |
openLogger() |
MatchResult |
performMatch(MatchWindowData data) |
protected MatchWindowData |
prepareForMatch(ICheckSettingsInternal checkSettingsInternal,
List<Trigger> userInputs,
AppOutput appOutput,
String tag,
boolean replaceLast,
ImageMatchSettings imageMatchSettings,
String renderId,
String source)
Creates the match model
|
SessionStartInfo |
prepareForOpen() |
SessionStopInfo |
prepareStopSession(boolean isAborted) |
Configuration |
setApiKey(String apiKey)
Sets the API key of your applitools Eyes account.
|
Configuration |
setBatch(BatchInfo batch)
Sets the batch in which context future tests will run or
null
if tests are to run standalone. |
void |
setDebugScreenshotsPath(String pathToSave) |
void |
setDebugScreenshotsPrefix(String prefix) |
protected void |
setEffectiveViewportSize(RectangleSize size) |
void |
setExplicitViewportSize(RectangleSize explicitViewportSize)
Define the viewport size as
size without doing any actual action on the |
void |
setImageCut(CutProvider cutProvider)
Manually set the the sizes to cut from an image before it's validated.
|
void |
setIsDisabled(boolean isDisabled) |
void |
setIsDisabled(Boolean isDisabled) |
void |
setLogHandler(LogHandler logHandler)
Sets a handler of log messages generated by this API.
|
void |
setPositionProvider(PositionProvider positionProvider) |
Configuration |
setProxy(AbstractProxySettings abstractProxySettings)
Sets the proxy settings to be used by the rest client.
|
void |
setSaveDebugScreenshots(boolean saveDebugScreenshots) |
void |
setScaleRatio(Double scaleRatio)
Manually set the scale ratio for the images being validated.
|
Configuration |
setSendDom(boolean isSendDom) |
void |
setServerConnector(ServerConnector serverConnector)
Sets the server connector to use.
|
Configuration |
setServerUrl(String serverUrl)
Sets the current server URL used by the rest client.
|
Configuration |
setServerUrl(URI serverUrl)
Sets the current server URL used by the rest client.
|
void |
setTestId(String testId) |
protected abstract Configuration |
setViewportSize(RectangleSize size) |
protected boolean |
shouldCaptureDom(Boolean sendDomFromCheckSettings) |
protected TestResults |
stopSession(boolean isAborted) |
protected String |
tryCaptureAndPostDom() |
protected abstract String |
tryCaptureDom() |
protected void |
validateResult(MatchResult result) |
protected static final int USE_DEFAULT_TIMEOUT
protected String agentRunId
protected ClassicRunner0 runner
protected ServerConnector serverConnector
protected RunningSession runningSession
protected SessionStartInfo sessionStartInfo
protected TestResultContainer testResultContainer
protected EyesScreenshot lastScreenshot
protected PropertyHandler<ScaleProvider> scaleProviderHandler
protected PropertyHandler<CutProvider> cutProviderHandler
protected PropertyHandler<PositionProvider> positionProviderHandler
protected Logger logger
protected boolean isOpen
protected DebugScreenshotsProvider debugScreenshotsProvider
public EyesBase()
public EyesBase(ClassicRunner0 runner)
public String getTestId()
public void setTestId(String testId)
public void setServerConnector(ServerConnector serverConnector)
serverConnector - The server connector object to use.public ServerConnector getServerConnector()
public Configuration setApiKey(String apiKey)
apiKey - The api key to set.public String getApiKey()
public Configuration setServerUrl(String serverUrl)
serverUrl - The URI of the rest server, or null to use
the default server.public Configuration setServerUrl(URI serverUrl)
serverUrl - The URI of the rest server, or null to use
the default server.public URI getServerUrl()
getServerUrl in interface IEyesBasepublic Configuration setProxy(AbstractProxySettings abstractProxySettings)
abstractProxySettings - The proxy settings to be used by the rest client.
If null then no proxy is set.public AbstractProxySettings 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()
getIsDisabled in interface IEyesBaseprotected void clearUserInputs()
protected Trigger[] getUserInputs()
checkWindowBase invocations.protected abstract String getBaseAgentId()
public String getFullAgentId()
getFullAgentId in interface IEyesBasepublic boolean getIsOpen()
public static URI getDefaultServerUrl()
public void setLogHandler(LogHandler logHandler)
setLogHandler in interface IEyesBaselogHandler - Handles log messages generated by this API.public LogHandler getLogHandler()
getLogHandler in interface IEyesBasepublic void setImageCut(CutProvider cutProvider)
cutProvider - the provider doing the cut.public boolean getIsCutProviderExplicitlySet()
public boolean getIsScaleProviderExplicitlySet()
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)
addProperty in interface IEyesBasename - The property name.value - The property value.protected void addProperty(PropertyData property)
public void clearProperties()
clearProperties in interface IEyesBasepublic 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 SessionStopInfo prepareStopSession(boolean isAborted)
public TestResults close()
public TestResults abort()
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.public TestResults abortIfNotClosed()
abortIfNotClosed in interface IEyesBaseprotected TestResults stopSession(boolean isAborted)
public void logSessionResultsAndThrowException(boolean throwEx,
TestResults results)
protected void openLogger()
public PositionProvider getPositionProvider()
public void setPositionProvider(PositionProvider positionProvider)
positionProvider - The position provider to be used.public List<String> extractText(BaseOcrRegion... ocrRegions)
protected abstract void getAppOutputForOcr(BaseOcrRegion ocrRegion)
public Map<String,List<TextRegion>> extractTextRegions(TextRegionSettings textRegionSettings)
protected abstract ScreenshotProvider getScreenshotProvider()
protected MatchWindowData prepareForMatch(ICheckSettingsInternal checkSettingsInternal, List<Trigger> userInputs, AppOutput appOutput, String tag, boolean replaceLast, ImageMatchSettings imageMatchSettings, String renderId, String source)
userInputs - The user inputs related to the current appOutput.appOutput - The application output to be matched.tag - Optional tag to be associated with the match (can be null).replaceLast - Whether to instruct the server to replace the screenshot of the last step.imageMatchSettings - The settings to use.public MatchResult performMatch(MatchWindowData data)
protected MatchResult checkWindowBase(Region region, String tag, String source)
region - The region to check or null for the entire window.tag - An optional tag to be associated with the snapshot.source - A string representing the source of the checkpoint.protected MatchResult checkWindowBase(Region region, String tag, int retryTimeout, String source)
region - The region to check or null for the entire window.tag - An optional tag to be associated with the snapshot.retryTimeout - The amount of time to retry matching in milliseconds or a negative
value to use the default retry timeout.source - A string representing the source of the checkpoint.TestFailedException - Thrown if a mismatch is detected and immediate failure reports are enabled.protected MatchResult checkWindowBase(Region region, String tag, ICheckSettings checkSettings)
protected MatchResult checkWindowBase(Region region, ICheckSettings checkSettings, String source)
region - The region to check or null for the entire window.checkSettings - The settings to use.source - A string representing the source of the checkpoint.TestFailedException - Thrown if a mismatch is detected and immediate failure reports are enabled.protected MatchResult checkWindowBase(Region region, ICheckSettingsInternal checkSettingsInternal, String source)
protected abstract String tryCaptureDom()
protected String tryCaptureAndPostDom()
protected boolean shouldCaptureDom(Boolean sendDomFromCheckSettings)
protected ValidationInfo fireValidationWillStartEvent(String tag)
protected void validateResult(MatchResult result)
public void setIsDisabled(Boolean isDisabled)
setIsDisabled in interface IEyesBasepublic SessionStartInfo prepareForOpen()
protected void openBase()
throws EyesException
EyesExceptionpublic void openCompleted(RunningSession result)
protected RectangleSize getViewportSizeForOpen()
protected abstract RectangleSize getViewportSize()
protected abstract Configuration setViewportSize(RectangleSize size)
size - The required viewport size.protected void setEffectiveViewportSize(RectangleSize 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(Region targetRegion, ICheckSettingsInternal checkSettingsInternal)
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 Object getAppEnvironment()
protected String getTestName()
protected String getAppName()
protected String getBaselineEnvName()
public Object getAgentSetup()
public Boolean isSendDom()
public Configuration setSendDom(boolean isSendDom)
public RenderingInfo getRenderingInfo()
public Map<String,DeviceSize> getDevicesSizes(String path)
public Map<String,MobileDeviceInfo> getMobileDeviceInfo()
public Configuration setBatch(BatchInfo batch)
null
if tests are to run standalone.batch - The batch info to set.protected abstract Configuration getConfigurationInstance()
public Configuration getConfiguration()
public void closeAsync()
closeAsync in interface IEyesBasepublic void abortAsync()
abortAsync in interface IEyesBasepublic boolean isCompleted()
Copyright © 2022. All rights reserved.