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


Java DataInteraction.perform方法代码示例

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


在下文中一共展示了DataInteraction.perform方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: openHABMainActivityTest

import android.support.test.espresso.DataInteraction; //导入方法依赖的package包/类
@Test
public void openHABMainActivityTest() throws InterruptedException {
    ViewInteraction firstRecyclerView = onView(withId(R.id.recyclerview));
    firstRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(0))
            .check(matches(atPositionOnView(0, isDisplayed(), R.id.widgetlabel)))
            .check(matches(atPositionOnView(0, withText("First Floor"), R.id.widgetlabel)));

    firstRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(6))
            .check(matches(atPositionOnView(6, isDisplayed(), R.id.widgetlabel)))
            .check(matches(atPositionOnView(6, withText("Astronomical Data"), R.id.widgetlabel)));

    // does it show "garden"?
    firstRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(3))
            .check(matches(atPositionOnView(3, isDisplayed(), R.id.widgetlabel)))
            .check(matches(atPositionOnView(3, withText("Garden"), R.id.widgetlabel)));

    // open widget overview
    firstRecyclerView
            .perform(RecyclerViewActions.actionOnItemAtPosition(10, click()));

    // FIXME: is there a more elegant way to wait for the new fragment?
    Thread.sleep(1000);

    // check whether selection widget appears and click on it
    ViewInteraction secondRecyclerView = onView(withIndex(withId(R.id.recyclerview), 1));

    secondRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(4))
            .check(matches(atPositionOnView(4, withText("Scene Selection"), R.id.widgetlabel)))
            .check(matches(atPositionOnView(4, isDisplayed(), R.id.selectionspinner)))
            .perform(RecyclerViewActions.actionOnItemAtPosition(4, onChildView(click(), R.id.selectionspinner)));

    DataInteraction appCompatCheckedTextView = onData(anything())
            .inAdapterView(withClassName(
                    is("com.android.internal.app.AlertController$RecycleListView")))
            .atPosition(0);
    appCompatCheckedTextView.check(matches(withText("off")));
    appCompatCheckedTextView.perform(click());

    // check whether scene radio button group is present
    secondRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(5))
            .check(matches(atPositionOnView(5, isDisplayed(), R.id.sectionswitchradiogroup)));

    // check whether switch is displayed
    secondRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(1))
            .check(matches(atPositionOnView(1, isDisplayed(), R.id.switchswitch)));

    // check whether slider is displayed
    secondRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(8))
            .check(matches(atPositionOnView(8, isDisplayed(), R.id.sliderseekbar)));

    // check whether color control button is displayed
    secondRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(9))
            .check(matches(atPositionOnView(9, isDisplayed(), R.id.colorbutton_color)));

    // check whether roller shutter button is displayed
    secondRecyclerView
            .perform(RecyclerViewActions.scrollToPosition(10))
            .check(matches(atPositionOnView(10, isDisplayed(), R.id.rollershutterbutton_stop)));
}
 
开发者ID:openhab,项目名称:openhab-android,代码行数:68,代码来源:BasicWidgetTest.java

示例9: searchKeywordAndGo

import android.support.test.espresso.DataInteraction; //导入方法依赖的package包/类
public static void searchKeywordAndGo(@NonNull String keyword) {

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

        ViewInteraction linearLayout = onView(
                allOf(withId(R.id.search_container),
                        childAtPosition(
                                childAtPosition(
                                        withId(R.id.fragment_feed_feed),
                                        0),
                                0),
                        isDisplayed()));
        linearLayout.perform(click());

        ViewInteraction frameLayout = onView(
                allOf(withId(R.id.search_lang_button_container), withContentDescription("Wikipedia language"),
                        childAtPosition(
                                childAtPosition(
                                        withId(R.id.search_toolbar),
                                        1),
                                1),
                        isDisplayed()));
        frameLayout.perform(click());

        ViewInteraction plainPasteEditText = onView(
                allOf(withId(R.id.preference_languages_filter),
                        childAtPosition(
                                childAtPosition(
                                        withClassName(is("android.support.design.widget.TextInputLayout")),
                                        0),
                                0),
                        isDisplayed()));
        plainPasteEditText.perform(replaceText("test"), closeSoftKeyboard());

        // take screenshot
        ScreenshotTools.snap("SearchPage");

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

        ViewInteraction searchAutoComplete = onView(
                allOf(withId(R.id.search_src_text),
                        childAtPosition(
                                allOf(withId(R.id.search_plate),
                                        childAtPosition(
                                                withId(R.id.search_edit_frame),
                                                1)),
                                0),
                        isDisplayed()));
        searchAutoComplete.perform(replaceText(keyword), closeSoftKeyboard());

        // hold until the result fetch
        while (!viewIsDisplayed(R.id.search_results_list)) {
            waitFor(WAIT_FOR_1000);
        }

        // take screenshot
        ScreenshotTools.snap("SearchSuggestionPage");

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


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