Can you use Protractor and Appium together to test hybrid apps? - automated-tests

Here is my scenario. I have a website which is built on top of Angular JS. I am able to automate the website using protractor. However there are certain actions which when performed on website are reflected in Android and IOS devices.
Here's what I want to achieve.
Run my tests on website like I normally do but I want to fire commands to test the android and ios app also
/*
For eg:
1. Change password on website using protractor
2. Launch android app and check if the password has been changed
3. Switch back to protractor tests for website
*/
it('Change password and check on IOS and Android device' , function()
{
changePasswordOnWeb();
OpenMobileAppInDeviceUsingAppium();
checNewkPasswordOnMobileApp();
});
Is it possible? If it is can you point me to any of the tutorials?

To answer your question, yes you can integrate protractor and appium. Though as of now Protractor doesn't support appium officially, you can still make it possible with the below details. There is a help file that is available in Protractor docs. All you need to do is update your conf.js file to include the appium configurations and remember to start your appium server before you run the test script. Take care of below points -
Start your avd
Install the .apk file in your avd that you will be invoking through appium
Start the appium server using command - appium &
Update your protractor conf.js file to include appium android/chrome configurations. More details about configurations can be found in the below link.
Here's the link to more info on this - Protractor-Appium Setup . Hope this helps

It seems like you can use it
to test hybrid apps
This readme will help you to setup Protractor with Appium - Android/Chrome and Android/Safari. Here is video how-to. Maybe you should consider the SauceLabs option too.I think you can request iOS and Android devices by specifying the platform in the capabilities section of the config.
If you don't want to use SauceLabs you can look at using Selenium's Grid functionality. You can get Selenium drivers for iOS and Android and have them connect to a centralized Selenium server that your Protractor scenarios are ran against, you just change the seleniumAddress in your config file to point to the centralized server.

Related

xamarin.forms Android release build only works with fast deployment enabled

For the past days I had major issues with deploying the android version of my app. I found out that I am only ever able to get the app to work when "Fast Deployment" is checked. However, this means I can never archieve my app. If fast deploy is enabled, the app, even though it is in release mode, is treated like a DEBUG build and therefore not accepted in the playstore.
If i uncheck fast deploy for release builds the app starts and then idles, not doing the first rest call it is supposed to do. If I leave the rest calls out, the app again works.
How can this be correlated?
The symptom that it works when set "Fast Deployment" suggests this situation:
If you are testing a release build on a device that previously had a debug build, its possible that the debug version did not get fully uninstalled. Specifically, "Fast Deployment" stores the xamarin library as a separate DLL. Because your release build has the same "bundle id" as the debug build, Android can get confused.
To fix.
Best Fix for emulator:
Tools / Android Device Manager / Select virtual device / Edit / Clear to Factory Defaults.
Quickest fix for phone (but not sure if it helps):
Drag app to trash can.
Power down the phone. Power it back on.
Deploy release build to device. Either by installing apk, or by "Start Without Debugging" menu item.
Quick Fix:
Run debug version again on the device. This makes sure Android "knows" that the debug version of app is there.
Stop the app.
On the device, "uninstall" the app. (Drag it to trash can).
Deploy release build to device. Either by installing apk, or by "Start Without Debugging" menu item.
If that doesn't work, then use "adb uninstall":
Run debug version again on the device. This makes sure Android "knows" that the debug version of app is there.
Stop the app.
menu Tools / Android / Android Adb Command Prompt.
adb uninstall com.companyname.appname <-- substitute your app's bundle id
deploy release build to device.
It turnes out that turning ON my linker to link assemblies only actually decreased the app size AND made everything work again. Before, the linker was set to LINK NONE (which should've been the safer bet, but turned out to be an error...).

Appium: Starting an android app using an intent?

Does anyone know if it's possible to start an android app with appium using just the intentAction and URL as optionalIntentArguments? This is to test against an expo app in local dev mode running in the Expo client app; I am basically copying what the expo-cli does, but in appium/webdriver tests.
I can get it to work via adb directly (e.g. adb shell am start -a "android.intent.action.VIEW" -d "exp://127.0.0.1:19000" but I have to leave out the appPackage and appActivity, which are (I think!) mandatory with appium desktop app at least. I actually hacked in changing appium's validation to not require an appPackage and appActivity when the intent is provided, and then leave that out of the subsequent adb command, which works, but was wondering if there was an intended/official way to do it? I'm happy to PR what I have if not, but figured someone else might be trying to do the same thing.
(If anyone knows how to launch dev expo for iOS I am also currently trying to work that out!)
Thanks!

How to specify a timeout when using Firebase Test Lab through Android Studio

I started using the Firebase Test Lab web page to run instrumented tests of my new apps. One of the advanced settings is "Test Timeout", which is the point Firebase will kill a long running test.
I started to launch tests directly from Android Studio (3.1.1). In setting up tests with the run configuration editor, I can't seem to find the setting for Test Timeout. Am I missing something or is this feature not available when launching tests from AS.
There is currently no way to set a Test Lab timeout using the Android Studio UI. Please feel free to file a feature request for missing functionality like this.

Do I need two Provisioning Profiles?

I've got a Provisioning Profile for distribution com.mycomapnyname.myappname
Now I want to test my app in my iPad and I did all steps- Get certificate - Add my device - create an AppId - and finally create a Development Profile called My Applications (to sets all apps), so I've got a Distribution Profile and a development Profile.
The bundle identifier for distribution is com.mycomapnyname.myappname
The bundle identifier for developer is com.mycomapnyname.*
In Library Provisioning Profiles I've got both.
In Ipad Provisioning profile I've got just My Applications Profile
When I try to run it on my iPad I set in Targets - Build Settings:
Code Signing / Debug / Any iOS SDK = iPhone developer matching with My Applications
Code Signing / Distribution / Any iOS SDK = iPhone distribution identity
in Targets / Info:
Bundle identifier: com.mycomapnyname.myappname
Finally when I want to run my project (setting to run it on my iPad) I've got the error:
"A valid provisioning profile for this executable was not found."
It's a king of mess for me, can anyone help me to be able to run in on my device?
I run other app on my device, but following a tutorial and creating a new app, but I can't run my own app in my device for testing.
Thanks in advance ;-)
No you don't unless you like to setup wild cards for each app which is confusing.
Try this it may help. In xcode go to organizer and then select provisioning profile section. Try to refresh that. It will connect to Dev portal and download your current profiles. Then with your device connected try clicking on the name of the device and make sure your device gets detected by xcode. If it says use for developing click on that and it will also refresh the provisioning profile on your device. That should re sync everything. If this dies not work let me know and I'll get on my Mac and see how I can help you more.
Adrian

PhoneGap example app does not do anything

I built the PhoneGap 0.8.0 example project and then deployed it on my jailbroken iPhone.
I am using Xcode 3.2.1, and target set to "Device - 3.0 | Release"
However the PhoneGap app did not do anything, it could not get my iPhone information, and clicking the "watch accelerometer", "Get Location", etc, did not do anything.
The same thing happened if I run it on the iPhone simulator.
What have I missed?
Thanks
Not sure but you may want to try it with a "real" iPhone.
I've known some mobile api's and services to state that they will NOT work for jail-broken phones.
Depending on how complex your application, you may want to try using their "Build" service. It's worked wonders for me!
Write your code, test in a browser...
When you're ready to test on a phone, package it up (.zip) and upload to the build service.
Within seconds (sometimes longer) you'll have compiled applications available to download.
We use it all the time - much easier than setting up your development computer.
Check it out: PhoneGap Build

Resources