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

TypeText Show IME Control dialog by Calling GeneralClickAction without no callback #19

Closed
GoogleCodeExporter opened this issue Sep 17, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run these Esspresso Test with EditText

onView(withId(R.id.editText)).perform(typeText("sample"));
onView(withId(R.id.editText)).perform(pressImeActionButton());


2. occur sometime


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

I want to succeed pressImeActionButton()

but I sometimes see below error.

--------------------------------------------------------------------------------
com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException: No 
views in hierarchy found matching: with id: is <2131361805>
If the target view is not part of the view hierarchy, you may need to use 
Espresso.onData to load it from one of the following 
AdapterViews:com.android.internal.app.AlertController$RecycleListView@406085d8

View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=768, height=304, 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, 
child-count=1}
|
+->FrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=768, 
height=304, 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, child-count=1}
|
+-->WeightedLinearLayout{id=16908666, res-name=parentPanel, visibility=VISIBLE, 
width=768, height=304, 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, child-count=4}
|
+--->LinearLayout{id=16908667, res-name=topPanel, visibility=VISIBLE, 
width=760, height=121, has-focus=false, has-focusable=false, 
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, child-count=2}
|
+---->LinearLayout{id=16908668, res-name=title_template, visibility=VISIBLE, 
width=670, height=71, has-focus=false, has-focusable=false, 
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, child-count=2}
|
+----->ImageView{id=16908294, res-name=icon, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false}
|
+----->DialogTitle{id=16908669, res-name=alertTitle, visibility=VISIBLE, 
width=670, height=71, has-focus=false, has-focusable=false, 
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, text=Edit text, 
input-type=0, ime-target=false}
|
+---->ImageView{id=16908670, res-name=titleDivider, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false}
|
+--->LinearLayout{id=16908671, res-name=contentPanel, visibility=VISIBLE, 
width=760, height=159, 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, child-count=1}
|
+---->RecycleListView{id=16908823, res-name=select_dialog_listview, 
visibility=VISIBLE, width=710, height=128, has-focus=true, has-focusable=true, 
has-window-focus=true, is-clickable=true, 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, child-count=1}
|
+----->ListMenuItemView{id=-1, visibility=VISIBLE, width=710, height=128, 
has-focus=false, has-focusable=false, 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, child-count=1}
|
+------>RelativeLayout{id=-1, visibility=VISIBLE, width=686, height=59, 
has-focus=false, has-focusable=false, 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, child-count=2}
|
+------->TextView{id=16908310, res-name=title, visibility=VISIBLE, width=686, 
height=59, has-focus=false, has-focusable=false, 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, text=Input method, input-type=0, ime-target=false}
|
+------->TextView{id=16908783, res-name=shortcut, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, text=, input-type=0, ime-target=false}
|
+--->FrameLayout{id=16908673, res-name=customPanel, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, child-count=1}
|
+---->FrameLayout{id=16908331, res-name=custom, visibility=VISIBLE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, child-count=0}
|
+--->LinearLayout{id=16908674, res-name=buttonPanel, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, child-count=1}
|
+---->LinearLayout{id=-1, visibility=VISIBLE, width=0, height=0, 
has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, child-count=5}
|
+----->LinearLayout{id=16908675, res-name=leftSpacer, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, child-count=0}
|
+----->Button{id=16908313, res-name=button1, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, text=, input-type=0, ime-target=false}
|
+----->Button{id=16908315, res-name=button3, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, text=, input-type=0, ime-target=false}
|
+----->Button{id=16908314, res-name=button2, visibility=GONE, width=0, 
height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, text=, input-type=0, ime-target=false}
|
+----->LinearLayout{id=16908676, res-name=rightSpacer, visibility=GONE, 
width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, 
is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, 
is-layout-requested=true, is-selected=false, root-is-layout-requested=false, 
has-input-connection=false, child-count=0}
|
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:737)
at 
com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.ge
tUserFriendlyError(DefaultFailureHandler.java:69)
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:146)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction.doPerform(Vie
wInteraction.java:77)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction.perform(ViewI
nteraction.java:69)
at xxxxxxxxxxxxxxxxxxx(our test application source)
at java.lang.reflect.Method.invokeNative(Native Method)
at 
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:204)
at 
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:194)
at 
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:186)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:52
9)
at 
com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunne
r.onStart(GoogleInstrumentationTestRunner.java:119)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
--------------------------------------------------------------------------------




What version of the product are you using? On what operating system?

espresso-1.0.jar

windows 7 / run Android 2.3.3 emulator



Please provide any additional information below.

When I got error, I also see IME Control dialog.
in normally, i can see this dialog when i longclick empty editbox.
so, I think here code is cause.

----------------------------------------
package com.google.android.apps.common.testing.ui.espresso.action;

public final class TypeTextAction implements ViewAction {

  @Override
  public void perform(UiController uiController, View view) {

    // Perform a click.
    new GeneralClickAction(Tap.SINGLE, GeneralLocation.CENTER, Press.PINPOINT)
        .perform(uiController, view);
    uiController.loopMainThreadUntilIdle();


----------------------------------------

when I use very very slow emulator, 
I have to set pressback  callback with click like below.

onView(withId(R.id.editView)).perform(click(pressBack()));

without callback, the dialog sometimes will be shown.
(its depends on emulator speed)

but click called without callback in TypeText.

what should i do for stable Test success ?

if you need more infromation, please ask me.







Original issue reported on code.google.com by oono0...@gmail.com on 14 Nov 2013 at 3:23

@GoogleCodeExporter
Copy link
Author

This is an unfortunate limitation in the way clicks are delivered using 
automation - it may happen that events are inserted between Motion.Down and 
Motion.Up events and turn the click into a long click. This is not something 
under our control, therefore we added the ability to workaround you have 
correctly identified - pressBack as the fallback action (it will only be called 
if click is turned into a longClick, so you should be OK with the stable tests).

Original comment by vale...@google.com on 14 Nov 2013 at 6:48

  • Changed state: WontFix

@GoogleCodeExporter
Copy link
Author

thanks for your reply.

you mean we cannot call typetext
 without click (and longclick) , right?

if that, i'm going to use TouchUtils
for type some word or
try disable longclick event of IME in UnitTest code.





Original comment by oono0...@gmail.com on 16 Nov 2013 at 5:25

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