Class VisualValidationsBuilder
java.lang.Object
com.shaft.validation.internal.VisualValidationsBuilder
- Direct Known Subclasses:
PlaywrightVisualValidationsBuilder
Fluent options builder for the
matchesScreenshot() visual-regression assertion.
This builder gathers optional diff-budget and mask options before the visual comparison
runs, mirroring Playwright's toHaveScreenshot() options.
-
Constructor Summary
ConstructorsConstructorDescriptionVisualValidationsBuilder(ValidationEnums.ValidationCategory validationCategory, org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator, boolean pageLevel, StringBuilder reportMessageBuilder) -
Method Summary
Modifier and TypeMethodDescriptionapplyOptions(VisualComparisonOptions options) Copies the diff-budget and mask settings from a publicVisualComparisonOptionsobject onto this internal builder.mask(org.openqa.selenium.By... masks) Excludes the region(s) covered by the given locators from the pixel comparison.maxDiffPixelRatio(double maxDiffPixelRatio) Caps the ratio of differing pixels (0.0-1.0) allowed for the comparison to still pass.maxDiffPixels(int maxDiffPixels) Caps the number of differing pixels allowed for the comparison to still pass.perform()Executes the visual-regression comparison (or saves a new baseline on first run / when-Dshaft.updateSnapshots=trueis set).
-
Constructor Details
-
VisualValidationsBuilder
public VisualValidationsBuilder(ValidationEnums.ValidationCategory validationCategory, org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator, boolean pageLevel, StringBuilder reportMessageBuilder)
-
-
Method Details
-
maxDiffPixels
Caps the number of differing pixels allowed for the comparison to still pass.- Parameters:
maxDiffPixels- maximum allowed differing pixel count- Returns:
- this builder, to continue chaining options
-
maxDiffPixelRatio
Caps the ratio of differing pixels (0.0-1.0) allowed for the comparison to still pass.- Parameters:
maxDiffPixelRatio- maximum allowed differing pixel ratio- Returns:
- this builder, to continue chaining options
-
mask
Excludes the region(s) covered by the given locators from the pixel comparison.- Parameters:
masks- locators of elements whose bounding boxes should be excluded from the diff- Returns:
- this builder, to continue chaining options
-
applyOptions
Copies the diff-budget and mask settings from a publicVisualComparisonOptionsobject onto this internal builder. PlaywrightLocator-based masks are handled separately by the Playwright entry points.- Parameters:
options- the caller-supplied options, ornullfor defaults- Returns:
- this builder, to continue chaining
-
perform
Executes the visual-regression comparison (or saves a new baseline on first run / when-Dshaft.updateSnapshots=trueis set).- Returns:
- a ValidationsExecutor object retained for source compatibility
-