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

Function expectElement

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

Source from the content-addressed store, hash-verified

70}
71
72function 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
87function expectAnyElement(locator, fn) {
88 const step = prepareStep('expect any element to be', locator, fn)

Callers 1

els_test.jsFile · 0.90

Calls 8

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

Tested by

no test coverage detected