]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix PushConfigurationLongPollingTest.
authorSauli Tähkäpää <sauli@vaadin.com>
Fri, 27 Jun 2014 07:52:01 +0000 (10:52 +0300)
committerVaadin Code Review <review@vaadin.com>
Wed, 2 Jul 2014 17:43:42 +0000 (17:43 +0000)
Change-Id: I49516f311315d3c84a177ec6bd937e1241e67351

uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java
uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java
uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java

index ac58deea56b83bcd60fb1ccfa8ede205924499f1..f2207ccba704077d5d234646a0e27acf5a8fb006 100644 (file)
@@ -26,33 +26,19 @@ import org.openqa.selenium.support.ui.Select;
 
 public class PushConfigurationLongPollingTest extends PushConfigurationTest {
 
-    @Override
-    public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-
-        return browsers;
-    }
-
     @Test
     public void testLongPolling() throws InterruptedException {
-        new Select(getTransportSelect()).selectByVisibleText("LONG_POLLING");
-        new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC");
+        openDebugLogTab();
 
+        new Select(getTransportSelect()).selectByVisibleText("LONG_POLLING");
         assertThat(getStatusText(),
                 containsString("fallbackTransport: long-polling"));
         assertThat(getStatusText(), containsString("transport: long-polling"));
 
+        clearDebugMessages();
+        new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC");
+        waitForDebugMessage("Push connection established using long-polling", 10);
         waitForServerCounterToUpdate();
-
-        // Use debug console to verify we used the correct transport type
-        assertThat(
-                driver.getPageSource(),
-                containsString("Push connection established using long-polling"));
-
-        new Select(getPushModeSelect()).selectByVisibleText("DISABLED");
-
     }
 
 }
index 0861e618a2ed61163f127c0503d9443e096021ce..f5c015ad12a007f8635f36638b5deb5c2f034868 100644 (file)
  */
 package com.vaadin.tests.push;
 
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.not;
-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;
 
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+
 public class PushConfigurationStreamingTest extends PushConfigurationTest {
 
     @Test
index e5cceca6b881c9117a91a61970275449db474a5c..f3d50af001f77c80fe442abd27f589b06a1df89b 100644 (file)
 
 package com.vaadin.tests.tb3;
 
-import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-
+import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
+import com.vaadin.server.LegacyApplication;
+import com.vaadin.server.UIProvider;
+import com.vaadin.testbench.TestBench;
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.TestBenchTestCase;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+import com.vaadin.ui.UI;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runner.RunWith;
-import org.openqa.selenium.By;
-import org.openqa.selenium.JavascriptExecutor;
-import org.openqa.selenium.Platform;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
+import org.openqa.selenium.*;
 import org.openqa.selenium.interactions.HasInputDevices;
 import org.openqa.selenium.interactions.Keyboard;
 import org.openqa.selenium.interactions.Mouse;
@@ -46,15 +41,15 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 import org.openqa.selenium.support.ui.WebDriverWait;
 
-import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
-import com.vaadin.server.LegacyApplication;
-import com.vaadin.server.UIProvider;
-import com.vaadin.testbench.TestBench;
-import com.vaadin.testbench.TestBenchElement;
-import com.vaadin.testbench.TestBenchTestCase;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
-import com.vaadin.ui.UI;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
 
 /**
  * Base class for TestBench 3+ tests. All TB3+ tests in the project should
@@ -1030,7 +1025,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
     }
 
     protected void openDebugLogTab() {
-        findElement(By.xpath("//button[@title='Debug message log']")).click();
+
+        waitUntil(new ExpectedCondition<Boolean>() {
+            @Override
+            public Boolean apply(WebDriver input) {
+                WebElement element = getDebugLogButton();
+                return element != null;
+            }
+        }, 15);
+        getDebugLogButton().click();
+    }
+
+    private WebElement getDebugLogButton() {
+        return findElement(By.xpath("//button[@title='Debug message log']"));
     }
 
 }