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

    Constructors
    Constructor
    Description
    JavaScriptErrorsRule(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 Type
    Method
    Description
    void
    errorsToIgnore(Map<String,List<String>> ignoredErrors)
    Allows to add exemptions and narrow them down to specific page(s).
    void
    failOnJavaScriptErrors(boolean failOnJavaScriptErrors)
    Whether it should force a test failure when Javascript errors are found.
    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.
    protected void
    starting(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JavaScriptErrorsRule

      public JavaScriptErrorsRule(Supplier<? extends org.openqa.selenium.WebDriver> webDriver, String productPageURL)
    • JavaScriptErrorsRule

      public JavaScriptErrorsRule(Supplier<? extends org.openqa.selenium.WebDriver> webDriver, String productPageURL, File artifactDir)
  • 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

      public void errorsToIgnore(Map<String,List<String>> ignoredErrors)
      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:
      starting in class org.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:
      finished in class org.junit.rules.TestWatcher
      Parameters:
      description - the information on the test case