mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-07 13:41:24 +00:00
GooglePlayBooks: Add support for applaunch
This commit is contained in:
parent
247650141b
commit
0786c25db5
@ -48,7 +48,7 @@ class Googleplaybooks(ApkUiautoWorkload):
|
|||||||
Tip: Install the 'Google Opinion Rewards' app to bypass the need to enter valid
|
Tip: Install the 'Google Opinion Rewards' app to bypass the need to enter valid
|
||||||
card/bank detail.
|
card/bank detail.
|
||||||
|
|
||||||
Known working APK version: 3.13.17
|
Known working APK version: 3.15.5
|
||||||
'''
|
'''
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
|
Binary file not shown.
@ -28,7 +28,9 @@ import android.util.Log;
|
|||||||
import com.arm.wa.uiauto.UxPerfUiAutomation.GestureTestParams;
|
import com.arm.wa.uiauto.UxPerfUiAutomation.GestureTestParams;
|
||||||
import com.arm.wa.uiauto.UxPerfUiAutomation.GestureType;
|
import com.arm.wa.uiauto.UxPerfUiAutomation.GestureType;
|
||||||
import com.arm.wa.uiauto.BaseUiAutomation;
|
import com.arm.wa.uiauto.BaseUiAutomation;
|
||||||
|
import com.arm.wa.uiauto.ApplaunchInterface;
|
||||||
import com.arm.wa.uiauto.ActionLogger;
|
import com.arm.wa.uiauto.ActionLogger;
|
||||||
|
import com.arm.wa.uiauto.UiAutoUtils;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -46,7 +48,7 @@ import static com.arm.wa.uiauto.BaseUiAutomation.FindByCriteria.BY_TEXT;
|
|||||||
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class UiAutomation extends BaseUiAutomation {
|
public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface {
|
||||||
|
|
||||||
private int viewTimeoutSecs = 10;
|
private int viewTimeoutSecs = 10;
|
||||||
private long viewTimeout = TimeUnit.SECONDS.toMillis(viewTimeoutSecs);
|
private long viewTimeout = TimeUnit.SECONDS.toMillis(viewTimeoutSecs);
|
||||||
@ -77,7 +79,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
@Test
|
@Test
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
setScreenOrientation(ScreenOrientation.NATURAL);
|
setScreenOrientation(ScreenOrientation.NATURAL);
|
||||||
runApplicationInitialization();
|
runApplicationSetup();
|
||||||
|
|
||||||
searchForBook(searchBookTitle);
|
searchForBook(searchBookTitle);
|
||||||
addToLibrary();
|
addToLibrary();
|
||||||
@ -107,7 +109,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get application parameters and clear the initial run dialogues of the application launch.
|
// Get application parameters and clear the initial run dialogues of the application launch.
|
||||||
public void runApplicationInitialization() throws Exception {
|
public void runApplicationSetup() throws Exception {
|
||||||
String account = parameters.getString("account");
|
String account = parameters.getString("account");
|
||||||
chooseAccount(account);
|
chooseAccount(account);
|
||||||
clearFirstRunDialogues();
|
clearFirstRunDialogues();
|
||||||
@ -115,6 +117,27 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
dismissSync();
|
dismissSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the launch command for the application.
|
||||||
|
public String getLaunchCommand() {
|
||||||
|
String launch_command;
|
||||||
|
launch_command = UiAutoUtils.createLaunchCommand(parameters);
|
||||||
|
return launch_command;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass the workload parameters, used for applaunch
|
||||||
|
public void setWorkloadParameters(Bundle workload_parameters) {
|
||||||
|
parameters = workload_parameters;
|
||||||
|
packageID = getPackageID(parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the UiObject that marks the end of the application launch.
|
||||||
|
public UiObject getLaunchEndObject() {
|
||||||
|
UiObject launchEndObject = mDevice.findObject(new UiSelector()
|
||||||
|
.className("android.widget.TextView")
|
||||||
|
.textContains("Library"));
|
||||||
|
return launchEndObject;
|
||||||
|
}
|
||||||
|
|
||||||
// If the device has more than one account setup, a prompt appears
|
// If the device has more than one account setup, a prompt appears
|
||||||
// In this case, select the first account in the list, unless `account`
|
// In this case, select the first account in the list, unless `account`
|
||||||
// has been specified as a parameter, otherwise select `account`.
|
// has been specified as a parameter, otherwise select `account`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user