Bug 1233693 - AppMenuComponent: Search for views with exactly matching text. r=mcomella

--HG--
extra : commitid : 4IydKYGBjSa
extra : rebase_source : 59d68eb5e96b81c1fb27314417580b3954467a00
extra : amend_source : ae23760ca70eea7ccc0dd4fa44efcfa358b29acf
This commit is contained in:
Sebastian Kaspari 2015-12-18 13:08:58 +01:00
Родитель 7ec278bec3
Коммит 6afe554637
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -159,7 +159,7 @@ public class AppMenuComponent extends BaseComponent {
* This method is dependent on not having two views with equivalent contentDescription / text.
*/
private View findAppMenuItemView(String text) {
mSolo.waitForText(text, 1, MAX_WAITTIME_FOR_MENU_UPDATE_IN_MS);
mSolo.waitForText(String.format("^%s$", text), 1, MAX_WAITTIME_FOR_MENU_UPDATE_IN_MS);
final List<View> views = mSolo.getViews();
@ -298,7 +298,8 @@ public class AppMenuComponent extends BaseComponent {
private boolean isLegacyMoreMenuOpen() {
// Check if the first menu option is visible.
return mSolo.searchText(mSolo.getString(R.string.share), true);
final String shareTitle = mSolo.getString(R.string.share);
return mSolo.searchText(String.format("^%s$", shareTitle), true);
}
/**
@ -310,7 +311,7 @@ public class AppMenuComponent extends BaseComponent {
*/
private boolean isMenuOpen(String menuItemTitle) {
final View menuItemView = findAppMenuItemView(menuItemTitle);
return isMenuOpen(menuItemView) ? true : mSolo.searchText(menuItemTitle, true);
return isMenuOpen(menuItemView) ? true : mSolo.searchText(String.format("^%s$", menuItemTitle), true);
}
/**