App switching in UI Automation - javascript

Is there a way to switch between applications using UI Automation in instruments?. And also to change wifi settings using the same? Any help will be greatly appreciated.

There is not currently a way to change connection settings. Although, technically if you are using the simulator you could launch an external script using UIAHost.performTaskWithPathArgumentsTimeout to change the host computers internet settings.
Switching between apps is also not possible for the reason that they don't want you controlling apps that aren't yours. However, if you own both apps I suppose it'd be possible to launch an external script to launch one app in instruments and once that test is over launch the second one. This would only work in some cases though.

Related

How to test E2E my Chrome extension - best practice

I have a chrome extension which I'd like to E2E test (simulate some basic user interactions).
Using Cypress, I was able to load my app but couldn't interact with it (i.e. go to the app url using the chrome-extension:// protocol).
Then I found out that Cypress (like many others testing frameworks) is not able to approach the chrome:// protcol, yet, as far as I get it, I need the chrome.runtime api to be included somehow for my app to behave as expected (e.g. interact with background page or use the local storage) and that can't be achived by simply clicking my popup.html file on the other hand.
I feel like I'm missing something here. How should I test my Chrome extension with ease? There must be some good practice for it, launching and treat it like a usual webpage.
Thanks
OK.
So after countless tryouts I've came to a conclusion that the best testing platform for browser extensions - offering a straight-forward way to load the extension (and also use the chrome:// protocol) is indeed - puppeteer (tried cypress and selenium as well)

JS, How can we open the desktop app from browser, like Zoom or Webex does

We all use Zoom or Webex to attend the meetings, then there is a popup that allows you to open the desktop app or you can continue on the web app. I want to implement a similar kind of user experience in my web application. But unable to understand how did they(zoom and Webex) did it.
I am not looking for a foolproof solution I just need to know the best approach to achieve it.
Update:
I am not doing it exactly like Zoom or Webex does. I have a button in my application so I am doing it onClick event.
In order to do this, you must register a protocol on your OS (ie. you can use protocol lib to register a specific one in an Electron app), this would allow your app to be called with simple URIs like myappprotocol://myappaction?myappparams
They make you install a client, that has caused many controversies since this is a gate for eventual security breaches
https://medium.com/bugbountywriteup/zoom-zero-day-4-million-webcams-maybe-an-rce-just-get-them-to-visit-your-website-ac75c83f4ef5

How launch external executable in uwp app

Here my problem, i create a couple mini game for windows 10 (PC, phone, Hololens UWP, ...), but now i would like to make a launcher to gather all my games, like steam (for example).
But, according to Microsoft, it's impossible to launch a .exe or even .msi from UWP app -> ("This API also imposes several restrictions on what types of files it can launch. Many file types that contain executable code, for example .exe, .msi, and .js files, are blocked from launching. This restriction protects users from potentially malicious files that could modify the system.
")
And now i search a solution, maybe with the Full​Trust​Process​Launcher Class but i dont know how its works :
https://learn.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher#Windows_ApplicationModel_FullTrustProcessLauncher_LaunchFullTrustProcessForCurrentAppAsync_System_String_
if you have an idea, a solution or even an exemple, I will be thankfull
Best regards
PS: sorry for the bad english, i'm french ^^
You can accomplish this by supporting a custom protocol in your games. Then your launcher app can launch them via that protocol by using the LaunchUriAsync API:
https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher#Windows_System_Launcher_LaunchUriAsync_Windows_Foundation_Uri_
Sorry, that is not going to work.
"Full​Trust​Process​Launcher Class
Activate the full-trust Win32 component of an application from a Universal Windows app component in the same application package."
In other words this is to run a Win32 component of the current application.
Since Microsoft wants UWP to be more secure, your best option is probably to bundle your games together in one bigger application. Have the start page / form be a menu of the games, then switch to another form for each game.
Name your classes, forms, resources carefully so you know what game they are for -- ChessMain, ChessForm, chess_logo.jpg; CheckersMain, CheckersForm, CheckersPlayerTurn.
I have a hack way that may help to launch the exe in uwp.
If you want to use the win32 dll that in other directory,please get the LoadLibrary that can use it.
You can use
MEMORY_BASIC_INFORMATION info = {};
if (VirtualQuery(VirtualQuery, &info, sizeof(info)))
{
auto kernelAddr = (HMODULE)info.AllocationBase;
auto loadlibraryPtr = GetProcAddress(kernelAddr, "LoadLibraryExW");
// load your library here ...
}
to get the loadlibrary and use to loadlibrary the dll.
See https://hjc.im/3-ways-to-bypass-wack/
Ms use the PE and P/Invoke to judge whether uwp use the not allowed dll.
So you can use the loadlibrary to load it.
You can launch the exe by win32.
But it may work today but it might break tomorrow.

Source visibility in ionic hybrid apps

I've just started learning ionic framework. It uses web browser capabilities for building apps.
These capabilities namely HTML, javascript and CSS are client side stuff. Which on browsers can be seen with view source.
My questions is how will be the visibility of the source? Will the end user be able to see the source of the app?
If yes, is it normal for any app? Shall one be worried about the security of the source?
The visibility of the source in chrome://inspect#device , is pretty much the whole application. And no, end user cannot see the source of your application once you set and push the project to production mode.
Well, since you are developing a hybrid application, there are of course, pros and cons for each. Security might not be as strong as native apps, but development time is greatly reduced to push the app to different platforms.
If you would to do something would requires high security and non-visibility of your source , then native is the way to go. As for hybrid apps,if you need somewhere to store your data securely, you will need plugins to communicate with native platform's secure storage which might pose a security risk. But then again, even native applications can be de-compiled. The way developers tries to make it harder is via obfuscation methods.
Once u set your application to production mode, you will not be able to inspect your application anymore.
To show your web-app on chrome://inspect/#devices :
1) Make sure your web-app is running and your phone is plugged into your computer via usb with USB debugging on and your PC is trusted by the phone.
2) Under device manager, you should not have missing phone drivers. (it would look something like this)
3) ADB should not be running co-currently. And you should be able to see something like this on ur inspect page:
4) Click on inspect button and you're done! (:
You have a signed apk, when you install it on a device and inspect the device on google chrome the inspect option will not be available. Theres an easy way to do that decompile the signed apk using apktools you will get the AndroidManifest.xml file. simply add android:debuggable="true" to the tag and recompile it resign it and you will be able to inspect it. If you check the main.js file in the inspect section the source code is visible.
Hence you can use Jscrambler to prevent this (Its a paid service i too am new to it)

Phonegap app working locally, not working on phone

I have written a phonegap application, and it performs a pretty simple task, it gets some JSON from a YQL link, and then displays it nicely to the user. This works excellently when I run it using Google Chrome on a Desktop, but, my client tells me that it does not work on his device which is Android 2.3. What can be going wrong? I'm using phonegap build to build to app, and they tell me that it is given internet permission, but, when my client puts the APK on the phone (its not on the market yet), does he need to do something special for it to access the internet?
Thanks a lot,
Dhaivat
in phonegap, allow external host : Open phonegap.plist -> external host and add your url or * to allow all
within the phonegap app the webapp runs under the file:// protocol - this might affect things.
you should test this at least on an emulator yourself - clients usually screw up anything some might screw up when testing ;) best would be to test on an actual device tho.
I'm not sure if this will help but I had a similar problem testing my app here:
https://stackoverflow.com/questions/17496104/json-wordpress-feed-not-appearing-in-android-studio-emulator-using-phonegap
I needed to change access origin to ="*"/ in my config.xml

Categories

Resources