aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-11-20 14:26:40 +0200
committerJohn Ahlroos <john@vaadin.com>2013-11-20 14:27:09 +0200
commite3b1e6be389cbe48d1782723adf1595edbd10ea2 (patch)
tree61dbd2fac407f0b6657863d100d6b1f09e67e356 /uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java
parent96de019ea4ee5536dab87d1f04d4cb94ae71371d (diff)
parentdd7e6fee8c4717df59699f04f7e72a6f2e92008f (diff)
downloadvaadin-framework-e3b1e6be389cbe48d1782723adf1595edbd10ea2.tar.gz
vaadin-framework-e3b1e6be389cbe48d1782723adf1595edbd10ea2.zip
Merge branch 'master' into grid
Change-Id: I9f669ec38c39a42d1ef2a25121b77aab31551863
Diffstat (limited to 'uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java')
-rw-r--r--uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java
new file mode 100644
index 0000000000..275b6d5b53
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.push;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public 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]");
+ }
+
+} \ No newline at end of file