Je suis en train d'écrire le test d'automatisation pour View pager en utilisant Espresso 2.2 dans lequel j'ai besoin de tester la fonctionnalité de balayage.Comment tester le geste de balayage de pager de vue dans Android en utilisant Espresso 2.2
J'ai écrit le code ci-dessous:
@LargeTest
public class FirstActivityTest {
@Rule
public ActivityTestRule<FirstActivity> firstActivityTestRule =
new ActivityTestRule<>(FirstActivity.class);
@Test
public void testViewPagerSwipeFunctionality() throws InterruptedException{
onView(withId(R.id.tv_commu)).check(matches(withText(R.string.first_screen_text)));
onView(withId(R.id.tv_skip)).check(matches(withText(R.string.skip))) ;
onView(withId(R.id.radio_button_first)).check(matches(isChecked()));
onView(withId(R.id.view_pager)).perform(swipLeft());
onView(withId(R.id.radio_button_second))
.check(matches(isChecked()));
onView(withId(R.id.tv_comp)).check(matches(withText(R.string.second_screen_text)));
onView(withId(R.id.tv_skip)).check(matches(withText(R.string.skip))) ;
onView(withId(R.id.view_pager)).perform(swipeLeft());
onView(withId(R.id.radio_button_third))
.check(matches(isChecked()));
onView(withId(R.id.tv_skip)).check(matches(withText(R.string.skip))) ;
onView(withId(R.id.tv_person)).check(matches(withText(R.string.third_screen_text)));}}
Cependant la méthode swipeLeft() ne se résolu. S'il vous plaît laissez-moi savoir où je fais mal? Votre aide sera très appréciée.
Salut, ce problème est-il résolu? S'il vous plaît ajouter plus d'informations sur le problème que vous aviez fait face – piotrek1543
Ouais, son été résolu, besoin de faire l'importation statique. – user1740281