Closed GoogleCodeExporter closed 9 years ago
And the problem does not happen on 4.3 emulators. It looks like the Android API
you use to get the screen position of views isn't 100% accurate on 4.1.2, but
is improved in 4.3
Original comment by K76...@gmail.com
on 26 Dec 2013 at 5:40
This also happens on larger views, like menu items, just very rare. I just got
an error after more than 300 runs of my tests that it failed to click on a menu
item during the test. The problem with it is that the Espresso thinks it has
completed the click and proceed to the next step, which is almost guaranteed to
fail. And when this happens, it is very hard to find out the reason of failure.
Original comment by K76...@gmail.com
on 2 Jan 2014 at 4:38
It looks like this happens more frequently to views at the top right corner.
The menu items are at the top right corner, and so does my small view.
Original comment by K76...@gmail.com
on 8 Jan 2014 at 6:39
Are you following the guidelines for min button
size?http://developer.android.com/design/style/metrics-grids.html
Original comment by vale...@google.com
on 9 Jan 2014 at 7:31
I am seeing this problem quite frequently on real tablet and occasionally on
phone emulator. And it's not only for small views. It's the action bar icons
and overflow menu items. For action bar icons and overflow menu items, they
should already follow any guidelines that Android has.
Original comment by K76...@gmail.com
on 10 Jan 2014 at 3:59
Here is the log for one of the problems. The menu was brought up and performed
click on one of the item, but when I later use check to check whether the
expected view in expected activity was shown, the view hierarchy indicates that
it was still in the menu list.
01-10 20:41:48.608 V/ESP_TRACE( 1773): EventInjector:Injecting event for
character (À€) with key code (82) downtime: (100255)
01-10 20:41:48.608 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=10 when=-1ms arg1=3373 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:48.638 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-3ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:48.678 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=6 when=-48ms arg1=1 arg2=1 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:48.678 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=3 when=-47ms }, with target: android.os.Handler, callback: no callback.
01-10 20:41:48.678 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.740 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=1 when=-1ms obj=android.os.AsyncTask$AsyncTaskResult@b3cd4690 }, with
target: android.os.AsyncTask.InternalHandler, callback: no callback.
01-10 20:41:48.740 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.740 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-82ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:48.740 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.740 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=5 when=-67ms arg1=480 arg2=117
obj=android.view.ViewRootImpl$ResizedInfo@b3cd4720 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:48.799 D/dalvikvm( 1773): GC_CONCURRENT freed 1503K, 11% free
14822K/16583K, paused 17ms+2ms, total 116ms
01-10 20:41:48.799 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.799 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=1 when=-57ms obj=android.widget.ProgressBar@b3b15cf8 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:48.799 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.799 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=1 when=-57ms obj=android.widget.ProgressBar@b3b15cf8 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:48.799 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.799 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=6 when=-55ms arg2=1 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:48.799 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.799 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-55ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:48.799 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.799 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-14ms }, with target: android.os.Handler, callback:
android.widget.Toast$TN$2@b3cd0d38
01-10 20:41:48.799 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.799 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=3 when=0 }, with target: android.view.ViewRootImpl.ViewRootHandler,
callback: no callback.
01-10 20:41:48.799 I/ViewInteraction( 1773): Performing 'single click' action
on view with string from resource id: <2131362320>[calMenu_edit] value: Edit
01-10 20:41:48.838 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=2 when=-1ms arg1=1
obj=android.graphics.drawable.AnimatedRotateDrawable@b3b8da18 }, with target:
android.view.Choreographer.FrameHandler, callback: no callback.
01-10 20:41:48.849 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-30ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:48.860 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=4 when=-22ms }, with target: android.os.Handler, callback: no callback.
01-10 20:41:48.860 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-19ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:48.869 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=0 }, with target: android.os.Handler, callback: no callback.
01-10 20:41:48.869 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=0 }, with target: android.os.Handler, callback:
android.widget.Toast$TN$1@b3d8d598
01-10 20:41:48.909 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-41ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:48.969 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-100ms }, with target: android.os.Handler, callback: no callback.
01-10 20:41:48.969 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.969 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=2 when=-36ms arg1=1
obj=android.graphics.drawable.AnimatedRotateDrawable@b3b8da18 }, with target:
android.view.Choreographer.FrameHandler, callback: no callback.
01-10 20:41:48.978 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.978 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=107 when=-40ms arg1=-1182164664 }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=129 when=-60ms arg2=2 }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=129 when=-61ms arg1=1 arg2=2 }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=129 when=-61ms }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=100 when=-59ms }, with target: android.webkit.CallbackProxy, callback: no
callback.
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=106 when=-58ms }, with target: android.webkit.CallbackProxy, callback: no
callback.
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-58ms }, with target: android.webkit.WebViewClassic.PrivateHandler,
callback: android.webkit.ViewManager$2@b39928c8
01-10 20:41:48.998 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:48.998 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-33ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:49.028 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.028 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=5 when=-51ms arg1=158 arg2=77
obj=android.view.ViewRootImpl$ResizedInfo@b3a2d980 }, with target:
android.view.ViewRootImpl.ViewRootHandler, callback: no callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-47ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-33ms }, with target: android.view.ViewRootImpl.ViewRootHandler,
callback: android.view.View$CheckForTap@b3983d08
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=106 when=-16ms }, with target: android.webkit.CallbackProxy, callback: no
callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=129 when=-17ms arg2=2 }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=129 when=-18ms arg1=1 arg2=2 }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=129 when=-17ms }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=131 when=-19ms }, with target:
android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=125 when=-6ms }, with target: android.webkit.CallbackProxy, callback: no
callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=121 when=-7ms obj=notes://// }, with target: android.webkit.CallbackProxy,
callback: no callback.
01-10 20:41:49.039 V/Unknown Source( 1773): WebViewAnnotator:annotate(WebView)
- start
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.039 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=125 when=-7ms }, with target: android.webkit.CallbackProxy, callback: no
callback.
01-10 20:41:49.039 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.059 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-32ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:49.068 V/ESP_TRACE( 1773): Barrier detected or task avaliable for
running shortly.
01-10 20:41:49.068 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-2ms }, with target: android.view.ViewRootImpl.ViewRootHandler,
callback: android.webkit.ZoomManager$PostScale@b3c9cf58
01-10 20:41:49.068 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=4 when=0 }, with target: android.os.Handler, callback: no callback.
01-10 20:41:49.068 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=0 }, with target: android.app.ActivityThread.H, callback:
android.app.LoadedApk$ReceiverDispatcher$Args@b3ad59a8
01-10 20:41:49.098 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=2 when=-12ms arg1=1
obj=android.graphics.drawable.AnimatedRotateDrawable@b3b8da18 }, with target:
android.view.Choreographer.FrameHandler, callback: no callback.
01-10 20:41:49.098 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=105 when=0 obj=android.webkit.WebViewCore$DrawData@b389e368 }, with
target: android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:49.109 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-10ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:49.118 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=123 when=-16ms }, with target: android.webkit.CallbackProxy, callback: no
callback.
01-10 20:41:49.118 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-16ms }, with target: android.webkit.WebViewClassic.PrivateHandler,
callback: android.webkit.ViewManager$3@b3ca03f0
01-10 20:41:49.118 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-12ms }, with target: android.view.ViewRootImpl.ViewRootHandler,
callback: android.webkit.ZoomManager$PostScale@b3a54b40
01-10 20:41:49.118 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=105 when=0 obj=android.webkit.WebViewCore$DrawData@b3b8f310 }, with
target: android.webkit.WebViewClassic.PrivateHandler, callback: no callback.
01-10 20:41:49.118 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-13ms }, with target: android.view.Choreographer.FrameHandler,
callback: android.view.Choreographer$FrameDisplayEventReceiver@b3b2eaa0
01-10 20:41:49.139 V/ESP_TRACE( 1773): UiControllerImpl: MessageQueue.next(): {
what=0 when=-1ms }, with target: android.os.Handler, callback: no callback.
01-10 20:41:49.139 E/ViewAssertions( 1773): 'is displayed on the screen to the
user' check could not be performed because view 'is displayed on the screen to
the user' was not found.
01-10 20:43:43.650 E/cucumber-android( 1773):
com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException: No
views in hierarchy found matching: with id: is <2131165564>
01-10 20:43:43.650 E/cucumber-android( 1773):
01-10 20:43:43.650 E/cucumber-android( 1773): View Hierarchy:
01-10 20:43:43.650 E/cucumber-android( 1773): +>DecorView{id=-1,
visibility=VISIBLE, width=480, height=117, has-focus=true, has-focusable=true,
has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false,
is-focusable=false, is-layout-requested=false, is-selected=false,
root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0,
child-count=1}
01-10 20:43:43.650 E/cucumber-android( 1773): |
01-10 20:43:43.650 E/cucumber-android( 1773): +->IconMenuView{id=16908939,
res-name=icon_menu, visibility=VISIBLE, width=474, height=99, has-focus=true,
has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true,
is-focused=true, is-focusable=true, is-layout-requested=false,
is-selected=false, root-is-layout-requested=false, has-input-connection=false,
x=3.0, y=18.0, child-count=3}
01-10 20:43:43.650 E/cucumber-android( 1773): |
01-10 20:43:43.650 E/cucumber-android( 1773): +-->IconMenuItemView{id=16908310,
res-name=title, visibility=VISIBLE, width=157, height=99, has-focus=false,
has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true,
is-focused=false, is-focusable=true, is-layout-requested=false,
is-selected=false, root-is-layout-requested=false, has-input-connection=false,
x=0.0, y=0.0, text=Set Alarm, input-type=0, ime-target=false}
01-10 20:43:43.650 E/cucumber-android( 1773): |
01-10 20:43:43.650 E/cucumber-android( 1773): +-->IconMenuItemView{id=16908310,
res-name=title, visibility=VISIBLE, width=157, height=99, has-focus=false,
has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true,
is-focused=false, is-focusable=true, is-layout-requested=false,
is-selected=false, root-is-layout-requested=false, has-input-connection=false,
x=158.0, y=0.0, text=Edit, input-type=0, ime-target=false}
01-10 20:43:43.650 E/cucumber-android( 1773): |
01-10 20:43:43.650 E/cucumber-android( 1773): +-->IconMenuItemView{id=16908310,
res-name=title, visibility=VISIBLE, width=158, height=99, has-focus=false,
has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true,
is-focused=false, is-focusable=true, is-layout-requested=false,
is-selected=false, root-is-layout-requested=false, has-input-connection=false,
x=316.0, y=0.0, text=Cancel, input-type=0, ime-target=false}
Original comment by K76...@gmail.com
on 12 Jan 2014 at 1:22
[deleted comment]
I found that this problem is much more easier to recreate on tablet when
clicking on action bar icons without text. It happens about every 300~400
action bar icon clicks. That doesn't sound too frequent, but if you consider
that tablet tests can click action bar icons dozen times for a test run, that's
a high frequency of failure.
Also, I have more than one action bar icon, along with the overflow menu icon.
It seems to happen more frequently when there are multiple action bar icons,
some with icon only and some with icon plus text, and click one that has icon
only in the middle of them.
Original comment by K76...@gmail.com
on 19 Jan 2014 at 9:28
This is killing me on tablets. It happens more than once per 100 tries for
action bar icons on tablet. I put some other things in the action bar, like
using actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST), or some
other custom views like notification count. These may make the position
calculation inaccurate, but they shouldn't.
Original comment by K76...@gmail.com
on 11 Feb 2014 at 7:18
4px click area is too small for a touch interface - it is likely that your
users will also not be able to click accurately on the given button (Espresso
is actually exposing this problem here). Please refer to the Metrics and Grid
guide: http://developer.android.com/design/style/metrics-grids.html
Original comment by vale...@google.com
on 7 May 2014 at 6:39
Well, as I mentioned in the comments, this also happens in larger views,
especially action bar icons and overflow menu options. If Espresso can fail to
click on action bar icons and overflow menu options, that looks like a must fix
to me.
Original comment by K76...@gmail.com
on 8 May 2014 at 1:30
Original issue reported on code.google.com by
K76...@gmail.com
on 26 Dec 2013 at 5:38