summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-08-21 11:38:22 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-21 09:58:18 +0000
commit279d862a4d457b28bde577076d6f87bdcbc96ce3 (patch)
treef734a28e976ecc1ef297edb36d913a7bd2d672fc /uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
parente482897e0c4296c0b74f03abccdc7449afffd222 (diff)
downloadvaadin-framework-279d862a4d457b28bde577076d6f87bdcbc96ce3.tar.gz
vaadin-framework-279d862a4d457b28bde577076d6f87bdcbc96ce3.zip
Do not automatically change DesiredCapabilities so equals works the way tests expect
Change-Id: I573f0a7f8544742396fcd5927bc3292350754c6d
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java')
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java37
1 files changed, 29 insertions, 8 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 8142c3ae6b..d2313a0709 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -266,12 +266,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());
+ if (requireWindowFocusForIE()) {
+ capabilities.setCapability(
+ InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
+ }
+ if (!usePersistentHoverForIE()) {
+ capabilities.setCapability(
+ InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
+ false);
+ }
}
WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
@@ -383,7 +386,10 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @param desiredCapabilities
*/
public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) {
- this.desiredCapabilities = desiredCapabilities;
+ // Make a copy as the desired capabilities can come from a shared,
+ // static resource. This will cause all kinds of problems if some test
+ // modifies the capabilities
+ this.desiredCapabilities = new DesiredCapabilities(desiredCapabilities);
}
/**
@@ -958,10 +964,25 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* Checks if the given capabilities refer to Internet Explorer 8
*
* @param capabilities
+ * @param version
* @return true if the capabilities refer to IE8, false otherwise
*/
public static boolean isIE8(DesiredCapabilities capabilities) {
- return isIE(capabilities) && "8".equals(capabilities.getVersion());
+ return isIE(8, capabilities);
+ }
+
+ /**
+ * Checks if the given capabilities refer to Internet Explorer of the
+ * given version
+ *
+ * @param capabilities
+ * @param version
+ * @return true if the capabilities refer to IE of the given version,
+ * false otherwise
+ */
+ public static boolean isIE(int version, DesiredCapabilities capabilities) {
+ return isIE(capabilities)
+ && ("" + version).equals(capabilities.getVersion());
}
/**