Package com.vaadin.flow.testutil
Class ChromeDeviceTest
java.lang.Object
com.vaadin.testbench.TestBenchTestCase
com.vaadin.testbench.parallel.ParallelTest
com.vaadin.flow.testutil.TestBenchHelpers
com.vaadin.flow.testutil.AbstractTestBenchTest
com.vaadin.flow.testutil.ViewOrUITest
com.vaadin.flow.testutil.ChromeDeviceTest
- All Implemented Interfaces:
com.vaadin.testbench.HasDriver,com.vaadin.testbench.HasElementQuery,com.vaadin.testbench.HasSearchContext,com.vaadin.testbench.HasTestBenchCommandExecutor
Base class for TestBench tests to run in Chrome with customized options,
which enable device emulation mode by default.
This facilitates testing with network connection overrides, e. g., using offline mode in the tests.
It is required to set system property with path to the driver to be able to run the test.
The test can be executed locally and on a test Hub. ChromeDriver is used if test is executed locally.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.testutil.AbstractTestBenchTest
AbstractTestBenchTest.ClientChecker -
Field Summary
Fields inherited from class com.vaadin.flow.testutil.AbstractTestBenchTest
BROWSERSTACK_IDENTIFIER, BROWSERSTACK_IDENTIFIER_PROPERTY, SERVER_PORT, SERVER_PORT_PROPERTY_KEY, testName, USE_BROWSERSTACK, USE_BROWSERSTACK_PROPERTY, USE_HUB, USE_HUB_PROPERTYFields inherited from class com.vaadin.testbench.parallel.ParallelTest
screenshotOnFailureFields inherited from class com.vaadin.testbench.TestBenchTestCase
driver, maxAttempts -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.openqa.selenium.chrome.ChromeOptionscustomizeChromeOptions(org.openqa.selenium.chrome.ChromeOptions chromeOptions) Customizes given Chrome options to enable network connection emulation.protected DevToolsWrapperprotected List<org.openqa.selenium.remote.DesiredCapabilities> Gets the browsers capabilities list to execute test on the tests Hub.voidsetup()voidMethods inherited from class com.vaadin.flow.testutil.ViewOrUITest
getTestPath, getUIClass, getViewClassMethods inherited from class com.vaadin.flow.testutil.AbstractTestBenchTest
assertImageEquals, assertRuleOnce, checkIfServerAvailable, getBrowserCapabilities, getBrowsersToTest, getCurrentHostAddress, getDeploymentHostname, getDeploymentPort, getHubHostname, getLocalExecution, getRootURL, getRunLocallyBrowser, getRunLocallyBrowserVersion, getTestURL, getTestURL, isClientRouter, open, open, openForEs6Url, openUrl, verifyScreenshot, waitForClientRouter, waitForFont, waitForWebComponent, waitForWebComponentsBootstrapMethods 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, waitUntilNotMethods inherited from class com.vaadin.testbench.parallel.ParallelTest
getDefaultCapabilities, getDesiredCapabilities, getHubURL, getRunOnHub, setDesiredCapabilitiesMethods inherited from class com.vaadin.testbench.TestBenchTestCase
concatUrl, findElement, findElements, getCommandExecutor, getContext, getDriver, setDriver, testBench, waitUntil, waitUntil, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.testbench.HasElementQuery
$, $
-
Constructor Details
-
ChromeDeviceTest
public ChromeDeviceTest()
-
-
Method Details
-
getDevTools
-
setup
- Overrides:
setupin classcom.vaadin.testbench.parallel.ParallelTest- Throws:
Exception
-
customizeChromeOptions
protected org.openqa.selenium.chrome.ChromeOptions customizeChromeOptions(org.openqa.selenium.chrome.ChromeOptions chromeOptions) Customizes given Chrome options to enable network connection emulation.- Parameters:
chromeOptions- Chrome options to customize- Returns:
- customized Chrome options instance
-
getHubBrowsersToTest
Description copied from class:AbstractTestBenchTestGets 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
AbstractTestBenchTest.getBrowsersToTest()delegates the logic to this method in caseAbstractTestBenchTest.getLocalExecution()return value is an empty optional (i.e. the tests Hub is used).- Overrides:
getHubBrowsersToTestin classAbstractTestBenchTest- Returns:
- the browsers capabilities list to execute test on the tests Hub
-
waitForServiceWorkerReady
public void waitForServiceWorkerReady()
-