Package com.vaadin.testbench.commands
Class TestBenchCommandExecutor
java.lang.Object
com.vaadin.testbench.commands.TestBenchCommandExecutor
- All Implemented Interfaces:
 CanCompareScreenshots,TestBenchCommands,HasDriver
Provides actual implementation of TestBenchCommands
- 
Constructor Summary
ConstructorsConstructorDescriptionTestBenchCommandExecutor(ImageComparison imageComparison, ReferenceNameGenerator referenceNameGenerator)  - 
Method Summary
Modifier and TypeMethodDescriptionbooleancompareScreen(BufferedImage reference, String referenceName) Tests that a screen shot is equal to the specified reference image.booleancompareScreen(File reference) Tests that a screen shot is equal to the specified reference image.booleancompareScreen(String referenceId) Tests that a screen shot is equal to the specified reference image.voidDisables implicit waiting for Vaadin to finish processing requests.voidEnables implicit waiting for Vaadin to finish processing requests.protected ObjectexecuteAsyncScript(String script, Object... args) executeScript(String script, Object... args) voidfocusElement(TestBenchElement testBenchElement) Return a reference to theWebDriverinstance associated with thisTestBenchCommandExecutorGets the image comparison implementation used for screenshots.Gets the name generator used for screenshot references.Finds the canonical host name of the remotely executing node where the test is being run.booleanWhether or not the elements should be scrolled into the visible area of the browser window before interacting with themvoidresizeViewPortTo(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.voidsetAutoScrollIntoView(boolean autoScrollIntoView) Sets if the elements should be scrolled into the visible area of the browser window before interacting with themvoidsetDriver(TestBenchDriverProxy driver) longThis method provides performance information of the client-side rendering for the last operation performed.longThis method provides performance information of the server-side processing for the last request.longThis method provides performance information of the client-side rendering for the entire session.longThis method provides performance information of the server-side processing for the entire session.voidBlock until Vaadin reports it has finished processing server messages. 
- 
Constructor Details
- 
TestBenchCommandExecutor
public TestBenchCommandExecutor(ImageComparison imageComparison, ReferenceNameGenerator referenceNameGenerator)  
 - 
 - 
Method Details
- 
setDriver
 - 
getRemoteControlName
Description copied from interface:TestBenchCommandsFinds the canonical host name of the remotely executing node where the test is being run. This is useful for failure reporting when running on large grids where one machine may start having problems and you need to find out which of the machines it is.- Specified by:
 getRemoteControlNamein interfaceTestBenchCommands- Returns:
 - the canonical host name along with it's IP as a string.
 
 - 
waitForVaadin
public void waitForVaadin()Block until Vaadin reports it has finished processing server messages. - 
compareScreen
Description copied from interface:CanCompareScreenshotsTests that a screen shot is equal to the specified reference image. The comparison tolerance can be specified by setting the com.vaadin.testbench.block.error system property to a value between 0 and 1, where 0 == no changes are accepted and 1 == big changes are accepted. Note that specifying 1 doesn't mean that any reference image is accepted.- Specified by:
 compareScreenin interfaceCanCompareScreenshots- Parameters:
 referenceId- the ID of the reference image- Returns:
 - true if the screenshot is considered equal to the reference image, false otherwise.
 - Throws:
 IOException- if there was a problem accessing the reference image
 - 
compareScreen
Description copied from interface:CanCompareScreenshotsTests that a screen shot is equal to the specified reference image. The comparison tolerance can be specified by setting the com.vaadin.testbench.block.error system property to a value between 0 and 1, where 0 == no changes are accepted and 1 == all changes are accepted.- Specified by:
 compareScreenin interfaceCanCompareScreenshots- Parameters:
 reference- the reference image file- Returns:
 - true if the screenshot is considered equal to the reference image, false otherwise.
 - Throws:
 IOException- if there was a problem accessing the reference image
 - 
compareScreen
Description copied from interface:CanCompareScreenshotsTests that a screen shot is equal to the specified reference image. The comparison tolerance can be specified by setting the com.vaadin.testbench.block.error system property to a value between 0 and 1, where 0 == no changes are accepted and 1 == all changes are accepted.- Specified by:
 compareScreenin interfaceCanCompareScreenshots- Parameters:
 reference- the reference imagereferenceName- the filename of the reference image. Used when writing the error files.- Returns:
 - true if the screenshot is considered equal to the reference image, false otherwise.
 - Throws:
 IOException- if there was a problem accessing the reference image
 - 
timeSpentRenderingLastRequest
public long timeSpentRenderingLastRequest()Description copied from interface:TestBenchCommandsThis method provides performance information of the client-side rendering for the last operation performed. You can use this information to make sure that some operation is executed in a timely fashion. If more than one application is running at the same URL, e.g. a portal environment with many portlets on the same page, the value returned will be the sum for all applications. Note! This method needs to be called beforeTestBenchCommands.timeSpentRenderingLastRequest()orTestBenchCommands.totalTimeSpentServicingRequests(), since they will perform an extra request, causing the value returned from this method to be that for an empty request/response.- Specified by:
 timeSpentRenderingLastRequestin interfaceTestBenchCommands- Returns:
 - the time spent rendering the last request.
 
 - 
totalTimeSpentRendering
public long totalTimeSpentRendering()Description copied from interface:TestBenchCommandsThis method provides performance information of the client-side rendering for the entire session. The session starts when you navigate to an application and this method returns the amount of time spent rendering up to the point of the call. If more than one application is running at the same URL, e.g. a portal environment with many portlets on the same page, the value returned will be the sum for all applications.- Specified by:
 totalTimeSpentRenderingin interfaceTestBenchCommands- Returns:
 - the total time spent rendering in this session.
 
 - 
timeSpentServicingLastRequest
public long timeSpentServicingLastRequest()Description copied from interface:TestBenchCommandsThis method provides performance information of the server-side processing for the last request. You can use this information to ensure that an operation is processed in a timely fashion. If more than one application is running at the same URL, e.g. a portal environment with many portlets on the same page, the value returned will be the sum for all applications. Note! If you are interested in the client-side performance for the last request, you must callTestBenchCommands.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.- Specified by:
 timeSpentServicingLastRequestin interfaceTestBenchCommands- Returns:
 - the time spent servicing the last request on the server.
 
 - 
totalTimeSpentServicingRequests
public long totalTimeSpentServicingRequests()Description copied from interface:TestBenchCommandsThis method provides performance information of the server-side processing for the entire session. The session starts when you navigate to an application and this method returns the amount of time spent processing requests up to the point of the call. If more than one application is running at the same URL, e.g. a portal environment with many portlets on the same page, the value returned will be the sum for all applications. Note! If you are interested in the client-side performance for the last request, you must callTestBenchCommands.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.- Specified by:
 totalTimeSpentServicingRequestsin interfaceTestBenchCommands- Returns:
 - the total time spent servicing requests in this session.
 
 - 
disableWaitForVaadin
public void disableWaitForVaadin()Description copied from interface:TestBenchCommandsDisables implicit waiting for Vaadin to finish processing requests. This is useful if you need to test bombarding an application with events. Implicit waiting is enabled by default.- Specified by:
 disableWaitForVaadinin interfaceTestBenchCommands
 - 
enableWaitForVaadin
public void enableWaitForVaadin()Description copied from interface:TestBenchCommandsEnables implicit waiting for Vaadin to finish processing requests. Implicit waiting is enabled by default.- Specified by:
 enableWaitForVaadinin interfaceTestBenchCommands
 - 
isAutoScrollIntoView
public boolean isAutoScrollIntoView()Whether or not the elements should be scrolled into the visible area of the browser window before interacting with them. The default istrue- Specified by:
 isAutoScrollIntoViewin interfaceTestBenchCommands- Returns:
 - true if elements should be scrolled, otherwise false
 
 - 
setAutoScrollIntoView
public void setAutoScrollIntoView(boolean autoScrollIntoView) Sets if the elements should be scrolled into the visible area of the browser window before interacting with them- Specified by:
 setAutoScrollIntoViewin interfaceTestBenchCommands- Parameters:
 autoScrollIntoView-trueif elements should be scrolled
 - 
executeScript
 - 
executeAsyncScript
 - 
getDriver
Return a reference to theWebDriverinstance associated with thisTestBenchCommandExecutor - 
resizeViewPortTo
public void resizeViewPortTo(int desiredWidth, int desiredHeight) throws UnsupportedOperationException Description copied from interface:TestBenchCommandsTries to resize the browsers window so that the space available for actual web content (aka viewport) is of given size.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.
- Specified by:
 resizeViewPortToin interfaceTestBenchCommands- Parameters:
 desiredWidth- the desired width of the viewportdesiredHeight- the desired height of the viewport- Throws:
 UnsupportedOperationException
 - 
focusElement
 - 
getReferenceNameGenerator
Gets the name generator used for screenshot references.- Returns:
 - the name generator for screenshot references
 
 - 
getImageComparison
Gets the image comparison implementation used for screenshots.- Returns:
 - the image comparison implementation
 
 
 -