(locator, fn)
| 70 | } |
| 71 | |
| 72 | function expectElement(locator, fn) { |
| 73 | const step = prepareStep('expect element to be', locator, fn) |
| 74 | if (!step) return |
| 75 | |
| 76 | return executeStep(step, async () => { |
| 77 | const els = await step.helper._locate(locator) |
| 78 | output.debug(`Found ${els.length} elements, first will be used for assertion`) |
| 79 | |
| 80 | const wrapped = new WebElement(els[0], step.helper) |
| 81 | const result = await fn(wrapped) |
| 82 | const assertion = truth(`element (${locator})`, fn.toString()) |
| 83 | assertion.assert(result) |
| 84 | }) |
| 85 | } |
| 86 | |
| 87 | function expectAnyElement(locator, fn) { |
| 88 | const step = prepareStep('expect any element to be', locator, fn) |
no test coverage detected