Ars*_*tch 6 javascript selenium nightwatch.js
我现在使用nightwatch.js,mocha.js和selenium web驱动程序进行验收测试.我需要跳过一些测试,我该怎么做?
module.exports = {
"User logs in the WebPortal": function(browser) {
browser
.url(urlAdress)
.setValue('input#login', user.login)
.setValue('input#password', user.password)
.click('button.ui-button')
.waitForElementPresent('a[href="/logout"]', middleTimer)
.getText('a[href="/logout"] span', function(result) {
(result.value).should.be.exactly("logout")
})
.end()
},
"User logs out": function(browser) {
browser
.url(urlAdress)
.setValue('input#login', user.login)
.setValue('input#password', user.password)
.click('button.ui-button')
.waitForElementPresent('a[href="/logout"]', middleTimer)
.click('a[href="/logout"]')
.waitForElementPresent('button.ui-button', middleTimer)
.getText('button.ui-button', function(result) {
(result.value).should.be.exactly("Login")
})
.end()
}
}
Run Code Online (Sandbox Code Playgroud)
那么,如何跳过一个或多个测试?谢谢你的回答.
不使用Mocha或Grunt.我可以跳过使用:
'@disabled': true,像这样使用
after module.exports = {
'@disabled': true,
Run Code Online (Sandbox Code Playgroud)
它会跳过里面的一切 module.exports = {
并在控制台中打印skip语句
跳过特定测试:
在您的.js文件中,如果您有太多测试但想要跳过特定测试,请''+在测试前使用前缀作为前缀function,如下所示:
'Test 1': '' + function (client) {
},
'Test 2': '' + function (client) {
},
'Test 3': function (client) {
}
Run Code Online (Sandbox Code Playgroud)
前两个测试将被跳过,第三个将被执行.不会打印任何跳过声明.