Detox: Timeout with long-polling connection

Created on 12 Sep 2017  路  4Comments  路  Source: wix/Detox

Description

We are building an RN app with the Pubnub publish-subscribe SDK included. Apparently this SDK relies on long-polling data. So, when running a detox test with an open Pubnub subscription, it will always time out, because it will wait forever for the connection to close.

When running with debug-synchronization this is the output:

detox info Sync App State: Waiting for network requests to finish.: (
detox info Sync     "https://ps16.pndsn.com/v2/subscribe/sub-c-xxx/xxx/0?heartbeat=300&tt=123&tr=123&uuid=123&pnsdk=PubNub-JS-ReactNative%2F4.15.1&auth=xxx"
detox info Sync )

Is there a way to manually ignore that connection? I have also found How do we turn off automatic synchronization?, but this isn't useable yet, is it?

Steps to Reproduce

  1. use Pubnub (or another library with long-polling)
  2. write an detox test for it
  3. test will time out due to the long polling connection never closing

Node, Device, Xcode and macOS Versions

  • Node: 5.3.0
  • Yarn: 1.0.1
  • Device: iPhone 7 Plus
  • Xcode: 8.3.3
  • macOS: macOS Sierra 10.12.6
questiostack overflow

All 4 comments

You're right, this section of the docs was not updated.
Here is the related API you need: https://github.com/wix/detox/blob/master/docs/APIRef.DeviceObjectAPI.md#deviceseturlblacklisturls

I'll update the docs and close this issue, please keep it open till docs are updated.
Thanks!

Docs are updated

Thank you very much for that fast and helpful response!
Using device.setURLBlacklist(['.*pndsn\\.com.*'])works perfectly!

One small thing, though. In the docs for setURLBlacklist() it says to block urls like this: '.*my.ignored.endpoint.*'. But shouldn't it be a regex, as stated in the EarlGrey docs? So the dot should be escaped?

You're probably right, I believe this is a mistake in our docs

Was this page helpful?
0 / 5 - 0 ratings