How do I test a mobile app update using Appium? - appium

Is it possible to automate the updating of an app using Appium?
My scenario is that I need to install an older version of the app and in my test I have to install the newest version.
But the desired capabilities for appium:app is defined as the latest app. I was thinking that I can override this desired capability to be an older version first? But, for now, I am still not sure how to execute this.
How should I go about testing this?

Using "app" capability install the old version.
Then, use driver.installApp() to install the newer version. This will upgrade the app by default.
Note that you might have to cast the driver to use the installApp() command.
For e.g. if you are initialising the driver like below,
AppiumDriver driver = new AndroidDriver():
Then, you may have to cast the driver like below:
((AndroidDriver) driver).installApp();
Similarly for iOS,
((IOSDriver) driver).installApp();
The Appium's project lead has created a very good article on this topic for Android. You can read about it here: https://appiumpro.com/editions/9-testing-android-app-upgrades

Related

Downgrading an MSIX-installer application after setting ForceUpdateFromAnyVersion

We have an application that we distribute internally on a network share with an MSIX package. We make the MSIX package with the MSIX project type in Visual Studio. Users install it with the index.html page that is created.
We want to rollback changes in case an update goes seriously wrong, so I've created an .appinstaller template and use it to set the ForceUpdateFromAnyVersion flag.
My question is how does a user actually perform a downgrade? I've tried to browse to an earlier version in Windows Explorer and execute the .msixbundle file, but it tells me that a newer version of the app is already installed and my only option is to launch the currently installed version.
I've only just discovered this ForceUpdateFromAnyVersion flag last week and we create weekly releases, so the version that has that flag set is the current version. Is that the reason downgrading doesn't work?
To perform a downgrade, place the appinstaller file on the share near the MSIX/MSIXBUNDLE and instruct the users to install the application via the appinstaller file (double click the appinstaller).
Only then the downgrade scenario will work. The msixbundle does not contain the ForceUpdateFromAnyVersion and it's not aware of it unless you use the appinstaller, that is why, when you try to downgrade via the msixbundle you receive the error that a new version is present on the machine.
What you must consider is this: if the user installed the MSIX/MSIXBUNDLE first, and then you publish the appinstaller file with the old version on your share, the downgrade will not happen automatically, because the MSIX on the user machine does not know that he has to check any share for updates/downgrades. All of the auto-update options are defined in the appinstaller.
But if your users installed the application via the appinstaller first, you can then put a new appinstaller file on your share (and MSIX/MSIXBUNDLE of course) which points to a lower version, and depending on how you defined the check interval in the appinstaller file, the downgrade will be performed automatically..
From what I read (I didn't test it) it seems that indeed the flag needs to be present in the appinstaller of the version that is checking for updates (not just in the new version). So, with the next update you should be able to push an downgrade.
Here is a more details tutorial from Microsoft on MSIX downgrades.

Cannot mount Developer Disk Image for iOS 13.6 using libimobiledevice

I'm trying to use the functionality of libimobiledevice on my iPad to do stuff like change location (idevicesetlocation) and etc. I have no problems if I install the Developer Disk Image using XCode, but as a primarily PC user, I would like to be able to use my program solely from my own computer. After trying the command ideviceimagemounter IMAGE_FILE IMAGE_SIGNATURE_FILE and using the files from https://github.com/mspvirajpatel/Xcode_Developer_Disk_Images/releases for the two files, I get these messages:
Mounting...
Error: mount_image returned -3
I've tried this with multiple different file sources and two different iOS devices with the same result. Any help would be appreciated, and let me know if I can clarify my question in any way, I've never really posted on here before. Thanks!
You're probably using an old version of libimobiledevice. The libimobiledevice team from time to time updates the codebase to maintain compatibility with new versions of libimobiledevice.
If you're on Windows, you can try to use the binaries from the libimobiledevice-win32 project which I maintain. The latest release is available at https://github.com/libimobiledevice-win32/imobiledevice-net/releases/tag/v1.3.6.

Is there a way to just apply changes in iOS simulator without rebuilding the whole app?

I'm asking because this is a feature of android studio and was wondering if xcode or an external thing had something similar?
Yes, there is:
https://apps.apple.com/app/injectioniii/id1380446739 or from here https://github.com/johnno1962/injectionforxcode Also, I think you can get it through Alcatraz too if you have it on your XCode
Also, another tip if you have not made any changes and just want to attach the debugger and run the app without building you can do: CMD+Control+R which will run the app instantly without building.
It's would be very useful feature for development, if the same would be possible with upcoming version.
But unfortunately, as of now, with current latest version of Xcode, it is not possible to apply source code changes without rebuilding an application.
Nice question, it deserves space in Apple Bug Reporter...

Does Firebreath support plugin updates in Internet Explorer once an instance is created without restarting?

Code snippet:
navigator.plugins.refresh(false);
var a = new ActiveXObject(collab.axName);
if (a) {
version = parseVersion(a.version);
}
I run something very similar to the above to check the version of my installed FB plugin. If it is out-of-date, I replace it with a newer version (Firebreath bog-standard Windows installer). However, if I run the snippet again, the newer version is not detected - the new ActiveX object has the old version number.
The ActiveX object creation seems to be the key - installing an update before creating an object will work correctly, and the update is detected if the browser is restarted. And updates work fine in NPAPI browser (which do version detection using navigator.plugins).
Internet Explorer 10, Windows 7.
My question:
Is this expected behavior (or indicative of a bug in my code)? If it is expected, is there is known workaround or alternate approach to accomplish the same goal of installing an update without restarting the browser (e.g., version detection without instantiation, forcing ActiveX update detection)?

Command line access to iOS app directory (sandbox) from Mac

I need to access the sandbox directory for an application installed on an iOS device, using the command line (non-gui) from a Mac or Linux. This is to help with development and testing automation. Dropping a json file into the sandbox lets me set parameters like extra debug messages and smaller refresh intervals.
A tool like iFunBox works perfectly but is graphical only, requiring numerous clicks to do this. Emails to the developers were unanswered. It also does not support AppleScript. I did find another app that provided a Fuse module, but it turned out buggy especially if the app was uninstalled and then reinstalled (in order to reset back to first time user experience). I reported the problems to the developer but there is no fix on the horizon.
The things I need to do are:
Test if an app with a specific bundle id is installed
Create Library/Caches/MYLIBNAME directory if it doesn't exist
Copy a ~100 byte json file from the Mac to that directory
Get a copy of that file
A solution that only works from Linux is acceptable too
Devices are not jailbroken and I would prefer not to need that as a requirement
In some cases I do not have the source code to the app since it is a third party using my library, so compiling different versions of the app isn't practical.
Answer is below in many comments thanks to lxt. Summary is:
Various libraries and programs associated with libimobiledevice can solve the problems
Use patched iFuse to mount an application sandbox
Use idevicesyslog to see the console log
Use ideviceinstaller to install/uninstall apps
The various libraries and programs associated with libimobiledevice are incredibly difficult if not impossible to compile as is on Linux or Mac, and there is no unified distribution of the source or binaries
For Ubuntu try libimobiledevice (may have 3 suffix), ideviceinstaller and libimobiledevice-utils packages
For Mac a search for libimobiledevice-macosx may get you some of the way there
This is going to be a little tricky, because as I think you've found out the application name is randomly generated on every install. I don't think there is a way past that, certainly that I know of. This explains the problems you're running into when simulating a new install (...the app directory name changes to a new, random hash, and then you're stuck).
Although my preference would be to access this config file in some other way (perhaps over a network, and have some code that only executes on debug/test builds check for it), if you did want to do this then I'd suggest trying something like writing a script that when you want to simulate a new install chooses the app directory that's most recently modified. But this is very hacky.
If you're not able to insert conditional code that only executes on debug/ test builds then I think the random app naming schema that iOS uses at a file system level is going to be problematic for you whatever approach you take.
Update: Regarding iFuse and libimobiledevice - out of the box it limits you to the documents directory. This is because the authors of iFuse don't entry-level users to be confused, and also because the structure is a little different depending on iOS version. You can comment out the lines in the iFuse source - fuse_opt_add_arg(&args, "-osubdir=Documents"); - to get access to the library directory through the mount. You will obviously need to re-compile iFuse yourself if doing this.
You can make use of MobileDevice Library
I know this is an old question and I doubt anyone is looking here anymore, but I thought I'd mention that you can use 'brew install libimobiledevice' to compile on the mac. There are a lot of dependencies and Homebrew really helps make it an easy process by installing them for you.

Resources