I have some strings that I have extracted using protractor/jasmine/angularJS and converted into integers. I am now trying to add these together and compare in an expect statement. But I am getting some promise errors in doing so.
var result0 = element.all(by.binding('Inboxes.Inbox.Count')).first().getText().then(parseFloat);
result0.then((value) => console.log("count: ", value));
var result1 = element.all(by.binding('InboxItem.Count')).get(0).getText().then(parseFloat);
result1.then((value) => console.log("count: ", value));
var result2 = element.all(by.binding('InboxItem.Count')).get(1).getText().then(parseFloat);
result2.then((value) => console.log("count: ", value));
var result3 = element.all(by.binding('InboxItem.Count')).get(2).getText().then(parseFloat);
result3.then((value) => console.log("count: ", value)).then(expect(result1 + result2 + result3).toEqual(result0));
//compare badge counts to Inbox badge count
expect(result1 + result2 + result3).toEqual(result0);
});
});
});
I am getting the following promise errors. I thought that since the promises had already been satisfied and the counts below print out (41, 7, 14 and 20) that I could add the bottom 3(reulst1-3) together and compare to result0 which is the total of result1-3. I am having a time with these promises since I am new to this and don't quite understand them very well.
Started
count: 41
count: 7
count: 14
count: 20
F
Failures:
1) Workflow Application When selecting Alerts panel should expand the Inbox panel and Postings
Message:
Expected 'ManagedPromise::859 {[[PromiseStatus]]: "pending"}ManagedPromise::896 {[[PromiseStatus]]: "pending"}ManagedPromise::933 {[[PromiseStatus]]: "pending"}' to equal ManagedPromise::822 {[[PromiseStatus]]: "pending"}.