使用量角器+ Appium + SauceLabs

编程入门 行业动态 更新时间:2024-10-26 14:34:22
本文介绍了使用量角器+ Appium + SauceLabs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在尝试使Mobile Pro的量角器测试自动化. 我已经阅读了网络上的大多数博客,并且达到了Saucelabs对Appium的官方"地位: docs.saucelabs/tutorials/appium/#mobile-web -应用程序 我在那里按照说明进行操作,并将我的config.js文件配置为此

I've been dealing to try to automate against Mobile my protractor tests. I've read most of the blogs around the web, I reached this one which is the "official" for Appium with Saucelabs: docs.saucelabs/tutorials/appium/#mobile-web-application I followed instructions there, and configured my config.js file as this

var testName = 'Testing'; //Change Project's name here in order to be identified in BrowserStack exports.config = { // The address of a running selenium server. seleniumAddress: 'bmsoko:[redacted]@ondemand.saucelabs:80/wd/hub', // Capabilities to be passed to the webdriver instance. multiCapabilities: [{ name: testName, 'appium-version': '1.4.0', 'browserName': 'Android', 'deviceName': 'Android Emulator', 'deviceOrientation': 'portrait', 'platform': 'Linux', 'version': '5.1', username: 'bmsoko', accessKey: '[redacted]' }], // Spec patterns are relative to the current working directly when // protractor is called. suites: { mobile: './././specs/mobile.js' }, // Maximum number of total browser sessions to run. Tests are queued in // sequence if number of browser sessions is limited by this parameter. // Use a number less than 1 to denote unlimited. Default is unlimited. maxSessions: 2, // protractor will save the test output in json format at this path. // The path is relative to the location of this config. resultJsonOutputFile: null, framework: 'jasmine2', // Options to be passed to Jasmine-node. jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 100000, realtimeFailure: true, showTiming: true, includeStackTrace: true, isVerbose: true, onComplete: null }, onPrepare: function () { //browser.driver.manage().window().maximize(); global.dvr = browser.driver; //variable to call selenium directly global.isAngularSite = function (flag) { browser.ignoreSynchronization = !flag; //This setup is to configure when testing non-angular pages }; browser.manage().timeouts().implicitlyWait(10000); browser.getCapabilities().then(function (cap) { browserName = cap.caps_.browserName; }); } };

这是我要在测试中尝试做的事情(我知道这不是一个很好的测试,我只是想测试Appium是否可以与我的有角度的应用一起使用.)

and here's what I'm trying to do in my test (I know its not a very good test, I just wanted to test Appium works with my angular app.):

it('User should see module 1s elements on the web page', function () { browser.sleep(6000); browser.driver.findElement(by.css('.play__video')); });

但是当我运行测试时,我不断收到android的错误消息:

But when I run my tests, I keep getting this error for android:

EDIT :我可以看到该网页正在打开.

EDIT: I can see that the web page is being opened.

堆栈: 错误:失败:{"message":"[$ injector:modulerr]由于以下原因,无法实例化模块p:\ n错误:[$ injector:nomod]模块'p'为 无法使用!您拼错了模块名称或忘记了加载 它.如果注册模块,请确保指定依赖项 作为第二 参数.\ nerrors.angularjs/1.3.14/$injector/nomod?p0 = p \ n 在 WEBAPPLICATION/assets/javascripts/global.js:107:21272\n 在 WEBAPPLICATIONs/assets/javascripts/global.js:107:29604\n 在t (WEBAPPLICATION/assets/javascripts/global.js:107:29176)\ n

Stack: Error: Failed: {"message":"[$injector:modulerr] Failed to instantiate module p due to:\nError: [$injector:nomod] Module 'p' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.\nerrors.angularjs/1.3.14/$injector/nomod?p0=p\n at WEBAPPLICATION/assets/javascripts/global.js:107:21272\n at WEBAPPLICATIONs/assets/javascripts/global.js:107:29604\n at t (WEBAPPLICATION/assets/javascripts/global.js:107:29176)\n

我也尝试过这种情况:

it('User should see module 1 s video start on the web page', function () { browser.wait(EC.visibilityOf(basePage.videoButtonModule1), 10000); basePage.videoButtonModule1.click(); expect(basePage.videoContainerModule1.isDisplayed()).toBeTruthy(); });

但是为此,我得到了上面的错误以及以下消息:

but for this I get the above error plus this message:

消息: 失败:等待量角器与页面同步时出错:"[ng:test]找不到元素参数为的注入器 getTestability \ nerrors.angularjs/1.3.14/ng/test"

Message: Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nerrors.angularjs/1.3.14/ng/test"

我在做什么错????请帮助pppp!

What am I doing wrong???? Please helppppp!!

编辑2 : 分享我在iOS中遇到的错误

EDIT 2: Sharing the error that I'm getting with iOS

新着陆页模块验证->用户应查看模块1 s 视频在网页上开始消息: 失败:在页面WEBAPP/上找不到Angular:angular 从未提供过resumeBootstrap堆栈: 错误:失败:在页面WEBAPP/上找不到Angular:angular 从未提供过简历 在/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:102:16 在[object Object] .promise.ControlFlow.runInFrame_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20) 在[object Object] .promise.Callback_.goog.defineClass.notify(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25) 在[object Object] .promise.Promise.notify_(/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)

New Landing page module verification --> User should see module 1 s video start on the web page Message: Failed: Angular could not be found on the page WEBAPP/ : angular never provided resumeBootstrap Stack: Error: Failed: Angular could not be found on the page WEBAPP/ : angular never provided resumeBootstrap at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:102:16 at [object Object].promise.ControlFlow.runInFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20) at [object Object].promise.Callback_.goog.defineClass.notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25) at [object Object].promise.Promise.notify_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)

推荐答案

我终于可以使它适用于我的测试,唯一在魔术贴上起作用的组合就是

I was able to finally make it work for my tests, the only combination that does the magic ONLY ON SAUCELABS is

multiCapabilities: [ { platformName: 'iOS', platformVersion: '7.1', browserName: '', app: 'safari', deviceName: 'iPhone Simulator', 'appium-version': "1.4.0", username: '<USERNAME>', accessKey: '<KEY>' } , { platformName: 'Android', platformVersion: '4.4', browserName: 'Browser', deviceName: 'Android Emulator', 'appium-version': "1.4.0", username: '<USERNAME>', accessKey: '<KEY>' } ],

至少对我的应用程序而言,其他组合而不是这些组合将不起作用.

Other combination rather than these won't work, at least for my app.

我已对量角器团队的原始问题发表了评论,希望他们能够回答.

I have placed a comment on my original issue for Protractor team hoping they'll answer it.

github/angular/protractor/issues/2247

更多推荐

使用量角器+ Appium + SauceLabs

本文发布于:2023-11-23 03:34:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619934.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:量角器   Appium   SauceLabs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!