| 123456789101112131415161718192021222324252627 | // A custom Nightwatch assertion.// The assertion name is the filename.// Example usage:////   browser.assert.elementCount(selector, count)//// For more information on custom assertions see:// http://nightwatchjs.org/guide#writing-custom-assertionsexports.assertion = function (selector, count) {  this.message = 'Testing if element <' + selector + '> has count: ' + count  this.expected = count  this.pass = function (val) {    return val === this.expected  }  this.value = function (res) {    return res.value  }  this.command = function (cb) {    var self = this    return this.api.execute(function (selector) {      return document.querySelectorAll(selector).length    }, [selector], function (res) {      cb.call(self, res)    })  }}
 |