Closed NickColley closed 10 years ago
not at the moment, sorry.
+1 to running nightwatch from mocha
Hi, I'm having trouble getting my mocha / nightwatch tests running ... I keep getting : describe is not defined when the test is picked up ... I'v added the test_runner : "test_runner": {"type": "mocha"} created a nightwatch runner script : #!/usr/bin/env node require('nightwatch/bin/runner.js'); and am running : ./nightwatch It just doesn't look like mocha is getting picked up ... Any ideas? /Stephen.
I managed to get this working by just using
"test_runner":"mocha"
instead of
"test_runner": {"type": "mocha"}
I am having the same problem, but I would like to use another reporter but when I add this to the config:
"test_runner" : {
"type" : "mocha",
"options" : {
"ui" : "tdd",
"reporter" : "nyan"
}
}
This setting is taken from the docs (except for 'nyan'), but it doesn't work. Only with:
"test_runner" : "mocha"
You're getting the error because you have "tdd"
as the "ui"
property. If you set it to bdd
it should work. Maybe I should also update the docs.
ahh ok, will try it out. Cheers, Stephen.
On 27 Oct 2015, at 15:54, Andrei Rusu notifications@github.com wrote:
You're getting the error because you have "tdd" as the "ui" property. If you set it to bdd it should work. Maybe I should also update the docs.
— Reply to this email directly or view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/234#issuecomment-151529060.
This works perfectly. Thanks! But yes please update the docs then as the example there doesn't work.
I have the same problem. I have no idea what is wrong as everything seems exactly the same as in the docs.
My config looks like:
require("babel-core/register")
module.exports = (() => {
return {
"src_folders" : ["test/e2e"],
"selenium" : {
"start_process" : false,
"server_path" : "",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost:8000",
"test_runner" : {
"type" : "mocha",
"options" : {
"ui" : "bdd",
"reporter" : "spec"
}
}
}
}
}
})()
Yet I can't run my tests receiving ReferenceError: describe is not defined
all the time. I'm using sample test from docs:
describe('Google demo test for Mocha', function() {
describe('with Nightwatch', function() {
before(function(client, done) {
done();
});
after(function(client, done) {
client.end(function() {
done();
});
});
afterEach(function(client, done) {
done();
});
beforeEach(function(client, done) {
done();
});
it('uses BDD to run the Google simple test', function(client) {
client
.url('http://google.com')
.expect.element('body').to.be.present.before(1000);
client.setValue('input[type=text]', ['nightwatch', client.Keys.ENTER])
.pause(1000)
.assert.containsText('#main', 'Night Watch');
});
});
});
@LKay
I got a same problems with you and then i tried
"test_settings": {
"default": {
"launch_url": "",
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
},
"test_runner" : "mocha"
and it works well.
I have tried all suggestions in this ticket and still not having any luck trying to use mocha, describe is not defined when running nightwatch path/to/test within cli
Is there anyway I use Mocha to structure my nightwatch tests? :)