I have to automate a scenario where a user has to assign one group/row out of n(10) group/row on 1st page. All groups/rows cannot be assigned.Only those group/row can be assigned that does not throw error message(based on group review state) in banner. So we have to iterate over each group and check if error appears or not. If no error is there then assign the group/row and break the .each loop.
The code below works fine but at the end it throws the following error:
Failed: unknown error: Element is not clickable at point (333, 555).
Other element would receive the click: <div class="loading"></div"
As per the error script is trying to click checkboxOfAllGroupRow
element even after loop is over.
How can we fix this issue?
this.assignGroupRow = function () {
pageTab.click();
filterDropdownIcon.click();
setValuesInFilterDropDown.click()
.then(function () {
functionLibrary.waitForLoaderToDisappear();
browser.sleep(3000);
var num = -1;
checkboxOfAllGroupRow.each(function (checkbox, index) {
checkbox.click().then(function () {
assignButtonInGroupPage.click();
dismissableErrorMessageInBanner.isPresent()
.then(function (errorPresence) {
if (errorPresence) {
checkbox.click();
dismissableErrorCloseIconInBanner.click();
if (index == groupCountOnFirstPage - 1)
console.log(" No groups in first page can be assigned.");
} else {
assignReasonIcon.click();
youIdentifiedSMEReason.click();
suggestSMENameTextField.click();
suggestSMENameInputField.sendKeys("ldapID");
functionLibrary.waitElementToBeVisisble(highlightedOptionInSuggestSMEDropDown);
highlightedOptionInSuggestSMEDropDown.click();
yesBtnInAssignmentOfGroupDialog.click()
.then(function () {
bannerMessageOnAssignmentOfGroup.getText().then(function (message) {
expect(message).toContain('group selected successfully assigned');
num = index;
return;
});
console.log(errorPresence + ' inside else. dialog is present at ' + index);
});
}
});
});
});
});
}