Loading android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSettingsTest.java +17 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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())); } Loading Loading
android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSettingsTest.java +17 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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())); } Loading