1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-22 10:38:37 +00:00

Vellamo: Updated to automatically generate PackageID

Now generates packageID instead of using hardcoded values and removed
unused reference to UxPerf.
This commit is contained in:
Marc Bonnici 2017-10-03 10:05:01 +01:00
parent 3b7af8e52c
commit 52b84b4030
2 changed files with 14 additions and 16 deletions

View File

@ -26,7 +26,6 @@ import android.support.test.uiautomator.UiWatcher;
import android.util.Log; import android.util.Log;
import com.arm.wa.uiauto.BaseUiAutomation; import com.arm.wa.uiauto.BaseUiAutomation;
import com.arm.wa.uiauto.UxPerfUiAutomation;
import org.junit.Test; import org.junit.Test;
import org.junit.Before; import org.junit.Before;
@ -42,19 +41,18 @@ public class UiAutomation extends BaseUiAutomation {
public static ArrayList<String> scores = new ArrayList(); public static ArrayList<String> scores = new ArrayList();
public static Boolean wasError = false; public static Boolean wasError = false;
protected UxPerfUiAutomation uxPerf; protected Bundle parameters;
protected String version;
Bundle parameters; protected Boolean browser;
String version; protected Boolean metal;
Boolean browser; protected Boolean multicore;
Boolean metal; protected Integer browserToUse;
Boolean multicore; protected String packageID;
Integer browserToUse;
@Before @Before
public void initialize(){ public void initialize(){
uxPerf = new UxPerfUiAutomation();
parameters = getParams(); parameters = getParams();
packageID = getPackageID(parameters);
version = parameters.getString("version"); version = parameters.getString("version");
browser = parameters.getBoolean("browser"); browser = parameters.getBoolean("browser");
metal = parameters.getBoolean("metal"); metal = parameters.getBoolean("metal");
@ -81,7 +79,7 @@ public class UiAutomation extends BaseUiAutomation {
startTest(); startTest();
dismissNetworkConnectionDialogIfNecessary(); dismissNetworkConnectionDialogIfNecessary();
dismissExplanationDialogIfNecessary(); dismissExplanationDialogIfNecessary();
waitForTestCompletion(15 * 60, "com.quicinc.vellamo:id/act_ba_results_btn_no"); waitForTestCompletion(15 * 60, packageID + "act_ba_results_btn_no");
} else { } else {
if (browser) { if (browser) {
startBrowserTest(browserToUse, version); startBrowserTest(browserToUse, version);
@ -166,7 +164,7 @@ public class UiAutomation extends BaseUiAutomation {
public void startTestV3(int run, String version) throws Exception { public void startTestV3(int run, String version) throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject thirdRunButton = mDevice.findObject(selector.resourceId("com.quicinc.vellamo:id/card_launcher_run_button").instance(2)); UiObject thirdRunButton = mDevice.findObject(selector.resourceId(packageID + "card_launcher_run_button").instance(2));
if (!thirdRunButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (!thirdRunButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!thirdRunButton.exists()) { if (!thirdRunButton.exists()) {
throw new UiObjectNotFoundException("Could not find three \"Run\" buttons."); throw new UiObjectNotFoundException("Could not find three \"Run\" buttons.");
@ -174,7 +172,7 @@ public class UiAutomation extends BaseUiAutomation {
} }
//Run benchmarks //Run benchmarks
UiObject runButton = mDevice.findObject(selector.resourceId("com.quicinc.vellamo:id/card_launcher_run_button").instance(run)); UiObject runButton = mDevice.findObject(selector.resourceId(packageID + "card_launcher_run_button").instance(run));
if (!runButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (!runButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!runButton.exists()) { if (!runButton.exists()) {
throw new UiObjectNotFoundException("Could not find correct \"Run\" button."); throw new UiObjectNotFoundException("Could not find correct \"Run\" button.");
@ -209,12 +207,12 @@ public class UiAutomation extends BaseUiAutomation {
} }
public void proccessTest(String metric) throws Exception{ public void proccessTest(String metric) throws Exception{
waitForTestCompletion(15 * 60, "com.quicinc.vellamo:id/button_no"); waitForTestCompletion(15 * 60, packageID + "button_no");
//Remove watcher //Remove watcher
mDevice.removeWatcher("stoppedWorkingDialogWatcher"); mDevice.removeWatcher("stoppedWorkingDialogWatcher");
getScore(metric, "com.quicinc.vellamo:id/card_score_score"); getScore(metric, packageID + "card_score_score");
mDevice.pressBack(); mDevice.pressBack();
mDevice.pressBack(); mDevice.pressBack();
mDevice.pressBack(); mDevice.pressBack();
@ -279,7 +277,7 @@ public class UiAutomation extends BaseUiAutomation {
public void dismissArrow() throws Exception { public void dismissArrow() throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject cardContainer = mDevice.findObject(selector.resourceId("com.quicinc.vellamo:id/cards_container")) ; UiObject cardContainer = mDevice.findObject(selector.resourceId(packageID + "cards_container")) ;
if (!cardContainer.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (!cardContainer.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!cardContainer.exists()) { if (!cardContainer.exists()) {
throw new UiObjectNotFoundException("Could not find vellamo main screen"); throw new UiObjectNotFoundException("Could not find vellamo main screen");