mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-21 01:59:13 +00:00
Add save document function
This commit is contained in:
parent
b096c11ec9
commit
9c2b83881f
Binary file not shown.
@ -51,6 +51,8 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
public static final int DOCTYPE_TEMPLATE = 1;
|
public static final int DOCTYPE_TEMPLATE = 1;
|
||||||
public static final int DOCTYPE_PPT = 2;
|
public static final int DOCTYPE_PPT = 2;
|
||||||
public static final int DOCTYPE_SLIDES = 3;
|
public static final int DOCTYPE_SLIDES = 3;
|
||||||
|
public static final String DOC_FILENAME = "UX Perf Slides";
|
||||||
|
// public static final String DOC_FILENAME = "Untitled Presentation";
|
||||||
|
|
||||||
protected Map<String, Timer> results = new LinkedHashMap<String, Timer>();
|
protected Map<String, Timer> results = new LinkedHashMap<String, Timer>();
|
||||||
|
|
||||||
@ -77,15 +79,13 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
if (useLocalFiles) {
|
if (useLocalFiles) {
|
||||||
openFromStorage(documents[0]);
|
openFromStorage(documents[0]);
|
||||||
} else {
|
} else {
|
||||||
// createNewDoc(DOCTYPE_TEMPLATE);
|
// createNewDoc(DOCTYPE_TEMPLATE, DOC_FILENAME);
|
||||||
createNewDoc(DOCTYPE_PPT);
|
createNewDoc(DOCTYPE_PPT, DOC_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// toggleWifiState(false);
|
// toggleWifiState(false);
|
||||||
// tapDisplayNormalised(0.99, 0.99); // dismiss help overlay
|
// tapDisplayNormalised(0.99, 0.99); // dismiss help overlay
|
||||||
sleep(5);
|
deleteDocument(DOC_FILENAME);
|
||||||
getUiDevice().pressBack();
|
|
||||||
deleteDocument();
|
|
||||||
|
|
||||||
if (false) { // TODO currently unused
|
if (false) { // TODO currently unused
|
||||||
writeResultsToFile(results, parameters.getString("results_file"));
|
writeResultsToFile(results, parameters.getString("results_file"));
|
||||||
@ -124,7 +124,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createNewDoc(int docType) throws Exception {
|
protected void createNewDoc(int docType, String docName) throws Exception {
|
||||||
UiObject newButton = getUiObjectByDescription("New presentation", CLASS_IMAGE_BUTTON);
|
UiObject newButton = getUiObjectByDescription("New presentation", CLASS_IMAGE_BUTTON);
|
||||||
newButton.click();
|
newButton.click();
|
||||||
UiObject fromTemplate = getUiObjectByText("Choose template", CLASS_TEXT_VIEW);
|
UiObject fromTemplate = getUiObjectByText("Choose template", CLASS_TEXT_VIEW);
|
||||||
@ -133,6 +133,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
// UiObject newSlidesFile = getUiObjectByDescription("New Slides", CLASS_IMAGE_BUTTON);
|
// UiObject newSlidesFile = getUiObjectByDescription("New Slides", CLASS_IMAGE_BUTTON);
|
||||||
UiObject newPowerpoint = getUiObjectByText("New PowerPoint", CLASS_TEXT_VIEW);
|
UiObject newPowerpoint = getUiObjectByText("New PowerPoint", CLASS_TEXT_VIEW);
|
||||||
UiObject newSlidesFile = getUiObjectByText("New Slides", CLASS_TEXT_VIEW);
|
UiObject newSlidesFile = getUiObjectByText("New Slides", CLASS_TEXT_VIEW);
|
||||||
|
UiObject view;
|
||||||
|
|
||||||
switch (docType) {
|
switch (docType) {
|
||||||
case DOCTYPE_TEMPLATE:
|
case DOCTYPE_TEMPLATE:
|
||||||
@ -147,20 +148,18 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
newPowerpoint.clickAndWaitForNewWindow();
|
newPowerpoint.clickAndWaitForNewWindow();
|
||||||
enterTextInSlide("Title", "WORKLOAD AUTOMATION");
|
enterTextInSlide("Title", "WORKLOAD AUTOMATION");
|
||||||
enterTextInSlide("Subtitle", "Measuring perfomance of different productivity apps on Android OS");
|
enterTextInSlide("Subtitle", "Measuring perfomance of different productivity apps on Android OS");
|
||||||
UiObject view = getViewByDesc("Insert slide");
|
saveDocument(docName);
|
||||||
view.clickAndWaitForNewWindow();
|
insertSlide("Title and Content");
|
||||||
view = getViewByText("Title and Content");
|
|
||||||
view.clickAndWaitForNewWindow();
|
|
||||||
enterTextInSlide("title", "INTRODUCTION");
|
enterTextInSlide("title", "INTRODUCTION");
|
||||||
enterTextInSlide("Text placeholder", "Welcome to Documentation for Workload Automation");
|
enterTextInSlide("Text placeholder", "Welcome to Documentation for Workload Automation");
|
||||||
view = getViewByDesc("Undo");
|
view = getViewByDesc("Undo");
|
||||||
view.click();
|
view.click();
|
||||||
sleep(1);
|
|
||||||
enterTextInSlide("Text placeholder", "Workload Automation (WA) is a framework for running workloads on real hardware devices. "
|
enterTextInSlide("Text placeholder", "Workload Automation (WA) is a framework for running workloads on real hardware devices. "
|
||||||
+ "WA supports a number of output formats as well as additional instrumentation "
|
+ "WA supports a number of output formats as well as additional instrumentation "
|
||||||
+ "(such as Streamline traces). A number of workloads are included with the framework.");
|
+ "(such as Streamline traces). A number of workloads are included with the framework.");
|
||||||
view = getViewByDesc("Done");
|
// view = getViewByDesc("Done");
|
||||||
view.clickAndWaitForNewWindow();
|
// view = getViewByDesc("Navigate up");
|
||||||
|
// view.clickAndWaitForNewWindow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DOCTYPE_SLIDES:
|
case DOCTYPE_SLIDES:
|
||||||
@ -169,6 +168,33 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
getUiDevice().pressBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertSlide(String slideLayout) throws Exception {
|
||||||
|
UiObject view = getViewByDesc("Insert slide");
|
||||||
|
view.clickAndWaitForNewWindow();
|
||||||
|
view = getViewByText(slideLayout);
|
||||||
|
view.clickAndWaitForNewWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveDocument(String docName) throws Exception {
|
||||||
|
UiObject saveButton = getViewByText("SAVE");
|
||||||
|
saveButton.click();
|
||||||
|
saveButton = getViewByText("Save on Device");
|
||||||
|
saveButton.click();
|
||||||
|
UiObject filename = getViewById(PACKAGE_ID + "file_name_edit_text");
|
||||||
|
filename.clearTextField();
|
||||||
|
filename.setText(docName);
|
||||||
|
saveButton = getUiObjectByText("Save", CLASS_BUTTON);
|
||||||
|
saveButton.click();
|
||||||
|
// Overwrite if prompted
|
||||||
|
UiObject overwriteView = new UiObject(new UiSelector().textContains("already exists"));
|
||||||
|
if (overwriteView.waitForExists(1000)) {
|
||||||
|
saveButton = getViewByText("Overwrite");
|
||||||
|
saveButton.click();
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UiObject enterTextInSlide(String viewName, String textToEnter) throws Exception {
|
public UiObject enterTextInSlide(String viewName, String textToEnter) throws Exception {
|
||||||
@ -178,12 +204,13 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
view.click(); // double click
|
view.click(); // double click
|
||||||
view.setText(textToEnter);
|
view.setText(textToEnter);
|
||||||
getUiDevice().pressBack();
|
getUiDevice().pressBack();
|
||||||
|
sleep(1);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteDocument() throws Exception {
|
public void deleteDocument(String docName) throws Exception {
|
||||||
UiObject moreOptions = getUiObjectByResourceId(PACKAGE_ID + "more_actions_button", CLASS_IMAGE_BUTTON);
|
UiObject doc = getViewByText(docName);
|
||||||
moreOptions.click();
|
doc.longClick();
|
||||||
UiObject deleteButton = getUiObjectByText("Remove", CLASS_TEXT_VIEW);
|
UiObject deleteButton = getUiObjectByText("Remove", CLASS_TEXT_VIEW);
|
||||||
deleteButton.click();
|
deleteButton.click();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user