mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 07:04:17 +00:00 
			
		
		
		
	PeacekeeperWorkload: Updated to work with new APK versions
Updated peacekeeper UI automation to work with newer version of chrome and firefox.
This commit is contained in:
		| @@ -65,6 +65,10 @@ public class UiAutomation extends BaseUiAutomation { | ||||
|             UiObject addressBar = new UiObject(new UiSelector() | ||||
|                                   .className("android.widget.TextView") | ||||
|                                   .text("Enter Search or Address")); | ||||
|             if (!addressBar.exists()) { | ||||
|                 addressBar = new UiObject(new UiSelector() | ||||
|                              .resourceIdMatches(".*/url_bar_title")); | ||||
|             } | ||||
|             addressBar.click(); | ||||
|             UiObject setUrl = new UiObject(new UiSelector() | ||||
|                               .className("android.widget.EditText")); | ||||
| @@ -72,6 +76,13 @@ public class UiAutomation extends BaseUiAutomation { | ||||
|             setUrl.setText(peacekeeperUrl); | ||||
|             getUiDevice().pressEnter(); | ||||
|  | ||||
|             // Allow time for UI to update | ||||
|             sleep(1); | ||||
|  | ||||
|             if (!setUrl.exists()){ | ||||
|                 setUrl = addressBar; | ||||
|             } | ||||
|  | ||||
|             UiObject currentUrl = new UiObject(new UiSelector() | ||||
|                                .className("android.widget.TextView").index(1)); | ||||
|             for (int i = 0; i < TIMEOUT; i++) { | ||||
| @@ -88,19 +99,43 @@ public class UiAutomation extends BaseUiAutomation { | ||||
|             sleep(10); | ||||
|             } | ||||
|         } else if (browser.equals("chrome")) { // Code for Chrome browser | ||||
|             UiObject adressBar = new UiObject(new UiSelector() | ||||
|                                   .className("android.widget.EditText") | ||||
|                                   .description("Search or type url")); | ||||
|  | ||||
|             adressBar.clearTextField(); | ||||
|             adressBar.setText(peacekeeperUrl); | ||||
|             //Check for welcome screen and dismiss if present. | ||||
|             UiObject acceptTerms = new UiObject(new UiSelector() | ||||
|                                    .className("android.widget.Button") | ||||
|                                    .textContains("Accept & continue")); | ||||
|             if (acceptTerms.exists()){ | ||||
|                 acceptTerms.click(); | ||||
|                 UiObject dismiss = new UiObject(new UiSelector() | ||||
|                                    .className("android.widget.Button") | ||||
|                                    .resourceIdMatches(".*/negative_button")); | ||||
|                 if (dismiss.exists()){ | ||||
|                     dismiss.clickAndWaitForNewWindow(); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             UiObject addressBar = new UiObject(new UiSelector() | ||||
|                                   .className("android.widget.EditText") | ||||
|                                   .descriptionContains("Search or type url")); | ||||
|  | ||||
|             addressBar.clickAndWaitForNewWindow(); | ||||
|             addressBar.clearTextField(); | ||||
|             addressBar.setText(peacekeeperUrl); | ||||
|             getUiDevice().pressEnter(); | ||||
|  | ||||
|             // Allow time for UI to update | ||||
|             sleep(1); | ||||
|  | ||||
|             if (!addressBar.exists()){ | ||||
|                 addressBar = new UiObject(new UiSelector() | ||||
|                              .resourceIdMatches(".*/url_bar")); | ||||
|             } | ||||
|             for (int i = 0; i < TIMEOUT; i++) { | ||||
|  | ||||
|                 if (!adressBar.getText().contains("run.action")) { | ||||
|                 if (!addressBar.getText().contains("run.action")) { | ||||
|  | ||||
|                     // write url address to peacekeeper.txt file | ||||
|                     urlAddress = adressBar.getText(); | ||||
|                     urlAddress = addressBar.getText(); | ||||
|                     if (!urlAddress.contains("http")) | ||||
|                     urlAddress = "http://" + urlAddress; | ||||
|                     writer.println(urlAddress); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user