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

ViewAction closeSoftKeyboard() does ensure that soft keyboard is completely gone #79

Open
GoogleCodeExporter opened this issue Apr 15, 2015 · 15 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Soft keyboard enabled
2. EditText with focus to bring up the soft keyboard
3. Button that would normally get blocked by the soft keyboard
4. In an Espresso test, click on the button immediately after performing the 
closeSoftKeyboard() ViewAction.

What is the expected output?
The soft keyboard gets dismissed and the click on the button is successful.

What do you see instead?
On certain devices (physical Nexus 4 with API19 and Nexus 5 emulator with 
API19), the click is invoked while the soft keyboard is animating away despite 
disabling animations in the Developer Settings. If the click is done on the 
soft keyboard, a SecurityException will be thrown.

What version of the product are you using? On what operating system?
Espresso v1.1
Physical Nexus 4 Android 4.4.2 (API19)
Emulator Nexus 5 Android 4.4.2 (API19)


Please provide any additional information below.
The issue appears to be mitigated if I add a sleep of 500 milliseconds.
Please see: 
https://groups.google.com/forum/#!searchin/android-test-kit-discuss/keyboard/and
roid-test-kit-discuss/IX-D3BRWQsE/-XAQmW9HrRMJ

Here is a sample call stack from one of our tests that ran into this issue:
com.google.android.apps.common.testing.ui.espresso.PerformException: Error 
performing 'single click' on view 'with id: is <2131296505>'.
    at com.google.android.apps.common.testing.ui.espresso.PerformException$Builder.build(PerformException.java:67)
    at com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:57)
    at com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:40)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:159)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.doPerform(ViewInteraction.java:90)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.perform(ViewInteraction.java:73)
    at com.twitter.android.coverage.TextFirstComposerActivityTest.postActivityWithASimpleImageTweetHelper(TextFirstComposerActivityTest.java:219)
    at com.twitter.android.coverage.TextFirstComposerActivityTest.testPostActivityWithASimpleImageTweetInLandscape(TextFirstComposerActivityTest.java:96)
    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(ActivityInstrumentationTestCase2.java:192)
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
    at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
    at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onStart(GoogleInstrumentationTestRunner.java:167)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
Caused by: com.google.android.apps.common.testing.ui.espresso.PerformException: 
Error performing 'Send down montion event' on view 'unknown'.
    at com.google.android.apps.common.testing.ui.espresso.PerformException$Builder.build(PerformException.java:67)
    at com.google.android.apps.common.testing.ui.espresso.action.MotionEvents.sendDown(MotionEvents.java:90)
    at com.google.android.apps.common.testing.ui.espresso.action.Tap$1.sendTap(Tap.java:24)
    at com.google.android.apps.common.testing.ui.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:82)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction$1.run(ViewInteraction.java:119)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5017)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: 
com.google.android.apps.common.testing.ui.espresso.InjectEventSecurityException:
 java.lang.SecurityException: Injecting to another application requires 
INJECT_EVENTS permission
    at com.google.android.apps.common.testing.ui.espresso.base.InputManagerEventInjectionStrategy.injectMotionEvent(InputManagerEventInjectionStrategy.java:131)
    at com.google.android.apps.common.testing.ui.espresso.base.EventInjector.injectMotionEvent(EventInjector.java:80)
    at com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl$3.call(UiControllerImpl.java:201)
    at com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl$3.call(UiControllerImpl.java:198)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.SecurityException: Injecting to another application 
requires INJECT_EVENTS permission
    at android.os.Parcel.readException(Parcel.java:1465)
    at android.os.Parcel.readException(Parcel.java:1419)
    at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:356)
    at android.hardware.input.InputManager.injectInputEvent(InputManager.java:641)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at com.google.android.apps.common.testing.ui.espresso.base.InputManagerEventInjectionStrategy.injectMotionEvent(InputManagerEventInjectionStrategy.java:122)
    ... 9 more

Original issue reported on code.google.com by [email protected] on 3 Jun 2014 at 7:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant