Assert Content

Asserts that the current page contains the expected content.

Parameters

content
The text to match (see Content Pattern for a detailed description).
It is possible to use the '*' and the '?' character as wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a comma separated list of words (with '*' and '?' if needed). Then this command checks, that the words in the defined order are parts of the content.
At the moment content of type text, html/xhtml, pdf, rtf, xls, xlsx and docx are supported.
wait
The (optional) timeout in seconds used for waiting for javascript events. This is helpful for pages working with setTimeout javascript command or doing some AJAX polling for e.g. search results.

Examples

Check for a single word on a page

Check for a single word on a page.

Command Parameter Optional Parameter
open-url commands/openurl.html
assert-content Gurkensalat

Check for a single word using wildcards on a page

Check for a single word using wildcards on a page.

Command Parameter Optional Parameter
open-url commands/openurl.html
assert-content Gu{{% wildcard-star %}}sa{{% wildcard-questionmark %}}at

Check for words in the right order on a page

Check for words in the right order on a page.

Command Parameter Optional Parameter
open-url commands/openurl.html
assert-content Pferde, keinen, Gu{{% wildcard-star %}}sa{{% wildcard-questionmark %}}at

Content checking for common file formats (PDF, RTF, xls, xlsx and docx)

The 'assert-content' command works with HTML pages and also supports common file formats. If your application offers the ability to download e.g. PDF files, you can simply write tests for the correct content also. To make this happen the file has to sent out by the server with the correct (supported) content type.
At the moment the following content types are supported:

Type Content-Type Heder
PDF application/pdf
MS Excel (xls, xlsx) application/vnd.ms-excel,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
MS Word (docx) application/vnd.openxmlformats-officedocument.wordprocessingml.document
RTF application/rtf,
text/rtf,
text/richtext,
text/enriched

Check the content of an PDF file.

TODO

Command Parameter Optional Parameter
assert-content TODO