【问题标题】:Multiple browser windows open automatically while testing with protractor使用量角器测试时自动打开多个浏览器窗口
【发布时间】:2015-10-26 16:42:12
【问题描述】:
最近我发现每当我运行量角器测试时,都会自动弹出多个 chrome 浏览器窗口。它们似乎类似于命令提示符窗口(click here for a screenshot),并在每个测试用例运行时打开。手动关闭窗口会导致测试失败。我没有对 protractor-conf.js 文件进行任何更改。任何人都可以提出解决方案吗?
【问题讨论】:
标签:
google-chrome
automated-tests
protractor
angularjs-e2e
e2e-testing
【解决方案1】:
多个窗口是 chromedriver 实例。通过完全重新安装环境(量角器、node.js、chromedriver.exe、jasmine、selenium)修复了该问题。
【解决方案2】:
您可以在配置文件中进行设置。 shardTestFiles 允许为您的测试套件运行多个浏览器实例,而 maxInstances 设置您要运行的浏览器数量。见下文。
capabilities: {
'browserName': (process.env.TEST_BROWSER_NAME || 'chrome'),
'version': (process.env.TEST_BROWSER_VERSION || 'ANY'),
//Allows tests to run in parallel
shardTestFiles: true,
//Max amount of browsers
maxInstances: 10
},