Function When_I_find_elements_by_testid

  • When I find elements by test ID:

    When I find elements by test ID {string}
    

    Finds all elements that matches the data-testid or data-test-id attribute:

    <div data-testid="test"></div>
    <div data-test-id="test"></div>

    Use this only if the other queries don't work. data-testid or data-test-id don't resemble how your software is used and should be avoided if possible.

    Parameters

    • testId: string
    • Optionaloptions: DataTable

    Returns void

    When I find elements by test ID "testID"
    

    With options:

    When I find elements by test ID "testID"
    | log | true |
    | timeout | 4000 |
    | withinSubject | null |
    | includeShadowDom | false |

    This precedes steps like "When I click". For example:

    When I find elements by test ID "testID"
    And I get 1st element
    And I click

    Inspired by Testing Library's ByTestId.