2020-02-18 08:57:00 +01:00
|
|
|
export default class ElementCount {
|
2020-12-14 10:21:04 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
2020-02-18 08:57:00 +01: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 11:28:29 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|