本文整理汇总了Java中android.support.test.uiautomator.UiDevice.pressHome方法的典型用法代码示例。如果您正苦于以下问题:Java UiDevice.pressHome方法的具体用法?Java UiDevice.pressHome怎么用?Java UiDevice.pressHome使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.uiautomator.UiDevice
的用法示例。
在下文中一共展示了UiDevice.pressHome方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openAppTest
import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
@Test
public void openAppTest() throws Exception {
UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
mDevice.pressHome();
// Bring up the default launcher by searching for a UI component
// that matches the content description for the launcher button.
UiObject allAppsButton = mDevice
.findObject(new UiSelector().description("Apps"));
// Perform a click on the button to load the launcher.
allAppsButton.clickAndWaitForNewWindow();
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.wbrawner.simplemarkdown", appContext.getPackageName());
UiScrollable appView = new UiScrollable(new UiSelector().scrollable(true));
UiSelector simpleMarkdownSelector = new UiSelector().text("Simple Markdown");
appView.scrollIntoView(simpleMarkdownSelector);
mDevice.findObject(simpleMarkdownSelector).clickAndWaitForNewWindow();
}
示例2: launchClickHome
import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
@Override
protected void launchClickHome() {
Log.i(runner.chimpTag("[email protected]"), "ClickHome");
// Espresso.onView(isRoot()).perform( new ChimpStagingAction() );
UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
mDevice.pressHome();
// Espresso.onView(isRoot()).perform(pressKey(KeyEvent.KEYCODE_HOME));
// kickBackExperiment();
}
示例3: start
import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
/**
* <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();
}
示例4: end
import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
/**
* <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();
}