RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 786 forks source link

Extended Edittext issue #335

Closed renas closed 9 years ago

renas commented 9 years ago

From Surhum...@gmail.com on May 01, 2012 07:50:38

What steps will reproduce the problem? 1. create extended class of EditText, with a popupwindow inside it.

  1. add the class programmatical (x2) 3. ArrayList edts = solo.getCurrentEditTexts(); for(int i=0; i<edts.size();i++){ solo.clickOnEditText(i); solo.enterText(i, "12345"); solo.enterText(i, "asdfghjklepoiuytrewq"); } What is the expected output? What do you see instead? that i'd click it, to spawn the popupwindow, and then fill it out with the entertext. Worked for the first edittext, but couldnt click the 2nd, it said, i dont know why? What version of the product are you using? On what operating system? 3.2.1, ubuntu 11.10 Please provide any additional information below. I can attach my code etc. if you want :-)

Original issue: http://code.google.com/p/robotium/issues/detail?id=256

renas commented 9 years ago

From renasr...@gmail.com on May 03, 2012 22:30:33

What happens if you remove solo.clickOnEditText()?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 00:42:34

it fills it into the first edittext, but not into the second.

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 00:59:17

Would it be possible for you to send me an application that exhibits this problem?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 01:06:05

That I'm affraid isn't possible, I can give you some snippets and or screenshots. The whole app also requires account etc. Which isn't free to create.

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 01:09:49

Do you get an error message (EditText with index 1 can not be found) when trying to fill in the second edit text field?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 01:22:09

Besides the "Next assert failure" I only get an IntentLeak error (at the same time, think it is because of the assertfailure) But here it is:

05-07 10:19:01.255: E/WindowManager(4438): Activity dk.mobile.basket.order.OrderActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41337558 that was originally added here 05-07 10:19:01.255: E/WindowManager(4438): android.view.WindowLeaked: Activity dk.mobile.basket.order.OrderActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41337558 that was originally added here 05-07 10:19:01.255: E/WindowManager(4438): at android.view.ViewRootImpl.(ViewRootImpl.java:344) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.Window$LocalWindowManager.addView(Window.java:537) 05-07 10:19:01.255: E/WindowManager(4438): at android.app.Dialog.show(Dialog.java:278) 05-07 10:19:01.255: E/WindowManager(4438): at dk.mobile.util.DialogHelper.show(DialogHelper.java:82) 05-07 10:19:01.255: E/WindowManager(4438): at dk.mobile.basket.order.OrderActivity.validateOrder(OrderActivity.java:379) 05-07 10:19:01.255: E/WindowManager(4438): at dk.mobile.basket.order.OrderActivity.nextTab(OrderActivity.java:486) 05-07 10:19:01.255: E/WindowManager(4438): at dk.mobile.basket.order.OrderActivity.nextTab(OrderActivity.java:307) 05-07 10:19:01.255: E/WindowManager(4438): at java.lang.reflect.Method.invokeNative(Native Method) 05-07 10:19:01.255: E/WindowManager(4438): at java.lang.reflect.Method.invoke(Method.java:511) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.View$1.onClick(View.java:3039) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.View.performClick(View.java:3511) 05-07 10:19:01.255: E/WindowManager(4438): at android.view.View$PerformClick.run(View.java:14105) 05-07 10:19:01.255: E/WindowManager(4438): at android.os.Handler.handleCallback(Handler.java:605) 05-07 10:19:01.255: E/WindowManager(4438): at android.os.Handler.dispatchMessage(Handler.java:92) 05-07 10:19:01.255: E/WindowManager(4438): at android.os.Looper.loop(Looper.java:137) 05-07 10:19:01.255: E/WindowManager(4438): at android.app.ActivityThread.main(ActivityThread.java:4424) 05-07 10:19:01.255: E/WindowManager(4438): at java.lang.reflect.Method.invokeNative(Native Method) 05-07 10:19:01.255: E/WindowManager(4438): at java.lang.reflect.Method.invoke(Method.java:511) 05-07 10:19:01.255: E/WindowManager(4438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) 05-07 10:19:01.255: E/WindowManager(4438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554) 05-07 10:19:01.255: E/WindowManager(4438): at dalvik.system.NativeStart.main(Native Method)

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 01:24:32

What do you get if you run this command before trying to enter text into the fields?

Log.d("Robotium", "number of edit texts: " + solo.getCurrentExitTexts().size());

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 01:31:14

05-07 10:27:52.370: D/Robotium(4918): number of edit texts: 1

Hmm that sure explains it :-/ There is 2 on the screen though

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 01:34:02

Can you please attach a screenshot?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 01:38:19

Of cause. :-) actually 7, Navn, : is 3 different edittexts (enabled=false) aswell though.

Attachment: roboSS.png

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 01:44:11

Does the second edit text field belong to the same process? Can you click it with any of the click methods?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 01:49:25

I fail to see what you mean, if it belongs to the same process. It is created at the same time as the first one (with 12345). I had clickOnEditText(i) in it before, that was not possible to click on no.2.

How can i else try and click on it?

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 01:53:34

If you have the source code to the application you can use solo.clickOnView(solo.getView(R.id.x)) or if you have the location, you can use solo.clickOnScreen(int x, int y).

If you check with hierarchyviewer, are you sure that the second component is indeed an EditText field?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 02:05:30

They are both an inheritance of EditText yes. (All under Reference is created from the same class, extended from EditText).

I dont have the id, since i add them programmaticly. I can try and add the clickonscreen, but it just isn't sustainable when I would like to test it on multiple devices :-). But i'll try it for this bugfinding

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 02:15:34

The clickOnScreen(158,426) worked, it targeted the location of the referenceField. And displayed the keyboard and my custom popup :-)

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 02:21:36

That is strange. Then it should find it.

I have emailed you the latest snapshot of Robotium. Can you please try with the new jar and see it the problem exists also there?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 02:38:52

Okay update, I missed something before. It does click the inheireted edittext, and it does act appropriately. But it also says:

05-07 11:36:15.945: I/TestRunner(7267): junit.framework.AssertionFailedError: Click can not be completed!

(didnt see if it said it with the released, but defently does with the snapshot you sent me)

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 02:42:34

Is the keyboard in the way? Please try to use solo.goBack() after clicking the edit text field. As the keyboard does not belong to your application a security exception is sent when you try to click it. That is why you are getting the AssertionFailedError.

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 02:48:07

click it, goback, and what? i cant enter text into it without having it in an ID or in some kind of variable, can I ? :-)

Ps. Trying to get a testproject with the necessities up and running that I can send to you :-)

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 02:50:38

The issue you are experiencing is that probably the keyboard is blocking the EditText. So you need to make the keyboard dissappear. A way to do that is by the use of solo.goBack() (when the keyboard is shown). So if you click on the edit text field, the keyboard is shown, you use goBack() to make the keyboard disappear and then use solo.enterText(1, "12345");

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 03:01:30

But it doesn't block it unless I click it. And the Array is only 1 big, which means that it only tries to insert the text into the first field, and not the second, or am I mistaken? the 12345 is getting inserted in the first field. it is the second field that it doesn't get too, and therefore can't insert into it.

Else I would need a method called insertTextInPreTargetedBox(String str), if I'm not mistaken?

renas commented 9 years ago

From Surhum...@gmail.com on May 07, 2012 03:54:16

Anyways tried it with: for(int i=0; i<edts.size();i++){ solo.enterText(i, "12345"); solo.clickOnScreen(158, 425); solo.goBack(); solo.enterText(i, "asdfghjklæpoiuytrewq"); solo.sleep(1000); } No difference. I made my testproject, where there is no tabviews, headers, footers. There it works. Any ideas? :)

renas commented 9 years ago

From renasr...@gmail.com on May 07, 2012 05:29:59

No idea why you are encountering this issue. I hope you will be able to reproduce it in your test project :)

renas commented 9 years ago

From renasr...@gmail.com on May 29, 2012 13:05:22

Will open up the issue when new information is provided.

Status: Invalid
Owner: renasr...@gmail.com