Maestro supports Flutter.
Commands such as tapOn
provide you with ways to select these widgets based on text or semantic labels.
Maestro can interact with widgets that have some displayed text (data
in the Text widget, hintText
in the TextField).
Given an InkWell
widget with a Text
widget child:
InkWell(
child: const Text('Open Browser'),
onTap: () => launch('')
)
The following command will tap on the InkWell widget:
- tapOn: "Open Browser"
For the following widget:
TextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'Enter your username'
)
)
The following command will tap on the TextFormField
:
- tapOn: "Enter your username"
Views can be decorated with a Semantics widget that will attach a semantic label that in turn can be used to locate a view
Semantics(
label: "My Label",
child: SomeView()
)
SomeView
can then be located using the label:
- tapOn: ".*My Label.*"
Some widgets can be interacted with via semanticLabel
property directly. For the following widget:
FloatingActionButton(
onPressed: _incrementCounter,
child: const Icon(Icons.add, semanticLabel: "fabAddIcon"),
)
The following command will tap on the FloatingActionButton
- tapOn: "fabAddIcon"
{% content-ref url="broken-reference" %} Broken link {% endcontent-ref %}
There are known limitations
- In cases where there are both
semanticLabel
and text label, thesemanticLabel
takes precedence. It's recommended to usemaestro studio
to identify accessibility labels. - Interaction on the basis of
key
is currently not possible. - Maestro cannot be used to test desktop or web apps (yet).