Reputation: 330
What's the best way to test the following scenario?
Currently I use Appium but I can not find specific elements of B's screen because labels of button are not always available in inspector. In order to select button in tests i have to specify X and Y coordinates to push a click. I'm looking for a robust solution which will cover automated integration e2e test both for Android, iOS and flutter. Separate Flutter parts are tested in standalone mode using flutter integration test.
Upvotes: 3
Views: 1086
Reputation: 570
Just an additional info, I have developed a simple flutter app from new flutter project
and add accessibility id
to two widgets.
sample for widget that already have semanticsLabel
:
Text(
'$_counter',
semanticsLabel: 'counterText$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
sample for widget that does not have semanticsLabel
, so we need to wrap it with Semantics
widget:
floatingActionButton: Semantics(
label: 'incrementButton',
child: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
),
And then test it using Appium for both Android and iOS. Please refer to this link for the codes.
Upvotes: 0
Reputation: 330
It turns out that Flutter in most of cases build an app with accessibility id
visible in Appium. This accessibility id
is derived from Widget text and other UI elements. Unfortunately I couldn't find any accessibility id
for Icon widget. In order to to find such Widget in Appium you have to wrap it in flutter with Semantics
widget.
Semantics(
label: "EDIT_PROFILE",
child: Icon(
After it's done you can easily find any widget in Appium.Answering main question: Appium is a good solution to test such scenarios where Flutter is only a embedded screen in Android app. I hope that test will go smoothly on iOS as well.
Upvotes: 1