简体   繁体   中英

Appium/Protractor tests do not run on real device .APK

I am trying to use Protractor tests already working nice on PC to hybrid apps thanks to Appium. As you guess there is a failure that ruin the chain and no way to find help on google. This problem is quite hard because there is many software engaged so let me list them :

• Gulp (classic server that launch commands)

• Protractor (test language running over webdriver)

• Phonegap (compile website to app ex: .apk)

• Appium (intermediate server that control mobile device)

• Real device (debug-mode: on)

The process is almost working, I mean the apk is well installed, the application start and after 10 sec waiting, instead of starting the test, it crash/ignore the app. I present here two scenario because I am not sure which configuration is the good one for my setup. I leave the details under but in short: first case the app.apk is installed but ignored, and in the other apk start but crash (~3sec later)

Here is Gulp start command :

gulp.task('appium', ['webdriver_update'], function (cb) {
    return gulp.src(['packages/custom/*/public/tests/e2e/*.spec.js']).pipe(protractor({
        configFile: __dirname + '/../protractor.appium.conf.js',
        args: ['--baseUrl', 'http://10.56.160.74:3000'] //My Local IP: Website Port
    })).on('error', function (e) {
        console.log(e);
    });
});

Here is my Protractor/Appium config :

exports.config = {

    framework: 'jasmine2',
    seleniumAddress: 'http://localhost:4723/wd/hub',

    capabilities: {
        fullReset: true,
        browserName: 'android',
        deviceName: "Galaxy Note S3",
        platformName: "Android",
        platformVersion: "5.1.1",
        app: "C:/Projet/Spherea/appca/packages/custom/appca/public/apk/appca.apk",
        'app-package': 'com.spherea.appca',
        'app-captivity': 'MainActivity',
        autoWebview: true //<= On/Off change the scenario
    },

    onPrepare: function () {
        var wd = require('wd'),
            protractor = require('gulp-protractor').protractor,
            wdBridge = require('wd-bridge')(protractor, wd);
        wdBridge.initFromProtractor(exports.config);
    }
};

When autoWebview = true :

The application freeze at start, and after 10 sec of failing starting protractor tests, Appium give up and launch the browser and deal with test there, which is NOT what I need.

Error when autoWebview = false :

[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
[launcher] Error: UnknownError: Not yet implemented. Please help us: http://appium.io/get-involved.html
    at new bot.Error (C:\Projet\Spherea\appca\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (C:\Projet\Spherea\appca\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:
109:9)
    at C:\Projet\Spherea\appca\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
    at [object Object].promise.ControlFlow.runInFrame_ (C:/Projet/Spherea/appca/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/goog
/../webdriver/promise.js:1857:20)
    at [object Object].goog.defineClass.notify (C:/Projet/Spherea/appca/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webd
river/promise.js:2448:25)
    at [object Object].promise.Promise.notify_ (C:/Projet/Spherea/appca/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webd
river/promise.js:564:12)
    at Array.forEach (native)
    at [object Object].promise.Promise.notifyAll_ (C:/Projet/Spherea/appca/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../w
ebdriver/promise.js:553:15)
    at goog.async.run.processWorkQueue (C:\Projet\Spherea\appca\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:13
0:15)
    at runMicrotasksCallback (node.js:337:7)
[launcher] Process exited with error code 100

I hope someone can help me, I already wasted 10 days trying this and I'm now out of idea to solve this issue.

i have tried the same, conclusion is protractor with jasmine/cucumber has no support for native apps it only supports web automation for desktop & web & hybrid apps automation for mobile.

you can find the responses in below link https://github.com/angular/protractor/issues/1798 Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM