cucumber-protractor
Version:
POM CukeTractor - Bootstrap your cucumber tests with cucumber, protractor and a structured way of creating page objects and component objects
9 lines (7 loc) • 417 B
JavaScript
module.exports = function checkElementExistsNTimes(locatorKey, doesNotExist, numberOfTimes) {
const els = this.getCurrentPage().getElements(locatorKey);
const actualCount = browser.wait(protractor.ExpectedConditions.presenceOf(els)).then(() => els.count());
return doesNotExist ?
expect(actualCount).to.not.eventually.equal(+numberOfTimes) :
expect(actualCount).to.eventually.equal(+numberOfTimes);
};