Class PlaywrightVisualComparisonOptions
java.lang.Object
com.shaft.validation.VisualComparisonOptions
com.shaft.gui.playwright.validation.PlaywrightVisualComparisonOptions
Playwright variant of
VisualComparisonOptions that adds a Playwright Locator-based
mask(...) overload, for use with the Playwright engine's
assertThat(...).matchesScreenshot(options) assertion.
driver.element().assertThat(locator)
.matchesScreenshot(PlaywrightVisualComparisonOptions.create()
.maxDiffPixelRatio(0.01)
.mask(page.locator("#timestamp")));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()List<com.microsoft.playwright.Locator> mask(com.microsoft.playwright.Locator... masks) Excludes the region(s) covered by the given Playwright locators from the pixel comparison.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.Methods inherited from class VisualComparisonOptions
getMaskLocators, getMaxDiffPixelRatio, getMaxDiffPixels
-
Constructor Details
-
PlaywrightVisualComparisonOptions
public PlaywrightVisualComparisonOptions()
-
-
Method Details
-
create
- Returns:
- a new, empty Playwright options object to configure and pass to
matchesScreenshot(...)
-
maxDiffPixels
Description copied from class:VisualComparisonOptionsCaps the number of differing pixels allowed for the comparison to still pass.- Overrides:
maxDiffPixelsin classVisualComparisonOptions- Parameters:
maxDiffPixels- maximum allowed differing pixel count- Returns:
- this options object, to continue chaining
-
maxDiffPixelRatio
Description copied from class:VisualComparisonOptionsCaps the ratio of differing pixels (0.0-1.0) allowed for the comparison to still pass.- Overrides:
maxDiffPixelRatioin classVisualComparisonOptions- Parameters:
maxDiffPixelRatio- maximum allowed differing pixel ratio- Returns:
- this options object, to continue chaining
-
mask
Description copied from class:VisualComparisonOptionsExcludes the region(s) covered by the given locators from the pixel comparison.- Overrides:
maskin classVisualComparisonOptions- Parameters:
masks- locators of elements whose bounding boxes should be excluded from the diff- Returns:
- this options object, to continue chaining
-
mask
Excludes the region(s) covered by the given Playwright locators from the pixel comparison.- Parameters:
masks- Playwright locators of elements whose bounding boxes should be excluded from the diff- Returns:
- this options object, to continue chaining
-
getPlaywrightMaskLocators
- Returns:
- the (possibly empty) list of Playwright locators whose regions are excluded from the diff
-