2020-02-18 07:57:00 +00:00
|
|
|
export default class ElementCount {
|
2020-12-14 09:21:04 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
2020-02-18 07:57:00 +00:00
|
|
|
constructor(selector, count) {
|
|
|
|
this.message = `Testing if element <${selector}> has count: ${count}`;
|
|
|
|
this.expected = count;
|
|
|
|
this.pass = (val) => val === count;
|
|
|
|
this.value = (res) => res.value;
|
|
|
|
function evaluator(_selector) {
|
|
|
|
return document.querySelectorAll(_selector).length;
|
|
|
|
}
|
|
|
|
this.command = (cb) => this.api.execute(evaluator, [selector], cb);
|
2018-05-18 09:28:29 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|