summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/common/com/android/documentsui/bots/SearchBot.java35
-rw-r--r--tests/functional/com/android/documentsui/DialogUiTest.java2
-rw-r--r--tests/functional/com/android/documentsui/SearchViewUiTest.java34
3 files changed, 7 insertions, 64 deletions
diff --git a/tests/common/com/android/documentsui/bots/SearchBot.java b/tests/common/com/android/documentsui/bots/SearchBot.java
index 9c3568bc5..da7dc5481 100644
--- a/tests/common/com/android/documentsui/bots/SearchBot.java
+++ b/tests/common/com/android/documentsui/bots/SearchBot.java
@@ -69,9 +69,6 @@ public class SearchBot extends Bots.BaseBot {
public void clickIcon() throws UiObjectNotFoundException {
UiObject searchView = findSearchView();
searchView.click();
-
- UiObject fragmentSearchView = findFragmentSearchView();
- assertTrue(fragmentSearchView.exists());
}
public void clickSearchViewClearButton() throws UiObjectNotFoundException {
@@ -79,11 +76,6 @@ public class SearchBot extends Bots.BaseBot {
clear.click();
}
- public void clickFragmentSearchViewClearButton() throws UiObjectNotFoundException {
- UiObject clear = findFragmentSearchClearButton();
- clear.click();
- }
-
public void setInputText(String query) throws UiObjectNotFoundException {
onView(SEARCH_INPUT).perform(typeText(query));
}
@@ -121,19 +113,6 @@ public class SearchBot extends Bots.BaseBot {
assertEquals(exists, findSearchViewTextField().exists());
}
- public void assertFragmentInputFocused(boolean focused)
- throws UiObjectNotFoundException {
- UiObject textField = findFragmentSearchViewTextField();
-
- assertTrue(textField.exists());
- assertEquals(focused, textField.isFocused());
- }
-
- public void assertFragmentInputExists(boolean exists)
- throws UiObjectNotFoundException {
- assertEquals(exists, findFragmentSearchViewTextField().exists());
- }
-
private UiObject findSearchView() {
return findObject(mTargetPackage + ":id/option_menu_search");
}
@@ -148,20 +127,6 @@ public class SearchBot extends Bots.BaseBot {
mTargetPackage + ":id/search_close_btn");
}
- private UiObject findFragmentSearchView() {
- return findObject(mTargetPackage + ":id/search_view");
- }
-
- private UiObject findFragmentSearchViewTextField() {
- return findObject(mTargetPackage + ":id/search_view",
- mTargetPackage + ":id/search_src_text");
- }
-
- private UiObject findFragmentSearchClearButton() {
- return findObject(mTargetPackage + ":id/search_view",
- mTargetPackage + ":id/search_close_btn");
- }
-
private UiObject findSearchViewIcon() {
return mContext.getResources().getBoolean(R.bool.full_bar_search_view)
? findObject(mTargetPackage + ":id/option_menu_search")
diff --git a/tests/functional/com/android/documentsui/DialogUiTest.java b/tests/functional/com/android/documentsui/DialogUiTest.java
index 24136021d..42234afd3 100644
--- a/tests/functional/com/android/documentsui/DialogUiTest.java
+++ b/tests/functional/com/android/documentsui/DialogUiTest.java
@@ -104,7 +104,7 @@ public class DialogUiTest {
assertNotNull("Dialog was null", mCreateDirectoryFragment.getDialog());
assertTrue("Dialog was not being shown", mCreateDirectoryFragment.getDialog().isShowing());
- mActivityTestRule.runOnUiThread(() -> mCreateDirectoryFragment.dismiss());
+ mActivityTestRule.runOnUiThread(() -> mCreateDirectoryFragment.getDialog().dismiss());
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
assertNull("Dialog should be null after dismiss()", mCreateDirectoryFragment.getDialog());
diff --git a/tests/functional/com/android/documentsui/SearchViewUiTest.java b/tests/functional/com/android/documentsui/SearchViewUiTest.java
index d18ac3c02..bc08c4984 100644
--- a/tests/functional/com/android/documentsui/SearchViewUiTest.java
+++ b/tests/functional/com/android/documentsui/SearchViewUiTest.java
@@ -57,7 +57,6 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
public void testSearchIconVisible() throws Exception {
// The default root (root 0) supports search
bots.search.assertInputExists(false);
- bots.search.assertFragmentInputExists(false);
bots.search.assertIconVisible(true);
}
@@ -67,15 +66,14 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
bots.search.assertIconVisible(false);
bots.search.assertInputExists(false);
- bots.search.assertFragmentInputExists(false);
}
public void testSearchView_ExpandsOnClick() throws Exception {
bots.search.clickIcon();
device.waitForIdle();
- bots.search.assertFragmentInputExists(true);
- bots.search.assertFragmentInputFocused(true);
+ bots.search.assertInputExists(true);
+ bots.search.assertInputFocused(true);
// FIXME: Matchers fail the not-present check if we've ever clicked this.
// bots.search.assertIconVisible(false);
@@ -85,8 +83,8 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
bots.search.clickIcon();
device.waitForIdle();
- bots.search.assertFragmentInputExists(true);
- bots.search.assertFragmentInputFocused(true);
+ bots.search.assertInputExists(true);
+ bots.search.assertInputFocused(true);
device.waitForIdle();
assertFalse(bots.menu.hasMenuItem("Grid view"));
@@ -97,11 +95,9 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
public void testSearchView_CollapsesOnBack() throws Exception {
bots.search.clickIcon();
device.pressBack();
- device.pressBack();
bots.search.assertIconVisible(true);
bots.search.assertInputExists(false);
- bots.search.assertFragmentInputExists(false);
}
public void testSearchView_ClearsTextOnBack() throws Exception {
@@ -116,7 +112,6 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
bots.search.assertIconVisible(true);
bots.search.assertInputExists(false);
- bots.search.assertFragmentInputExists(false);
}
public void testSearchView_ClearsSearchOnBack() throws Exception {
@@ -129,7 +124,6 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
bots.search.assertIconVisible(true);
bots.search.assertInputExists(false);
- bots.search.assertFragmentInputExists(false);
}
public void testSearchView_ClearsAutoSearchOnBack() throws Exception {
@@ -143,7 +137,6 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
bots.search.assertIconVisible(true);
bots.search.assertInputExists(false);
- bots.search.assertFragmentInputExists(false);
}
public void testSearchView_StateAfterSearch() throws Exception {
@@ -232,22 +225,7 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
bots.search.clickSearchViewClearButton();
device.waitForIdle();
- bots.search.assertFragmentInputExists(true);
- bots.search.assertFragmentInputFocused(true);
- }
-
- public void testSearchHistory_showAfterFragmentSearchViewClear() throws Exception {
- bots.search.clickIcon();
- bots.search.setInputText("chocolate");
-
- bots.keyboard.pressEnter();
- device.waitForIdle();
-
- bots.search.clickIcon();
- bots.search.clickFragmentSearchViewClearButton();
- device.waitForIdle();
-
- bots.search.assertFragmentInputExists(true);
- bots.search.assertFragmentInputFocused(true);
+ bots.search.assertInputExists(true);
+ bots.search.assertInputFocused(true);
}
}