stephenwang1011 / robotium

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

Need a waitForTextToDismiss(text) method #308

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There are certain situations where the only visible indication that occurs is 
that the text disappears or changes after click.  

In my case it's a listview click that needs to register.  I need to wait for 
the text to change before completing the next operation (clicking the back 
button).  The back button is pressed so quickly after the previous clickOnText 
that the app doesn't have time to fully process the clickOnText, causing an 
incorrectly failed test.  So for now, I've stuck a sleep command in there.  

This would also work very well for dialogs (I saw how the waitForDialog to 
dismiss was implemented and it looks like it might have some reliability 
problems--it doesn't (can't?) actually look for the presence of a dialog, only 
a change in the view count.) 

What this waitForTextToDismiss could do is first wait for the text to appear, 
and then for the text to disappear.  

Original issue reported on code.google.com by glenview...@gmail.com on 9 Aug 2012 at 2:25

GoogleCodeExporter commented 9 years ago
You can use while(!solo.searchText()) with any searchText parameter to achieve 
what you want. 

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

GoogleCodeExporter commented 9 years ago
Right.  I would think this is a common enough use case to warrant its own 
readable method in Solo:

   void waitForNoText(String text ) {
      while (searchText(text)) {
         sleep(200);
      }
   }

Original comment by glenview...@gmail.com on 22 Aug 2012 at 5:46