forked from upstream-mirrors/OpenTracks
Change some code in getButtonOnScreen() in EndToEndTestUtils.
This commit is contained in:
+14
-5
@@ -25,6 +25,7 @@ import android.app.Activity;
|
||||
import android.app.Instrumentation;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@@ -495,6 +496,7 @@ public class EndToEndTestUtils {
|
||||
SOLO.waitForText(buttonName);
|
||||
}
|
||||
|
||||
// Find on action bar.
|
||||
if (hasActionBar) {
|
||||
ArrayList<View> allViews = SOLO.getViews();
|
||||
for (View view : allViews) {
|
||||
@@ -509,11 +511,14 @@ public class EndToEndTestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<Button> currentButtons = SOLO.getCurrentButtons();
|
||||
for (Button oneButton : currentButtons) {
|
||||
String title = (String) oneButton.getText();
|
||||
if (title.equalsIgnoreCase(buttonName)) {
|
||||
button = oneButton;
|
||||
// Get all buttons and find.
|
||||
if(button == null) {
|
||||
ArrayList<Button> currentButtons = SOLO.getCurrentButtons();
|
||||
for (Button oneButton : currentButtons) {
|
||||
String title = (String) oneButton.getText();
|
||||
if (title.equalsIgnoreCase(buttonName)) {
|
||||
button = oneButton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,6 +526,10 @@ public class EndToEndTestUtils {
|
||||
SOLO.clickOnView(button);
|
||||
}
|
||||
|
||||
if (button == null && isClick) {
|
||||
Log.d(LOG_TAG, "Don't find the button " + buttonName);
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user