ฉันกำลังพยายามเขียนการทดสอบแตงกวา/capybara เพื่อตรวจสอบความถูกต้องของข้อมูลในส่วนประกอบ KendoGrid UI และกำลังมีปัญหาบางประการในการพิจารณาวิธีการเลือกและตรวจสอบความถูกต้องของข้อมูลบนหน้าเว็บ
ฉันพบบทช่วยสอนพื้นฐานและตัวอย่างเกี่ยวกับการใช้แตงกวา/คาปิบาราด้วยข้อมูลตาราง แต่ปรากฏว่า KendoGrid ใช้การกำหนดค่าตารางและข้อมูลที่แตกต่างกันเล็กน้อย โดยที่ 1.) ไม่มี "id" เพื่อเลือกตารางบนหน้าได้อย่างง่ายดาย และ 2.) มีหลายตาราง (หนึ่งตารางสำหรับส่วนหัว) และอีกตารางหนึ่งสำหรับข้อมูลจริง
นี่คือข้อความที่ตัดตอนมาจากข้อมูล kendoGrid ปัจจุบันของฉันที่ฉันต้องการตรวจสอบ:
<div id="item_grid" data-role="grid" class="k-grid k-widget k-secondary" style="">
<div class="k-grid-header" style="padding-right: 17px;">
<div class="k-grid-header-wrap">
<table role="grid">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th role="columnheader" data-field="ItemA" data-title="Item A" class="k-header" data-role="sortable">
<a class="k-link" href="/th#">Item A</a>
</th>
<th role="columnheader" data-field="ItemB" data-title="Item B" class="k-header" data-role="sortable">
<a class="k-link" href="/th#">Item B</a>
</th>
<th role="columnheader" data-field="ItemC" data-title="Item C" class="k-header" data-role="sortable">
<a class="k-link" href="/th#">Item C</a>
</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="k-grid-content">
<table role="grid">
<colgroup>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr data-uid="2c77ea57-50ea-474d-950a-8379b3690936" role="row">
<td role="gridcell">A</td>
<td role="gridcell">223.63</td>
<td role="gridcell">0</td>
</tr>
<tr class="k-alt" data-uid="979534bc-7dea-47e9-9471-088c5bffe5b5" role="row">
<td role="gridcell">B</td>
<td role="gridcell">223.63</td>
<td role="gridcell">180</td>
</tr>
<tr data-uid="4d4c31e7-4daf-44ad-b6c1-20ffdfde57c4" role="row">
<td role="gridcell">C</td>
<td role="gridcell">143.58</td>
<td role="gridcell">0</td>
</tr>
<tr class="k-alt" data-uid="8d315558-b014-4219-b21b-dbe52cc6dd18" role="row">
<td role="gridcell">D</td>
<td role="gridcell">143.58</td>
<td role="gridcell">180</td>
</tr>
</tbody>
</table>
</div>
</div>
จุดเริ่มต้นที่ดีที่สุดในการเขียนแบบทดสอบเพื่อให้ครอบคลุมสถานการณ์นี้คือที่ใด
ฉันได้เล่นเพิ่มเติมกับ Telerik Test Studio แล้ว และการทดสอบสถานการณ์เฉพาะนี้ในแอปพลิเคชันนั้นง่ายมาก!