Add checks about the status of recording, pause and not in recording. Add method findTextView and sleep to help current and following tests.

This commit is contained in:
youtaol
2012-09-04 15:04:11 +08:00
parent 9505ba9a23
commit 7b025443c1
4 changed files with 117 additions and 27 deletions
@@ -726,13 +726,13 @@ public class EndToEndTestUtils {
}
/**
* Finds a text view with specified test in a view.
* Finds a displayed text view with specified text in a view.
*
* @param findText text to find
* @param parent which text view in in
* @return the text view, null means can not find it
*/
static TextView findTextView(String findText, View parent) {
static TextView findTextViewInView(String findText, View parent) {
ArrayList<TextView> textViews = SOLO.getCurrentTextViews(parent);
for (TextView textView : textViews) {
String text = (String) textView.getText();
@@ -742,6 +742,26 @@ public class EndToEndTestUtils {
}
return null;
}
/**
* Finds a displayed text view with specified text.
*
* @param findText text to find
* @return the text view, null means can not find it
*/
static TextView findTextView(String findText) {
ArrayList<View> allViews = SOLO.getViews();
for (View view : allViews) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
String text = (String) textView.getText();
if (textView.isShown() && text.endsWith(findText)) {
return textView;
}
}
}
return null;
}
/**
* Gets the ChartView.
@@ -788,5 +808,18 @@ public class EndToEndTestUtils {
imm.hideSoftInputFromWindow(editText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
SOLO.enterText(editText, text);
}
/**
* Waits n milliseconds.
*
* @param milliseconds time to sleep
*/
public static void sleep(long milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
Log.e(EndToEndTestUtils.LOG_TAG, "Unable to sleep " + milliseconds, e);
}
}
}