diff --git a/mobile/android/base/tests/testBookmarksTab.java.in b/mobile/android/base/tests/testBookmarksTab.java.in index 81c811fd4f79..563ee4b745cf 100644 --- a/mobile/android/base/tests/testBookmarksTab.java.in +++ b/mobile/android/base/tests/testBookmarksTab.java.in @@ -59,9 +59,6 @@ public class testBookmarksTab extends BaseTest { View child; list = getBookmarksList(); - // Clear VKB so that list is not obscured - mActions.sendSpecialKey(Actions.SpecialKey.BACK); - mSolo.waitForText(url); mAsserter.ok(list != null, "checking that bookmarks list exists", list.toString()); @@ -107,8 +104,6 @@ public class testBookmarksTab extends BaseTest { private void testContextMenu(String url) { list = getBookmarksList(); - // Clear VKB so that list is not obscured - mActions.sendSpecialKey(Actions.SpecialKey.BACK); mSolo.waitForText(url); // wait for the bookmarks list to be populated diff --git a/mobile/android/base/tests/testHistoryTab.java.in b/mobile/android/base/tests/testHistoryTab.java.in index 07aef1c9df45..2ade9585d66e 100644 --- a/mobile/android/base/tests/testHistoryTab.java.in +++ b/mobile/android/base/tests/testHistoryTab.java.in @@ -61,8 +61,36 @@ public class testHistoryTab extends PixelTest { loadAndPaint(url); mActions.sendSpecialKey(Actions.SpecialKey.MENU); - mSolo.waitForText("Bookmark"); - mSolo.clickOnText("Bookmark"); + mSolo.waitForText("Settings"); + + // On ICS+ phones, there is no button labeled "Bookmarks" + // instead we have to just dig through every button on the screen + ArrayList images = mSolo.getCurrentViews(); + for (int i = 0; i < images.size(); i++) { + final View view = images.get(i); + boolean found = false; + found = "Bookmark".equals(view.getContentDescription()); + + // on older android versions, try looking at the button's text + if (!found) { + if (view instanceof TextView) { + found = "Bookmark".equals(((TextView)view).getText()); + } + } + + if (found) { + int[] xy = new int[2]; + view.getLocationOnScreen(xy); + + final int viewWidth = view.getWidth(); + final int viewHeight = view.getHeight(); + final float x = xy[0] + (viewWidth / 2.0f); + float y = xy[1] + (viewHeight / 2.0f); + + mSolo.clickOnScreen(x, y); + } + } + mAsserter.is(mSolo.waitForText("Bookmark added"), true, "bookmark added successfully"); testList(url); @@ -132,8 +160,6 @@ public class testHistoryTab extends PixelTest { private void testContextMenu(String url) { listview = getHistoryList(); - // clear VKB - mActions.sendSpecialKey(Actions.SpecialKey.BACK); mSolo.waitForText(url); // wait for the history list to be populated @@ -186,8 +212,7 @@ public class testHistoryTab extends PixelTest { private void testClick(String url) { listview = getHistoryList(); - // clear VKB - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.waitForText(url); View child = listview.getChildAt(0);