Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow user interaction (gestures/taps) when executing integration tests #103288

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fzyzcjy opened this issue May 8, 2022 · 4 comments
Open
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: gestures flutter/packages/flutter/gestures repository. f: integration_test The flutter/packages/integration_test plugin framework flutter/packages/flutter repository. See also f: labels. P3 Issues that are less important to the Flutter project team-framework Owned by Framework team triaged-framework Triaged by Framework team

Comments

@fzyzcjy
Copy link
Contributor

fzyzcjy commented May 8, 2022

Use case

Hi thanks for Flutter! Currently, when executing integration tests, "tapping the screen" will output something like "Some possible finders for the widgets at Offset(165.7, 462.0)". However, I would appreciate it if the app could be interactive. In other words, users could tap buttons of the app and play with it, etc. It would be very help for debugging the tests!

The reason and context is that, with https://github.com/fzyzcjy/flutter_convenient_test (a package I just open sourced), users can already conveniently re-run a test very quickly and see various results. However, currently the users still cannot interact with the app, except for doing a full hot-restart.

Proposal

I have done a bit of hacking (if you are interested, the messy code is at fzyzcjy/flutter_convenient_test#147). But seems no clue to solve it.

I am willing to make a PR!

@danagbemava-nc danagbemava-nc added in triage Presently being triaged by the triage team c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. f: gestures flutter/packages/flutter/gestures repository. c: proposal A detailed proposal for a change to Flutter f: integration_test The flutter/packages/integration_test plugin and removed in triage Presently being triaged by the triage team labels May 9, 2022
@dkwingsmt
Copy link
Contributor

I haven't read through your project but how do developers write a test with you app? If you can ask them to use a special tester binding (or if you already have), then you can extend the binding and override handlePointerEventForSource or handlePointerEvent so that events that would be branched into source device are forced into source test.

Related: https://github.com/flutter/flutter/pull/83337/files#diff-d34dbaacc51359fa05706c29bf6f9defc134c57d31b2d84313b1bbcc54bd2773R474

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented May 9, 2022

@dkwingsmt Hi!

how do developers write a test with you app?

There is a video and intro in README: https://github.com/fzyzcjy/flutter_convenient_test

If you can ask them to use a special tester binding (or if you already have)

Yes I can.

so that events that would be branched into source device are forced into source test.

I have tried similar things but failed. I will try your suggestions later. Thanks!

@goderbauer goderbauer added the P6 label May 12, 2022
@flutter-triage-bot flutter-triage-bot bot added P3 Issues that are less important to the Flutter project and removed P6 labels Jun 28, 2023
@Lonyless
Copy link

Lonyless commented Jul 5, 2023

@dkwingsmt Hi!

how do developers write a test with you app?

There is a video and intro in README: https://github.com/fzyzcjy/flutter_convenient_test

If you can ask them to use a special tester binding (or if you already have)

Yes I can.

so that events that would be branched into source device are forced into source test.

I have tried similar things but failed. I will try your suggestions later. Thanks!

did it work?

@flutter-triage-bot flutter-triage-bot bot added team-framework Owned by Framework team triaged-framework Triaged by Framework team labels Jul 8, 2023
@featherelle
Copy link

featherelle commented Nov 15, 2023

I got here from google, having the same issue.

I found that #108430 adds a method to enable user input during integration testing. In my code, after calling IntegrationTestWidgetsFlutterBinding.ensureInitialized() I can allow users to interact with the app like so:

// Enable user interaction
IntegrationTestWidgetsFlutterBinding.instance.shouldPropagateDevicePointerEvents = true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: gestures flutter/packages/flutter/gestures repository. f: integration_test The flutter/packages/integration_test plugin framework flutter/packages/flutter repository. See also f: labels. P3 Issues that are less important to the Flutter project team-framework Owned by Framework team triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests

6 participants