Class AccessibilityHelper.AccessibilityConfig

java.lang.Object
com.shaft.validation.accessibility.AccessibilityHelper.AccessibilityConfig
Enclosing class:
AccessibilityHelper

public static class AccessibilityHelper.AccessibilityConfig extends Object
Mutable configuration bean for an accessibility scan with fluent-builder setters.

All setters follow a fluent (builder) pattern and return this, allowing convenient one-liner configuration:

AccessibilityConfig config = new AccessibilityConfig()
        .setTags(List.of("wcag21aa"))
        .setContext("main")
        .setReportsDir("target/a11y-reports/")
        .setIncludePasses(false);
AccessibilityHelper.analyzePageAccessibility(driver, "Home", config);

Default values:

  • tags["wcag2a","wcag2aa","wcag21a","wcag21aa","best-practice"]
  • reportsDir"accessibility-reports/"
  • includePassestrue
  • context"body, header, main, footer"
  • Constructor Details

    • AccessibilityConfig

      public AccessibilityConfig()
      Creates a new AccessibilityConfig with default settings. Use the fluent setters to customise the configuration after construction.
  • Method Details

    • getTags

      public List<String> getTags()
      Returns the axe-core WCAG tag filters applied during the scan.
      Returns:
      mutable list of axe rule-set tag identifiers (e.g. "wcag21aa")
    • setTags

      Replaces the axe-core tag filters for this scan.
      config.setTags(List.of("wcag21aa", "best-practice")); 
      Parameters:
      tags - non-null list of axe rule-set tag identifiers
      Returns:
      this instance for method chaining
      Throws:
      NullPointerException - if tags is null
    • getReportsDir

      public String getReportsDir()
      Returns the file-system directory where JSON and HTML reports will be written.
      Returns:
      directory path string (includes trailing /)
    • setReportsDir

      public AccessibilityHelper.AccessibilityConfig setReportsDir(String reportsDir)
      Sets the output directory for generated accessibility reports.
      config.setReportsDir("target/accessibility/"); 
      Parameters:
      reportsDir - path to the output directory; created automatically if absent
      Returns:
      this instance for method chaining
    • isIncludePasses

      public boolean isIncludePasses()
      Returns whether passing rules are included in the generated report.
      Returns:
      true if passing rules appear in the report; false otherwise
    • setIncludePasses

      public AccessibilityHelper.AccessibilityConfig setIncludePasses(boolean includePasses)
      Controls whether passing axe rules are written into the report.
      config.setIncludePasses(false); // omit passes for a leaner report 
      Parameters:
      includePasses - true to include passing rules; false to suppress them
      Returns:
      this instance for method chaining
    • getContext

      public String getContext()
      Returns the CSS selector string used to scope the axe scan to specific page regions.
      Returns:
      CSS selector string (e.g. "body, header, main, footer")
    • setContext

      public AccessibilityHelper.AccessibilityConfig setContext(String context)
      Restricts the axe scan to the DOM subtrees matched by the given CSS selector.
      config.setContext("#content, nav"); 
      Parameters:
      context - CSS selector identifying the elements to include in the scan
      Returns:
      this instance for method chaining