views:

40

answers:

2

Hi all,
I have a strange situation I can't explain myself.
The following code works well:
solo.sleep(1000);
assertTrue(solo.searchText("Banking"));


but the following code fails:
assertTrue(solo.waitForText("Banking", 1, 1000));

Can someone can explain me this?

Kind regards,
Alban.

+1  A: 

The problem is that '1000' in waitForText isn't setting a delay, it's setting how long to keep looking. If it doesn't find the text within that time, it returns false. See Robotium source

Try the second version like this and see if it doesn't work:

assertTrue(solo.waitForText("Banking", 1, 10000)); // Take up to 10 seconds

Also, the delay before the first one probably doesn't change anything. I think the first example would work just as well if it was only:

assertTrue(solo.searchText("Banking"));
kiswa
So... did I answer your question?
kiswa
A: 

Before robotium-1.7.1 there were some issues with searchText(). It was definetely not always finding the text even when it should. You might want to try again with simple code without timing.

pjv