leancodepl / patrol

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

iOS webview running `getNativeViews(focused: true)` or `enterTextbyIndex` twice crashes #2262

Closed shovelmn closed 2 months ago

shovelmn commented 2 months ago

Steps to reproduce

  1. follow setup guide
  2. run test with enterTextbyIndex twice in a webview (auth0 login webview)

example test code:

        final views = await $.native.getNativeViews(Selector(
          focused: true,
        )); // fails here

        print(views.map((v) => v.className));

        await $.native.enterTextByIndex(
          'test@test.com',
          index: 0,
        );

        await $.native.enterTextByIndex(
          'Test123456',
          index: 1,
        ); // fails here, if I call this enter text first then the other enterTextByIndex fails

Actual results

flutter: Patrol (native): getNativeViews() failed
flutter: ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
flutter: The following ClientException was thrown running a test:
flutter: Connection closed before full header was received, uri=http://localhost:8081/getNativeViews
flutter: Patrol (native): enterTextByIndex() succeeded
flutter: Patrol (native): enterTextByIndex() started
flutter: Patrol (native): enterTextByIndex() failed
flutter: ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
flutter: The following PatrolActionException was thrown running a test:
flutter: Patrol action failed: NativeAutomatorClientException: enterTextByIndex() failed with Invalid
flutter: response: 400 The operation couldn’t be completed. (patrol.PatrolError error 0.)

Logs

Logs ``` Posted in Actual results ```

Patrol version

patrol: ^3.9.0

Patrol Doctor output

Patrol Doctor output ``` Patrol CLI version: 3.0.0 Flutter command: flutter Flutter 3.22.2 • channel stable Android: • Program adb found in /usr/local/bin/adb • Env var $ANDROID_HOME set to /Users/user/Library/Android/sdk iOS / macOS: • Program xcodebuild found in /usr/bin/xcodebuild • Program ideviceinstaller found in /usr/local/bin/ideviceinstaller ```

Flutter Doctor output

Flutter Doctor output ``` [✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-x64, locale en-NO) • Flutter version 3.22.2 on channel stable at /Users/user/fvm/versions/3.22.2 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (5 weeks ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc1) • Android SDK at /Users/user/Library/Android/sdk • Platform android-35, build-tools 35.0.0-rc1 • ANDROID_HOME = /Users/user/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15F31d • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2024.1) • Android Studio at /Applications/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.10+0-17.0.10b1087.21-11609105) [✓] VS Code (version 1.91.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.92.0 [✓] Connected device (2 available) • iPhone 15 Pro (mobile) • uuid • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.127 [✓] Network resources • All expected network resources are available. • No issues found! ```
jBorkowska commented 2 months ago

Closing, we'll continue investigation in Discord since it probably is not a bug. Link to our DC server: https://discord.gg/ukBK5t4EZg. Link to our conversation: https://discord.com/channels/1167030497612922931/1261246311005683752

github-actions[bot] commented 2 months ago

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.