From c8e6c343483c4b4eaaa5b2a20b8c174c3b6c5f84 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 11 Aug 2014 13:43:53 +0300 Subject: Support setting persistent hover and require window focus parameters Change-Id: I0b2bb3fba1a8a854799fd087601ba54988ec423b --- .../src/com/vaadin/tests/tb3/AbstractTB3Test.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index e463f666d9..6c37e7b950 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -233,6 +233,15 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { */ private void setupRemoteDriver(DesiredCapabilities capabilities) throws Exception { + if (BrowserUtil.isIE(capabilities)) { + capabilities.setCapability( + InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, + requireWindowFocusForIE()); + capabilities.setCapability( + InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, + usePersistentHoverForIE()); + } + for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) { try { WebDriver dr = TestBench.createDriver(new RemoteWebDriver( @@ -1128,4 +1137,33 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { return findElement(By.xpath("//button[@title='Debug message log']")); } + /** + * Should the "require window focus" be enabled for Internet Explorer. + * RequireWindowFocus makes tests more stable but seems to be broken with + * certain commands such as sendKeys. Therefore it is not enabled by default + * for all tests + * + * @return true, to use the "require window focus" feature, false otherwise + */ + protected boolean requireWindowFocusForIE() { + return false; + } + + /** + * Should the "enable persistent hover" be enabled for Internet Explorer. + * + * Persistent hovering causes continuous firing of mouse over events at the + * last location the mouse cursor has been moved to. This is to avoid + * problems where the real mouse cursor is inside the browser window and + * Internet Explorer uses that location for some undefined operation + * (http:// + * jimevansmusic.blogspot.fi/2012/06/whats-wrong-with-internet-explorer + * .html) + * + * @return true, to use the "persistent hover" feature, false otherwise + */ + protected boolean usePersistentHoverForIE() { + return true; + } + } -- cgit v1.2.3