stephenwang1011 / robotium

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

compatibility with Jelly Bean #304

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
pasting whole email conversation related to this issue. Please see bellow.

I tried one more thing which suggested Renas. I iterated over all objects 
returned by solo.getViews() and I checked all ImageView, ImageButton and Button 
objects but I did not find the one which I'm looking for. The button which I 
would like to find is normally visible on screen and it is possible to click on 
it [that invokes other action].

Again please let me stress the fact that the same code worked on my device 
before I did upgrade from 4.0 to 4.1. After that upgrade it does not work any 
longer.
I tried that code with robotium 3.2, 3.3 and 3.4 with same result.

----------------------------
Email communication 

1) If that is the case then please file an issue on it.

2) I chose an incorrect word in my first answer. There is no need for
them to be shown but they have to be there in the display space for
the getCurrent methods to return the objects.

/Renas

On Aug 9, 1:19 pm, Vladimir Marek <vladimir.ma...@qnective.com> wrote:
> @1: hmmm the screen looks the same for all Android versions and I'm sure
> the code worked before upgrade to Jelly bean on the same dev ice where
> it does not work now
>
> @2: now I'm confused 
> originally you wrote that "getCurrentImages() only returns the image
> views that are shown on the display at a given time."
> let say I have an object which is invisible - should getCurrentImages()
> return it or not?
> According to your answer that it should return views which are shown I
> would expect that invisible object will not be returned but apparently
> it is 
> Maybe I misunderstood it.
>
> Vladimir
>
> On 08/09/2012 01:08 PM, Renas Reda wrote:
>
>
>
>
>
>
>
>> 1) I think it can have something to do with the display size,
>> resolution and how many of the objects that are there.
>
>> 2) Just because you can not see them do not mean that they are not
>> there. Many times a view is set to be invisible or gone and then you
>> will not see it however the object is still there.
>
>> /Renas
>
>> On Aug 9, 1:01 pm, Vladimir Marek <vladimir.ma...@qnective.com> wrote:
>>> OK, I can try that but have two questions
>
>>> 1) Why the same code work for Android 2.3.* and 4.0?
>>> 2) Why the result from solo.getCurrentImageViews() contains object which
>>> is NOT visible on the screen? [it is hidden there and can be shown by
>>> some action] 
>
>>> Vladimir
>
>>> On 08/09/2012 12:56 PM, Renas Reda wrote:
>
>>>> Can you see all of them fully on the display? Because
>>>> getCurrentImages() only returns the image views that are shown on the
>>>> display at a given time. If you want everything back you can use
>>>> solo.getViews() and then filter out the ImageView objects from the
>>>> ArrayList it returns.
>>>> /Renas
>>>> On Aug 9, 12:53 pm, Vladimir Marek <vladimir.ma...@qnective.com>
>>>> wrote:
>>>>> Hi,
>>>>> the "solo.getCurrentImageViews()" returns less objects than I would 
expect.
>>>>> Vladimir
>>>>> On 08/09/2012 12:32 PM, Renas Reda wrote:
>>>>>> Hi,
>>>>>> Is your issue due to this: solo.getCurrentActivity().getResources()?
>>>>>> Or is it that solo.getCurrentImageViews() returns less items then
>>>>>> expected?
>>>>>> If it is getResources() that you have an issue with then it is a bug
>>>>>> in the Android platform. The only thing Robotium does in your case is
>>>>>> to give you the current activity. The getResources() method is part of
>>>>>> the Activity API.
>>>>>> /Renas
>>>>>> On 9 Aug, 11:51, Vladimir Marek <vladimir.ma...@qnective.com> wrote:
>>>>>>> Hi Naveed,
>>>>>>> did you have a time to check the code again?
>>>>>>> Today I tried it with robotium 3.4.1 and issue still persists.
>>>>>>> I would not expect an issue with array list but as you mentioned
>>>>>>> something wrong with getting all resources from current activity.
>>>>>>> Thanks,
>>>>>>>        Vladimir
>>>>>>> On 08/04/2012 05:45 AM, naveed wrote:
>>>>>>>> Hi,
>>>>>>>> I don't think it is issue with Arraylist, it seems like issue with
>>>>>>>> Resources or something else, because I am using ArryList & its working
>>>>>>>> fine in my case.
>>>>>>>> I'll check with this code and get back to you.
>>>>>>>> On Friday, August 3, 2012 7:26:54 PM UTC+5, Vladimir wrote:
>>>>>>>>        Hello,
>>>>>>>>        I would like to ask you if robotium 3.3 fully supports Android
>>>>>>>>        jelly bean.
>>>>>>>>        I am facing following problem.
>>>>>>>>        The code bellow returns all image view object on active screen 
but
>>>>>>>>        for
>>>>>>>>        jelly bean OS the array list is different then for ICS OS ... 
For
>>>>>>>>        Jelly
>>>>>>>>        bean there is missing one image button.
>>>>>>>>        ArrayList<ImageView> img_view = solo.getCurrentImageViews();
>>>>>>>>        Resources res = solo.getCurrentActivity().getResources();
>>>>>>>>        String name;
>>>>>>>>        for (int i = 0; i < img_view.size(); i++) {
>>>>>>>>           if (img_view.get(i).getId() != -1) {
>>>>>>>>             name = res.getResourceEntryName(img_view.get(i).getId());
>>>>>>>>             if (name.equals(SHOW_ADD_BUT)) {
>>>>>>>>               showAddBut = img_view.get(i);
>>>>>>>>             }
>>>>>>>>             if (name.equals(ADD_BUT)) {
>>>>>>>>               addBut = img_view.get(i);
>>>>>>>>             }
>>>>>>>>           }
>>>>>>>>        }
>>>>>>>>        Any idea what could be wrong?
>>>>>>>>        I'm testing given apk file.
>>>>>>>>        I'm using robotium 3.3 and Android 2.3.3 from Android-10 
platform
>>>>>>>>        from
>>>>>>>>        SDK [both configured in eclipse].
>>>>>>>>        Thank you for any hints!
>>>>>>>>        Vladimir

Original issue reported on code.google.com by vladimir...@qnective.com on 9 Aug 2012 at 12:00

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. Can you please try this scenario on the Jelly Bean 
emulator? Just to rule out that it is not  a device specific issue. 

Original comment by renasr...@gmail.com on 9 Aug 2012 at 12:11

GoogleCodeExporter commented 9 years ago
So I tried that with another Nexus S device [unfortunately I don't have any 
other available on 4.1] and issue persists
Then I tried that with 4.1 simulator and still the same

Original comment by vladimir...@qnective.com on 9 Aug 2012 at 2:33

GoogleCodeExporter commented 9 years ago
Can you send me a sample app that displays this behavior?

Original comment by renasr...@gmail.com on 9 Aug 2012 at 9:10

GoogleCodeExporter commented 9 years ago
unfortunately I cannot - I cannot share with you the application and it is out 
of my possibilities to create similar one :-(

On the other hand I can send you all information I can gather [like memory 
stack and so on...] - just let me know what exactly you need and how I can 
obtain them 

Original comment by vladimir...@qnective.com on 10 Aug 2012 at 7:17

GoogleCodeExporter commented 9 years ago
I will try to reproduce it my self with the applications that I have. Will get 
back to you if I am not able to successfully reproduce the issue. 

Original comment by renasr...@gmail.com on 10 Aug 2012 at 7:23

GoogleCodeExporter commented 9 years ago
Was not able to reproduce this issue with other applications. Will open up if a 
sample app can be provided that exhibits this issue. 

Original comment by renasr...@gmail.com on 11 Oct 2012 at 5:08

GoogleCodeExporter commented 9 years ago
I think I have the same problem, but with a different function.  When I use 
searchText("String") on a 2.3.3-4.0 device it works as expected, but when I run 
the same test on a 4.1 device I get the following error "Test run failed: 
Instrumentation run failed due to 'java.lang.IllegalStateException'" 

Is this caused by something in Robotium?  I havent seen anything different from 
4.0 to 4.1 android sdk that would cause this.

Original comment by JeffreyR...@gmail.com on 25 Oct 2012 at 3:54

GoogleCodeExporter commented 9 years ago
Can you please paste the stack trace?

Original comment by renasr...@gmail.com on 25 Oct 2012 at 3:55

GoogleCodeExporter commented 9 years ago
Just a note, this happens on 3.4.1 and 3.5.1 robotium versions (those are the 
two I have tested)

10-25 08:04:01.950: E/AndroidRuntime(15858): FATAL EXCEPTION: main
10-25 08:04:01.950: E/AndroidRuntime(15858): java.lang.IllegalStateException: 
Fragment LookFragment{4187f558} not attached to Activity
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
android.support.v4.app.Fragment.getResources(Fragment.java:551)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
android.support.v4.app.Fragment.getString(Fragment.java:573)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
com.digimarc.corvallis.lookmodestates.StartState$1.run(StartState.java:45)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
android.os.Handler.handleCallback(Handler.java:615)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
android.os.Handler.dispatchMessage(Handler.java:92)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
android.os.Looper.loop(Looper.java:137)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
android.app.ActivityThread.main(ActivityThread.java:4745)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
java.lang.reflect.Method.invokeNative(Native Method)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
java.lang.reflect.Method.invoke(Method.java:511)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-25 08:04:01.950: E/AndroidRuntime(15858):    at 
dalvik.system.NativeStart.main(Native Method)

Original comment by JeffreyR...@gmail.com on 25 Oct 2012 at 4:08

GoogleCodeExporter commented 9 years ago
Can you please test with robotium 3.3?
Den 25 okt 2012 18:08 skrev <robotium@googlecode.com>:

Original comment by renasr...@gmail.com on 25 Oct 2012 at 4:49

GoogleCodeExporter commented 9 years ago
It fails on 3.3 as well

Original comment by JeffreyR...@gmail.com on 25 Oct 2012 at 5:04

GoogleCodeExporter commented 9 years ago
It seems like anything that extends something from actionbarsherlock on 4.1 is 
the problem.  My preferences extend SherlockPreferenceActivity and my about 
screen extends SherlockActivity.  Is there anything I can provide to help?

Original comment by JeffreyR...@gmail.com on 25 Oct 2012 at 5:10

GoogleCodeExporter commented 9 years ago
I agree. Your issue is due to actionbarsherlock not being fully compatible with 
4.1.  

Original comment by renasr...@gmail.com on 26 Oct 2012 at 4:49