You can now create "not present" assertions, which verify that an element is not present on a page. There are a number of ways you might wish to work with the "not present" assertion. These include verifying changed content, confirming pre-stable conditions, and inducing premature test failure.
Important information about creating an assertion
Suppose you want to confirm certain actions away from a location in your app. If the location you're leaving has distinctive content, you can create a "not present" assertion on that content before navigating elsewhere. Then, you can move the run cursor above the assertion, and perform your navigation.
If you have a test where you create an item and then delete it, you might want to assert that the item does not exist before the item's creation. Essentially, you want to assert that an item does not exist after you delete it, in order to verify pre-stable conditions.
To do this, you can train throughout the item creation, then create a "not present" assertion while the item is present, or twice if you want to confirm the pre-condition. If verifying the pre-condition, you can drag one of the assertions to a position before the create step. From here, position the run cursor, using the arrow keys or the jump to step feature, before the "not present" assertion and train the deletion step.
You might want to assert that performing a certain action does not produce a particular error message, or that performing an action does not produce an error message. If these actions do not hold, you can trigger the "not present" assertion, and quickly fail a test.
- Select the "add assertion" button in the bottom toolbar of the trainer.
- Click on the element on your webpage that you would like to confirm is not present.
- Examine the "Assertion type," which will be "is Present" by default.
- Click the dropdown menu and change the type to "is not present", examining the result.
- Click the "Save" button.
Updated 9 months ago