I am trying to create a test script for my MainActivity. This main class has a QR-code scanner. At this moment I can scan a QR-code while testing with my phone, however I want be able to do this with an emulator. The text in my QR-code contains only a string: "start1".
This is my test script:
@Test
public void shouldRenderView() throws Exception {
rule.launchActivity(new Intent());
onView(withId(R.id.textStatus)).check(matches(withText("Inruimen")));
onView(withId(R.id.scan_btn)).perform(click());
pressBack();
Thread.sleep(5000);
//within this period I scan the code.
onView(withId(R.id.textStatus)).check(matches(withText("draaien")));
}
Aucun commentaire:
Enregistrer un commentaire