✔️VALIDATION

In the Scriptless Automation Framework, the VALIDATION field is essential for specifying the expected outcomes or values against which the state or properties of web elements are checked during automation tests. This field is effectively paired with VALIDATION_TYPE to enable various forms of validation checks.

Role of the VALIDATION Field

  • Purpose: The VALIDATION field is used to define the expected result or benchmark for comparison during the validation of web elements.

  • Versatility: Its usage varies depending on the chosen VALIDATION_TYPE, catering to a wide range of validation scenarios.

Interaction with VALIDATION_TYPE

The VALIDATION_TYPE dictates how the VALIDATION field is employed:

chevron-rightEQUAL_IGNOREhashtag

Compares the web element's text with the value in VALIDATION, ignoring case differences.

Example:

PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,NONE,NONE,pageTitle,NONE,NONE,Swag Labs,EQUAL_IGNORE

Tutorial:

https://youtu.be/X7RBAiojoeoarrow-up-right

chevron-rightIS_DISPLAYhashtag

This type does not utilize VALIDATION, focusing instead on the element's visibility.

Example:

PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,NONE,NONE,pageTitle,NONE,NONE,NONE,IS_DISPLAY

Tutorial:

https://youtu.be/SgxgHDhD2d4arrow-up-right

chevron-rightIS_BUTTON_ENABLE / IS_BUTTON_DISABLEhashtag

These types do not use VALIDATION, assessing the enablement or disablement of a button element.

Example:

PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,NONE,NONE,loginButton,NONE,NONE,NONE,IS_BUTTON_ENABLE
SwagLabs,NONE,NONE,loginButton,NONE,NONE,NONE,IS_BUTTON_DISABLE
chevron-rightATTRIBUTE_VALUE_PRESENT / ATTRIBUTE_VALUE_NOT_PRESENThashtag

Here, VALIDATION specifies the attribute value to check for its presence or absence.

  • Example for ATTRIBUTE_VALUE_PRESENT:

    PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
    SwagLabs,NONE,NONE,userName,NONE,Automation,NONE,NONE
    SwagLabs,NONE,NONE,userName,NONE,NONE,NONE,ATTRIBUTE_VALUE_PRESENT
  • Example for ATTRIBUTE_VALUE_NOT_PRESENT:

    PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
    SwagLabs,NONE,NONE,userName,NONE,NONE,NONE,ATTRIBUTE_VALUE_NOT_PRESENT
chevron-rightATTRIBUTE_EQUAL_IGNOREhashtag

Compares an attribute's value against the VALIDATION field value, ignoring case. VALIDATION should follow the template attributeExpected|attributeProperty.

Example:

DEMO -> https://youtu.be/4YNpkKYCopIarrow-up-right

chevron-rightATTRIBUTE_EQUALhashtag

Compares an attribute's value against the VALIDATION field value. VALIDATION should follow the template attributeExpected|attributeProperty.

  • Example:

chevron-rightATTRIBUTE_CONTAINShashtag

Ensures the attribute's value contains the substring provided in the VALIDATION field.VALIDATION should follow the template attributeExpected|attributeProperty.

  • Example:

chevron-rightCUSTOMhashtag

Custom validation logic may vary in its use of the VALIDATION field.

chevron-rightCSS_PROPERTYhashtag

Added a feature for validating CSS property types, enabling users to ensure UI components match expected CSS values accurately. VALIDATION should follow the template "cssExpected | CssPropertyName".

  • Example: To validate the font-family of a page title in SwagLabs, the syntax would be:

    Copy

chevron-rightPAGE_COMPARISONhashtag

Validate the screenshot taken from the driver against the expected screenshot stored in directory test_data/web/page_screenshot .

chevron-rightNOT_EQUALShashtag

Validate the element text is not equal to the expected text.

chevron-rightIS_NOT_DISPLAYhashtag

Validate the element is not visible on the HTML page.

https://youtu.be/MmlHqld809warrow-up-right

chevron-rightIS_ELEMENT_PRESENThashtag

Validate the element is present/display on the HTML page

chevron-rightIS_ELEMENT_NOT_PRESENThashtag

Validate the element is not present/display on the HTML page

chevron-rightNONEhashtag

Indicates no validation is required, rendering the VALIDATION field unused.

Example Scenarios

  • If VALIDATION_TYPE is EQUAL_IGNORE and VALIDATION is "Submit", the framework checks if the element’s text is "Submit", irrespective of case.

  • For IS_DISPLAY, the VALIDATION field is not necessary; the framework simply confirms the element's presence.

Last updated