简体   繁体   English

Appium / Protractor测试不能在真实设备上运行.APK

[英]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. 感谢Appium,我正在尝试使用Proractor测试已经在PC上运行良好的混合应用程序。 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) •Gulp(启动命令的经典服务器)

• Protractor (test language running over webdriver) •量角器(通过webdriver运行的测试语言)

• Phonegap (compile website to app ex: .apk) •Phonegap(将网站编译为app ex:.apk)

• Appium (intermediate server that control mobile device) •Appium(控制移动设备的中间服务器)

• 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. 这个过程几乎正常,我的意思是apk安装得很好,应用程序启动并等待10秒后,而不是启动测试,它会崩溃/忽略应用程序。 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) 我留下了详细信息,但简而言之:第一种情况是app.apk已安装但被忽略,而在另一种情况下apk开始但崩溃(约3秒后)

Here is Gulp start command : 这是Gulp启动命令:

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 : 这是我的Protractor / Appium配置:

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 : 当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. 应用程序在开始时冻结,在启动量角器测试失败10秒后,Appium放弃并启动浏览器并在那里处理测试,这不是我需要的。

Error when autoWebview = false : 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. 我希望有人可以帮助我,我已经浪费了10天尝试这个,我现在不想解决这个问题。

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 你可以在下面的链接中找到答案https://github.com/angular/protractor/issues/1798谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Appium在真实设备上从jenkins安装* .apk并运行用python编写的测试? - How can I install *.apk from jenkins on real device with Appium and run tests written in python? Appium / Protractor在真实设备上旋转屏幕 - Appium/Protractor rotate screen on real device 使用量角器和Appium在真实的Android设备上测试Ionic App - Testing Ionic App on real Android Device with Protractor and Appium 量角器的waitForAngular()在angular-webapp(真实设备上的appium / chrome)上失败 - Protractor's waitForAngular() fails on angular-webapp (appium/chrome on real device) 使用appium和selenium网格运行自动化测试只能在一台设备上运行 - Running automate tests with appium and selenium grid only run in one device APK未安装在Real Device中 - Apk Not installing in Real Device 每当我在Windows机器上运行测试时,如何防止appium重新安装apk - How to prevent appium from re-installing apk each time when i run tests on windows machine Appium + Protractor + Android设备错误超时 - Appium + Protractor + Android Device error timeout 使用appium和量角器在设备浏览器上并行执行 - parallel execution on device browser with appium and protractor 运行自动化测试Android 7.0版真实设备 - Run automation Tests for android version 7.0 real device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM