Saturday, 15 August 2015
android espresso click, Error performing 'single click' on view ' again again.
As I mentioned in :http://baiduhix.blogspot.co.uk/2015/07/android-espresso-test-with-viewlist.html
the "click()" function doesn't work well most of time if you have a scrollable view, and your button isn't show on the screen initially.
And my solution was create my own click function by coping the code and change it.
I have kept most of the code but just call "((View) view).callOnClick();" when it fails to click.
As I mentioned in my previous post, espresso "click()" function measure your button's location and send a click native call to the location, so if it is out of the screen, you will get error.
Today I got another interesting error. My test failed because it clicked an unexpected button. Because of the scroller view, my target button just under another button, but espresso surprisingly clicked the button above. Even my "click" function doesn't work, because it successfully clicked something.....
So I have to make my "click" function directly call the native click function instead of doing the failover.