From 82acb5e52ed99b9c77356cb19397dba5c9eab659 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 29 Jan 2015 11:06:16 +0200 Subject: [PATCH] Make tests more reliable Especially fixes problems with GridStructureTest Change-Id: Iad0b25fc9cb182940db45af76d47292fd6d1b0bf --- .../src/com/vaadin/tests/tb3/AbstractTB3Test.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 15585c7e45..c8ca4c12a1 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -67,6 +67,7 @@ import com.vaadin.testbench.TestBench; import com.vaadin.testbench.TestBenchDriverProxy; import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.TestBenchTestCase; +import com.vaadin.testbench.elements.AbstractElement; import com.vaadin.testbench.elements.CheckBoxElement; import com.vaadin.testbench.elements.LabelElement; import com.vaadin.testbench.elements.TableElement; @@ -1332,4 +1333,16 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { checkbox.findElement(By.xpath("input")).click(); } + @Override + public boolean isElementPresent(Class clazz) { + // This is a bug in TB4 as isElementPresent(..) should just return true + // or false but can also throw exceptions. The problem is possibly if + // this is run when the Vaadin app is not initialized yet + try { + return super.isElementPresent(clazz); + } catch (NoSuchElementException e) { + return false; + } + } + } -- 2.39.5