I'm now tearing out what little remains of my hair. And I think I've lost vision in my left knee.
I have two functions that work. Each one takes a parameter correctly. I would dearly, so very dearly, love one function to take both parameters.
I have a super simple data structure:
var stuff = [
{ name: "Stone", id: "cc45" },
{ name: "Hanley", id: "cc78" }
];
I wish to loop through the structure and run a super simple test on each. Please observe:
for (var ii = 0; ii < stuff.length; ii++) {
var aTile = element(by.id(stuff[ii].id));
aTile.getText().then(
/* magical solution */
);
}
All I'm missing the magical solution. In version A (which lacks magic) I can successfully regard the text that Protractor kindly grabbed:
aTile.getText().then((function (text) {
console.log(" --Protractor Grab--" + text);
}));
In version B (which also lacks magic) I can successfully behold the data I wish to compare the Protractor-grabbed text to:
aTile.getText().then((function (test) {
console.log(" ==Stuff test==" + test);
})(stuff[ii].name));
What I cannot do, no matter how much hair I pull, is to get Protractor to compare both. Effectively, I need to add this:
expect(protractorGrabbedText).toContain(expectedTextFromStuff);
Please kind heroes of code, help me, I implore you.