ByTestId class

Finds element by 'data-test-id' attribute.

To use this annotation, add a 'data-test-id' HTML attribute to the element you wish to select. This assigns a test-only ID to the element so this annotation can target select that element.

For more detailed explaination and rationales, please see go/change-resilient-ui-testing-dd or https://kentcdodds.com/blog/making-your-ui-tests-resilient-to-change

Example:

<button data-test-id="cancel-button">
<button data-test-id="submit-button">

Then these button can be selected as follow:

@ByTestId("cancel-button")
MaterialButtonPO get cancelButton;

@ByTestId("submit-button")
MaterialButtonPO get submitButton;
Implemented types

Constructors

ByTestId(String _testId)
const

Properties

cssSelector String
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited