Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically scroll when needed when clicking in tests #6092

Merged
merged 3 commits into from Apr 15, 2024

Conversation

seadowg
Copy link
Member

@seadowg seadowg commented Apr 12, 2024

This pulls out click interactions to a shared place and adds a fallback scroll when clicking fails so we don't need explicit methods for scrolling.

@seadowg seadowg changed the title Auto scroll when needed when clicking tests Automatically scroll when needed when clicking tests Apr 12, 2024
* because the click never actually occurs (most likely due to some flakiness in
* [androidx.test.espresso.action.ViewActions.click]).
*/
fun clickOn(view: Matcher<View>, root: Matcher<Root>? = null, assertion: () -> Unit) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this helper is advisable over the other clickOn as it seems there's some flakiness in Espresso's ViewActions.click that are resolved with this "try again on fail" approach.

@seadowg seadowg changed the title Automatically scroll when needed when clicking tests Automatically scroll when needed when clicking in tests Apr 12, 2024
@seadowg seadowg marked this pull request as ready for review April 15, 2024 09:29
@seadowg seadowg added the high priority Should be looked at before other PRs/issues label Apr 15, 2024
}

fun clickManuallyEnterProjectDetails(): ManualProjectCreatorDialogPage {
scrollToAndClickText(org.odk.collect.strings.R.string.configure_manually)
return ManualProjectCreatorDialogPage().assertOnPage()
return clickOnString(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should resolve this flake.

@grzesiek2010 grzesiek2010 merged commit e524a73 into getodk:master Apr 15, 2024
6 checks passed
@seadowg seadowg deleted the click-interactions branch April 15, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority Should be looked at before other PRs/issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants