(page, selector)
| 43 | condition(selector, {orderedValues: {attribute: 'data-record', values}}); |
| 44 | |
| 45 | async function visibleRows(page, selector) { |
| 46 | return page.locator(`${selector} [data-record]`).evaluateAll(nodes => |
| 47 | nodes.map(node => ({ |
| 48 | id: node.getAttribute('data-record'), |
| 49 | label: node.querySelector('[slot="label"]')?.textContent, |
| 50 | level: node.getAttribute('aria-level') |
| 51 | })) |
| 52 | ); |
| 53 | } |
| 54 | |
| 55 | function invalidRows() { |
| 56 | throw new Error('Visible collection records have incorrect labels or hierarchy levels.'); |