How to interact with native UI elements from flutter integration_test?
Long story short, it is likely not currently possible.
These two GitHub issues are pretty much our concern:
- Add support to test native permission dialog (#87440)
- Allow driving native UI interactions from Dart (#86295)
But, so far, every comment about the matter has been a remark about how difficult it is. The only "solution" from the Android side is to use Android ADB—but, at that point, it isn't even an integration_test
anymore.
Admin
Updated on December 22, 2022Comments
-
Admin over 1 year
I am trying to do an automated testing of the user flow in a flutter app. For this I am using flutter integration test package (https://flutter.dev/docs/testing/integration-tests). I have written tests using integration_test package. Though these tests run on a physical device, there are situation where I have to interact with native UI elements (for example, clicking on a permission button to give permission to camera etc.) However, I am not able to interact with the native UI elements specifically :
1.Tapping Allow on System permission dialog
2.Tapping on Capture button when camera is opened
3.Selecting an image from galleryI would like to understand how the above situations can be achieved through a script and hence automated. Also, can frameworks like appium-flutter-driver or flutter-driver be used in conjunction with flutter_integration to achieve this. Any pointers would be helpful.