当前位置: 首页>>代码示例>>Java>>正文


Java UiScrollable.scrollTextIntoView方法代码示例

本文整理汇总了Java中android.support.test.uiautomator.UiScrollable.scrollTextIntoView方法的典型用法代码示例。如果您正苦于以下问题:Java UiScrollable.scrollTextIntoView方法的具体用法?Java UiScrollable.scrollTextIntoView怎么用?Java UiScrollable.scrollTextIntoView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.test.uiautomator.UiScrollable的用法示例。


在下文中一共展示了UiScrollable.scrollTextIntoView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test020EnterFeedback

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Category(CategoryAppStoreTests_v3_3_15.class)
    @Test
    public void test020EnterFeedback() throws UiObjectNotFoundException {
        TestUtils.screenshotCap("appStoreHome");
        UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
        mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
        TestUtils.screenshotCap("mineHome");
        UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
        mineScroll.scrollTextIntoView("反馈");
        TestUtils.screenshotCap("ScrollToFeedbackInterface");
        UiObject2 feedbackObj = device.findObject(By.text("反馈"));
        feedbackObj.clickAndWait(Until.newWindow(),LONG_WAIT);
        TestUtils.screenshotCap("enterFeedbackInterface");
        String currentPkgName = device.getCurrentPackageName();
//        for (int i = 0; i <10 ; i++) {
//            Log.v("myautotest1",device.getCurrentPackageName());
//            sleep(500);
//        }
        Assert.assertEquals("期望当前包名为com.sunmi.userfeedback,而实际为"+currentPkgName,"com.sunmi.userfeedback",currentPkgName);
    }
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:21,代码来源:SunmiAppStore_v3_3_15.java

示例2: clickListViewItem

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
public static boolean clickListViewItem(String name) {
    UiScrollable listView = new UiScrollable(new UiSelector());
    listView.setMaxSearchSwipes(4);
    listView.waitForExists(3000);
    UiObject listViewItem;
    try {
        if (listView.scrollTextIntoView(name)) {
            listViewItem = listView.getChildByText(new UiSelector()
                    .className(TextView.class.getName()), "" + name + "");
            listViewItem.click();
        } else {
            return false;
        }
    } catch (UiObjectNotFoundException e) {
        return false;
    }
    return true;
}
 
开发者ID:akvo,项目名称:akvo-caddisfly,代码行数:19,代码来源:TestUtil.java

示例3: test022Search

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test022Search() throws UiObjectNotFoundException {
    if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)){
        Log.v("myautotest1","233333333");
        UiObject2 searchBtnObj = device.findObject(By.res("com.android.settings:id/search"));
        searchBtnObj.clickAndWait(Until.newWindow(),LONG_WAIT);
        UiObject2 searchTextObj = device.findObject(By.focused(true));
        searchTextObj.setText("W");
        UiScrollable resultScroll = new UiScrollable(new UiSelector().resourceId("com.android.settings:id/list_results"));
        Boolean searched = resultScroll.scrollTextIntoView("WLAN");
        Assert.assertTrue("未搜索到要查找的WLAN",searched);
    }
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:14,代码来源:SunmiSettings.java

示例4: test063CheckShowPasswordStatus

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test063CheckShowPasswordStatus() throws UiObjectNotFoundException {
    if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)) {
        UiScrollable SettingScoll = new UiScrollable(new UiSelector().resourceId("android:id/content"));
        SettingScoll.scrollTextIntoView("安全");
        device.findObject(By.text("安全")).clickAndWait(Until.newWindow(), 5000);
        UiScrollable SwitchScoll = new UiScrollable(new UiSelector().resourceId("android:id/list"));
        SwitchScoll.scrollTextIntoView("显示密码");
        UiObject2 SwitchObj = device.findObjects(By.res("android:id/switchWidget")).get(0);
        Assert.assertTrue("测试失败,显示密码默认不是打开", SwitchObj.isChecked());

    }
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:14,代码来源:SunmiSettings.java

示例5: test067CheckAutoGetTimeZoneStatus

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test067CheckAutoGetTimeZoneStatus() throws UiObjectNotFoundException {
    if ("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL));
    UiScrollable SettingScroll = new UiScrollable(new UiSelector().resourceId("android:id/content"));
    SettingScroll.scrollTextIntoView("日期和时间");
    device.findObject(By.text("日期和时间")).clickAndWait(Until.newWindow(),5000);
    UiScrollable DateScroll = new UiScrollable(new UiSelector().resourceId("android:id/list"));
    DateScroll.scrollTextIntoView("自动确定日期和时间");
    UiObject2 DataObj = device.findObjects(By.res("android:id/switchWidget")).get(0);
    Assert.assertTrue("测试失败,自动确定时区开关默认不是打开",DataObj.isChecked());


}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:14,代码来源:SunmiSettings.java

示例6: test071Check24HFormatStatus

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test071Check24HFormatStatus() throws UiObjectNotFoundException {
    if ("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL));
    UiScrollable SettingScroll = new UiScrollable(new UiSelector().resourceId("android:id/content"));
    SettingScroll.scrollTextIntoView("日期和时间");
    device.findObject(By.text("日期和时间")).clickAndWait(Until.newWindow(),5000);
    UiScrollable DataScroll = new UiScrollable(new UiSelector().resourceId("android:id/list"));
    DataScroll.scrollTextIntoView("使用24小时制");
    UiObject2 FormatObj = device.findObjects(By.res("android:id/switchWidget")).get(1);
    Assert.assertTrue("测试失败,使用24小时制开关默认不是打开状态",FormatObj.isChecked());
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:12,代码来源:SunmiSettings.java

示例7: test021CheckServiceProvider

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test021CheckServiceProvider() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
    mineScroll.scrollTextIntoView("服务商");
    TestUtils.screenshotCap("ScrollToServicePro");
    UiObject2 serviceProObj = device.findObject(By.text("服务商"));
    Assert.assertNotNull("未找到服务商信息",serviceProObj);
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:14,代码来源:SunmiAppStore_v3_3_15.java

示例8: test022CheckRecentVersion

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test022CheckRecentVersion() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(), LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
    mineScroll.scrollTextIntoView("当前版本");
    TestUtils.screenshotCap("scrollToCurVersion");
    UiObject2 serviceProObj = device.findObject(By.text("当前版本"));
    Assert.assertNotNull("未找到版本信息", serviceProObj);
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:14,代码来源:SunmiAppStore_v3_3_15.java

示例9: test008InstallAppFromHot

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test008InstallAppFromHot() throws UiObjectNotFoundException, IOException {
    device.registerWatcher("downLoadFail", new UiWatcher() {
        @Override
        public boolean checkForCondition() {
            UiObject2 confirmObj = device.findObject(By.res("woyou.market:id/tv_confirm"));
            if(null != confirmObj){
                confirmObj.clickAndWait(Until.newWindow(),LONG_WAIT);
                return true;
            }
            return false;
        }
    });

    TestUtils.screenshotCap("appStoreHome");
    UiObject2 hotObj = device.findObject(By.res("woyou.market:id/tv_hot_all").text("全部"));
    hotObj.clickAndWait(Until.newWindow(), LONG_WAIT);
    TestUtils.screenshotCap("allHotAppsInterface");
    UiScrollable hotAllScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/list_view"));
    hotAllScroll.scrollTextIntoView("安装");
    TestUtils.screenshotCap("ScrollToInstallableInterface");
    UiObject2 installObj = device.findObject(By.text("安装"));
    UiObject2 fullInstallObj = installObj.getParent().getParent();
    UiObject2 installNameObj = fullInstallObj.findObject(By.res("woyou.market:id/tv_name"));
    String name = installNameObj.getText();
    UiObject2 installObjnew =  fullInstallObj.getParent().findObject(By.text("安装"));
    installObjnew.click();
    TestUtils.screenshotCap("afterClickInstallBtn");
    boolean installSucc = installObjnew.wait(Until.textEquals("打开"),DOWNLOAD_WAIT);
    if(!installSucc){
        installObjnew.click();
        TestUtils.screenshotCap("installFailed");
        Assert.fail("下载安装了300秒,仍然未安装好,暂停了下载");
    }
    TestUtils.screenshotCap("afterInstalled");
    device.pressHome();
    Boolean b = TestUtils.findAppByText(name);
    TestUtils.screenshotCap("findInstalledApp");
    Assert.assertTrue("桌面上未找到\""+name+"\"这个应用",b);
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:41,代码来源:SunmiAppStore.java

示例10: test020EnterFeedback

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test020EnterFeedback() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
    mineScroll.scrollTextIntoView("反馈");
    TestUtils.screenshotCap("ScrollToFeedbackInterface");
    UiObject2 feedbackObj = device.findObject(By.text("反馈"));
    feedbackObj.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("enterFeedbackInterface");
    String currentPkgName = device.getCurrentPackageName();
    Assert.assertEquals("期望当前包名为com.sunmi.userfeedback,而实际为"+currentPkgName,"com.sunmi.userfeedback",currentPkgName);
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:16,代码来源:SunmiAppStore.java

示例11: test021CheckServiceProvider

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test021CheckServiceProvider() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(),LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
    mineScroll.scrollTextIntoView("服务商");
    TestUtils.screenshotCap("ScrollToServicePro");
    UiObject2 serviceProObj = device.findObject(By.text("服务商"));
    Assert.assertNotNull("未找到服务商信息",serviceProObj);
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:13,代码来源:SunmiAppStore.java

示例12: test022CheckRecentVersion

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
public void test022CheckRecentVersion() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 mineEntrence = device.findObject(By.res("woyou.market:id/fab_me"));
    mineEntrence.clickAndWait(Until.newWindow(), LONG_WAIT);
    TestUtils.screenshotCap("mineHome");
    UiScrollable mineScroll = new UiScrollable(new UiSelector().className("android.widget.ScrollView"));
    mineScroll.scrollTextIntoView("当前版本");
    TestUtils.screenshotCap("scrollToCurVersion");
    UiObject2 serviceProObj = device.findObject(By.text("当前版本"));
    Assert.assertNotNull("未找到版本信息", serviceProObj);
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:13,代码来源:SunmiAppStore.java

示例13: findButtonInScrollable

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@SuppressWarnings("SameParameterValue")
static void findButtonInScrollable(String name) {
    UiScrollable listView = new UiScrollable(new UiSelector().className(ScrollView.class.getName()));
    listView.setMaxSearchSwipes(10);
    listView.waitForExists(5000);
    try {
        listView.scrollTextIntoView(name);
    } catch (Exception ignored) {
    }
}
 
开发者ID:akvo,项目名称:akvo-caddisfly,代码行数:11,代码来源:TestUtil.java

示例14: test016CheckAddVPN

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Test
    public void test016CheckAddVPN() throws UiObjectNotFoundException {
        if("V1".equals(Build.MODEL) || "P1".equals(Build.MODEL)) {
            screenshotCap("after_enter");
            //进入到更多中找到VPN选项进入
            UiObject2 moreObj = device.findObject(By.text("更多"));
            moreObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            UiObject2 VPNObj = device.findObject(By.text("VPN"));
            VPNObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            //判断VPN下为空
            UiObject2 VPNListObj = device.findObject(By.res("android:id/list"));
            Assert.assertEquals("VPN列表下不为空", 0, VPNListObj.getChildCount());
            //点击新增VPN按钮
            UiObject2 addObj = device.findObject(By.res("com.android.settings:id/vpn_create"));
            addObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            sleep(SHORT_SLEEP);
            UiObject2 confirmObj = device.findObject(By.res("android:id/button1"));
            confirmObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            sleep(SHORT_SLEEP);
            //选择图案加密项
            UiObject2 picObj = device.findObject(By.text("图案"));
            picObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            sleep(SHORT_SLEEP);
            //确定所要绘制的图案为倒L形
            TestUtils.drawLPattern();
            sleep(SHORT_SLEEP);
            UiObject2 goonObj = device.findObject(By.res("com.android.settings:id/footerRightButton"));
            goonObj.click();
            sleep(SHORT_SLEEP);
            TestUtils.drawLPattern();
            sleep(SHORT_SLEEP);
            UiObject2 confirmObj1 = device.findObject(By.res("com.android.settings:id/footerRightButton"));
            confirmObj1.clickAndWait(Until.newWindow(), LONG_WAIT);
            UiObject2 finishObj = device.findObject(By.res("com.android.settings:id/next_button"));
            finishObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            sleep(SHORT_SLEEP);
            //输入VPN名称和服务器地址
            UiObject2 VPNNameObj = device.findObject(By.res("com.android.settings:id/name"));
            UiObject2 serverObj = device.findObject(By.res("com.android.settings:id/server"));
            VPNNameObj.clear();
            VPNNameObj.setText("testVPN");
            serverObj.clear();
            serverObj.setText("p1.hk2.heyjump.com");
            UiObject2 saveVPNObj = device.findObject(By.res("android:id/button1"));
            saveVPNObj.click();
            sleep(SHORT_SLEEP);
            //检查添加的VPN存在
            UiObject2 testVPNObj = device.findObject(By.text("testVPN"));
            Assert.assertNotNull("添加的testVPN不存在", testVPNObj);
            //添加账户密码
            testVPNObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            UiObject2 userName = device.findObject(By.focused(true));
            userName.setText("Jzorrof");
            UiObject2 pwdObj = device.findObjects(By.clazz("android.widget.EditText")).get(1);
            pwdObj.setText("qscvhi$$!_");
            sleep(SHORT_SLEEP);
            UiObject2 linkObj = device.findObject(By.res("android:id/button1"));
            linkObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            sleep(SHORT_SLEEP);
            device.findObject(By.res("android:id/list")).wait(Until.findObject(By.text("已连接")), LONG_WAIT);
            UiObject2 linkedObj = device.findObject(By.res("android:id/summary").text("已连接"));
            Assert.assertNotNull("没有找到已连接信息,判断连接失败", linkedObj);
//        device.executeShellCommand("ping www.google.com");
            device.pressBack();
            device.pressBack();
            UiScrollable settingsScroll = new UiScrollable(new UiSelector().resourceId("com.android.settings:id/dashboard"));
            settingsScroll.scrollTextIntoView("安全");
            UiObject2 securityObj = device.findObject(By.text("安全"));
            securityObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            UiObject2 lockStyleObj = device.findObject(By.text("屏幕锁定方式"));
            lockStyleObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            sleep(SHORT_SLEEP);
            TestUtils.drawLPattern();
            sleep(SHORT_SLEEP);
            UiObject2 swipeObj = device.findObject(By.text("滑动"));
            swipeObj.clickAndWait(Until.newWindow(), LONG_WAIT);
            UiObject2 moveObj = device.findObject(By.res("android:id/button1"));
            moveObj.clickAndWait(Until.newWindow(), LONG_WAIT);
        }
    }
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:81,代码来源:SunmiSettings.java

示例15: test005EnterCategory

import android.support.test.uiautomator.UiScrollable; //导入方法依赖的package包/类
@Category(CategoryAppStoreTests_v3_3_15.class)
@Test
public void test005EnterCategory() throws UiObjectNotFoundException {
    TestUtils.screenshotCap("appStoreHome");
    UiObject2 categoryObj = device.findObject(By.text("分类"));
    categoryObj.clickAndWait(Until.newWindow(), LONG_WAIT);
    TestUtils.screenshotCap("categoryInterface");
    UiScrollable cateScroll = new UiScrollable(new UiSelector().resourceId("woyou.market:id/recycler_view"));
    ArrayList<String> appCategory = new ArrayList<>();
    switch (Build.DEVICE) {
        case "V1-B18":
            Log.v("enterV1-B18", "V1-B18");
            appCategory.add("外卖");
            appCategory.add("支付");
            appCategory.add("餐饮");
            appCategory.add("电商");
            appCategory.add("酒店");
            appCategory.add("零售");
            appCategory.add("工具");
            appCategory.add("配送");
            appCategory.add("旅游");
            appCategory.add("理财");
            appCategory.add("EET");
            break;
        case "V1s-G":
            Log.v("enterV1s-G", "V1s-G");
            appCategory.add("外卖");
            appCategory.add("支付");
            appCategory.add("团购");
            appCategory.add("餐饮");
            appCategory.add("电商");
            appCategory.add("酒店");
            appCategory.add("零售");
            appCategory.add("工具");
            appCategory.add("配送");
            appCategory.add("旅游");
            appCategory.add("理财");
            appCategory.add("EET");
            break;
        default:
            Log.v("enterDefault", "default");
            appCategory.add("外卖");
            appCategory.add("支付");
            appCategory.add("团购");
            appCategory.add("餐饮");
            appCategory.add("电商");
            appCategory.add("酒店");
            appCategory.add("零售");
            appCategory.add("工具");
            appCategory.add("配送");
            appCategory.add("旅游");
            appCategory.add("理财");
            appCategory.add("EET");
    }
    for (String s : appCategory
            ) {
        boolean b = cateScroll.scrollTextIntoView(s);
        Assert.assertTrue(s + "--分类不存在", b);
        UiObject2 sCategoryObj = device.findObject(By.text(s));
        sCategoryObj.clickAndWait(Until.newWindow(), LONG_WAIT);
        UiObject2 cateNmaeObj = device.findObject(By.res("woyou.market:id/tv_title"));
        String cateName = cateNmaeObj.getText();
        Assert.assertEquals("应该是" + s + ",而实际是" + cateName, s, cateName);
        device.pressBack();
    }
}
 
开发者ID:sunmiqa,项目名称:SunmiAuto,代码行数:67,代码来源:SunmiAppStore_v3_3_15.java


注:本文中的android.support.test.uiautomator.UiScrollable.scrollTextIntoView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。