How-to
Id assert (toHaveId)
Id assert (toHaveId)
Expect assertion: the Target id attribute equals Value.
Step model
action_name | toHaveId |
| Group | Expect |
| Target | Required |
| Value | Required (dom_id) |
| expected_value | Unused |
| TEST_ACCOUNT | Allowed |
| Do not confuse with | toHaveAttribute |
Target/Value facts match the source-of-truth catalog and Autotest step.
Prerequisites
- The element has a stable id.
Steps
- Add a
toHaveIdstep. - Set Target.
- Enter the id in Value.
- Save.
The step is stored on the autotest. Next - neighbouring steps or autotest run creation.
Examples
Checkout form
Fields in the UI:
| Field | Value |
|---|---|
action_name | toHaveId |
| Target | kind ROLE, value form |
| Value | checkout |
| value_source_type | INLINE |
Step JSON fragment (copy-paste):
json
{
"action_name": "toHaveId",
"target": {
"kind": "ROLE",
"value": "form"
},
"value_text": "checkout",
"value_source_type": "INLINE"
}Common mistakes
- Do not use this assert to find the element. To find it, set a Target of kind
ID.toHaveIdchecks an element that is already located.
Screenshots
Screenshots of the step form for toHaveId will be added here in a later pass.
Did this page help?