I am currently attempting to loop through a list of elements in order to locate any one of them that has a specific value as its getText()
result.
The issue I am encountering is that my test is not following the sequence I have outlined.
I have researched queuing and Promise resolution extensively, but I am unsure of how it impacts my current situation.
This is what I am trying to accomplish:
it('should search for applications by name', function() {
var exists = false;
element.all(by.repeater('item in list')).each(function(elem) {
elem.getText().then(function(text) {
if(text === 'foo')
exists = true;
return exists;
}).then(function(exists) {
console.log('current value: ' + exists); // This displays later
});
});
console.log('final result: ' + exists); // This appears first in the console
})
Any advice on how I can ensure the boolean value I desire is determined prior to being logged at the conclusion would be greatly appreciated.