mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 20:11:20 +00:00
workloads/gfxbench: Fix using the correct scrollable element.
On smaller devices there can be multiple scrollable elements, ensure we scroll the correct one to identify tests.
This commit is contained in:
parent
83da20ce9f
commit
39121caf66
Binary file not shown.
@ -42,11 +42,14 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
public static String TAG = "UXPERF";
|
public static String TAG = "UXPERF";
|
||||||
protected Bundle parameters;
|
protected Bundle parameters;
|
||||||
protected String[] testList;
|
protected String[] testList;
|
||||||
|
protected String packageID;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void initialize(){
|
public void initialize(){
|
||||||
parameters = getParams();
|
parameters = getParams();
|
||||||
testList = parameters.getStringArray("tests");
|
testList = parameters.getStringArray("tests");
|
||||||
|
packageID = getPackageID(parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -56,7 +59,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
//Calculate the location of the test selection button
|
//Calculate the location of the test selection button
|
||||||
UiObject circle =
|
UiObject circle =
|
||||||
mDevice.findObject(new UiSelector().resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/main_circleControl")
|
mDevice.findObject(new UiSelector().resourceId(packageID + "main_circleControl")
|
||||||
.className("android.widget.RelativeLayout"));
|
.className("android.widget.RelativeLayout"));
|
||||||
Rect bounds = circle.getBounds();
|
Rect bounds = circle.getBounds();
|
||||||
int selectx = bounds.width()/4;
|
int selectx = bounds.width()/4;
|
||||||
@ -119,7 +122,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UiObject home =
|
UiObject home =
|
||||||
mDevice.findObject(new UiSelector().resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/main_homeBack")
|
mDevice.findObject(new UiSelector().resourceId(packageID + "main_homeBack")
|
||||||
.className("android.widget.LinearLayout"));
|
.className("android.widget.LinearLayout"));
|
||||||
home.waitForExists(300000);
|
home.waitForExists(300000);
|
||||||
}
|
}
|
||||||
@ -132,7 +135,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
//Wait for results
|
//Wait for results
|
||||||
UiObject complete =
|
UiObject complete =
|
||||||
mDevice.findObject(new UiSelector().resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/results_testList"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "results_testList"));
|
||||||
complete.waitForExists(1200000);
|
complete.waitForExists(1200000);
|
||||||
|
|
||||||
UiObject outOfmemory = mDevice.findObject(new UiSelector().text("OUT_OF_MEMORY"));
|
UiObject outOfmemory = mDevice.findObject(new UiSelector().text("OUT_OF_MEMORY"));
|
||||||
@ -149,19 +152,19 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
Boolean top_of_list = false;
|
Boolean top_of_list = false;
|
||||||
while(true) {
|
while(true) {
|
||||||
UiObject resultsList =
|
UiObject resultsList =
|
||||||
mDevice.findObject(new UiSelector().resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/results_testList"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "results_testList"));
|
||||||
// Find the element in the list that contains our test and pull result and sub_result
|
// Find the element in the list that contains our test and pull result and sub_result
|
||||||
for (int i=1; i < resultsList.getChildCount(); i++) {
|
for (int i=1; i < resultsList.getChildCount(); i++) {
|
||||||
UiObject testName = resultsList.getChild(new UiSelector().index(i))
|
UiObject testName = resultsList.getChild(new UiSelector().index(i))
|
||||||
.getChild(new UiSelector().resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/updated_result_item_name"));
|
.getChild(new UiSelector().resourceId(packageID + "updated_result_item_name"));
|
||||||
UiObject result = resultsList.getChild(new UiSelector()
|
UiObject result = resultsList.getChild(new UiSelector()
|
||||||
.index(i))
|
.index(i))
|
||||||
.getChild(new UiSelector()
|
.getChild(new UiSelector()
|
||||||
.resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/updated_result_item_result"));
|
.resourceId(packageID + "updated_result_item_result"));
|
||||||
UiObject subResult = resultsList.getChild(new UiSelector()
|
UiObject subResult = resultsList.getChild(new UiSelector()
|
||||||
.index(i))
|
.index(i))
|
||||||
.getChild(new UiSelector()
|
.getChild(new UiSelector()
|
||||||
.resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/updated_result_item_subresult"));
|
.resourceId(packageID + "updated_result_item_subresult"));
|
||||||
if (testName.waitForExists(500) && result.waitForExists(500) && subResult.waitForExists(500)) {
|
if (testName.waitForExists(500) && result.waitForExists(500) && subResult.waitForExists(500)) {
|
||||||
Log.d(TAG, "name: (" + testName.getText() + ") result: (" + result.getText() + ") sub_result: (" + subResult.getText() + ")");
|
Log.d(TAG, "name: (" + testName.getText() + ") result: (" + result.getText() + ") sub_result: (" + subResult.getText() + ")");
|
||||||
}
|
}
|
||||||
@ -175,7 +178,8 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void toggleTest(String testname) throws Exception {
|
public void toggleTest(String testname) throws Exception {
|
||||||
UiScrollable list = new UiScrollable(new UiSelector().scrollable(true));
|
UiScrollable list = new UiScrollable(new UiSelector().scrollable(true)
|
||||||
|
.resourceId(packageID + "main_testSelectListView"));
|
||||||
UiObject test =
|
UiObject test =
|
||||||
mDevice.findObject(new UiSelector().text(testname));
|
mDevice.findObject(new UiSelector().text(testname));
|
||||||
if (!test.exists() && list.waitForExists(60)) {
|
if (!test.exists() && list.waitForExists(60)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user