diff options
author | Artur Signell <artur@vaadin.com> | 2013-09-23 15:46:20 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-09-23 15:48:48 +0300 |
commit | 6b17abed4cbf3aff19efd58c5f3ca6195972f39e (patch) | |
tree | f9d61f3eca1ef8da5a6ffaa817d2bc5df6ec75da | |
parent | 7f7dc316e3593bc4823f2cbc8e6f4814f233ce03 (diff) | |
download | vaadin-framework-6b17abed4cbf3aff19efd58c5f3ca6195972f39e.tar.gz vaadin-framework-6b17abed4cbf3aff19efd58c5f3ca6195972f39e.zip |
Make it possible to override web driver in tests (#12572)
Change-Id: If696c8a57fc370d2851592d745ab8a2698631ed5
-rw-r--r-- | uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index f27fff5873..966be1a692 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -72,13 +72,36 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * Connect to the hub using a remote web driver, set the canvas size and * opens the initial URL as specified by {@link #getTestUrl()} * - * @throws MalformedURLException + * @throws Exception */ @Before - public void setup() throws MalformedURLException { + public void setup() throws Exception { + setupDriver(); + + String testUrl = getTestUrl(); + if (testUrl != null) { + driver.get(testUrl); + } + } + + /** + * Creates and configure the web driver to be used for the test. By default + * creates a remote web driver which connects to {@link #getHubURL()} and + * selects a browser based on {@link #getDesiredCapabilities()}. + * + * This method MUST call {@link #setDriver(WebDriver)} with the newly + * generated driver. + * + * @throws Exception + * If something goes wrong + */ + protected void setupDriver() throws Exception { DesiredCapabilities capabilities = getDesiredCapabilities(); - driver = TestBench.createDriver(new RemoteWebDriver( - new URL(getHubURL()), capabilities)); + + WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL( + getHubURL()), capabilities)); + setDriver(dr); + int w = SCREENSHOT_WIDTH; int h = SCREENSHOT_HEIGHT; @@ -93,10 +116,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { // Opera does not support this... } - String testUrl = getTestUrl(); - if (testUrl != null) { - driver.get(testUrl); - } } /** |