From 9be3b40801a73edae8b96c03670d8d2d029f0ee5 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 12 Nov 2013 17:12:30 +0200 Subject: Workaround for missing value change event in chrome (#10109) Change-Id: I019527041539fcd0083261b693767144492e626a --- ...tiveSelectsAndChromeKeyboardNavigationTest.java | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java new file mode 100644 index 0000000000..364d3bd8d4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java @@ -0,0 +1,131 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.nativeselect; + +import java.util.Collections; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.Platform; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class NativeSelectsAndChromeKeyboardNavigationTest extends + MultiBrowserTest { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest() + */ + @Override + public List getBrowsersToTest() { + DesiredCapabilities chrome = DesiredCapabilities.chrome(); + chrome.setPlatform(Platform.WINDOWS); + return Collections.singletonList(chrome); + } + + @Test + public void testValueChangeListenerWithKeyboardNavigation() + throws InterruptedException { + setDebug(true); + openTestURL(); + Thread.sleep(1000); + menu("Component"); + menuSub("Listeners"); + menuSub("Value change listener"); + + getDriver().findElement(By.tagName("body")).click(); + + WebElement select = getDriver().findElement(By.tagName("select")); + select.sendKeys(Keys.ARROW_DOWN); + select.sendKeys(Keys.ARROW_DOWN); + select.sendKeys(Keys.ARROW_DOWN); + + String bodytext = getDriver().findElement(By.tagName("body")).getText(); + + Assert.assertTrue(bodytext.contains("new value: 'Item 1'")); + Assert.assertTrue(bodytext.contains("new value: 'Item 2'")); + Assert.assertTrue(bodytext.contains("new value: 'Item 3'")); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.tb3.AbstractTB3Test#getUIClass() + */ + @Override + protected Class getUIClass() { + return NativeSelects.class; + } + + // Uncomment this to debug test in local/portforwarded chromedriver + // @Override + // protected void setupLocalDriver() { + // WebDriver chromeDriver; + // try { + // chromeDriver = new RemoteWebDriver( + // new URL("http://localhost:9515"), getBrowsersToTest() + // .iterator().next()); + // setDriver(chromeDriver); + // } catch (MalformedURLException e) { + // e.printStackTrace(); + // } + // } + // + // /* + // * (non-Javadoc) + // * + // * @see com.vaadin.tests.tb3.AbstractTB3Test#runLocally() + // */ + // @Override + // public boolean runLocally() { + // return false; + // } + + /** + * @since + * @param string + */ + private void menuSub(String string) { + getDriver().findElement(By.xpath("//span[text() = '" + string + "']")) + .click(); + new Actions(getDriver()).moveByOffset(100, 0).build().perform(); + } + + /** + * @since + * @param string + */ + private void menu(String string) { + getDriver().findElement(By.xpath("//span[text() = '" + string + "']")) + .click(); + + } + +} -- cgit v1.2.3 From cbc9949b6922d31c848f6288565c9c3de3359780 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 14 Nov 2013 11:41:40 +0200 Subject: Added test case for #12726 Change-Id: I396bfa4f255d64dd1729afa1be6771ff35026ad9 --- .../window/SubWindowsTextSelectionTest.java | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java new file mode 100644 index 0000000000..1df036af58 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java @@ -0,0 +1,97 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.window; + +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Point; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for issue #12726, IE's make text selection when sub windows are + * dragged(moved). + * + * @since + * @author Vaadin Ltd + */ +public class SubWindowsTextSelectionTest extends MultiBrowserTest { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.tb3.AbstractTB3Test#getUIClass() + */ + @Override + protected Class getUIClass() { + return SubWindows.class; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest() + */ + @Override + public List getBrowsersToTest() { + ArrayList list = new ArrayList(); + list.add(BrowserUtil.ie(9)); + list.add(BrowserUtil.ie(10)); + list.add(BrowserUtil.ie(11)); + return list; + } + + @Test + public void verifyNoTextSelectionOnMove() throws MalformedURLException { + + openTestURL(); + + WebElement element = driver.findElement(By + .className("v-window-outerheader")); + + Point location = element.getLocation(); + + element.click(); + + new Actions(driver).moveToElement(element).perform(); + sleep(100); + // move pointer bit right from the caption text + new Actions(driver).moveByOffset(50, 0).clickAndHold() + .moveByOffset(10, 2).moveByOffset(10, 0).moveByOffset(10, 0) + .moveByOffset(10, 0).release().perform(); + + String selection = ((JavascriptExecutor) getDriver()).executeScript( + "return document.getSelection().toString();").toString(); + + Assert.assertTrue("Text selection was not empty:" + selection, + selection.isEmpty()); + + // Verify also that window was really moved + Point location2 = element.getLocation(); + Assert.assertEquals(location.getX() + (4 * 10), location2.getX()); + + } + +} -- cgit v1.2.3 From e05e10eccf1886c1621421d584615a278dd44d62 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 14 Nov 2013 12:17:04 +0200 Subject: Added extra asserts to make test more safer to blind refactorings Change-Id: I5dd159640bdc4f188c291017032ca96ca8b85d11 --- .../tests/components/datefield/DateFieldTestTest.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java index 557201e803..123fd167d0 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java @@ -35,9 +35,14 @@ public class DateFieldTestTest extends MultiBrowserTest { menu("Component"); menuSub("State"); menu("Required"); + assertRequiredIndicatorVisible(); assertNoErrorNotification(); } + private void assertRequiredIndicatorVisible() { + getDriver().findElement(By.className("v-required-field-indicator")); + } + private void assertNoErrorNotification() { try { getDriver().findElement( @@ -58,6 +63,8 @@ public class DateFieldTestTest extends MultiBrowserTest { menuSub("State"); menu("Required"); + assertRequiredIndicatorVisible(); + menu("Component"); menuSub("Features"); menuSub("Resolution"); @@ -100,8 +107,8 @@ public class DateFieldTestTest extends MultiBrowserTest { * @param string */ private void menuSub(String string) { - getDriver().findElement( - By.xpath("//span[text() = '" + string + "']")).click(); + getDriver().findElement(By.xpath("//span[text() = '" + string + "']")) + .click(); new Actions(getDriver()).moveByOffset(100, 0).build().perform(); } @@ -110,8 +117,8 @@ public class DateFieldTestTest extends MultiBrowserTest { * @param string */ private void menu(String string) { - getDriver().findElement( - By.xpath("//span[text() = '" + string + "']")).click(); + getDriver().findElement(By.xpath("//span[text() = '" + string + "']")) + .click(); } -- cgit v1.2.3 From 33e58977c266c3b5846bb2edc5e673359768ed2e Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 11 Nov 2013 20:41:09 +0200 Subject: Use localhost when running locally to avoid potential network issues Change-Id: Ie43604a2b41d2214d55d0976ba3c81ea361c8c56 --- uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index caa35732d6..89fa304bfe 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -80,6 +80,9 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { @Override protected String getDeploymentHostname() { + if (runLocally()) { + return "localhost"; + } String hostName = getProperty(HOSTNAME_PROPERTY); if (hostName == null || "".equals(hostName)) { -- cgit v1.2.3 From 642818fef200429d4206403e98aabd54ff3b6dd8 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 14 Nov 2013 09:38:05 +0200 Subject: Allow using @RunLocally to run on a local Firefox/Chrome/Safari Change-Id: Ibb1dfd12dc48637d8179f80322b5203ea5562805 --- .../com/vaadin/tests/VerifyBrowserVersionTest.java | 13 ++- .../actions/ActionsOnInvisibleComponentsTest.java | 8 +- ...tiveSelectsAndChromeKeyboardNavigationTest.java | 30 +------ .../tests/integration/AbstractIntegrationTest.java | 5 +- .../src/com/vaadin/tests/tb3/AbstractTB3Test.java | 96 ++++++++++++++++------ .../src/com/vaadin/tests/tb3/MultiBrowserTest.java | 35 +++++--- .../vaadin/tests/tb3/PrivateTB3Configuration.java | 33 ++++++-- uitest/src/com/vaadin/tests/tb3/TB3Runner.java | 8 +- uitest/src/com/vaadin/tests/tb3/WebsocketTest.java | 6 +- 9 files changed, 140 insertions(+), 94 deletions(-) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java index ae5806af56..bb0b40e2d1 100644 --- a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java @@ -30,23 +30,22 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest { { expectedUserAgent - .put(BrowserUtil - .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION), + .put(Browser.FIREFOX.getDesiredCapabilities(), "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"); expectedUserAgent - .put(BrowserUtil.ie(8), + .put(Browser.IE8.getDesiredCapabilities(), "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"); expectedUserAgent - .put(BrowserUtil.ie(9), + .put(Browser.IE9.getDesiredCapabilities(), "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"); expectedUserAgent - .put(BrowserUtil.ie(10), + .put(Browser.IE10.getDesiredCapabilities(), "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"); expectedUserAgent - .put(BrowserUtil.ie(11), + .put(Browser.IE11.getDesiredCapabilities(), "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); expectedUserAgent - .put(BrowserUtil.chrome(MultiBrowserTest.TESTED_CHROME_VERSION), + .put(Browser.CHROME.getDesiredCapabilities(), "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"); } diff --git a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java index ca00c998a6..1d08ee5ede 100644 --- a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java +++ b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java @@ -18,12 +18,12 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { public List getBrowsersToTest() { List browsers = super.getBrowsersToTest(); // sendKeys does nothing on these browsers - browsers.remove(BrowserUtil.firefox(24)); - browsers.remove(BrowserUtil.ie(8)); - browsers.remove(BrowserUtil.opera(12)); + browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); + browsers.remove(Browser.IE8.getDesiredCapabilities()); + browsers.remove(Browser.OPERA.getDesiredCapabilities()); // Causes 'cannot focus element' - browsers.remove(BrowserUtil.chrome(29)); + browsers.remove(Browser.CHROME.getDesiredCapabilities()); return browsers; } diff --git a/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java index 364d3bd8d4..e038c451d0 100644 --- a/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java +++ b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java @@ -22,7 +22,6 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; -import org.openqa.selenium.Platform; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; @@ -44,9 +43,8 @@ public class NativeSelectsAndChromeKeyboardNavigationTest extends */ @Override public List getBrowsersToTest() { - DesiredCapabilities chrome = DesiredCapabilities.chrome(); - chrome.setPlatform(Platform.WINDOWS); - return Collections.singletonList(chrome); + return Collections.singletonList(Browser.CHROME + .getDesiredCapabilities()); } @Test @@ -84,30 +82,6 @@ public class NativeSelectsAndChromeKeyboardNavigationTest extends return NativeSelects.class; } - // Uncomment this to debug test in local/portforwarded chromedriver - // @Override - // protected void setupLocalDriver() { - // WebDriver chromeDriver; - // try { - // chromeDriver = new RemoteWebDriver( - // new URL("http://localhost:9515"), getBrowsersToTest() - // .iterator().next()); - // setDriver(chromeDriver); - // } catch (MalformedURLException e) { - // e.printStackTrace(); - // } - // } - // - // /* - // * (non-Javadoc) - // * - // * @see com.vaadin.tests.tb3.AbstractTB3Test#runLocally() - // */ - // @Override - // public boolean runLocally() { - // return false; - // } - /** * @since * @param string diff --git a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java index ddaf84b3e1..cbb3a8b8e4 100644 --- a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java +++ b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized.Parameters; import org.openqa.selenium.remote.DesiredCapabilities; -import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.MultiBrowserTest.Browser; import com.vaadin.tests.tb3.PrivateTB3Configuration; /** @@ -47,8 +47,7 @@ public abstract class AbstractIntegrationTest extends PrivateTB3Configuration { @Parameters public static Collection getBrowsersForTest() { - return Collections.singleton(BrowserUtil - .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION)); + return Collections.singleton(Browser.FIREFOX.getDesiredCapabilities()); } } diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index d4eed99f19..f6e58a51b2 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -16,6 +16,10 @@ package com.vaadin.tests.tb3; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.net.URL; import java.util.Collections; import java.util.List; @@ -39,6 +43,7 @@ import com.vaadin.server.UIProvider; import com.vaadin.testbench.TestBench; import com.vaadin.testbench.TestBenchTestCase; import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.tb3.MultiBrowserTest.Browser; import com.vaadin.ui.UI; /** @@ -76,8 +81,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { private boolean push = false; { // Default browser to run on unless setDesiredCapabilities is called - desiredCapabilities = BrowserUtil - .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION); + desiredCapabilities = Browser.FIREFOX.getDesiredCapabilities(); } /** @@ -103,8 +107,9 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * If something goes wrong */ protected void setupDriver() throws Exception { - if (runLocally()) { - setupLocalDriver(); + RunLocally runLocally = getClass().getAnnotation(RunLocally.class); + if (runLocally != null) { + setupLocalDriver(runLocally.value().getDesiredCapabilities()); return; } DesiredCapabilities capabilities = getDesiredCapabilities(); @@ -129,14 +134,10 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { } - /** - * Override and return true to run the test locally. This method is only to - * be used for developing tests. - * - * @return true to run the test on a local browser, false to use the hub - */ - public boolean runLocally() { - return false; + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + public @interface RunLocally { + public Browser value() default Browser.FIREFOX; } /** @@ -144,7 +145,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * for debug purposes. Used only when {@link #runLocally()} is overridden to * return true; */ - protected abstract void setupLocalDriver(); + protected abstract void setupLocalDriver( + DesiredCapabilities desiredCapabilities); /** * Opens the given test (defined by {@link #getTestUrl()}, optionally with @@ -212,9 +214,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * @return The browsers to run the test on */ public List getBrowsersToTest() { - return Collections.singletonList(BrowserUtil - .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION)); - + return Collections.singletonList(Browser.FIREFOX + .getDesiredCapabilities()); } /** @@ -738,8 +739,53 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * @return true if the capabilities refer to IE8, false otherwise */ public static boolean isIE8(DesiredCapabilities capabilities) { - return BrowserType.IE.equals(capabilities.getBrowserName()) - && "8".equals(capabilities.getVersion()); + return isIE(capabilities) && "8".equals(capabilities.getVersion()); + } + + /** + * @param capabilities + * The capabilities to check + * @return true if the capabilities refer to Internet Explorer, false + * otherwise + */ + public static boolean isIE(DesiredCapabilities capabilities) { + return BrowserType.IE.equals(capabilities.getBrowserName()); + } + + /** + * @param capabilities + * The capabilities to check + * @return true if the capabilities refer to Chrome, false otherwise + */ + public static boolean isChrome(DesiredCapabilities capabilities) { + return BrowserType.CHROME.equals(capabilities.getBrowserName()); + } + + /** + * @param capabilities + * The capabilities to check + * @return true if the capabilities refer to Opera, false otherwise + */ + public static boolean isOpera(DesiredCapabilities capabilities) { + return BrowserType.OPERA.equals(capabilities.getBrowserName()); + } + + /** + * @param capabilities + * The capabilities to check + * @return true if the capabilities refer to Safari, false otherwise + */ + public static boolean isSafari(DesiredCapabilities capabilities) { + return BrowserType.SAFARI.equals(capabilities.getBrowserName()); + } + + /** + * @param capabilities + * The capabilities to check + * @return true if the capabilities refer to Firefox, false otherwise + */ + public static boolean isFirefox(DesiredCapabilities capabilities) { + return BrowserType.FIREFOX.equals(capabilities.getBrowserName()); } /** @@ -751,21 +797,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { */ public static String getBrowserIdentifier( DesiredCapabilities capabilities) { - String browserName = capabilities.getBrowserName(); - - if (BrowserType.IE.equals(browserName)) { + if (isIE(capabilities)) { return "InternetExplorer"; - } else if (BrowserType.FIREFOX.equals(browserName)) { + } else if (isFirefox(capabilities)) { return "Firefox"; - } else if (BrowserType.CHROME.equals(browserName)) { + } else if (isChrome(capabilities)) { return "Chrome"; - } else if (BrowserType.SAFARI.equals(browserName)) { + } else if (isSafari(capabilities)) { return "Safari"; - } else if (BrowserType.OPERA.equals(browserName)) { + } else if (isOpera(capabilities)) { return "Opera"; } - return browserName; + return capabilities.getBrowserName(); } /** diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java index e8a974343b..e166e421ef 100644 --- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java @@ -40,23 +40,34 @@ import org.openqa.selenium.remote.DesiredCapabilities; */ public abstract class MultiBrowserTest extends PrivateTB3Configuration { - public static final int TESTED_SAFARI_VERSION = 7; - public static final int TESTED_CHROME_VERSION = 29; - public static final int TESTED_FIREFOX_VERSION = 24; + public enum Browser { + FIREFOX(BrowserUtil.firefox(24)), CHROME(BrowserUtil.chrome(29)), SAFARI( + BrowserUtil.safari(7)), IE8(BrowserUtil.ie(8)), IE9(BrowserUtil + .ie(9)), IE10(BrowserUtil.ie(10)), IE11(BrowserUtil.ie(11)), OPERA( + BrowserUtil.opera(17)); + private DesiredCapabilities desiredCapabilities; + + private Browser(DesiredCapabilities desiredCapabilities) { + this.desiredCapabilities = desiredCapabilities; + } + + public DesiredCapabilities getDesiredCapabilities() { + return desiredCapabilities; + } + } static List allBrowsers = new ArrayList(); static { - allBrowsers.add(BrowserUtil.ie(8)); - allBrowsers.add(BrowserUtil.ie(9)); - allBrowsers.add(BrowserUtil.ie(10)); - allBrowsers.add(BrowserUtil.ie(11)); - allBrowsers.add(BrowserUtil.firefox(TESTED_FIREFOX_VERSION)); + allBrowsers.add(Browser.IE8.getDesiredCapabilities()); + allBrowsers.add(Browser.IE9.getDesiredCapabilities()); + allBrowsers.add(Browser.IE10.getDesiredCapabilities()); + allBrowsers.add(Browser.IE11.getDesiredCapabilities()); + allBrowsers.add(Browser.FIREFOX.getDesiredCapabilities()); // Uncomment once we have the capability to run on Safari 6 - // allBrowsers.add(BrowserUtil.safari(TESTED_SAFARI_VERSION)); - allBrowsers.add(BrowserUtil.chrome(TESTED_CHROME_VERSION)); + // allBrowsers.add(SAFARI); + allBrowsers.add(Browser.CHROME.getDesiredCapabilities()); // Re-enable this when it is possible to run on a modern Opera version - // (15+) - // allBrowsers.add(BrowserUtil.opera(15)); + // allBrowsers.add(Browser.OPERA.getDesiredCapabilities()); } /** diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index 89fa304bfe..543484fc14 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -26,8 +26,11 @@ import java.util.Enumeration; import java.util.Properties; import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxBinary; import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.safari.SafariDriver; import com.vaadin.testbench.TestBench; @@ -80,7 +83,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { @Override protected String getDeploymentHostname() { - if (runLocally()) { + if (getClass().getAnnotation(RunLocally.class) != null) { return "localhost"; } String hostName = getProperty(HOSTNAME_PROPERTY); @@ -148,17 +151,29 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { * @see com.vaadin.tests.tb3.AbstractTB3Test#setupLocalDriver() */ @Override - protected void setupLocalDriver() { - String firefoxPath = getProperty("firefox.path"); + protected void setupLocalDriver(DesiredCapabilities desiredCapabilities) { WebDriver driver; - if (firefoxPath != null) { - driver = new FirefoxDriver( - new FirefoxBinary(new File(firefoxPath)), null); + if (BrowserUtil.isFirefox(desiredCapabilities)) { + String firefoxPath = getProperty("firefox.path"); + if (firefoxPath != null) { + driver = new FirefoxDriver(new FirefoxBinary(new File( + firefoxPath)), null); + } else { + driver = new FirefoxDriver(); + } + } else if (BrowserUtil.isChrome(desiredCapabilities)) { + System.setProperty("webdriver.chrome.driver", + getProperty("chrome.driver.path")); + driver = new ChromeDriver(); + } else if (BrowserUtil.isSafari(desiredCapabilities)) { + driver = new SafariDriver(); } else { - driver = new FirefoxDriver(); + throw new RuntimeException( + "Not implemented support for running locally on " + + BrowserUtil + .getBrowserIdentifier(desiredCapabilities)); } setDriver(TestBench.createDriver(driver)); - setDesiredCapabilities(BrowserUtil - .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION)); + setDesiredCapabilities(desiredCapabilities); } } diff --git a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java index 4e084ab0ed..eaffa80d09 100644 --- a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java +++ b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java @@ -33,6 +33,7 @@ import org.junit.runners.model.Statement; import org.openqa.selenium.remote.DesiredCapabilities; import com.vaadin.tests.tb3.AbstractTB3Test.BrowserUtil; +import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally; /** * This runner is loosely based on FactoryTestRunner by Ted Young @@ -76,10 +77,11 @@ public class TB3Runner extends BlockJUnit4ClassRunner { .getOnlyConstructor().newInstance(); Collection desiredCapabilites = testClassInstance .getBrowsersToTest(); - if (testClassInstance.runLocally()) { + if (testClassInstance.getClass().getAnnotation(RunLocally.class) != null) { desiredCapabilites = new ArrayList(); - desiredCapabilites.add(BrowserUtil - .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION)); + desiredCapabilites.add(testClassInstance.getClass() + .getAnnotation(RunLocally.class).value() + .getDesiredCapabilities()); } for (DesiredCapabilities capabilities : desiredCapabilites) { diff --git a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java index 26fef667cd..e9ef11957c 100644 --- a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java +++ b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java @@ -25,6 +25,8 @@ import java.util.List; import org.openqa.selenium.remote.DesiredCapabilities; +import com.vaadin.tests.tb3.MultiBrowserTest.Browser; + /** * A {@link MultiBrowserTest} which restricts the tests to the browsers which * support websocket @@ -35,8 +37,8 @@ public abstract class WebsocketTest extends PrivateTB3Configuration { private static List websocketBrowsers = new ArrayList(); static { websocketBrowsers.addAll(MultiBrowserTest.getAllBrowsers()); - websocketBrowsers.remove(BrowserUtil.ie(8)); - websocketBrowsers.remove(BrowserUtil.ie(9)); + websocketBrowsers.remove(Browser.IE8.getDesiredCapabilities()); + websocketBrowsers.remove(Browser.IE9.getDesiredCapabilities()); } /** -- cgit v1.2.3 From 81a1c293f0e407db4a5443b85e57d32cddd397a7 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Fri, 15 Nov 2013 09:46:42 +0000 Subject: Revert "Fixed lost scrollLeft when row count changed in Table (#12652)." This reverts commit 533ddcda271b7226b38c035adf3073062c562653. Seems like the caused regressions are far from trivial to resolve. A new approach might be needed to resolve this issue. Change-Id: I88cf75608e8d47fffab5a366a8ad1b3b70c1c11f --- client/src/com/vaadin/client/Util.java | 37 ------- client/src/com/vaadin/client/ui/VScrollTable.java | 47 +-------- ...bleHorizontalScrollPositionOnItemSetChange.html | 110 --------------------- ...bleHorizontalScrollPositionOnItemSetChange.java | 101 ------------------- 4 files changed, 1 insertion(+), 294 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html delete mode 100644 uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java (limited to 'uitest') diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index 7c7978be09..8972670232 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -447,35 +447,6 @@ public class Util { return detectedScrollbarSize; } - /** - * Calculates maximum horizontal scrolling value for the given element. - * - * @since 7.1.9 - * @param element - * which scrollLeft should be calculated - * @return maximum value for scrollLeft of the given element - */ - public static int getMaxScrollLeft(final Element element) { - int scrollWidth = element.getScrollWidth(); - int clientWidth = element.getClientWidth(); - return scrollWidth - clientWidth; - } - - /** - * Checks if scrollLeft of the element is at its maximum value. Returns - * false if the element can't be scrolled horizontally. - * - * @since 7.1.9 - * @param element - * which scrollLeft should be checked - * @return true, if scrollLeft is at maximum (false if element can't be - * scrolled horizontally) - */ - public static boolean isScrollLeftAtMax(final Element element) { - int scrollLeft = element.getScrollLeft(); - return scrollLeft != 0 && scrollLeft == getMaxScrollLeft(element); - } - /** * Run workaround for webkits overflow auto issue. * @@ -497,8 +468,6 @@ public class Util { // check the scrolltop value before hiding the element final int scrolltop = elem.getScrollTop(); final int scrollleft = elem.getScrollLeft(); - final boolean scrollLeftAtMax = isScrollLeftAtMax(elem); - elem.getStyle().setProperty("overflow", "hidden"); Scheduler.get().scheduleDeferred(new Command() { @@ -522,12 +491,6 @@ public class Util { elem.setScrollTop(scrollvalue); } - // keep horizontal scroll at max if it was before vertical - // scroll bar was added/removed - if (scrollLeftAtMax) { - elem.setScrollLeft(getMaxScrollLeft(elem)); - } - // fix for #6940 : Table horizontal scroll sometimes not // updated when collapsing/expanding columns // Also appeared in Safari 5.1 with webkit 534 (#7667) diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index d1d73f4e91..c56a2a8772 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -276,10 +276,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private int detachedScrollPosition = 0; - // fields used in fixing erroneously lost scrollLeft - int lastScrollBodyHeight = 0; - boolean lastScrollLeftWasAtMax = false; - /** * Represents a select range of rows */ @@ -1009,15 +1005,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, initialContentReceived = true; sizeNeedsInit = true; scrollBody.restoreRowVisibility(); - - // At least FireFox requires that scrollLeft is restored deferred after - // scrollBody is recreated - Scheduler.get().scheduleFinally(new ScheduledCommand() { - @Override - public void execute() { - restoreScrollLeft(); - } - }); } /** For internal use only. May be removed or replaced in the future. */ @@ -6877,45 +6864,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return s; } - /** - * Tries to restore horizontal scroll position if it was lost due to change - * in the height of scrollBody (#12652). - */ - private void restoreScrollLeft() { - int upcomingScrollLeft = scrollLeft; - - if (lastScrollLeftWasAtMax) { - upcomingScrollLeft = Util.getMaxScrollLeft(scrollBodyPanel - .getElement()); - } - scrollBodyPanel.getElement().setScrollLeft(upcomingScrollLeft); - } - - /** - * Checks if restore of scrollLeft is needed by checking if height of the - * scrollBody has changed. - * - * @return true, if restore is required - */ - private boolean isScrollLeftRestoreRequired() { - return (scrollBody.getElement().getClientHeight() != lastScrollBodyHeight); - } - /** * This method has logic which rows needs to be requested from server when * user scrolls */ + @Override public void onScroll(ScrollEvent event) { - // restore in initializeRows() doesn't work right with Chrome - if (isScrollLeftRestoreRequired()) { - restoreScrollLeft(); - } - - lastScrollBodyHeight = scrollBody.getElement().getClientHeight(); - lastScrollLeftWasAtMax = Util.isScrollLeftAtMax(scrollBodyPanel - .getElement()); - scrollLeft = scrollBodyPanel.getElement().getScrollLeft(); scrollTop = scrollBodyPanel.getScrollPosition(); /* diff --git a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html deleted file mode 100644 index 6fd54ba0ca..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - -TableHorizontalScrollPositionOnItemSetChange - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TableHorizontalScrollPositionOnItemSetChange
open/run/com.vaadin.tests.components.table.TableHorizontalScrollPositionOnItemSetChange?restartApplication
scrollLeftvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]326
pause500
clickvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Slessitems/domChild[0]/domChild[0]
pause500
screenCaptureleft-scroll-position-stays-in-middle-with-fewer-items
clickvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Smoreitems/domChild[0]/domChild[0]
pause500
screenCaptureleft-scroll-position-stays-in-middle-with-more-items
scrollLeftvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]653
pause500
clickvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Slessitems/domChild[0]/domChild[0]
pause500
screenCaptureleft-scroll-position-stays-max-with-fewer-items
clickvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Smoreitems/domChild[0]/domChild[0]
pause500
screenCaptureleft-scroll-position-stays-max-with-more-items
scrollLeftvaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]0
- - diff --git a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java deleted file mode 100644 index 1f59a84428..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.tests.components.table; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; - -public class TableHorizontalScrollPositionOnItemSetChange extends - AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - layout.setSpacing(true); - setContent(layout); - - final Table table = new Table(); - table.setWidth("640px"); - table.setHeight("243px"); - table.setId("horscrolltable"); - layout.addComponent(table); - - for (int i = 0; i < 15; i++) { - table.addContainerProperty("Column " + i, String.class, null); - } - - for (int i = 0; i < 60; i++) { - table.addItem(); - } - - Button lessItems = new Button("Less items", new Button.ClickListener() { - - @Override - public void buttonClick(Button.ClickEvent event) { - table.removeAllItems(); - for (int i = 0; i < 5; i++) { - table.addItem(); - } - } - }); - lessItems.setId("lessitems"); - - Button moreItems = new Button("More items", new Button.ClickListener() { - - @Override - public void buttonClick(Button.ClickEvent event) { - table.removeAllItems(); - for (int i = 0; i < 50; i++) { - table.addItem(); - } - } - }); - moreItems.setId("moreitems"); - - Button clearItems = new Button("Clear all", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - table.removeAllItems(); - } - }); - - HorizontalLayout buttonLayout = new HorizontalLayout(); - buttonLayout.setSpacing(true); - layout.addComponent(buttonLayout); - - buttonLayout.addComponent(lessItems); - buttonLayout.addComponent(moreItems); - buttonLayout.addComponent(clearItems); - clearItems.setId("clearitems"); - } - - @Override - protected String getTestDescription() { - return "Horizontal scrolling position should not be lost if amount of items changes in Table."; - } - - @Override - protected Integer getTicketNumber() { - return 12652; - } - -} -- cgit v1.2.3 From dde6a4893dd1c3d1bc040d58db6fd4cec012c74c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 4 Nov 2013 18:10:05 +0200 Subject: Output test results in XML reports instead of to standard output This is a workaround for a problem with the integrated TeamCity JUnit listener which is not thread safe. Without this the test results are completely mixed up in TeamCity. For more information, see http://youtrack.jetbrains.com/issue/TW-33176. All standard JUnit test reports is put in result/reports. For uitest there are three report directories: result/reports-tb2, result/reports-tb3 and result/reports-integration to be able to clean the directories before running a given type of tests. This change is based on the separate fixes by John. Change-Id: I2f0dee416f6745544636f2f3dcea0d0832ff8076 --- common.xml | 17 +++++++++++++---- uitest/build.xml | 2 -- uitest/integration_tests.xml | 20 ++++++++++++++++---- uitest/tb3test.xml | 10 +++++++--- uitest/test.xml | 15 +++++++++++---- 5 files changed, 47 insertions(+), 17 deletions(-) (limited to 'uitest') diff --git a/common.xml b/common.xml index 88fbc49196..a1c086c57a 100644 --- a/common.xml +++ b/common.xml @@ -305,16 +305,20 @@ + + + + - - + + - + @@ -363,7 +367,12 @@ - + + + + + + diff --git a/uitest/build.xml b/uitest/build.xml index 76b75e9203..864d111023 100644 --- a/uitest/build.xml +++ b/uitest/build.xml @@ -150,8 +150,6 @@ Checkstyle is disabled for uitest for now - - WHAT? No JUnit tests for ${module.name}! diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml index 73aac2405c..9f639b9cb5 100644 --- a/uitest/integration_tests.xml +++ b/uitest/integration_tests.xml @@ -27,6 +27,9 @@ + + + @@ -56,6 +59,7 @@ + @@ -69,6 +73,7 @@ + @@ -87,6 +92,7 @@ + @@ -105,16 +111,19 @@ - - - + + + + + + - + @@ -360,6 +369,9 @@ + + + diff --git a/uitest/tb3test.xml b/uitest/tb3test.xml index dd0c12db91..41cce8f0f2 100644 --- a/uitest/tb3test.xml +++ b/uitest/tb3test.xml @@ -2,6 +2,7 @@ + @@ -19,13 +20,16 @@ - - + + + + + - + diff --git a/uitest/test.xml b/uitest/test.xml index b0db8d47f4..57f61d67fa 100644 --- a/uitest/test.xml +++ b/uitest/test.xml @@ -3,7 +3,6 @@ - @@ -84,6 +83,11 @@ + + + + + @@ -103,13 +107,16 @@ - + + + - + @@ -129,7 +136,7 @@ - + -- cgit v1.2.3 From 012e649775e7efbcbbdd9d1c3ef4edd9c9acb71a Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 19 Nov 2013 15:06:16 +0200 Subject: Fix TB3 local testing and occasionally failing SliderDisableTest. Change-Id: I58e60e55838c3339c934cf975e5e148c8f09a78b --- .../tests/components/slider/SliderDisableTest.java | 1 + uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java index f6ec3dac3b..53521ee483 100644 --- a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java +++ b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java @@ -29,6 +29,7 @@ public class SliderDisableTest extends MultiBrowserTest { openTestURL(); WebElement element = vaadinElement("/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]"); new Actions(driver).dragAndDropBy(element, 112, 0).perform(); + testBench().waitForVaadin(); compareScreen("enabled"); vaadinElementById("disableButton").click(); compareScreen("disabled"); diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index f6e58a51b2..d7b7cd050f 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -107,16 +107,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * If something goes wrong */ protected void setupDriver() throws Exception { + DesiredCapabilities capabilities; + RunLocally runLocally = getClass().getAnnotation(RunLocally.class); if (runLocally != null) { - setupLocalDriver(runLocally.value().getDesiredCapabilities()); - return; - } - DesiredCapabilities capabilities = getDesiredCapabilities(); + capabilities = runLocally.value().getDesiredCapabilities(); + setupLocalDriver(capabilities); + } else { + capabilities = getDesiredCapabilities(); - WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL( - getHubURL()), capabilities)); - setDriver(dr); + WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL( + getHubURL()), capabilities)); + setDriver(dr); + } int w = SCREENSHOT_WIDTH; int h = SCREENSHOT_HEIGHT; -- cgit v1.2.3