Class JavaScriptErrorsRule
java.lang.Object
org.junit.rules.TestWatcher
com.atlassian.jira.pageobjects.js.JavaScriptErrorsRule
- All Implemented Interfaces:
org.junit.rules.TestRule
public class JavaScriptErrorsRule
extends org.junit.rules.TestWatcher
-
Constructor Summary
ConstructorsConstructorDescriptionJavaScriptErrorsRule(Supplier<? extends org.openqa.selenium.WebDriver> webDriver, String productPageURL) JavaScriptErrorsRule(Supplier<? extends org.openqa.selenium.WebDriver> webDriver, String productPageURL, File artifactDir) -
Method Summary
Modifier and TypeMethodDescriptionvoiderrorsToIgnore(Map<String, List<String>> ignoredErrors) Allows to add exemptions and narrow them down to specific page(s).voidfailOnJavaScriptErrors(boolean failOnJavaScriptErrors) Whether it should force a test failure when Javascript errors are found.voidfinished(org.junit.runner.Description description) When the test fires the "finished" event, obtain JSErr entries, dump to a file, fail the test if desired.protected voidstarting(org.junit.runner.Description description) When the test fires the "starting" event, set up the directory to save the artifacts.Methods inherited from class org.junit.rules.TestWatcher
apply, failed, skipped, skipped, succeeded
-
Constructor Details
-
JavaScriptErrorsRule
-
JavaScriptErrorsRule
-
-
Method Details
-
failOnJavaScriptErrors
public void failOnJavaScriptErrors(boolean failOnJavaScriptErrors) Whether it should force a test failure when Javascript errors are found. This property is true by default.- Parameters:
failOnJavaScriptErrors- true if Javascript errors should always cause a test to fail
-
errorsToIgnore
Allows to add exemptions and narrow them down to specific page(s). Provided ignored error messages can be a substring of the whole original error message.- Parameters:
ignoredErrors- a Map where `key` is a page URI RegEx and `value` is a list of ignored errors, for those page URIs that match the RegEx.
-
starting
protected void starting(@Nonnull org.junit.runner.Description description) When the test fires the "starting" event, set up the directory to save the artifacts.- Overrides:
startingin classorg.junit.rules.TestWatcher- Parameters:
description- the information on the test case
-
finished
public void finished(org.junit.runner.Description description) When the test fires the "finished" event, obtain JSErr entries, dump to a file, fail the test if desired.- Overrides:
finishedin classorg.junit.rules.TestWatcher- Parameters:
description- the information on the test case
-