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

Calling $.native.selectCoarseLocation() fails on devices with Android <11 and iOS <14 #1217

Closed
1 task done
bartekpacia opened this issue Apr 23, 2023 · 4 comments · Fixed by #1564
Closed
1 task done
Labels
bug Something isn't working package: patrol Related to the patrol package (native automation, test bundling)

Comments

@bartekpacia
Copy link
Contributor

bartekpacia commented Apr 23, 2023

Is there an existing issue for this?

Steps to reproduce

Call $.native.selectFineLocation() or $.native.selectCoarseLocation() on iOS and Android devices (either physical or virtual) running Android <11 (API 30) or iOS <14.

Actual results

Calls to selectFineLocation()/selectCoarseLocation() fail on devices with Android 11 and older (API 30 and below).

This can be fixed easily:

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
    Logger.i("Ignored selectFineLocation() because it's only available on Android 10+")
    return
}

Logs

Logs
04-23 17:08:19.755 13716 13740 I flutter : Patrol (native): selectCoarseLocation() started
04-23 17:08:30.079 13716 13740 I flutter : Patrol (native): selectCoarseLocation() failed
04-23 17:08:30.244 13716 13740 I flutter : ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
04-23 17:08:30.244 13716 13740 I flutter : The following PatrolActionException was thrown running a test:
04-23 17:08:30.244 13716 13740 I flutter : Patrol action failed: GrpcError: selectCoarseLocation() failed with code NOT_FOUND (selector button
04-23 17:08:30.244 13716 13740 I flutter : to select coarse location found nothing)
04-23 17:08:30.244 13716 13740 I flutter :
04-23 17:08:30.244 13716 13740 I flutter : When the exception was thrown, this was the stack:
04-23 17:08:30.244 13716 13740 I flutter : #0      NativeAutomator._wrapRequest (package:patrol/src/native/native_automator.dart:200:7)
04-23 17:08:30.244 13716 13740 I flutter : <asynchronous suspension>
04-23 17:08:30.244 13716 13740 I flutter : #1      NativeAutomator.selectCoarseLocation (package:patrol/src/native/native_automator.dart:705:5)
04-23 17:08:30.244 13716 13740 I flutter : <asynchronous suspension>
04-23 17:08:30.244 13716 13740 I flutter : #2      main.<anonymous closure> (file:///Users/bartek/dev/leancode/patrol/packages/patrol/example/integration_test/permissions/permissions_location_test.dart:17:9)
04-23 17:08:30.244 13716 13740 I flutter : <asynchronous suspension>
04-23 17:08:30.244 13716 13740 I flutter : #3      patrolTest.<anonymous closure> (package:patrol/src/common.dart:114:7)
04-23 17:08:30.244 13716 13740 I flutter : <asynchronous suspension>
04-23 17:08:30.244 13716 13740 I flutter : #4      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:171:15)
04-23 17:08:30.245 13716 13740 I flutter : <asynchronous suspension>
04-23 17:08:30.245 13716 13740 I flutter : #5      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:935:5)
04-23 17:08:30.245 13716 13740 I flutter : <asynchronous suspension>
04-23 17:08:30.245 13716 13740 I flutter :
04-23 17:08:30.245 13716 13740 I flutter : The test description was:
04-23 17:08:30.245 13716 13740 I flutter :   accepts location permission
04-23 17:08:30.245 13716 13740 I flutter : ════════════════════════════════════════════════════════════════════════════════════════════════════
04-23 17:08:30.246 13716 13740 I flutter : 00:13 +1: permissions permissions_location_test.dart accepts location permission [E]
04-23 17:08:30.246 13716 13740 I flutter :   Test failed. See exception logs above.
04-23 17:08:30.246 13716 13740 I flutter :   The test description was: accepts location permission
04-23 17:08:30.246 13716 13740 I flutter :

Patrol version

patrol: ^1.1.0

Patrol Doctor output

Patrol Doctor output
Patrol CLI version: 1.1.7
Program adb found in /Users/bartek/androidsdk/platform-tools/adb
Env var $ANDROID_HOME set to /Users/bartek/androidsdk
Program xcodebuild found in /usr/bin/xcodebuild
Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller
Program ios-deploy found in /opt/homebrew/bin/ios-deploy

Flutter Doctor output

Flutter Doctor output
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E261 darwin-arm64, locale en-PL)
    • Flutter version 3.7.12 on channel stable at /Users/bartek/fvm/versions/3.7.12
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (6 days ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/bartek/androidsdk
    • Platform android-33, build-tools 33.0.1
    • ANDROID_HOME = /Users/bartek/androidsdk
    • Java binary at: /Users/bartek/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/bartek/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
    • IntelliJ at /Users/bartek/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.0.4
    • Dart plugin version 231.8109.91

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
    • IntelliJ at /Users/bartek/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8109.175/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0
@bartekpacia bartekpacia changed the title Calling $.native.selectCoarseLocation() fails on devices with Android 11 and lower Calling $.native.selectCoarseLocation() fails on devices with Android <11 and iOS <14 Apr 23, 2023
@bartekpacia bartekpacia added package: patrol Related to the patrol package (native automation, test bundling) a: native automation bug Something isn't working labels Apr 23, 2023
@bartekpacia
Copy link
Contributor Author

bartekpacia commented Jun 30, 2023

Fixed on Android by #1444.

@bartekpacia
Copy link
Contributor Author

Oops, forgot about iOS.

@bartekpacia bartekpacia reopened this Jun 30, 2023
@bartekpacia
Copy link
Contributor Author

bartekpacia commented Jul 20, 2023

Cannot run tests on iOS 13 (the only version of iOS where this problem occurs) because of #1441.

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 Related to the patrol package (native automation, test bundling)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant