1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +00:00

workloads/chrome: Fix for tablet devices

Some tablet devices use an alternate tab switching method due to the
larger screen space. Add support for adding new tabs via the menu
instead of via the tab switcher.
This commit is contained in:
Marc Bonnici 2019-02-08 14:28:25 +00:00 committed by setrofim
parent 6ab1ae74a6
commit 1415f61e36
2 changed files with 16 additions and 6 deletions

View File

@ -81,12 +81,22 @@ public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface
// Activate the tab switcher
tabSwitcher = mDevice.findObject(new UiSelector().resourceId(packageID + "tab_switcher_button")
.className("android.widget.ImageButton"));
tabSwitcher.clickAndWaitForNewWindow(uiAutoTimeout);
// Click the New Tab button
newTab = mDevice.findObject(new UiSelector().resourceId(packageID + "new_tab_button")
.className("android.widget.Button"));
newTab.clickAndWaitForNewWindow(uiAutoTimeout);
if (tabSwitcher.exists()){
tabSwitcher.clickAndWaitForNewWindow(uiAutoTimeout);
// Click the New Tab button
newTab = mDevice.findObject(new UiSelector().resourceId(packageID + "new_tab_button")
.className("android.widget.Button"));
newTab.clickAndWaitForNewWindow(uiAutoTimeout);
}
// Support Tablet devices which do not have tab switcher
else {
UiObject menu_button = mDevice.findObject(new UiSelector().resourceId(packageID + "menu_button")
.className("android.widget.ImageButton"));
menu_button.click();
newTab = mDevice.findObject(new UiSelector().resourceId(packageID + "menu_item_text")
.textContains("New tab"));
newTab.click();
}
}
public void followTextLink(String text) throws Exception {