How-to
Text contains assert (toContainText)
Text contains assert (toContainText)
Expect assertion: the Target text contains Value. This is not an exact match of the whole text.
Step model
action_name | toContainText |
| Group | Expect |
| Target | Required |
| Value | Required (text) |
| expected_value | Unused |
| TEST_ACCOUNT | Allowed |
| Do not confuse with | toHaveText |
Target/Value facts match the source-of-truth catalog and Autotest step.
Prerequisites
- The element with text exists.
Steps
- Add a
toContainTextstep. - Set Target.
- Enter the substring in Value.
- Save.
The step is stored on the autotest. Next - neighbouring steps or autotest run creation.
Examples
Status contains Submitted
Fields in the UI:
| Field | Value |
|---|---|
action_name | toContainText |
| Target | kind TESTID, value status |
| Value | Submitted |
| value_source_type | INLINE |
Step JSON fragment (copy-paste):
json
{
"action_name": "toContainText",
"target": {
"kind": "TESTID",
"value": "status"
},
"value_text": "Submitted",
"value_source_type": "INLINE"
}Common mistakes
- Use
toHaveTextwhen the whole text must match.
Screenshots
Screenshots of the step form for toContainText will be added here in a later pass.
Did this page help?