量角器如何在Jenkins构建上启动Selenium服务器 [英] Protractor How do I Start the Selenium Server on a Jenkins Build
问题描述
某些背景
我一直在阅读有关在Jenkins服务器上运行的量角器测试的信息.关于如何在Jenkins Build上启动Selenium服务器,我仍然有些困惑.由于您需要先运行以下2条命令
I've been reading up about Protractor Tests running on a Jenkins Server. I'm still a little confused as to how you can start the selenium server on a Jenkins Build. Since you need to first run the following 2 commands
webdriver-manager update
webdriver-manager start
然后您需要运行适当的量角器命令
and then you need to run the appropriate protractor command
protractor conf.js
问题
一旦运行了前2个命令,您实际上需要使该命令窗口保持打开状态,以便服务器继续运行,在这种情况下,您如何调用量角器命令?因为您需要原始命令行才能继续运行
Once you've run the first 2 commands, you essentially need to leave that command window open for the server to continue to run, in such a case how are you able to call the protractor command? since you need the original command line to keep running
我希望有人找到了一种干净的方法.也许可以运行一个必备脚本?或以某种方式能够在服务器上启动多个命令行?
I was hoping someone has found a clean way of doing this. Maybe a pre-requisite script that runs? or somehow being able to kick off multiple command lines on the server?
我还在寻找一种方法,当测试完成执行时,您也可以退出命令Selenium Server Command Prompt,这将使整个过程更加简洁.
I was also looking for a way you could also quit the command Selenium Server Command Prompt when the tests are finished executing, this would make the whole process a lot more cleaner aswell.
推荐答案
如果从量角器conf.js
中删除seleniumAddress
,则量角器将自动启动硒.示例:
If you remove the seleniumAddress
from your protractor conf.js
, protractor will start the selenium automatically. Example:
在conf.js
上使用seleniumAddress
:
With the seleniumAddress
on the conf.js
:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [ 'spec.js' ]
};
移除conf.js
上的seleniumAddress
:
Removing the seleniumAddress
on the conf.js
:
exports.config = {
specs: [ 'spec.js' ]
};
现在,使用protractor conf.js
,量角器将根据需要自动启动硒服务器.
Now, using the protractor conf.js
, protractor will start the selenium server automatically as you need.
这篇关于量角器如何在Jenkins构建上启动Selenium服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!