Java Code Examples for android.support.test.uiautomator.UiDevice#pressHome()

The following examples show how to use android.support.test.uiautomator.UiDevice#pressHome() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTest.java    From SmoothClicker with MIT License 5 votes vote down vote up
/**
 * <i>The tests have to start from the screen home</i>
 */
@BeforeClass
public static void start(){
    l("AbstractTest","@BeforeClass start");
    UiDevice d = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    d.pressHome();
}
 
Example 2
Source File: AbstractTest.java    From SmoothClicker with MIT License 5 votes vote down vote up
/**
 * <i>The device should be at its initial state when all tests are done</i>
 */
@AfterClass
public static void end(){
    l("AbstractTest","@AfterClass end");
    UiDevice d = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    d.pressHome();
}
 
Example 3
Source File: UiHelper.java    From AppCrawler with Apache License 2.0 5 votes vote down vote up
public static void launchCrawlerApp() {
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    device.pressHome();
    FileLog.i(TAG_MAIN, "{Launch} " + Config.sCrawlerPackage);
    Context context = InstrumentationRegistry.getContext();
    Intent intent = context.getPackageManager().getLaunchIntentForPackage(Config.sCrawlerPackage);
    context.startActivity(intent);
}
 
Example 4
Source File: UiHelper.java    From AppCrawler with Apache License 2.0 5 votes vote down vote up
public static void launchHome() {
    FileLog.i(TAG_MAIN, "{Press} Home");

    UiDevice uidevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    uidevice.pressHome();
    String launcherPackage = uidevice.getLauncherPackageName();
    uidevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), Config.sLaunchTimeout);
}
 
Example 5
Source File: UnifiedFragmentHelperTest.java    From OPFIab with Apache License 2.0 4 votes vote down vote up
private static void changeToHomeScreen(UiDevice uiDevice) throws InterruptedException {
    uiDevice.pressHome();
    Thread.sleep(WAIT_REOPEN_ACTIVITY);
}