There are two elements on the GUI, depending on the context only a single is visible.
Therefore, i like to use a helper function that gives the the Protractor element of the currently visible element.
However, i have to wait until the promise is resolved since everything is asynchronous.
function () {
var result;
var controlA = $('controlA');
var controlB = $('controlB');
listControl.isDisplayed().then(function (isVisible) {
result = isVisible;
// STEP X
});
// WAIT HERE UNTIL STEP X is done
return result ? controlA : controlB;
};
Clarification: I do NOT want to wait until the control is getting visible.