summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/push/TogglePush.java
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests/push/TogglePush.java')
-rw-r--r--uitest/src/com/vaadin/tests/push/TogglePush.java95
1 files changed, 0 insertions, 95 deletions
diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java
index 3ef369b408..6ec8903d65 100644
--- a/uitest/src/com/vaadin/tests/push/TogglePush.java
+++ b/uitest/src/com/vaadin/tests/push/TogglePush.java
@@ -18,112 +18,17 @@ package com.vaadin.tests.push;
import java.util.Timer;
import java.util.TimerTask;
-import org.junit.Assert;
-import org.junit.Test;
-import org.openqa.selenium.WebElement;
-
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
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.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
public class TogglePush extends AbstractTestUI {
- public static class TogglePushTB3 extends MultiBrowserTest {
-
- @Test
- public void togglePushInInit() {
- setPush(true);
- String url = getTestUrl();
-
- // Open with push disabled
- driver.get(addParameter(url, "push=disabled"));
-
- Assert.assertFalse(getPushToggle().isSelected());
-
- getDelayedCounterUpdateButton().click();
- sleep(2000);
- Assert.assertEquals("Counter has been updated 0 times",
- getCounterText());
-
- // Open with push enabled
- driver.get(addParameter(url, "push=enabled"));
- Assert.assertTrue(getPushToggle().isSelected());
-
- getDelayedCounterUpdateButton().click();
- sleep(2000);
- Assert.assertEquals("Counter has been updated 1 times",
- getCounterText());
-
- }
-
- private String addParameter(String url, String queryParameter) {
- if (url.contains("?")) {
- return url + "&" + queryParameter;
- } else {
- return url + "?" + queryParameter;
- }
- }
-
- @Test
- public void togglePush() {
- setPush(true);
- openTestURL();
- getDelayedCounterUpdateButton().click();
- sleep(2000);
-
- // Push is enabled, so text gets updated
- Assert.assertEquals("Counter has been updated 1 times",
- getCounterText());
-
- // Disable push
- getPushToggle().click();
- getDelayedCounterUpdateButton().click();
- sleep(2000);
- // Push is disabled, so text is not updated
- Assert.assertEquals("Counter has been updated 1 times",
- getCounterText());
-
- getDirectCounterUpdateButton().click();
- // Direct update is visible, and includes previous update
- Assert.assertEquals("Counter has been updated 3 times",
- getCounterText());
-
- // Re-enable push
- getPushToggle().click();
- getDelayedCounterUpdateButton().click();
- sleep(2000);
-
- // Push is enabled again, so text gets updated
- Assert.assertEquals("Counter has been updated 4 times",
- getCounterText());
- }
-
- private WebElement getDirectCounterUpdateButton() {
- return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]");
- }
-
- private WebElement getPushToggle() {
- return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]");
- }
-
- private WebElement getDelayedCounterUpdateButton() {
- return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]");
- }
-
- private String getCounterText() {
- return vaadinElement(
- "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]")
- .getText();
- }
-
- }
-
private final Label counterLabel = new Label();
private int counter = 0;