public class TestBenchCommandExecutor extends Object implements TestBenchCommands, HasDriver
Constructor and Description |
---|
TestBenchCommandExecutor(ImageComparison imageComparison,
ReferenceNameGenerator referenceNameGenerator) |
Modifier and Type | Method and Description |
---|---|
boolean |
compareScreen(BufferedImage reference,
String referenceName)
Tests that a screen shot is equal to the specified reference image.
|
boolean |
compareScreen(File reference)
Tests that a screen shot is equal to the specified reference image.
|
boolean |
compareScreen(String referenceId)
Tests that a screen shot is equal to the specified reference image.
|
void |
disableWaitForVaadin()
Disables implicit waiting for Vaadin to finish processing requests.
|
void |
enableWaitForVaadin()
Enables implicit waiting for Vaadin to finish processing requests.
|
protected Object |
executeAsyncScript(String script,
Object... args) |
Object |
executeScript(String script,
Object... args) |
void |
focusElement(TestBenchElement testBenchElement) |
TestBenchDriverProxy |
getDriver()
Return a reference to the
WebDriver instance associated with this
TestBenchCommandExecutor |
ImageComparison |
getImageComparison()
Gets the image comparison implementation used for screenshots.
|
ReferenceNameGenerator |
getReferenceNameGenerator()
Gets the name generator used for screenshot references.
|
String |
getRemoteControlName()
Finds the canonical host name of the remotely executing node where the
test is being run.
|
boolean |
isAutoScrollIntoView()
Whether or not the elements should be scrolled into the visible area of
the browser window before interacting with them
|
void |
resizeViewPortTo(int desiredWidth,
int desiredHeight)
Tries to resize the browsers window so that the space available for
actual web content (aka viewport) is of given size.
|
void |
setAutoScrollIntoView(boolean autoScrollIntoView)
Sets if the elements should be scrolled into the visible area of the
browser window before interacting with them
|
void |
setDriver(TestBenchDriverProxy driver) |
long |
timeSpentRenderingLastRequest()
This method provides performance information of the client-side rendering
for the last operation performed.
|
long |
timeSpentServicingLastRequest()
This method provides performance information of the server-side
processing for the last request.
|
long |
totalTimeSpentRendering()
This method provides performance information of the client-side rendering
for the entire session.
|
long |
totalTimeSpentServicingRequests()
This method provides performance information of the server-side
processing for the entire session.
|
void |
waitForVaadin()
Block until Vaadin reports it has finished processing server messages.
|
public TestBenchCommandExecutor(ImageComparison imageComparison, ReferenceNameGenerator referenceNameGenerator)
public void setDriver(TestBenchDriverProxy driver)
public String getRemoteControlName()
TestBenchCommands
getRemoteControlName
in interface TestBenchCommands
public void waitForVaadin()
public boolean compareScreen(String referenceId) throws IOException
CanCompareScreenshots
compareScreen
in interface CanCompareScreenshots
referenceId
- the ID of the reference imageIOException
- if there was a problem accessing the reference imagepublic boolean compareScreen(File reference) throws IOException
CanCompareScreenshots
compareScreen
in interface CanCompareScreenshots
reference
- the reference image fileIOException
- if there was a problem accessing the reference imagepublic boolean compareScreen(BufferedImage reference, String referenceName) throws IOException
CanCompareScreenshots
compareScreen
in interface CanCompareScreenshots
reference
- the reference imagereferenceName
- the filename of the reference image. Used when writing the
error files.IOException
- if there was a problem accessing the reference imagepublic long timeSpentRenderingLastRequest()
TestBenchCommands
TestBenchCommands.timeSpentRenderingLastRequest()
or
TestBenchCommands.totalTimeSpentServicingRequests()
, since they will perform an
extra request, causing the value returned from this method to be that for
an empty request/response.timeSpentRenderingLastRequest
in interface TestBenchCommands
public long totalTimeSpentRendering()
TestBenchCommands
totalTimeSpentRendering
in interface TestBenchCommands
public long timeSpentServicingLastRequest()
TestBenchCommands
TestBenchCommands.timeSpentRenderingLastRequest()
before calling this method. This is due to the fact that this method
causes an extra server round-trip, which will cause an empty response to
be rendered.timeSpentServicingLastRequest
in interface TestBenchCommands
public long totalTimeSpentServicingRequests()
TestBenchCommands
TestBenchCommands.timeSpentRenderingLastRequest()
before calling this method. This is due to the fact that this method
causes an extra server round-trip, which will cause an empty response to
be rendered.totalTimeSpentServicingRequests
in interface TestBenchCommands
public void disableWaitForVaadin()
TestBenchCommands
disableWaitForVaadin
in interface TestBenchCommands
public void enableWaitForVaadin()
TestBenchCommands
enableWaitForVaadin
in interface TestBenchCommands
public boolean isAutoScrollIntoView()
true
isAutoScrollIntoView
in interface TestBenchCommands
public void setAutoScrollIntoView(boolean autoScrollIntoView)
setAutoScrollIntoView
in interface TestBenchCommands
public TestBenchDriverProxy getDriver()
WebDriver
instance associated with this
TestBenchCommandExecutor
public void resizeViewPortTo(int desiredWidth, int desiredHeight) throws UnsupportedOperationException
TestBenchCommands
Note, that the result cannot be guaranteed on all platforms. For example browsers in mobile devices are most often always fullscreen and their viewport can be "simultated". Also browsers might not allow resizing the window or limit size of window to minimum or maximum (often limited by screen size). Currently most common desktop browsers support this.
resizeViewPortTo
in interface TestBenchCommands
desiredWidth
- the desired width of the viewportdesiredHeight
- the desired height of the viewportUnsupportedOperationException
public void focusElement(TestBenchElement testBenchElement)
public ReferenceNameGenerator getReferenceNameGenerator()
public ImageComparison getImageComparison()
Copyright © 2019. All rights reserved.