* {{> waitForText }} *
(text, sec = null, context = null)
| 2599 | * |
| 2600 | */ |
| 2601 | async waitForText(text, sec = null, context = null) { |
| 2602 | const aSec = sec || this.options.waitForTimeoutInSeconds |
| 2603 | const _context = context || this.root |
| 2604 | |
| 2605 | return this.browser.waitUntil( |
| 2606 | async () => { |
| 2607 | const res = await this.$$(withStrictLocator.call(this, _context)) |
| 2608 | if (!res || res.length === 0) return false |
| 2609 | const selected = await forEachAsync(res, async el => this.browser.getElementText(getElementId(el))) |
| 2610 | if (Array.isArray(selected)) { |
| 2611 | return selected.filter(part => part.indexOf(text) >= 0).length > 0 |
| 2612 | } |
| 2613 | return selected.indexOf(text) >= 0 |
| 2614 | }, |
| 2615 | { |
| 2616 | timeout: aSec * 1000, |
| 2617 | timeoutMsg: `element (${_context}) is not in DOM or there is no element(${_context}) with text "${text}" after ${aSec} sec`, |
| 2618 | }, |
| 2619 | ) |
| 2620 | } |
| 2621 | |
| 2622 | /** |
| 2623 | * {{> waitForValue }} |
nothing calls this directly
no test coverage detected