Detox icon indicating copy to clipboard operation
Detox copied to clipboard

launchApp not working with deeplink url in IOS

Open urbanclap-admin opened this issue 1 year ago • 8 comments

What happened?

launchApp not working with deeplink url in IOS, only way to get it working is to launchApp first then use openUrl to open the URL.

with the launchApp command app gets stuck on white page.

What was the expected behaviour?

app should have opened with the URL

Was it tested on latest Detox?

  • [X] I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

The following code does not work

await device.launchApp({
        newInstance: true,
        url: "deeplink url",
        permissions: { notifications: "YES", userTracking: "YES" },
      });

In what environment did this happen?

Detox version: 20.13.5 React Native version: 0.67 Has Fabric (React Native's new rendering system) enabled: No Node version: 21.1.0 Device model: simulator iPhone 12 iOS version: IOS 15 macOS version: 12.1 Xcode version: 13 Test-runner (select one): jest

Detox logs

No response

Device logs

No response

More data, please!

The only way to open the deeplink URL is to first launch the app and then open the URL.

the following code works -


beforeEach(async () => {
      await device.launchApp({
        newInstance: true,
      });
    }

  it("successfully resolve URL ", async () => {
 await device.openURL({
    url: "deeplink url,
       });
})

urbanclap-admin avatar Nov 02 '23 09:11 urbanclap-admin

the problem with the above approach is since it launches the app as a new instance, it always shows the first page of the app, instead it should directly open the URL and navigate to the desired page

urbanclap-admin avatar Nov 02 '23 09:11 urbanclap-admin

I can't tell easily, maybe your app registers the handlers too late... 🤔

noomorph avatar Nov 02 '23 15:11 noomorph

I'm experiencing the same problem. I've always had working deeplinks tests in my suite, but since one of the latest Xcode updates I can't get them working anymore (only openUrl works as @urbanclap-admin said).

angelica-snowit avatar Nov 10 '23 15:11 angelica-snowit

it's happening the same here

sergiomap avatar Nov 13 '23 16:11 sergiomap

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!

For more information on bots in this repository, read this discussion.

stale[bot] avatar Dec 15 '23 04:12 stale[bot]

Not stale, just ignored

angelica-snowit avatar Dec 15 '23 08:12 angelica-snowit

Fixed with latest RN upgrade. Just keep ignoring.

angelica-snowit avatar Jan 31 '24 15:01 angelica-snowit

Facing the same issue, but was able to solve it with suggestion above: await device.openURL({ url: deepLink})

And was able to find one more workaround (for those who can't fix with command above):

import { exec } from 'child_process'
exec(`xcrun simctl openurl booted ${deepLink}`)

MadSandwich avatar Aug 09 '24 10:08 MadSandwich