leancodepl / patrol

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

disableCellular() failed with Invalid response: 400 The operation #2179

Open creatorpiyush opened 5 months ago

creatorpiyush commented 5 months ago

Steps to reproduce

  1. Clone https://github.com/leancodepl/patrol.git
  2. Run iOS simulator(any)
  3. in patrol/dev/e2e_app run: patrol test --target=integration_test/service_cellular_test.dart --device="iPhone 15" --verbose

Actual results

disableCellular() and other services should work and not return 400

Logs

Logs ``` ((passed) is true) failed - ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════ The following PatrolActionException was thrown running a test: Patrol action failed: NativeAutomatorClientException: disableCellular() failed with Invalid response: 400 The operation couldn’t be completed. (patrol.PatrolError error 3.) When the exception was thrown, this was the stack: #0 NativeAutomator._wrapRequest (package:patrol/src/native/native_automator.dart:226:7) #1 main. (file:///Users/piyushanand/github_clones/patrol/dev/e2e_app/integration_test/service_cellular_test.dart:7:5) #2 patrolTest. (package:patrol/src/common.dart:134:7) #3 testWidgets.. (package:flutter_test/src/widget_tester.dart:168:15) #4 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1013:5) #5 TestWidgetsFlutterBinding._createTestCompletionHandler. (package:flutter_test/src/binding.dart:804:12) The test description was: disables and enables cellular twice ═════════════════════════════════════════════════════════════════ ```

Patrol version

patrol: path: ../../packages/patrol (Master) and also checked with patrol: 3.6.0

Patrol Doctor output

Patrol Doctor output ``` Patrol doctor: Patrol CLI version: 2.7.0 Flutter command: flutter Flutter 3.16.9 • channel [user-branch] Android: • Program adb found in /Users/piyushanand/Library/Android/sdk/platform-tools/adb • Env var $ANDROID_HOME set to /Users/piyushanand/Library/Android/sdk iOS / macOS: • Program xcodebuild found in /usr/bin/xcodebuild • Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller ```

Flutter Doctor output

Flutter Doctor output ``` Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel [user-branch], 3.16.9, on macOS 14.4.1 23E224 darwin-arm64, locale en-IN) ! Flutter version 3.16.9 on channel [user-branch] at /Users/piyushanand/development/FlutterSDK/flutter Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository unknown source is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error. [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] VS Code (version 1.87.2) [✓] Connected device (5 available) ! Error: Browsing on the local area network for Piyush’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [✓] Network resources ```
piotruela commented 5 months ago

I was able to reproduce the issue. As the device logs say: PatrolServer: ERROR: Control Center is not available on Simulator. So I'm afraid it's not possible to call this method for iOS Simulator. We should describe this limitation in NativeAutomator documentation.

bartekpacia commented 3 months ago

https://github.com/leancodepl/patrol/issues/396

not related but worth to keep in mind