how to disable Push Notifications os popup on ios and avoid to launch app on main page - automation

I am doing automation using Appium and I came across 2 major problems.
How to dismiss SEND/PUSH Notifications popup on iOS which is system popup
If I install the application and uninstalled it and then again installed, It is launching the app with already user signed in. How can I avoid it to launch signed in instead of Showing on Sign in.
To cancel the PUSH Notification, I am using autoAcceptAlerts, which works but not always.

Though ideally uninstall and install shall not have leave the user logged in. But you can try this to logout the user after every relaunch, you can use ((AppiumDriver) driver).resetApp() for resetting the application so that it launches back with the login page.
For dismissing the alerts autoAcceptAlerts should work. Another way to tweak it is to use ((IOSDriver)driver).SwitchTo().Alert().Accept();. You can also try your hands on some methods mentioned here.

Related

Options for interacting with an alert for signing in through an in-app browser on iOS

We ran into a issue where, after adding a functionality for authentication through an in-app web browser, a new confirmation alert appears in the app, that cannot be targeted by Detox. This alert is at this moment seemingly impossible to handle, since there are no preferences that can be added at the setup of the test.
We actually bypass the entire authentication process once we get into the web browser, but we need to open it in order to call the service and validate that the user that tries to login has the necessary permissions. Also, mocking is not an option, since we use different users between the tests (for testing various feature flags) and that would mean rebuilding the release app for each separate user (at least, that's how I understand the mocking mechanism works). We also tried to tap by coordinates, but Detox validates that there is no system alert present before tapping, which is kind of ironic and funny considering what we are trying to do.
Are there any options for interacting with this popup?

Branchio Universal Deeplink redirecting to safari and shows popup to launch the application even app is installed in iOS 13.3.1

Even though the Application is installed in the iPhone, tapping Branchio universal deep-link redirecting to safari and shows a popup to launch the application.
Expected: if the application is already installed, tapping deep link should launch the application.
Pre- requests:
OS: iPhone iOS 13.3.1
Release build in Appcenter
Set custom URL to https://install.appcenter.ms/app (Appcenter)
Generate the Universal deeplink
Steps to reproduce:
Generate the Universal deep-link
Using the deep-link install the application
Again Tap on the same deep-link will redirect to Safari and popup alert with CANCEL and OPEN options
Tap OPEN in safari to launch the application
This is an expected behaviour where Apple prompts the user first time if to open the app. Only if universal links are implemented, it does not ask for the second time. Our AASA validator tool (https://branch.io/resources/aasa-validator/) shows the AASA file to validated correctly but while testing on the install page of your redirected website, it is showing a 404 error. So, we are unable to replicate this on our end to check further.
Could you please share your app store link so as to help us out here.
Also, would request to check our documentation here ( https://help.branch.io/developers-hub/docs/ios-troubleshooting#section-validate-if-aasa-file-successfully-downloaded ) so as to confirm if the device is receiving the generated AASA files. This is a known issue with Apple for iOS 13.x+ where the AASA files do not get ingested into the device and causes the link redirection to show a prompt or a fail.

How to test facebook login using react-native detox

How can I test if the login with facebook is working with detox e2e test?
I don't need to pass the full login process (should be greate but we can use mocking for that) but I only want to test if a tap on the login with facebook button will open the facebook login screen (or prompt the user to accept this)
The main reason for that is that due to a package update + iOS13 update, this button was not working anymore, this was a bug in the version of the FBSD we use.
As our tester don't test all app feature for each release, they don't check this button and don't see that it was broken before app release.
We want to detect this kind of failure before our user
Detox cannot interact or assert with web views and system alerts. Mock your code to display some text (instead of actually using the FBSDK), then verify the text is there.

Facebook messenger heads popup

In my application I'm trying to implement a popup which will be overlay on other applications. I did it by adding this permission SYSTEM_ALERT_WINDOW in the manifest. It works fine, but on Android 6 I know that I need to request on runtime a permission to "Draw over other apps".
I entered to this settings in my phone and saw that Facebook, Messenger, Skyoe and other apps are allowed to draw over other apps without asking this permission during the installation process (on android 6) and was wondering how can I do that? is targeting to sdk version below 22 will solved this? if so, is there another solution instead of targeting to a lower sdk version?
for example, I uninstalled the facebook messenger application, and install it again, just opened it without completing the registration process, then I opened the settings and clicked on "Draw over other apps" and it was automatically set to "Yes" means that the messneger app can draw over other applications.

How can iOS's Javascript UIAutomation be used to navigate a native app's oAuth process?

Context
Many native apps have the user authenticate with Facebook, rather than with their own authentication system. This has been problematic for me to write iOS UIAutomation testcases with the Javascript bindings. Our scenario, from the user's perspective, typically looks like this.
Scenario
The user clicks "Connect to Facebook".
The (target) applications moves to the background, and a Safari browser moves into the foreground, so the user can authenticate with oAuth.
The user enters their authentication data and submits.
The Safari browser window moves into the background, and the target application moves back into the foreground.
Problem
Before running tests, Instruments has the user set the "target app" in the top menu bar.
Using the Automation within Instruments proves problematic when the target app moves into the background and the Safari app moves into the foreground (Step #2). At this point, Instruments reports
The target application appears to have died
I thought this would be as simple as merely polling/testing for changes in UIATarget.localTarget().frontMostApp() (or something similar), but does not seem to be the case -- the test run stops executing.
How can I use Instruments to successfully test this scenario? Is this a testable scenario with UIAutomation's Javascript bindings?
Alas, this is not possible. Instruments loses it's connection with the app since the app freezes in the background and does not continue. Also, it's not possible to send touch events to Safari because UI Automation doesn't work with apps that you didn't build yourself.
If you're using a pre-built SDK, you're pretty much out of luck. But if you are rolling your own Oauth connection to them, you could present a modal view controller with a webview going to Facebook's Oauth authentication page instead of kicking the user all the way out to mobile Safari.
That way, the application never exits. You can then figure out the events to send to the webview and try testing this from there.