apache / cordova-paramedic

Apache Cordova - Paramedic
https://cordova.apache.org/
Apache License 2.0
36 stars 53 forks source link

fix: Finding first ios simulator #265

Closed breautek closed 10 months ago

breautek commented 10 months ago

Platforms affected

Motivation and Context

simulator lists has a tab \t, so the ^ start of string regex was failing to find anything.

fixes #264

Description

Testing

Checklist

svenemtell commented 10 months ago

Thanks @breautek! It now works without using the --target flag, but I get a couple of Error messages, see log excerpt below.

...
---------------------------------------------------------
4. Run (Jasmine) tests...
... locally
---------------------------------------------------------
cordova-paramedic: running tests locally
cordova-paramedic: Choosing Target for iOS
running:
    cordova run ios --list --emulator --no-telemetry --no-update-notifier
Avaliable Emulators:
Available iOS Simulators:
        iPhone-SE-3rd-generation, 16.4
        iPad-Air-5th-generation, 16.4
        iPad-mini-6th-generation, 16.4
        iPhone-14, 16.4
        iPhone-14-Plus, 16.4
        iPhone-14-Pro, 16.4
        iPhone-14-Pro-Max, 16.4
        iPad-10th-generation, 16.4
        iPad-Pro-11-inch-4th-generation-8GB, 16.4
        iPad-Pro-12-9-inch-6th-generation-8GB, 16.4
Filtering for Targeted Emulator: /^iPhone/
Unable to find requested simulator, falling back to the first available!
running:
    (xcrun xctrace list devices || instruments -s devices) 2>&1 | grep ^iPhone
$ (xcrun xctrace list devices || instruments -s devices) 2>&1 | grep ^iPhone
iPhone 14 Simulator (16.4) (3424276F-20AD-4EBB-93FD-74D868B0673F)
iPhone 14 Plus Simulator (16.4) (9EB10B98-76B8-44F5-8CEE-79AF4A9AEA30)
iPhone 14 Pro Simulator (16.4) (129B73AE-52A2-48C3-BAF8-3BC7FFEAD288)
iPhone 14 Pro Max Simulator (16.4) (00F6199B-13D2-46DF-8FC2-715D16EF04D7)
iPhone SE (3rd generation) Simulator (16.4) (19C62B77-CE5E-4CE0-B723-4E02591EEEFD)
Error: No simulator found.
cordova-paramedic: Setting required permissions.
cordova-paramedic: running command cordova run ios --no-telemetry --no-update-notifier  --target "iPhone-SE-3rd-generation, 16.4" --emulator
$ cordova run ios --no-telemetry --no-update-notifier  --target "iPhone-SE-3rd-generation, 16.4" --emulator
cordova-paramedic: waiting for test results
List simulator targets
Building for "iPhone SE (3rd generation)" Simulator (com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation, iPhone-SE-3rd-generation).
Building project: /private/var/folders/02/k2jz79g95rl4xyz2h6wp03b80000gn/T/tmp-74830-CARfYfuUKWG3/platforms/ios/HelloCordova.xcworkspace
        Configuration: Debug
        Platform: emulator
        Target: iPhone SE (3rd generation)
2023-09-15 09:01:14.657 xcodebuild[75301:2380511] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace HelloCordova.xcworkspace -scheme HelloCordova -configuration Debug -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone SE (3rd generation)" build SYMROOT=/private/var/folders/02/k2jz79g95rl4xyz2h6wp03b80000gn/T/tmp-74830-CARfYfuUKWG3/platforms/ios/build

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line:
    SDKROOT = iphonesimulator16.4
    SYMROOT = /private/var/folders/02/k2jz79g95rl4xyz2h6wp03b80000gn/T/tmp-74830-CARfYfuUKWG3/platforms/ios/build

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:19C62B77-CE5E-4CE0-B723-4E02591EEEFD, OS:16.4, name:iPhone SE (3rd generation) }
{ platform:iOS Simulator, id:19C62B77-CE5E-4CE0-B723-4E02591EEEFD, OS:16.4, name:iPhone SE (3rd generation) }
Prepare packages

...

---------------------------------------------------------
6. Collect data and clean up
---------------------------------------------------------
Completed tests at 9:01:39 AM
Collecting logs for the devices.
Error: Failed to find the ID of the simulator
Uninstalling the app.
cordova-paramedic: Running command: xcrun simctl uninstall undefined io.cordova.hellocordova
$ xcrun simctl uninstall undefined io.cordova.hellocordova
Invalid device: undefined
Error: Failed to uninstall the app
Error: Error code: 148
cordova-paramedic: App uninstall timed out!
cordova-paramedic: Killing the emulator process.
Running the following command:
    killall -9 "Simulator" "iOS Simulator"
$ killall -9 "Simulator" "iOS Simulator"
local-server: killing local file transfer server if it's up...
cordova-paramedic: Deleting the application: /var/folders/02/k2jz79g95rl4xyz2h6wp03b80000gn/T/tmp-74830-CARfYfuUKWG3
/Volumes/source/cordova-plugin-gaudiamus
Finished with exit code 0
breautek commented 10 months ago

Yah, I did experience that issue during testing/using where it only really works if there are no simulators running.

I think there's another, perhaps similar issue somewhere's else in paramedic.