How do I use Chai to verify data in data tables

110 views
Skip to first unread message

ebuc...@gmail.com

unread,
Mar 17, 2017, 11:37:58 AM3/17/17
to Chai.js

I searched but I couldn't find how to utilize Chai to inspect a grid of data.  The data is presented in data tables.  There are column headers and then rows of data.  I need to verify that the counts displayed are correct.  I know I can utilize a screenshot but I thought it would be better to use Chai. 

 

Can you please direct me to an example of how to achieve this?  When I inspect the page, the following is what is retrieved for the column header is Completed and the first line of data has a count of 3.

 

#dt_58cbfd2329471 > thead > tr > th.sorting_asc

 

 

<th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="dt_58cbfd2329471" rowspan="1" colspan="1"

style="width: 103.182px;" aria-sort="ascending" aria-label="COMPLETED: activate to sort column descending">COMPLETED</th>

 

 

<a href="User_count.php?p=user_summary_grid&amp;mode=comp&amp;user_id=1777&amp;product_id=22&amp;project_id=&amp;license_state=&amp;user_level=&amp;firstname=&amp;lastname=&amp;city=&amp;state=&amp;region=&amp;region1=&amp;discussion_id=&amp;page=" style="font-weight:normal;color:#5A5A56;">3</a>

Robin

unread,
Feb 22, 2018, 10:03:50 AM2/22/18
to Chai.js
Take a look at the `chai-jQuery` plugin here: http://chaijs.com/plugins/chai-jquery/ - that will allow you to select and query HTML content.
Reply all
Reply to author
Forward
0 new messages