1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

Update googlemaps workload to work against most recent version

* Updated google maps workload to work against apk version 10.19.1
This commit is contained in:
Robert Freeman 2019-10-29 13:17:51 +00:00 committed by Marc Bonnici
parent e9839d52c4
commit f3e7b14b28
3 changed files with 20 additions and 1 deletions

View File

@ -37,7 +37,7 @@ class GoogleMaps(ApkUiautoWorkload):
should then be placed in the ``~/.workload_automation/dependencies/googlemaps`` directory on your should then be placed in the ``~/.workload_automation/dependencies/googlemaps`` directory on your
local machine, creating this if it does not already exist. local machine, creating this if it does not already exist.
Known working APK version: 9.72.2 Known working APK version: 10.19.1
''' '''
package_names = ['com.google.android.apps.maps'] package_names = ['com.google.android.apps.maps']

View File

@ -36,6 +36,9 @@ import org.junit.runner.RunWith;
import com.arm.wa.uiauto.BaseUiAutomation; import com.arm.wa.uiauto.BaseUiAutomation;
import static com.arm.wa.uiauto.BaseUiAutomation.Direction.DOWN;
import static com.arm.wa.uiauto.BaseUiAutomation.Direction.UP;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class UiAutomation extends BaseUiAutomation { public class UiAutomation extends BaseUiAutomation {
@ -66,6 +69,17 @@ public class UiAutomation extends BaseUiAutomation {
dismissLocationTutorial(); dismissLocationTutorial();
sleep(3); sleep(3);
/** On newer version the location info at bottom of screen interferes with swiping tests so remove by
swiping down. Check if new version by seeing if view switcher is present **/
UiObject viewSwitcher =
mDevice.findObject(new UiSelector().className("android.widget.ViewSwitcher"));
UiObject cambridgeTextView =
mDevice.findObject(new UiSelector().textContains("Cambridge"));
if(!viewSwitcher.exists()) { // Version 10.19.1
cambridgeTextView.dragTo(0,getDisplayHeight(), 40);
}
// Pinch to zoom, scroll around // Pinch to zoom, scroll around
UiObject mapContainer = mDevice.findObject(new UiSelector().resourceId(packageID + "mainmap_container")); UiObject mapContainer = mDevice.findObject(new UiSelector().resourceId(packageID + "mainmap_container"));
uiDeviceSwipeDown(100); uiDeviceSwipeDown(100);
@ -79,6 +93,11 @@ public class UiAutomation extends BaseUiAutomation {
uiObjectVertPinchOut(mapContainer, 100, 50); uiObjectVertPinchOut(mapContainer, 100, 50);
sleep(3); sleep(3);
// On newer versions swipe the location info tab back up
if(!viewSwitcher.exists()) { // Version 10.19.1
cambridgeTextView.dragTo(0, getDisplayCentreHeight(), 40);
}
// Get directions from Cambridge train station to Corpus Christi college // Get directions from Cambridge train station to Corpus Christi college
getDirectionsFromLocation(); getDirectionsFromLocation();
search("Corpus Christi, Cambridge, England", "directions_startpoint_textbox"); search("Corpus Christi, Cambridge, England", "directions_startpoint_textbox");