Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to write UI tests that interact with native UI elements #36024

Open
felangel opened this issue Jul 11, 2019 · 12 comments
Open

Document how to write UI tests that interact with native UI elements #36024

felangel opened this issue Jul 11, 2019 · 12 comments
Labels
a: tests "flutter test", flutter_test, or one of our tests customer: crowd Affects or could affect many people, though not necessarily a specific customer. customer: vroom d: api docs Issues with https://api.flutter.dev/ p: maps Google Maps plugin P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@felangel
Copy link
Contributor

felangel commented Jul 11, 2019

Since markers aren't widgets, what is the recommended way to write a widget test which taps a map marker and ensures that the onTap is executed? I didn't see any marker onTap tests in the google maps plugin tests 馃檨

Thanks!

@kf6gpe kf6gpe added p: maps Google Maps plugin plugin labels Jan 6, 2020
@TahaTesser TahaTesser added a: tests "flutter test", flutter_test, or one of our tests documentation customer: crowd Affects or could affect many people, though not necessarily a specific customer. labels Mar 19, 2020
@hainguyen168
Copy link

Hi @felangel , it seems a long time no answer here. Did you have any solution for this yet? I'm in the same situation here. Thanks

@felangel
Copy link
Contributor Author

@hainguyen168 unfortunately, I don't think we ever came up with a solution :(

@stuartmorgan
Copy link
Contributor

This would need to be done via espresso/XCUITest. Leaving open to track adding such a test to the plugin, both for improved test coverage and to provide an example of this kind of test for apps using the plugin.

@stuartmorgan stuartmorgan added the P3 Issues that are less important to the Flutter project label May 6, 2021
@AngeloAvv
Copy link

Are there any updates about this?

@mzdm
Copy link
Contributor

mzdm commented Jul 7, 2022

I've tried tapping on the marker via tester.tapAt function and even if I hit the marker, onTap didn't seem to call. Does that mean that also tapAt triggers tap events only onto widgets? /cc @stuartmorgan

await tester.tapAt(Offset(mapCenter.dx, mapCenter.dy); // I hit the marker, but no reaction.

@stuartmorgan
Copy link
Contributor

Flutter test events are injected at the Flutter layer, so have no effect on native views.

@suesitran

This comment was marked as off-topic.

@bartekpacia
Copy link
Member

Patrol might help you with this. It can interact with platform views (i.e. not Flutter widgets).

@zilvis97
Copy link

Following this. Has anyone yet managed to get any kind of test that loads the map and able to interact with it, like clicking on a marker

@flutter-triage-bot flutter-triage-bot bot added the d: api docs Issues with https://api.flutter.dev/ label Jul 5, 2023
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
@Hixie Hixie removed the plugin label Jul 6, 2023
@flutter-triage-bot flutter-triage-bot bot added team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jul 8, 2023
@stuartmorgan stuartmorgan changed the title How to test Google Maps Marker onTap Document how to write UI tests that interact with native elements Sep 11, 2023
@stuartmorgan stuartmorgan changed the title Document how to write UI tests that interact with native elements Document how to write UI tests that interact with native UI elements Sep 11, 2023
@stuartmorgan
Copy link
Contributor

This would need to be done via espresso/XCUITest. Leaving open to track adding such a test to the plugin, both for improved test coverage and to provide an example of this kind of test for apps using the plugin.

For reference until there's actual documentation on this, some examples of hybrid UI tests in flutter/packages:

@bawantha

This comment was marked as off-topic.

@bartekpacia
Copy link
Member

Any update on this

You could try using Patrol to interact with non-native UI such as Google Maps markers and info windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests customer: crowd Affects or could affect many people, though not necessarily a specific customer. customer: vroom d: api docs Issues with https://api.flutter.dev/ p: maps Google Maps plugin P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

No branches or pull requests