Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automating number picker in android using espresso

How to automate number picker using espresso. I want to set specific time in the timePicker using espresso.

like image 524
Pranit Avatar asked Jun 06 '14 05:06

Pranit


People also ask

What is espresso automation?

Espresso created by Google is a native framework for Android automated testing. The tool is a part of the Android SDK and is easy to use for native mobile development. Thanks to Espresso, you can create tests that are close to the Android app's logic.

What is the significance of espresso in Android?

Espresso is an open source android user interface (UI) testing framework developed by Google. The term Espresso is of Italian origin, meaning Coffee. Espresso is a simple, efficient and flexible testing framework.

What is the espresso recording tool?

The Espresso Test Recorder tool lets you create UI tests for your app without writing any test code. By recording a test scenario, you can record your interactions with a device and add assertions to verify UI elements in particular snapshots of your app.


1 Answers

For those looking at this question later (like me) this might be helpful: DateTimePickerTest makes use of PickerActions. PickerActions allows code for date pickers like this (Java):

onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).perform(PickerActions.setDate(year, month + 1, day));

Or for time pickers (Kotlin):

onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(0, 10))
like image 60
yasd Avatar answered Oct 22 '22 03:10

yasd