angularjs - identifying that table header values are what they should be -


i'm trying prove in table have following table labels. date, amount, comment.

<table class="grid-table-body"> <thead>     <tr>         <th>date</th>         <th>amount (£)</th>         <th>description</th>     </tr> </thead> <tbody>      .....     .....     .....  </tbody> </table> 

i've got far proving table present!

   var mytable = element(by.css('.grid-table-body'));    expect(mytable.ispresent()).tobetruthy(); 

how can loop through each <th> , text. if put them array prove should be. i.e.

expect(data.get(0).gettext()).tobe("date"); 

would enough (i think)

first locate elements, can call gettext():

var headers = $$(".grid-table-body thead th"); expect(headers.gettext()).toequal(["date", "amount (£)", "description"]); 

to check of headers visible, can either use:

expect(headers.isdisplayed()).toequal([true, true, true]); 

or, check if there no false in array:

expect(headers.isdisplayed()).not.tocontain(false); 

you can map()/reduce() single boolean value.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -