Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Detox hangs after launching app, hits jest timeout #749

Closed
wontonst opened this issue May 22, 2018 · 5 comments
Closed

Detox hangs after launching app, hits jest timeout #749

wontonst opened this issue May 22, 2018 · 5 comments

Comments

@wontonst
Copy link

Description

Detox correctly loads up and runs the app, but gets hung when the app is in the foreground. Based on #689 it's because the app is having trouble communicating with the detox server.

What is weird is that everything runs fine on x86 android 27 but does not on arm64 android 25. Device configs are pretty much identical. I need the arm64 because I'm doing CI and I want it to run on AWS ec2 which doesn't have KVM support needed by x86. I love Travis but it is not an option at the moment.

Steps to Reproduce

init.js

const detox = require('detox');
const config = require('../package.json').detox;

// Set the default timeout
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;

beforeAll(async () => {
  await detox.init(config, {launchApp: false});
});

afterAll(async () => {
  await detox.cleanup();
});

first test that runs looks something like

describe('Profile Page', () => {

  beforeAll(async () => {
    await device.launchApp({ permissions: { notifications: 'YES' } });
    await starterKit.generateSampleSession();
  });

  beforeEach(async () => {
    await device.reloadReactNative();
    await starterKit.loadAccountPage();
    const userFirstName = element(by.id('userFirstName'));
    await expect(userFirstName).toExist();
  });

  it('should allow the user to edit their profile', async () => {
    const profile = element(by.id('Profile'));
    await expect(profile).toExist();
    await expect(profile).toBeVisible();
    await profile.tap();
  });
});

Standard release config

"android.emu.release": {
        "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
        "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
        "type": "android.emulator",
        "name": "Nexus_One_API_25"
      }

Detox, Node, Device, Xcode and macOS Versions

  • Detox 7.0.1, upgraded to 7.3.7 but still hit the issue
  • React native 0.50
  • Node 9.3.0
  • Android 25 arm64-v8a on emulator
  • Mac osx 10.13.4

Device and verbose Detox logs

Macbook-Pro:iris $ ./node_modules/.bin/detox --loglevel wss test -c android.emu.release
node_modules/.bin/jest e2e --config=e2e/config.json --runInBand --testNamePattern='^((?!:ios:).)*$'
 server listening on localhost:51598...
 onOpen [object Object]
 send: {"type":"login","params":{"sessionId":"d8dbdb72-4566-4c3b-d1f7-d9f9e1d050a5","role":"tester"},"messageId":0}
 role=tester login (sessionId=d8dbdb72-4566-4c3b-d1f7-d9f9e1d050a5)
 role=tester action=loginSuccess (sessionId=d8dbdb72-4566-4c3b-d1f7-d9f9e1d050a5)
 onMessage: {"type":"loginSuccess","params":{"sessionId":"d8dbdb72-4566-4c3b-d1f7-d9f9e1d050a5","role":"tester"},"messageId":0}
  rbx
 : /Users//Library/Android/sdk/tools/emulator -list-avds --verbose
 Nexus_5X_API_27
 Nexus_One_API_25
 Nexus_S_API_25
 headless:
 integout:
 integration
 : stdout:
 -verbose -gpu auto -no-audio @Nexus_One_API_25tor
 emulator: Android virtual device file at: /Users//.android/avd/Nexus_One_API_25.ini
 emulator: virtual device content at /Users//.android/avd/Nexus_One_API_25.avd
 emulator: virtual device config file: /Users//.android/avd/Nexus_One_API_25.avd/config.ini
 emulator: using core hw config path: /Users//.android/avd/Nexus_One_API_25.avd/hardware-qemu.ini
 emulator: using snapshot lock path: /Users//.android/avd/Nexus_One_API_25.avd/snapshot.lock
 emulator: Found AVD target API level: 25
 emulator: Read property file at /Users//Library/Android/sdk/system-images/android-25/google_apis/arm64-v8a//build.prop
 emulator: No boot.prop property file found.
 emulator: Warning: config.ini contains invalid skin.path entry: _no_skin
 emulator: autoconfig: -skin 480x800
 emulator: autoconfig: -skindir (null)
 emulator: autoconfig: -kernel /Users//Library/Android/sdk/system-images/android-25/google_apis/arm64-v8a//kernel-ranchu
 emulator: Target arch = 'arm64'
 emulator: Auto-detect: Kernel image requires new device naming scheme.
 emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
 emulator: autoconfig: -ramdisk /Users//Library/Android/sdk/system-images/android-25/google_apis/arm64-v8a//ramdisk.img
 emulator: Using initial system image: /Users//Library/Android/sdk/system-images/android-25/google_apis/arm64-v8a//system.img
 emulator: No vendor image
 emulator: autoconfig: -data /Users//.android/avd/Nexus_One_API_25.avd/userdata-qemu.img
 emulator: autoconfig: -initdata /Users//.android/avd/Nexus_One_API_25.avd/userdata.img
 emulator: autoconfig: -cache /Users//.android/avd/Nexus_One_API_25.avd/cache.img
 emulator: autoconfig: -sdcard /Users//.android/avd/Nexus_One_API_25.avd/sdcard.img
 emulator: Physical RAM size: 2048MB
 tdout
 emulator: VM heap size 96MB is below hardware specified minimum of 192MB,setting it to that value
 emulator: System image is read only
 emulator: autoconfig: -no-snapshot from AVD config.ini
 emulator: Found 1 DNS servers: 10.5.1.1
 emulator: ERROR: There's another emulator instance running with the current AVD 'Nexus_One_API_25'. Exiting...
 tdout
 tdout
 : /Users//Library/Android/sdk/platform-tools/adb  devices
 List of devices attached
 emulator-5556	device
 : stdout:
 : stdout:
3: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 shell getprop d v.bootcomplete
 1 stdout:
 : stdout:
4: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 shell input key vent 82
5: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 uninstall com.m eatclub
 Successt:
 : stdout:
6: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 uninstall com.m eatclub.test
 Successt:
 : stdout:
7: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 shell getprop r .build.version.sdk
 25stdout:
 : stdout:
8: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 install -r -g / sers//iris/android/app/build/outputs/apk/release/app-release.apk
 Successt:
 : stdout:
9: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 shell getprop r .build.version.sdk
 25stdout:
 : stdout:
10: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 install -r -g /Users//iris/android/app/build/outputs/apk/androidTest/release/app-release-android est.apk
 Successut:
 0: stdout:
11: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 shell pm list  nstrumentation
 instrumentation:com.android.emulator.smoketests/android.support.test.runner.AndroidJUnitRunner (target=com.android.emulator.smoketests)
 instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
 instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
 instrumentation:com.myeatclub.test/android.support.test.runner.AndroidJUnitRunner (target=com.myeatclub)
 instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)
 1: stdout:
/Users//Library/Android/sdk/platform-tools/adb -s emulator-5556 shell am instrument -w -r -e detoxServer ws://localhost:51598 -e detoxSessionId d8dbdb72-4566-4c3b-d1f7-d9f9 1d050a5 -e debug false com.myeatclub.test/android.support.test.runner.AndroidJUnitRunner
 23112mentation spawned, childProcess.pid:
 send: {"type":"isReady","params":{},"messageId":-1000}
 role=tester action=isReady (sessionId=d8dbdb72-4566-4c3b-d1f7-d9f9e1d050a5)
 role=testee not connected, cannot fw action (sessionId=d8dbdb72-4566-4c3b-d1f7-d9f9e1d050a5)
 INSTRUMENTATION_STATUS: numtests=1
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: stream=
 com.myeatclub.DetoxTest:
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: test=runDetoxTests
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: class=com.myeatclub.DetoxTest
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: current=1
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS_CODE: 1
 nstrumentation stdout:
 nstrumentation stdout:

 RUNS  e2e/profile.spec.js
@rotemmiz
Copy link
Member

Form the log it seems like everything works correctly. Arm emulators are somewhere between 10 to 50 times slower, is going to be a very bad experience (I wouldn't even bother try running on arm since it really is too slow).
Travis doesn't support x86 either. 😒

@chyrta
Copy link

chyrta commented May 23, 2018

@wontonst We were using CircleCI in our project, but then decided to try Bitrise. It took more than an hour to migrate our configuration to the service. They allow to use x86 Android emulators on Linux-based containers.

@wontonst
Copy link
Author

@rotemmiz thanks for getting back to me. my thought process is I slug through this awful arm slowness, then forget about it and let the ci tests take however long they want to take. I'm also a masochist for frustrating tech issues 😃

Here are some more logs of when detox hangs, do these look normal? The line testee not connected, cannot fw action doesn't seem right.

11: /Users//Library/Android/sdk/platform-tools/adb -s emulator-5554 sh ll pm list instrumentation
 instrumentation:com.android.emulator.smoketests/android.support.test.runner.AndroidJUnitRunner (target=com.android.emulator.smoketests)
 instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
 instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
 instrumentation:com.myeatclub.test/android.support.test.runner.AndroidJUnitRunner (target=com.myeatclub)
 instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)
 1: stdout:
/Users//Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:60589 -e detoxSessionId f3e341a9-ae39-ccc5-cfde-03c356aab2e9 -e debug false com.myeatclub.test/android.sup ort.test.runner.AndroidJUnitRunner
 35945mentation spawned, childProcess.pid:
 send: {"type":"isReady","params":{},"messageId":-1000}
 role=tester action=isReady (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 role=testee not connected, cannot fw action (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 INSTRUMENTATION_STATUS: numtests=1
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: stream=
 com.myeatclub.DetoxTest:
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: test=runDetoxTests
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: class=com.myeatclub.DetoxTest
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS: current=1
 nstrumentation stdout:
 nstrumentation stdout:
 INSTRUMENTATION_STATUS_CODE: 1
 nstrumentation stdout:
 nstrumentation stdout:
 send: {"type":"reactNativeReload","params":{},"messageId":-1000}
 role=tester action=reactNativeReload (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 role=testee not connected, cannot fw action (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 send: {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"android.support.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["Profile"]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForNotNull","args":[]}}]},"messageId":1}
 role=tester action=invoke (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 role=testee not connected, cannot fw action (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 send: {"type":"reactNativeReload","params":{},"messageId":-1000}
 role=tester action=reactNativeReload (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 role=testee not connected, cannot fw action (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 send: {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"android.support.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["Change Password"]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForNotNull","args":[]}}]},"messageId":2}
 role=tester action=invoke (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 role=testee not connected, cannot fw action (sessionId=f3e341a9-ae39-ccc5-cfde-03c356aab2e9)
 FAIL  e2e/profile.spec.js (756.138s)
  ● Profile Page › should allow the user to edit their profile

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

      at ../node_modules/jest-jasmine2/build/queue_runner.js:72:21
      at Timeout.callback [as _onTimeout] (../node_modules/jsdom/lib/jsdom/browser/Window.js:633:19)

@stale
Copy link

stale bot commented Jul 7, 2018

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.

@stale
Copy link

stale bot commented Jul 14, 2018

The issue has been closed for inactivity.

@stale stale bot closed this as completed Jul 14, 2018
@wix wix locked and limited conversation to collaborators Jul 23, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants