在我正在进行的当前测试中,我需要验证单个行上的单个列,并相应地检查值,我认为expect(...)
是我获取它的地方但是,我并不完全确定,我得到的错误是:
TypeError:Object [object Object]没有方法' row'
TypeError:无法调用方法'元素'未定义的
//function in page.js file:
Page.prototype.getSummaryInfo = function () {
return element.all(by.repeater('accountsSummary in accountsSummaries'))
.map(function (item, idx, rowNumber) {
return {
index: idx,
row: rowNumber.element(by.repeater('accountsSummary in accountsSummaries')).get(rowNumber),
currency: item.element(by.binding('accountsSummary.currency')).getText(),
totalBalance: item.element(by.binding('accountsSummary.amount')).getText(),
totalAccounts: item.element(by.binding('accountsSummary.noOfAccounts')).getText()
};
});
};
// calling function in test:
it("should get summary info", function() {
var details = page.getSummaryInfo();
expect(details.row(2)).totalAccounts.toBe("17");
});