Test for app closing with Calabash - ios

Our iOS app opens links in Safari. Is it possible to use a Calabash test to check that our app goes into the background when particular links are clicked?

No. Once the link is touched and Safari becomes the frontmost app, the cucumber processes loses connection with the calabash server and there is no way for calabash to interact with your app.

Related

How to check if an app is running in iOS device from a mac terminal

I am trying to launch ios app from python script/terminal using ios-deploy. This is a test app so it might crash and need to relaunch multiple times.
I want to check if this app is currently running or not on the connected device, for my relaunch logic to work. But I am kind of stuck here.
I know idevicesyslog which can capture logs and then parsing logs I can check if my app is currently running or not. But isn't there any sophisticated way to just check if an app is currently running or not in device. Xcode/instruments can get the list of processes via GUI in connected device but I want a command line utility so that I can take certain action.
You can check app or debug app using safari.
Open safari.
And If develop option not available on top navigation bar then open preferences of safari and in advance tab tick show develop option in below that screen.

Apple IOS Power Button linkage to activate an app

I am trying to develop an app which is targeted towards saving time and no. of clicks of a user.
Is there any way by which I can activate the installed app without unlocking the phone by using the power button?
No, thats not possible at all, not even close
The app can be opened when the user press on it, or if another app opens it using a schema.

Why my application is started automatically after install

I'm new to iOS programming.
Currently working on an Enterprise Application which is downloaded from the web and suppose to be activated with a URL schema.
When the download and install process is completed the application is started automatically by iOS without the URL schema and without the user activating the application.
At this stage the application is asking the user to activate it with a schema but this Alert is not being displayed, nighter the application main view.
Double click the home button display the splash screen of my application together with other running apps.
When the user press the registration link:
applicationWillEnterForeground is being called.
openURL is being called.
didFinishLaunchingWithOptions is NOT being called.
The application display the register with link (the alert that was not displayed earlier) and exit.
My questions:
Why my application is starting automatically?
[edit] Forgot to mention that this is a VOIP application so iOS gives us a chance to set up the connection.
How come the AlertView is not being displayed?
Is there a way to prevent it?
If there is no way to prevent it, is there a way to detect this state?
I'm using XCode 5 and iOS7 on iPhone 4 (but saw this behaviour on other devices as well).
Thanks,
Yaron

how to check whether a hybrid app is executing in background?

I have an oracle APEX app on ipad as hybrid ipad app built with html5,jquery and uses PhoneGap.
1.Now when I save details on one of the form page->page save process is executing
2.Lock my ipad without waiting to check whether details are saved or not OR goto home and browse through other apps.
3.When i again visit my app,I still see the page as loading.My app freezes.
4.Now I have to close my app and open it newly to check whether details entered are saved or not. This is bit annoying.
The details don't get saved.
What exactly happens to a running app when an ipad is locked OR when we move from running app to any other app?
Can we check if process is getting executed in background?
Can we capture this switch from running app to another OR ipad lock as a jquery/javascript event?
Can we relaunch an app after switch/lock interruption automatically?

iOS: How to debug "freshly launching" an app from a URL

When launching an app from a URL, there is a distinction between whether the URL is freshly launching an app, or if it's resuming an app that has been put into a suspended state.
My question is, how do I debug the process of a "fresh launch" from a URL? Hitting "Run" in Xcode automatically opens the app. Then, I have to suspend the app to reach Safari and access my test site. But if I close my suspended app, Xcode is no longer attached to it and I'm unable to debug.
These steps can be followed on the device. Founded at this link.
Run the app from Xcode to install it on your device and then stop it
from Xcode.
Force quit the app from the app switcher UI on the device.
Navigate to the scheme for the project in Xcode. Under the Run
section's Info tab, there is a radio button for "Wait for executable
to be launched". Make sure this is checked instead of the
"Automatically" option.
Run the app from Xcode. It will not open
on the device, but the debugger will wait for it to open and then it
will attach to it.
On the simulator as suggested by Marc-Alexandre Bérubé.
Run your app on the simulator.
Force quit the app on the simulator. Press cmd+shift+(hit h twice). Swipe the app up.
Open your terminal and enter this xcrun simctl openurl booted http://yourdomain/path.
You need to configure your Xcode app scheme to wait for the app to be launched manually.
Here is how you do it: http://blogmobile.itude.com/2013/09/03/how-to-debug-deep-linking-in-ios/.
You then need to copy the launch URL and paste it to Mobile Safari. This will launch your app, and make Xcode get attached to the running app process.
While the answers that mention activating "Wait for executable to be launched" are good in theory, for various reasons these didn't work for me. On the simulator, though Xcode claimed it had "attached", no logs or breakpoints were ever shown. On-device I was running iOS 13, building from Xcode 10, and using Xcode 11 to load, so I didn't have any debugging symbols. That was more of a personal problem, I suspect on device debugging may have worked.
What worked best for me was just opening up Console.app on my mac, and using the OSLog APIs to get a solid stream of caveman debugging from the simulator.
Run the app from Xcode on the simulator.
Then immediately quit it on the simulator via the app launched (Cmd-Shift-H * 2)
Launch the app by tapping a deep link I sent to myself via the Messages app
Observe my logs in Console.app
It's not pretty, but it is highly reliable.
It's also worth mentioning, that you can protect this useful feature by testing cold start deep-linking via XCUITest. You can call app.terminate in your XCUITests, then open a deep link (typically via a static web page you've setup, I use public GitHub wikis for this) and write tests and assert behaviors just like normal.

Resources