0

I've been trying to get iOS Universal Links to work with Detox using device.openURL from https://github.com/wix/Detox/blob/master/docs/APIRef.MockingOpenFromURL.md but it does not work.

Sample of what I've tried:

it('should work', async () => {
  await device.sendToHome();
  await device.openURL({
    url: 'https://name.page.link/somewhere,
    sourceApp: 'com.apple.MobileSMS'
  });
});

It never opens my app and after testing various things it seems detox only support deep links and not universal links.

I can mention that when running the app (both on device and simulator) the universal links work fine which leads me to believe the issue is not with how I have configured universal links but with detox support for it.

In iOS UI Testing it is doable to test universal links by going through iMessage app (see https://blog.branch.io/ui-testing-universal-links-in-xcode-9/). Anyone know of a similar workaround for detox?

jbohman
  • 1
  • 1
  • 1

1 Answers1

0

You used this code in AppDelegate.m:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RCTLinkingManager application:application openURL:url
                  sourceApplication:sourceApplication annotation:annotation];
}

But it is not supported by Detox. You should use:

- (BOOL)application:(UIApplication *)app
        openURL:(NSURL *)url
        options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
  return [RCTLinkingManager application:app openURL:url
                            options:options];
}
mgz
  • 1
  • 1
  • 4
  • Indeed. `application:openURL:sourceApplication:annotation:` is old and deprecated, and should not be used. Since Detox does not support iOS 9, we don't check for this method and do not call it. – Léo Natan Mar 31 '19 at 10:06