summaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorOlli Tietäväinen <ollit@vaadin.com>2017-12-20 16:48:56 +0200
committerGitHub <noreply@github.com>2017-12-20 16:48:56 +0200
commit14a52da08932d6691815d19b31a81ba28bbbc711 (patch)
treebb457c22b05604ac0b88f67c156c242475ecec2a /uitest/src/test
parent22d20f67625e260f5f015ee691dcef476c58b8bd (diff)
downloadvaadin-framework-14a52da08932d6691815d19b31a81ba28bbbc711.tar.gz
vaadin-framework-14a52da08932d6691815d19b31a81ba28bbbc711.zip
Prevent killing UI if heartbeats are pending (#10371) (#10450)
* Prevent killing UI if heartbeats are pending (#10371) Fixes #9663 * fixed Java 1.8 syntax -> 1.6
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/core/LockingUITest.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/core/LockingUITest.java b/uitest/src/test/java/com/vaadin/tests/core/LockingUITest.java
new file mode 100644
index 0000000000..214adfc94d
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/core/LockingUITest.java
@@ -0,0 +1,47 @@
+package com.vaadin.tests.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.NotificationElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class LockingUITest extends SingleBrowserTest {
+
+ @Test
+ public void testLockingTheUIFor4HeartBeats() {
+ openTestURL();
+
+ clickButtonAndCheckNotification("check", LockingUI.ALL_OK);
+ clickButtonAndCheckNotification("lock", LockingUI.LOCKING_ENDED);
+ clickButtonAndCheckNotification("check", LockingUI.ALL_OK);
+ }
+
+ private void clickButtonAndCheckNotification(String buttonId, String text) {
+ checkNoInitialNotification();
+
+ $(ButtonElement.class).id(buttonId).click();
+ testBench().waitForVaadin();
+
+ checkNotification(text);
+ }
+
+ private void checkNotification(String text) {
+ assertTrue("Notification should be displayed",
+ $(NotificationElement.class).exists());
+
+ NotificationElement notification = $(NotificationElement.class).first();
+ assertEquals("Unexpected text content in Notification", text,
+ notification.getText());
+ notification.close();
+ }
+
+ private void checkNoInitialNotification() {
+ assertFalse("Extra notification displayed",
+ $(NotificationElement.class).exists());
+ }
+}