Home » Android » angularjs – How to test native Android app with Protractor

angularjs – How to test native Android app with Protractor

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have native Android app, built with Ionic, so e2e tests are written with Protractor and works fine with hybrid version of application.
I’m trying to figure out, if it’s possible to run these tests against native app on Android device (or, at least, emulator/avd)?

I’ve tried Appium – no luck, it’s trying to run browser on device. I don’t need it.

Selendroid:
java -jar path-to-selendroid.jar -app path-to.apk
it executes, but when I start Protractor, it’s trying to run some AndroidDriver Webview App (with Selendroid logo) instead of my app, so all tests failing. Config of protractor:

seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl:         'http://10.0.2.2:8000',
capabilities:    {
    browserName: 'android'
},

Is it possible at all? Or best what I can hope is run mobile browser on device by Appium/Selendroid?

How to&Answers:

As you pointed, you want to test an Android native application. You would need to use other framework for testing native apps.

On the other way, Protractor “is an end-to-end test framework for AngularJS applications”. http://angular.github.io/protractor/#/

So, it runs on a browser. The browser could be on your PC with WebDriver on your phone with AndroidDriver. But never a native application.