[docsui] More robust root selection in sidebar in tests
1. Skip clicking on a root in the sidebar if the target root is already selected. UiObject.click() waits for a TYPE_WINDOW_CONTENT_CHANGED or TYPE_VIEW_SELECTED accessibility event, and will return false if a timeout (3s by default) is reached without an event happening. If the target root is already selected, clicking it doesn't appear to generate these events, failing the test. 2. Since we are only clicking if the root isn't already selected, the drawer should be closed automatically, so stop closing it manually. 3. Wait for the title to change after clicking. 4. Make checks in assertWindowTitle more specific. Only check header_title for pre-m3 recents root, because checking header_title substring for other roots is not a reliable indicator that the root is selected, as the title will contain the root's name even if a subdirectory is selected. This also rolls back ag/34396707, which isn't needed anymore. Bug: 428680975 Test: atest DocumentsUIGoogleTests:com.android.documentsui.CancelFromNotificationUiTest Flag: EXEMPT test change Change-Id: I6b780d674ed8f6c293dfbbb87c50e74bfbaf4ca7
Loading
Please register or sign in to comment