MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / waitForValue

Method waitForValue

lib/helper/WebDriver.js:2625–2644  ·  view source on GitHub ↗

* {{> waitForValue }}

(field, value, sec = null)

Source from the content-addressed store, hash-verified

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 }}

Callers

nothing calls this directly

Calls 3

forEachAsyncFunction · 0.85
getValueMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected