Testing Android and iOS with a flutter embedded parts

Viewed 285

What's the best way to test the following scenario?

  1. Open native android app
  2. Go to screen B written in flutter - click on button "OK"
  3. Go to screen C which is a pure Android view again

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.

1 Answers

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.

Related