Loading tests/common/com/android/documentsui/bots/Bots.java +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ public final class Bots { public final UiBot main; public final InspectorBot inspector; public final NotificationsBot notifications; public final PickerBot picker; public Bots(UiDevice device, UiAutomation automation, Context context, int timeout) { main = new UiBot(device, context, TIMEOUT); Loading @@ -63,6 +64,7 @@ public final class Bots { menu = new MenuBot(device, context, TIMEOUT); inspector = new InspectorBot(device, context, TIMEOUT); notifications = new NotificationsBot(device, context, TIMEOUT); picker = new PickerBot(device, context, TIMEOUT); } /** Loading tests/common/com/android/documentsui/bots/PickerBot.kt 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.documentsui.bots import android.R import android.content.Context import androidx.test.espresso.Espresso import androidx.test.espresso.action.ViewActions import androidx.test.espresso.matcher.ViewMatchers import androidx.test.uiautomator.UiDevice import com.android.documentsui.bots.Bots.BaseBot /** * A test helper class that provides support for controlling picker activities * programmatically, and making assertions against the state of the UI. */ class PickerBot(device: UiDevice?, context: Context?, timeout: Int) : BaseBot( device, context, timeout ) { /** * Clicks the save button with id button1 */ fun clickSaveButton() { Espresso.onView(ViewMatchers.withId(R.id.button1)).perform(ViewActions.click()) } } tests/common/com/android/documentsui/bots/UiBot.java +0 −4 Original line number Diff line number Diff line Loading @@ -258,10 +258,6 @@ public class UiBot extends Bots.BaseBot { onView(withText(label)).perform(click()); } public void clickSaveButton() { onView(withId(android.R.id.button1)).perform(click()); } public boolean waitForActionModeBarToAppear() { String actionModeId = isUseMaterial3FlagEnabled() ? "toolbar" : "action_mode_bar"; UiObject2 bar = Loading tests/functional/com/android/documentsui/ActionCreateDocumentUiTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ public class ActionCreateDocumentUiTest extends DocumentsUiTestBase { bots.main.setDialogText(fileName); device.waitForIdle(); bots.main.clickSaveButton(); bots.picker.clickSaveButton(); final Instrumentation.ActivityResult activityResult = mRule.getActivityResult(); assertThat(activityResult.getResultCode()).isEqualTo(RESULT_OK); Loading Loading
tests/common/com/android/documentsui/bots/Bots.java +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ public final class Bots { public final UiBot main; public final InspectorBot inspector; public final NotificationsBot notifications; public final PickerBot picker; public Bots(UiDevice device, UiAutomation automation, Context context, int timeout) { main = new UiBot(device, context, TIMEOUT); Loading @@ -63,6 +64,7 @@ public final class Bots { menu = new MenuBot(device, context, TIMEOUT); inspector = new InspectorBot(device, context, TIMEOUT); notifications = new NotificationsBot(device, context, TIMEOUT); picker = new PickerBot(device, context, TIMEOUT); } /** Loading
tests/common/com/android/documentsui/bots/PickerBot.kt 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.documentsui.bots import android.R import android.content.Context import androidx.test.espresso.Espresso import androidx.test.espresso.action.ViewActions import androidx.test.espresso.matcher.ViewMatchers import androidx.test.uiautomator.UiDevice import com.android.documentsui.bots.Bots.BaseBot /** * A test helper class that provides support for controlling picker activities * programmatically, and making assertions against the state of the UI. */ class PickerBot(device: UiDevice?, context: Context?, timeout: Int) : BaseBot( device, context, timeout ) { /** * Clicks the save button with id button1 */ fun clickSaveButton() { Espresso.onView(ViewMatchers.withId(R.id.button1)).perform(ViewActions.click()) } }
tests/common/com/android/documentsui/bots/UiBot.java +0 −4 Original line number Diff line number Diff line Loading @@ -258,10 +258,6 @@ public class UiBot extends Bots.BaseBot { onView(withText(label)).perform(click()); } public void clickSaveButton() { onView(withId(android.R.id.button1)).perform(click()); } public boolean waitForActionModeBarToAppear() { String actionModeId = isUseMaterial3FlagEnabled() ? "toolbar" : "action_mode_bar"; UiObject2 bar = Loading
tests/functional/com/android/documentsui/ActionCreateDocumentUiTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ public class ActionCreateDocumentUiTest extends DocumentsUiTestBase { bots.main.setDialogText(fileName); device.waitForIdle(); bots.main.clickSaveButton(); bots.picker.clickSaveButton(); final Instrumentation.ActivityResult activityResult = mRule.getActivityResult(); assertThat(activityResult.getResultCode()).isEqualTo(RESULT_OK); Loading