0

My e2e-test for ui-grid is the following:

  1. I'm adding the new item with the name that includes timestamp, saving it to the server.
  2. I'm checking if the item with this name has been added to the ui-grid table.

The problem is that the table can get very big and ui-grid apparently uses lazy loading and puts only the visible rows to the DOM. I found this library of helper methods for testing, but it doesn't provide anything to search for the rows which are not in visible now.

So, question, is one of the following is possible in my Protractor test? 1) can I check how many rows do I have in my ui-grid table? 2) can I search for the certain cell by text, even if the cell is not visible?

ganqqwerty
  • 1,894
  • 2
  • 23
  • 36

1 Answers1

0

1) Can I check how many rows do I have in my ui-grid table?

As long as the row is in the DOM, you can access it. However, if it's not visible you won't be able to do any operation on it (e.g. click). To get number of table rows you can use count:

$$('table tr').count();

2) Can I search for the certain cell by text, even if the cell is not visible?

Yes, you can search for (but not interact with) the cell as long as it's in the DOM. It doesn't have to be visible. But selecting elements by their text is rather fragile, so you should try to use some other method, if possible.

finspin
  • 4,021
  • 6
  • 38
  • 66
  • My question is specific to ui-grid, I know how to deal with simple tables. ui-grid puts only visible rows to the DOM – ganqqwerty May 14 '16 at 09:52