package com.vaadin.tests.components.datefield;
+import static org.junit.Assert.assertEquals;
+
import java.util.List;
import org.junit.Test;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.Select;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.DateTimeFieldElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
-import static org.junit.Assert.assertEquals;
-
public class DateTimeFieldEventOrderTest extends SingleBrowserTest {
@Test
new Select(timeSelects.get(0)).selectByValue("09");
findElement(By.id("test-button")).click();
- sleep(100);
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver arg0) {
+ return !" ".equals(getLogRow(1));
+ }
+
+ @Override
+ public String toString() {
+ // waiting for ...
+ return "log row 1 to get content";
+ }
+ });
assertEquals("The button click event should come second.",
"2. Button Click Event", getLogRow(0));
@Test
public void updateProgressShouldNotMoveButton() {
openTestURL();
+ waitUntilLoadingIndicatorNotVisible();
ProgressBarElement pb = $(ProgressBarElement.class).first();
ButtonElement button = $(ButtonElement.class).first();
int initialWidth = pb.getSize().getWidth();
button.click();
+ waitUntilLoadingIndicatorNotVisible();
assertEquals("Button's position changed unexpectedly", initialX,
button.getLocation().getX());