MCPcopy
hub / github.com/codeceptjs/CodeceptJS / expectAllElements

Function expectAllElements

lib/els.js:110–128  ·  view source on GitHub ↗
(locator, fn)

Source from the content-addressed store, hash-verified

108}
109
110function 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
130export { element, eachElement, expectElement, expectAnyElement, expectAllElements }
131

Callers 1

els_test.jsFile · 0.90

Calls 8

truthFunction · 0.90
humanizeFunctionFunction · 0.90
prepareStepFunction · 0.85
executeStepFunction · 0.85
debugMethod · 0.80
assertMethod · 0.80
fnFunction · 0.50
_locateMethod · 0.45

Tested by

no test coverage detected