0

I'm using nightwatch.js to do some ui integration tests and I didn't find any functionality that allows me to assert for the opposite of an expectation. I remember I used to have a .not() method in jasmine.js and I am looking for that kind of functionality in nightwatch as well. I couldn't find any custom methods online and I'm having difficulties developing a custom assertion myself.

My goal is to do: Browser.assert.not().title("Login").end();

NLev
  • 1
  • 2

1 Answers1

1

you can use node.js standart assertion. And use it in callback of getTitle. I think it should looking like that:

module.exports = {
"Some test" : function (browser) {
    browser
        .url(my.app.url.example.com)
        .getTitle(function(title){
             this.assert.notEqual(title,'another string');
         })
        .end();
}
};

Of course result of this assertion looks same as nightwatch.js assertions.

Andrew Kochnev
  • 956
  • 2
  • 7
  • 10