Package com.vaadin.flow.testutil
Class AbstractParallelTestBenchTest
- java.lang.Object
-
- com.vaadin.testbench.TestBenchTestCase
-
- com.vaadin.testbench.parallel.ParallelTest
-
- com.vaadin.flow.testutil.TestBenchHelpers
-
- com.vaadin.flow.testutil.AbstractParallelTestBenchTest
-
- All Implemented Interfaces:
com.vaadin.testbench.HasDriver,com.vaadin.testbench.HasElementQuery,com.vaadin.testbench.HasSearchContext,com.vaadin.testbench.HasTestBenchCommandExecutor
public class AbstractParallelTestBenchTest extends TestBenchHelpers
Abstract base class for parallel flow TestBench tests.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static intSERVER_PORTServer port resolved by system property "serverPort" or the default "8888".static StringSERVER_PORT_PROPERTY_KEYSystem property key for the test server port.static booleanUSE_HUBstatic StringUSE_HUB_PROPERTY
-
Constructor Summary
Constructors Constructor Description AbstractParallelTestBenchTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<org.openqa.selenium.remote.DesiredCapabilities>getBrowserCapabilities(com.vaadin.testbench.parallel.Browser... browsers)Gets browser capabilities for the providedbrowsers.List<org.openqa.selenium.remote.DesiredCapabilities>getBrowsersToTest()Produces a collection of browsers to run the test on.protected StringgetDeploymentHostname()Used to determine what URL to initially open for the test.protected intgetDeploymentPort()Used to determine what port the test is running on.protected List<org.openqa.selenium.remote.DesiredCapabilities>getHubBrowsersToTest()Gets the browsers capabilities list to execute test on the tests Hub.protected Optional<LocalExecution>getLocalExecution()Gets local execution (LocalExecution) configuration for the test.protected StringgetRootURL()Returns the URL to the root of the server, e.g.protected com.vaadin.testbench.parallel.BrowsergetRunLocallyBrowser()voidsetup()protected voidupdateHeadlessChromeOptions(org.openqa.selenium.chrome.ChromeOptions chromeOptions)Allows modifying the chrome options to be used when running on a local Chrome.-
Methods inherited from class com.vaadin.flow.testutil.TestBenchHelpers
assertEquals, blur, checkLogsForErrors, checkLogsForErrors, clickElementWithJs, clickElementWithJs, drag, dragAndDrop, dragElementOver, executeScript, getLogEntries, getScrollX, getScrollY, hasCssClass, isElementPresent, scrollBy, scrollIntoViewAndClick, scrollToElement, waitForDevServer, waitForElementNotPresent, waitForElementPresent, waitForElementVisible, waitUntilNot, waitUntilNot
-
Methods inherited from class com.vaadin.testbench.parallel.ParallelTest
getDefaultCapabilities, getDesiredCapabilities, getHubHostname, getHubURL, getRunLocallyBrowserVersion, getRunOnHub, setDesiredCapabilities
-
Methods inherited from class com.vaadin.testbench.TestBenchTestCase
concatUrl, findElement, findElements, getCommandExecutor, getContext, getDriver, setDriver, testBench, waitUntil, waitUntil, wrap
-
-
-
-
Field Detail
-
SERVER_PORT_PROPERTY_KEY
public static final String SERVER_PORT_PROPERTY_KEY
System property key for the test server port.- See Also:
- Constant Field Values
-
SERVER_PORT
public static final int SERVER_PORT
Server port resolved by system property "serverPort" or the default "8888".
-
USE_HUB_PROPERTY
public static final String USE_HUB_PROPERTY
- See Also:
- Constant Field Values
-
USE_HUB
public static final boolean USE_HUB
-
-
Method Detail
-
setup
public void setup() throws Exception- Overrides:
setupin classcom.vaadin.testbench.parallel.ParallelTest- Throws:
Exception
-
updateHeadlessChromeOptions
protected void updateHeadlessChromeOptions(org.openqa.selenium.chrome.ChromeOptions chromeOptions)
Allows modifying the chrome options to be used when running on a local Chrome.- Parameters:
chromeOptions- chrome options to use when running on a local Chrome
-
getRootURL
protected String getRootURL()
Returns the URL to the root of the server, e.g. "http://localhost:8888"- Returns:
- the URL to the root
-
getDeploymentPort
protected int getDeploymentPort()
Used to determine what port the test is running on.- Returns:
- The port the test is running on, by default AbstractTestBenchTest.DEFAULT_SERVER_PORT
-
getLocalExecution
protected Optional<LocalExecution> getLocalExecution()
Gets local execution (LocalExecution) configuration for the test.If this method return an empty optional then test with be run on the test Hub
- Returns:
- an optional configuration, or an empty optional if configuration is disabled or not available
- See Also:
LocalExecution
-
getRunLocallyBrowser
protected com.vaadin.testbench.parallel.Browser getRunLocallyBrowser()
- Overrides:
getRunLocallyBrowserin classcom.vaadin.testbench.parallel.ParallelTest
-
getDeploymentHostname
protected String getDeploymentHostname()
Used to determine what URL to initially open for the test.- Returns:
- the host name of development server
-
getBrowsersToTest
public List<org.openqa.selenium.remote.DesiredCapabilities> getBrowsersToTest()
Produces a collection of browsers to run the test on. This method is executed by the test runner when determining how many test methods to invoke and with what parameters. For each returned value a test method is ran and before running that,ParallelTest.setDesiredCapabilities(DesiredCapabilities)is invoked with the value returned by this method.- Returns:
- The browsers to run the test on
-
getHubBrowsersToTest
protected List<org.openqa.selenium.remote.DesiredCapabilities> getHubBrowsersToTest()
Gets the browsers capabilities list to execute test on the tests Hub.This list will be used only for the tests Hub. Local test execution is managed by
LocalExecutionannotation.The method
getBrowsersToTest()delegates the logic to this method in casegetLocalExecution()return value is an empty optional (i.e. the tests Hub is used).- Returns:
- the browsers capabilities list to execute test on the tests Hub
-
getBrowserCapabilities
protected List<org.openqa.selenium.remote.DesiredCapabilities> getBrowserCapabilities(com.vaadin.testbench.parallel.Browser... browsers)
Gets browser capabilities for the providedbrowsers.- Parameters:
browsers- a browsers list- Returns:
- the capabilities for the given
browsers
-
-