Class ChromeDeviceTest

java.lang.Object
com.vaadin.testbench.TestBenchTestCase
com.vaadin.testbench.parallel.ParallelTest
All Implemented Interfaces:
com.vaadin.testbench.HasDriver, com.vaadin.testbench.HasElementQuery, com.vaadin.testbench.HasSearchContext, com.vaadin.testbench.HasTestBenchCommandExecutor

public class ChromeDeviceTest extends ViewOrUITest
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
  • Constructor Details

    • ChromeDeviceTest

      public ChromeDeviceTest()
  • Method Details

    • getDevTools

      protected DevToolsWrapper getDevTools()
    • setup

      public void setup() throws Exception
      Overrides:
      setup in class com.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

      protected List<org.openqa.selenium.remote.DesiredCapabilities> getHubBrowsersToTest()
      Description copied from class: AbstractTestBenchTest
      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 LocalExecution annotation.

      The method AbstractTestBenchTest.getBrowsersToTest() delegates the logic to this method in case AbstractTestBenchTest.getLocalExecution() return value is an empty optional (i.e. the tests Hub is used).

      Overrides:
      getHubBrowsersToTest in class AbstractTestBenchTest
      Returns:
      the browsers capabilities list to execute test on the tests Hub
    • waitForServiceWorkerReady

      public void waitForServiceWorkerReady()