mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
skype: now hangs up at the end. Better duration handling
This commit is contained in:
parent
751970f991
commit
ae4ae3da5e
@ -40,19 +40,19 @@ class Skype(AndroidUxPerfWorkload):
|
||||
2. Log in to a pre-defined account
|
||||
3. Select a recipient from the Contacts list
|
||||
4. Initiate either a ``voice`` or ``video`` call for ``duration`` time (in seconds)
|
||||
Note: The actual duration of the call may not match exactly the intended duration
|
||||
due to the uiautomation overhead.
|
||||
|
||||
**Skype Setup**
|
||||
|
||||
- You should install Skype client from Google Play Store on the device
|
||||
(this was tested with client version 7.01.0.669; other recent versions
|
||||
should also work).
|
||||
- You must have a Skype account set up.
|
||||
- You must have a Skype account set up and its credentials passed
|
||||
as parameters into this workload
|
||||
- The contact to be called must be added (and has accepted) to the
|
||||
account. It's possible to have multiple contacts in the list, however
|
||||
the contact to be called *must* be visible on initial navigation to the
|
||||
list.
|
||||
- For video calls the contact must be able to received the call. This
|
||||
means that there must be a Skype client running (somewhere) with the
|
||||
means that there must be a Skype client running (somewhere) with the
|
||||
contact logged in and that client must have been configured to
|
||||
auto-accept calls from the account on the device (how to set this
|
||||
varies between different versions of Skype and between platforms --
|
||||
@ -72,7 +72,7 @@ class Skype(AndroidUxPerfWorkload):
|
||||
Parameter('contact_name', kind=str, default='Echo / Sound Test Service',
|
||||
description='This is the contact display name as it appears in the people list'),
|
||||
Parameter('duration', kind=int, default=10,
|
||||
description='This is the duration of the call in seconds'),
|
||||
description='This is the target duration of the call in seconds'),
|
||||
Parameter('action', kind=str, allowed_values=['voice', 'video'], default='voice',
|
||||
description='Action to take - either voice call (default) or video'),
|
||||
]
|
||||
|
Binary file not shown.
@ -67,9 +67,9 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
searchForContact(contactName);
|
||||
|
||||
if (ACTION_VOICE.equalsIgnoreCase(callType)) {
|
||||
voiceCallTest(callDuration);
|
||||
makeCall(callDuration, false);
|
||||
} else if (ACTION_VIDEO.equalsIgnoreCase(callType)) {
|
||||
videoCallTest(callDuration);
|
||||
makeCall(callDuration, true);
|
||||
}
|
||||
|
||||
removeWatcher("infoPopUpWatcher");
|
||||
@ -96,7 +96,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
UiObject updateNotice =
|
||||
new UiObject(new UiSelector().resourceId(packageID + "update_notice_dont_show_again"));
|
||||
//Detect if the update notice popup is present
|
||||
if (updateNotice.waitForExists(uiAutoTimeout)) {
|
||||
if (updateNotice.waitForExists(TimeUnit.SECONDS.toMillis(30))) {
|
||||
//Stop the notice from reappearing
|
||||
updateNotice.click();
|
||||
clickUiObject(BY_TEXT, "Continue", "android.widget.Button");
|
||||
@ -165,35 +165,58 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
return infoPopUpWatcher;
|
||||
}
|
||||
|
||||
private void voiceCallTest(int duration) throws Exception {
|
||||
String testTag = "call_voice";
|
||||
ActionLogger logger = new ActionLogger(testTag, parameters);
|
||||
|
||||
logger.start();
|
||||
makeCall(duration, false, testTag);
|
||||
logger.stop();
|
||||
}
|
||||
|
||||
private void videoCallTest(int duration) throws Exception {
|
||||
String testTag = "call_video";
|
||||
ActionLogger logger = new ActionLogger(testTag, parameters);
|
||||
|
||||
logger.start();
|
||||
makeCall(duration, true, testTag);
|
||||
logger.stop();
|
||||
}
|
||||
|
||||
private void makeCall(int duration, boolean video, String testTag) throws Exception {
|
||||
private void makeCall(int duration, boolean video) throws Exception {
|
||||
String testTag = video ? "video" : "voice";
|
||||
String description = video ? "Video call" : "Call options";
|
||||
|
||||
UiObject callButton =
|
||||
new UiObject(new UiSelector().descriptionContains(description));
|
||||
callButton.clickAndWaitForNewWindow();
|
||||
|
||||
UiObject muteButton =
|
||||
new UiObject(new UiSelector().descriptionContains("Mute"));
|
||||
muteButton.click();
|
||||
|
||||
sleep(duration);
|
||||
new UiObject(new UiSelector().descriptionContains("mute"));
|
||||
UiObject endButton =
|
||||
new UiObject(new UiSelector().descriptionContains("end"));
|
||||
|
||||
// Start the call and log how long that takes
|
||||
ActionLogger logger = new ActionLogger(testTag + "_start", parameters);
|
||||
logger.start();
|
||||
long target = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(duration);
|
||||
callButton.clickAndWaitForNewWindow();
|
||||
logger.stop();
|
||||
|
||||
// Wait for 'duration' seconds - attempt to mute while waiting
|
||||
logger = new ActionLogger(testTag + "_call", parameters);
|
||||
logger.start();
|
||||
boolean muted = false;
|
||||
while (System.currentTimeMillis() < target) {
|
||||
if (muted == true) {
|
||||
sleep(1);
|
||||
} else {
|
||||
muted = tryButton(muteButton, 500);
|
||||
}
|
||||
}
|
||||
logger.stop();
|
||||
|
||||
// Hang up the call and log how long that takes
|
||||
logger = new ActionLogger(testTag + "_stop", parameters);
|
||||
logger.start();
|
||||
tryButton(endButton, 500);
|
||||
logger.stop();
|
||||
}
|
||||
|
||||
private boolean tryButton(UiObject button, long timeout) throws Exception {
|
||||
if (button.waitForExists(timeout)) {
|
||||
button.click();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// The buttons could be hidden...
|
||||
// Tap screen to make them appear and look again
|
||||
tapDisplayCentre();
|
||||
if (button.waitForExists(timeout)) {
|
||||
button.click();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user