leancodepl/patrol

Not able to run tests on iPhone physical device

Closed this issue · 4 comments

Steps to reproduce

  1. Clone: https://github.com/manojkumar-bandlamudi/mission_patrol_2103.git
  2. Make sure the app builds fine
  3. Try running tests on a iPhone physical device

Actual results

I am getting error: No profiles for 'com.example.manojMissionPatrol2103.RunnerUITests.xctrunner' were found.
Screenshot 2024-03-22 at 12 19 58 PM

I have tried making the identifier unique on xcode and enabled auto signing. It looks fine in xcode as shown in the screenshots. I am not sure what I am missing

Screenshot 2024-03-22 at 12 16 41 PM
Screenshot 2024-03-22 at 12 17 03 PM

I have done the whole patrol setup so many times in the past two weeks, everytime it works fine on simulators and android device. But the problem is with the iOS physical device.

Can someone please help me to figure out what's happening here..?

Logs

Logs
manoj01b@AUMAC18155 mission_patrol_2103 % patrol test -t integration_test/example_test.dart --release --verbose
Verbose mode enabled. More logs will be printed.
$ flutter --suppress-analytics --no-version-check pub deps --style=list
Received 1 test target(s)
Received test target: /Users/manoj01b/Documents/repos/GitHub/mission_patrol_2103/integration_test/example_test.dart
Generated entrypoint /Users/manoj01b/Documents/repos/GitHub/mission_patrol_2103/integration_test/test_bundle.dart with 1 bundled test(s)
$ flutter --no-version-check --suppress-analytics devices --machine
No device specified, using the first one (Youi iPhone 14)
Received 1 device(s) to run on
Received device: Youi iPhone 14
Received 9 --dart-define(s) (0 custom, 9 internal)
Received internal --dart-define: PATROL_WAIT=0
Received internal --dart-define: PATROL_APP_PACKAGE_NAME=com.example.mission_patrol_2103
Received internal --dart-define: PATROL_APP_BUNDLE_ID=com.example.manojMissionPatrol2103
Received internal --dart-define: PATROL_ANDROID_APP_NAME=MissionPatrol2103
Received internal --dart-define: PATROL_IOS_APP_NAME=MissionPatrol2103
Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false
Received internal --dart-define: PATROL_TEST_LABEL_ENABLED=true
Received internal --dart-define: PATROL_TEST_SERVER_PORT=8081
Received internal --dart-define: PATROL_APP_SERVER_PORT=8082
• Building app with entrypoint test_bundle.dart for iOS device (release)...
$ flutter build ios --no-version-check --suppress-analytics --config-only --no-codesign --release --target /Users/manoj01b/Documents/repos/GitHub/mission_patrol_2103/integration_test/test_bundle.dart --dart-define PATROL_WAIT=0 --dart-define PATROL_APP_PACKAGE_NAME=com.example.mission_patrol_2103 --dart-define PATROL_APP_BUNDLE_ID=com.example.manojMissionPatrol2103 --dart-define PATROL_ANDROID_APP_NAME=MissionPatrol2103 --dart-define PATROL_IOS_APP_NAME=MissionPatrol2103 --dart-define INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false --dart-define PATROL_TEST_LABEL_ENABLED=true --dart-define PATROL_TEST_SERVER_PORT=8081 --dart-define PATROL_APP_SERVER_PORT=8082
        Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
        Building com.example.manojMissionPatrol210324 for device (ios-release)...
        Running pod install...                                           1,506ms
$ xcodebuild build-for-testing -workspace Runner.xcworkspace -scheme Runner -configuration Release -sdk iphoneos -destination generic/platform=iOS -quiet -derivedDataPath ../build/ios_integ OTHER_SWIFT_FLAGS=$(inherited) -D PATROL_ENABLED
        /Users/manoj01b/Documents/repos/GitHub/mission_patrol_2103/ios/Runner.xcodeproj: error: No profiles for 'com.example.manojMissionPatrol210324.RunnerUITests.xctrunner' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.example.manojMissionPatrol210324.RunnerUITests.xctrunner'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'RunnerUITests' from project 'Runner')
        warning: Run script build phase 'xcode_backend build' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RunnerUITests' from project 'Runner')
        warning: Run script build phase 'xcode_backend embed_and_thin' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RunnerUITests' from project 'Runner')
        /Users/manoj01b/Documents/repos/GitHub/mission_patrol_2103/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'CocoaAsyncSocket' from project 'Pods')
        note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
        note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
        2024-03-22 12:18:18.395 xcodebuild[24580:2457025] Writing error result bundle to /var/folders/k8/46dqrqzd7yqfps8b7wzbvrzh0000gn/T/ResultBundle_2024-22-03_12-18-0018.xcresult
        xcodebuild: error: Failed writing xctestrun file: The folder “Runner_iphoneos17.2-arm64.xctestrun” doesn’t exist..
✗ Failed to build app with entrypoint test_bundle.dart for iOS device (xcodebuild exited with code 70) (13.2s)
Error: xcodebuild exited with code 70
#0      throwToolExit (package:patrol_cli/src/base/exceptions.dart:7:3)
#1      IOSTestBackend.build.<anonymous closure> (package:patrol_cli/src/ios/ios_test_backend.dart:136:9)
<asynchronous suspension>
#2      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)
<asynchronous suspension>
#3      IOSTestBackend.build (package:patrol_cli/src/ios/ios_test_backend.dart:76:5)
<asynchronous suspension>
#4      TestCommand._build (package:patrol_cli/src/commands/test.dart:268:7)
<asynchronous suspension>
#5      TestCommand.run (package:patrol_cli/src/commands/test.dart:202:5)
<asynchronous suspension>
#6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#7      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:341:18)
<asynchronous suspension>
#8      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:285:18)
<asynchronous suspension>
#9      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20)
<asynchronous suspension>
#10     main (file:///Users/manoj01b/.pub-cache/hosted/pub.dev/patrol_cli-2.6.5/bin/main.dart:6:20)
<asynchronous suspension>

See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.
Error: xcodebuild exited with code 70
#0      throwToolExit (package:patrol_cli/src/base/exceptions.dart:7:3)
#1      IOSTestBackend.build.<anonymous closure> (package:patrol_cli/src/ios/ios_test_backend.dart:136:9)
<asynchronous suspension>
#2      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)
<asynchronous suspension>
#3      IOSTestBackend.build (package:patrol_cli/src/ios/ios_test_backend.dart:76:5)
<asynchronous suspension>
#4      TestCommand._build (package:patrol_cli/src/commands/test.dart:268:7)
<asynchronous suspension>
#5      TestCommand.run (package:patrol_cli/src/commands/test.dart:202:5)
<asynchronous suspension>
#6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#7      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:341:18)
<asynchronous suspension>
#8      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:285:18)
<asynchronous suspension>
#9      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20)
<asynchronous suspension>
#10     main (file:///Users/manoj01b/.pub-cache/hosted/pub.dev/patrol_cli-2.6.5/bin/main.dart:6:20)
<asynchronous suspension>

Patrol version

patrol_cli v2.6.5

Patrol Doctor output

Patrol Doctor output
Patrol doctor:
Patrol CLI version: 2.6.5
Android: 
• Program adb found in /Users/manoj01b/Library/Android/Sdk/platform-tools/adb
• Env var $ANDROID_HOME set to /Users/manoj01b/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
manoj01b@AUMAC18155 mission_patrol_2103 % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.2, on macOS 14.4 23E214 darwin-arm64, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Hi, auto signing is not going to work. You need to create provisioning profile for your RunnerUITests bundleID

See: #1596

Hi! I had a similar problem today. Not sure it will help, but it worth the try.

In my case, I solved it by opening the iOS workspace in Xcode and then I plugged my physical device, pairing it with the Xcode.
After that I made some builds through Xcode pointing to the physical device, then back to Android Studio I had no more errors.

Hi, we already have an issue for creating a documentation for running tests of physical iOS device. Closing this as duplicate

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.