.url()调用后没有任何反应 [英] nothing happens after .url() calling
问题描述
我进行了以下夜间看守测试:
I have the following nightwatch test:
module.exports = {
'Set Initial Dataset' : function (browser) {
browser
.url('http://localhost/nightwatch/load-initial-dataset')
.end()
}
}
当我执行它时,将打开浏览器并加载url,但是当加载结束时,它不会关闭浏览器以开始下一个测试.
When I execute it the browser is opened and the url is loaded, but when the loading is ended it doesn't close the browser to begin the next test.
该测试在1个月前成功进行了...我将夜视仪更新为nigthwatch的最新版本(v0.9.8),下载了selenium-server-standalone-3.0.1.jar
,chromedriver 2.25和Chrome 54.0.2840.87
The test worked 1 month ago... I updated nightwatch to the nigthwatch latest version (v0.9.8), downloaded selenium-server-standalone-3.0.1.jar
, chromedriver 2.25 and Chrome 54.0.2840.87
我的Nigthwatch.js是
My Nigthwatch.js is
module.exports = {
src_folders: ['./tests'],
output_folder: './results',
selenium: {
start_process: true,
server_path: './selenium-server-standalone-3.0.1.jar',
log_path: './results',
host: '127.0.0.1',
port: 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./osx/chromedriver"
}
},
test_settings: {
default: {
waitForConditionPollInterval: 1,
selenium_host: '127.0.0.1',
selenium_port: 4444,
screenshots: {
enabled: true,
path: './results/screenshots'
},
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
};
I tried to launch this test and I have the same problem: https://github.com/nightwatchjs/nightwatch/blob/master/examples/tests/google.js (the browser stay opened at the url and nothing from the terminal)
当我使用野生动物园进行测试时,我没有什么特别的问题.
I have no particular problem when I ran my test with safari.
Thx
推荐答案
乍看起来,您的测试实际上并未执行任何断言,因此实际上并未对任何内容进行测试".这可能会使测试跑步者感到困惑.
From a first glance it looks like your test doesn't actually perform any assertions and thus doesn't actually 'test' for anything. This might be confusing the test runner.
我的另一个理论是waitForConditionPollInterval
设置太低. 1毫秒似乎有点矫kill过正.
My other theory is that the waitForConditionPollInterval
setting is too low. 1 millisecond seems a bit overkill.
从这里要做两件事:
- 在测试中执行实际的断言.例如,导航到页面后,请尝试此...
示例:
module.exports = {
'Set Initial Dataset' : function (browser) {
browser
.url('http://localhost/nightwatch/load-initial-dataset')
.assert.title('Some Title')
.end()
}
}
- 删除
waitForConditionPollInterval
设置,看看是否有帮助.如果是这样,请尝试将其设置为更合理一些的值,例如100ms,然后检查测试是否仍然挂起.
- Remove the
waitForConditionPollInterval
setting and see if that helps. If it does, try setting it to something a little more sane, like 100ms, and check if the test still hangs.
这篇关于.url()调用后没有任何反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!