leancodepl / patrol

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

patrol build ios fails with an error: Failed writing xctestrun file #2134

Open himeshp opened 8 months ago

himeshp commented 8 months ago

Steps to reproduce

  1. Clone the official example from GitHub
  2. Setup identifier and profile on Apple developer account
  3. Run on CI
  4. The command xcode-project use-profiles works correctly and as expected on CI as Screenshot 2024-02-28 at 14 43 21

Actual results

The command patrol build ios --release --flavor dev should work as expected but instead fails with an error, logs shared.

Logs

Logs ``` /Users/builder/clone/ios/Runner.xcodeproj: error: No profiles for 'pl.leancode.patrol.Example.RunnerUITests.xctrunner' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'pl.leancode.patrol.Example.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') .... .... 2024-02-28 08:24:41.710 xcodebuild[5038:27639] Writing error result bundle to /var/folders/w2/rrf5p87d1bbfyphxc7jdnyvh0000gn/T/ResultBundle_2024-28-02_08-24-0041.xcresult xcodebuild: error: Failed writing xctestrun file: The folder “dev_TestPlan_iphoneos16.4-arm64.xctestrun” doesn’t exist.. ✗ Failed to build app with entrypoint test_bundle.dart for iOS device (xcodebuild exited with code 70) (6.9s) Error: xcodebuild exited with code 70 ```

Patrol version

patrol: ^3.5.2

Patrol Doctor output

Patrol Doctor output ``` Patrol CLI version: 2.6.4 Android: • Program adb found in /usr/local/share/android-sdk/platform-tools/adb • Env var $ANDROID_HOME set to /usr/local/share/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 ``` [✓] Flutter (Channel stable, 3.19.1, on macOS 13.3.1 22E261 darwin-arm64, locale en-US) • Flutter version 3.19.1 on channel stable at /Users/builder/programs/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision abb292a07e (7 days ago), 2024-02-20 14:35:05 -0800 • Engine revision 04817c99c9 • Dart version 3.3.0 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /usr/local/share/android-sdk • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = /usr/local/share/android-sdk • ANDROID_SDK_ROOT = /usr/local/share/android-sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode-14.3.app/Contents/Developer • Build 14E300c • CocoaPods version 1.13.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.3) • 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 11.0.13+0-b1751.21-8125866) [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 118.0.5993.117 [✓] Network resources • All expected network resources are available. • No issues found! ```
Liortra commented 8 months ago

Is there any update about this issue? @himeshp

himeshp commented 8 months ago

Hi @Liortra, Not yet, I believe it has still not been triaged by the Patrol Team.

pawlowskim commented 8 months ago

Manual signing solved problem for me https://github.com/leancodepl/patrol/issues/1596

himesh-cm commented 6 months ago

It looks like this issue is not specific to patrol, and was able to resolve it by adding the .xctrunner bundle identifier. This can be closed

bshvets-ama commented 3 months ago

We had the same issue when we tried to create the build for the Firebase Test Lab. This may be resolved by configuring manual signing and bundle identifier for the RunnerUITests target: 1) Go to Xcode and open RunnerUITests target configuration. 2) In Signing & Capabilities specify your Bundle Identifier. E.g. com.example.myapp.test. 3) On the Apple developer portal create a new Bundle Identifier that will match the one you specified in step 2 + .xctrunner postfix. E.g. com.example.myapp.test.xctrunner. 4) Create a new provisioning profile and import it in Xcode. You may see the warning that app ID in the provisioning profile does not match the one you specified in the Bundle Identifier field - ignore this message.

Now you should be able to build the test bundle with patrol build command.

These steps could be added to the documentation to save time for anyone who tries to set up UI testing on CI. @bartekpacia