Issue
I want to automate the test of consuming a Firebase Dynamic Link
.
The app responds well from any valid dynamic link that i open from an email but to test it, i need to open the url from my test code.
How can i do it? Loading the url doesn't trigger Android to open my app.
Solution
The solution pass by using ActivityTestRule, like this:
@RunWith(AndroidJUnit4.class)
public class TestYard {
//assign these test rule to the test
@Rule
public ActivityTestRule testRule = new ActivityTestRule(false,false);
@Test
public void testDynamicLink() {
//Dynamic link url
String url = "https://....app.goo.gl/...";
//create intent
Intent intent = new Intent (Intent.ACTION_VIEW);
intent.setData (Uri.parse(url));
//launch activity with the url as intent. Should work exactly as open from the email generated by Firebase invite function.
testRule.launchActivity(intent);
}
}
Check how to prepare the app here.
Answered By - MiguelSlv
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.