Prevent Appium from launching application? - appium

I am testing canvas based web application and i have situation where i need to merge python UI automator based testing technique with Nightwatch's End to End testing. Since canvas based android application doesn't have locator id for some parts i need to test those using nightwatch feature. Nightwatch uses Appium and sets desired configuration for launch. So situation is i have written few steps with UI Automator Python and next step i call node command from python subprocess which causes same application to relaunch.
I want to avoid Appium relaunch somehow. EDIT : I am able to achieve it by setting autoLaunch False
Mechanism to completely avoid Appium and direct send client API on mobile application launched on phone and get response.

I am able to achieve it by setting autoLaunch False

Related

How to launch a non-background process from a Windows Service?

I have a Windows Service written in C# that launches an instance of the Google Chrome browser using PuppeteerSharp. See the launching code below:
string[] chromeArgs = { "--remote-debugging-port=9222" };
Browser browser = await Puppeteer.LaunchAsync(new LaunchOptions()
{
ExecutablePath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
DefaultViewport = null,
Args = chromeArgs,
Headless = false // <-- this is important!
});
Even though I am launching the browser in non-headless mode, I don't see the Chrome browser actually being launched on my machine. I have confirmation that the browser does actually get launched because I see it show up in Task Manager.
I suspect that the Chrome browser is not visible because it is being launched from a Windows service which is a background process, so Chrome is automatically being launched as a background process. Is it possible to launch Chrome as a non-background process so I can see it? And if so, how?
I suspect that the Chrome browser is not visible because it is being launched from a Windows service which is a background process, so Chrome is automatically being launched as a background process. Is it possible to launch Chrome as a non-background process so I can see it? And if so, how?
Win32 services run in a separate session from user-visible applications. Among other reasons, this prevents a security vulnerability known as a shatter attack. So it's not just on a different desktop; it's in a different desktop, which is in a different Windows station, which is in a different user session.
While there is a hack you can put in that allows displaying a UI from a Win32 service, that hack should not be used. It requires lowering the security of the entire system, additionally lowering the security of that service in particular, and may stop working with any future Windows Update.
The proper response to "how do I show a UI from a Win32 service" is "you don't". There are a couple of alternatives:
Do you really need a Win32 service? Perhaps it should just be a regular app that is auto-run on login? Usually, Win32 services are used because they can run without a login, but in that case, I'd have to ask where exactly would you show the UI if there's no user logged in? So first, consider whether your application should really be a Win32 service or not.
If you do really need a Win32 service, and you need to show a UI, then the proper architecture is to split the existing app into a Win32 service and a separate executable that runs on login. When the Win32 service wants to display a UI, it uses some form of inter-process communication to tell the autorun application to display the actual UI.
Note that with option (2), you'd also need to decide how to handle the situation where there are multiple logged-in users (e.g., Remote Desktop sessions), and determine which session you want to display the UI on.

Disable video recording on Amazon Device Farm tests

I'm trying to run some tests on a iOS app using Calabash and Amazon Device Farm. The tests run fine on the local simulator but when I try to execute them on the server it throws timeout exceptions.
I go to the tour screen failed: Timeout waiting for elements: * id: 'welcome_login_button' (Calabash::Cucumber::WaitHelpers::WaitError)
I think it may be a performance issue caused by the video recording so I want to know if there is a way to disable it in order to see if using this platform is viable for testing a large iOS app. The Amazon technical help on this subject doesn't include this information.
Thanks.
You can disable video recording by using the Device Farm CLI. Inside the test JSON object, there is an attribute for specifying key-value parameters. You can set the "video_recording" key to false.
Here is an example without any ARNs filled in:
aws devicefarm schedule-run --project-arn YourProjectArn --app-arn YourApplicationArn --device-pool-arn YourDevicePoolArn --name MyTestRun --test '{"type": "CALABASH","testPackageArn":"YourTestPackageArn","parameters": {"video_recording": "false"}}'
Related links: Schedule run CLI documentation
Cheers,
Michael

Modal Application

I'm using Xamarin.Android and I would like to build an application that start in modal way and don't close if you push the home button.
So this application need to be the only one application than a user can use on device.
Somebody can suggest how it can be done?
You best way to do is to make a "Launcher"/"Home" application. The Android SDK comes with a sample on how to do this.
You basically do this by adding your main Activity to the android.intent.category.HOME and android.intent.category.DEFAULT category and you set the launchMode to singleInstance.
This will register it as a Home application, then when you press your home button it should ask you to choose which launcher you want to use. You will have to set it once and it can be changed by the user.
You can find the sample in: android-sdk\samples\android-17\Home\src\com\example\android\home (should also be available in the other API samples).
You cant stop people from installing applications on android devices. You would have to build your own hardware for that however, you can override OnKeyTouch and check for the key being home.
You could build a service that checks the package of each running application and log which applications are run on the device to prevent users from using company property on other things. However, if android ever decides to kill your application the service should stop and this wont work.
Long story short what you are trying to do is flawed in its inception given the platform you are trying to do it on.

iOS UI Automation : toggle network settings during test execution time from within the tests

I need to test various alerts that comes when network disconnects at various points of test flows. So I need to disconnect iPad/simulator from network. Is there any way where we can toggle network settings during tests execution time from within the tests ?
I have searched and found it is not possible : Is it possible to disable the network in iOS Simulator?
But, the response here is old , wondering do we have some approach now ?
Using function performTaskWithPathArgumentsTimeout on UIAHost you can run any program on your computer (if you know the absolute path).
If you can write a program or script (e.g. using osascript) which will turn your internet connection off, then it's possible.
I am actually using this function to open a web page in the simulator which redirects to a link handled by my application, thus testing the behavior when the application is opened from the browser.

Communication Handling using Service in Blackberry 4.5

I am developing an app. (like google talk) which at phone boot-up starts a background service which is continuously running. This service interacts with UI (means any request to server is first sent from UI to service & from service to server) & any response is sent to UI through service.
What i know to start background service at boot up is "Create an alternate entry point and use that to start the background service. "
right click the project properties then go to Application tab, then check "Auto run on startup" / "System Module"
is it right?
In Android u can achieve this Service using system-defined Service class. How to achieve this in Blackberry 4.5? I want to do it (UI & Service) in one project.
Any solution?
Thanks for the reply.
I got a link for
"How To - Setup an alternate entry point for my application"
is it the right solution for starting Service?
I want the app. like email app. which will notify u when an incoming mail comes (like even though ur main application is minimized then also ur service is running in background which will continuously check for any incoming mail & will notify the main UI application through any app icon change)
So for this is there any class like Service class which will start at boot-up or "Setup an alternate entry point for my main UI application" is the only solution for this?
Thanks for the reply..
I read this GlobalEveltListener & tried for handling the communication between the 2 apps (Service app. & UI app.) by starting the Service at auto-startup.
I m using the "Persistent Store" & accessing it in both the apps. But the Persistent Store name should be unique otherwise it gives "Linker error: Cannot start the Service app. as Persistent Store is multiply defined." But I have to access the Persistent Store the both the apps to make some database calls.
So now i m trying for handling the Service by putting both apps in one project. So that the Persistent Store will be unique.
How to achieve this communication between Service & UI in one project?
You only need an alternate entry point if you want the program to behave in both the service mode, starting at boot and running in the background; and in application mode, having an icon in the home screen that the user can click to begin interacting with your software. In that case you need to have an entry point that tells the program "you are starting automatically at boot up", and one that tells the program "you are starting in response to user interaction".
There are other ways to handle this. If your application makes itself available to the user through ApplicationMenus, then you make the one and only entry point "Auto Run" and "System Module" so that it starts on boot, registers the menus and does not display an icon.
You can also use one entry point set to "Auto Run" but not a system module so the icon is displayed and detect the start on boot case using the ApplicationManager.inStartup() method.
The method you describe does work well for the type of application you are developing. It simplifies the initialization by allowing you to specify different arguments to the program in each entry point.
Please see the answer I have given earlier to a different question here. This essentially is an IPC mechanism between two running processes.

Resources