Java 类android.support.test.espresso.matcher.RootMatchers 实例源码

项目:Red-Calorie    文件:IngredientActivityTest.java   
@Test
public void testSearchUsingCategory() throws Exception {
    main.launchActivity(null);
    onView(withId(R.id.token_search_text_view)).perform(loopMainThreadForAtLeast(200));
    onView(withText(exampleIngredients[0].getName())).check(matches(isDisplayed()));
    onView(withText(exampleIngredients[1].getName())).check(matches(isDisplayed()));
    onView(withId(R.id.ingredients_search_view))
            .check(matches(isDisplayed()))
            .perform(clickExpand());
    onView(withId(R.id.token_search_text_view))
            .check(matches(isDisplayed()))
            .perform(typeTextIntoFocusedView("Tag"))
            .perform(loopMainThreadForAtLeast(500)); //Debounce

    onData(allOf(is(instanceOf(String.class)), is("Tag 2")))
            .inRoot(RootMatchers.withDecorView(not(is(main
                    .getActivity().getWindow().getDecorView()))))
            .perform(click());
    onView(allOf(withId(R.id.ingredients_content),isAssignableFrom(RecyclerView.class)))
            .perform(loopMainThreadForAtLeast(500));
    onView(withText(exampleIngredients[0].getName())).check(doesNotExist());
    onView(withText(exampleIngredients[1].getName())).check(matches(isDisplayed()));
    onView(withText(exampleIngredients[2].getName())).check(doesNotExist());
}
项目:FlightSearch    文件:AutoCompleteActivityTest.java   
@Test
public void testAutoComplete() {
    // replace ProgressBar drawable while invisible since Espresso has issues with animations.
    onView(isAssignableFrom(ProgressBar.class)).perform(ViewActionUtils.replaceProgressBarDrawable());

    // type d
    onView(withId(R.id.delayed_autocomplete_textview)).perform(typeText("d"));
    onView(withId(R.id.autocomplete_progress_bar)).check(matches(not(isDisplayed())));

    // type e
    onView(withId(R.id.delayed_autocomplete_textview)).perform(typeText("e"));
    onView(withId(R.id.autocomplete_progress_bar)).check(matches(not(isDisplayed())));

    // type n
    onView(withId(R.id.delayed_autocomplete_textview)).perform(typeText("n"));
    onView(withId(R.id.autocomplete_progress_bar)).check(matches(isDisplayed()));

    // idle until data is loaded
    registerIdlingResources(mIdlingResource);

    // select from list
    onData(allOf(is(instanceOf(String.class)), is("Denver International Airport [DEN]")))
            .inRoot(RootMatchers.withDecorView(not(is(mActivityRule
                    .getActivity().getWindow().getDecorView()))))
            .perform(click());

    unregisterIdlingResources(mIdlingResource);
}
项目:starwarsshop    文件:MyViewMatcher.java   
public static org.hamcrest.Matcher findToastInRule(ActivityTestRule mActivityRule){
    return  RootMatchers.withDecorView(CoreMatchers.not(is(mActivityRule.getActivity().getWindow().getDecorView())));
}
项目:mpos-ui.android.paybutton    文件:SignatureActivityTest.java   
public void testBackKeyShowsToast() {
    Espresso.pressBack();
    Espresso.onView(ViewMatchers.withText(R.string.MPUBackButtonDisabled)).inRoot(RootMatchers.withDecorView(CoreMatchers.not(CoreMatchers.is(getActivity().getWindow().getDecorView())))).check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
}
项目:mpos-ui.android.paybutton    文件:TransactionActivityTest.java   
public void testBackKeyShowsToast() {
    initWithAmount(106);
    Espresso.pressBack();
    Espresso.onView(ViewMatchers.withText(R.string.MPUBackButtonDisabled)).inRoot(RootMatchers.withDecorView(CoreMatchers.not(CoreMatchers.is(getActivity().getWindow().getDecorView())))).check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
}
项目:Ironhide    文件:BaseView.java   
/**
 * Changes the root to search for this view to be a dialog
 */
public BaseView<T> inDialogRoot() {
    return inRoot(RootMatchers.isDialog());
}
项目:Ironhide    文件:BaseView.java   
/**
 * Changes the root to search for this view to be a platform popup
 */
public BaseView<T> inPlatformPopup() {
    return inRoot(RootMatchers.isPlatformPopup());
}
项目:Ironhide    文件:BaseView.java   
/**
 * Changes the root to search for this view to be touchable
 */
public BaseView<T> inTouchableRoot() {
    return inRoot(RootMatchers.isTouchable());
}
项目:Ironhide    文件:BaseView.java   
/**
 * Changes the root to search for this view to be a decor view
 */
public BaseView<T> inDecorView(Matcher<View> decorViewMatcher) {
    return inRoot(RootMatchers.withDecorView(decorViewMatcher));
}
项目:Ironhide    文件:BaseView.java   
/**
 * Changes the root to search for this view to be focusable
 */
public BaseView<T> inFocusableRoot() {
    return inRoot(RootMatchers.isFocusable());
}