aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2015-02-02 11:17:50 +0200
committerVaadin Code Review <review@vaadin.com>2015-02-02 11:49:37 +0000
commit0e0875a7ddb9a6f0b76094a33ce3f8348a7b977b (patch)
treea6f3a70d13c41694b8e30b7dfb00e1145ecfe171 /uitest/src/com
parent755f623e4d21b73a4f2b179553450512d7759795 (diff)
downloadvaadin-framework-0e0875a7ddb9a6f0b76094a33ce3f8348a7b977b.tar.gz
vaadin-framework-0e0875a7ddb9a6f0b76094a33ce3f8348a7b977b.zip
Reduce stability issues with LoadingIndicatorTest.
Change-Id: Ia8a9c7cef41a1f7bbd4468d6a2c1cb8eb973ee7a
Diffstat (limited to 'uitest/src/com')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java
index b122eb02e9..f251313100 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java
@@ -18,7 +18,9 @@ package com.vaadin.tests.components.grid.basicfeatures.server;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import com.vaadin.testbench.elements.GridElement;
@@ -44,11 +46,8 @@ public class LoadingIndicatorTest extends GridBasicFeaturesTest {
gridElement.getCell(200, 1);
// Wait for loading indicator delay
- Thread.sleep(500);
-
- Assert.assertTrue(
- "Loading indicator should be visible when fetching rows that are visible",
- isLoadingIndicatorVisible());
+ waitUntil(ExpectedConditions.visibilityOfElementLocated(By
+ .className("v-loading-indicator")));
waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
.className("v-loading-indicator")));
@@ -65,22 +64,29 @@ public class LoadingIndicatorTest extends GridBasicFeaturesTest {
isLoadingIndicatorVisible());
// Finally verify that there was actually a request going on
- Thread.sleep(2000);
+ waitUntilLogContains("Requested items");
+ }
- String firstLogRow = getLogRow(0);
- Assert.assertTrue(
- "Last log message should be number 6: " + firstLogRow,
- firstLogRow.startsWith("6. Requested items"));
+ private void waitUntilLogContains(final String value) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return getLogRow(0).contains(value);
+ }
+
+ @Override
+ public String toString() {
+ // Timed out after 10 seconds waiting for ...
+ return "first log row to contain '" + value + "' (was: '"
+ + getLogRow(0) + "')";
+ }
+ });
}
private boolean isLoadingIndicatorVisible() {
WebElement loadingIndicator = findElement(By
.className("v-loading-indicator"));
- if (loadingIndicator == null) {
- return false;
- } else {
- return loadingIndicator.isDisplayed();
- }
+ return loadingIndicator.isDisplayed();
}
}