从量角器上特拉维斯运行在酱实验室测试端到端 [英] Running e2e tests on Sauce Labs from Protractor on Travis
问题描述
所以,我有我的开源项目( https://github.com/ahmednuaman/radian )和我有一些端到端细运行在本地使用量角器。
So I have my open source project (https://github.com/ahmednuaman/radian) and I have some e2e tests that run fine locally using Protractor.
我跟着酱实验室文档并成立了我的<一个href=\"https://github.com/ahmednuaman/radian/blob/feature-23-an/.travis.yml\"><$c$c>.travis.yml$c$c>因此。测试正确的地方量角器尝试连接到硒服务器上酱实验室点运行,这是错误的简短快照:
I've followed the Sauce Labs docs and set up my .travis.yml
accordingly. The tests run right to the point where Protractor tries to connect to selenium server on Sauce Labs, this is a brief snapshot of the error:
Running "exec:e2e" (exec) task
Using the selenium server at ahmednuaman-radian:06dd4e07-0f52-4fdf-be5e-389f2117bbf5@localhost:4445
>>
>> timers.js:103
>> if (!process.listeners('uncaughtException').length) throw e;
>> ^
>> TypeError: Cannot read property 'length' of undefined
>> at HttpClient.send (/home/travis/.nvm/v0.8.26/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:62:16)
下面是完整的作业日志:<一href=\"https://travis-ci.org/ahmednuaman/radian/jobs/16250460\">https://travis-ci.org/ahmednuaman/radian/jobs/16250460
所以,我做的下一件事就是尝试在本地效仿这一点。我阅读酱实验室连接文档并最终在我的终端跑这样的:
So the next thing I did was try to emulate this locally. I read the Sauce Labs Connect docs and eventually ran this in my terminal:
java -jar ~/bin/Sauce-Connect.jar USERNAME PASSWORD
一切都开始罚款,完全一样的特拉维斯但我然后跑我的咕噜E2E
任务(更新后的<一个href=\"https://github.com/ahmednuaman/radian/blob/feature-23-an/test/e2e/protractor.conf.coffee\"><$c$c>protractor.conf.coffee$c$c>匹配特拉维斯配置本地),并收到作为特拉维斯有同样的错误,这里是一个快照:
Everything started fine, exactly the same as on Travis but as I then ran my grunt e2e
task (after updating the protractor.conf.coffee
to match the Travis config locally) and recieved the same error as Travis had, here's a snapshot:
Running "exec:e2e" (exec) task
Using the selenium server at ahmednuaman-radian:06dd4e07-0f52-4fdf-be5e-389f2117bbf5@localhost:4445
>>
>> /Users/ahmed/bin/node/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1542
>> throw error;
>> ^
>> TypeError: Cannot read property 'length' of null
>> at HttpClient.send (/Users/ahmed/bin/node/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:62:16)
我有一个谷歌的周围,但我找不到任何人有这个问题。那么,是不是我的配置?它是一个量角器/ webdriver的问题?小心地阐明这个任何光线?
I had a google around but I couldn't find anyone else with this problem. So, is it my config? Is it a protractor/webdriver issue? Care to shed any light on this?
推荐答案
好了,所以之后重新阅读所有的文档,我再次发现我的 config.seleniumAddress
是不正确的,它缺少在最后的 / WD /集线器
路径;然后,我得到了一个新的错误:有人抱怨我的凭据。
Ok so after re-reading all the docs again I found that my config.seleniumAddress
was incorrect as it was missing the /wd/hub
path at the end; then I got a new error: it was complaining about my credentials.
在深入量角器的源代码后,我发现这个讲给,它基本上消灭所有的酱*
如果我指定 seleniumAddress
,所以我删除它从我的配置,再次试图和全权证书成功了! WOOP WOOP!下面是特拉维斯输出只是为了好玩:<一href=\"https://travis-ci.org/ahmednuaman/radian/jobs/16271613\">https://travis-ci.org/ahmednuaman/radian/jobs/16271613
After diving into Protractor's source I found this doozy, it basically wiped out all the sauce*
credentials if I specify a seleniumAddress
, so I removed it from my config, tried again and it worked! Woop woop! Here's the Travis output just for fun: https://travis-ci.org/ahmednuaman/radian/jobs/16271613
因此,要获得量角器在酱实验室运行通过Travis是使用这些配置选项的方式:
So the way to get Protractor to run on Sauce Labs via Travis is to use these config options:
config.sauceUser = process.env.SAUCE_USERNAME
config.sauceKey = process.env.SAUCE_ACCESS_KEY
config.capabilities =
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
'build': process.env.TRAVIS_BUILD_NUMBER
和不可以添加 seleniumAddress
。
这篇关于从量角器上特拉维斯运行在酱实验室测试端到端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!