summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhe Sun <31067185+ZheSun88@users.noreply.github.com>2019-07-04 09:42:54 +0300
committerGitHub <noreply@github.com>2019-07-04 09:42:54 +0300
commitd3f784f37378ade98d3b5de28a7d108b7ad77c7d (patch)
tree229d193f63e6058457e2bcc521eeb8178b5cfc41
parent2584e9ad44fa9135daa405df8cbc9ae7d4a3ee33 (diff)
downloadvaadin-framework-d3f784f37378ade98d3b5de28a7d108b7ad77c7d.tar.gz
vaadin-framework-d3f784f37378ade98d3b5de28a7d108b7ad77c7d.zip
Fix unstable tests (#11648)
* Fix unstable tests
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java18
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldEventOrderTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java9
-rw-r--r--uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java5
5 files changed, 22 insertions, 19 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java
index 423ff2e71c..49e8312295 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java
@@ -1,13 +1,14 @@
package com.vaadin.tests.components.datefield;
-import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
+import org.openqa.selenium.By;
import com.vaadin.testbench.elements.DateFieldElement;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertEquals;
+
public class DateFieldFocusTest extends MultiBrowserTest {
@Test
@@ -19,16 +20,15 @@ public class DateFieldFocusTest extends MultiBrowserTest {
TextFieldElement textField = $(TextFieldElement.class).caption("second")
.first();
- dateField.openPopup();
- dateField.openPopup();
-
- dateField.openPopup();
- dateField.openPopup();
+ // open DateField popup
+ dateField.findElement(By.className("v-datefield-button")).click();
+ sleep(100);
+ // close DateField popup
+ dateField.findElement(By.className("v-datefield-button")).click();
+ sleep(100);
assertEquals("1. focused", getLogRow(0));
-
textField.focus();
-
waitUntil(input -> "2. blurred".equals(getLogRow(0)));
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldEventOrderTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldEventOrderTest.java
index e8496a37a3..d28a3f490c 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldEventOrderTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldEventOrderTest.java
@@ -20,7 +20,7 @@ public class DateTimeFieldEventOrderTest extends SingleBrowserTest {
DateTimeFieldElement field = $(DateTimeFieldElement.class).first();
- field.openPopup();
+ field.findElement(By.className("v-datefield-button")).click();
List<WebElement> timeSelects = findElement(
By.className("v-datefield-calendarpanel-time"))
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java
index 3d68fc5800..53a3ab0c33 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java
@@ -1,8 +1,5 @@
package com.vaadin.tests.components.grid;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.util.List;
import org.junit.Test;
@@ -13,6 +10,9 @@ import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
@TestCategory("grid")
public class GridEditorMultiselectTest extends MultiBrowserTest {
@@ -37,6 +37,7 @@ public class GridEditorMultiselectTest extends MultiBrowserTest {
openTestURL();
GridElement grid = openEditor();
grid.getEditor().cancel();
+ sleep(100);
assertCheckboxesEnabled(grid, true);
}
diff --git a/uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java
index f1d5f931ae..8969928ce8 100644
--- a/uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java
+++ b/uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java
@@ -1,9 +1,5 @@
package com.vaadin.tests.elements.menubar;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
import java.util.List;
import org.junit.Before;
@@ -15,6 +11,10 @@ import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
public class MenuBarUITest extends MultiBrowserTest {
@Override
@@ -58,6 +58,7 @@ public class MenuBarUITest extends MultiBrowserTest {
// The Edit menu will be opened by moving the mouse over the item (done
// by clickItem). The first click then actually closes the menu.
menuBar.clickItem("Edit");
+ sleep(100);
menuBar.clickItem("Edit");
assertFalse(isItemVisible("Save As.."));
assertTrue(isItemVisible("Paste"));
diff --git a/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java b/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java
index 333fd7e8e3..93ac72fa4d 100644
--- a/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.elements.notification;
-import static org.junit.Assert.assertTrue;
-
import java.util.List;
import org.junit.Test;
@@ -10,6 +8,8 @@ import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertTrue;
+
public class NotificationCloseTest extends MultiBrowserTest {
@Override
@@ -43,6 +43,7 @@ public class NotificationCloseTest extends MultiBrowserTest {
ButtonElement btn = $(ButtonElement.class).id(id);
// show notification
btn.click();
+ sleep(100);
$(NotificationElement.class).get(0).close();
List<NotificationElement> notifications = $(NotificationElement.class)
.all();