iOS | Always logged in at the start of every new test - ios

Not sure was this already asked here, but I could use help with an issue. I will provide any additional info if needed.
As said in the title, I would like to not be logged in after every test has been run, since I need to go through login test first. My colleague on Android just goes through her test, and does Driver.Quit/Dispose(); at the end, and she’s logged out for every other/next test after that.
On the other hand, for me (iOS), after I dispose of my driver - when the next test starts, I’m frequently (if not all the time) already logged in, and then I need to handle that case as well - and I’m trying to avoid it. I know that some login data is kept in the iOS keychain - and I can reproduce this issue manually with our app - if I uninstall the app, while being logged in - after I reinstall the app and start it - I’m already logged in.
Is there a way to handle this in a proper way? I’ve tried a lot of things, like actually logging out through the app, but that adds additional code, and makes it more complicated. Tried few additional capabilities - but nothing worked.

Note: It sounds like your app is keeping you logged in even with terminating/reinstalling the app. I would take a look closer and see if there's an issue attempting to log the user out when the app terminates or if there's a reason it's not coming to the login page after reinstalling.
I have code inside my iOS app that closes out the app if the app is terminated. And the below code works for me with appium as it terminates the app which also means it logs me out.
Try this to terminate your app:
const bundleId = "com.yourappsbundleid"
driver.terminateApp(bundleId)
Also note that appium's website provides more information and also ways to do this in other languages. See: https://appium.io/docs/en/commands/device/app/terminate-app/

Related

Flutter app stuck loading right after splash screen fades away

Has anybody had anything similar to this happen with a flutter app build? It works half of the time with log in credentials and when I try to use a different person it starts the loading screen and stays stuck there. I’m using firestore for the Authenticator and the database for the app.
I'm not sure what this means: "I’m using firestore for the Authenticator and the database for the app." I'm guessing you're just a bit new to firebase. Check out Net Ninja for some good starter material. You probably have logic issues in your app.
Figured it out. I was wanting to manually enter individuals login credentials from my Mac into firestorm but for some reason it wouldn't recognize it. Created a registration page within the app project and now everything works like it's suppose to.

iOS - Logout from Apple Store / Restore Device Programmatically

I'm automating test cases to run in several devices in parallel. I'm using Appium for this and this works fine. My issue is that I have some test cases that need the device to be logged into specific Apple Store accounts. Also, it is possible that the device might already be logged into another account and I don't have the option to logout manually. My test cases to log into an account if the device has no account attached to it already run well (inside my app I try to do an action that requires an Apple ID, the alert requiring login appears and I already automated the login process). The issue is when the device is already logged into another account.
My two options are:
Force the device to log out from Apple Store
Create a device backup without being logged and restore this backup before my test
I wasn't able to find a way to handle the first option. The second one works using idevicebackup2 (a lib from libimobiledevice). The issue here is that after restoring the device data, the setup wizard appear and there is no way to get rid of it automatically. I tried using cfgutils to remove the wizard steps, but even after removing all steps, the wizard appears just waiting for a confirmation after restoring.
I would like to know if there is a way to go for the first option, or a way to skip the setup wizard in the second option, or maybe a way to restore the backup partially (just clearing the Apple ID data) in order to avoid rebooting the device and getting stuck with the wizard again. Thanks in advance.
One option available now with Xcode 9 is the new multi-app testing. You can now call any app on the system based on it's bundle identifier XCUIApplication(bundleIdentifier: "com.MEGACORP.xyz") during a XCUI test. They cover the new API and examples in WWDC session 409 - What's New in Testing - it's worth watching the whole thing.
I've written some tests using the new API to switch out of the app under test and open System Settings to reset the app state during the test teardown. There's a list of all the system bundle ids in this question.
Your test would start with something like:
let store = XCUIApplication(bundleIdentifier: "com.apple.AppStore")
store.launch()

Parse iOS Facebook Login when in production

I implemented Facebook login a while ago in my app, using the Parse tutorial:
https://parse.com/tutorials/integrating-facebook-in-ios
It seemed to be working just fine, and I released my application to the app store. I then changed, on my Parse dashboard, the app from regular to "Production", and I was wondering if this could cause my Facebook login to stop working.
The actual error message on the phone, which occurs after a user presses the Login button, then after hitting accept for the basic facebook permissions, it brings up an error message:
Could it be the production switch, or is there something else wrong here?
I think there are just two things that should cause this error. First and most possible one is the one you thought of it, so switching to the production. And the second could be some similar setting on facebook developer site. You shoould check there if the settings there are in production environment. I know I dont give you anything specific but I'll for problem there if I'll have the same problem.

Destroying iOS application programmatically on failed login attempts

My client has come up with a strange requirement. He wants the iOS application to be deleted from the iPad/iPhone on 5 unsuccessful login attempts. I want to tell him that, its just NOT possible. Does anyone know any way of programmatically write a piece of code to self destruct an iOS app ?
At least on non-jailbroken devices this won't be possible. I mean, you can't even close an app without the user explicitly pressing the Home button. Also, the user could just re-download the app, rendering self-destruction moot.
You could - as is common in the Internet - just ban the client's IP or UDID for a while. Or store the number of login attempts on the device and refuse to let the user log in after too many attempts.
You can lock the user out of the application, and delete all of the cached data. But no, you can't erase it.
I suppose you could call abort() on every launch after 5 failed attempts, but I'm not sure you'll get through review if that happens.

Blackberry installation problem: users miss OK dialogs and the app ends up not being installed

We have a Blackberry app that is installed by users OTA. The install works fine as long as the user clicks OK on all of the dialog boxes that come up during the process.
However, if something else happens during installation (like a phone call or whatever), the user ends up never clicking the dialogs, so the app is never completely installed successfully.
Is there any way to force an installation process to re-show the dialogs if the user wanders away? Alternatively (or additionally), is there any way for an app to be aware that one or more components have not been installed successfully? Right now the app starts up but then spins forever, if everything has not been installed correctly.
Sorry if a lot of this doesn't make sense - I'm not a Blackberry developer, but I've been charged with investigating this problem generally.
If you can reproduce the problem on a device, dump the event log and take a look. If I had to guess, I'd say that the dialogs being skipped are permission-granting dialogs or maybe even firewall dialogs. If this is the case, you'll see various exceptions thrown by your app (i.e. ControlledAccessException). You can work around this by catching the exception and displaying a proper message informing them that they need to take some action (i.e. allow app in the firewall settings). If it's a case of needing additional application permissions, you can use the ApplicationPermissionsManager class to see what permissions your app has been granted, and to ask for additional permissions if required.

Resources