leancodepl/patrol

During a test, the app crashes on a physical iOS device

Closed this issue · 25 comments

Dbis7 commented

Steps to reproduce

  1. connect real device to Mac
  2. patrol test -t PATH --release --flavor=FLAVOR --dart-define=APP_ENV=ENV
  3. error

iOS 17.5

Actual results

We are trying to run a login test on a physical iOS device, however, the test stops during interaction with a textField in a webview while the interaction with the location permissions popup works correctly. The error only occurs on the physical device while everything works fine on the simulator and android.

I have redacted the sensitive information that I cannot share

Logs

Logs
<!--  2024-06-14 15:23:22.090458+0200 RunnerUITests-Runner[490:8430] Task <F780207F-6F9C-479E-94EA-B439B75CDF3F>.<1> HTTP load failed, 385/0 bytes (error code: -1005 [4:-4])
        2024-06-14 15:23:22.093597+0200 RunnerUITests-Runner[490:8428] Task <F780207F-6F9C-479E-94EA-B439B75CDF3F>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x301e0e6d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x303245ef0 [0x1f7fdfc70]>{length = 16, capacity = 16, bytes = 0x10021f927f0000010000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F780207F-6F9C-479E-94EA-B439B75CDF3F>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
            "LocalDataTask <F780207F-6F9C-479E-94EA-B439B75CDF3F>.<1>"
        ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=
http://localhost:8082/runDartTest
, NSErrorFailingURLKey=
http://localhost:8082/runDartTest
, _kCFStreamErrorDomainKey=4}
        2024-06-14 15:23:22.094476+0200 RunnerUITests-Runner[490:8428] runDartTestWithName(access.1_1_Login 1_1_Login_): failed, err: Invalid response: nil nil
            t =    39.15s         Find the "Password" SecureTextField (retry 1)
            t =    39.15s         Collecting extra data to assist test failure triage
        /Users/USER/FOLDER/PROJECT/ios/RunnerUITests/RunnerUITests.m:6: error: -[RunnerUITests access_11Login___1_1_Login] : Failed to get matching snapshot: Lost connection to the application (pid 503). (Underlying Error: Couldn’t communicate with a helper application. Try your operation again. If that fails, quit and relaunch the application and try again. connection to service with pid 503 created from an endpoint)
        2024-06-14 15:23:23.189393+0200 RunnerUITests-Runner[490:8246] PatrolServer: INFO: done entering text "ta.owner@yopmail.com
        " by index 0 in app com.my.app.test -->

Patrol version

^3.0.1

Patrol Doctor output

Patrol Doctor output
<!--PATROL DOCTOR
Patrol doctor:
Patrol CLI version: 2.7.0
Flutter command: flutter 
  Flutter 3.19.5 • channel stable
Android: 
• Program adb found in /Users/testfactory/Library/Android/sdk/platform-tools/adb
• Env var $ANDROID_HOME set to /Users/testfactory/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 DOCTOR
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.1 23B74 darwin-x64, locale it-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] IntelliJ IDEA Community Edition (version 2021.3.2)
[✓] VS Code (version 1.89.0)
[✓] Connected device (4 available)
[✓] Network resources -->

Hi @Dbis7 , thank you for reporting this issue.

From logs that you shared, it looks like the http connection is lost, though there are no other traces, so it's hard to guess what's wrong.
I faced a similar problem, but it was caused by the app, that was sending way too many requests at some point, which led to saturation of internet connection.
If you are sure that is an issue with patrol, please send us a minimal reproducible example with this bug.

Dbis7 commented

Hi, I tried adding a delay in the test and manually entering the credentials in the app, and the problem does not occur. Additionally, with the tap() method, the app continues to function and the textField is clicked correctly, but if I try to enter the text, it crashes.

I have another question - can you show the code responsible for interacting with that textfield? We noticed some issues when trying to enterText() on an already focused textfield, but it was some time ago and it was gone in next patrol update

Dbis7 commented

Thank you, I will try updating Patrol to a more recent version.

this is the code:
await loginPage.login(Constants.email, Constants.password);

class LoginPage {
final UtilityManager utils;

LoginPage(this.utils);

Future login(String email, String password) async {
await utils.waitForDefaultTime();
await utils.enterTextInNativeFieldByIndex(email, Mapping.emailFieldIndex);
await utils.enterTextInNativeFieldByIndex(password, Mapping.passwordFieldIndex);
}
}

I have also tried all the other enterText() methods

Ok but I need to know what utils.enterTextInNativeFieldByIndex is doing :)

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.
Feel free to open a new issue with all the required information provided, including a [minimal, reproducible sample]. Make sure to diligently fill out the issue template.
Thanks for your contribution.
[minimal, reproducible sample]: https://stackoverflow.com/help/minimal-reproducible-example