Java Code Examples for android.support.test.uiautomator.UiDevice.getInstance()

The following are Jave code examples for showing how to use getInstance() of the android.support.test.uiautomator.UiDevice class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: smart-lens   File: BaseTestClass.java   View Source Code Vote up 9 votes
@Before
public void setup() {
    // Unlock the screen if it's locked
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    try {
        device.wakeUp();
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    // Set the flags on our activity so it'll appear regardless of lock screen state
    new Handler(Looper.getMainLooper()).post(() -> {
        if (getActivity() == null) return;
        getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    });
}
 
Example 2
Project: ChimpCheck   File: ExampleInstrumentedTest.java   View Source Code Vote up 7 votes
@Before
public void startMainActivityFromHomeScreen() {
    // Initialize UiDevice instance
    mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());

    // Start from the home screen
    mDevice.pressHome();

    // Wait for launcher
    final String launcherPackage = getLauncherPackageName();
    assertThat(launcherPackage, notNullValue());
    mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT);

    // Launch the blueprint app
    Context context = InstrumentationRegistry.getContext();
    final Intent intent = context.getPackageManager()
            .getLaunchIntentForPackage(BASIC_SAMPLE_PACKAGE);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);    // Clear out any previous instances
    context.startActivity(intent);

    // Wait for the app to appear
    mDevice.wait(Until.hasObject(By.pkg(BASIC_SAMPLE_PACKAGE).depth(0)), LAUNCH_TIMEOUT);
}
 
Example 3
Project: ChimpCheck   File: PermissionGranter.java   View Source Code Vote up 7 votes
public static void allowPermissionsIfNeeded(String permissionNeeded) {
    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !hasNeededPermission(permissionNeeded)) {
            sleep(PERMISSIONS_DIALOG_DELAY);
            UiDevice device = UiDevice.getInstance(getInstrumentation());
            UiObject allowPermissions = device.findObject(new UiSelector()
                    .clickable(true)
                    .checkable(false)
                    .index(GRANT_BUTTON_INDEX));
            if (allowPermissions.exists()) {
                allowPermissions.click();
            }
        }
    } catch (UiObjectNotFoundException e) {
        System.out.println("There is no permissions dialog to interact with");
    }
}
 
Example 4
Project: android-testing-guide   File: MainActivityTest.java   View Source Code Vote up 7 votes
@Ignore
@Test
public void testUiAutomatorAPI() throws UiObjectNotFoundException, InterruptedException {
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());

    UiSelector editTextSelector = new UiSelector().className("android.widget.EditText").text("this is a test").focusable(true);
    UiObject editTextWidget = device.findObject(editTextSelector);
    editTextWidget.setText("this is new text");

    Thread.sleep(2000);

    UiSelector buttonSelector = new UiSelector().className("android.widget.Button").text("CLICK ME").clickable(true);
    UiObject buttonWidget = device.findObject(buttonSelector);
    buttonWidget.click();

    Thread.sleep(2000);
}
 
Example 5
Project: ibeacon-scanner-android   File: PermissionTestHelper.java   View Source Code Vote up 7 votes
/**
 * Allows location permission if the runtime permission dialog is shown.
 */
public static void allowLocationPermissionWhenAsked()
{
    try
    {
        if (!PermissionUtils.isLocationGranted(InstrumentationRegistry.getTargetContext()))
        {
            TestHelper.sleep(PERMISSIONS_DIALOG_DELAY);

            final UiDevice device = UiDevice.getInstance(getInstrumentation());
            final UiObject allowPermissions = device.findObject(new UiSelector()
                                                                        .clickable(true)
                                                                        .checkable(false)
                                                                        .index(GRANT_BUTTON_INDEX));
            if (allowPermissions.exists())
            {
                allowPermissions.click();
            }
        }
    }
    catch (final UiObjectNotFoundException e)
    {
        Log.e(PermissionTestHelper.class.getSimpleName(), "There is no permissions dialog to interact with.");
    }
}
 
Example 6
Project: Demos   File: UiTest.java   View Source Code Vote up 6 votes
/**
 * 测试CollapsingToolbarLayout
 * 被测Demo下载地址:https://github.com/alidili/DesignSupportDemo
 *
 * @throws UiObjectNotFoundException
 */
public void testA() throws UiObjectNotFoundException {
    // 获取设备对象
    Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
    UiDevice uiDevice = UiDevice.getInstance(instrumentation);
    // 获取上下文
    Context context = instrumentation.getContext();

    // 启动测试App
    Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.yang.designsupportdemo");
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    context.startActivity(intent);

    // 打开CollapsingToolbarLayout
    String resourceId = "com.yang.designsupportdemo:id/CollapsingToolbarLayout";
    UiObject collapsingToolbarLayout = uiDevice.findObject(new UiSelector().resourceId(resourceId));
    collapsingToolbarLayout.click();

    for (int i = 0; i < 5; i++) {
        // 向上移动
        uiDevice.swipe(uiDevice.getDisplayHeight() / 2, uiDevice.getDisplayHeight(),
                uiDevice.getDisplayHeight() / 2, uiDevice.getDisplayHeight() / 2, 10);

        // 向下移动
        uiDevice.swipe(uiDevice.getDisplayHeight() / 2, uiDevice.getDisplayHeight() / 2,
                uiDevice.getDisplayHeight() / 2, uiDevice.getDisplayHeight(), 10);
    }

    // 点击应用返回按钮
    UiObject back = uiDevice.findObject(new UiSelector().description("Navigate up"));
    back.click();

    // 点击设备返回按钮
    uiDevice.pressBack();
}
 
Example 7
Project: firefox-tv   File: ScreenshotTest.java   View Source Code Vote up 6 votes
@Before
public void setUpScreenshots() {
    Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
    targetContext = instrumentation.getTargetContext();
    device = UiDevice.getInstance(instrumentation);

    // Use this to switch between default strategy and HostScreencap strategy
    //Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
    Screengrab.setDefaultScreenshotStrategy(new HostScreencapScreenshotStrategy(device));

    device.waitForIdle();
}
 
Example 8
Project: notification-adapter   File: NotificationAdapterTest.java   View Source Code Vote up 5 votes
@Test
public void testNotificationAdapter() {
    final String NOTIFICATION_TEXT = "adapter-text";
    final String NOTIFICATION_TITLE = "adapter-title";
    final long TIMEOUT = 5000;

    Context appContext = InstrumentationRegistry.getTargetContext();

    RemoteViews contentView = new RemoteViews("cn.dreamtobe.toolset.test", R.layout.custom_layout);
    contentView.setTextViewText(R.id.title, NOTIFICATION_TITLE);
    contentView.setTextViewText(R.id.text, NOTIFICATION_TEXT);

    // Fix the Notification-Style problem ---------------
    // Set the default title style color to title view.
    contentView.setTextColor(R.id.title, NotificationAdapter.getTitleColor(appContext));
    // Set the default title style size to title view
    contentView.setTextViewTextSize(R.id.title, COMPLEX_UNIT_PX, NotificationAdapter.getTitleSize(appContext));
    // Set the default text style color to text view
    contentView.setTextColor(R.id.text, NotificationAdapter.getTextColor(appContext));
    // Set the default text style size to text view
    contentView.setTextViewTextSize(R.id.text, COMPLEX_UNIT_PX, NotificationAdapter.getTextSize(appContext));
    // End fix the Notification-Style problem ---------------

    Notification notification = new Notification();
    notification.icon = R.drawable.ic_launcher;
    notification.contentView = contentView;

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;

    NotificationManager notifyMgr =
            (NotificationManager) appContext.getSystemService(NOTIFICATION_SERVICE);
    notifyMgr.notify(1, notification);

    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    device.openNotification();
    device.wait(Until.hasObject(By.text(NOTIFICATION_TITLE)), TIMEOUT);
}
 
Example 9
Project: adyen-android   File: PaymentAppTest.java   View Source Code Vote up 5 votes
/**
 * This test needs additional work. The following passes in Google Pixel device. But since
 * it uses screen coordinates; this test cannot be relied on yet. Work in progress.
 * @throws Exception
 */
@Ignore @Test
public void testIdealPayment() throws Exception {
    startIdealPayment();
    waitForText("Test Issuer");
    onView(withText(equalToIgnoringCase("Test Issuer"))).perform(click());
    final UiDevice device = UiDevice.getInstance(getInstrumentation());
    Thread.sleep(5000);
    device.click(65, 535);

    checkResultString(Payment.PaymentStatus.AUTHORISED.toString());
}
 
Example 10
Project: civify-app   File: CreateIssueActivityTest.java   View Source Code Vote up 5 votes
private static void takeCameraPhoto() throws UiObjectNotFoundException {
    UiDevice device = UiDevice.getInstance(getInstrumentation());
    UiSelector shutterSelector =
            new UiSelector().resourceId("com.android.camera:id/shutter_button");
    UiObject shutterButton = device.findObject(shutterSelector);
    shutterButton.click();

    UiSelector doneSelector = new UiSelector().resourceId("com.android.camera:id/btn_done");
    UiObject doneButton = device.findObject(doneSelector);
    doneButton.click();
}
 
Example 11
Project: FlickLauncher   File: LauncherInstrumentationTestCase.java   View Source Code Vote up 5 votes
@Override
protected void setUp() throws Exception {
    super.setUp();

    mDevice = UiDevice.getInstance(getInstrumentation());
    mTargetContext = getInstrumentation().getTargetContext();
    mTargetPackage = mTargetContext.getPackageName();
}
 
Example 12
Project: UIAutomatorAdapter   File: AutoTestAdapter.java   View Source Code Vote up 5 votes
@Before
public void setUp() throws IOException, RemoteException {
    // Initialize UiDevice instance
    mDevice = UiDevice.getInstance(getInstrumentation());
    // wake up the device when screen is off
    if (!mDevice.isScreenOn()) {
        mDevice.wakeUp();
        mDevice.swipe(mDevice.getDisplayWidth() / 2,
                mDevice.getDisplayHeight() - 100, mDevice.getDisplayWidth() / 2,
                mDevice.getDisplayHeight() / 2, 5);
        delay(1000);
        preSteup(); // do wakeup & maybe unlock gesture lock
    }
    // Start from the home screen
    mDevice.pressHome();
    // launch "com.sc.uiautomatoradapter" to grant the permission and copy XML file to SDCARD
    launchPackage("com.sc.uiautomatoradapter");

    UiObject2 allow = mDevice.wait(Until.findObject(By.res(
            "com.android.packageinstaller:id/permission_allow_button")), timeout);
    // click the allow button to grant the permission
    if (allow != null && allow.isClickable()) {
        allow.click();
        delay(5000);
    }
    if (logger.mOut == null || parser.apps == null) {
        // initialize the Logger instance
        logger.init();
        // initialize the XMLParser instance
        parser.init();
    }
}
 
Example 13
Project: ChimpCheck   File: PermissionGranter.java   View Source Code Vote up 5 votes
public static void allowPermissionsIfNeeded() {
    if (Build.VERSION.SDK_INT >= 23) {
        UiDevice device = UiDevice.getInstance(getInstrumentation());
        UiObject allowPermissions = device.findObject(new UiSelector().text("Allow"));
        if (allowPermissions.exists()) {
            try {
                allowPermissions.click();
            } catch (UiObjectNotFoundException e) {
                Log.e(e.getStackTrace()[0].toString(), "There is no permissions dialog to interact with ");
            }
        }
    }
}
 
Example 14
Project: FlickLauncher   File: RotationPreferenceTest.java   View Source Code Vote up 5 votes
@Override
protected void setUp() throws Exception {
    super.setUp();

    mDevice = UiDevice.getInstance(getInstrumentation());
    mTargetContext = getInstrumentation().getTargetContext();
    mTargetPackage = mTargetContext.getPackageName();
    mPrefs = Utilities.getPrefs(mTargetContext);
    mOriginalRotationValue = mPrefs.getBoolean(Utilities.ALLOW_ROTATION_PREFERENCE_KEY, false);
}
 
Example 15
Project: SimpleUILauncher   File: RotationPreferenceTest.java   View Source Code Vote up 5 votes
@Override
protected void setUp() throws Exception {
    super.setUp();

    mDevice = UiDevice.getInstance(getInstrumentation());
    mTargetContext = getInstrumentation().getTargetContext();
    mTargetPackage = mTargetContext.getPackageName();
    mPrefs = Utilities.getPrefs(mTargetContext);
    mOriginalRotationValue = mPrefs.getBoolean(Utilities.ALLOW_ROTATION_PREFERENCE_KEY, false);
}
 
Example 16
Project: chaosflix-leanback   File: ConferencesActivityTest.java   View Source Code Vote up 5 votes
@Before
public void setup() throws IOException, TimeoutException {
	mDevice = UiDevice.getInstance(getInstrumentation());

	server = new MockWebServer();
	server.start();
	String serverUrl = server.url("").toString();

	server.enqueue(TestHelper.getResponseForRaw(R.raw.conferences_json));
	server.enqueue(TestHelper.getResponseForRaw(R.raw.conferences_101_33c3_json));

	Intent i = new Intent();
	i.putExtra("server_url",serverUrl);
	mActivityTestRule.launchActivity(i);
}
 
Example 17
Project: orgzly-android   File: ListWidgetTest.java   View Source Code Vote up 5 votes
@Before
public void addWidget() throws Exception {
    device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());

    device.pressHome();
    device.pressHome();
}
 
Example 18
Project: chaosflix   File: ConferencesActivityTest.java   View Source Code Vote up 5 votes
@Before
public void setup() throws IOException, TimeoutException {
	mDevice = UiDevice.getInstance(getInstrumentation());

	server = new MockWebServer();
	server.start();
	String serverUrl = server.url("").toString();

	server.enqueue(TestHelper.getResponseForRaw(R.raw.conferences_json));
	server.enqueue(TestHelper.getResponseForRaw(R.raw.conferences_101_33c3_json));

	Intent i = new Intent();
	i.putExtra("server_url",serverUrl);
	mActivityTestRule.launchActivity(i);
}
 
Example 19
Project: SmoothClicker   File: ItIntroScreensActivity.java   View Source Code Vote up 5 votes
/**
 * Starts the main activity to test from the home screen
 */
@Before
public void startMainActivityFromHomeScreen() {

    l(this, "@Before startMainActivityFromHomeScreen");

    Context context = InstrumentationRegistry.getContext();

    // Initialize UiDevice instance
    mDevice = UiDevice.getInstance(getInstrumentation());

    // Start from the home screen
    mDevice.pressHome();

    // Wait for launcher
    final String launcherPackage = mDevice.getLauncherPackageName();
    assertThat(launcherPackage, notNullValue());
    mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT_MS);

    // Launch the app
    final Intent intent = context.getPackageManager().getLaunchIntentForPackage(PACKAGE_APP_PATH);

    // Clear out any previous instances
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    context.startActivity(intent);

    // Wait for the app to appear
    mDevice.wait(Until.hasObject(By.pkg(PACKAGE_APP_PATH).depth(0)), LAUNCH_TIMEOUT_MS);

}
 
Example 20
Project: SmoothClicker   File: ItServiceClicker.java   View Source Code Vote up 5 votes
/**
 * Initializes the NotificationManager
 * <i>The tests have to start from the home screen</i>
 */
@Before
public void init(){
    l(this,"@Before init");
    mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    mDevice.pressHome();
    mContext = InstrumentationRegistry.getTargetContext();
}
 
Example 21
Project: AndroidProjects   File: MainEspressoTest.java   View Source Code Vote up 5 votes
@Test
public void d() throws UiObjectNotFoundException {
    // Initialize UiDevice instance
    mDevice = UiDevice.getInstance(getInstrumentation());

    // Perform a short press on the HOME button
    mDevice.pressHome();

    // Bring up the default launcher by searching for
    // a UI component that matches the content-description for the launcher button
    UiObject allAppsButton = mDevice.findObject(new UiSelector().description("Apps"));

    // Perform a click on the button to bring up the launcher
    allAppsButton.clickAndWaitForNewWindow();
}
 
Example 22
Project: SmoothClicker   File: ItSelectMultiPointsActivity.java   View Source Code Vote up 5 votes
/**
 * Starts the main activity to test from the home screen
 */
@Before
public void startMainActivityFromHomeScreen() {

    l(this, "@Before startMainActivityFromHomeScreen");

    // Initialize UiDevice instance
    mDevice = UiDevice.getInstance(getInstrumentation());

    // Start from the home screen
    mDevice.pressHome();

    // Wait for launcher
    final String launcherPackage = mDevice.getLauncherPackageName();
    assertThat(launcherPackage, notNullValue());
    mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT_MS);

    // Launch the app
    Context context = InstrumentationRegistry.getContext();
    final Intent intent = context.getPackageManager().getLaunchIntentForPackage(PACKAGE_APP_PATH);

    // Clear out any previous instances
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    context.startActivity(intent);

    // Wait for the app to appear
    mDevice.wait(Until.hasObject(By.pkg(PACKAGE_APP_PATH).depth(0)), LAUNCH_TIMEOUT_MS);

}
 
Example 23
Project: AndroidUIGestureRecognizer   File: TestTapGesture.java   View Source Code Vote up 5 votes
@Before
public void launchSample() {
    instrumentation = InstrumentationRegistry.getInstrumentation();
    device = UiDevice.getInstance(instrumentation);
    context = InstrumentationRegistry.getContext();
    device.wait(Until.hasObject(By.pkg(PACKAGE_NAME).depth(0)), LAUNCH_TIMEOUT);

    PowerManager power = (PowerManager) context.getSystemService(POWER_SERVICE);
    wakeLock = power.newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, "test");
    wakeLock.acquire();
}
 
Example 24
Project: SmoothClicker   File: ItNotificationsManager.java   View Source Code Vote up 5 votes
/**
 * Initializes the NotificationManager
 *
 * <i>Tests should start from the home screen</i>
 */
@Before
public void init(){
    l(this,"@Before init");
    mContext = mActivityRule.getActivity().getApplicationContext();
    mNm = NotificationsManager.getInstance(mContext);
    mDevice = UiDevice.getInstance(getInstrumentation());
    mDevice.pressHome();
}
 
Example 25
Project: BreadcrumbsView   File: BreadcrumbsActivityTest.java   View Source Code Vote up 5 votes
private void rotateDevice() {
  try {
    UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    uiDevice.setOrientationLeft();
    waitTime();
    uiDevice.setOrientationNatural();
    waitTime();
  } catch (RemoteException e) {
    e.printStackTrace();
  }
}
 
Example 26
Project: appium-uiautomator2-server   File: PositionHelper.java   View Source Code Vote up 5 votes
public static Point getDeviceAbsPos(final Point point)
        throws UiObjectNotFoundException, InvalidCoordinatesException {
    final UiDevice d = UiDevice.getInstance();
    final Rect displayRect = new Rect(0, 0, d.getDisplayWidth(), d.getDisplayHeight());

    Logger.debug("Display bounds: " + displayRect.toShortString());

    return getAbsolutePosition(point, displayRect, new Point(), true);
}
 
Example 27
Project: espresso-macchiato   File: EspSystemDialog.java   View Source Code Vote up 5 votes
protected void click(String target) {
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    UiObject button = device.findObject(new UiSelector().text(target));

    try {
        button.click();
    } catch (UiObjectNotFoundException e) {
        throw new IllegalStateException(e);
    }
}
 
Example 28
Project: RxJavaEspressoSample   File: ActivityAsyncTaskExecutorTest.java   View Source Code Vote up 4 votes
private void setUpUiAutomator() {
    uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
 
Example 29
Project: dagger-test-example   File: SimpleEspressoTest.java   View Source Code Vote up 4 votes
private UiDevice device() {
    return UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
 
Example 30
Project: RxPermission   File: PermissionActivityTest.java   View Source Code Vote up 4 votes
private static UiObject getButton(final String text) {
  final UiDevice device = UiDevice.getInstance(getInstrumentation());
  return device.findObject(new UiSelector().text(text));
}
 
Example 31
Project: RxJavaEspressoSample   File: ActivityCountingIdlingResourceTest.java   View Source Code Vote up 4 votes
private void setUpUiAutomator() {
    uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
 
Example 32
Project: Theo   File: AnotationsTest.java   View Source Code Vote up 4 votes
@Before
public void init() {
    device = UiDevice.getInstance(getInstrumentation());
}
 
Example 33
Project: android-testing-codelab   File: AutomatorTest.java   View Source Code Vote up 4 votes
@Before
public void beforeTest() {
    uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    uiDevice.pressHome();
}
 
Example 34
Project: test_agent_android   File: Tools.java   View Source Code Vote up 4 votes
@Test
public void dump() throws IOException {
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    device.dumpWindowHierarchy(new File("/sdcard/ui.uix"));
}
 
Example 35
Project: Theo   File: SnackBarTest.java   View Source Code Vote up 4 votes
@Before
public void init() {
    device = UiDevice.getInstance(getInstrumentation());
}
 
Example 36
Project: RxLifecycleInterop   File: LifeCycleTest.java   View Source Code Vote up 4 votes
@Before public void before() {
  TestLogger.Instance.clearEvents();
  uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
 
Example 37
Project: CreditCardEditText   File: CreditCardNumberEditTextTest.java   View Source Code Vote up 4 votes
@Before
public void setUp() throws Exception {
    device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
 
Example 38
Project: espresso-macchiato   File: EspSystemDialog.java   View Source Code Vote up 4 votes
protected boolean dialogIsShownWith(String expectedMessage) {
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    UiObject dialog = device.findObject(new UiSelector().textMatches(expectedMessage));
    return dialog.exists();
}
 
Example 39
Project: android-testing-runtime-permissions   File: ContactsSyncTest.java   View Source Code Vote up 4 votes
@Before
public void setUp() {
    this.device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
 
Example 40
Project: AsteroidOSSync   File: ABluetoothPowerTest.java   View Source Code Vote up 3 votes
@Override
protected void setUp() throws Exception
{
    super.setUp();

    testActivity = getActivity();

    bleManager = testActivity.getManager();

    bleAdapter = BluetoothAdapter.getDefaultAdapter();

    uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}