I am currently executing a protractor test to validate the existence of a record in the grid based on a specific license number. However, I have encountered an issue where the value assigned to the rowNumber
variable gets lost after traversing through all the rows. The reason behind this behavior is unknown to me. Ideally, the rowNumber
should be equivalent to the index.
This snippet showcases my test scenario:
var rowNumber = null;
var rows = element.all(by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index'));
it('should identify the row where the driver's license was created', function() {
rows.each(function(element, index) {
element.getText().then(function (text) {
if (text.includes(licenceNumber)) {
rowNumber = index; // At this instance, rowNumber does correspond with the index
return true;
}
});
expect(rowNumber).not.toEqual(null);
});
});