Open TWiStErRob opened 5 years ago
There is a workaround from StackOverflow: https://stackoverflow.com/a/55084395/2531709
Kotlin Version:
/**
* Espresso has problems clicking on rotated image buttons:
* https://issuetracker.google.com/issues/64758984
* This is a workaround
*
*/
fun forceClick(): ViewAction {
return object : ViewAction {
override fun getConstraints(): Matcher<View> {
return allOf(isClickable(), isEnabled())
}
override fun getDescription(): String {
return "force click"
}
override fun perform(uiController: UiController, view: View) {
view.performClick()
uiController.loopMainThreadUntilIdle()
}
}
}
Use with onView(R.id.my_rotated_image_button).perform(forceClick())
Description
I'm trying to find out what happened to this issue: https://issuetracker.google.com/issues/64758984 (related: https://stackoverflow.com/q/42626452/253468)
It says fixed for a year now, yet Espresso 3.1.1 (latest stable atm) doesn't work. The code of GeneralLocation is exactly as described in the issue. I tried to search the history for the bug IDs but couldn't find any trace of the fix. Can you please help me find the fix, which version has the fix, whether it's released, or really any info? No mention in release notes either.
Steps to Reproduce
see https://issuetracker.google.com/issues/64758984
Expected Results
clicks correctly
Actual Results
perform(click())
passes, butOnClickListener
not triggeredAndroidX Test and Android OS Versions
3.1.1, API 25
Link to a public git repo demonstrating the problem:
https://github.com/duanbo1983/espresso-click-sample