Package at.willhaben.willtest.rule
Class JavascriptAlert
- java.lang.Object
-
- at.willhaben.willtest.rule.TestFailureAwareRule
-
- at.willhaben.willtest.rule.JavascriptAlert
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class JavascriptAlert extends TestFailureAwareRule
Adds the text of a possible alert to the normal test failure as suppressed exception. The reason is that if an alert happens, there is usually a timeout from aWebDriver.findElement(By)call, which is caused actually by the alert which hangs the javascript processing. Alerts are unfortunately not visible on screenshots, they do not result in javascript console or webdriver log entries. So the only possibility to get this information is to try to fetch a possible alert message. This helps then the investigation.
-
-
Constructor Summary
Constructors Constructor Description JavascriptAlert(SeleniumProvider seleniumProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidonError(org.junit.runner.Description description, java.lang.Throwable testFailure)Called if the test has thrown an error.-
Methods inherited from class at.willhaben.willtest.rule.TestFailureAwareRule
after, apply, before
-
-
-
-
Constructor Detail
-
JavascriptAlert
public JavascriptAlert(SeleniumProvider seleniumProvider)
-
-
Method Detail
-
onError
protected void onError(org.junit.runner.Description description, java.lang.Throwable testFailure) throws java.lang.ThrowableDescription copied from class:TestFailureAwareRuleCalled if the test has thrown an error. By default it does nothing.- Overrides:
onErrorin classTestFailureAwareRule- Parameters:
description- junit test description objecttestFailure- any error from the test- Throws:
java.lang.Throwable- this will be added totestFailureas suppressed exception. SeeThrowable.addSuppressed(Throwable)
-
-