Class WebDriverElementValidationsBuilder
java.lang.Object
com.shaft.validation.internal.WebDriverElementValidationsBuilder
- All Implemented Interfaces:
ElementAssertions
-
Constructor Summary
ConstructorsConstructorDescriptionWebDriverElementValidationsBuilder(ValidationEnums.ValidationCategory validationCategory, org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator, StringBuilder reportMessageBuilder) -
Method Summary
Modifier and TypeMethodDescriptionUse this to check against a certain element attributecssProperty(String elementCssProperty) Use this to check against a certain element attributeUse this to check that the target element does not existUse this to check that the target element does not match a reference image (using the Artificial Intelligence library OpenCV).doesNotMatchReferenceImage(ValidationEnums.VisualValidationEngine visualValidationEngine) Use this to check that the target element does not match a reference image.domAttribute(String domAttribute) domProperty(String domProperty) exists()Use this to check that the target element existsUse this to check against the provided elements checked attributeUse this to check against the provided elements disabled attributeUse this to check against the provided elements disabled attributeisHidden()Use this to check against the provided elements hidden attributeUse this to check against the provided elements checked attributeUse this to check against the provided elements selected attributeUse this to check against the provided elements selected attributeUse this to check against the provided elements hidden attributematchesAriaSnapshot(String snapshotFileName) Use this to check that the target element matches its accessible-name-tree ("aria") baseline snapshot, using partial-subset semantics (seeAriaSnapshotHelper).Use this to check that the target element matches a reference image (using the Artificial Intelligence library SHUTTERBUG).matchesReferenceImage(ValidationEnums.VisualValidationEngine visualValidationEngine) Use this to check that the target element matches a reference image.Use this to check that the target element matches its visual-regression baseline screenshot (pixel diff via OpenCV).matchesScreenshot(VisualComparisonOptions options) Same asmatchesScreenshot(), but with diff-budget/mask options (seeVisualComparisonOptions).Use this to check against a certain element attributetext()Use this to check against the provided elements text attributeUse this to check against the provided elements text attribute after it's trimmed (all leading and trailing space removed)
-
Constructor Details
-
WebDriverElementValidationsBuilder
public WebDriverElementValidationsBuilder(ValidationEnums.ValidationCategory validationCategory, org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator, StringBuilder reportMessageBuilder)
-
-
Method Details
-
exists
Use this to check that the target element exists- Specified by:
existsin interfaceElementAssertions- Returns:
- a ValidationsExecutor object retained for source compatibility
-
doesNotExist
Use this to check that the target element does not exist- Specified by:
doesNotExistin interfaceElementAssertions- Returns:
- a ValidationsExecutor object retained for source compatibility
-
matchesReferenceImage
Use this to check that the target element matches a reference image (using the Artificial Intelligence library SHUTTERBUG). On the first test run this method will take a screenshot of the target element and the test will pass, and on following runs the element will be compared against that reference image. The reference images are stored under src/test/resources/DynamicObjectRepository for later maintenance- Specified by:
matchesReferenceImagein interfaceElementAssertions- Returns:
- a ValidationsExecutor object retained for source compatibility
-
matchesReferenceImage
public ValidationsExecutor matchesReferenceImage(ValidationEnums.VisualValidationEngine visualValidationEngine) Use this to check that the target element matches a reference image.- Specified by:
matchesReferenceImagein interfaceElementAssertions- Parameters:
visualValidationEngine- the selected visualValidationEngine that will be used to perform the image comparison- Returns:
- a ValidationsExecutor object retained for source compatibility
-
doesNotMatchReferenceImage
Use this to check that the target element does not match a reference image (using the Artificial Intelligence library OpenCV). On the first test run this method will take a screenshot of the target element and the test will pass, and on following runs the element will be compared against that reference image. The reference images are stored under src/test/resources/DynamicObjectRepository for later maintenance- Specified by:
doesNotMatchReferenceImagein interfaceElementAssertions- Returns:
- a ValidationsExecutor object retained for source compatibility
-
doesNotMatchReferenceImage
public ValidationsExecutor doesNotMatchReferenceImage(ValidationEnums.VisualValidationEngine visualValidationEngine) Use this to check that the target element does not match a reference image.- Specified by:
doesNotMatchReferenceImagein interfaceElementAssertions- Parameters:
visualValidationEngine- the selected visualValidationEngine that will be used to perform the image comparison- Returns:
- a ValidationsExecutor object retained for source compatibility
-
matchesScreenshot
Use this to check that the target element matches its visual-regression baseline screenshot (pixel diff via OpenCV). On the first test run this method takes a screenshot of the target element and the test passes, saving it as the baseline for subsequent runs. Baselines are stored alongside the other visual baselines under the configureddynamicObjectRepositoryPath. The comparison runs when this terminal assertion is called.- Specified by:
matchesScreenshotin interfaceElementAssertions- Returns:
- a ValidationsExecutor object to optionally set a custom validation message
-
matchesScreenshot
Same asmatchesScreenshot(), but with diff-budget/mask options (seeVisualComparisonOptions). The comparison executes immediately.- Specified by:
matchesScreenshotin interfaceElementAssertions- Parameters:
options- the visual comparison options (diff budgets, masks), ornullfor defaults- Returns:
- a ValidationsExecutor object to optionally set a custom validation message
-
matchesAriaSnapshot
Use this to check that the target element matches its accessible-name-tree ("aria") baseline snapshot, using partial-subset semantics (seeAriaSnapshotHelper). On the first test run this method saves the current snapshot as the baseline and the test passes, under the configuredariaSnapshotFolderPath.- Specified by:
matchesAriaSnapshotin interfaceElementAssertions- Parameters:
snapshotFileName- the baseline file name (without extension) to compare against or create- Returns:
- a ValidationsExecutor object retained for source compatibility
-
attribute
Use this to check against a certain element attribute- Specified by:
attributein interfaceElementAssertions- Parameters:
attribute- the target element attribute that will be checked against- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
domAttribute
- Specified by:
domAttributein interfaceElementAssertions
-
domProperty
- Specified by:
domPropertyin interfaceElementAssertions
-
property
Use this to check against a certain element attribute- Specified by:
propertyin interfaceElementAssertions- Parameters:
domProperty- the target element DOM property that will be checked against- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isSelected
Use this to check against the provided elements selected attribute- Specified by:
isSelectedin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isChecked
Use this to check against the provided elements checked attribute- Specified by:
isCheckedin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isVisible
Use this to check against the provided elements hidden attribute- Specified by:
isVisiblein interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isEnabled
Use this to check against the provided elements disabled attribute- Specified by:
isEnabledin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isNotSelected
Use this to check against the provided elements selected attribute- Specified by:
isNotSelectedin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isNotChecked
Use this to check against the provided elements checked attribute- Specified by:
isNotCheckedin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isHidden
Use this to check against the provided elements hidden attribute- Specified by:
isHiddenin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
isDisabled
Use this to check against the provided elements disabled attribute- Specified by:
isDisabledin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
text
Use this to check against the provided elements text attribute- Specified by:
textin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
textTrimmed
Use this to check against the provided elements text attribute after it's trimmed (all leading and trailing space removed)- Specified by:
textTrimmedin interfaceElementAssertions- Returns:
- a NativeValidationsBuilder object to continue building your validation
-
cssProperty
Use this to check against a certain element attribute- Specified by:
cssPropertyin interfaceElementAssertions- Parameters:
elementCssProperty- the target element css property that will be checked against- Returns:
- a NativeValidationsBuilder object to continue building your validation
-