summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2015-06-19 14:22:19 +0300
committerVaadin Code Review <review@vaadin.com>2015-06-22 09:04:16 +0000
commitca15c5bb99703d73687e2fba56d1b18f74937acc (patch)
tree74ea45e8389c387ad05479f767c72843b53ee569 /uitest
parent122fccfe01f8f1aca922d861b44853b09fe8f603 (diff)
downloadvaadin-framework-ca15c5bb99703d73687e2fba56d1b18f74937acc.tar.gz
vaadin-framework-ca15c5bb99703d73687e2fba56d1b18f74937acc.zip
Extract duplciated logic for checking for error notifications
Change-Id: I1cc630e9c21b3e73d135129ba3d86f7b22019e0f
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveComponentTest.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java17
5 files changed, 22 insertions, 16 deletions
diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveComponentTest.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveComponentTest.java
index 84f1734897..785acddcb7 100644
--- a/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveComponentTest.java
+++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveComponentTest.java
@@ -15,9 +15,7 @@
*/
package com.vaadin.tests.components.accordion;
-import org.junit.Assert;
import org.junit.Test;
-import org.openqa.selenium.By;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -36,8 +34,7 @@ public class AccordionRemoveComponentTest extends MultiBrowserTest {
$(ButtonElement.class).first().click();
- Assert.assertFalse(
- "Error notification with client side exception is shown",
- isElementPresent(By.className("v-Notification-error")));
+ assertNoErrorNotifications();
}
+
}
diff --git a/uitest/src/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java b/uitest/src/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java
index dfafe8fb40..090286b1ad 100644
--- a/uitest/src/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java
+++ b/uitest/src/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroupTest.java
@@ -38,9 +38,7 @@ public class ReadOnlyOptionGroupTest extends MultiBrowserTest {
WebElement checkboxInput = checkbox.findElement(By.tagName("input"));
checkboxInput.click();
- Assert.assertFalse("There is a client side exception after unset "
- + "readonly mode for option group",
- isElementPresent(By.className("v-Notification-error")));
+ assertNoErrorNotifications();
Assert.assertFalse("Radio button in option group is still disabled "
+ "after unset reaonly",
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java
index 4d11190ea9..073fd321e5 100644
--- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.components.popupview;
-import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebElement;
@@ -38,10 +37,7 @@ public class PopupViewWithExtensionTest extends MultiBrowserTest {
WebElement view = driver.findElement(By.className("v-popupview"));
view.click();
- Assert.assertFalse(
- "Popup view with extension should not throw an exception. "
- + "(Error notification window is shown).",
- isElementPresent(By.className("v-Notification-error")));
+ assertNoErrorNotifications();
}
}
diff --git a/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java b/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java
index 4c682637b1..6fb0d446d3 100644
--- a/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java
+++ b/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.components.table;
-import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
@@ -42,8 +41,7 @@ public class DndEmptyTableTest extends MultiBrowserTest {
Actions actions = new Actions(driver);
actions.clickAndHold(source).moveToElement(target).release();
- Assert.assertFalse(isElementPresent(By
- .className("v-Notification-error")));
+ assertNoErrorNotifications();
}
}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 2e33cc2741..5b05d1d50a 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -1065,4 +1065,21 @@ public abstract class AbstractTB3Test extends ParallelTest {
Assert.assertFalse("Element is present", isElementPresent(by));
}
+ /**
+ * Asserts that no error notifications are shown. Requires the use of
+ * "?debug" as exceptions are otherwise not shown as notifications.
+ */
+ protected void assertNoErrorNotifications() {
+ Assert.assertTrue(
+ "Debug window must be open to be able to see error notifications",
+ isDebugWindowOpen());
+ Assert.assertFalse(
+ "Error notification with client side exception is shown",
+ isElementPresent(By.className("v-Notification-error")));
+ }
+
+ private boolean isDebugWindowOpen() {
+ return isElementPresent(By.className("v-debugwindow"));
+ }
+
}