Detox: ExpoKit: device is not defined: detox.init(config) seems to be hanging

Created on 28 Feb 2019  ·  16Comments  ·  Source: wix/Detox

Description

Having what seems to be a classic device is not defined error, it seems that indeed the await detox.init(config) which is located by default in the beforeAll from the init.js never completes. I surrounded it by logs, and only the first one triggers. I also tried to put it in a try/catch but it does not catch any exception.
My app is detached from expo, I'm using ExpoKit 31 with RN 0.57.
I'm also using jest and not mocha.
I'm trying to run one single test, and the error was the same with the default first test generated by detox init.

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 10.0.11
  • Expo: 31.0.4
  • ExpoKit: 31.0.2
  • React Native: 0.57
  • Node: 10.10.0
  • Device: iPhone Xs Max (Simulator)
  • Xcode: 10.1
  • macOS: Mojave 10.14.3

Device and verbose Detox logs

  ● Example › should tap login button on login screen

    ReferenceError: device is not defined

      3 |   beforeEach(async () => {
      4 |     // await reloadApp()
    > 5 |     await device.reloadReactNative()
        |           ^
      6 |   })
      7 |
      8 |   it('should tap login button on login screen', async () => {

Most helpful comment

I have same problem without expo, just react-native

All 16 comments

I have same problem without expo, just react-native

Has anyone found a solution?

No, for me it's on hold until we get an answer, and if nothing comes i'll have to change my testing strategy and find another solution than detox :-(.

I have a plain react-native project https://github.com/msand/react-native-svg-e2e which works well locally both with Android and iOS. iOS also works on both travis and bitrise, and android works sometimes on travis using an ugly workaround, but haven't got e2e tests to work with android on bitrise yet. https://github.com/wix/Detox/issues/1194

I am having same issue without expo but only on android.
detox:10.0.13
react-native: 0.57.5
node: 11.10.1
device: Pixel_XL_API_28 (android emulator)
macOS: Mojave 10.14.3

When I use detox test --reuse my test is working which makes sense as it does not init configs.

I have different problem, but I guess the origin is the same.
My app has:
detox: ^12.0.0
expokit: 32.0.7
expo: 32.0.7
react-native: 0.57.1 (expo sdk-32.0.0)
macOS: Mojave 10.14.3 (18D109)
node: 8.12.0

For expokit, I can't use Exponent.app, so I managed this by building the native app package like normal react-native app.
When I am trying to use detox in debug for ios with 'expo start', App is installed successfully, but I got errors like 'Async callback timeout after 120000ms'.
When I build app for release and trying to use detox with it - e2e tests works.

I think that right now detox cannot be used with expokit for debug =(

Any news on that?

I am not using Expo. But For me I found that problem was happening after
detox version update.
Probably init configurations created by prior version wasn't working well
with updated one. So i removed all detox files reinstalled everything for
latest. And it was working.

On Wed, Mar 27, 2019, 6:14 AM Roni Litman notifications@github.com wrote:

Any news on that?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/wix/Detox/issues/1187#issuecomment-477078193, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AtCll83M0hFzEvwIA5gJbZ3x87__Yzh1ks5va0RugaJpZM4bW94Y
.

When I build app for release and trying to use detox with it - e2e tests works.

Could you be a bit more specific in the steps you use to make it work?
I'm also facing this issue and would be happy to be able to at least use detox with release builds?

I encounter the same problem as @KowalskiP.

For reference, my app has these libraries:
detox: ^12.4.1
expokit: 32.1.1
expo: 32.0.0
react-native: 0.57.1 (expo sdk-32.0.0)
XCode: 10.1 (10B61)
macOS: Mojave 10.14.4 (18E226)
node: 11.13.0

Here's a sample repo with a status that's failing: https://github.com/jmporchet/expokit-detox-test
There are two branches, master with jest and mocha with mocha.

There's a trace.txt that gives the output of the detox test --loglevel trace command in both branches.

What I did:

Happy to help in debugging this, hit me up here or on Twitter @jmporchet.

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.

I encounter the same problem as @KowalskiP.

For reference, my app has these libraries:
detox: ^12.4.1
expokit: 32.1.1
expo: 32.0.0
react-native: 0.57.1 (expo sdk-32.0.0)
XCode: 10.1 (10B61)
macOS: Mojave 10.14.4 (18E226)
node: 11.13.0

Here's a sample repo with a status that's failing: https://github.com/jmporchet/expokit-detox-test
There are two branches, master with jest and mocha with mocha.

There's a trace.txt that gives the output of the detox test --loglevel trace command in both branches.

What I did:

Happy to help in debugging this, hit me up here or on Twitter @jmporchet.

Still happening with "detox": "^12.10.0" and "expokit": "32.1.2".
I updated the test repo, and I can post the logs if necessary.

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.

@LeoNatan , is it an issue because of a URL not present in blacklist?

Please see my comment there with a recommendation on how to debug this.

Was this page helpful?
0 / 5 - 0 ratings