Search in sources :

Example 81 with UiObject

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());
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 82 with UiObject

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);
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 83 with UiObject

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);
}
Also used : UiObject(android.support.test.uiautomator.UiObject) Bundle(android.os.Bundle)

Example 84 with UiObject

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());
}
Also used : UiObject(android.support.test.uiautomator.UiObject)

Example 85 with UiObject

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);
}
Also used : UiObject(android.support.test.uiautomator.UiObject) NumberFormat(java.text.NumberFormat)

Aggregations

UiObject (android.support.test.uiautomator.UiObject)140 UiSelector (android.support.test.uiautomator.UiSelector)44 UiScrollable (android.support.test.uiautomator.UiScrollable)13 UiObjectNotFoundException (android.support.test.uiautomator.UiObjectNotFoundException)7 DownloadManager (android.app.DownloadManager)5 Request (android.app.DownloadManager.Request)5 Bundle (android.os.Bundle)5 Suppress (android.test.suitebuilder.annotation.Suppress)5 NumberFormat (java.text.NumberFormat)5 Test (org.junit.Test)3 MediumTest (android.support.test.filters.MediumTest)2 UiDevice (android.support.test.uiautomator.UiDevice)2 RelativeLayout (android.widget.RelativeLayout)1