使用Browserstack的Nightwatch.js文档相当稀疏。我目前使用Javascript设置了自动化测试,并且测试设置为在Browserstack上运行。它循环浏览器并在不同的浏览器上重复运行测试,一次一个。如何使用Nightwatch.js在Browserstack中运行并行测试?
我认为我已正确设置了以下settings.json,但请告知我需要进行的更改。
此外,由于在webdriver或Browserstack的多个实例上运行测试的方法是从命令行运行:
nightwatch –e default,chrome
这是否意味着浏览器的选择仅限于浏览器名称?如果我的settings.json包含多个Firefox浏览器,每个浏览器都是不同的版本并在不同的操作系统上晒黑,该怎么办?
帮助表示赞赏。谢谢!
这是我的settings.json文件:
{
"src_folders" : ["tests/"],
"selenium" : {
"start_process" : false,
"host" : "hub.browserstack.com",
"port" : 80
},
"test_settings" : {
"default" : {
"launch_url" : "http://hub.browserstack.com",
"selenium_port" : 80,
"selenium_host" : "hub.browserstack.com",
"silent": true,
"screenshots" : {
"enabled" : true,
"path" : ""
},
"desiredCapabilities": {
"browserName": "Firefox",
"browser_version": "42.0",
"os": "Windows",
"os_version": "8.1",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "Chrome",
"browser_version": "46",
"os": "Windows",
"os_version": "10",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
},
"ie" : {
"desiredCapabilities" : {
"browserName": "internet explorer",
"browser_version": "10",
"os": "Windows",
"os_version": "8",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
}
}
答案 0 :(得分:2)
它只需要与“test_settings”链接。每次实例化新浏览器时,都需要传递Browserstack的设置。
{
"src_folders" : ["tests/"],
"selenium" : {
"start_process" : false,
"host" : "hub.browserstack.com",
"port" : 80
},
"test_settings" : {
"firefox" : {
"launch_url" : "http://hub.browserstack.com",
"selenium_port" : 80,
"selenium_host" : "hub.browserstack.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
},
"chrome" : {
"launch_url" : "http://hub.browserstack.com",
"selenium_port" : 80,
"selenium_host" : "hub.browserstack.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "Chrome",
"os": "Windows",
"browser_version": "46.0",
"os_version": "0",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
},
"safari" : {
"launch_url" : "http://hub.browserstack.com",
"selenium_port" : 80,
"selenium_host" : "hub.browserstack.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserstack.ie.enablePopups": true,
"browserName": "safari",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
},
"ie" : {
"launch_url" : "http://hub.browserstack.com",
"selenium_port" : 80,
"selenium_host" : "hub.browserstack.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserstack.ie.enablePopups": true,
"browserName": "internet explorer",
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserstack.user": "<username>",
"browserstack.key": "<access key>"
}
}
}
}