[DocsUI] Use clickAndRetryOnLongPress when cant have long press
Using ViewActions.click() to click on something in tests is problematic when the click has to be the intended (short) click and not a long press. This is because ViewActions.click() can become a long press accidentally. ViewActions.click() will retry the click in the case of a long press, only if a rollbackAction is provided. Manage this logic behind a helper clickAndRetryOnLongPress(). A lot of times ViewActions.click() is sufficient because the click and long press behaviour are the same. But in the cases they are not, use clickAndRetryOnLongPress() which retries the click whenever a long press accidentally occurred. The caller can also provide a rollbackAction to be run in between retries for when the long press has an effect. In the case that the long press does nothing and the click just needs to be retried, the default rollbackAction will be a DoNothingAction. Bug: 433362841 Flag: EXEMPT test fix Test: atest com.android.documentsui.RenameDocumentUiTest#testRename_NameExists Test: atest com.android.documentsui.FileManagementUiTest#testDeleteDocument Change-Id: Ibfa428c592a1068859fdf66bc1480b1487f7fb2d
Loading
Please register or sign in to comment