问题
How do I tap on the overflow menu in a Flutter test, doing so in a way that works for both Material apps and Cupertino apps? The icon differs between iOS and Android, so I can't just find the icon type.
From the PopupMenuButton docs:
If both [
childandicon] are null, then a standard overflow icon is created (depending on the platform).
This is analogous to pressing the platform-dependent icon for going back to the previous screen. The WidgetTester class includes the pageBack() method for this purpose, so I would have expected the class to also include a method for selecting the overflow menu, but I see no such method.
UPDATE: I've figured out the icon for Material Design apps. I don't know what it is for iOS yet, and if Flutter is going to select the icon for me, I'd rather delegate the selection to Flutter.
await tester.tap(find.byIcon(Icons.more_vert))
来源:https://stackoverflow.com/questions/58464657/tapping-the-overflow-menu-in-a-flutter-test