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

Already on GitHub? Sign in to your account

Test drive never starting because of failed connection to VMServiceFlutterDriver #272

Closed
bartekpacia opened this issue Sep 13, 2022 · 4 comments · Fixed by #280
Closed
Assignees
Labels
bug Something isn't working package: patrol_cli Related to the patrol_cli package platform: android Android is affected

Comments

@bartekpacia
Copy link
Contributor

See this workflow run. Out of 6 jobs, 3 succeeded, 1 failed, and 2 timed out. This issue is about getting rid of those timeouts.

It looks that sometimes Flutter Driver can't connect to the service running on the Dart VM, and waits indefinitely.

This how logs from the "corrupt" state look like:

Patrol automation server is running, starting test drive
VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:50087/DCSwv2oETPg=/
VMServiceFlutterDriver: Isolate found with number: 380803021374111
VMServiceFlutterDriver: Unknown pause event type Event. Assuming application is ready.
VMServiceFlutterDriver: Flutter Driver extension is taking a long time to become available. Ensure your test app (often "lib/main.dart") imports "package:flutter_driver/driver_extension.dart" and calls enableFlutterDriverExtension() as the first call in main().

And this is how logs look like when everything is OK:

Patrol automation server is running, starting test drive
VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:49741/_Om3Er0LaIw=/
VMServiceFlutterDriver: Isolate found with number: 628925095143275
VMServiceFlutterDriver: Isolate is paused at start.
VMServiceFlutterDriver: Attempting to resume isolate
Patrol: creating Patrol, host: localhost, port: 8081, verbose: true

The solution I'd try out is to check for logs containing, for example VMServiceFlutterDrive: VMServiceFlutterDriver: Unknown pause event type Event. Assuming application is ready. and if it occurs, try to connect once again. We could also go the other way around and wait for the connection for a few seconds and then try to reconnect.

@bartekpacia bartekpacia added bug Something isn't working package: patrol_cli Related to the patrol_cli package platform: android Android is affected labels Sep 13, 2022
@bartekpacia bartekpacia changed the title Fix tests never starting beacuse of failed connection to VMServiceFlutterDriver Fix test drive never starting beacuse of failed connection to VMServiceFlutterDriver Sep 13, 2022
@bartekpacia bartekpacia mentioned this issue Sep 13, 2022
6 tasks
@bartekpacia bartekpacia changed the title Fix test drive never starting beacuse of failed connection to VMServiceFlutterDriver Fix test drive never starting because of failed connection to VMServiceFlutterDriver Sep 13, 2022
@bartekpacia bartekpacia self-assigned this Sep 14, 2022
@bartekpacia
Copy link
Contributor Author

bartekpacia commented Sep 27, 2022

The possible solution I mentioned above doesn't work. If the driver can't connect for the first time, then it can't connect for the 2nd, 3rd, and n-th time as well. That's why I reverted the PRs (see above).

Another approach that we could try: look into replacing the default integration driver (in test_driver/integration_test.dart):

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

with something ours that would have retry semantics.

See also:

@bartekpacia bartekpacia changed the title Fix test drive never starting because of failed connection to VMServiceFlutterDriver Test drive never starting because of failed connection to VMServiceFlutterDriver Sep 30, 2022
@bartekpacia
Copy link
Contributor Author

bartekpacia commented Oct 8, 2022

@bartekpacia
Copy link
Contributor Author

We've freed ourselves from flutter_driver thanks to #646.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: patrol_cli Related to the patrol_cli package platform: android Android is affected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant