Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Last active December 13, 2017 10:44
Show Gist options
  • Save EmmanuelGuther/1205a53d11295e149ab61139bedc9873 to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/1205a53d11295e149ab61139bedc9873 to your computer and use it in GitHub Desktop.
AndroidTest instrumentation: Check if activity is was launched
Instrumentation.ActivityMonitor activityBackMonitor = getInstrumentation().addMonitor(StationsActivity.class.getName(), null, false);
//CHECK IF ACTIVITY IS LAUNCHED
StationDetailActivity nextActivity = (StationDetailActivity) getInstrumentation().waitForMonitorWithTimeout(activityMonitor, 5000);
// next activity is opened and captured.
assertNotNull(nextActivity);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment