Some tests might require examination of the contents of the screen as a whole, rather than one specific element in a predictable location. You can use page assertions to check data without having to identify the specific element where it’s expected to appear.
Page assertions are managed in the same dialog as element assertions. To begin adding an page assertion:
Navigate to Test Results
Select an existing test
Click a screen in the test
Click “Assertions” in the upper right.
The types of page assertions are listed in the dropdown.
Mesmer allows you to provide a limited XPath expression to check for the existence of elements on screen. The assertion types are:
XPath Does Not Exist
Currently, only one type of expression is supported, which matches the exact text of an element. For example, to check if an element exists on the screen with the exact text "Foo", the XPath string will be:
If you know the ID of an element that should or should not exist on screen, you can use an element ID assertion to check that case with the following page assertion types:
Element ID Exists
Element ID Does Not Exist
The IDs that you provide to Mesmer are related to the IDs that you use in your app to identify specific views in its view hierarchy. For now, you will have to go through your Mesmer contact to obtain the exact strings to use for your assertion.
If you’ve already defined a dynamic variable with an element assertion, you can use that variable as a page assertion that checks for the contents of that variable anywhere on a screen. Dynamic variable assertions are created using the following page assertion types:
Dynamic Variable Exists
Dynamic Variable Does Not Exist
To use a dynamic variable page assertion, you must first add an dynamic variable element assertion on a screen. Note that dynamic variable element assertions are different from dynamic variable page assertions. Be sure to read the prior documentation on element assertions to understand how they work.
After a dynamic variable is created for a test case, you will have the option to use it in a dynamic variable page assertion. The screen for the page assertion must come after the screen where the variable was defined. To create the page assertion, choose the desired assertion from the dropdown, then choose the variable. When the test is next executed and the screen encountered, Mesmer will check if the contents of that variable are (or are not) anywhere on the screen.
If you want to make the test wait for some amount of time on the current screen, use a wait assertion, and specify the amount of time (in seconds) that Mesmer should wait before continuing to the next screen. This is useful if the page is going to take an automatic action, such as playing a video, and you want to wait for that to complete.