Closed SebastianKlaiber closed 1 month ago
Hi Sebastian, thanks for creating this issue! Looks like a cool feature to have.
Let me clarify a bit: what would the openLink()
method do? Would it call adb
? Like this:
$ adb shell am start -a android.intent.action.VIEW -d "example://gizmos" com.my.app
Or maybe you have another idea on how this could work? If yes I'd be happy if you shared them:)
Also, the solution has to be cross-platform solution (both Android and iOS).
Yes, exactly it should call adb for android and for ios simctl openurl booted "example://gizmos"
Dear testers: @jBorkowska, @fylyppo, @Kendru98, @zoskar, and our dear external user @lmlikota – please chip in :)
The simplest version could be:
class HostAutomator {
Future<void> openLink(String url);
}
So await $.host.openLink("example://gizmos")
would result in adb shell am start -d "example://gizmos"
. But that's kinda limiting because, as you could see in a comment above, adb
supports more options (docs here)
@SebastianKlaiber
Yes, exactly it should call adb for android and for ios simctl openurl booted "example://gizmos"
And what about physical iOS devices? Do you have some idea?
If we're talking about e2e testing, I don't see a use case for that - user never provides a literal link as a deeplink. If we're talking about cases, when we can't perform the action that opens a deeplink (eg. it requires real payment), then I understand - but again, I don't know how those links work, but if providing a link is sufficient from technical perspective, so is for us.
Most common cases:
It should be possible to run ActivityManager from Java/Kotlin code within the app.
We would need to add this to adb shell commands in order to test dynamic links:
-W -a android.intent.action.VIEW
The proper way to test it for Android via adb
:
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://your.domain.com/path?param1=1%26param2=2"
The above tries to open some app to show the content of the link. It may be some app that is already installed on a device, or it may be a browser, or it may be an Instant App.
So, in general, the feature should simulate OS's action for following a link on a device under test. Is this something in scope for patrol even?
@jBorkowska There is definitely a test case for e2e testing in regards to deep links. Or, I should rather refer to them as "App Links" (in Android lingo). The test case is:
Granted, the journey doesn't start within the app under test, I can see why this may be outside of scope for patrol though. But damn it would be so nice to have.
There is another example "somewhat from within the app":
My 2 cents: Of course we can already write tests by passing a link directly to App in Dart, but being able to write E2E tests would be much better because that would also cover:
@bartekpacia I'd like to inquire about bringing back host functionality, so that I can run $.host.runProcess('adb shell...')
. Is it in the plans? Having the ability to test deep links is crucial for my project.
Hi @Sevastyan – I no longer work on Patrol, so I can't answer. But if such functionality was re-introduced, it would only work in places where you can directly run patrol_cli
. This excludes "device farm" services like Firebase Test Lab, emulator.wtf, or BrowserStack. You'd have to use a "full-blown" CI service like GitHub Actions or CircleCI. Ultimately it's all about tradeoffs.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.
Hi,
is there a way to test deep links with patrol? I've only found the open App method, but I want to specify a URL and check if my app opens and navigates to the correct page.
e.g.:
await $.native.openLink(link: 'http://www.example.com/passwordrest');