Reputation: 1295
I need to locate and test a specific cell in an ng-grid table to ensure it's not showing 'NaN'. I have been able to locate cells in columns 1-7, but this cell is in column 14, which a user needs to scroll horizontally to see. When trying to locate cells 8-14, protractor just returns undefined. I've tried resizing the window before the test, to no avail.
Code:
it('should have values in the adverse events tab for the Fosamax column when viewing Postmenopausal Osteoporosis report', function () {
browser.get('/#/druggroup/indication/N0000003303/adverseevents/IR');
var fosamaxCell = element.all(by.repeater('row in renderedRows')).then(function(rows) {
cell = rows[6].element(by.className('colt14')).getText()
.then(function (data) {
return data.replace(/ /g,'');
});
return cell;
});
expect(fosamaxCell).toEqual('NaN');
});
Upvotes: 2
Views: 2133
Reputation: 474241
Scrolling into view should help here:
var elm = rows[6].element(by.className('colt14'));
browser.executeScript("arguments[0].scrollIntoView(true);", elm.getWebElement());
cell = elm.getText().then(function (data) {
return data.replace(/ /g,'');
});
Upvotes: 2