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


Java DataInteraction类代码示例

本文整理汇总了Java中android.support.test.espresso.DataInteraction的典型用法代码示例。如果您正苦于以下问题:Java DataInteraction类的具体用法?Java DataInteraction怎么用?Java DataInteraction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: performStartAdventure

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
protected void performStartAdventure() {
    ViewInteraction button = onView(allOf(withText(getString(R.string.create_new_adventure)), isDisplayed()));
    button.perform(click());


    //Clicks over the proper book using the property order of the GamebookEnum
    DataInteraction textView = onData(anything())
            .inAdapterView(allOf(withId(R.id.gamebookListView),
                    childAtPosition(
                            withClassName(is("android.widget.RelativeLayout")),
                            0)))
            .atPosition(getGamebook().getOrder() - 1);
    textView.perform(click());

    button = onView(allOf(withText(getString(R.string.create_new_adventure)), isDisplayed()));
    button.perform(click());

    Espresso.closeSoftKeyboard();
}
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:20,代码来源:TCBaseTest.java

示例2: onListItem

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
/**
 */
@SuppressWarnings("unchecked")
public static DataInteraction onListItem(int pos) {
    return onData(anything())
            .inAdapterView(allOf(withId(android.R.id.list), isDisplayed()))
            .atPosition(pos);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:9,代码来源:EspressoUtils.java

示例3: performChoosemartialArt

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
public void performChoosemartialArt() {

        DataInteraction linearLayout = onData(anything())
                .inAdapterView(allOf(withId(R.id.skillList),
                        childAtPosition(
                                withClassName(is("android.widget.RelativeLayout")),
                                1)))
                .atPosition(0);
        linearLayout.perform(click());
    }
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:11,代码来源:TestSOTS.java

示例4: performChooseSpells

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
public void performChooseSpells() {
    DataInteraction textView2 = onData(anything())
            .inAdapterView(allOf(withId(R.id.spellListView),
                    childAtPosition(
                            withClassName(is("android.widget.LinearLayout")),
                            1)))
            .atPosition(0);
    textView2.perform(click());

    DataInteraction textView3 = onData(anything())
            .inAdapterView(allOf(withId(R.id.spellListView),
                    childAtPosition(
                            withClassName(is("android.widget.LinearLayout")),
                            1)))
            .atPosition(0);
    textView3.perform(click());

    DataInteraction textView4 = onData(anything())
            .inAdapterView(allOf(withId(R.id.spellListView),
                    childAtPosition(
                            withClassName(is("android.widget.LinearLayout")),
                            1)))
            .atPosition(1);
    textView4.perform(click());

    DataInteraction textView5 = onData(anything())
            .inAdapterView(allOf(withId(R.id.spellListView),
                    childAtPosition(
                            withClassName(is("android.widget.LinearLayout")),
                            1)))
            .atPosition(1);
    textView5.perform(click());
}
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:34,代码来源:TestTCOC.java

示例5: performChooseSuperpower

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
public void performChooseSuperpower() {

        DataInteraction linearLayout = onData(anything())
                .inAdapterView(allOf(withId(R.id.superpowerList),
                        childAtPosition(
                                withClassName(is("android.widget.RelativeLayout")),
                                1)))
                .atPosition(0);
        linearLayout.perform(click());
    }
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:11,代码来源:TestAWF.java

示例6: performChoosePotion

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
protected void performChoosePotion() {
    DataInteraction linearLayout = onData(anything())
            .inAdapterView(allOf(withId(R.id.potionList),
                    childAtPosition(
                            withClassName(is("android.widget.LinearLayout")),
                            0)))
            .atPosition(0);
    linearLayout.perform(click());
}
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:10,代码来源:TCBaseTest.java

示例7: testExistingGroup

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
@Test
public void testExistingGroup() throws InterruptedException {
    //Given a preexisting group newGroup, when we search for new group in the list view,
    //then the new group is still there (and clickable)
    Thread.sleep(1000);
    DataInteraction v2 = onData(hasToString(startsWith("newGroup")))
            .inAdapterView(withId(R.id.groupList)).atPosition(0);
    v2.check(matches(withText("newGroup")));
}
 
开发者ID:ThisChessPlayer,项目名称:GroupScheduleCoordinator,代码行数:10,代码来源:MainActivityTest.java

示例8: testOpenMeal

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
/**
     * Tests clicking on a meal in the meal list to open it
     */
    public void testOpenMeal() throws SQLException {
        final Matcher<View> mealList = withTagKey(R.id.test_tag_meal_list,
                Is.<Object>is("Meal List"));
        final DataInteraction mealItem = onData(anything()).inAdapterView(mealList);
        mealItem.perform(click());
        // Check that the MealViewActivity activity has started
        // The below statement produces an error in the instrumentation code.
        // TODO: Fix
//        intended(hasComponent(new ComponentName(getInstrumentation().getTargetContext(),
//                MealViewActivity.class)));
    }
 
开发者ID:Cook-E-team,项目名称:Cook-E,代码行数:15,代码来源:HomeActivityTest.java

示例9: with

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
public ActionableData with(C content)
{
    DataInteraction dataInteraction = onData(dataMatcher(content));

    if (resourceId != 0)
    {
        return new ActionableData(dataInteraction.inAdapterView(withId(resourceId)));
    }
    else
    {
        return new ActionableData(dataInteraction);
    }
}
 
开发者ID:mauriciotogneri,项目名称:green-coffee,代码行数:14,代码来源:DataMatcher.java

示例10: test_schedule_saturday

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
@Test
public void test_schedule_saturday() {
    String fromName = "San Francisco";
    String toName = "22nd St";

    onView(withId(R.id.btn_sat)).perform(click());

    onView(withId(R.id.input_departure)).perform(click());
    onData(is(fromName)).perform(click());

    onView(withId(R.id.input_arrival)).perform(click());
    onData(is(toName)).perform(click());

    List<String> expects = Arrays.asList("08:07 => 08:11",
                                         "09:37 => 09:41",
                                         "11:07 => 11:11",
                                         "12:37 => 12:41",
                                         "14:07 => 14:11",
                                         "15:37 => 15:41",
                                         "17:07 => 17:11",
                                         "18:37 => 18:41",
                                         "20:07 => 20:11",
                                         "21:37 => 21:41",
                                         "22:51 => 22:55",
                                         "00:05 => 00:10");

    onView(withId(R.id.results)).check(matches(new ResultListMatcher(fromName,
                                                                     toName,
                                                                     expects.size())));

    DataInteraction interaction = onData(anything()).inAdapterView(withId(R.id.results));
    for (int l = expects.size() - 1; l >= 0; l--) {
        String expect = expects.get(l);
        interaction
                .atPosition(l)
                .check(matches(new ResultViewMatcher(fromName, toName, l, expect)));
    }
}
 
开发者ID:ranmocy,项目名称:rCaltrain,代码行数:39,代码来源:ApplicationTest.java

示例11: test_schedule_sunday

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
@Test
public void test_schedule_sunday() {
    String fromName = "San Francisco";
    String toName = "22nd St";

    onView(withId(R.id.btn_sun)).perform(click());

    onView(withId(R.id.input_departure)).perform(click());
    onData(is(fromName)).perform(click());

    onView(withId(R.id.input_arrival)).perform(click());
    onData(is(toName)).perform(click());

    List<String> expects = Arrays.asList("08:07 => 08:11",
                                         "09:37 => 09:41",
                                         "11:07 => 11:11",
                                         "12:37 => 12:41",
                                         "14:07 => 14:11",
                                         "15:37 => 15:41",
                                         "17:07 => 17:11",
                                         "18:37 => 18:41",
                                         "20:07 => 20:11",
                                         "21:37 => 21:41");

    onView(withId(R.id.results)).check(matches(new ResultListMatcher(fromName,
                                                                     toName,
                                                                     expects.size())));

    DataInteraction interaction = onData(anything()).inAdapterView(withId(R.id.results));
    for (int l = expects.size() - 1; l >= 0; l--) {
        String expect = expects.get(l);
        interaction
                .atPosition(l)
                .check(matches(new ResultViewMatcher(fromName, toName, l, expect)));
    }
}
 
开发者ID:ranmocy,项目名称:rCaltrain,代码行数:37,代码来源:ApplicationTest.java

示例12: testArticleLoad

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
public static void testArticleLoad(Activity activity) {

        while (!viewIsDisplayed(R.id.search_results_list)) {
            waitFor(WAIT_FOR_1000);
        }

        DataInteraction view = onData(anything())
                .inAdapterView(allOf(withId(R.id.search_results_list),
                        childAtPosition(
                                withId(R.id.search_results_container),
                                1)))
                .atPosition(0);
        view.perform(click());
        while (!viewIsDisplayed(R.id.view_page_header_image)) {
            waitFor(WAIT_FOR_2000);
        }
        ScreenshotTools.snap("Barack");

        onView(withId(R.id.view_page_header_image))
                .perform(swipeUp());

        onView(withId(R.id.page_fragment))
                .perform(swipeUp());
        ScreenshotTools.snap("ArticleSwipeUpNoActionBar");

        onView(withId(R.id.page_fragment))
                .perform(swipeUp());
        onView(withId(R.id.page_fragment))
                .perform(swipeDown());
        ScreenshotTools.snap("ArticleSwipeDownActionBarAndTabSeen");

    }
 
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:33,代码来源:PageActivityTest.java

示例13: onSpinnerString

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
static DataInteraction onSpinnerString(String value) {
    return onData(allOf(instanceOf(String.class), is(value))).inRoot(not(isDialog()));
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:4,代码来源:EspressoUtils.java

示例14: testAddMember

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
@Test
public void testAddMember(){
    //Given that we have a new group, when we click on it
    onData(hasToString(startsWith("Group E")))
            .inAdapterView(withId(R.id.groupList)).atPosition(0)
            .perform(click());

    //and when we click on members in the content page
    ViewInteraction appCompatTextView7 = onView(
            allOf(withId(android.R.id.title), withText("Members"), isDisplayed()));
    appCompatTextView7.perform(click());

    //and when we click on add members
    onView(withId(R.id.addmembers))
            .perform(click());

    //and when we type in the name of and email of the new member
    ViewInteraction appCompatEditText = onView(
            allOf(withId(R.id.tbMemberName), isDisplayed()));
    appCompatEditText.perform(click());

    appCompatEditText.perform(replaceText("Harry"), closeSoftKeyboard());

    ViewInteraction appCompatEditText4 = onView(
            allOf(withId(R.id.tbMemberEmail), isDisplayed()));
    appCompatEditText4.perform(replaceText("[email protected]"), closeSoftKeyboard());

    ViewInteraction appCompatEditText5 = onView(
            allOf(withId(R.id.tbMemberEmail), withText("[email protected]"), isDisplayed()));
    appCompatEditText5.perform(pressImeActionButton());

    //and click on the button add member
    ViewInteraction appCompatButton2 = onView(
            allOf(withId(R.id.btnCreateGroup), withText("Add Member"), isDisplayed()));
    appCompatButton2.perform(click());

    ViewInteraction appCompatTextView5 = onView(
            allOf(withId(android.R.id.title), withText("Members"), isDisplayed()));
    appCompatTextView5.perform(click());

    //then a new member with the info we just inputted appears in the list view
    DataInteraction v2 = onData(hasToString(startsWith("[email protected]")))
            .inAdapterView(withId(R.id.lvMembers)).atPosition(0);
    v2.check(matches(withText("[email protected]")));

}
 
开发者ID:ThisChessPlayer,项目名称:GroupScheduleCoordinator,代码行数:47,代码来源:AddMemberTest.java

示例15: testAddMember

import android.support.test.espresso.DataInteraction; //导入依赖的package包/类
@Test
public void testAddMember() throws InterruptedException {
    Thread.sleep(1000);
    ViewInteraction floatingActionButton = onView(
            allOf(withId(R.id.myFab),
                    withParent(allOf(withId(R.id.activity_main),
                            withParent(withId(android.R.id.content)))),
                    isDisplayed()));
    floatingActionButton.perform(click());

    Thread.sleep(1000);
    //and when we create a new group
    onView(withId(R.id.userInputDialog))
            .perform(typeText("Group C"));

    Thread.sleep(1000);
    ViewInteraction appCompatButton = onView(
            allOf(withId(android.R.id.button1), withText("Create"),
                    withParent(allOf(withId(R.id.buttonPanel),
                            withParent(withId(R.id.parentPanel)))),
                    isDisplayed()));
    appCompatButton.perform(click());

    //when we enter the new group
    onData(hasToString(startsWith("Group C")))
            .inAdapterView(withId(R.id.groupList)).atPosition(0)
            .perform(click());

    //When we click on members...
    ViewInteraction appCompatTextView7 = onView(
            allOf(withId(android.R.id.title), withText("Members"), isDisplayed()));
    appCompatTextView7.perform(click());

    //then members content page appears. When we click on it...
    onView(withId(R.id.addmembers))
            .check(matches(isDisplayed()))
            .perform(click());

    //Then Dialog appears to enter member
    ViewInteraction appCompatEditText = onView(
            allOf(withId(R.id.tbMemberName), isDisplayed()));
    appCompatEditText.perform(click());

    //When we enter "Students" for the name of the new member
    appCompatEditText.perform(replaceText("Students"), closeSoftKeyboard());

    //and when we enter an email
    ViewInteraction appCompatEditText4 = onView(
            allOf(withId(R.id.tbMemberEmail), isDisplayed()));
    appCompatEditText4.perform(typeText("[email protected]"), closeSoftKeyboard());

    //and when we click addmember
    ViewInteraction appCompatButton2 = onView(
            allOf(withId(R.id.btnCreateGroup), withText("Add Member"), isDisplayed()));
    appCompatButton2.perform(click());

    //and when we cut away from member content page
    ViewInteraction appCompatTextView5 = onView(
            allOf(withId(android.R.id.title), withText("Info"), isDisplayed()));
    appCompatTextView5.perform(click());

    //when we come back to the member content page
    ViewInteraction appCompatTextView9 = onView(
            allOf(withId(android.R.id.title), withText("Members"), isDisplayed()));
    appCompatTextView9.perform(click());

    //the new member's email is still there!
    DataInteraction v2 = onData(hasToString(startsWith("[email protected]")))
            .inAdapterView(withId(R.id.lvMembers)).atPosition(0);
    v2.check(matches(withText("[email protected]")));
}
 
开发者ID:ThisChessPlayer,项目名称:GroupScheduleCoordinator,代码行数:72,代码来源:MainActivityTest.java


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