use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZonePickerSettingsTest method wait.
/**
* @throws UiObjectNotFoundException if UiDevice.wait returns null
*/
private UiObject2 wait(BySelector selector) throws UiObjectNotFoundException {
UiObject2 item = mDevice.wait(Until.findObject(selector), TIMEOUT);
assertUiObjectFound(item, selector);
return item;
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SoundSettingsTest method findRingtoneInList.
private UiObject2 findRingtoneInList(String ringtone) throws Exception {
mHelper.scrollVert(false);
SystemClock.sleep(1000);
UiObject2 ringToneObject = mDevice.wait(Until.findObject(By.text(ringtone)), TIMEOUT);
int count = 0;
while (ringToneObject == null && count < 5) {
mHelper.scrollVert(true);
SystemClock.sleep(1000);
ringToneObject = mDevice.wait(Until.findObject(By.text(ringtone)), TIMEOUT);
count++;
}
return ringToneObject;
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SoundSettingsTest method clickMore.
private void clickMore() throws InterruptedException {
UiObject2 more = mDevice.wait(Until.findObject(By.text("Advanced")), TIMEOUT);
if (more != null) {
more.click();
Thread.sleep(TIMEOUT);
}
}
use of android.support.test.uiautomator.UiObject2 in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataSaverSummaryUITest method launchDataSaverSettings.
private void launchDataSaverSettings() throws InterruptedException {
mInstrumentation.getContext().startActivity(mIntent);
final UiObject2 prefDataSaver = mUiDevice.wait(Until.findObject(By.text("Data Saver")), TIMEOUT);
assertThat(prefDataSaver).isNotNull();
prefDataSaver.click();
Thread.sleep(TIMEOUT * 2);
}
use of android.support.test.uiautomator.UiObject2 in project android_packages_apps_Settings by omnirom.
the class PrintJobSettingsActivityTest method viewPrintJobSettings.
@Test
@LargeTest
public void viewPrintJobSettings() throws Exception {
UUID uuid = UUID.randomUUID();
Object isWriteCalled = new Object();
// Create adapter that is good enough to start a print preview
PrintDocumentAdapter adapter = new PrintDocumentAdapter() {
@Override
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras) {
callback.onLayoutFinished(new PrintDocumentInfo.Builder(uuid.toString()).build(), true);
}
@Override
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback callback) {
synchronized (isWriteCalled) {
isWriteCalled.notify();
}
callback.onWriteFailed(null);
}
};
Activity activity = mActivityRule.getActivity();
PrintManager pm = mActivityRule.getActivity().getSystemService(PrintManager.class);
// Start printing
PrintJob printJob = pm.print(uuid.toString(), adapter, null);
// Wait until print preview is up
synchronized (isWriteCalled) {
isWriteCalled.wait();
}
// Start print job settings
Intent intent = new Intent(android.provider.Settings.ACTION_PRINT_SETTINGS);
intent.putExtra(EXTRA_PRINT_JOB_ID, printJob.getId().flattenToString());
intent.setData(Uri.fromParts("printjob", printJob.getId().flattenToString(), null));
activity.startActivity(intent);
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
UiObject2 printPrefTitle = uiDevice.wait(Until.findObject(By.text("Configuring " + uuid.toString())), 5000);
assertNotNull(printPrefTitle);
Log.i(LOG_TAG, "Found " + printPrefTitle.getText());
}
Aggregations