Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing e2e with detox failing to start iPhone simulator, starts Apple TV instead

tldr; I have a React Native app, and I am using workspace. I have gone through this detox getting started document and I now have an e2e folder with 3 files (default), and a configuration in the package.json.

Configuration looks like

"detox": {
    "test-runner": "mocha",
    "specs": "e2e",
    "runner-config": "e2e/mocha.opts",
    "configurations": {
        "ios.sim.debug": {
            "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/MyApp.app",
            "build": "xcodebuild -workspace ios/MyApp.xcworkspace -scheme Staging -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
            "type": "ios.simulator",
            "name": "iPhone 6"
        }
    }
}

When I run xcrun simctl list I get the following list, where iPhone 6 is listed and Booted.

== Devices ==
-- iOS 11.4 --
    iPhone 5s (E9D0264C-9257-4BE4-8693-4B7AE6AAE97A) (Shutdown)
    iPhone 6 (099D481A-6F6D-4DC9-A379-16DFAE617CA0) (Booted)
    iPhone 6 Plus (7556F239-06F0-421D-A294-AE15BCF6D64D) (Shutdown)
    iPhone 6s (FB65410A-4654-40BB-88B0-234DF3C191DE) (Shutdown)
...
-- tvOS 11.4 --
    Apple TV (9875527D-A6FC-4BD8-965E-255C910E3ABA) (Shutdown)
    Apple TV 4K (0BF2198F-04AF-49CC-B05C-540BB2FB53AF) (Shutdown)
    Apple TV 4K (at 1080p) (8F14FC95-685B-481C-860F-384CBD880D2B) (Shutdown)
...

detox build --configuration ios.sim.debug runs fine, but when I run detox test --configuration ios.sim.debug or detox build or detox build --reuse it starts the Apple TV simulator and throws this error

detox info 11:47:49: server listening on localhost:51379...
detox info 2: Searching for device matching iPhone 6...
detox info 5: Booting device 9875527D-A6FC-4BD8-965E-255C910E3ABA
detox info 7: Terminating com.local.MyApp...
detox ERR! 7: An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=164):
Unable to lookup in current state: Shutting Down, exited with code 164
  1) "before all" hook

  0 passing (9s)
  1 failing

  1) "before all" hook:
     Error: 7: running "/usr/bin/xcrun simctl terminate 9875527D-A6FC-4BD8-965E-255C910E3ABA com.local.MyApp" returned undefined
      at Object.execWithRetriesAndLogs (node_modules/detox/src/utils/exec.js:36:11)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:118:7)



child_process.js:615
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.debug   --reuse  --grep :android: --invert
    at checkExecSyncError (child_process.js:575:11)
    at Object.execSync (child_process.js:612:13)
    at runMocha (/Users/me/code/node_modules/detox/local-cli/detox-test.js:114:6)
    at run (/Users/me/code/node_modules/detox/local-cli/detox-test.js:75:7)
    at Object.<anonymous> (/Users/me/code/node_modules/detox/local-cli/detox-test.js:181:1)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)

You can see that under detox info 5: it starts booting up 9875527D-A6FC-4BD8-965E-255C910E3ABA, which is the Apple TV Device.

How can I configure detox to start an iPhone simulator instead?

like image 796
Tim Rijavec Avatar asked Oct 20 '25 05:10

Tim Rijavec


1 Answers

brew update && brew upgrade applesimutils and detox clean-framework-cache && detox build-framework-cache as suggested by Tim Rijavec helped in my case! Hidden in the comments it looked like there is no solution to this issue.

like image 200
mamartin Avatar answered Oct 22 '25 18:10

mamartin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!