本文整理汇总了Java中android.support.test.uiautomator.UiScrollable.getChild方法的典型用法代码示例。如果您正苦于以下问题:Java UiScrollable.getChild方法的具体用法?Java UiScrollable.getChild怎么用?Java UiScrollable.getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.uiautomator.UiScrollable
的用法示例。
在下文中一共展示了UiScrollable.getChild方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test026FoldupAppDetail
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test026FoldupAppDetail() throws UiObjectNotFoundException {
TestUtils.screenshotCap("appStoreHome");
UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
TestUtils.screenshotCap("hotAllInterface");
UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
UiObject fullAppObj = hotAllScroll.getChild(new UiSelector().className("android.widget.FrameLayout"));
fullAppObj.clickAndWaitForNewWindow(LONG_WAIT);
TestUtils.screenshotCap("enterAppDetail");
UiObject2 foldupButton = device.findObject(By.res("woyou.market:id/iv_arrow"));
foldupButton.clickAndWait(Until.newWindow(),LONG_WAIT);
TestUtils.screenshotCap("foldUpAppDetail");
UiScrollable hotAllScroll1 = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
Assert.assertNotNull(hotAllScroll1);
}
示例2: test026FoldupAppDetail
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test026FoldupAppDetail() throws UiObjectNotFoundException {
TestUtils.screenshotCap("appStoreHome");
UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
TestUtils.screenshotCap("hotAllInterface");
UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
UiObject fullAppObj = hotAllScroll.getChild(new UiSelector().resourceId("woyou.market:id/app_view"));
fullAppObj.clickAndWaitForNewWindow(LONG_WAIT);
TestUtils.screenshotCap("enterAppDetail");
UiObject2 foldupButton = device.findObject(By.res("woyou.market:id/iv_arrow"));
foldupButton.clickAndWait(Until.newWindow(),LONG_WAIT);
TestUtils.screenshotCap("foldUpAppDetail");
UiScrollable hotAllScroll1 = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
Assert.assertNotNull(hotAllScroll1);
}
示例3: mainActivity_changeGridSize
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void mainActivity_changeGridSize() throws Exception {
UiScrollable recycleView = new UiScrollable(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/trendRecycleView")
.className(RecyclerView.class));//recycleView.click();
UiObject item = recycleView.getChild(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/googleTrendView"));
item.click();
String gridDescription = InstrumentationRegistry.getInstrumentation().getTargetContext().getString(R.string.choose_grid);
UiObject grid = mDevice.findObject(new UiSelector().descriptionContains(gridDescription));
grid.click();
UiObject gridList = mDevice.findObject(new UiSelector().text("2*2"));
gridList.click();
mDevice.waitForIdle();
takeScreenShot("Change_grid_to_2_2.jpg");
mDevice.pressHome();
takeScreenShot("Home.jpg");
}
示例4: test023CheckAppDetail
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test023CheckAppDetail() throws UiObjectNotFoundException {
TestUtils.screenshotCap("appStoreHome");
UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
TestUtils.screenshotCap("hotAllInterface");
UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
UiObject fullAppObj = hotAllScroll.getChild(new UiSelector().className("android.widget.FrameLayout"));
String appName = fullAppObj.getChild(new UiSelector().resourceId("woyou.market:id/tv_name")).getText();
fullAppObj.clickAndWaitForNewWindow(LONG_WAIT);
TestUtils.screenshotCap("enterHotAppsFirstOne");
UiObject2 nameObj = device.findObject(By.res("woyou.market:id/tv_name"));
Assert.assertEquals("期望的名字是"+appName+",而实际是"+nameObj.getText(),appName,nameObj.getText());
}
示例5: test023CheckAppDetail
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test023CheckAppDetail() throws UiObjectNotFoundException {
TestUtils.screenshotCap("appStoreHome");
UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
TestUtils.screenshotCap("hotAllInterface");
UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
UiObject fullAppObj = hotAllScroll.getChild(new UiSelector().resourceId("woyou.market:id/app_view"));
String appName = fullAppObj.getChild(new UiSelector().resourceId("woyou.market:id/tv_name")).getText();
fullAppObj.clickAndWaitForNewWindow(LONG_WAIT);
TestUtils.screenshotCap("enterHotAppsFirstOne");
UiObject2 nameObj = device.findObject(By.res("woyou.market:id/tv_name"));
Assert.assertEquals("期望的名字是"+appName+",而实际是"+nameObj.getText(),appName,nameObj.getText());
}
示例6: mainActivity_RecycleViewChangeCountry
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void mainActivity_RecycleViewChangeCountry() throws Exception {
UiScrollable recycleView = new UiScrollable(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/trendRecycleView")
.className(RecyclerView.class));//recycleView.click();
UiObject item = recycleView.getChild(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/googleTrendView"));
item.click();
item.click();
mDevice.waitForIdle();
takeScreenShot("Country_menu_page.jpg");
}
示例7: mainActivity_changeLanguageToEnglish
import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void mainActivity_changeLanguageToEnglish() throws Exception {
UiScrollable recycleView = new UiScrollable(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/trendRecycleView")
.className(RecyclerView.class));//recycleView.click();
UiObject item = recycleView.getChild(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/googleTrendView"));
item.click();
item.click();
mDevice.waitForIdle();
takeScreenShot("Country_chinese.jpg");
mDevice.pressHome();
// Validate that the package name is the expected one
Context context = InstrumentationRegistry.getContext();
final Intent intent = context.getPackageManager().getLaunchIntentForPackage(SETTING_PACKAGE);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Clear out any previous instances
context.startActivity(intent);
mDevice.wait(Until.hasObject(By.pkg(SETTING_PACKAGE).depth(0)), LAUNCH_TIMEOUT);
if(selectSettingsFor("語言與輸入設定")){
UiObject language = mDevice.findObject(new UiSelector().text("語言"));
language.click();
takeScreenShot("language_setting.jpg");
//Click english language item
UiScrollable languageFrame = new UiScrollable(SettingsHelper.FRAMELAYOUT_VIEW);
UiObject englishLanguageItem = languageFrame.getChildByText(SettingsHelper.LIST_VIEW_ITEM, "English (United States)");
englishLanguageItem.click();
mDevice.pressHome();
// Wait for launcher
final String launcherPackage = mDevice.getLauncherPackageName();
assertThat(launcherPackage, notNullValue());
mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)),
LAUNCH_TIMEOUT);
// Launch the blueprint app
final Intent intentAPP = context.getPackageManager().getLaunchIntentForPackage(BASIC_PACKAGE);
intentAPP.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Clear out any previous instances
context.startActivity(intentAPP);
// Wait for the app to appear
mDevice.wait(Until.hasObject(By.pkg(BASIC_PACKAGE).depth(0)), LAUNCH_TIMEOUT);
// UiScrollable recycleView = new UiScrollable(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/trendRecycleView")
// .className(RecyclerView.class));//recycleView.click();
// UiObject item = recycleView.getChild(new UiSelector().resourceId("com.fantasyfang.googletrendapp:id/googleTrendView"));
item.click();
item.click();
mDevice.waitForIdle();
takeScreenShot("Country_english.jpg");
}
}