Class LocatorHealthReporter
java.lang.Object
com.shaft.gui.internal.locator.LocatorHealthReporter
Collects run-level locator timing and flakiness signals when enabled.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the current locator-health JSON snapshot without resetting collected data.static booleanReturns whether locator health collection is enabled for the current thread.static voidrecordHealingAttempt(org.openqa.selenium.By originalLocator, boolean accepted) Records one SHAFT Heal recovery attempt for the original locator.static voidrecordHealingAttempt(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 voidrecordLookup(org.openqa.selenium.By locator, long elapsedMillis, int pollingAttempts, int foundElementCount, boolean timedOut, int staleRetries) Records one completed locator lookup.static AssertionErrorWrites and attaches the end-of-run report, then returns a build failure when configured.static voidreset()Clears all collected run-level locator health data.
-
Method Details
-
isEnabled
public static boolean isEnabled()Returns whether locator health collection is enabled for the current thread.- Returns:
truewhen 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 lookupelapsedMillis- elapsed lookup time in millisecondspollingAttempts- number of polling attempts performedfoundElementCount- number of elements found by the locatortimedOut- whether the lookup timed outstaleRetries- 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 recoveryaccepted- 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 recoveryaccepted- whether the recovery was acceptedselectedLocator- accepted replacement locatorconfidence- provider confidence from0.0to1.0, or negative when unknown
-
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
Returns the current locator-health JSON snapshot without resetting collected data.- Returns:
- current locator-health summary JSON
-