Then I should see text matching "text pattern"

This step definition is used to test whether the current page contains text that matches the specified pattern.

 

Then (I|we)* should see text matching "([^"]*)?"

 

There are many types of text that are searched such as email, phone number, link address path, time and date, uppercase or lowercase words, words with certain letters, and . . . etc.

 

Example:

Then I should see text matching "^T\w+"

"^T\w+" It is a pattern that searches for any text beginning with the capital letter "T".

 

Example:

Then we should see text matching "[a-z0-9]+@[a-z]+\.[a-z]{2,3}"

"[a-z0-9]+@[a-z]+\.[a-z]{2,3}" It is a pattern that searches for an email.