webdriverio-automation
Version:
WebdriverIO-Automation android ios project
25 lines (24 loc) • 763 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateElementsArray = exports.wrapExpectedWithArray = void 0;
exports.wrapExpectedWithArray = (el, actual, expected) => {
if (Array.isArray(el) && el.length > 1 && Array.isArray(actual)) {
expected = [expected];
}
return expected;
};
exports.updateElementsArray = (success, received, refetched, full = false) => {
if (!success) {
return;
}
if (Array.isArray(received) && Array.isArray(refetched)) {
if (full === true) {
while (received.length > 0) {
received.pop();
}
}
if (received.length === 0) {
refetched.forEach(el => received.push(el));
}
}
};
;