I have an array of objects 'arr'. each value should be looped through forEach loop and key (which is a parentEle) should be clicked first and the value (which is a childEle) should be clicked next. like wise the loop should repeat 5 times. where as it is looping all the five elements at a time and then clicking on the first parentEle1 and then exiting the loop. Tried lot of ways but no luck. highly appreciate any resolution on this.
static changeCoverage = async function (testData) {
var onlyCoverage = _.drop(testData[0].coverage);
onlyCoverage.forEach(async (coverages) => {
var filteredCoverage = _.omit(coverages, ["coverageType"]);
Object.entries(filteredCoverage).forEach(async ([key, value]) => {
var isKeyDisplayed = await $(`//div[text()="${key}"]`).isDisplayed()
logger.info(
"INFO",
"availability of coverage key we are changing is: " + isKeyDisplayed
);
await coveragesPM.clickAndWait($(`//div[text()="${key}"]`))
var isValueDisplayed = await $(`//div[text()="${key}"]/../../../../../..//span[text()="${value}"]`).isDisplayed()
logger.info(
"INFO",
"availability of coverage value we are changing is: " + isValueDisplayed
);
await coveragesPM.clickAndWait($(`//div[text()="${key}"]/../../../../../..//span[text()="${value}"]`))
});
});
}