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

Function proceedSee

lib/helper/Puppeteer.js:3151–3181  ·  view source on GitHub ↗
(assertType, text, context, strict = false)

Source from the content-addressed store, hash-verified

3149}
3150
3151async function proceedSee(assertType, text, context, strict = false) {
3152 let description
3153 let allText
3154 if (!context) {
3155 let el = await this.context
3156
3157 if (el && !el.getProperty) {
3158 // Fallback to body
3159 el = await this.context.$('body')
3160 }
3161
3162 allText = [await el.getProperty('innerText').then(p => p.jsonValue())]
3163 description = 'web application'
3164 } else {
3165 const locator = new Locator(context, 'css')
3166 description = `element ${locator.toString()}`
3167 const els = await this._locate(locator)
3168 assertElementExists(els, locator.toString())
3169 allText = await Promise.all(els.map(el => el.getProperty('innerText').then(p => p.jsonValue())))
3170 }
3171
3172 if (store?.currentStep?.opts?.ignoreCase === true) {
3173 text = text.toLowerCase()
3174 allText = allText.map(elText => elText.toLowerCase())
3175 }
3176
3177 if (strict) {
3178 return allText.map(elText => equals(description)[assertType](text, elText))
3179 }
3180 return stringIncludes(description)[assertType](normalizeSpacesInString(text), normalizeSpacesInString(allText.join(' | ')))
3181}
3182
3183async function findCheckable(locator, context) {
3184 let contextEl = await this.context

Callers

nothing calls this directly

Calls 7

toStringMethod · 0.95
equalsFunction · 0.90
normalizeSpacesInStringFunction · 0.90
$Method · 0.80
getPropertyMethod · 0.80
assertElementExistsFunction · 0.70
_locateMethod · 0.45

Tested by

no test coverage detected