Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Resuming the app with a url causes detox to hang and time-out #1125

Closed
d4vidi opened this issue Jan 22, 2019 · 0 comments
Closed

Resuming the app with a url causes detox to hang and time-out #1125

d4vidi opened this issue Jan 22, 2019 · 0 comments

Comments

@d4vidi
Copy link
Collaborator

d4vidi commented Jan 22, 2019

Description

On Android, resuming a background app with a supported url (provided as an arg to launchApp) results in a timeout. This distinctively happens in case the app activity has been set launchMode=singleInstance.

     Error: Error: Could not launch intent Intent { act=android.intent.action.VIEW dat=mytestscheme://test-string flg=0x10000000 cmp=com.somevendor/com.example.MainActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1548160484943 and now the last time the queue went idle was: 1548160534341. If these numbers are the same your activity might be hogging the event queue.
      at Client.execute (node_modules/detox/src/client/Client.js:80:28)
      at InvocationManager.execute (node_modules/detox/src/invoke.js:11:33)
      at EmulatorDriver.deliverPayload (node_modules/detox/src/devices/drivers/AndroidDriver.js:145:36)
      at Device.launchApp (node_modules/detox/src/devices/Device.js:87:33)
      at Context.it.only (e2e/15.urls.test.js:31:18)
      at <anonymous>

The timeout takes place albeit the activity and expected content clearly residing in the foreground.

Steps to Reproduce

The following combination of a test and a main-activity definition will result in the aforementioned timeout:

AndroidManifest.xml:

     <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleInstance">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="mytestscheme"/>
        </intent-filter>
      </activity>

Test (JS):

const url = 'mytestscheme://test-string';
await device.launchApp({newInstance: true});
await device.sendToHome();
await device.launchApp({newInstance: false, url: url});

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 9.1.2
  • React Native: 0.51
  • Node: 9.11.2
  • Device: Pixel 2 API 28 emulator
  • IDE: Android Studio 3.3
  • macOS: 10.13.6 (HS)

Device and verbose Detox logs

See description.

@d4vidi d4vidi self-assigned this Jan 22, 2019
@d4vidi d4vidi closed this as completed Feb 10, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant