use of net.bytebuddy.utility.RandomString in project collect by opendatakit.
the class AllWidgetsFormTest method testStringWidget.
public void testStringWidget() {
String stringWidgetText = randomString();
onVisibleEditText().perform(replaceText(stringWidgetText));
// captures screenshot of string widget
Screengrab.screenshot("string-input");
openWidgetList();
onView(withText("String widget")).perform(click());
onVisibleEditText().check(matches(withText(stringWidgetText)));
onView(withText("String widget")).perform(swipeLeft());
}
use of net.bytebuddy.utility.RandomString in project collect by opendatakit.
the class AllWidgetsFormTest method testExStringWidget.
public void testExStringWidget() {
// Manually input the value:
String exStringWidgetFirstText = randomString();
when(activityAvailability.isActivityAvailable(any(Intent.class))).thenReturn(false);
onView(withText("Launch")).perform(click());
onVisibleEditText().perform(replaceText(exStringWidgetFirstText));
openWidgetList();
onView(withText("Ex string widget")).perform(click());
Screengrab.screenshot("ex-string");
onVisibleEditText().check(matches(withText(exStringWidgetFirstText)));
// Replace with Intent value:
String exStringWidgetSecondText = randomString();
Intent stringIntent = new Intent();
stringIntent.putExtra("value", exStringWidgetSecondText);
ActivityResult exStringResult = new ActivityResult(RESULT_OK, stringIntent);
intending(allOf(hasAction("change.uw.android.BREATHCOUNT"), hasExtra("value", exStringWidgetFirstText))).respondWith(exStringResult);
when(activityAvailability.isActivityAvailable(any(Intent.class))).thenReturn(true);
onView(withText("Launch")).perform(click());
onView(withText(exStringWidgetSecondText)).check(matches(isDisplayed()));
Screengrab.screenshot("ex-string2");
openWidgetList();
onView(withText("Ex string widget")).perform(click());
onVisibleEditText().check(matches(withText(exStringWidgetSecondText)));
onView(withText("Ex string widget")).perform(swipeLeft());
}
Aggregations