Content Pattern

The Content Pattern is part of every assertion command (commands starting with assert-*). It is the expression defining what exactly you want to check in your assertion test step. The Content Pattern always relates to the textual content of the current page (including alt texts of images).

Let us have a look at a typical application form and explain by example:

You can use a content pattern to proof that you are on the right page by identifying some page individual content, e.g. a headline:

Command Parameter Optional Parameter
assert-content What do you think about WETATOR

 

Or, if you like to check a whole page, your Content Pattern should contain the whole textual content of that page:

Command Parameter Optional Parameter
assert-content What do you think about WETATOR? WETATOR is amazing visionary marvelous WETATOR makes

 

And finally for checking to correct order of the checkboxes use this.

Command Parameter Optional Parameter
assert-content WETATOR is, amazing, visionary, marvelous

Wildcards

In general a Content Pattern might consist of 1..n patterns separated by ','. Every single pattern is the text you like to check for. Additonally you can use:

  • '*' means 0..n arbitrary characters and
  • '?' stands for exactly one character.
Sample
  • 'test' matches only the text 'test' (case sensitive)
  • 'te?t' matches e.g. 'test', 'text' but not 'tet'
  • 'te*t' matches e.g. 'test', 'text' and also 'tet'
Escaping
If your assertion contains a comma, star, or question mark, precede it with a backslash.
  • 'Smart\?' matches the text 'Smart?' but not 'Smart!'

In the sample above, if you like to check for the question mark also, use

Command Parameter Optional Parameter
assert-content What do you think about WETATOR\?

 

Pattern parts

If your pattern consists of many parts, WETATOR proofs that the parts are found in the given order inside the checked content.

Sample
Command Parameter Optional Parameter
assert-content WETATOR is, amazing, visionary, marvelous
assert-content WETATOR is, amazing, marvelous, visionary

In the sample above, the second assert will fail, because of it expects a different order of the checkbox labels.

Negate a pattern part

Sometimes you have to ensure, that something is NOT part of the content. The content pattern supports this kind of check also. But there is no way to use a negated pattern part alone; you always have to combine your negated part with at least one other part.
Background: If you are only check that something is not on a page, this check passes also, if you are at the wrong page.

Sample
Command Parameter Optional Parameter
assert-content WETATOR is, amazing, ~shiny, visionary

In this sample, wetator proofs, that there is no 'shiny' between 'amazing' and 'visionary'.