-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (18 loc) · 744 Bytes
/
index.js
File metadata and controls
24 lines (18 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Selector } from 'testcafe';
fixture `Iterate through table rows`
.page('./index.html');
test('Check employees', async t => {
const table = Selector('table');
const dataRows = table.find('tbody > tr');
const dataRowCount = await dataRows.count;
for (let i = 0; i < dataRowCount; i++) {
const currentRow = dataRows.nth(i);
const fullNameCell = currentRow.child('td').nth(1);
const isEvenRow = !(i % 2);
await t.expect(fullNameCell.textContent).contains('Smith');
if (isEvenRow) {
const isRetiredCheckbox = currentRow.find('input[type=checkbox]');
await t.expect(isRetiredCheckbox.hasAttribute('checked')).ok();
}
}
});