4

Need some help with Detox. I’ve got a similar issue to https://github.com/wix/detox/issues/272



We have a Pubnub publish-subscribe SDK included in our app. So, when running a detox test, it will always time out, because it will wait for the connection to close.

I’ve tried both setURLBlacklist on launch and detoxURLBlacklistRegex but with no luck. The logs still say:

[com.wix.Detox:EarlGreyStatistics] App State -> busy Waiting for network requests to finish: (
    "https://ps15.pndsn.com/v2/subscribe/sub-c-xxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”

I’m fairly positive my regex is correct. The regex mentioned in the issue mentioned above doesn’t work. I wouldn't normally ask for help with simple regex, but my knowledge of EarlGrey is minimal and i've been battling with this for a while.

I need to ignore all requests made to ps[0-9][0-9].pndsn. A little help with the regex, or Blacklist array would be much appreciated.

  await device.launchApp({permissions: { notifications: 'YES' }, launchArgs: { 'detoxPrintBusyIdleResources': 'YES' , 'detoxURLBlacklistRegex' : '\\(".*pndsn.com.*"\\)'}});
  await device.setURLBlacklist([".*ps1.pndsn.com.*",".*ps2.pndsn.com.*",".*ps3.pndsn.com.*",".*ps4.pndsn.com.*",".*ps5.pndsn.com.*",".*ps6.pndsn.com.*",".*ps7.pndsn.com.*",".*ps8.pndsn.com.*",".*ps9.pndsn.com.*",".*ps10.pndsn.com.*",".*ps11.pndsn.com.*",".*ps12.pndsn.com.*",".*ps13.pndsn.com.*",".*ps14.pndsn.com.*",".*ps15.pndsn.com.*",".*ps16.pndsn.com.*",".*ps17.pndsn.com.*",".*ps18.pndsn.com.*",".*ps19.pndsn.com.*.",".*ps20.pndsn.com.*"]);

Note: If I disable synchronisation the app hangs on initialisation. This is for an iOS app.

mckenzit
  • 53
  • 1
  • 6
  • Hello, I see that you are setting the URL blacklist after launch. That means that your app might already be stuck. Better to set it as a launch argument – Léo Natan Jan 13 '20 at 16:53
  • If it still doesn't work, follow [this guide](https://github.com/wix/Detox/blob/master/docs/Guide.DebuggingInXcode.md), put a breakpoint inside Earl Grey's matching and see why your regexes fail. – Léo Natan Jan 13 '20 at 16:54
  • 2
    Why `.*ps...` and not `https://ps...` as the pattern? – Craig Conover Jan 13 '20 at 17:08
  • @leoNatan relating to the aforementioned guide, I unfortunately don't see embedded binaries in xcode. Is it because . . . "Embedded Binaries tab doesn't show up in Xcode if you're in a command line project instead of a cocoa project and you're targeting Mac OS X" Let me know how to bring embedded binaries into my project settings. – mckenzit Jan 14 '20 at 09:31
  • Try following Craig's advice. – Léo Natan Jan 14 '20 at 09:32
  • I think the guide is a little outdated with Xcode 11. I will update it now. – Léo Natan Jan 14 '20 at 09:34
  • @LeoNatan i'm now using Craig's suggestion: '\\("https://ps[0-9][0-9]?://pndsn.com.*"\\)' but with no luck. – mckenzit Jan 14 '20 at 10:39
  • https://github.com/wix/Detox/issues/1861 – mckenzit Jan 20 '20 at 16:59

1 Answers1

0

As mentioned in a collapsed comment to the question, the url blacklist in launchArgs is not working in Detox at the moment. See https://github.com/wix/Detox/issues/1861 for further discussion.

cs01
  • 5,287
  • 1
  • 29
  • 28