I would like to make sure that when a user presses a "close" button, he will not see the activity under test but a "home" screen.
Using Robotium I can write e.g.
@Override
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(),getActivity());
}
public void testMainUseCase() throws InterruptedException {
solo.clickOnText("close");
Log.w("CURRENT_ACT", solo.getCurrentActivity().getClass().toString());
}
But in logs I get then "MainActivity" (which is the Activity Under Test) even if I can see on my device that the activity went off.
On the other hand, using Roboelectric I can write such a snippet:
@Test
public void shouldStopWhenRejectButtonClicked() throws Exception {
activity.onCreate(null);
clickOn(activity.findViewById(R.id.close));
}
But again, I have no idea how to check that the activity user sees is no more the Activity Under Test.