use of android.app.Instrumentation.ActivityMonitor in project welcome-android by stephentuso.
the class WelcomeScreenHelperAndroidTest method testShow.
@Test
public void testShow() {
ActivityMonitor monitor = new ActivityMonitor(DefaultWelcomeActivity.class.getName(), null, false);
instrumentation.addMonitor(monitor);
String key = WelcomeUtils.getKey(DefaultWelcomeActivity.class);
WelcomeSharedPreferencesHelper.storeWelcomeCompleted(activity, key);
assertFalse(helper.show(null));
assertFalse(helper.show(new Bundle()));
WelcomeSharedPreferencesHelper.removeWelcomeCompleted(activity, key);
assertTrue(helper.show(null));
assertFalse(helper.show(null));
Activity welcomeActivity = instrumentation.waitForMonitor(monitor);
assertNotNull(welcomeActivity);
WelcomeSharedPreferencesHelper.removeWelcomeCompleted(activity, key);
Bundle state = new Bundle();
helper.onSaveInstanceState(state);
assertFalse(helper.show(state));
}
use of android.app.Instrumentation.ActivityMonitor in project appium-espresso-driver by appium.
the class CreateSession method startActivity.
private void startActivity(String appActivity) {
System.out.println("Starting activity '" + appActivity + "'");
Instrumentation mInstrumentation = InstrumentationRegistry.getInstrumentation();
ActivityMonitor mSessionMonitor = mInstrumentation.addMonitor(appActivity, null, false);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName(mInstrumentation.getTargetContext(), appActivity);
mInstrumentation.startActivitySync(intent);
Activity mCurrentActivity = mInstrumentation.waitForMonitor(mSessionMonitor);
System.out.println("Activity '" + mCurrentActivity.getLocalClassName() + "' started");
}
use of android.app.Instrumentation.ActivityMonitor in project welcome-android by stephentuso.
the class WelcomeScreenHelperAndroidTest method testForceShow.
@Test
public void testForceShow() {
ActivityMonitor monitor = new ActivityMonitor(DefaultWelcomeActivity.class.getName(), null, false);
instrumentation.addMonitor(monitor);
helper.forceShow();
Activity welcomeActivity = instrumentation.waitForMonitor(monitor);
assertNotNull(welcomeActivity);
}
Aggregations