leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
901 stars 135 forks source link

Never accept the permissions. #1052

Open oscarshaitan opened 1 year ago

oscarshaitan commented 1 year ago

Describe the bug I just started integrating Patrol in my app because I require son permissions dialogues in some flows. I manage to set up the Native automation and run the test with the console but never accept a permission I tried await tester.native.grantPermissionWhenInUse(); and await tester.native.grantPermissionOnlyThisTime();

I have 2 scenarios: open a camera screen, in this case, the app is closed

https://user-images.githubusercontent.com/9093952/223726997-0a2976b8-1d44-4443-a099-d1a331af0912.mov

open gallery, in this case, the app remains.

https://user-images.githubusercontent.com/9093952/223726500-9938335c-c16d-4c2f-9a9c-578d2e8e801e.mov

on any of the cases accept the permissions and go to the next screen where I have some validations but in both the tests are marked as passed. Also tested on a real device and same behaviour

and also tried the https://patrol.leancode.co/tips-and-tricks#handling-permission-dialogs-before-the-main-app-widget-is-pumped

bartekpacia commented 1 year ago

Hi @oscarshaitan. This looks strange to me. Thanks for reporting.

Please:

Also, please follow the issue template next time :)

oscarshaitan commented 1 year ago

patrol: ^1.0.6 patrol_cli v1.0.9 at the moment of the new test log_file.txt

Screenshot 2023-03-10 at 11 57 59

The logcat only shows the server starting nothing more

bartekpacia commented 1 year ago

The logcat only shows the server starting nothing more

Then it looks like the problem – native automation requests from Dart tests cannot reach the server. Please post the whole logcat nevertheless.

oscarshaitan commented 1 year ago

btw spot that by using the nativeAutomation: true, the test don't even start correctly

bartekpacia commented 1 year ago

You must pass nativeAutomation: true if you want to use $.native.

the test don't even start correctly

Please run with --verbose and show the logs.

oscarshaitan commented 1 year ago

this are the logs running on the native test example test_log.txt

sometimes the test starts and closes in 1 sec and prints Starting 0 tests on tablet_API_33(AVD) - 13 some others run perfectly I dont know why

oscarshaitan commented 1 year ago

Starting 0 test related to this https://github.com/leancodepl/patrol/issues/947

bartekpacia commented 1 year ago

some others run perfectly I dont know why

What does that mean? Is it random? Which specific tests do not work?

oscarshaitan commented 1 year ago

sorry for the confusing text. right now, I spot that sometimes don't delete the app but that's for a different case.

when the test runs correctly never tap the dialogues. and the logs remain the same as the last one I sent. right now. I'm doing other tests that don't need native dialogs

bartekpacia commented 1 year ago

right now, I spot that sometimes don't delete the app but that's for a different case.

You need to pass your app's package name (on Android) and bundle ID (on iOS) if you want patrol_cli to uninstall your app after test. See docs.

oscarshaitan commented 1 year ago

thanks I will check that part but still remaining the taps on dialogues not working or even the map