diff options
author | Artur Signell <artur@vaadin.com> | 2014-12-14 15:06:42 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-15 08:45:46 +0000 |
commit | f341dac68a5c47049431b5e857e710c6b0d985e0 (patch) | |
tree | c7582620f11f436972ab50cce12008fb89e06f75 /uitest/src/com/vaadin/tests/push | |
parent | eaa5328054cf197e4c8192dd6c2e2fca37f1589d (diff) | |
download | vaadin-framework-f341dac68a5c47049431b5e857e710c6b0d985e0.tar.gz vaadin-framework-f341dac68a5c47049431b5e857e710c6b0d985e0.zip |
Fix push test broken by new StringToEnumConverter
Change-Id: I76885f3254ec28574ac637905af13cba1a9d2b41
Diffstat (limited to 'uitest/src/com/vaadin/tests/push')
5 files changed, 18 insertions, 27 deletions
diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java index a04d569e05..1d5ead7d98 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java @@ -18,11 +18,7 @@ package com.vaadin.tests.push; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; -import java.util.List; - import org.junit.Test; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.ui.Select; public class PushConfigurationLongPollingTest extends PushConfigurationTest { @@ -30,13 +26,13 @@ public class PushConfigurationLongPollingTest extends PushConfigurationTest { public void testLongPolling() throws InterruptedException { openDebugLogTab(); - new Select(getTransportSelect()).selectByVisibleText("LONG_POLLING"); + getTransportSelect().selectByText("Long polling"); assertThat(getStatusText(), containsString("fallbackTransport: long-polling")); assertThat(getStatusText(), containsString("transport: long-polling")); clearDebugMessages(); - new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); + getPushModeSelect().selectByText("Automatic"); waitForDebugMessage("Push connection established using long-polling", 10); waitForServerCounterToUpdate(); diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java index f5c015ad12..202db8d6b7 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java @@ -15,25 +15,24 @@ */ package com.vaadin.tests.push; -import org.junit.Test; -import org.openqa.selenium.support.ui.Select; - import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; +import org.junit.Test; + public class PushConfigurationStreamingTest extends PushConfigurationTest { @Test public void testStreaming() throws InterruptedException { openDebugLogTab(); - new Select(getTransportSelect()).selectByVisibleText("STREAMING"); + getTransportSelect().selectByText("Streaming"); assertThat(getStatusText(), containsString("fallbackTransport: long-polling")); assertThat(getStatusText(), containsString("transport: streaming")); clearDebugMessages(); - new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); + getPushModeSelect().selectByText("Automatic"); waitForDebugMessage("Push connection established using streaming", 10); waitForServerCounterToUpdate(); diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java index bb5b420259..396160cc7d 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java @@ -20,8 +20,8 @@ import static org.junit.Assert.assertEquals; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; -import org.openqa.selenium.support.ui.Select; +import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.tests.annotations.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -49,7 +49,7 @@ abstract class PushConfigurationTest extends MultiBrowserTest { } protected void disablePush() throws InterruptedException { - new Select(getPushModeSelect()).selectByVisibleText("DISABLED"); + getPushModeSelect().selectByText("Disabled"); int counter = getServerCounter(); sleep(2000); @@ -57,12 +57,12 @@ abstract class PushConfigurationTest extends MultiBrowserTest { getServerCounter()); } - protected WebElement getPushModeSelect() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VNativeSelect[0]/domChild[0]"); + protected NativeSelectElement getPushModeSelect() { + return $(NativeSelectElement.class).caption("Push mode").first(); } - protected WebElement getTransportSelect() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[1]/VNativeSelect[0]/domChild[0]"); + protected NativeSelectElement getTransportSelect() { + return $(NativeSelectElement.class).caption("Transport").first(); } protected int getServerCounter() { diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java index c9a813fac0..475fa2165f 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java @@ -23,7 +23,6 @@ import java.util.List; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.ui.Select; public class PushConfigurationWebSocketTest extends PushConfigurationTest { @@ -40,8 +39,8 @@ public class PushConfigurationWebSocketTest extends PushConfigurationTest { @Test public void testWebsocket() throws InterruptedException { - new Select(getTransportSelect()).selectByVisibleText("WEBSOCKET"); - new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); + getTransportSelect().selectByText("Websocket"); + getPushModeSelect().selectByText("Automatic"); assertThat(getStatusText(), containsString("fallbackTransport: long-polling")); diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurator.java b/uitest/src/com/vaadin/tests/push/PushConfigurator.java index 5a45ab7206..7da58af1da 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurator.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurator.java @@ -87,11 +87,9 @@ public class PushConfigurator extends VerticalLayout { pushMode.addItem(PushMode.AUTOMATIC); for (Transport t : Transport.values()) { - transport.addItem(t.toString()); - fallbackTransport.addItem(t.toString()); + transport.addItem(t); + fallbackTransport.addItem(t); } - transport.addItem(""); - fallbackTransport.addItem(""); pushMode.setImmediate(true); transport.setImmediate(true); @@ -124,7 +122,7 @@ public class PushConfigurator extends VerticalLayout { transport.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - Transport t = Transport.valueOf((String) transport.getValue()); + Transport t = (Transport) transport.getValue(); ui.getPushConfiguration().setTransport(t); refreshStatus(); } @@ -133,8 +131,7 @@ public class PushConfigurator extends VerticalLayout { fallbackTransport.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - Transport t = Transport.valueOf((String) fallbackTransport - .getValue()); + Transport t = (Transport) fallbackTransport.getValue(); ui.getPushConfiguration().setFallbackTransport(t); refreshStatus(); } |