* {{> waitForValue }}
(field, value, sec = null)
| 2623 | * {{> waitForValue }} |
| 2624 | */ |
| 2625 | async waitForValue(field, value, sec = null) { |
| 2626 | const client = this.browser |
| 2627 | const aSec = sec || this.options.waitForTimeoutInSeconds |
| 2628 | |
| 2629 | return client.waitUntil( |
| 2630 | async () => { |
| 2631 | const res = await findFields.call(this, field) |
| 2632 | if (!res || res.length === 0) return false |
| 2633 | const selected = await forEachAsync(res, async el => el.getValue()) |
| 2634 | if (Array.isArray(selected)) { |
| 2635 | return selected.filter(part => part.indexOf(value) >= 0).length > 0 |
| 2636 | } |
| 2637 | return selected.indexOf(value) >= 0 |
| 2638 | }, |
| 2639 | { |
| 2640 | timeout: aSec * 1000, |
| 2641 | timeoutMsg: `element (${field}) is not in DOM or there is no element(${field}) with value "${value}" after ${aSec} sec`, |
| 2642 | }, |
| 2643 | ) |
| 2644 | } |
| 2645 | |
| 2646 | /** |
| 2647 | * {{> waitForVisible }} |
nothing calls this directly
no test coverage detected