diff options
Diffstat (limited to 'uitest')
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")); + } + } |