javascript - Using protractor to test infinite scrolling -


I do not think it's infinite scrolling strictly, but it was the best I could think of what I'm seeing Makes comparisons. .

However, we are using ng-grid to show data in the table. We have about 170 items (rows) to display when we use the NG-Grid, it creates a criminal when I observe this repeater from the browser, it is limited to 35 items and, as you Scroll down the list, you start losing the top row from the dom and the new rows are added to the bottom etc. (That's why I do not think so strictly infinite scraps In the form of scrolling, usually only adds more rows)

That's all I am clear that always 35 'ng-repeat = lines in lines provided' Far away you have to scroll down

This test is great until it comes up. I need to get the text for each item in the list, but element.all (by.bending ('item.name')) by using or by.repeater or by.css Now there are only 35 items present on the page.

Now for my question, how can I make it so that I can hold all 170 items in the form of an object which can then iterate again to capture the text as an array Store?

On other pages where we have fewer than 35 items I iv just use binding to create an object, then go to each line as the Async js. Using and using text (see below for example, for removing this, I know that it probably will not work because it is intended for reference)

  // There are only 35 rows in the column data, I need all 170. Var columnData = element.all (by.binding ('row.entity.name')), colDataTextArr = [] / / PreOrderArray elsewhere, prevOrderArray = ['item1', 'item2' ... 'item 169', created Has been 'Item 170']; Get the text for current async line {columnData, colDataTextArr, prevOrderArray} {columnData.then (function (colData) {//} using async to go to each line async.eachSeries (colData, function (colDataRow, nRow) ColDataRow.getText (). Then (function (colDataText) {// add an array to an array colDataTextArr.push (colDataText); nRow ()});}, function (error) {if (err) {console.log} } ('Failed to process a row')} Other {/} expect expected return (colDataTextArr) .toqual (prevOrderArray);}});}); }  

As a side, I know that running through 170 lines and accumulating text in an array is not very efficient, so if there is a better way of doing this So I'm open for suggestions 'I am open'

I am quite new to JavaScript and web testing, if I do not understand because I am using the wrong terminology or I know anything And I'll try and clearly Mjaunga.

I think this is an overkill for testing all the rows in the grid. I think it would be enough to test that you get the value for the first few lines and then, if you need to test all the elements, use the evaluate ().

Unfortunately there is no code snippet in the API page, but it looks like this:

  // Hold an element where you Evaluate the angular expression element (by.css ('grid' ('rows'). Evaluate ('rows'). (Function (rows) {// This forces you the values ​​of rows of variables according to the element (Line [16 9] .name) .toEqual ('some name');});  

Let me know that it works.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -