我的nightwatch.json文件中有以下配置
"saucelabsChrome": {
"selenium_host": "ondemand.saucelabs.com",
"selenium_port": 80,
"username": "example",
"access_key": "--REDACTED---",
"desiredCapabilities": {
"acceptsSslCerts": true,
"name": "chrome",
"browserName": "chrome",
"platform": "OS X 10.11",
"version": "45.0"
}
},
但是,当我用酱汁实验室运行夜班时
node nightwatch ---args '{"beta": "true", "env": "stage"}' --test tests/example.js -e saucelabsChrome
我收到错误
Couldn't find element signUpAdobe
两个问题
答案 0 :(得分:3)
以下是我的nightwatch.json文件示例,该文件配置为在Sauce Labs上运行并行测试。
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "custom_commands",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : false,
"server_path" : "",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "",
"webdriver.ie.driver" : ""
}
},
"test_workers" : {"enabled" : true, "workers" : "auto"},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 80,
"selenium_host" : "ondemand.saucelabs.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"username" : "${SAUCE_USERNAME}",
"access_key" : "${SAUCE_ACCESS_KEY}",
"desiredCapabilities": {
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome": {
"desiredCapabilities": {
"platform": "XP",
"browserName": "chrome",
"version": "41"
}
},
"firefox" : {
"desiredCapabilities": {
"platform": "XP",
"browserName": "firefox",
"version": "33"
}
},
"internet_explorer_10" : {
"desiredCapabilities": {
"platform": "Windows 7",
"browserName": "internet explorer",
"version": "10"
}
}
}
}
如果您想看一下整个项目的链接:
https://github.com/saucelabs-sample-test-frameworks/JS-Nightwatch.js
关于你的第二个问题。您可以在Sauce Labs仪表板中看到运行的测试。登录www.saucelabs.com并单击左上角的测试选项卡。
答案 1 :(得分:0)
我意识到已经有几年了,但是当我进行搜索时,我偶然发现了这篇文章,并找到了how to use SauceLabs with Nightwatch的新指南
希望这可以帮助像我一样结束此处的任何人:D