fix: nightwatch helper compat with airbnb linter

close #870
This commit is contained in:
Evan You
2018-02-28 17:37:19 -05:00
parent 00ec67bc35
commit f4d1841723

View File

@@ -7,12 +7,13 @@
// For more information on custom assertions see:
// http://nightwatchjs.org/guide#writing-custom-assertions
exports.assertion = function (selector, count) {
exports.assertion = function elementCount (selector, count) {
this.message = `Testing if element <${selector}> has count: ${count}`
this.expected = count
this.pass = val => val === count
this.value = res => res.value
this.command = cb => this.api.execute(function (selector) {
return document.querySelectorAll(selector).length
}, [selector], cb)
function evaluator (_selector) {
return document.querySelectorAll(_selector).length
}
this.command = cb => this.api.execute(evaluator, [selector], cb)
}