Closed bartekpacia closed 1 year ago
photo_test.dart
and video_test.dart
pass. ui_test.dart
crashes with a mysterious "Instrumentation crashed" when run with patrol test
, but works when run with patrol develop
.
I run adb logcat
while ui_test.dart
crashed and these logs look interesting:
What's worse is that you don't get test results of the failure, but only a cryptic "Instrumentation process crashed" instead. That's because
Thanks a lot @bartekpacia 👍 Your help is greatly appreciated 🥇
Since you mentioned that there was a problem with ui_test, I tried an other one.
The tests didn't run after running the following command: patrol test --target integration_test/photo_test.dart --verbose
After looking at the logcat, I've noticed this:
Note that the error only appeared in the logcat (no error from the CLI which makes it seem to hang forever)
The develop
command gave a similar result but the CLI (with --verbose) mentionned this:
V/FlutterTestRunner(12075): launchActivity failed, possibly because the activity was already running. java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.example.camera_app/.MainActivity } within 45000 milliseconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1679906315630 and now the last time the queue went idle was: 1679906315630. If these numbers are the same your activity might be hogging the event queue.
V/FlutterTestRunner(12075): Try disabling auto-launch of the activity, e.g. ActivityTestRule<>(MainActivity.class, true, false);
I found similar logs in the logcat:
@bartekpacia Any idea on how we could fix this?
After looking at the logcat, I've noticed this:
I'm pretty sure that the killing of all these threads (visible in your logcat) is the aftermath of a crash that occurred a bit earlier. If you scrolled the logcat up, you'd see this.
Unfortunately, I've no idea what could be causing this – I've seen many different crashes with Patrol but nothing like this.
I applied your changes on another branch and commented my own tests. Then I made one very simple to see if this simple config works first and seems to be ok.
In the end, my tests are probably the problem 😅 I'll fix them then I'll have to figure out if the tests run well on my physical device as well, but I am not stuck anymore :)
Thanks for the help! 💪
Hm, strange. But I'm glad to hear that it at least started to work on another branch.
Thanks for the help!
Yeah, happy to help and thanks for the awesome plugin :) Unfortunately, my time is limited so I can't help you as much as I want, but feel free to ask me in case of any more problems/questions - maybe I'll be of more help.
I made an other PR (#307) which fixes some of the tests that didn't pass and include your changes. I'm closing this PR since the changes are also there.
There are still some behaviours a bit weird on my device: once the apps for testing are installed, I need to launch manually my app to be able to run the tests on it. It may be related to this specific device. On emulator it works fine, and same for Firebase Test Lab!
Thanks again for the help 🙏
Description
This PR fixes #267
Checklist
Before creating any Pull Request, confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).flutter analyze
without any issues.Breaking Change