Skip to content

Commit 311808c

Browse files
renasjonasmaturana
authored andcommitted
Added waitForActivity(String name) with a default timeout of 20 seconds
1 parent cc3010d commit 311808c

File tree

1 file changed

+16
-3
lines changed
  • robotium-solo/src/main/java/com/jayway/android/robotium/solo

1 file changed

+16
-3
lines changed

robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class Solo {
8282
private final Waiter waiter;
8383
private final Setter setter;
8484
private final Instrumentation instrumentation;
85+
private final int TIMEOUT = 20000;
8586
public final static int LANDSCAPE = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; // 0
8687
public final static int PORTRAIT = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 1
8788
public final static int RIGHT = KeyEvent.KEYCODE_DPAD_RIGHT;
@@ -276,7 +277,7 @@ public boolean waitForText(String text, int minimumNumberOfMatches, long timeout
276277

277278
public <T extends View> boolean waitForView(final Class<T> viewClass){
278279

279-
return waiter.waitForView(viewClass, 0, 20000, true);
280+
return waiter.waitForView(viewClass, 0, TIMEOUT, true);
280281
}
281282

282283
/**
@@ -1825,14 +1826,26 @@ public void goBackToActivity(String name)
18251826
}
18261827

18271828
/**
1828-
* Waits for the given Activity.
1829+
* Waits for the given {@link Activity}. Default timeout is 20 seconds.
1830+
*
1831+
* @param name the name of the {@code Activity} to wait for e.g. {@code "MyActivity"}
1832+
* @return {@code true} if {@code Activity} appears before the timeout and {@code false} if it does not
1833+
*
1834+
*/
1835+
1836+
public boolean waitForActivity(String name){
1837+
return waiter.waitForActivity(name, TIMEOUT);
1838+
}
1839+
1840+
/**
1841+
* Waits for the given Activity.
18291842
*
18301843
* @param name the name of the {@link Activity} to wait for e.g. {@code "MyActivity"}
18311844
* @param timeout the amount of time in milliseconds to wait
18321845
* @return {@code true} if {@link Activity} appears before the timeout and {@code false} if it does not
18331846
*
18341847
*/
1835-
1848+
18361849
public boolean waitForActivity(String name, int timeout)
18371850
{
18381851
return waiter.waitForActivity(name, timeout);

0 commit comments

Comments
 (0)