Add Text Assertions
The AI Recorder includes assertion commands that help you verify text in your application. Two types of assertions are available:
- Verify text is found on the page
- Verify a text in relation to other text
Adding a "Verify Text Is Found in the Page" Step
The Verify text is found in the page assertion checks that the selected text is displayed on the screen.
Example use cases:
- Verify a welcome message is displayed after login.
- Verify you are on a specific page. Example: "Shipping Details"
- Verify a maintenance notification is displayed at the top of the page.
- Verify a confirmation message is shown after placing an order.
To add a Verify text is found on the page step:
Navigate to the relevant page where you want to add the verification step during Recording.
In Recording mode, click the plus icon at the top right. The Manual Steps box opens.
Select Add a verification step, then choose Verify text is found in the page. A text selection box will appear.
Click the required text in the browser to automatically register it
in
the selection box.Click Save to add the verification step.
Adding a "Verify Text in Relation to Other" Step
The Verify a text in relation to other text step checks for a specific text in relation to another piece of text.
Example use cases:
- On the products page, verify that product X has a Price of $30
- On the booking confirmation page, verify that Flight 123 is departing from JFK at 10:00 AM.
- On the hotel listing page, verify that Hotel A has a rating of 4.5 stars
- On the event page, verify that Event X is scheduled for September 19th, 2024
To add a Verify a text in relation to other text step:
Navigate to the relevant page where you want to add the verification step during Recording.
In Recording mode, click the plus icon at the top right. The Manual Steps box opens.
Select Add a verification step, then choose Verify a text in relation to other text. A text selection box will appear.
Select the reference text and then the text to verify in the browser. Both texts will populate in the selection box.
Click Save to add the verification step.
TIP
Playback recorded steps using Run Scenario to verify them before publishing the recording.
Parameterize the Verification Step Text
By default, text assertion steps use a static string. You can replace this string with an existing or new parameter to make your tests more dynamic.
To parameterize the verification text:
Expand the Recorder to view existing parameters.
Add a new parameter and assign a value (or skip this if using an existing parameter).
Click the string in the verification step to reveal the text input field.
Clear the input, select the new parameter, and click the checkbox to save the changes.
NOTE
Don't forget to Publish your scenario after finalizing all your steps.
TIP
Playback recorded steps using Run Scenario to verify them before publishing the recording.