I use nightwatch.js, mocha.js and selenium web driver for acceptance testing for now. And I need to skip some tests, how I can do it?
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()
}
}
So, how to skip one or more tests? Thank you for answers.
I use nightwatch.js, mocha.js and selenium web driver for acceptance testing for now. And I need to skip some tests, how I can do it?
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()
}
}
So, how to skip one or more tests? Thank you for answers.
Share Improve this question asked Jan 20, 2016 at 16:24 ArsenowitchArsenowitch 4015 silver badges22 bronze badges 3- Do you want to skip a test using mand line parameters, or by adding some code to the test case? – Jens Wegar Commented Feb 2, 2016 at 9:31
- @Jens Wegar, thank you, but I found the solution by adding mocha.js wrapper to my tests! – Arsenowitch Commented Feb 2, 2016 at 9:38
- Cool! Would be good if you can add your solution as an answer to this question and accept it, so it gets removed from the list of unanswered questions ;) – Jens Wegar Commented Feb 2, 2016 at 11:32
2 Answers
Reset to default 12Without using Mocha
or Grunt
. I am able to skip using:
Use
'@disabled': true,
like thisafter module.exports = { '@disabled': true,
it will will skip everything inside
module.exports = {
and print skip statement in console
Skip specific tests:
In your
.js
file if you have so many tests and you want to skip specific test, use''+
as prefix before testfunction
in your test, like this:'Test 1': '' + function (client) { }, 'Test 2': '' + function (client) { }, 'Test 3': function (client) { }
first two tests will be skipped and third will get executed. No skip statement will be printed.
You can just prefix function keyword with exclamation !
or some other valid character:
"User logs in the WebPortal": !function(browser) {
browser
.url(urlAdress)
...
.end()
},
Tests marked by this way will not executed.