use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.
the class UiBot method openSearchView.
public void openSearchView() throws UiObjectNotFoundException {
UiObject searchView = findSearchView();
searchView.click();
assertTrue(searchView.exists());
}
use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.
the class UiBot method setSearchQuery.
public void setSearchQuery(String query) throws UiObjectNotFoundException {
UiObject searchView = findSearchView();
assertTrue(searchView.exists());
UiObject searchTextField = findSearchViewTextField();
searchTextField.setText(query);
assertSearchTextField(true, query);
}
use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.
the class BugreportReceiverTest method bugreportFinishedWithWarningTest.
private void bugreportFinishedWithWarningTest(Integer propertyState) throws Exception {
if (propertyState == null) {
// Clear properties
mContext.getSharedPreferences(PREFS_BUGREPORT, Context.MODE_PRIVATE).edit().clear().commit();
// Sanity check...
assertEquals("Did not reset properties", STATE_UNKNOWN, getWarningState(mContext, STATE_UNKNOWN));
} else {
setWarningState(mContext, propertyState);
}
// Send notification and click on share.
sendBugreportFinished(NO_ID, mPlainTextPath, null);
acceptBugreport(NO_ID);
// Handle the warning
mUiBot.getVisibleObject(mContext.getString(R.string.bugreport_confirm));
// TODO: get ok and dontShowAgain from the dialog reference above
UiObject dontShowAgain = mUiBot.getVisibleObject(mContext.getString(R.string.bugreport_confirm_dont_repeat));
final boolean firstTime = propertyState == null || propertyState == STATE_UNKNOWN;
if (firstTime) {
if (Build.TYPE.equals("user")) {
assertFalse("Checkbox should NOT be checked by default on user builds", dontShowAgain.isChecked());
mUiBot.click(dontShowAgain, "dont-show-again");
} else {
assertTrue("Checkbox should be checked by default on build type " + Build.TYPE, dontShowAgain.isChecked());
}
} else {
assertFalse("Checkbox should not be checked", dontShowAgain.isChecked());
mUiBot.click(dontShowAgain, "dont-show-again");
}
UiObject ok = mUiBot.getVisibleObject(mContext.getString(com.android.internal.R.string.ok));
mUiBot.click(ok, "ok");
// Share the bugreport.
mUiBot.chooseActivity(UI_NAME);
Bundle extras = mListener.getExtras();
assertActionSendMultiple(extras, BUGREPORT_CONTENT, NO_SCREENSHOT);
// Make sure it's hidden now.
int newState = getWarningState(mContext, STATE_UNKNOWN);
assertEquals("Didn't change state", STATE_HIDE, newState);
}
use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.
the class BugreportReceiverTest method assertScreenshotButtonEnabled.
private void assertScreenshotButtonEnabled(boolean expectedEnabled) throws Exception {
UiObject screenshotButton = getScreenshotButton();
assertEquals("wrong state for screenshot button ", expectedEnabled, screenshotButton.isEnabled());
}
use of android.support.test.uiautomator.UiObject in project platform_frameworks_base by android.
the class BugreportReceiverTest method testProgress_cancel.
public void testProgress_cancel() throws Exception {
resetProperties();
sendBugreportStarted(1000);
waitForScreenshotButtonEnabled(true);
final NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
assertProgressNotification(NAME, 00.00f);
openProgressNotification(ID);
UiObject cancelButton = mUiBot.getVisibleObject(mContext.getString(com.android.internal.R.string.cancel).toUpperCase());
mUiBot.click(cancelButton, "cancel_button");
waitForService(false);
}
Aggregations