Validations

Validations

Validations are typically about something visible on the page. There are many different types of validations you can use with the “check” command. Alternatively, you can use verify/assert/validate/assess – they are all supported and equal to check.

  • contains/doesn’t contain (text) check that "my_div" contains "error"
  • is blank/is not blank
  • matches regex/doesn’t match regex
  • has value/doesn’t have value (for inputs/text areas)
  • is checked/is not checked check that checkbox "<label>" is not checked
  • is disabled/is enabled
  • is visible/is invisible
  • color is
  • is clickable/is not clickable
  • cursor is
  • has CSS class
  • background color is
  • has property check that property "background-color" of "my-div" is equal to "black"
  • has options selected (for selects) check that "mySelect" has option selected "hello"
Use the word itself to perform validation on a stored value:
call api "https://testrigor.com" and save it as "variableName"
check that stored value "variableName" itself contains "James"

The key to the testing API results is to save it to stored value and then perform validation on stored value itself (with keyword itself) as shown above.

Both element and stored value validations support:
  1. is equal as a number to/is not equal as a number to
  2. is greater than
  3. is greater or equal than
  4. is less than
  5. is less or equal than
You can also enjoy validations that apply to the whole screen/page:
  1. page contains/page doesn’t contain check that page contains "error message"
  2. page has regex/page doesn’t have regex
  3. page’s return code is
  4. title is
  5. title contains
  6. url is/url is not
  7. url contains/url doesn’t contain
  8. url starts with/url doesn’t start with
  9. url ends with/url doesn’t end with
  10. url matches regex/url doesn’t match regex
For example, you can combine stored values for validation:
check that url matches regex from the string with parameters "${homePrefix}/product/${type}/[0-9A-Za-z\-]+"

Test your knowledge

check that checkbox “Same-day Delivery” is empty
check that checkbox “Same-day Delivery” is not checked
check that checkbox “Same-day Delivery” is blank
check that checkbox “Same-day Delivery” has value “unchecked”
check that url is from the string with parameters “${homePrefix}/…”
check that url starts at from the string with parameters “${homePrefix}/…”
check that url matches regex from the string with parameters “${homePrefix}/…”
check that url starts with from the string with parameters “${homePrefix}/…”
check that page contains message “Sign up successful”
check that page contains “Sign up successful”
check that page contains message “Sign up successful” as expected
verify that page displays “Sign up successful”
[wpcode id=”1112380″ answers=”2;4;2″ page=”Validations” numoffields=”3″]