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

Commit c2b1dc7e authored by Ben Lin's avatar Ben Lin Committed by android-build-merger
Browse files

Merge "Add Authentication UI Test." into arc-apps

am: 5fea1c36

Change-Id: I979557648e1a7f5c433af6b81a84fbb807ea3acf
parents fab7e3ef 5fea1c36
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@
    <string name="name_conflict">A file with this name already exists.</string>

    <!-- Error message shown when more authentication is necessary to view files  -->
    <string name="authentication_required">Authentification is required to see the content of this directory</string>
    <string name="authentication_required">Authentication is required to see the content of this directory</string>

    <!-- Text shown on button to open an application -->
    <string name="open_app">Open <xliff:g id="name" example="Cloud Storage">%1$s</xliff:g></string>
+21 −3
Original line number Diff line number Diff line
@@ -103,16 +103,34 @@ public class DirectoryListBot extends Bots.BaseBot {
        }
    }

    public void assertMessageTextView(String message) throws UiObjectNotFoundException {
        UiObject messageTextView = findMessageTextView();
    public void assertHeaderMessageText(String message) throws UiObjectNotFoundException {
        UiObject messageTextView = findHeaderMessageTextView();
        assertTrue(messageTextView.exists());

        String msg = String.valueOf(message);
        assertEquals(msg, messageTextView.getText());
    }

    /**
     * Checks against placeholder text. Placeholder can be Empty page, No results page, or the
     * "Hourglass" page (ie. something-went-wrong page).
     */
    public void assertPlaceholderMessageText(String message) throws UiObjectNotFoundException {
        UiObject messageTextView = findPlaceholderMessageTextView();
        assertTrue(messageTextView.exists());

        String msg = String.valueOf(message);
        assertEquals(msg, messageTextView.getText());

    }

    private UiObject findHeaderMessageTextView() {
        return findObject(
                DIR_CONTAINER_ID,
                "com.android.documentsui:id/message_textview");
    }

    private UiObject findMessageTextView() {
    private UiObject findPlaceholderMessageTextView() {
        return findObject(
                DIR_CONTAINER_ID,
                "com.android.documentsui:id/message");
+1 −1
Original line number Diff line number Diff line
@@ -40,6 +40,6 @@ public class ArchiveUiTest extends ActivityTest<FilesActivity> {
        bots.directory.openDocument("broken.zip");

        final String msg = String.valueOf(context.getString(R.string.empty));
        bots.directory.assertMessageTextView(msg);
        bots.directory.assertPlaceholderMessageText(msg);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public class FilesActivityDefaultsUiTest extends ActivityTest<FilesActivity> {
        bots.roots.openRoot(rootDir0.title);

        String msg = String.valueOf(context.getString(R.string.empty));
        bots.directory.assertMessageTextView(msg);
        bots.directory.assertPlaceholderMessageText(msg);

        // Check to make sure back button is properly handled by non-Doc type DocHolders
        device.pressBack();
+9 −0
Original line number Diff line number Diff line
@@ -61,6 +61,15 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> {
        bots.main.assertWindowTitle("Images");
    }

    public void testProtectedFolder_showsAuthenticationUi() throws Exception {
        bots.roots.openRoot("Demo Root");
        bots.main.switchToListMode();
        bots.directory.openDocument("throw a recoverable exception");
        bots.directory.assertHeaderMessageText(
                "Authentication is required to see the content of this directory");

    }

    public void testFilesListed() throws Exception {
        bots.directory.assertDocumentsPresent("file0.log", "file1.png", "file2.csv");
    }
Loading