Detox: TypeError: Cannot read property 'identifier' of undefined

Created on 30 Jul 2019  路  19Comments  路  Source: wix/Detox

Description
I have a problem from this lib during running detox tests, simulators for react native works okay.

Screenshots
detox[17229] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
TypeError: Cannot read property 'identifier' of undefined
at AppleSimUtils.create (/.../node_modules/detox/src/devices/ios/AppleSimUtils.js: 100:100)

Environment

  • macOS version: 10.14.5
  • Xcode version: 10.3

Before Xcode update I didn't have this issue

acceptebug ios

All 19 comments

If you run applesimutils --list, do you get a list of devices?

@LeoNatan yes, I have looooong list here is a part of it:

"isAvailable" : true, "state" : "Shutdown", "name" : "iPad Pro (10.5-inch)" }, { "availabilityError" : "", "os" : { "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.2.simruntime", "availabilityError" : "", "buildversion" : "16E226", "availability" : "(available)", "isAvailable" : true, "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-2", "version" : "12.2", "name" : "iOS 12.2" }, "availability" : "(available)", "deviceType" : { "name" : "iPad Pro (11-inch)", "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/iPad Pro (11-inch).simdevicetype", "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--11-inch-" }, "udid" : "6CA4A862-CCB6-48F5-94CE-C2CB9B226210", "isAvailable" : true, "state" : "Shutdown", "name" : "iPad Pro (11-inch)" }, { "availabilityError" : "", "os" : { "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.2.simruntime", "availabilityError" : "", "buildversion" : "16E226", "availability" : "(available)", "isAvailable" : true, "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-2", "version" : "12.2", "name" : "iOS 12.2" }, "availability" : "(available)", "deviceType" : { "name" : "iPad Pro (12.9-inch)", "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/iPad Pro (12.9-inch).simdevicetype", "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro" }, "udid" : "61DC4870-8B99-47DF-BA5D-564AFCE02C4F", "isAvailable" : true, "state" : "Shutdown", "name" : "iPad Pro (12.9-inch)" }, { "availabilityError" : "", "os" : { "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.2.simruntime", "availabilityError" : "", "buildversion" : "16E226", "availability" : "(available)", "isAvailable" : true, "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-2", "version" : "12.2", "name" : "iOS 12.2" }, "availability" : "(available)", "deviceType" : { "name" : "iPad Pro (12.9-inch) (2nd generation)", "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/iPad Pro (12.9-inch) (2nd generation).simdevicetype", "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-" }, "udid" : "C82A692B-A052-4F4C-A750-CAECE7529EC4", "isAvailable" : true, "state" : "Shutdown", "name" : "iPad Pro (12.9-inch) (2nd generation)" }, { "availabilityError" : "", "os" : { "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.2.simruntime", "availabilityError" : "", "buildversion" : "16E226", "availability" : "(available)", "isAvailable" : true, "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-2", "version" : "12.2", "name" : "iOS 12.2" }, "availability" : "(available)", "deviceType" : { "name" : "iPad Pro (12.9-inch) (3rd generation)", "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/iPad Pro (12.9-inch) (3rd generation).simdevicetype", "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---3rd-generation-" }, "udid" : "A4064FC2-2311-4733-A8DA-370AABA89461", "isAvailable" : true, "state" : "Shutdown", "name" : "iPad Pro (12.9-inch) (3rd generation)" }, { "availabilityError" : "", "os" : { "bundlePath" : "\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS 12.2.simruntime", "availabilityError" : "", "buildversion" : "16E226", "availability" : "(available)", "isAvailable" : true, "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-2", "version" : "12.2", "name" : "iOS 12.2" }, .... "availability" : "(available)", "deviceType" : { "name" : "Apple Watch Series 4 - 40mm", "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/WatchOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/Apple Watch Series 4 - 40mm.simdevicetype", "identifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-40mm" }, "udid" : "23226F6A-43DF-4551-9098-9572E37D5B88", "isAvailable" : true, "state" : "Shutdown", "name" : "Apple Watch Series 4 - 40mm" }, { "availabilityError" : "", "os" : { "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/WatchOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/Runtimes\/watchOS.simruntime", "availabilityError" : "", "buildversion" : "16U567", "availability" : "(available)", "isAvailable" : true, "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-5-3", "version" : "5.3", "name" : "watchOS 5.3" }, "availability" : "(available)", "deviceType" : { "name" : "Apple Watch Series 4 - 44mm", "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/WatchOS.platform\/Developer\/Library\/CoreSimulator\/Profiles\/DeviceTypes\/Apple Watch Series 4 - 44mm.simdevicetype", "identifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-44mm" }, "udid" : "69EA4193-6A4D-4465-94EF-0D8C149FBDFF", "isAvailable" : true, "state" : "Shutdown", "name" : "Apple Watch Series 4 - 44mm" } ]

OK, so this is a Detox issue. Moving.

@redbluenat What version of applesimutils are you using?

@LeoNatan applesimutils version 0.7.0

Very odd. I don't see a change in the output format from simctl, so applesimutils is exporting correctly.

Can you post your Detox config from package.json?

"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/app.app",
"build": "xcodebuild -workspace ios/app.xcworkspace -scheme app -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone Xs"
},

same issue

@noomorph Any insights here? Thanks

Of course, the insight is that detox.init has not been called. Currently, by.id functions are platorm-specific, and initiated inside detox.init. If it is important for you to have a very early access to them, post a feature request and we'll see what we can do.

@noomorph Thanks! Could it also be that the init() somehow failed and that is causing this? Do you know what detox[13114] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] is?

Exactly, that's it. Init has failed.

I resolved this issue by updating Detox and

gem install xcode-install
xcversion simulators --install='iOS 12.4'

and add to configuration

 "name": "iPhone X, iOS 12.4"

I am still having this issue but only with threading. Particularly we are using --workers=3, though the # of workers, as long as its over 1, doesnt matter and will throw the error.

This is using jest and latest v of detox.

Seems to be linked to this issue? https://github.com/wix/Detox/issues/1395

Resolved by cleaning out all previous xcode and applesimutils. Reinstalling both with latest.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

We might have reproduced this issue locally.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeoNatan picture LeoNatan  路  4Comments

alexmngn picture alexmngn  路  3Comments

carlosalmonte04 picture carlosalmonte04  路  4Comments

rikur picture rikur  路  4Comments

gtRfnkN picture gtRfnkN  路  4Comments