Skip to content

Instantly share code, notes, and snippets.

@joecks
Last active January 3, 2018 16:02
Show Gist options
  • Save joecks/bd7954637a290b651bed12de3d3838a9 to your computer and use it in GitHub Desktop.
Save joecks/bd7954637a290b651bed12de3d3838a9 to your computer and use it in GitHub Desktop.
class RideDetails : ScopedActions(idMatcher(R.id.ride_details_container)) {
fun inRideEditButton(action: UiActions.() -> Actions) =
UiActions(idMatcher(R.id.rideBookedDetailEdit)).action()
fun inRideMapButton(action: UiActions.() -> Actions) =
UiActions(idMatcher(R.id.map_item)).action()
fun inRideStopList(action: List.() -> Actions) =
List(R.id.ridesStopsRecycler).action()
fun inSuccessDialog(action: Dialog.() -> Actions) =
Dialog(ResString(R.string.message_ride_book_success_title)).action()
}
class Robot {
fun inLanding(action: Landing.() -> Actions) = Landing().action()
fun inRideDetails(action: RideDetails.() -> Actions) = RideDetails().action()
fun pressBack(): Actions {
Espresso.pressBack()
return NoActions
}
fun inRideMap(action: RideMapView.() -> Actions) = RideMapView().action()
}
fun robot(action: Robot.() -> Actions) {
Robot().action()
}
internal fun idMatcher(@IdRes resId: Int) = {
ViewMatchers.withId(resId)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment