rahul7386 / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Extended Edittext issue #256

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create extended class of EditText, with a popupwindow inside it.
2. add the class programmatical (x2)
3.
        ArrayList<EditText> 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 reported on code.google.com by Surhum...@gmail.com on 1 May 2012 at 2:50

GoogleCodeExporter commented 9 years ago
What happens if you remove solo.clickOnEditText()?

Original comment by renasr...@gmail.com on 4 May 2012 at 5:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
it fills it into the first edittext, but not into the second.
- which makes it not get to the next activity, since it opens up an error 
dialogue when it the custom edittext isnt filled out correctly :-/

Original comment by Surhum...@gmail.com on 7 May 2012 at 7:42

GoogleCodeExporter commented 9 years ago
Would it be possible for you to send me an application that exhibits this 
problem?

Original comment by renasr...@gmail.com on 7 May 2012 at 7:59

GoogleCodeExporter commented 9 years ago
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.

Original comment by Surhum...@gmail.com on 7 May 2012 at 8:06

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

Original comment by renasr...@gmail.com on 7 May 2012 at 8:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

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.<init>(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)

Original comment by Surhum...@gmail.com on 7 May 2012 at 8:22

GoogleCodeExporter commented 9 years ago
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());

Original comment by renasr...@gmail.com on 7 May 2012 at 8:24

GoogleCodeExporter commented 9 years ago
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

Original comment by Surhum...@gmail.com on 7 May 2012 at 8:31

GoogleCodeExporter commented 9 years ago
Can you please attach a screenshot?

Original comment by renasr...@gmail.com on 7 May 2012 at 8:34

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

Original comment by Surhum...@gmail.com on 7 May 2012 at 8:38

Attachments:

GoogleCodeExporter commented 9 years ago
Does the second edit text field belong to the same process? Can you click it 
with any of the click methods?

Original comment by renasr...@gmail.com on 7 May 2012 at 8:44

GoogleCodeExporter commented 9 years ago
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?

Original comment by Surhum...@gmail.com on 7 May 2012 at 8:49

GoogleCodeExporter commented 9 years ago
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?

Original comment by renasr...@gmail.com on 7 May 2012 at 8:53

GoogleCodeExporter commented 9 years ago
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

Original comment by Surhum...@gmail.com on 7 May 2012 at 9:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The clickOnScreen(158,426) worked, it targeted the location of the 
referenceField.
And displayed the keyboard and my custom popup :-)

Original comment by Surhum...@gmail.com on 7 May 2012 at 9:15

GoogleCodeExporter commented 9 years ago
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?

Original comment by renasr...@gmail.com on 7 May 2012 at 9:21

GoogleCodeExporter commented 9 years ago
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)

Original comment by Surhum...@gmail.com on 7 May 2012 at 9:38

GoogleCodeExporter commented 9 years ago
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. 

Original comment by renasr...@gmail.com on 7 May 2012 at 9:42

GoogleCodeExporter commented 9 years ago
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 :-)

Original comment by Surhum...@gmail.com on 7 May 2012 at 9:48

GoogleCodeExporter commented 9 years ago
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");

Original comment by renasr...@gmail.com on 7 May 2012 at 9:50

GoogleCodeExporter commented 9 years ago
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?

Original comment by Surhum...@gmail.com on 7 May 2012 at 10:01

GoogleCodeExporter commented 9 years ago
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? :)

Original comment by Surhum...@gmail.com on 7 May 2012 at 10:54

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

Original comment by renasr...@gmail.com on 7 May 2012 at 12:29

GoogleCodeExporter commented 9 years ago
Will open up the issue when new information is provided. 

Original comment by renasr...@gmail.com on 29 May 2012 at 8:05