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

Commit 42a85838 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update tests to wait and assert vs. immediately asserting" into main

parents 7d274cc9 731d1aae
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -44,7 +44,9 @@ import android.platform.test.flag.junit.DeviceFlagsValueProvider;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.Until;

import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.RootInfo;
@@ -296,7 +298,7 @@ public class FilesActivityUiTest extends ActivityTestJunit4<FilesActivity> {
            // Deselect the file and ensure the share menu disappears (this ensures the menu is
            // refreshed).
            bots.directory.selectDocument(fileName);
            onView(withId(R.id.action_menu_share)).check(doesNotExist());
            device.wait(Until.gone(By.desc("Share")), /* timeout= */ 5000);
        } finally {
            cleanupFile(fileName, primaryRoot.title);
        }
+1 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.documentsui;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
@@ -361,7 +360,7 @@ public class SearchViewUiTest extends ActivityTestJunit4<FilesActivity> {

        // Ensure the selection has cleared and the "1 file selected" text is not displayed.
        device.wait(Until.findObject(By.text(TestFilesRule.FILE_NAME_2).selected(false)), mTimeout);
        onView(withText("1 selected")).check(doesNotExist());
        device.wait(Until.gone(By.text("1 selected")), mTimeout);
    }

    @Test