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


Java ViewInteraction.check方法代码示例

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


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

示例1: mainActivityTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void mainActivityTest() throws Throwable {
  ViewInteraction webView = onView(
    allOf(childAtPosition(
      allOf(withId(R.id.activity_main),
        childAtPosition(
          withId(android.R.id.content),
          0)),
      0),
      isDisplayed()));
  webView.check(matches(isDisplayed()));

  ViewInteraction editText = onView(
    allOf(withId(R.id.input_view),
      childAtPosition(
        allOf(withId(R.id.activity_main),
          childAtPosition(
            withId(android.R.id.content),
            0)),
        1),
      isDisplayed()));
  editText.check(matches(isDisplayed()));
}
 
开发者ID:Nishant-Pathak,项目名称:MathView,代码行数:24,代码来源:MainActivityTest.java

示例2: definingInitialFragmentWithState

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void definingInitialFragmentWithState() {
    ViewInteraction appCompatButton = onView(
            allOf(withId(R.id.defining_initial_fragment_with_state), withText("Defining initial fragment with state"),
                    childAtPosition(
                            childAtPosition(
                                    withId(android.R.id.content),
                                    0),
                            4),
                    isDisplayed()));
    appCompatButton.perform(click());

    ViewInteraction textView = onView(
            allOf(withId(R.id.value), withText("100"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            0),
                    isDisplayed()));
    textView.check(matches(withText("100")));

}
 
开发者ID:grzechu92,项目名称:frogment,代码行数:24,代码来源:DefiningInitialFragmentWithState.java

示例3: definingInitialFragmentTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void definingInitialFragmentTest() {
    ViewInteraction appCompatButton = onView(
            allOf(withId(R.id.defining_initial_fragment), withText("Defining initial fragment"),
                    childAtPosition(
                            childAtPosition(
                                    withId(android.R.id.content),
                                    0),
                            3),
                    isDisplayed()));
    appCompatButton.perform(click());

    ViewInteraction textView = onView(
            allOf(withText("2"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            0),
                    isDisplayed()));
    textView.check(matches(withText("2")));

}
 
开发者ID:grzechu92,项目名称:frogment,代码行数:24,代码来源:DefiningInitialFragmentTest.java

示例4: loginActivityTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test public void loginActivityTest() {
    ViewInteraction textView = onView(allOf(withId(R.id.title), withText("Sign in"),
            childAtPosition(allOf(withId(R.id.intro_background),
                    childAtPosition(withId(android.R.id.content), 0)), 0), isDisplayed()));
    textView.check(matches(withText("Sign in")));

    ViewInteraction linearLayout = onView(allOf(withId(R.id.edit_text_layout), childAtPosition(
            allOf(withId(R.id.intro_background),
                    childAtPosition(withId(android.R.id.content), 0)), 1), isDisplayed()));
    linearLayout.check(matches(isDisplayed()));

    ViewInteraction editText = onView(allOf(withId(R.id.login_email_input),
            childAtPosition(childAtPosition(withId(R.id.login_email_layout), 0), 0),
            isDisplayed()));
    editText.check(matches(isDisplayed()));

    ViewInteraction editText2 = onView(allOf(withId(R.id.login_password_input),
            childAtPosition(childAtPosition(withId(R.id.logi_password_layout), 0), 0),
            isDisplayed()));
    editText2.check(matches(isDisplayed()));

    ViewInteraction textView2 = onView(allOf(withId(R.id.login_forgot),
            withText("Have you forgotten your password?"), childAtPosition(
                    allOf(withId(R.id.intro_background),
                            childAtPosition(withId(android.R.id.content), 0)), 2),
            isDisplayed()));
    textView2.check(matches(withText("Have you forgotten your password?")));

    ViewInteraction button = onView(allOf(withId(R.id.bsignin), childAtPosition(
            allOf(withId(R.id.intro_background),
                    childAtPosition(withId(android.R.id.content), 0)), 3), isDisplayed()));
    button.check(matches(isDisplayed()));
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:34,代码来源:LoginActivityTest.java

示例5: testActivityRun

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void testActivityRun() {
    calculatorActivity.launchActivity(new Intent());

    ViewInteraction calculateButton = onView(withId(R.id.calculate_button));
    calculateButton.check(matches(isDisplayed()));
    calculateButton.check(new ViewAssertion() {
        @Override
        public void check(View view, NoMatchingViewException noViewFoundException) {
            if(view.isEnabled()) {
                throw new IllegalStateException("button enabled");
            }
        }
    });

    onView(withId(R.id.input_field_edit_text)).perform(typeText("1+2"));

    calculateButton.check(matches(isEnabled()));

    calculateButton.perform(click());

    /*onView(withId(R.id.result_text_view)).check(new ViewAssertion() {
        @Override
        public void check(View view, NoMatchingViewException noViewFoundException) {
            if(!((TextView)view).getText().toString().equals("3")) {
                throw new IllegalStateException("result wrong. Aspected 3");
            }
        }
    });*/

}
 
开发者ID:IstiN,项目名称:android-training-2017,代码行数:32,代码来源:CalculatorAndroidTest.java

示例6: profileActivityNavigationTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void profileActivityNavigationTest() {
    ViewInteraction recyclerView = onView(
            allOf(withId(R.id.recycler_teams), isDisplayed()));
    recyclerView.perform(actionOnItemAtPosition(0, click()));

    final Matcher<View> textMessage = allOf(withId(R.id.txt_message), withText("I see @alex and @bruno are having fun here (notbad)"),
            childAtPosition(
                    childAtPosition(
                            withId(R.id.recycler_messages),
                            2),
                    2));

    Espresso.onView(textMessage).perform(EspressoTestUtils.clickClickableSpan("@alex"));


    ViewInteraction textView = onView(
            allOf(withId(R.id.txt_name), withText("Full name: Alex Smith"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.root),
                                    0),
                            1),
                    isDisplayed()));
    textView.check(matches(withText("Full name: Alex Smith")));

    ViewInteraction textView2 = onView(
            allOf(withId(R.id.txt_nick), withText("Nickname: alex"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.root),
                                    0),
                            2),
                    isDisplayed()));
    textView2.check(matches(withText("Nickname: alex")));

    EspressoTestUtils.matchToolbarTitle("Alex Smith");

}
 
开发者ID:charafau,项目名称:TurboChat,代码行数:40,代码来源:ProfileActivityNavigationTest.java

示例7: interceptorsPostTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void interceptorsPostTest() {
    ViewInteraction buttonPost = onView(
            allOf(withId(R.id.button_post), withText("POST"), isDisplayed()));
    buttonPost.perform(click());
    buttonPost.check(matches(isDisplayed()));
}
 
开发者ID:ihsanbal,项目名称:LoggingInterceptor,代码行数:8,代码来源:InterceptorsTest.java

示例8: interceptorsGetTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void interceptorsGetTest() {
    ViewInteraction buttonPost = onView(
            allOf(withId(R.id.button_get), withText("GET"), isDisplayed()));
    buttonPost.perform(click());
    buttonPost.check(matches(isDisplayed()));
}
 
开发者ID:ihsanbal,项目名称:LoggingInterceptor,代码行数:8,代码来源:InterceptorsTest.java

示例9: interceptorsDeleteTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void interceptorsDeleteTest() {
    ViewInteraction buttonPost = onView(
            allOf(withId(R.id.button_delete), withText("DELETE"), isDisplayed()));
    buttonPost.perform(click());
    buttonPost.check(matches(isDisplayed()));
}
 
开发者ID:ihsanbal,项目名称:LoggingInterceptor,代码行数:8,代码来源:InterceptorsTest.java

示例10: activityStateProvider

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void activityStateProvider() {
    ViewInteraction appCompatButton = onView(
            allOf(withId(R.id.activity_state_provider), withText("Activity state provider"),
                    childAtPosition(
                            childAtPosition(
                                    withId(android.R.id.content),
                                    0),
                            7),
                    isDisplayed()));
    appCompatButton.perform(click());

    ViewInteraction textView = onView(
            allOf(withId(R.id.state), withText("State from fragment"),
                    childAtPosition(
                            childAtPosition(
                                    withId(android.R.id.content),
                                    0),
                            0),
                    isDisplayed()));
    textView.check(matches(withText("State from fragment")));

    ViewInteraction textView2 = onView(
            allOf(withText("1"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            0),
                    isDisplayed()));
    textView2.check(matches(withText("1")));

}
 
开发者ID:grzechu92,项目名称:frogment,代码行数:34,代码来源:ActivityStateProvider.java

示例11: interceptorsFileTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void interceptorsFileTest() {
    ViewInteraction buttonPost = onView(
            allOf(withId(R.id.button_pdf), withText("FILE"), isDisplayed()));
    buttonPost.perform(click());
    buttonPost.check(matches(isDisplayed()));
}
 
开发者ID:ihsanbal,项目名称:LoggingInterceptor,代码行数:8,代码来源:InterceptorsTest.java

示例12: mainActivityMessageViewNavigationTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void mainActivityMessageViewNavigationTest() {
    ViewInteraction textView = onView(
            allOf(withId(R.id.txt_team_name), withText("Java developer team"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.card_view),
                                    0),
                            1),
                    isDisplayed()));
    textView.check(matches(withText("Java developer team")));

    ViewInteraction recyclerView = onView(
            allOf(withId(R.id.recycler_teams), isDisplayed()));
    recyclerView.perform(actionOnItemAtPosition(0, click()));


    EspressoTestUtils.matchToolbarTitle("Java developer team");

    ViewInteraction appCompatImageButton = onView(
            allOf(withContentDescription("Navigate up"),
                    withParent(withId(R.id.toolbar)),
                    isDisplayed()));
    appCompatImageButton.perform(click());

    ViewInteraction textView4 = onView(
            allOf(withText("Turbo Chat"),
                    childAtPosition(
                            allOf(withId(R.id.toolbar),
                                    childAtPosition(
                                            IsInstanceOf.<View>instanceOf(android.widget.LinearLayout.class),
                                            0)),
                            0),
                    isDisplayed()));
    textView4.check(matches(withText("Turbo Chat")));

}
 
开发者ID:charafau,项目名称:TurboChat,代码行数:38,代码来源:MainActivityMessageViewNavigationTest.java

示例13: recorderActivityTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void recorderActivityTest() {
    ViewInteraction appCompatEditText = onView(allOf(withId(R.id.edUsername), withParent(allOf(withId(R.id.clMainContainer), withParent(withId(android.R.id.content)))), isDisplayed()));
    appCompatEditText.perform(replaceText("parth"), closeSoftKeyboard());
    
    ViewInteraction appCompatButton = onView(allOf(withId(R.id.btnLoginButton), withText("Login"), withParent(allOf(withId(R.id.clMainContainer), withParent(withId(android.R.id.content)))), isDisplayed()));
    appCompatButton.perform(click());
    
    ViewInteraction editText = onView(allOf(withId(R.id.edUsername), withText("parth"), childAtPosition(allOf(withId(R.id.clMainContainer), childAtPosition(withId(android.R.id.content), 0)), 1), isDisplayed()));
    editText.check(matches(hasErrorText("Please enter valid email address")));
    
}
 
开发者ID:parthdave93,项目名称:AndroidTestingTutorial,代码行数:13,代码来源:RecorderActivityTest.java

示例14: mainActivityTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void mainActivityTest() {
    ViewInteraction imageView = onView(allOf(withId(R.id.titleView), childAtPosition(
            allOf(withId(R.id.mainLayout),
                    childAtPosition(IsInstanceOf.<View>instanceOf(android.view.ViewGroup.class),
                            0)), 0), isDisplayed()));
    imageView.check(matches(isDisplayed()));

    ViewInteraction imageView2 = onView(allOf(withId(R.id.logoView), childAtPosition(
            allOf(withId(R.id.mainLayout),
                    childAtPosition(IsInstanceOf.<View>instanceOf(android.view.ViewGroup.class),
                            0)), 1), isDisplayed()));
    imageView2.check(matches(isDisplayed()));

    ViewInteraction button = onView(allOf(withId(R.id.registerButton), childAtPosition(
            allOf(withId(R.id.buttonsLayout), childAtPosition(withId(R.id.mainLayout), 2)), 0),
            isDisplayed()));
    button.check(matches(isDisplayed()));

    ViewInteraction button2 = onView(allOf(withId(R.id.signInButton), childAtPosition(
            allOf(withId(R.id.buttonsLayout), childAtPosition(withId(R.id.mainLayout), 2)), 1),
            isDisplayed()));
    button2.check(matches(isDisplayed()));

    ViewInteraction linearLayout3 = onView(allOf(withId(R.id.buttonsLayout), childAtPosition(
            allOf(withId(R.id.mainLayout),
                    childAtPosition(IsInstanceOf.<View>instanceOf(android.view.ViewGroup.class),
                            0)), 2), isDisplayed()));
    linearLayout3.check(matches(isDisplayed()));

    ViewInteraction linearLayout4 = onView(allOf(withId(R.id.mainLayout),
            childAtPosition(childAtPosition(withId(android.R.id.content), 0), 0),
            isDisplayed()));
    linearLayout4.check(matches(isDisplayed()));

    ViewInteraction appCompatButton =
            onView(allOf(withId(R.id.registerButton), withText("Register"), withParent(
                    allOf(withId(R.id.buttonsLayout), withParent(withId(R.id.mainLayout)))),
                    isDisplayed()));
    appCompatButton.perform(click());

    ViewInteraction textView2 = onView(allOf(withId(R.id.title0), withText("What's your name?"),
            childAtPosition(withParent(withId(R.id.viewpager)), 0), isDisplayed()));
    textView2.check(matches(withText("What's your name?")));

    pressBack();

    ViewInteraction appCompatButton2 =
            onView(allOf(withId(R.id.signInButton), withText("Sign in"), withParent(
                    allOf(withId(R.id.buttonsLayout), withParent(withId(R.id.mainLayout)))),
                    isDisplayed()));
    appCompatButton2.perform(click());

    pressBack();

    ViewInteraction appCompatButton7 =
            onView(allOf(withId(android.R.id.button1), withText("Close")));
    appCompatButton7.perform(scrollTo(), click());
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:60,代码来源:MainActivityTest.java

示例15: fragmentSwitchingFromFragmentTest

import android.support.test.espresso.ViewInteraction; //导入方法依赖的package包/类
@Test
public void fragmentSwitchingFromFragmentTest() {
    ViewInteraction appCompatButton = onView(
            allOf(withId(R.id.fragment_switching_from_fragment), withText("Fragment switching from fragment"),
                    childAtPosition(
                            childAtPosition(
                                    withId(android.R.id.content),
                                    0),
                            2),
                    isDisplayed()));
    appCompatButton.perform(click());

    ViewInteraction textView = onView(
            allOf(withText("1"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            0),
                    isDisplayed()));
    textView.check(matches(withText("1")));

    ViewInteraction appCompatButton2 = onView(
            allOf(withId(R.id.button), withText("2"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            1),
                    isDisplayed()));
    appCompatButton2.perform(click());

    ViewInteraction textView2 = onView(
            allOf(withText("2"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            0),
                    isDisplayed()));
    textView2.check(matches(withText("2")));

    ViewInteraction appCompatButton3 = onView(
            allOf(withId(R.id.button), withText("1"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            1),
                    isDisplayed()));
    appCompatButton3.perform(click());

    ViewInteraction textView3 = onView(
            allOf(withText("1"),
                    childAtPosition(
                            childAtPosition(
                                    withId(R.id.fragment_container),
                                    0),
                            0),
                    isDisplayed()));
    textView3.check(matches(withText("1")));

}
 
开发者ID:grzechu92,项目名称:frogment,代码行数:64,代码来源:FragmentSwitchingFromFragmentTest.java


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