mosil / robotium

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

Problem with searchText method on two different devices (Samsung S4 / Samsung Note 2) #534

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'm running an unit test on Samsung S4 and it run correctly
2. I run the same test on Samsung Note 2 and it gives me some errors related to 
searchText method. The screens are the same.

I'm using the same version of the application under test and devices are 
samsung S4 (Model GT-I9505) with Android 4.2.2 and samsung note 2 (Model 
GT-N7100) with Android 4.1.2.

The code I try to run is very simple and is listed below:

public void test_001(){
    if(solo.searchText("HOME")){
        ArrayList<ImageView> views = solo.getCurrentViews(ImageView.class);
        solo.clickOnView(views.get(0));
//It doesn't work also If i use solo.clickOnText("Log out") and/or //boolean 
parameter about visibility
        solo.clickOnText(getLocalizedStringFromId("str_logout"));

        }
}

private String getLocalizedStringFromId(String stringId) {
        Activity act=solo.getCurrentActivity(); 
        String s = solo.getString(act.getResources().getIdentifier(stringId, "string", act.getPackageName()));
        return s;
}

Error reported is the following: 
junit.framework.AssertionFailedError: Text string: 'Log out' is not found!
at com.jayway.android.robotium.solo.Clicker.clickOnText(Clicker.java:381)
at com.jayway.android.robotium.solo.Solo.clickOnText(Solo.java:1022)
at com.MWalletTest.TestApk.setting_001(TestApk.java:189)
at com.MWalletTest.TestApk.test_001(TestApk.java:53)
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(ActivityInstrumentationTes
tCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:177)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
5)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1619)

It doesn't work on Note 2 even in these cases:
- I use solo.searchText("Log out");
- I use solo.searchText("Log out", false);
- I use solo.searchText("Log out", true);
- I use methods as sleep or wait before of calling methods.

Original issue reported on code.google.com by flavioca...@gmail.com on 15 Oct 2013 at 1:38

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. What does the log say? When searchText does not find 
a text string it will print to the log the ones that it did find. Do you see 
all the expected text view strings in there?

Original comment by renasr...@gmail.com on 18 Oct 2013 at 11:20

GoogleCodeExporter commented 9 years ago
Hi Renas, thank you for replying.

I just run the same script on two devices; when I run it on Samsung S4 it's ok 
when I run it on Samsung Note II it fails and the logcat error report with tag 
robotium is reported below; in the list from logcat I can't find the string I 
need to search and others that are on the screen too!

10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 
'COUPONS'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'HOME'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'DEALS'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: '3,00'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: '€ '
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'test 
coupon robotium flavio valore € 3'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'test 
coupon'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: '3,00'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: '€ '
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'test 
coupon robotium flavio valore € 3'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'test 
coupon'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'NEW'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 
'ACCEPTED'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 
'EXPIRING'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 
'NEAREST'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: 'Yet to 
implement!'
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''
10-18 14:42:04.930: D/Robotium(29707): 'Log out' not found. Have found: ''

Original comment by flavioca...@gmail.com on 18 Oct 2013 at 12:51

GoogleCodeExporter commented 9 years ago
Unfortunately there is nothing to do about this. Each Vendor has their own 
customisation of Android and sometimes they are not fully compatible with 
Robotium. 

Original comment by renasr...@gmail.com on 4 Nov 2013 at 4:34