Detox: Incorrect OS version of specified iPhone simulator name

Created on 30 Dec 2018  路  8Comments  路  Source: wix/Detox

https://github.com/wix/Detox/blob/45c895aa6abb02823f325f0b274ac63e12b05760/detox/src/devices/ios/AppleSimUtils.js#L38

E.G;

  • delete iPhone 8 iOS 12.1 simulators
  • pass only device name; iPhone 8

When other devices have 12.1 simulators installed for them, 12.1 will be picked even though device won't match;

 Error: Can't find a simulator to match with "iPhone 8", run 'xcrun simctl list' to list your supported devices.
      It is advised to only state a device type, and not to state iOS version, e.g. "iPhone 7"
    at AppleSimUtils.findDevicesUDID (/Users/jonathanl/Desktop/dev/crm/invoices-mobile/node_modules/detox/src/devices/ios/AppleSimUtils.js:47:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
acceptebug ios 馃搶 pinned

Most helpful comment

For anyone coming through this through searching for the error message, you might want to upgrade you applesimutils to at least version 0.7.0 using:

brew upgrade applesimutils

My issue was that I was on version 0.6.3, which was not able to return a list of any simulators. You can test this by running the command:

applesimutils --list

If you get an empty array, you might fix it by upgrading :+1:

All 8 comments

The logic should be fixed to search the latest available OS for the specified simulator name, not latest available OS version in general.

Affecting me as well. @Wo1v3r what was your workaround?

Indirectly related to https://github.com/wix/Detox/issues/853 .

Affecting me as well. @Wo1v3r what was your workaround?

Having other issues now, but updating to latest version of detox@^12.1.1 fixed this.

For anyone coming through this through searching for the error message, you might want to upgrade you applesimutils to at least version 0.7.0 using:

brew upgrade applesimutils

My issue was that I was on version 0.6.3, which was not able to return a list of any simulators. You can test this by running the command:

applesimutils --list

If you get an empty array, you might fix it by upgrading :+1:

I have the same problem. I also tried upgrading applesimutils but the problem remains.

"configurations": {
  "ios.sim.debug": {
    ...
    "type": "ios.simulator",
    "name": "iPhone SE"
  },
  ...
 }
$ brew upgrade applesimutils                                                                                                                                                                                                                     
Error: wix/brew/applesimutils 0.7.0 already installed

$ detox test -c ios.sim.debug
detox[12206] INFO:  [test.js] configuration="ios.sim.debug" artifactsLocation="artifacts/ios.sim.debug.2019-07-26 11-45-20Z" recordLogs="none" takeScreenshots="manual" recordVideos="none" recordPerformance="none" reportSpecs=true node_modules/.bin/jest --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$' "e2e"
detox[12207] INFO:  [DetoxServer.js] server listening on localhost:49796...
detox[12207] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] 
 Error: Can't find a simulator to match with "iPhone SE", run 'xcrun simctl list' to list your supported devices.
      It is advised to only state a device type, and not to state iOS version, e.g. "iPhone 7"
    at AppleSimUtils.findDevicesUDID (/Users/travis/build/-/node_modules/detox/src/devices/ios/AppleSimUtils.js:47:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
...
$ applesimutils --list --byName "iPhone SE"

Output (8 matches)

[
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "3A44622D-4E95-40A7-9C94-1330012DA391",
    "os" : {
      "buildversion" : "16B91",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.1.simruntime",
      "isAvailable" : true,
      "name" : "iOS 12.1",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-1",
      "version" : "12.1"
    }
  },
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "A879EE19-CC79-4AB2-B91E-FF80D888A5C2",
    "os" : {
      "buildversion" : "16A366",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.0.simruntime",
      "isAvailable" : true,
      "name" : "iOS 12.0",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-0",
      "version" : "12.0"
    }
  },
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "D35C108E-F1E6-4ABC-8B92-E742D8452046",
    "os" : {
      "buildversion" : "15F79",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.4.simruntime",
      "isAvailable" : true,
      "name" : "iOS 11.4",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-4",
      "version" : "11.4"
    }
  },
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "823D551A-58B3-4E50-9037-6915FD6C6ADD",
    "os" : {
      "buildversion" : "15E217",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.3.simruntime",
      "isAvailable" : true,
      "name" : "iOS 11.3",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-3",
      "version" : "11.3"
    }
  },

{
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "18B69D50-DF49-459B-85B6-AC59D055F498",
    "os" : {
      "buildversion" : "15C107",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.2.simruntime",
      "isAvailable" : true,
      "name" : "iOS 11.2",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-2",
      "version" : "11.2"
    }
  },
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "CACA29AA-8E4E-480C-A121-66AACC9D2394",
    "os" : {
      "buildversion" : "15B87",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.1.simruntime",
      "isAvailable" : true,
      "name" : "iOS 11.1",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
      "version" : "11.1"
    }
  },
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "9F533DC5-4929-46EE-8C22-514464181C33",
    "os" : {
      "buildversion" : "15A8401",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 11.0.simruntime",
      "isAvailable" : true,
      "name" : "iOS 11.0",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-0",
      "version" : "11.0.1"
    }
  },
  {
    "deviceType" : {
      "name" : "iPhone SE",
      "bundlePath" : "\/Applications\/Xcode-11.0.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone SE.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
    },
    "state" : "Shutdown",
    "isAvailable" : true,
    "name" : "iPhone SE",
    "udid" : "F8BF689D-D374-409E-A98B-5EA73142280D",
    "os" : {
      "buildversion" : "14E8301",
      "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 10.3.simruntime",
      "isAvailable" : true,
      "name" : "iOS 10.3",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-10-3",
      "version" : "10.3.1"
    }
  }
]

Resolved by #1694.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlosalmonte04 picture carlosalmonte04  路  4Comments

aamorozov picture aamorozov  路  3Comments

jn3qf picture jn3qf  路  3Comments

tomball123 picture tomball123  路  4Comments

gtRfnkN picture gtRfnkN  路  4Comments