本文整理汇总了Java中android.support.test.espresso.contrib.PickerActions类的典型用法代码示例。如果您正苦于以下问题:Java PickerActions类的具体用法?Java PickerActions怎么用?Java PickerActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PickerActions类属于android.support.test.espresso.contrib包,在下文中一共展示了PickerActions类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testShiftRepeaterTaskToTomorrow
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
public void testShiftRepeaterTaskToTomorrow() {
DateTime tomorrow = DateTime.now().withTimeAtStartOfDay().plusDays(1);
defaultSetUp();
openAgenda();
onListItem(2).perform(swipeRight());
onListItem(2).onChildView(withId(R.id.item_menu_schedule_btn)).perform(click());
onView(withId(R.id.dialog_timestamp_date_picker)).perform(click());
onView(withClassName(equalTo(DatePicker.class.getName())))
.perform(PickerActions.setDate(
tomorrow.getYear(),
tomorrow.getMonthOfYear(),
tomorrow.getDayOfMonth()));
onView(withText(R.string.ok)).perform(click());
onView(withText(R.string.set)).perform(click());
onView(allOf(withId(android.R.id.list), isDisplayed())).check(matches(listViewItemCount(21)));
}
开发者ID:orgzly,项目名称:orgzly-android,代码行数:19,代码来源:AgendaFragmentTest.java
示例2: testClickDepartureDate
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
public void testClickDepartureDate() {
onView(withId(R.id.departureDateTextView)).perform(click());
onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).check(matches(isDisplayed()));
// set date to 10 days ahead
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 10);
// set date to datePicker dialog
onView(withClassName(Matchers.equalTo(DatePicker.class.getName())))
.perform(PickerActions.setDate(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)+1,
calendar.get(Calendar.DAY_OF_MONTH)));
// click ok on the datePicker dialog
onView(withId(android.R.id.button1)).perform(click());
// validate label is set same as date set
onView(withId(R.id.departureDateTextView))
.check(matches(withText(mSimpleDateFormat.format(calendar.getTime()))));
}
开发者ID:ricasares,项目名称:FlightSearch,代码行数:24,代码来源:SearchFlightsTest.java
示例3: testClickDepartureDateCancel
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
public void testClickDepartureDateCancel() {
onView(withId(R.id.departureDateTextView)).perform(click());
onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).check(matches(isDisplayed()));
// get departureDateTextView value
String departure = ((TextView) mActivityRule.getActivity().findViewById(R.id.departureDateTextView)).getText().toString();
// set date to 10 days ahead
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 10);
// set date to datePicker dialog
onView(withClassName(Matchers.equalTo(DatePicker.class.getName())))
.perform(PickerActions.setDate(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)+1,
calendar.get(Calendar.DAY_OF_MONTH)));
// click cancel on the datePicker dialog
onView(withId(android.R.id.button2)).perform(click());
// validate label has not changed
onView(withId(R.id.departureDateTextView))
.check(matches(withText(departure)));
}
开发者ID:ricasares,项目名称:FlightSearch,代码行数:27,代码来源:SearchFlightsTest.java
示例4: testClickReturnDate
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
public void testClickReturnDate() {
onView(withId(R.id.returnDateTextView)).perform(click());
onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).check(matches(isDisplayed()));
// set date to 20 days ahead.
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 20);
// set date to datePicker dialog
onView(withClassName(Matchers.equalTo(DatePicker.class.getName())))
.perform(PickerActions.setDate(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)+1,
calendar.get(Calendar.DAY_OF_MONTH)));
// click ok on the datePicker dialog
onView(withId(android.R.id.button1)).perform(click());
// validate label is set same as date set
onView(withId(R.id.returnDateTextView))
.check(matches(withText(mSimpleDateFormat.format(calendar.getTime()))));
}
开发者ID:ricasares,项目名称:FlightSearch,代码行数:24,代码来源:SearchFlightsTest.java
示例5: testClickReturnDateCancel
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
public void testClickReturnDateCancel() {
onView(withId(R.id.returnDateTextView)).perform(click());
onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).check(matches(isDisplayed()));
// get return date textview value
String textViewValue = ((TextView) mActivityRule.getActivity().findViewById(R.id.returnDateTextView)).getText().toString();
// set date to 20 days ahead.
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 20);
// set date to datePicker dialog
onView(withClassName(Matchers.equalTo(DatePicker.class.getName())))
.perform(PickerActions.setDate(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH)+1,
calendar.get(Calendar.DAY_OF_MONTH)));
// click cancel on the datePicker dialog
onView(withId(android.R.id.button2)).perform(click());
// validate label has not changed
onView(withId(R.id.returnDateTextView))
.check(matches(withText(textViewValue)));
}
开发者ID:ricasares,项目名称:FlightSearch,代码行数:27,代码来源:SearchFlightsTest.java
示例6: testDatePicker
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
/**
* Tests a date picker by inputting a date in the date picker then validating
* if the date is displayed.
*/
@Test
public void testDatePicker(){
onView(withId(R.id.input_datepicker)).perform(PickerActions.setDate(2015, 10, 27));
checkIfIdIsDisplayedWithText(R.id.input_date_display, "10/27/2015");
}
开发者ID:awslabs,项目名称:aws-device-farm-sample-app-for-android,代码行数:10,代码来源:DatePickerTest.java
示例7: testTimePicker
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
/**
* Tests a time picker by setting the time and checking the time display
*/
@Test
public void testTimePicker() {
onView(withId(R.id.input_timepicker)).perform(PickerActions.setTime(8, 2));
checkIfIdIsDisplayedWithText(R.id.input_time_display, "8 : 02");
}
开发者ID:awslabs,项目名称:aws-device-farm-sample-app-for-android,代码行数:9,代码来源:TimePickerTest.java
示例8: pickDate
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
public DatePickerTester pickDate(int day, Month month, int year) {
onView(withClassName(Matchers.equalTo(DatePicker.class.getName())))
.perform(PickerActions.setDate(year, month.getValue(), day));
return this;
}
开发者ID:sewerk,项目名称:Bill-Calculator,代码行数:6,代码来源:FormTester.java
示例9: userAddTest
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
public void userAddTest() {
mActivityTestRule.launchActivity(null);
ViewInteraction editText = onView(
allOf(withId(R.id.txtUserName),
childAtPosition(
allOf(withId(R.id.rowUserName),
childAtPosition(
withId(R.id.tableUserData),
0)),
1)));
editText.perform(scrollTo(), click());
ViewInteraction editText2 = onView(
allOf(withId(R.id.txtUserName),
childAtPosition(
allOf(withId(R.id.rowUserName),
childAtPosition(
withId(R.id.tableUserData),
0)),
1)));
editText2.perform(scrollTo(), replaceText("test"), closeSoftKeyboard());
ViewInteraction editText3 = onView(
allOf(withId(R.id.txtBodyHeight),
childAtPosition(
allOf(withId(R.id.rowBodyHeight),
childAtPosition(
withId(R.id.tableUserData),
1)),
1)));
editText3.perform(scrollTo(), replaceText("180"), closeSoftKeyboard());
onView(withId(R.id.txtBirthday)).perform(click());
onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).perform(PickerActions.setDate(1990, 1, 19));
onView(withId(android.R.id.button1)).perform(click());
ViewInteraction editText5 = onView(
allOf(withId(R.id.txtInitialWeight),
childAtPosition(
allOf(withId(R.id.tableRowInitialWeight),
childAtPosition(
withId(R.id.tableUserData),
5)),
1)));
editText5.perform(scrollTo(), replaceText("80"), closeSoftKeyboard());
ViewInteraction editText6 = onView(
allOf(withId(R.id.txtGoalWeight),
childAtPosition(
allOf(withId(R.id.rowGoalWeight),
childAtPosition(
withId(R.id.tableUserData),
6)),
1)));
editText6.perform(scrollTo(), replaceText("60"), closeSoftKeyboard());
onView(withId(R.id.txtGoalDate)).perform(click());
onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).perform(PickerActions.setDate(2018, 1, 31));
onView(withId(android.R.id.button1)).perform(click());
ViewInteraction button3 = onView(
allOf(withId(R.id.btnOk),
childAtPosition(
childAtPosition(
withClassName(is("android.widget.LinearLayout")),
1),
2)));
button3.perform(scrollTo(), click());
}
开发者ID:oliexdev,项目名称:openScale,代码行数:72,代码来源:UserAddTest.java
示例10: setDate
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
/**
* @see android.support.test.espresso.contrib.PickerActions#setDate(int, int, int)
* @return The model reached by interacting with this element.
*/
public T setDate(int year, int monthOfYear, int dayOfMonth) {
return performAction(PickerActions.setDate(year, monthOfYear, dayOfMonth));
}
开发者ID:mindbody,项目名称:Ironhide,代码行数:8,代码来源:DatePicker.java
示例11: setTime
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
/**
* @see android.support.test.espresso.contrib.PickerActions#setTime(int, int)
* @return The model reached by interacting with this element.
*/
public T setTime(int hours, int minutes) {
return performAction(PickerActions.setTime(hours, minutes));
}
开发者ID:mindbody,项目名称:Ironhide,代码行数:8,代码来源:DatePicker.java
示例12: testRestartAppDuringAnalysis
import android.support.test.espresso.contrib.PickerActions; //导入依赖的package包/类
@Test
@RequiresDevice
public void testRestartAppDuringAnalysis() {
onView(withText(R.string.calibrate)).perform(click());
onView(withText(currentHashMap.get("fluoride"))).perform(click());
if (TestUtil.isEmulator()) {
onView(withText(R.string.errorCameraFlashRequired))
.inRoot(withDecorView(not(is(mActivityRule.getActivity().getWindow()
.getDecorView())))).check(matches(isDisplayed()));
return;
}
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
onView(withId(R.id.fabEditCalibration)).perform(click());
onView(withId(R.id.editBatchCode))
.perform(typeText("TEST 123#*@!"), closeSoftKeyboard());
onView(withId(R.id.editExpiryDate)).perform(click());
onView(withClassName((Matchers.equalTo(DatePicker.class.getName()))))
.perform(PickerActions.setDate(2025, 8, 25));
onView(withId(android.R.id.button1)).perform(click());
onView(withText(R.string.save)).perform(click());
onView(allOf(withId(R.id.calibrationList),
childAtPosition(withClassName(is("android.widget.RelativeLayout")),
3))).perform(actionOnItemAtPosition(4, click()));
// onView(withText("2" + dfs.getDecimalSeparator() + "0 mg/l")).perform(click());
//onView(withId(R.id.buttonStart)).perform(click());
mDevice.pressHome();
try {
mDevice.pressRecentApps();
} catch (RemoteException e) {
Timber.e(e);
}
sleep(2000);
mDevice.click(mDevice.getDisplayWidth() / 2, (mDevice.getDisplayHeight() / 2) + 300);
mDevice.click(mDevice.getDisplayWidth() / 2, (mDevice.getDisplayHeight() / 2) + 300);
mDevice.click(mDevice.getDisplayWidth() / 2, (mDevice.getDisplayHeight() / 2) + 300);
mDevice.waitForWindowUpdate("", 1000);
//clickListViewItem("Automated Tests");
clickListViewItem("test caddisfly");
}
开发者ID:akvo,项目名称:akvo-caddisfly,代码行数:64,代码来源:MiscTest.java
注:本文中的android.support.test.espresso.contrib.PickerActions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论