how to open recent app list panel via Monkeyrunner - monkeyrunner

for automation testing using monkeyrunner, i want to launch a app from recent app list panel, while the panel cannot be opened after long press HOME key via monkeyrunner command.
device.press('KEYCODE_HOME',MonkeyDevice.DOWN)
Monkeyrunner.sleep(5)
device.press('KEYCODE_HOME',MonkeyDevice.UP)
with the above code, the press is acted as a short press. And the panel can be opened after long pressing HOME key manually. is there some solution for this issue?
Thanks.

You can use the coordinates of the home button and simulate a long touch on those exact coordinates:
device.touch(x, y, MonkeyDevice.DOWN)
MonkeyRunner.sleep(3)
device.touch(x, y, MonkeyDevice.UP)
Where (x, y) are the coordinates of the home button. You can get these by going to the developer options and select pointer location and observe the coordinates as you touch the home button.
Also, there is a specific key event for app switching:
device.press(' KEYCODE_APP_SWITCH', MonkeyDevice.DOWN_AND_UP)
This should open the recent apps panel.

Related

Buffering a New url which is navigated on other page using tosca in run time

There is an website called X, When u click on the particular button from website X, it navigates in another tab with new url & i want to buffer that new url at run time. How to do in tosca?
I was able to successfully buffer a URL from IE. Here's how I did it.
First, I found this article on tricentis: https://support.tricentis.com/community/article.do?number=KB0015575
Following the instructions in that article, I scanned a new module for IE itself by selecting UIA during the scan (in the article). I captured the editbox of the URL bar as a module element.
Then, in a test case, I just used action-mode Buffer to read and store the URL into a buffer.

How to find which TVs are currently using my app?

I am developing an app for Android TV is it possible to know, on which TV my app is running or what action is performed on it?
Thank you.
To review your app's supported devices:
Sign in to your Play Console.
Select an app.
On the left menu, click
Release management > Device catalog. If you haven't already, review
and accept the Terms of Service.
Select the All, Supported, or
Excluded tabs. If you want to download a list of devices as a CSV
file, near the right side of the page, click Download device list.
For more infos:
https://support.google.com/googleplay/android-developer/answer/7353455
To track action performed on your app, you can use Fabric's Answers plug in.
Here is a sample code you'll need to add in your code to track events in Answers:
public void onKeyMetric() {
// TODO: Use your own string attributes to track common values over time
// TODO: Use your own number attributes to track median value over time
Answers.getInstance().logCustom(new CustomEvent("Video Played")
.putCustomAttribute("Category", "Comedy")
.putCustomAttribute("Length", 350));
}
For more infos:
https://fabric.io/kits/android/answers

Display direction route on WKInterfaceMap in WatchKit

In one of my watchKit application I need to show the route between two locations on the WKInterfaceMap. I searched for different links including Apple Developer Link. But I didn't find any way to display the route on the WKInterfaceMap.
Then, how the Uber watchKit App displays the route on the WKInterfaceMap? Is it the Map or an WKInterfaceImage/UIImage?
Below is the screenshot for the Uber App.
My guess is that they are be finding the route on the iOS app then passing it on to the watch in the form of a WKInerfaceImage
WKInterfacemap is non interactive map. If you just want to give the user driving directions, use below code where you can specify destination lat and long and open Map application on iWatch. It will launch Map application on iPhone, from there WatchOS will receive routing information.
let coordinate = CLLocationCoordinate2DMake( <ENTER DESTINATON LATITUDE>, <ENTER DESTINATON LONGITUDE>)
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate, add ressDictionary:nil))
mapItem.name = <DESTINATION NAME>
mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving])

Smartwatch Gear 2

I have developed an application getting data from the Gear2 accelorometer.
The devicemotion events are managed by a window event listener such as:
window.addEventListener('devicemotion', function(e) {
Ax = e.accelerationIncludingGravity.x / 9.8;
Ay = e.accelerationIncludingGravity.y / 9.8;
Az = e.accelerationIncludingGravity.z / 9.8;
});
I need to run the application in background even if the screen is switched off.
I adopted the power setup:
tizen.power.request("SCREEN", "SCREEN_NORMAL");
tizen.power.request('CPU', 'CPU_AWAKE');
The problem:
when the screen is switched off (by means of the Home button) the motion event associated to the window is not fired. I think that if the window is not active then the listener itself is not active.
Somebody has any idea how to get the accelometer data even if the screen is off?
Regards
V
Yes, you can still get the data when app is running in background on pressing the home key.
Please add this in your config.xml
<tizen:setting background-support="enable"/>
This will enable your app to collect data in background as well. :)

PostMessage interferes with user input

I'm trying to send key stroke to an external application in java using jna.
It sends VK_DOWN key, also that application has a shortcut for ctrl+down which makes something very different. My application sends around ~15 down key with 1 sec in between, and if user happens to click CTRL during it while working on a different window, it breaks the application(treats it as ctrl+down).
I checked the keyboard messages via Spy++, compared mine with AutoIt, they are exactly same messages.
ControlSend("window_title", "", "", "{DOWN}")
This AutoIt code works perfect, even if I click ctrl when window is active or inactive, it does not interfere with down key.
My code on the other hand:
User32.INSTANCE.PostMessage(handle, WM_KEYDOWN, wparam, lparamDown);
User32.INSTANCE.PostMessage(handle, WM_KEYUP, wparam, lparamUp);
has exactly same messages, but it doesn't work.
I tried sending control up before sending down key but to no avail.
Spy++ output:
<14335> 00011456 P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 ScanCode:50 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
<14336> 00011456 P WM_KEYUP nVirtKey:VK_DOWN cRepeat:1 ScanCode:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
My ctrl clicks are not even on target application so why does it treat it as such? Should I use a hook?

Resources