Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42403ef7 authored by Hyundo Moon's avatar Hyundo Moon Committed by Automerger Merge Worker
Browse files

Merge "Fix BluetoothMapSettingsTest failure in some devices" into main am:...

Merge "Fix BluetoothMapSettingsTest failure in some devices" into main am: d008f495 am: e5c20221

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2954770



Change-Id: I8e5ab3f147470e68a4ea85d66e905b84413088f8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents bb24d2f4 e5c20221
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -25,14 +25,21 @@ import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;

import static com.google.common.truth.Truth.assertThat;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;

import androidx.test.core.app.ActivityScenario;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;

import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
@@ -64,15 +71,23 @@ public class BluetoothMapSettingsTest {
    public void tearDown() throws Exception {
        TestUtils.tearDownUiTest();
        if (mActivityScenario != null) {
            // Workaround for b/159805732. Without this, test hangs for 45 seconds.
            Thread.sleep(1_000);
            mActivityScenario.close();
        }
        enableActivity(false);
    }

    @Test
    @FlakyTest
    public void initialize() throws Exception {
        UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());

        long timeoutMs = 5_000;
        String activityLabel = mTargetContext.getString(R.string.bluetooth_map_settings_title);
        UiObject2 object = device.wait(Until.findObject(By.text(activityLabel)), timeoutMs);
        assertThat(object).isNotNull();

        object.click();

        onView(withId(R.id.bluetooth_map_settings_list_view)).check(matches(isDisplayed()));
    }