The most important steps we need in our tests are the validations.
We'll need validation to see if our app shows what we expect it to show.
Testim has a wide range of validation options, so you can choose the ones that suit best for your needs:

  • Element Visible - Make sure an element is visible to the user.
  • Element Not Visible - Make sure an element is not visible to the user.
  • Element Text - Make sure an element is visible and validate its content.
  • Element Pixel - Visual Validation. Make sure an element is visible, has the text, and the correct (visual) styling.
  • Viewport Pixel - Visual Validation on the entire viewport.
  • Document Pixel - Visual Validation on the document (scroll the page & stitch).
  • Custom (JavaScript) - Write anything that comes to your mind.

Let's go over the options. 

Element visible

Use element visible validation to check whether your element exists and is visible on the page. If your element contains a variable image or text, validation will still work.This validation verifies that the element exists and is visible and does not check its specific content. 

How to add

  • Hover over the arrow menu where you want to add your validation.
  • Click ‘+’ ⇒ ‘Validations’ ⇒ ‘Validate Element Visible’.
  • Select the element you want to validate from your app.

Note: If you get the message "No app to choose an element from" this means that you must first run the test so you can select a component from within your application.

How to change

If you want to change the element you selected, you don't have to re-record this step.

  • Click the 'Reassign' button under the element you choose in the properties panel.
  • Select a different element from your application.

Element Not visible

Use element not visible validation to check whether your element does not exists/visible in the page.  Use this validation to make sure an element disappeared from the screen or wasn't shown in the first place.   

How to add

Similar to adding "Validate Element Visible".

  • Hover over the arrow menu where you want to add your validation.
  • Click ‘+’ ⇒ ‘Validations’ ⇒ ‘Validate Element Not Visible’.
  • Select the element you want to validate from your app.

Note: If you get the message "No app to choose an element from" this means that you must first run the test so you can select a component from within your application.

Delay step
In some cases, you want to set a delay time before checking that the element is not visible. For example, you want to make sure that the element does not suddenly appear on the page.

  • Enter the properties of the 'Element not visible validation' step that you created.
  • Check 'Pre-step delay'. 
  • Set delay time in ms. 

How to change

Similar as you do in "Validate Element Visible", using the reassign button. 

Element Text

Use element text to make sure that a particular text appears in an element.

How to add

  • Hover over the arrow menu where you want to add your validation.
  • Click ‘+’ ⇒ ‘Validations’ ⇒ ‘Validate Element Text’.
  • Select the text you want to validate from your app.

Tip: You can use a keyboard shortcut to record text validation from your application during recording. Just use Alt +'v' and select the text you want to validate. 

How to change

If you want to change the validation text, you don't have to re-record this step.

  • Enter the properties of the 'Text validation' step that you created.
  • Change the text in the 'Expected Value' field

Note: Parameters, regular expressions, and Java Script expression can be used in the 'Expected Value' field. Read Advanced Text validation to learn how.

Multiple Text Validation

Let's see how multiple validations can be done in a simple way.

  1. Add 'Element Text Validation' as you did before. 
  2. Instead of choosing just one button to validate, use 'Ctrl' key, and start choosing all the texts you want to validate.
  3. Go back to Testim editor and see what happened. 

You can see a group was created with all your validations.
This group is a reusable group by default, and you can reuse it in other tests. 

Custom (JavaScript) validation

Custom validations are JavaScript validations. They allow you to validate everything you need and can not perform using the other options. You can use this validation for cases where you are required to validate texts against parameters or if you need to do calculations for the validation and so on.

You can read more about custom validation here.  More examples for use can be found here.

Pixel validations 

Use pixels validation when you want to validate to the pixel level.

  • Element Pixel- validate a specific element in your page.
  • Viewport Pixel - validate the current viewport of the page.
  • Document Pixel - validate the whole page.

Read more on basic pixel validation here and on more advanced pixel validation topics here.

Did this answer your question?