From 503e5757bbac1a28c8987ecae9f75d271a61899b Mon Sep 17 00:00:00 2001 From: Artem Godin Date: Thu, 3 Oct 2013 15:47:08 +0300 Subject: Fix NullPointerException in logger when message is null (#12588) LogSection.publish and VConsole.log/VConsole.error methods now replace null message with an empty string ("") Change-Id: I735b51bce971ababe2557f1b6c317c01066bc03c --- client/src/com/vaadin/client/VConsole.java | 18 ++++++++++++++---- .../com/vaadin/client/debug/internal/LogSection.java | 6 ++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/client/src/com/vaadin/client/VConsole.java b/client/src/com/vaadin/client/VConsole.java index 37ed8e6370..32eb206a70 100644 --- a/client/src/com/vaadin/client/VConsole.java +++ b/client/src/com/vaadin/client/VConsole.java @@ -41,25 +41,35 @@ public class VConsole { public static void log(String msg) { if (LogConfiguration.loggingIsEnabled(Level.INFO)) { - getLogger().log(Level.INFO, msg); + // Check for null, so no NullPointerException is generated when + // formatting (#12588) + getLogger().log(Level.INFO, msg == null ? "null" : msg); } } public static void log(Throwable e) { if (LogConfiguration.loggingIsEnabled(Level.INFO)) { - getLogger().log(Level.INFO, e.getMessage(), e); + // Check for null, so no NullPointerException is generated when + // formatting (#12588) + getLogger().log(Level.INFO, + e.getMessage() == null ? "" : e.getMessage(), e); } } public static void error(Throwable e) { if (LogConfiguration.loggingIsEnabled(Level.SEVERE)) { - getLogger().log(Level.SEVERE, e.getMessage(), e); + // Check for null, so no NullPointerException is generated when + // formatting (#12588) + getLogger().log(Level.SEVERE, + e.getMessage() == null ? "" : e.getMessage(), e); } } public static void error(String msg) { if (LogConfiguration.loggingIsEnabled(Level.SEVERE)) { - getLogger().log(Level.SEVERE, msg); + // Check for null, so no NullPointerException is generated when + // formatting (#12588) + getLogger().log(Level.SEVERE, msg == null ? "null" : msg); } } diff --git a/client/src/com/vaadin/client/debug/internal/LogSection.java b/client/src/com/vaadin/client/debug/internal/LogSection.java index 1e7524b56d..f792ec95be 100644 --- a/client/src/com/vaadin/client/debug/internal/LogSection.java +++ b/client/src/com/vaadin/client/debug/internal/LogSection.java @@ -73,6 +73,12 @@ public class LogSection implements Section { return; } + // If no message is provided, record.getMessage will be null and so + // the formatter.format will fail with NullPointerException (#12588) + if (record.getMessage() == null) { + record.setMessage(""); + } + Formatter formatter = getFormatter(); String msg = formatter.format(record); -- cgit v1.2.3 From d9f6dadfb41c2b618390edf8a05bbe78a8794e06 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Mon, 7 Oct 2013 12:37:50 +0300 Subject: Fixed Table range selection IE regression #12407 After fixes for #12407 the range selection did not work in the case where the selection start had previously been removed. This caused MultiSelectWithRemovedRow test to fail on IE. Change-Id: Iaa91cc6a3a310aedc80c4c2475fa8e94a30a5563 --- client/src/com/vaadin/client/ui/VScrollTable.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 6e9e28ff25..9cec59a5a2 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -6110,7 +6110,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, .next(); setRowFocus(endRow); } + } else if (!startRow.isSelected()) { + // The start row is no longer selected (probably removed) + // and so we select from above + startRow = (VScrollTableRow) scrollBody.iterator().next(); + setRowFocus(endRow); } + // Deselect previous items if so desired if (deselectPrevious) { deselectAll(); -- cgit v1.2.3 From 64530550abb89aa59d05f824e949f58ba05f1202 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 7 Oct 2013 20:49:18 +0300 Subject: Run tests on Tomcat 8 (#12326) Change-Id: I99d91f16c5ad2dce6fb93f2862913b23518410d7 --- uitest/integration_tests.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml index f1b2070bc8..1c9c2b1f8f 100644 --- a/uitest/integration_tests.xml +++ b/uitest/integration_tests.xml @@ -124,6 +124,12 @@ + + + + + + @@ -397,6 +403,7 @@ + -- cgit v1.2.3 From 10bcbdc652c6a61a0adbb8a8b357402ab1b65e2f Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 7 Oct 2013 20:16:15 +0300 Subject: Actually open integration test. Regression since the change in test behavior (no longer automatically opens test URL) Change-Id: I1c4efc9b5b5c8a28818afa6f91af1a8b159354b4 --- uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java | 1 + 1 file changed, 1 insertion(+) diff --git a/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java index ae83083d85..2a2f8ab3d1 100644 --- a/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java @@ -31,6 +31,7 @@ public abstract class ServletIntegrationTestTB3 extends @Test public void runTest() throws IOException, AssertionError { + openTestURL(); compareScreen("initial"); WebElement cell = vaadinElement(getTableCell(getTable(), 0, 1)); -- cgit v1.2.3 From 3cba6bf847df3fab77cec04dcd2586c76316fd74 Mon Sep 17 00:00:00 2001 From: Artem Godin Date: Mon, 7 Oct 2013 17:19:57 +0300 Subject: Rebuild OptionGroup on HtmlContentAllowed/Multiselect changes (#10451) Fixes regression with HtmlContent in Safari 5 and changing of Multiselect properties on the fly. Change-Id: I4a3820eba8d1c06460777340ea36b1df31b38983 --- client/src/com/vaadin/client/ui/VOptionGroup.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/com/vaadin/client/ui/VOptionGroup.java b/client/src/com/vaadin/client/ui/VOptionGroup.java index 455c7669f5..fee1c313f5 100644 --- a/client/src/com/vaadin/client/ui/VOptionGroup.java +++ b/client/src/com/vaadin/client/ui/VOptionGroup.java @@ -87,11 +87,16 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, /** For internal use only. May be removed or replaced in the future. */ public boolean htmlContentAllowed = false; + private boolean wasHtmlContentAllowed = false; + private boolean wasMultiselect = false; + public VOptionGroup() { super(CLASSNAME); panel = (Panel) optionsContainer; optionsToKeys = new HashMap(); optionsEnabled = new ArrayList(); + + wasMultiselect = isMultiselect(); } /* @@ -143,7 +148,11 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, String key = opUidl.getStringAttribute("key"); CheckBox op = keysToOptions.get(key); - if (op == null) { + + // Need to recreate object if isMultiselect is changed (#10451) + // OR if htmlContentAllowed changed due to Safari 5 issue + if ((op == null) || (htmlContentAllowed != wasHtmlContentAllowed) + || (isMultiselect() != wasMultiselect)) { // Create a new element if (isMultiselect()) { op = new VCheckBox(); @@ -184,6 +193,9 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, panel.add(wid); } } + + wasHtmlContentAllowed = htmlContentAllowed; + wasMultiselect = isMultiselect(); } @Override -- cgit v1.2.3 From 4f3cc4cef8c75a6f3a6af26e95509247a84c08b8 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Sep 2013 13:44:00 +0300 Subject: Converted push test to TB3 (#12226, #12522) Change-Id: Ia12b35ef6beed0bf2f534f2c9505b22ce7b3c7c3 --- .../com/vaadin/tests/push/EnableDisablePush.html | 97 ---------------------- .../com/vaadin/tests/push/EnableDisablePush.java | 60 ++++++++++++- .../src/com/vaadin/tests/tb3/AbstractTB3Test.java | 25 ++++++ 3 files changed, 84 insertions(+), 98 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/push/EnableDisablePush.html diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePush.html b/uitest/src/com/vaadin/tests/push/EnableDisablePush.html deleted file mode 100644 index 87dfa8428f..0000000000 --- a/uitest/src/com/vaadin/tests/push/EnableDisablePush.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - -EnableDisablePush - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EnableDisablePush
open/run/EnableDisablePush?restartApplication
assertTextvaadin=runEnableDisablePush::PID_SLog_row_01. Push enabled
clickvaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runEnableDisablePush::PID_SLog_row_03. Push disabled
clickvaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runEnableDisablePush::PID_SLog_row_05. Poll enabled
clickvaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runEnableDisablePush::PID_SLog_row_07. Push enabled
clickvaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runEnableDisablePush::PID_SLog_row_09. Poll disabled
clickvaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runEnableDisablePush::PID_SLog_row_011. Push disabled, polling enabled
pause3500
assertTextvaadin=runEnableDisablePush::PID_SLog_row_016. Polling disabled, push enabled
clickvaadin=runEnableDisablePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runEnableDisablePush::PID_SLog_row_018. Push disabled
- - diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java index 1911c66c2d..50dab43667 100644 --- a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java +++ b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java @@ -1,19 +1,74 @@ package com.vaadin.tests.push; +import static org.junit.Assert.assertEquals; + import java.util.Date; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.TimeUnit; +import org.junit.Test; +import org.openqa.selenium.WebElement; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.communication.PushMode; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.UIDetachedException; public class EnableDisablePush extends AbstractTestUI { + public static class EnableDisablePushTest extends MultiBrowserTest { + @Test + public void testEnablePushWhenUsingPolling() throws Exception { + openTestURL(); + + assertEquals("1. Push enabled", getLogRow(0)); + + getDisablePushButton().click(); + assertEquals("3. Push disabled", getLogRow(0)); + + getEnablePollButton().click(); + assertEquals("5. Poll enabled", getLogRow(0)); + + getEnablePushButton().click(); + assertEquals("7. Push enabled", getLogRow(0)); + + getDisablePollButton().click(); + assertEquals("9. Poll disabled", getLogRow(0)); + + getDisablePushButtonAndReenableFromBackground().click(); + Thread.sleep(2500); + assertEquals("16. Polling disabled, push enabled", getLogRow(0)); + + getDisablePushButton().click(); + assertEquals("18. Push disabled", getLogRow(0)); + } + + private WebElement getDisablePushButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]"); + } + + private WebElement getEnablePushButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]"); + } + + private WebElement getDisablePollButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]"); + } + + private WebElement getEnablePollButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]"); + } + + private WebElement getDisablePushButtonAndReenableFromBackground() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]"); + } + + } + private int c = 0; private Log log = new Log(15); @@ -27,7 +82,7 @@ public class EnableDisablePush extends AbstractTestUI { try { while (true) { - TimeUnit.MILLISECONDS.sleep(1000); + TimeUnit.MILLISECONDS.sleep(500); access(new Runnable() { @Override @@ -42,6 +97,9 @@ public class EnableDisablePush extends AbstractTestUI { } } }); + if (c == 3) { + return; + } } } catch (InterruptedException e) { } catch (UIDetachedException e) { diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 054492444d..5d5f5fae31 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -37,6 +37,7 @@ import org.openqa.selenium.support.ui.WebDriverWait; import com.vaadin.server.LegacyApplication; import com.vaadin.testbench.TestBench; import com.vaadin.testbench.TestBenchTestCase; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.UI; /** @@ -297,6 +298,30 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { new WebDriverWait(driver, 10).until(ExpectedConditions.not(condition)); } + /** + * For tests extending {@link AbstractTestUIWithLog}, returns the element + * for the Nth log row + * + * @param rowNr + * The log row to retrieve + * @return the Nth log row + */ + protected WebElement getLogRowElement(int rowNr) { + return vaadinElementById("Log_row_" + rowNr); + } + + /** + * For tests extending {@link AbstractTestUIWithLog}, returns the text in + * the Nth log row + * + * @param rowNr + * The log row to retrieve text for + * @return the text in the log row + */ + protected String getLogRow(int rowNr) { + return getLogRowElement(rowNr).getText(); + } + /** * Returns the path that should be used for the test. The path contains the * full path (appended to hostname+port) and must start with a slash. -- cgit v1.2.3 From 281fc4334881080a89c487b2d867d4643b667809 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 7 Oct 2013 18:53:53 +0300 Subject: Fixed incorrect logging (#12241) Change-Id: Icfe32a26f9069b7c5ed8160dba93b806754acf58 --- .../com/vaadin/client/communication/AtmospherePushConnection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index 8bddd78688..4bf12ca1f3 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -229,12 +229,14 @@ public class AtmospherePushConnection implements PushConnection { } protected void onReopen(AtmosphereResponse response) { - VConsole.log("Push connection re-established using " + transport); + VConsole.log("Push connection re-established using " + + response.getTransport()); onConnect(response); } protected void onOpen(AtmosphereResponse response) { - VConsole.log("Push connection established using " + transport); + VConsole.log("Push connection established using " + + response.getTransport()); onConnect(response); } -- cgit v1.2.3 From 63e16e6547b4a7c067a9a1fa53dcecb9d704016b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 7 Oct 2013 17:56:31 +0300 Subject: Mark as deprecated to discourage usage for new tests Change-Id: I87d417da5b6b8cf9753604944dff74f8f39c321a --- uitest/src/com/vaadin/tests/tb3/SimpleMultiBrowserTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/uitest/src/com/vaadin/tests/tb3/SimpleMultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/SimpleMultiBrowserTest.java index a7ade3f9f7..aeeed4198c 100644 --- a/uitest/src/com/vaadin/tests/tb3/SimpleMultiBrowserTest.java +++ b/uitest/src/com/vaadin/tests/tb3/SimpleMultiBrowserTest.java @@ -32,6 +32,7 @@ import org.junit.Test; * * @author Vaadin Ltd */ +@Deprecated public abstract class SimpleMultiBrowserTest extends MultiBrowserTest { @Test -- cgit v1.2.3 From f488825d46c984cea841534178b094be3a562eea Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 7 Oct 2013 18:12:06 +0300 Subject: Update TB3+ convention to use a separate *Test file For any issue there should be a UI class, e.g. LabelSomething and a Test class which has the name of the UI + Test, e.g. LabelSomethingTest. The LabelSomethingTest contains ALL tests which depend on LabelSomething and are named accordingly to what they test. For special and legacy cases also LegacyApplication and UIProvider are supported in addition to UI classes Change-Id: Ifc0180b377284bbd029202494ad194d324f8213b --- .../src/com/vaadin/tests/VerifyBrowserVersion.java | 48 ---- .../com/vaadin/tests/VerifyBrowserVersionTest.java | 66 ++++++ .../vaadin/tests/components/label/LabelModes.java | 10 - .../tests/components/label/LabelModesTest.java | 30 +++ ...orizontalLayoutFullsizeContentWithErrorMsg.java | 34 +-- ...ontalLayoutFullsizeContentWithErrorMsgTest.java | 49 ++++ .../components/panel/PanelChangeContentsTest.java | 53 +++++ .../tests/components/slider/SliderDisable.java | 19 -- .../tests/components/slider/SliderDisableTest.java | 36 +++ .../com/vaadin/tests/components/ui/UIAccess.java | 28 --- .../vaadin/tests/components/ui/UIAccessTest.java | 45 ++++ uitest/src/com/vaadin/tests/push/BarInUIDL.java | 28 --- .../src/com/vaadin/tests/push/BarInUIDLTest.java | 45 ++++ uitest/src/com/vaadin/tests/push/BasicPush.java | 75 ------- .../com/vaadin/tests/push/BasicPushStreaming.java | 3 - .../vaadin/tests/push/BasicPushStreamingTest.java | 19 ++ .../src/com/vaadin/tests/push/BasicPushTest.java | 92 ++++++++ .../com/vaadin/tests/push/BasicPushWebsocket.java | 12 - .../vaadin/tests/push/BasicPushWebsocketTest.java | 29 +++ .../com/vaadin/tests/push/PushConfiguration.java | 117 ++++++++++ .../vaadin/tests/push/PushConfigurationTest.java | 246 ++++++--------------- uitest/src/com/vaadin/tests/push/PushFromInit.java | 33 --- .../com/vaadin/tests/push/PushFromInitTest.java | 50 +++++ .../vaadin/tests/push/PushReattachedComponent.java | 63 ------ uitest/src/com/vaadin/tests/push/TogglePush.java | 95 -------- .../src/com/vaadin/tests/push/TogglePushTest.java | 112 ++++++++++ .../com/vaadin/tests/push/TrackMessageSizeUI.java | 152 +++++++++++++ .../vaadin/tests/push/TrackMessageSizeUITest.java | 30 +++ .../tests/push/TrackMessageSizeUnitTests.java | 164 -------------- .../src/com/vaadin/tests/tb3/AbstractTB3Test.java | 43 +++- 30 files changed, 1039 insertions(+), 787 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java create mode 100644 uitest/src/com/vaadin/tests/components/label/LabelModesTest.java create mode 100644 uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java create mode 100644 uitest/src/com/vaadin/tests/components/panel/PanelChangeContentsTest.java create mode 100644 uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java create mode 100644 uitest/src/com/vaadin/tests/push/BarInUIDLTest.java create mode 100644 uitest/src/com/vaadin/tests/push/BasicPushStreamingTest.java create mode 100644 uitest/src/com/vaadin/tests/push/BasicPushTest.java create mode 100644 uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java create mode 100644 uitest/src/com/vaadin/tests/push/PushConfiguration.java create mode 100644 uitest/src/com/vaadin/tests/push/PushFromInitTest.java delete mode 100644 uitest/src/com/vaadin/tests/push/PushReattachedComponent.java create mode 100644 uitest/src/com/vaadin/tests/push/TogglePushTest.java create mode 100644 uitest/src/com/vaadin/tests/push/TrackMessageSizeUI.java create mode 100644 uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java delete mode 100644 uitest/src/com/vaadin/tests/push/TrackMessageSizeUnitTests.java diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java index 47c09bdfd7..1b21f08aa7 100644 --- a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java @@ -1,59 +1,11 @@ package com.vaadin.tests; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.remote.DesiredCapabilities; - import com.vaadin.server.WebBrowser; import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.ui.Label; public class VerifyBrowserVersion extends TestBase { - public static class BrowserVersionTest extends MultiBrowserTest { - - private Map expectedUserAgent = new HashMap(); - - { - expectedUserAgent - .put(BrowserUtil.firefox(24), - "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"); - expectedUserAgent - .put(BrowserUtil.ie(8), - "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), - "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"); - expectedUserAgent - .put(BrowserUtil.ie(10), - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"); - expectedUserAgent - .put(BrowserUtil.ie(11), - "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); - expectedUserAgent - .put(BrowserUtil.chrome(29), - "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"); - expectedUserAgent - .put(BrowserUtil.opera(12), - "Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.15"); - - } - - @Test - public void verifyUserAgent() { - openTestURL(); - Assert.assertEquals( - expectedUserAgent.get(getDesiredCapabilities()), - vaadinElementById("userAgent").getText()); - Assert.assertEquals("Touch device? No", - vaadinElementById("touchDevice").getText()); - } - } - @Override protected void setup() { WebBrowser browser = getBrowser(); diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java new file mode 100644 index 0000000000..6704f55226 --- /dev/null +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java @@ -0,0 +1,66 @@ +/* + * 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; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.AbstractTB3Test.BrowserUtil; + +public class VerifyBrowserVersionTest extends MultiBrowserTest { + + private Map expectedUserAgent = new HashMap(); + + { + expectedUserAgent + .put(BrowserUtil.firefox(24), + "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"); + expectedUserAgent + .put(BrowserUtil.ie(8), + "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), + "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"); + expectedUserAgent + .put(BrowserUtil.ie(10), + "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"); + expectedUserAgent + .put(BrowserUtil.ie(11), + "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); + expectedUserAgent + .put(BrowserUtil.chrome(29), + "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"); + expectedUserAgent + .put(BrowserUtil.opera(12), + "Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.15"); + + } + + @Test + public void verifyUserAgent() { + openTestURL(); + Assert.assertEquals( + expectedUserAgent.get(getDesiredCapabilities()), + vaadinElementById("userAgent").getText()); + Assert.assertEquals("Touch device? No", + vaadinElementById("touchDevice").getText()); + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/label/LabelModes.java b/uitest/src/com/vaadin/tests/components/label/LabelModes.java index 9e51978743..e5bc539f36 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelModes.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelModes.java @@ -2,20 +2,10 @@ package com.vaadin.tests.components.label; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.ComponentTestCase; -import com.vaadin.tests.tb3.SimpleMultiBrowserTest; import com.vaadin.ui.Label; public class LabelModes extends ComponentTestCase