Detox
Detox copied to clipboard
launchApp not working with deeplink url in IOS
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?
- [X] I have followed the instructions under Identifying which synchronization mechanism causes us to wait too much.
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,
});
})
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
I can't tell easily, maybe your app registers the handlers too late... 🤔
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).
it's happening the same here
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.
Not stale, just ignored
Fixed with latest RN upgrade. Just keep ignoring.
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}`)