diff options
author | Artur Signell <artur@vaadin.com> | 2013-11-11 16:19:52 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-11-11 16:19:52 +0200 |
commit | 9835a829de6d30566442dfecb400f973b7c7ee7d (patch) | |
tree | de621bd995c5c30b6ad87985c7f3e9215225bf1b /uitest/src/com/vaadin/tests/push/BasicPushTest.java | |
parent | 2ef66c9372fa57f529f95e02c571e75fcc3a0b21 (diff) | |
parent | f8da9267bf223b516a3ec7d1ee0c782a6b3f6fdb (diff) | |
download | vaadin-framework-9835a829de6d30566442dfecb400f973b7c7ee7d.tar.gz vaadin-framework-9835a829de6d30566442dfecb400f973b7c7ee7d.zip |
Merge changes from origin/7.1
a5a9131 Converted LayoutTesterApplication test to TB3
1376429 Fix compilation error in test
7b120fc Tests for validating reconnect works for streaming and websockets (#12868,#12853,#12852)
9e6a82d Force connection to closed state on reconnect (#12853)
e365eee No longer require specifying Atmosphere js version in two places
ca7e928 Update to Atmosphere js 2.0.3.vaadin2 (#12868, #12852)
1cc4dc1 Fix duplicate id issue in test and test more corner cases
c21a684 Prepare for Safari 7 testing (#5288)
7615fd1 Made test more stable and added Firefox reconnect test (#12492)
186696d fix regression related to #12504
c48c94d Reverted change in how hack works (#12727, #12736)
f328340 Fix NPE caused by setting ApplicationConnection too late (#12736)
b47915f Extracted test to separate class
e07e674 Remove possibility to use static inner classes for tests
c4aff77 Fix NPE in fix (#12504)
15dce28 Make test more reliable by updating description which does not update the DOM
6a63d12 Make Panel scroll the correct div (#12736)
cc796b0 Ensure testing Jetty does not run out of heap space
f8da926 Updated to Atmosphere 1.0.18.vaadin1 (#12891)
Change-Id: Ic30441d72c4e45551255724a0dcc3b3fa5a1729b
Diffstat (limited to 'uitest/src/com/vaadin/tests/push/BasicPushTest.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/push/BasicPushTest.java | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/uitest/src/com/vaadin/tests/push/BasicPushTest.java b/uitest/src/com/vaadin/tests/push/BasicPushTest.java index 57af8524bc..ef40ae09dc 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPushTest.java +++ b/uitest/src/com/vaadin/tests/push/BasicPushTest.java @@ -19,6 +19,7 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; +import com.vaadin.tests.tb3.AbstractTB3Test; import com.vaadin.tests.tb3.MultiBrowserTest; public abstract class BasicPushTest extends MultiBrowserTest { @@ -30,15 +31,13 @@ public abstract class BasicPushTest extends MultiBrowserTest { // Test client initiated push Assert.assertEquals(0, getClientCounter()); getIncrementButton().click(); - Assert.assertEquals( - "Client counter not incremented by button click", 1, - getClientCounter()); + Assert.assertEquals("Client counter not incremented by button click", + 1, getClientCounter()); getIncrementButton().click(); getIncrementButton().click(); getIncrementButton().click(); - Assert.assertEquals( - "Four clicks should have incremented counter to 4", 4, - getClientCounter()); + Assert.assertEquals("Four clicks should have incremented counter to 4", + 4, getClientCounter()); // Test server initiated push getServerCounterStartButton().click(); @@ -63,30 +62,47 @@ public abstract class BasicPushTest extends MultiBrowserTest { } private int getServerCounter() { - return Integer.parseInt(getServerCounterElement().getText()); + return getServerCounter(this); } private int getClientCounter() { - return Integer.parseInt(getClientCounterElement().getText()); + return getClientCounter(this); } - private WebElement getServerCounterElement() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]"); + public static int getClientCounter(AbstractTB3Test t) { + WebElement clientCounterElem = t + .vaadinElementById(BasicPush.CLIENT_COUNTER_ID); + return Integer.parseInt(clientCounterElem.getText()); } - private WebElement getServerCounterStartButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]"); + private WebElement getIncrementButton() { + return getIncrementButton(this); } private WebElement getServerCounterStopButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]"); + return getServerCounterStopButton(this); } - private WebElement getIncrementButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]"); + private WebElement getServerCounterStartButton() { + return getServerCounterStartButton(this); + } + + public static int getServerCounter(AbstractTB3Test t) { + WebElement serverCounterElem = t + .vaadinElementById(BasicPush.SERVER_COUNTER_ID); + return Integer.parseInt(serverCounterElem.getText()); } - private WebElement getClientCounterElement() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]"); + public static WebElement getServerCounterStartButton(AbstractTB3Test t) { + return t.vaadinElementById(BasicPush.START_TIMER_ID); } + + public static WebElement getServerCounterStopButton(AbstractTB3Test t) { + return t.vaadinElementById(BasicPush.STOP_TIMER_ID); + } + + public static WebElement getIncrementButton(AbstractTB3Test t) { + return t.vaadinElementById(BasicPush.INCREMENT_BUTTON_ID); + } + }
\ No newline at end of file |