Class LocatorHealthReporter

java.lang.Object
com.shaft.gui.internal.locator.LocatorHealthReporter

public final class LocatorHealthReporter extends Object
Collects run-level locator timing and flakiness signals when enabled.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Returns the current locator-health JSON snapshot without resetting collected data.
    static boolean
    Returns whether locator health collection is enabled for the current thread.
    static void
    recordHealingAttempt(org.openqa.selenium.By originalLocator, boolean accepted)
    Records one SHAFT Heal recovery attempt for the original locator.
    static void
    recordHealingAttempt(org.openqa.selenium.By originalLocator, boolean accepted, org.openqa.selenium.By selectedLocator, double confidence)
    Records one SHAFT Heal recovery attempt for the original locator.
    static void
    recordLookup(org.openqa.selenium.By locator, long elapsedMillis, int pollingAttempts, int foundElementCount, boolean timedOut, int staleRetries)
    Records one completed locator lookup.
    Writes and attaches the end-of-run report, then returns a build failure when configured.
    static void
    Clears all collected run-level locator health data.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isEnabled

      public static boolean isEnabled()
      Returns whether locator health collection is enabled for the current thread.
      Returns:
      true when collection is enabled
    • reset

      public static void reset()
      Clears all collected run-level locator health data.
    • recordLookup

      public static void recordLookup(org.openqa.selenium.By locator, long elapsedMillis, int pollingAttempts, int foundElementCount, boolean timedOut, int staleRetries)
      Records one completed locator lookup.
      Parameters:
      locator - locator used for the lookup
      elapsedMillis - elapsed lookup time in milliseconds
      pollingAttempts - number of polling attempts performed
      foundElementCount - number of elements found by the locator
      timedOut - whether the lookup timed out
      staleRetries - number of stale-element retries observed
    • recordHealingAttempt

      public static void recordHealingAttempt(org.openqa.selenium.By originalLocator, boolean accepted)
      Records one SHAFT Heal recovery attempt for the original locator.
      Parameters:
      originalLocator - locator that needed recovery
      accepted - whether the recovery was accepted
    • recordHealingAttempt

      public static void recordHealingAttempt(org.openqa.selenium.By originalLocator, boolean accepted, org.openqa.selenium.By selectedLocator, double confidence)
      Records one SHAFT Heal recovery attempt for the original locator.
      Parameters:
      originalLocator - locator that needed recovery
      accepted - whether the recovery was accepted
      selectedLocator - accepted replacement locator
      confidence - provider confidence from 0.0 to 1.0, or negative when unknown
    • reportAndGetFailure

      public static AssertionError reportAndGetFailure()
      Writes and attaches the end-of-run report, then returns a build failure when configured.
      Returns:
      assertion error when warnings should fail the run; otherwise null
    • currentSummaryJson

      public static String currentSummaryJson()
      Returns the current locator-health JSON snapshot without resetting collected data.
      Returns:
      current locator-health summary JSON