tacoss / grunt-nightwatch

Run your Nightwatch.js tests with Grunt
50 stars 22 forks source link

Strange Hang only when using grunt task #17

Closed ghost closed 10 years ago

ghost commented 10 years ago

Dont know how to explain this one. I implemented a custom command that returns true or false depending on a condition on the page, then executes different assertions depending on the result. It works fine when executing nightwatch but not using the grunt task, it just hangs forever after the conditional and before the assertions start.

"Do some conditional tests" : function (browser) {

    browser.CheckThing(function(result) {

        if (result === "Thing Exists") {
            console.info("Executing Thing Tests First");
            browser
                .waitForElementVisible('#stuff, 2500)
                //etc etc...
        } else {
            console.info("Executing Other thing Tests First");
            browser
                .assert.elementNotPresent('#stuff')
                //etc etc...
        }
    });
    browser.end();
}

So here i get the console.info in the log, but after that nada. The custom command is very simple:

exports.command = function(callback) {
var browser = this;

browser.execute(
    function () {
        return app.getthing();
    },
    [callback],
    function (result) {
        callback(result.value);
    }
);

return this;

};

Thanks for the help.

pateketrueke commented 10 years ago

Hi, currently i'm working solving many issues.

I've implemented missing features like custom_commands_path and so on.

Could you clone the repo and run your tests against develop branch?

pateketrueke commented 10 years ago

I think this is solved on 0.2.3

ghost commented 10 years ago

I'm all fixed, thanks @pateketrueke . One weird thing is that in order for this to work I had to structure my grunt options a bit differently than in the readme.

the readme implies i can pass the options at the top level, for example:

nightwatch: {
        options: {
                custom_commands_path : "path",

But I had to do:

       nightwatch: {
           options: {
               test_settings: {
                   custom_commands_path : "path",
pateketrueke commented 10 years ago

Fixed on 0.2.4