Protractor 量角器使用by.repeater和evaluate按行属性搜索
我正在尝试使用带有ui网格的e2e的by.repeater和evaluate实现按行搜索属性 其思想是将by.repeater的结果映射到一个新对象,该对象具有我从evaluate和行中获得的底层对象id,以便我可以对新对象数组执行按id过滤。大概是这样的:Protractor 量角器使用by.repeater和evaluate按行属性搜索,protractor,angular-ui-grid,ui-grid,Protractor,Angular Ui Grid,Ui Grid,我正在尝试使用带有ui网格的e2e的by.repeater和evaluate实现按行搜索属性 其思想是将by.repeater的结果映射到一个新对象,该对象具有我从evaluate和行中获得的底层对象id,以便我可以对新对象数组执行按id过滤。大概是这样的: return this.getGrid( gridId ).all( by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index') ).
return this.getGrid( gridId ).all( by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index') ).map(function(row, index){
return {
index: index,
row: row,
id: row.evaluate('row.entity.id')
};
}).then(function(maps){
return maps.find(function(e){
return e.id === rowId;
});
});
当我使用或返回row对象时,map函数似乎挂起。根据这一点,它应该工作,但它没有。有什么想法吗
谢谢,
大卫 您可以直接使用
filter()
方法根据任何条件筛选行。看看下面的例子
return this.getGrid(gridId).all(by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index')).filter(function(row_element){
return row_element.evaluate('row.entity.id').then(function(Current_rowid){
return Current_rowid == rowId;
})
}).first()