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

Commit c6a2a32e authored by Ben Reich's avatar Ben Reich
Browse files

Remove all instances of file names from ActivityTestJunit4

With the move to the TestFilesRule, these should be referenced through
there and not via the ActivityTestJunit4. Remove them and update all
the references.

This also fixes up an indentation issue in SearchViewUiTest.

Bug: 407646510
Test: atest DocumentsUIGoogle
Flag: EXEMPT test change
Change-Id: I2445d3a9d43ca43b5170bfc8fab80aeca74bc040
parent c6c97f12
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ class TestFilesRule(private val skipCreation: Boolean = false) : ExternalResourc
        @JvmField
        val DIR_NAME_1: String = "Dir1"

        @JvmField
        val CHILD_DIR_1: String = "ChildDir1"

        @JvmField
        val FILE_NAME_1: String = "file1.log"

+0 −8
Original line number Diff line number Diff line
@@ -195,14 +195,6 @@ abstract class ActivityTestJunit4<T : Activity?> {
    }

    companion object {
        // Testing files. For custom ones, override initTestFiles().
        const val dirName1 = "Dir1"
        const val childDir1 = "ChildDir1"
        const val fileName1 = "file1.log"
        const val fileName2 = "file12.png"
        const val fileName3 = "anotherFile0.log"
        const val fileName4 = "poodles.text"
        const val fileNameNoRename = "NO_RENAMEfile.txt"
        const val TIMEOUT = 5000
    }
}
+6 −6
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class FilesActivityUiTest extends ActivityTestJunit4<FilesActivity> {
    public final TestFilesRule mTestFilesRule =
            new TestFilesRule()
                    .createFolderInRoot(ROOT_0_ID, TestFilesRule.DIR_NAME_1)
                    .createFolderWithParent(TestFilesRule.DIR_NAME_1, "ChildDir1")
                    .createFolderWithParent(TestFilesRule.DIR_NAME_1, TestFilesRule.CHILD_DIR_1)
                    .createFileInRoot(ROOT_0_ID, "file0.log", "text/plain")
                    .createFileInRoot(ROOT_0_ID, "file1.png", "image/png")
                    .createFileInRoot(ROOT_0_ID, "file2.csv", "text/csv")
@@ -179,15 +179,15 @@ public class FilesActivityUiTest extends ActivityTestJunit4<FilesActivity> {

    @Test
    public void testNavigate_byBreadcrumb() throws Exception {
        bots.directory.openDocument(dirName1);
        bots.directory.waitForDocument(childDir1);  // wait for known content
        bots.directory.assertDocumentsPresent(childDir1);
        bots.directory.openDocument(TestFilesRule.DIR_NAME_1);
        bots.directory.waitForDocument(TestFilesRule.CHILD_DIR_1);  // wait for known content
        bots.directory.assertDocumentsPresent(TestFilesRule.CHILD_DIR_1);

        device.waitForIdle();
        bots.breadcrumb.assertItemsPresent(dirName1, "TEST_ROOT_0");
        bots.breadcrumb.assertItemsPresent(TestFilesRule.DIR_NAME_1, "TEST_ROOT_0");

        bots.breadcrumb.clickItem("TEST_ROOT_0");
        bots.directory.waitForDocument(dirName1);
        bots.directory.waitForDocument(TestFilesRule.DIR_NAME_1);
    }

    @Test
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public class FingerSelectionUiTest extends ActivityTestJunit4<FilesActivity> {
    public void testFingerSelection_outOfRange() throws Exception {
        bots.main.switchToGridMode();
        Rect dirListBounds = bots.directory.findDocumentsList().getBounds();
        Rect firstDoc = bots.directory.findDocument(fileName1).getBounds();
        Rect firstDoc = bots.directory.findDocument(TestFilesRule.FILE_NAME_1).getBounds();
        // Start from list right bottom.
        Point start = new Point(firstDoc.centerX(), firstDoc.centerY());
        // End is center of file1
+4 −4
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public class GestureSelectionUiTest extends ActivityTestJunit4<FilesActivity> {
    @Test
    public void testGridGestureSelect_twoFiles() throws Exception {
        bots.main.switchToGridMode();
        bots.gesture.gestureSelectFiles(fileName1, fileName2);
        bots.gesture.gestureSelectFiles(TestFilesRule.FILE_NAME_1, TestFilesRule.FILE_NAME_2);

        bots.directory.assertSelection(2);
    }
@@ -47,7 +47,7 @@ public class GestureSelectionUiTest extends ActivityTestJunit4<FilesActivity> {
    @Test
    public void testGridGestureSelect_multipleFiles() throws Exception {
        bots.main.switchToGridMode();
        bots.gesture.gestureSelectFiles(fileName2, dirName1);
        bots.gesture.gestureSelectFiles(TestFilesRule.FILE_NAME_2, TestFilesRule.DIR_NAME_1);

        bots.directory.assertSelection(3);

@@ -56,7 +56,7 @@ public class GestureSelectionUiTest extends ActivityTestJunit4<FilesActivity> {
    @Test
    public void testListGestureSelect_twoFiles() throws Exception {
        bots.main.switchToListMode();
        bots.gesture.gestureSelectFiles(fileName1, fileName2);
        bots.gesture.gestureSelectFiles(TestFilesRule.FILE_NAME_1, TestFilesRule.FILE_NAME_2);

        bots.directory.assertSelection(2);

@@ -65,7 +65,7 @@ public class GestureSelectionUiTest extends ActivityTestJunit4<FilesActivity> {
    @Test
    public void testListGestureSelect_multipleFiles() throws Exception {
        bots.main.switchToListMode();
        bots.gesture.gestureSelectFiles(fileName2, dirName1);
        bots.gesture.gestureSelectFiles(TestFilesRule.FILE_NAME_2, TestFilesRule.DIR_NAME_1);

        bots.directory.assertSelection(3);

Loading