]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix NotificationDelayTest for IE8 and Chrome. (#14689)
authorSauli Tähkäpää <sauli@vaadin.com>
Mon, 19 Jan 2015 16:31:00 +0000 (18:31 +0200)
committerVaadin Code Review <review@vaadin.com>
Tue, 20 Jan 2015 07:30:28 +0000 (07:30 +0000)
Change-Id: I3f92722ce9832ec2b748f2bf20477244597a8912

uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java

index 219d44710cb127f9a07ab9e306f6b8bd53de395d..903c3440ccd8d75933003035d27e6a0d146d2952 100644 (file)
  */
 package com.vaadin.tests.components.notification;
 
+import com.vaadin.tests.tb3.MultiBrowserTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.interactions.Actions;
-
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.openqa.selenium.support.ui.ExpectedCondition;
 
 /**
  * Test to check notification delay.
@@ -34,20 +35,16 @@ public class NotificationDelayTest extends MultiBrowserTest {
         openTestURL();
 
         Assert.assertTrue("No notification found", hasNotification());
-        Actions actions = new Actions(getDriver());
-        actions.moveByOffset(10, 10).build().perform();
-        long start = System.currentTimeMillis();
-        boolean hidden = false;
-        while (System.currentTimeMillis() <= start + 5000) {
-            Thread.sleep(500);
-            hidden = !hasNotification();
-            if (hidden) {
-                break;
-            }
-        }
 
-        Assert.assertTrue("Notification is still visible after 5 seconds",
-                hidden);
+        waitUntil(new ExpectedCondition<Boolean>() {
+
+            @Override
+            public Boolean apply(WebDriver input) {
+                new Actions(getDriver()).moveByOffset(10, 10).perform();
+
+                return !hasNotification();
+            }
+        });
     }
 
     private boolean hasNotification() {