Best Appium-espresso-driver code snippet using android.support.test.espresso.ViewAction
ViewActions.kt
Source:ViewActions.kt
1package ru.ltst.u2020mvp.util2import android.support.test.espresso.PerformException3import android.support.test.espresso.UiController4import android.support.test.espresso.ViewAction5import android.support.test.espresso.action.GeneralLocation6import android.support.test.espresso.action.GeneralSwipeAction7import android.support.test.espresso.action.Press8import android.support.test.espresso.action.Swipe9import android.support.test.espresso.matcher.ViewMatchers.isRoot10import android.support.test.espresso.matcher.ViewMatchers.withId11import android.support.test.espresso.util.HumanReadables12import android.support.test.espresso.util.TreeIterables13import android.view.View14import org.hamcrest.CoreMatchers.any15import org.hamcrest.Matcher16import java.util.concurrent.TimeoutException17object ViewActions {18 /**19 * Perform action of waiting for a specific view id.20 *21 *22 * E.g.:23 * onView(isRoot()).perform(waitId(R.id.dialogEditor, Sampling.SECONDS_15));24 * @param viewId25 * *26 * @param millis27 * *28 * @return29 */30 fun waitId(viewId: Int, millis: Long): ViewAction {31 return object : ViewAction {32 override fun getConstraints(): Matcher<View> {33 return isRoot()34 }35 override fun getDescription(): String {36 return "wait for a specific view with id <$viewId> during $millis millis."37 }38 override fun perform(uiController: UiController, view: View) {39 uiController.loopMainThreadUntilIdle()40 val startTime = System.currentTimeMillis()41 val endTime = startTime + millis42 val viewMatcher = withId(viewId)43 do {44 for (child in TreeIterables.breadthFirstViewTraversal(view)) {45 // found view with required ID46 if (viewMatcher.matches(child)) {47 return48 }49 }50 uiController.loopMainThreadForAtLeast(50)51 } while (System.currentTimeMillis() < endTime)52 // timeout happens53 throw PerformException.Builder().withActionDescription(this.description).withViewDescription(HumanReadables.describe(view)).withCause(TimeoutException()).build()54 }55 }56 }57 /**58 * Perform action of waiting for a specific time. Useful when you need59 * to wait for animations to end and Espresso fails at waiting.60 *61 *62 * E.g.:63 * onView(isRoot()).perform(waitAtLeast(Sampling.SECONDS_15));64 * @param millis65 * *66 * @return67 */68 fun waitAtLeast(millis: Long): ViewAction {69 return object : ViewAction {70 override fun getConstraints(): Matcher<View> {71 return any(View::class.java)72 }73 override fun getDescription(): String {74 return "wait for at least $millis millis."75 }76 override fun perform(uiController: UiController, view: View) {77 uiController.loopMainThreadUntilIdle()78 uiController.loopMainThreadForAtLeast(millis)79 }80 }81 }82 fun swipeTop(): ViewAction {83 return GeneralSwipeAction(Swipe.FAST, GeneralLocation.BOTTOM_CENTER, GeneralLocation.TOP_CENTER, Press.FINGER)84 }85 fun swipeBottom(): ViewAction {86 return GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER, GeneralLocation.BOTTOM_CENTER, Press.FINGER)87 }88 /**89 * Perform action of waiting until UI thread is free.90 *91 *92 * E.g.:93 * onView(isRoot()).perform(waitUntilIdle());94 * @return95 */96 fun waitUntilIdle(): ViewAction {97 return object : ViewAction {98 override fun getConstraints(): Matcher<View> {99 return any(View::class.java)100 }101 override fun getDescription(): String {102 return "wait until UI thread is free"103 }104 override fun perform(uiController: UiController, view: View) {105 uiController.loopMainThreadUntilIdle()106 }107 }108 }109 fun withCustomConstraints(action: ViewAction, constraints: Matcher<View>): ViewAction {110 return object : ViewAction {111 override fun getDescription(): String {112 return action.description113 }114 override fun getConstraints(): Matcher<View> {115 return constraints;116 }117 override fun perform(uiController: UiController, view: View) {118 action.perform(uiController, view)119 }120 }121 }122}...
NavigationViewActions.kt
Source:NavigationViewActions.kt
...17import android.content.res.Resources.NotFoundException18import android.support.design.widget.NavigationView19import android.support.test.espresso.PerformException20import android.support.test.espresso.UiController21import android.support.test.espresso.ViewAction22import android.support.test.espresso.matcher.ViewMatchers23import android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom24import android.support.test.espresso.matcher.ViewMatchers.isDisplayingAtLeast25import android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility26import android.support.test.espresso.util.HumanReadables27import android.support.v4.widget.DrawerLayout28import android.view.Menu29import android.view.View30import org.hamcrest.Matcher31import org.hamcrest.Matchers.allOf32/**33 * View actions for interacting with [NavigationView]34 */35object NavigationViewActions {36 /**37 * Returns a [ViewAction] that navigates to a menu item in [NavigationView] using a38 * menu item resource id.39 *40 *41 *42 *43 * View constraints:44 *45 * * View must be a child of a [DrawerLayout]46 * * View must be of type [NavigationView]47 * * View must be visible on screen48 * * View must be displayed on screen49 *50 *51 * @param menuItemId the resource id of the menu item52 * @return a [ViewAction] that navigates on a menu item53 */54 fun navigateTo(menuItemId: Int): ViewAction {55 return object : ViewAction {56 override fun perform(uiController: UiController, view: View) {57 val navigationView = view as NavigationView58 val menu = navigationView.menu59 if (null == menu.findItem(menuItemId)) {60 throw PerformException.Builder()61 .withActionDescription(this.description)62 .withViewDescription(HumanReadables.describe(view))63 .withCause(RuntimeException(getErrorMessage(menu, view)))64 .build()65 }66 menu.performIdentifierAction(menuItemId, 0)67 uiController.loopMainThreadUntilIdle()68 }69 private fun getErrorMessage(menu: Menu, view: View): String {...
RecyclerViewUtils.kt
Source:RecyclerViewUtils.kt
1package eu.caraus.appsflastfm.testUtils.views2import android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition3import android.support.v7.widget.RecyclerView4import android.support.test.espresso.UiController5import android.support.test.espresso.matcher.ViewMatchers6import android.support.test.espresso.ViewAction7import android.support.test.espresso.util.HumanReadables8import android.support.test.espresso.PerformException9import android.support.annotation.IdRes10import android.support.test.espresso.Espresso11import android.support.test.espresso.assertion.ViewAssertions12import android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom13import android.support.test.espresso.matcher.ViewMatchers.isDisplayed14import android.view.View15import org.hamcrest.*16import org.hamcrest.Matchers.allOf17object RecyclerViewUtils {18 fun <VH : RecyclerView.ViewHolder> actionOnItemViewAtPosition( position:Int, @IdRes viewId:Int, viewAction:ViewAction):ViewAction {19 return ActionOnItemViewAtPositionViewAction<VH>(position, viewId, viewAction)20 }21 fun recyclerViewItemsCount(@IdRes RecyclerViewId: Int): Int {22 var COUNT = 023 val matcher = object : TypeSafeMatcher<View>() {24 override fun matchesSafely(item: View): Boolean {25 COUNT = (item as RecyclerView).adapter.itemCount26 return true27 }28 override fun describeTo(description: Description) {29 }30 }31 Espresso.onView(CoreMatchers.allOf(ViewMatchers.withId(RecyclerViewId), isDisplayed())).check(ViewAssertions.matches(matcher))32 val result = COUNT33 COUNT = 034 return result35 }36 class ActionOnItemViewAtPositionViewAction<VH : RecyclerView.ViewHolder>37 ( private val position:Int,38 @param:IdRes private val viewId:Int,39 private val viewAction:ViewAction )40 : ViewAction {41 override fun getConstraints(): Matcher<View> {42 return allOf( isAssignableFrom(RecyclerView::class.java), isDisplayed() )43 }44 override fun getDescription():String {45 return ("actionOnItemAtPosition performing ViewAction: " + this.viewAction.description + " on item at position: " + this.position)46 }47 override fun perform(uiController:UiController, view:View) {48 val recyclerView = view as RecyclerView49 ScrollToPositionViewAction(this.position).perform( uiController, view)50 uiController.loopMainThreadUntilIdle()51 val targetView = recyclerView.getChildAt(this.position).findViewById<View>(this.viewId)52 if (targetView == null)53 {54 throw PerformException.Builder().withActionDescription(this.toString())55 .withViewDescription(56 HumanReadables.describe(view))57 .withCause(IllegalStateException(58 "No view with id "59 + this.viewId60 + " found at position: "61 + this.position))62 .build()63 }64 else65 {66 this.viewAction.perform(uiController, targetView)67 }68 }69 }70 class ScrollToPositionViewAction (71 private val position : Int )72 : ViewAction {73 override fun getConstraints():Matcher<View> {74 return allOf( isAssignableFrom(RecyclerView::class.java), isDisplayed() )75 }76 override fun getDescription():String {77 return "scroll RecyclerView to position: " + this.position78 }79 override fun perform(uiController:UiController, view:View) {80 val recyclerView = view as RecyclerView81 recyclerView.scrollToPosition(this.position)82 }83 }84 fun withRecyclerView( recyclerViewId : Int) : RecyclerViewMatcher {85 return RecyclerViewMatcher(recyclerViewId)86 }...
RecyclerViewItemInteractions.kt
Source:RecyclerViewItemInteractions.kt
2import android.support.annotation.IdRes3import android.support.test.espresso.NoMatchingViewException4import android.support.test.espresso.PerformException.Builder5import android.support.test.espresso.UiController6import android.support.test.espresso.ViewAction7import android.support.test.espresso.ViewAssertion8import android.support.test.espresso.action.ViewActions9import android.support.test.espresso.matcher.ViewMatchers10import android.support.test.espresso.util.HumanReadables11import android.support.v7.widget.RecyclerView12import android.view.View13import org.hamcrest.Matcher14import org.hamcrest.Matchers15internal object RecyclerViewItemInteractions {16 internal const val rootViewId = -117 internal fun actionOnItemViewAtPosition(position: Int, @IdRes viewId: Int, viewAction: ViewAction): ViewAction {18 return ActionOnItemViewAtPositionViewAction(position, viewId, viewAction)19 }20 internal fun assertionOnItemViewAtPosition(position: Int, @IdRes viewId: Int = rootViewId, viewAssertion: ViewAssertion): ViewAssertion {21 return AssertionOnItemViewAtPosition(position, viewId, viewAssertion)22 }23 private class ActionOnItemViewAtPositionViewAction (24 private val position: Int,25 @IdRes private val viewId: Int,26 private val viewAction: ViewAction) : ViewAction {27 override fun getConstraints(): Matcher<View> = createConstraints()28 override fun getDescription(): String {29 return "actionOnItemAtPosition performing ViewAction: ${viewAction.description} on item at position: $position"30 }31 override fun perform(uiController: UiController, view: View) {32 val recyclerView = view as RecyclerView33 ScrollToPositionViewAction(position).perform(uiController, view)34 uiController.loopMainThreadUntilIdle()35 val targetView = recyclerView.getChildAt(position).apply {36 if (viewId == rootViewId) {37 rootView38 } else {39 findViewById<View>(viewId)40 }41 }42 if (targetView == null) {43 throw Builder()44 .withActionDescription(this.toString())45 .withViewDescription(HumanReadables.describe(view))46 .withCause(IllegalStateException("No view with id $viewId found at position: $position"))47 .build()48 } else {49 viewAction.perform(uiController, targetView)50 }51 }52 }53 private class AssertionOnItemViewAtPosition(private val position: Int,54 @IdRes private val viewId: Int,55 private val viewAssertion: ViewAssertion) : ViewAssertion {56 override fun check(view: View?, noViewFoundException: NoMatchingViewException?) {57 val recyclerView = view as RecyclerView58 actionOnItemViewAtPosition(position, viewId, ViewActions.scrollTo())59 val childAt = recyclerView.getChildAt(position)60 val targetView = childAt.findViewById<View>(viewId)61 ?: throw Builder().withCause(noViewFoundException).build()62 viewAssertion.check(targetView, noViewFoundException)63 }64 }65 private class ScrollToPositionViewAction(private val position: Int) : ViewAction {66 override fun getConstraints(): Matcher<View> = createConstraints()67 override fun getDescription(): String {68 return "scroll RecyclerView to position: $position"69 }70 override fun perform(uiController: UiController, view: View) {71 val recyclerView = view as RecyclerView72 recyclerView.scrollToPosition(position)73 }74 }75 private fun createConstraints() = Matchers.allOf(76 ViewMatchers.isAssignableFrom(RecyclerView::class.java), ViewMatchers.isDisplayed())77}...
InstrumentedTest.kt
Source:InstrumentedTest.kt
2import android.os.Build3import android.os.CountDownTimer4import android.support.test.espresso.Espresso.onView5import android.support.test.espresso.UiController6import android.support.test.espresso.ViewAction7import android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom8import android.support.test.espresso.matcher.ViewMatchers.withId9import android.support.test.rule.ActivityTestRule10import android.support.test.runner.AndroidJUnit411import android.support.v4.app.Fragment12import android.view.View13import android.widget.FrameLayout14import android.widget.ProgressBar15import org.junit.Rule16import org.junit.Test17import org.junit.runner.RunWith18/**19 * @author Hendra Anggrian (hendraanggrian@gmail.com)20 */21@RunWith(AndroidJUnit4::class)22class InstrumentedTest {23 @Rule @JvmField var rule = ActivityTestRule(InstrumentedActivity::class.java)24 @Test25 @Throws(Exception::class)26 fun revealSimple() {27 onView(withId(R.id.container)).perform(replaceFragment(Test1Fragment()))28 onView(withId(R.id.progressBar)).perform(delay(2000))29 }30 @Test31 @Throws(Exception::class)32 fun revealProgramatically() {33 onView(withId(R.id.container)).perform(replaceFragment(Test2Fragment()))34 onView(withId(R.id.progressBar)).perform(delay(4000))35 }36 @Test37 @Throws(Exception::class)38 fun revealTo() {39 onView(withId(R.id.container)).perform(replaceFragment(Test3Fragment()))40 onView(withId(R.id.progressBar)).perform(delay(2000))41 }42 fun replaceFragment(fragment: Fragment): ViewAction = object : ViewAction {43 override fun getDescription() = "attaching fragment " + fragment.javaClass.simpleName44 override fun getConstraints() = isAssignableFrom(FrameLayout::class.java)45 override fun perform(uiController: UiController?, view: View) {46 rule.activity.supportFragmentManager47 .beginTransaction()48 .replace(R.id.container, fragment)49 .commit()50 }51 }52 fun delay(millis: Long): ViewAction = object : ViewAction {53 override fun getDescription() = "delay for " + millis54 override fun getConstraints() = isAssignableFrom(ProgressBar::class.java)55 override fun perform(uiController: UiController, view: View) {56 view as ProgressBar57 object : CountDownTimer(millis, 100) {58 override fun onTick(millisUntilFinished: Long) {59 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {60 view.setProgress((view.max * millisUntilFinished / millis).toInt(), true)61 } else {62 view.progress = (view.max * millisUntilFinished / millis).toInt()63 }64 }65 override fun onFinish() {66 view.visibility = View.GONE...
NestedScrollViewViewAction.kt
Source:NestedScrollViewViewAction.kt
1package com.xmartlabs.bigbang.test.viewaction2import android.graphics.Rect3import android.support.test.espresso.PerformException4import android.support.test.espresso.UiController5import android.support.test.espresso.ViewAction6import android.support.test.espresso.action.ViewActions7import android.support.test.espresso.matcher.ViewMatchers8import android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom9import android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA10import android.support.test.espresso.matcher.ViewMatchers.isDisplayingAtLeast11import android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility12import android.support.test.espresso.util.HumanReadables13import android.support.v4.widget.NestedScrollView14import android.view.View15import org.hamcrest.Matchers.allOf16import org.hamcrest.Matchers.anyOf17import timber.log.Timber18/** [ViewAction] that scrolls the [NestedScrollView] to any desired view */19class NestedScrollViewViewAction : ViewAction {20 companion object {21 private const val DISPLAY_PERCENTAGE = 9022 23 /**24 * Factory method that performs all assertions before the [ViewAction] and then returns it25 *26 * @return the [NestedScrollViewViewAction] instance27 */28 @JvmStatic29 fun scrollTo() = ViewActions.actionWithAssertions(NestedScrollViewViewAction())30 }31 override fun getConstraints() = allOf<View>(32 withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE),33 isDescendantOfA(anyOf<View>(34 isAssignableFrom(NestedScrollView::class.java), isAssignableFrom(NestedScrollView::class.java))35 )36 )37 override fun perform(uiController: UiController, view: View) {38 if (isDisplayingAtLeast(DISPLAY_PERCENTAGE).matches(view)) {39 Timber.i("View is already displayed. Returning.")40 return41 }42 val rect = Rect()43 view.getDrawingRect(rect)...
CustomViewAction.kt
Source:CustomViewAction.kt
1package com.kkbox.hellomusic.viewAction2import android.app.Activity3import android.support.test.espresso.UiController4import android.support.test.espresso.ViewAction5import android.support.test.espresso.action.GeneralClickAction6import android.support.test.espresso.action.GeneralLocation7import android.support.test.espresso.action.Press8import android.support.test.espresso.action.Tap9import android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom10import android.support.test.espresso.matcher.ViewMatchers.withId11import android.view.InputDevice12import android.view.MotionEvent13import android.view.View14import android.widget.TextView15import org.hamcrest.Matcher16class CustomViewAction {17 companion object {18 fun clickChildView(viewId: Int): ViewAction {19 val clickAction = GeneralClickAction(20 Tap.SINGLE,21 GeneralLocation.VISIBLE_CENTER,22 Press.FINGER,23 InputDevice.SOURCE_UNKNOWN,24 MotionEvent.BUTTON_PRIMARY25 )26 return object : ViewAction {27 override fun getConstraints(): Matcher<View> {28 return isAssignableFrom(View::class.java)29 }30 override fun getDescription(): String {31 return "Click child view ${withId(viewId)}"32 }33 override fun perform(uiController: UiController, view: View) {34 val targetView = view.findViewById<View>(viewId)35 clickAction.perform(uiController, targetView)36 }37 }38 }39 fun getText(viewId: Int, stringHolder: ArrayList<String>): ViewAction {40 return object : ViewAction {41 override fun getConstraints(): Matcher<View> {42 return isAssignableFrom(TextView::class.java)43 }44 override fun getDescription(): String {45 return "Get text from TextView"46 }47 override fun perform(uiController: UiController, view: View) {48 val textView = view.findViewById<TextView>(viewId)49 stringHolder.add(textView.text.toString())50 }51 }52 }53 }54}...
ViewAction.kt
Source:ViewAction.kt
...8import org.hamcrest.CoreMatchers.allOf9/**10 * Created by radityagumay on 4/19/17.11 */12object ViewAction {13 fun setTextInTextView(value: String): android.support.test.espresso.ViewAction {14 return object : android.support.test.espresso.ViewAction {15 override fun getConstraints(): Matcher<View> {16 return allOf(isDisplayed(), isAssignableFrom(TextView::class.java!!))17 }18 override fun perform(uiController: UiController, view: View) {19 (view as TextView).text = value20 }21 override fun getDescription(): String {22 return "replace text"23 }24 }25 }26}...
ViewAction
Using AI Code Generation
1ViewAction clickXY(final int x, final int y) {2return new ViewAction() {3public Matcher<View> getConstraints() {4return isAssignableFrom(View.class);5}6public String getDescription() {7return "Click at given X,Y co-ordinates.";8}9public void perform(UiController uiController, View view) {10ClickAction click = new ClickAction(Tap.SINGLE);11click.perform(uiController, view);12}13};14}15ViewAction clickXY(final int x, final int y) {16return new ViewAction() {17public Matcher<View> getConstraints() {18return isAssignableFrom(View.class);19}20public String getDescription() {21return "Click at given X,Y co-ordinates.";22}23public void perform(UiController uiController, View view) {24ClickAction click = new ClickAction(Tap.SINGLE);25click.perform(uiController, view);26}27};28}29ViewAction clickXY(final int x, final int y) {30return new ViewAction() {31public Matcher<View> getConstraints() {32return isAssignableFrom(View.class);33}34public String getDescription() {35return "Click at given X,Y co-ordinates.";36}37public void perform(UiController uiController, View view) {38ClickAction click = new ClickAction(Tap.SINGLE);39click.perform(uiController, view);40}41};42}43ViewAction clickXY(final int x, final int y) {44return new ViewAction() {45public Matcher<View> getConstraints() {46return isAssignableFrom(View.class);47}48public String getDescription() {49return "Click at given X,Y co-ordinates.";50}51public void perform(UiController uiController, View view) {52ClickAction click = new ClickAction(Tap.SINGLE);53click.perform(uiController, view);54}55};56}57ViewAction clickXY(final int x, final int y) {58return new ViewAction() {59public Matcher<View> getConstraints() {60return isAssignableFrom(View.class);61}62public String getDescription() {63return "Click at given X,Y co-ordinates.";64}65public void perform(UiController uiController, View view) {
ViewAction
Using AI Code Generation
1ViewAction action = new ViewAction() {2public Matcher<View> getConstraints() {3return ViewMatchers.isAssignableFrom(TextView.class);4}5public String getDescription() {6return "Click on a child view with specified id.";7}8public void perform(UiController uiController, View view) {9TextView tv = (TextView) view;10tv.setText("This is a test");11}12};13onView(withId(R.id.tv)).perform(action);14ViewAction action = new ViewAction() {15public Matcher<View> getConstraints() {16return ViewMatchers.isAssignableFrom(TextView.class);17}18public String getDescription() {19return "Click on a child view with specified id.";20}21public void perform(UiController uiController, View view) {22TextView tv = (TextView) view;23tv.setText("This is a test");24}25};26onView(withId(R.id.tv)).perform(action);27ViewAction action = new ViewAction() {28public Matcher<View> getConstraints() {29return ViewMatchers.isAssignableFrom(TextView.class);30}31public String getDescription() {32return "Click on a child view with specified id.";33}34public void perform(UiController uiController, View view) {35TextView tv = (TextView) view;36tv.setText("This is a test");37}38};39onView(withId(R.id.tv)).perform(action);40ViewAction action = new ViewAction() {41public Matcher<View> getConstraints() {42return ViewMatchers.isAssignableFrom(TextView.class);43}44public String getDescription() {45return "Click on a child view with specified id.";46}47public void perform(UiController uiController, View view) {48TextView tv = (TextView) view;49tv.setText("This is a test");50}51};52onView(withId(R.id.tv)).perform(action);53ViewAction action = new ViewAction() {54public Matcher<View> getConstraints() {55return ViewMatchers.isAssignableFrom(TextView.class);56}57public String getDescription() {58return "Click on a child view with specified id.";59}60public void perform(UiController uiController, View view) {61TextView tv = (TextView) view;62tv.setText("
ViewAction
Using AI Code Generation
1ViewInteraction appCompatButton = onView(2allOf(withId(R.id.button), withText("Go to next activity"),3childAtPosition(4childAtPosition(5withClassName(is("android.widget.LinearLayout")),60)));7appCompatButton.perform(scrollTo(), click());8ViewInteraction appCompatButton2 = onView(9allOf(withId(R.id.button), withText("Go to next activity"),10childAtPosition(11childAtPosition(12withClassName(is("android.widget.LinearLayout")),130)));14appCompatButton2.perform(scrollTo(), click());15ViewInteraction appCompatButton3 = onView(16allOf(withId(R.id.button), withText("Go to next activity"),17childAtPosition(18childAtPosition(19withClassName(is("android.widget.LinearLayout")),200)));21appCompatButton3.perform(scrollTo(), click());22ViewInteraction appCompatButton4 = onView(23allOf(withId(R.id.button), withText("Go to next activity"),24childAtPosition(25childAtPosition(26withClassName(is("android.widget.LinearLayout")),270)));28appCompatButton4.perform(scrollTo(), click());29ViewInteraction appCompatButton5 = onView(30allOf(withId(R.id.button), withText("Go to next activity"),31childAtPosition(32childAtPosition(33withClassName(is("android.widget.LinearLayout")),340)));35appCompatButton5.perform(scrollTo(), click());36ViewInteraction appCompatButton6 = onView(37allOf(withId(R.id.button), withText("Go to next activity"),38childAtPosition(39childAtPosition(40withClassName(is("android.widget.LinearLayout")),410)));42appCompatButton6.perform(scrollTo(), click());43ViewInteraction appCompatButton7 = onView(44allOf(withId(R.id.button), withText("Go to next activity"),45childAtPosition(46childAtPosition(47withClassName(is("android.widget.LinearLayout")),480)));49appCompatButton7.perform(scrollTo(), click());50ViewInteraction appCompatButton8 = onView(51allOf(withId(R.id.button), with
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!