sangmingming / robotium

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

Robotium can't click on TextViews if dialog is opened multiple times #136

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In my app I have a ListView which can be filled through a dialog which contains 
another ListView with TextViews nested in LinearLayouts. By clicking on any of 
these TextViews they're added to the (main) List and the dialog is closed. But 
there's a strange issue where Robotium can't click on the TextViews if the 
dialog is opened multiple times:

What steps will reproduce the problem?

1. Open dialog
2. Click on TextView (item is added, dialog is closed)
3. Open dialog again
4. Attempt to click on TextView again --> Robotium can't "see" or click the 
TextView.

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

solo.clickOnText produces the following error trace:
junit.framework.AssertionFailedError: The text: Item 2 is not found!
at com.jayway.android.robotium.solo.Clicker.clickOnText(Clicker.java:282)
at com.jayway.android.robotium.solo.Solo.clickOnText(Solo.java:830)
at foo.bar.test.AddItemsTest.addItemClickOnText(AddItemsTest.java:68)
at foo.bar.test.AddItemsTest.testAddItemsClickOnText(AddItemsTest.java:74)
[...]

The text is clearly visible on the screen and running the app and manually 
clicking on the items works perfectly fine all the time.

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

Robotium 2.4. with both Android 2.1 and 2.2 on emulator and HTC Desire

Please provide any additional information below.

I've done a little debugging and traversed the ListView manually. Turns out the 
ListView contains all the TextViews (and I can access them too), but 
getCurrentTextViews doesn't return them all the second time the dialog is 
opened. When I traverse the ListView manually to get the View I want to click 
on and use solo.clickOnView nothing happens. No click, but no exception or 
failed assertion either.

I've created a (somewhat) minimal example of the problem and attached it. Just 
run the test project to see the problem.

Original issue reported on code.google.com by peter.tr...@gmail.com on 8 Aug 2011 at 12:51

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for this. The issue will be analyzed and if possible fixed before the 
next release.

Original comment by renasr...@gmail.com on 9 Aug 2011 at 5:36

GoogleCodeExporter commented 9 years ago

Original comment by renasr...@gmail.com on 9 Aug 2011 at 6:01

GoogleCodeExporter commented 9 years ago
Unfortunately this is a platform issue and not a bug in Robotium.

Original comment by renasr...@gmail.com on 31 Aug 2011 at 8:10