-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling done() in a step ends the whole test #444
Comments
I fixed the extra "Passed". The other problem is with your custom command. You must explicitly emit the "complete" event, like this: var util = require('util');
var events = require('events');
function Get () {}
util.inherits(Get, events.EventEmitter);
Get.prototype.command = function(path, success) {
var request = require("request");
request.get(this.launchUrl + path, function (error, response) {
if (error) {
console.log(error);
return;
}
success(response);
this.emit('complete');
}.bind(this));
};
module.exports = Get; |
Thanks. When I change my command to mirror the above, |
Try |
Yep that works thanks. |
@wheelsandcogs Have you managed to do this? What was the result? Thanks in advance! |
I'm trying to use the
done()
callback as my tests are using async code to make requests to a REST API. However, when I have more than one step, the test completes after the first call todone()
and exits the suite. It also seems to display✔ Passed
as soon as the test is started...nightwatch.json:
widget-test.js
_commands/post.js:
_commands/get.js:
The text was updated successfully, but these errors were encountered: