(locator, fn)
| 108 | } |
| 109 | |
| 110 | function expectAllElements(locator, fn) { |
| 111 | const step = prepareStep('expect all elements', locator, fn) |
| 112 | if (!step) return |
| 113 | |
| 114 | return executeStep(step, async () => { |
| 115 | const els = await step.helper._locate(locator) |
| 116 | output.debug(`Found ${els.length} elements, all should pass the assertion`) |
| 117 | |
| 118 | let i = 1 |
| 119 | for (const el of els) { |
| 120 | output.debug(`checking element #${i}: ${el}`) |
| 121 | const wrapped = new WebElement(el, step.helper) |
| 122 | const result = await fn(wrapped) |
| 123 | const assertion = truth(`element #${i} of (${locator})`, humanizeFunction(fn)) |
| 124 | assertion.assert(result) |
| 125 | i++ |
| 126 | } |
| 127 | }) |
| 128 | } |
| 129 | |
| 130 | export { element, eachElement, expectElement, expectAnyElement, expectAllElements } |
| 131 |
no test coverage detected