Fix PasswordsSettingsTestCase.testCopyPasswordToast
The tested settings have a button just at the bottom end of the screen on small devices. Tapping the button results in showing a snackbar, which covers the button on small devices. testCopyPasswordToast in particular needs to tap the copy button twice. The second tap was impossible on small devices because the snackbar was still around, blocking the button. This CL adds two actions to prevent this issue: (1) While checking for the snackbar, the test also taps it, causing it to close. The test waits for the fade-out animation to finish. (2) The test also uses usingSearchAction:grey_scrollInDirection to ask EarlGrey to scroll until the control is clickable. Even though either single option from the above would fix the current issue, the CL contains both: (2) because it will also be useful on smaller devices, e.g., should we start testing in landscape mode (see https://crbug.com/717548 and also https://crbug.com/717163 for another blocker for landscape mode), where the buttons will be off the screen instead of just being covered. It also includes (1), because cleaning up the snackbar explicitly seems like a reasonable thing to do. Speaking of cleaning up, the CL also: (3) Forcibly closes all passwords-related snackbars on teardown. This will be useful when the test fails in the middle, leaving a snackbar up. If not foce-closed, such snackbar would remain visible for (currently) 4 seconds, which might be enough to interfere with the next test. The CL also applied (1) and (2) to two other tests in the same suite as well. Those deal with similar buttons, which are currently high enough not to experience the problem with being blocked. This secures them in case that, e.g., the layout changes in the future. Note that while (2) is clearly beneficial, it also has a drawback: the search action takes a considerable amount of time (about 2 seconds per one scrolling step on my computer). With it, the tests are more likely to time out. If there is an issue with timing out in the future, we should increase kScrollAmount to speed up the scrolling, or split long tests (testCopyPasswordToast is a particular candidate). BUG=718043 Review-Url: https://codereview.chromium.org/2860453004 Cr-Commit-Position: refs/heads/master@{#469361}
Showing
Please register or sign in to comment