Detox device/element is not defined

Created on 30 Aug 2018  ยท  19Comments  ยท  Source: wix/Detox

Hello Team :)

Description

My app work fine, but an error appear and say element/device is not defined
i found many issues :

DETOX_INIT_ERROR isn't throw

Steps to Reproduce

See the repository clone and read to reproduce :)
https://github.com/GuillaumeSarfati/detox-expo-issue

Detox, Node, Device, Xcode and macOS Versions

| Program | Version |
| ------------- | ---------- |
| Node | v8.11.3 |
| React | v16.3.1 |
| React Native | v0.53.0 |
| Expo | v29.0.0 |
| ExpoKit | v2.7.0 |
| Detox | v8.2.3 |
| Xcode | v9.4.1 |
| MacOS | v10.13.6 |

Device and verbose Detox logs

$ detox test --loglevel verbose

configuration="ios.sim.debug" loglevel="verbose" artifactsLocation="artifacts/ios.sim.debug.2018-08-30 08-23-23Z" node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$'
detox[89428] INFO:  [DetoxServer.js] server listening on localhost:64943...
detox[89428] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:64943
detox[89428] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761
detox[89428] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761
detox[89428] DEBUG: [exec.js/EXEC_CMD, #0] /usr/bin/xcrun simctl list -j
detox[89428] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byType "iPhone X" --byOS "11.4"
detox[89428] DEBUG: [exec.js/EXEC_TRY, #1] Searching for device matching iPhone X...
detox[89428] DEBUG: [exec.js/EXEC_CMD, #2] applesimutils --list --byId "86146F25-20FE-4DC4-AB16-2867F836F275"
detox[89428] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl uninstall 86146F25-20FE-4DC4-AB16-2867F836F275 com.detox.issue
detox[89428] DEBUG: [exec.js/EXEC_TRY, #3] Uninstalling com.detox.issue...
detox[89428] DEBUG: [exec.js/EXEC_SUCCESS, #3] com.detox.issue uninstalled
detox[89428] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl install 86146F25-20FE-4DC4-AB16-2867F836F275 "/Volumes/Guillaume/Projects/detox-expo-issue/ios/build/Build/Products/Debug-iphonesimulator/detox-expo-issue.app"
detox[89428] DEBUG: [exec.js/EXEC_TRY, #4] Installing /Volumes/Guillaume/Projects/detox-expo-issue/ios/build/Build/Products/Debug-iphonesimulator/detox-expo-issue.app...
detox[89428] DEBUG: [exec.js/EXEC_SUCCESS, #4] /Volumes/Guillaume/Projects/detox-expo-issue/ios/build/Build/Products/Debug-iphonesimulator/detox-expo-issue.app installed
detox[89428] DEBUG: [exec.js/EXEC_CMD, #5] /usr/bin/xcrun simctl terminate 86146F25-20FE-4DC4-AB16-2867F836F275 com.detox.issue
detox[89428] DEBUG: [exec.js/EXEC_TRY, #5] Terminating com.detox.issue...
detox[89428] DEBUG: [exec.js/EXEC_SUCCESS, #5] com.detox.issue terminated
detox[89428] DEBUG: [exec.js/EXEC_CMD, #6] /bin/cat /dev/null >/Users/guillaumesarfati/Library/Developer/CoreSimulator/Devices/86146F25-20FE-4DC4-AB16-2867F836F275/data/tmp/detox.last_launch_app_log.out 2>/Users/guillaumesarfati/Library/Developer/CoreSimulator/Devices/86146F25-20FE-4DC4-AB16-2867F836F275/data/tmp/detox.last_launch_app_log.err && SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/guillaumesarfati/Library/Detox/ios/9b1cf119d6b7b0d2bb09a9e8c56ad526925d9c30/Detox.framework/Detox" /usr/bin/xcrun simctl launch --stdout=/tmp/detox.last_launch_app_log.out --stderr=/tmp/detox.last_launch_app_log.err 86146F25-20FE-4DC4-AB16-2867F836F275 com.detox.issue --args -detoxServer ws://localhost:64943 -detoxSessionId d6b7276b-92cb-e6c3-c7bf-ba5102d46761
detox[89428] DEBUG: [exec.js/EXEC_TRY, #6] Launching com.detox.issue...
detox[89428] DEBUG: [exec.js/EXEC_SUCCESS, #6] com.detox.issue launched. The stdout and stderr logs were recreated, you can watch them with:
        tail -F /Users/guillaumesarfati/Library/Developer/CoreSimulator/Devices/86146F25-20FE-4DC4-AB16-2867F836F275/data/tmp/detox.last_launch_app_log.{out,err}
detox[89428] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761)
detox[89428] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761
detox[89428] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761
 FAIL  e2e/firstTest.spec.js (521.184s)
  Example
    โœ• should have welcome screen (9ms)
    โœ• should show hello screen after tap (2ms)
    โœ• should show world screen after tap (3ms)

  โ— Example โ€บ should have welcome screen

    Timeout - Async callback was not invoked within the 520000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queue_runner.js:41:52)

  โ— Example โ€บ should have welcome screen

    ReferenceError: device is not defined

      2 | describe('Example', () => {
      3 |   beforeEach(async () => {
    > 4 |     await device.reloadReactNative();
        |           ^
      5 |   });
      6 |
      7 |   it('should have welcome screen', async () => {

      at Object.device (firstTest.spec.js:4:11)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee (firstTest.spec.js:3:14)

  โ— Example โ€บ should have welcome screen

    ReferenceError: element is not defined

       5 |   });
       6 |
    >  7 |   it('should have welcome screen', async () => {
         |                                    ^
       8 |     await expect(element(by.id('welcome'))).toBeVisible();
       9 |   });
      10 |

      at Object._callee2$ (firstTest.spec.js:7:36)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee2 (firstTest.spec.js:7:36)

  โ— Example โ€บ should show hello screen after tap

    Timeout - Async callback was not invoked within the 520000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queue_runner.js:41:52)

  โ— Example โ€บ should show hello screen after tap

    ReferenceError: device is not defined

      2 | describe('Example', () => {
      3 |   beforeEach(async () => {
    > 4 |     await device.reloadReactNative();
        |           ^
      5 |   });
      6 |
      7 |   it('should have welcome screen', async () => {

      at Object.device (firstTest.spec.js:4:11)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee (firstTest.spec.js:3:14)

  โ— Example โ€บ should show hello screen after tap

    ReferenceError: element is not defined

       9 |   });
      10 |
    > 11 |   it('should show hello screen after tap', async () => {
         |                                            ^
      12 |     await element(by.id('hello_button')).tap();
      13 |     await expect(element(by.text('Hello!!!'))).toBeVisible();
      14 |   });

      at Object._callee3$ (firstTest.spec.js:11:44)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee3 (firstTest.spec.js:11:44)

  โ— Example โ€บ should show world screen after tap

    Timeout - Async callback was not invoked within the 520000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queue_runner.js:41:52)

  โ— Example โ€บ should show world screen after tap

    ReferenceError: device is not defined

      2 | describe('Example', () => {
      3 |   beforeEach(async () => {
    > 4 |     await device.reloadReactNative();
        |           ^
      5 |   });
      6 |
      7 |   it('should have welcome screen', async () => {

      at Object.device (firstTest.spec.js:4:11)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee (firstTest.spec.js:3:14)

  โ— Example โ€บ should show world screen after tap

    ReferenceError: element is not defined

      14 |   });
      15 |
    > 16 |   it('should show world screen after tap', async () => {
         |                                            ^
      17 |     await element(by.id('world_button')).tap();
      18 |     await expect(element(by.text('World!!!'))).toBeVisible();
      19 |   });

      at Object._callee4$ (firstTest.spec.js:16:44)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee4 (firstTest.spec.js:16:44)

Test Suites: 1 failed, 1 total
Tests:       3 failed, 3 total
Snapshots:   0 total
Time:        521.24s
Ran all test suites matching /e2e/i with tests matching "^((?!:android:).)*$".
detox[89428] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761
detox[89428] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=d6b7276b-92cb-e6c3-c7bf-ba5102d46761
child_process.js:644
    throw err;
    ^

Error: Command failed: node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$'
    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at runJest (/Volumes/Guillaume/Projects/detox-expo-issue/node_modules/detox/local-cli/detox-test.js:154:6)
    at run (/Volumes/Guillaume/Projects/detox-expo-issue/node_modules/detox/local-cli/detox-test.js:85:7)
    at Object.<anonymous> (/Volumes/Guillaume/Projects/detox-expo-issue/node_modules/detox/local-cli/detox-test.js:217:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

Most helpful comment

I'll do my best to look into this on the next week.

All 19 comments

Someone can help us ?

got the same problem !

I, too, am experiencing this issue.

@GuillaumeSarfati @Tchangang If either of you figure this out could you please create a demo project? I will do the same if I figure it out ๐Ÿ˜„

Happened to me after upgrading to babel 7 and newest RN.

Fix for me was to kill all simulators and do a project clean in iOS. Once the simulator works again, then the detox tests will work as well.

Also needed the babel 7 core package ("babel-core": "7.0.0-bridge.0",) . https://jestjs.io/docs/en/getting-started.html#using-babel

@benburton I have already link the demo project, it is here https://github.com/GuillaumeSarfati/detox-expo-issue ;)

@GuillaumeSafrati, I don't see any Expo specific integration code for Detox in your repo. Correct me if I am wrong.

AFAIR, it does not work out of the box and somebody in the previous issues published their workaround wrapper for Expo. It is said to be not officially supported, but you can try.

@noomorph Can you point me in the direction of the workaround wrapper? All I really want is to see a working example of latest Expo+Detox, and it's really frustrating that one doesn't exist.

@noomorph this is an example of "detached" Expo App ( like an app without expo) , I tried to use expo-detox-helpers no more results

@GuillaumeSarfati me too

I'll do my best to look into this on the next week.

is there a workaround to make this work first like degrading some dependencies?

I have this issue with Xcode 10.
Rolling back to version 9.4.1 seems to be enough for me.
By the way, with Xcode 10, my first test file runs OK, it's my second test file which triggers the _ReferenceError: device is not defined_ .
Good luck for the fix.

Yes, there is an issue with Xcode 10 install wrapper AFAIK. I'm aware and
this is in the nearest plan's to fix.

ื‘ืชืืจื™ืš ื™ื•ื ื“ืณ, 26 ื‘ืกืคื˜ืณ 2018, 10:35, ืžืืช yannDuval โ€<
[email protected]>:

I have this issue with Xcode 10.
Rolling back to version 9.4.1 seems to be enough for me.
By the way, with Xcode 10, my first test file runs OK, it's my second
test file which triggers the ReferenceError: device is not defined .
Good luck for the fix.

โ€”
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/wix/detox/issues/911#issuecomment-424615925, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB3x5Twb9RvOz-ko8rxLwD_MGiLq5p_5ks5uey5HgaJpZM4WTGi4
.

Hi,

Is there any solution for this? I am using xcode 9.4 and facing the same problem. The thing is, I tried their app from here: https://github.com/wix/Detox/tree/master/examples/demo-react-native-jest, upgraded to react-native 0.52.0 (the same as I use in my app and it runs with their example) and it works. Then I try with our app, which has the same version of dependencies (rn 0.52.0, detox 9.0) and it does not work. Is maybe problem react-navigation or some other dependencies in package.json?

The difference is, I created my app with Expo and then ejected it. Maybe that should be problem?

Our package.json:

{
"name": "nintendo-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-eslint": "^8.2.2",
"babel-plugin-transform-runtime": "^6.0.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-flow": "^6.23.0",
"babel-preset-jest": "^22.4.1",
"babel-preset-react-native": "^4.0.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"detox": "^9.0.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.4",
"eslint": "^4.18.2",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-detox": "^1.0.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-native": "^3.2.1",
"fetch-mock": "^6.4.4",
"identity-obj-proxy": "^3.0.0",
"jest": "^23.1.0",
"jest-environment-enzyme": "^6.0.1",
"jest-enzyme": "^6.0.1",
"jest-fetch-mock": "^1.6.4",
"jest-react-native": "^18.0.0",
"react-test-renderer": "16.2.0",
"redux-mock-store": "^1.5.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/nintendoapp/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'",
"test:unit": "node node_modules/jest/bin/jest.js",
"test:ios:release": "detox build -c ios.sim.release && detox test -c ios.sim.release",
"test:ios:debug": "detox build -c ios.sim.debug && detox test -c ios.sim.debug",
"test": "yarn test:unit && yarn test:ios:debug",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"flow": "flow",
"version": "./version-ios.sh"
},
"jest": {
"preset": "react-native",
"modulePathIgnorePatterns": [
"/node_modules/./react-native/",
"/node_modules/.
/react/"
],
"testPathIgnorePatterns": [
"e2e",
"node_modules"
],
"transformIgnorePatterns": [
"/node_modules/(?!react-native|react-navigation)/"
],
"moduleNameMapper": {
".+\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "identity-obj-proxy"
},
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"collectCoverageFrom": [
"js/*/.{js}"
],
"setupFiles": [
"./setupJest.js"
]
},
"detox": {
"test-runner": "jest",
"runner-config": "e2e/config.json",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/nintendoapp.app",
"build": "xcodebuild -project ios/nintendoapp.xcodeproj -scheme nintendoapp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7"
}
}
},
"dependencies": {
"axios": "^0.18.0",
"babel-preset-stage-0": "^6.24.1",
"credit-card-type": "^7.1.0",
"flow-bin": "^0.66.0",
"lodash": "^4.17.5",
"prop-types": "^15.6.1",
"rambda": "^1.0.12",
"react": "16.2.0",
"react-dom": "^16.4.0",
"react-native": "0.52.0",
"react-native-camera": "^1.1.2",
"react-native-code-push": "^5.3.4",
"react-native-device-info": "^0.21.5",
"react-native-global-font": "^1.0.1",
"react-native-keyboard-aware-scroll-view": "^0.5.0",
"react-native-loader": "^1.2.1",
"react-native-modal": "^5.2.0",
"react-native-openanything": "^0.0.3",
"react-native-qrcode-scanner": "^1.1.0",
"react-native-side-menu": "^1.1.3",
"react-native-view-overflow": "0.0.3",
"react-navigation": "^1.4.0",
"react-navigation-redux-helpers": "^1.0.3",
"react-proptypes": "^1.0.0",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-axios-middleware": "^4.0.0",
"redux-thunk": "^2.2.0",
"websocket": "^1.0.25"
},
"rnpm": {
"assets": [
"./assets/fonts"
]
}
}

got the same problem on Xcode 9.4.1. Is there a plan to fix it?

For me upgrading my applesimutils solved the problem:
brew update && brew upgrade applesimutils

It seems like there are too many different issues here, and it will be impossible to address them all at the same time, so I will close this issue now, but try to answer as generally as I can, and if there are still individual issues please open new ones.

Sync Issues

There are only two known ways Detox can reach the test runner's timeout,

  1. The first would be that the app never gets idle. That may include never ending animations, excessively long network call or things that may keep runloops busy (nested setTimeouts for one). The way to get insight over this first issue is using --debug-synchronization, this will print the state of your application if an action/expectation take excessively long time.
  2. The second is app crashes. We try to get the native stack trace of app crashes, but depending on when that crash happens, we may not be able to detect it. Therefore, always look at the device log (you can either find them in ~/Library/Developer/CoreSimulator/Devices/{device udid} or record the logs with Detox's log recorder)

Jest: beforeAll and other setup hooks

Jest acts a bit strange when a beforeAll setup is failed. Instead of stopping the test suite, it will continue running all tests, causing unpredictable results such as device/element is not defined. This is due to the fact that detox.init() has failed (for the causes mentioned above) , and those globals have not been exported.

device/element is not defined is not really an issues, it's a symptom of failed initialization.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrobber picture jrobber  ยท  3Comments

lc3t35 picture lc3t35  ยท  4Comments

aamorozov picture aamorozov  ยท  3Comments

LeoNatan picture LeoNatan  ยท  4Comments

jn3qf picture jn3qf  ยท  3Comments