Flutter

Maestro supports Flutter.
Commands such as tapOn
provide you with ways to select these widgets based on text or semantic labels.
Interacting with Widgets by Text
Maestro can interact with widgets that have some displayed text (data
in the Text widget, hintText
in the TextField).
Example: Tap on a InkWell widget
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"
Example: Tap on TextFormField
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"
Interacting with Widgets by semantic label
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.*"
semanticLabel property
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"
Known Limitations
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).
Last updated
Was this helpful?