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

Commit 83e0efae authored by Tony Huang's avatar Tony Huang Committed by Android (Google) Code Review
Browse files

Merge "Fix UI tests failed on band selection and directory"

parents 9cee68f8 7b3f0740
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withText;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;

import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.is;
@@ -99,6 +100,12 @@ public class UiBot extends Bots.BaseBot {
                .check(matches(withToolbarTitle(is(expected))));
    }

    public void assertSearchBarShow() {
        UiSelector selector = new UiSelector().text(mContext.getString(R.string.search_bar_hint));
        UiObject searchHint = mDevice.findObject(selector);
        assertTrue(searchHint.exists());
    }

    public void assertMenuEnabled(int id, boolean enabled) {
        UiObject2 menu = findMenuWithName(mContext.getString(id));
        assertNotNull(menu);
+4 −5
Original line number Diff line number Diff line
@@ -50,11 +50,10 @@ public class BandSelectionUiTest extends ActivityTest<FilesActivity> {
    public void testBandSelection_someFiles() throws Exception {
        bots.main.switchToGridMode();
        Rect dirListBounds = bots.directory.findDocumentsList().getBounds();
        Rect startDir = bots.directory.findDocument(dirName1).getBounds();
        Rect endDoc = bots.directory.findDocument(fileName2).getBounds();
        // Start from dir1 center of X and top of Y
        Point start = new Point(startDir.centerX(), dirListBounds.top);
        // End is center of file2
        Rect endDoc = bots.directory.findDocument(fileName1).getBounds();
        // Start from list right bottom.
        Point start = new Point(dirListBounds.right - 1, dirListBounds.bottom - 1);
        // End is center of file1
        Point end = new Point(endDoc.centerX(), endDoc.centerY());
        bots.gesture.bandSelection(start, end);

+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> {
    // to be able to click on it.
    public void testClickRecent() throws Exception {
        bots.roots.openRoot("Recent");
        bots.main.assertWindowTitle("Recent");
        bots.main.assertSearchBarShow();
    }

    public void testRootClick_SetsWindowTitle() throws Exception {