How can we help?

Available validations and expectations

You are here:

A test that doesn’t check things isn’t much of a test, and so Trudon provides many complex and quick validations to check that things are as they should be.

Expectations allow you to confirm that a specific condition is met on the page. They are not required, but they are highly recommended. Using at least one expectation at the end of your test is generally a good idea because it helps to confirm that things have turned out as expected.

Expectations don’t check the condition only once. It will continue checking the condition for the time specified when starting to run the test (5 seconds default), so you don’t have to worry about slow pages, AJAX requests, or javascript code.

Generic expectations

These expectations can be applied to any element of your application.

  • Expect element visible: This will pass if the specified element is visible on the page, meaning that the element (and its parents) do not have their display style attribute set to none or their visibility style attribute set to hidden. It also checks that the element is entirely visible in the viewport. The element is identified using a CSS selector.
  • Expect element text: This will pass if the specified element matches the desired value. The element is identified using a CSS selector. The value comparison can be any of the following: equals, does not equal, greater than, less than, contains, does not contain, starts with, does not start with, ends with, does not end with, or matches regex. It also checks if the element is visible on the screen.
  • Expect element style: This will pass if the specified element has the desired type (color, background color, background image, opacity) with the desired value. It also checks if the element is visible on the screen.

Form related expectations

  • Expect input value: Checks if a given input has the desired value. The input is identified using a CSS selector. It also checks if the input is visible on the screen.
  • Expect input type: Checks if a given input has the desired type (ex: text, password, …). The input is identified using a CSS selector. It also checks if the input is visible on the screen.
  • Expect textarea value: Checks if a given textarea has the desired value. The textarea is identified using a CSS selector. It also checks if the textarea is visible on the screen.
  • Expect select value: Checks if a given select has the desired value. The select is identified using a CSS selector. It also checks if the select is visible on the screen.

Other expectations

  • Expect image visible: Used to check if a given image has the appropriate image URL and is visible on the screen (the element and its parents do not have their display style attribute set to none or their visibility style attribute set to hidden). This validation requires a CSS selector to identify the element and a URL to check against.
  • Expect page URL: Used to check if the current page URL matches the desired value. The comparison can be any of the following: equals, does not equal, greater than, less than, contains, does not contain, starts with, does not start with, ends with, does not end with, or matches regex.
  • Expect cookie: Used to check if the specified cookie has the desired value. The value comparison can be any of the following: equals, does not equal, greater than, less than, contains, does not contain, starts with, does not start with, ends with, does not end with, or matches regex.
  • Expect local storage: Used to check if the specified key has the desired value. The value comparison can be any of the following: equals, does not equal, greater than, less than, contains, does not contain, starts with, does not start with, ends with, does not end with, or matches regex.
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Need help?