2016-11-14 155 views
0

在用於UI網格量角器E2E測試,我使用的函數DATACELL(gridId,fetchRow,fetchCol),這已在ui.grid.e2eTestLibrary.api提供了:gridTest,量角器E2E測試角UI網格單元填充

來源: - https://github.com/angular-ui/ui-grid/tree/master/test/e2e

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));} 

它在註釋部分明確提到,該DATACELL(fetchRow,fetchColumn)必須是可見的頁面,用於訪問數據單元,並填滿它。

@param {string}裏gridId要檢查

@param {整數衝電網的id fetchRow行的,你想要回號碼(可見行內)

@param {整數衝fetchCol山坳 要返回

數(可見的cols內)

我有一個大的UI電網(約100行〜50列),所以所有的行和列是不可見的。因此,爲了使它們可見在頁面中通過量角器自動化測試,我已經修改DATACELL()的代碼如下: -

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) ); 
browser.executeScript("arguments[0].scrollIntoView(true);", row.getWebElement()); 

return row.element(by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.uid').row(fetchCol)); 

},

在此之後,它應該滾動到適當的單元格,然後選擇它並相應地進行編輯。

但是,這我收到DATACELL,是可點擊(),但是當我用該方法給出的輸入: -

cell.element(by.css("input")).sendKeys("Data to be filled"); 

量角器是越來越墜毀,並表示這是顯示錯誤如下: -

Failed: No element found using locator: By(css selector, input). 

請建議一種方法,在UI網格中編輯網格單元格,這些網格單元格通過適當的滾動不可見。

採取Addtional操作: -

我用渲染的行和列,在創建UI電網的開發代碼增加virtualizationThreshold和columnvirtualizationThreshold值的一種變通方法。單元格正確定位,雖然它現在觸及性能問題。 RAM和交換正在被自動化過程完全消耗掉,隨後這個過程變得太慢了。有沒有解決內存性能問題的方法?

回答

0

虛擬化數據的自動e2e測試很難。要找到它,它必須在DOM中,才能進入DOM,您必須滾動到它。因此,您需要在循環中使用您的查找器:find/scroll/find/scroll;只有當你匹配或用完時纔會滾動。希望我錯了,但我沒有看到ui.grid.e2eTestLibrary.api中的任何東西:gridTest這樣做。

相關問題