wangyao5 / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

MotionEvents.sendCancel should not be fatal #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.        
Espresso.onView(ViewMatchers.withId(R.id.action_new_game)).perform(ViewActions.c
lick());
where R.id.action_new_game is a action bar item that will switch to a new 
activity.

The exception below is s

What is the expected output? What do you see instead?

On slow devices there is no problem.  
On GennyMotion 2.0.3 (http://www.genymotion.com)
 using Galaxy Nexus 4.2.2 API 17, periodically we get

com.google.android.apps.common.testing.ui.espresso.PerformException: Error 
performing 'single click' on view 'with id: is <2131296376>'.
at 
com.google.android.apps.common.testing.ui.espresso.PerformException$Builder.buil
d(PerformException.java:67)
at 
com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.ge
tUserFriendlyError(DefaultFailureHandler.java:57)
at 
com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.ha
ndle(DefaultFailureHandler.java:40)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction.runSynchronou
slyOnUiThread(ViewInteraction.java:159)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction.doPerform(Vie
wInteraction.java:90)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction.perform(ViewI
nteraction.java:73)
at 
com.agileteer.futsalcounter.activity.CountingActivity2Test.test300OnNewGameActiv
ityBringsUpTheNewGameActivity(CountingActivity2Test.java:179)
at java.lang.reflect.Method.invokeNative(Native Method)
at 
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at 
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at 
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
5)
at 
com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunne
r.onStart(GoogleInstrumentationTestRunner.java:167)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)
Caused by: com.google.android.apps.common.testing.ui.espresso.PerformException: 
Error performing 'inject cancel event (corresponding down event: MotionEvent { 
action=ACTION_DOWN, id[0]=0, x[0]=328.0, y[0]=98.0, 
toolType[0]=TOOL_TYPE_UNKNOWN, buttonState=0, metaState=0, flags=0x0, 
edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=12204894, 
downTime=12204894, deviceId=0, source=0x1002 })' on view 'unknown'.
at 
com.google.android.apps.common.testing.ui.espresso.PerformException$Builder.buil
d(PerformException.java:67)
at 
com.google.android.apps.common.testing.ui.espresso.action.MotionEvents.sendCance
l(MotionEvents.java:160)
at 
com.google.android.apps.common.testing.ui.espresso.action.Tap$1.sendTap(Tap.java
:28)
at 
com.google.android.apps.common.testing.ui.espresso.action.GeneralClickAction.per
form(GeneralClickAction.java:82)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction$1.run(ViewInt
eraction.java:119)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

If we set a break point on the click statement, and then step through makes the 
problem not visible.

What version of the product are you using? On what operating system?
android test kit 1.1, with android studio 0.42 on OS X 10.9.1

Please provide any additional information below.

Original issue reported on code.google.com by marcp...@gmail.com on 16 Jan 2014 at 10:13

GoogleCodeExporter commented 9 years ago
I see the same problem intermittently with fast emulators (using Intel HAXM), 
not only Genymotion.

Original comment by GoncaloS...@gmail.com on 4 Mar 2014 at 5:08

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 7 May 2014 at 7:09

GoogleCodeExporter commented 9 years ago
Fixed in Espresso 2.0

Original comment by vale...@google.com on 20 Dec 2014 at 4:33