mardi 28 avril 2015

Edit ui-grid cell value using protractor

I am using protractor to test angular ui-grid 3.0. All cells in grid are editable. In my tests I can get cell using following method:

dataCell: function( gridId, fetchRow, fetchCol ) {
    var row = this.getGrid( gridId ).element(by.css('.ui-grid-render-container-body')).element( by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index').row( fetchRow )  );
    return row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name').row( fetchCol ));
}

from http://ift.tt/1IiwpZx.

After I get first cell from first row, when I try to send value to cell

cell.click();
cell.sendKeys("newCellValue");

test breaks. I get following error message:

    - Failed: unknown error: cannot focus element.

The problem occurs when sendKeys method is called. Does anyone know the correct way to change cell value using protractor?

Aucun commentaire:

Enregistrer un commentaire