From: Sauli Tähkäpää Date: Sat, 4 Oct 2014 18:25:47 +0000 (+0300) Subject: Activated RetryOnFail on AbstractTB3Test. X-Git-Tag: 7.4.0.beta1~174 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7d4884fab4b224c2cff88038ceed51cb554d575a;p=vaadin-framework.git Activated RetryOnFail on AbstractTB3Test. Change-Id: I7d000593ba77f2edf7743775dbd8d7241c33e36a --- diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java index cbe4dbdf29..2b6ba40e8c 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java @@ -1,18 +1,17 @@ package com.vaadin.tests.components.ui; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.endsWith; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assert.assertThat; - -import org.junit.Test; - import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.tests.tb3.SingleBrowserTest; +import org.junit.Ignore; +import org.junit.Test; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThat; public class UISerializationTest extends SingleBrowserTest { + @Test + @Ignore //Broken on all browsers since 9696e6c3e7e952b66ac3f5c9ddc3dfca4233451e public void tb2test() throws Exception { openTestURL(); $(ButtonElement.class).first().click(); diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 1d03a7df76..76b851fd23 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -40,6 +40,7 @@ import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicHttpEntityEnclosingRequest; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.runner.RunWith; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -94,6 +95,10 @@ import elemental.json.impl.JsonUtil; */ @RunWith(value = TB3Runner.class) public abstract class AbstractTB3Test extends TestBenchTestCase { + + @Rule + public RetryOnFail retry = new RetryOnFail(); + /** * Height of the screenshots we want to capture */ diff --git a/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java b/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java index 9c12147314..6fa6f9cd27 100644 --- a/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java +++ b/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java @@ -19,20 +19,7 @@ import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; -/** - * ALWAYS declare the reason for using this test rule in a - * test. - * - *

- * Violators and abusers of this rule will be punished. - *

- * - * @since 7.1.14 - * @author Vaadin Ltd - */ public class RetryOnFail implements TestRule { - private int retryCount = 1; - @Override public Statement apply(Statement base, Description description) { return statement(base, description); @@ -44,6 +31,7 @@ public class RetryOnFail implements TestRule { @Override public void evaluate() throws Throwable { Throwable caughtThrowable = null; + int retryCount = getRetryCount(); for (int i = 0; i <= retryCount; i++) { try { @@ -60,6 +48,16 @@ public class RetryOnFail implements TestRule { } throw caughtThrowable; } + + private int getRetryCount() { + String retryCount = System.getProperty("com.vaadin.testbench.max.retries"); + + if(retryCount != null && retryCount != "") { + return Integer.parseInt(retryCount); + } + + return 4; + } }; } } diff --git a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java index a99eea9bf6..ed5a2ed8aa 100644 --- a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -68,13 +68,15 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { * Contains a list of screenshot identifiers for which * {@link #compareScreen(String)} has failed during the test */ - private List screenshotFailures = new ArrayList(); + private List screenshotFailures; /** * Defines TestBench screen comparison parameters before each test run */ @Before public void setupScreenComparisonParameters() { + screenshotFailures = new ArrayList(); + Parameters.setScreenshotErrorDirectory(getScreenshotErrorDirectory()); Parameters .setScreenshotReferenceDirectory(getScreenshotReferenceDirectory()); diff --git a/uitest/tb3test.xml b/uitest/tb3test.xml index a39725f1bb..975298926e 100644 --- a/uitest/tb3test.xml +++ b/uitest/tb3test.xml @@ -8,6 +8,7 @@ + @@ -39,6 +40,7 @@ +