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

Method seeElement

lib/helper/Puppeteer.js:1192–1210  ·  view source on GitHub ↗

* {{> seeElement }}

(locator, context = null)

Source from the content-addressed store, hash-verified

1190 * {{> seeElement }}
1191 */
1192 async seeElement(locator, context = null) {
1193 let els
1194 if (context) {
1195 const contextPage = await this.context
1196 const contextEls = await findElements.call(this, contextPage, context)
1197 assertElementExists(contextEls, context, 'Context element')
1198 els = await findElements.call(this, contextEls[0], locator)
1199 } else {
1200 els = await this._locate(locator)
1201 }
1202 els = (await Promise.all(els.map(el => el.boundingBox() && el))).filter(v => v)
1203 // Puppeteer visibility was ignored? | Remove when Puppeteer is fixed
1204 els = await Promise.all(els.map(async el => (await el.evaluate(node => window.getComputedStyle(node).visibility !== 'hidden' && window.getComputedStyle(node).display !== 'none')) && el))
1205 try {
1206 return empty('visible elements').negate(els.filter(v => v).fill('ELEMENT'))
1207 } catch (e) {
1208 dontSeeElementError(locator)
1209 }
1210 }
1211
1212 /**
1213 * {{> dontSeeElement }}

Callers

nothing calls this directly

Calls 7

_locateMethod · 0.95
emptyFunction · 0.90
dontSeeElementErrorFunction · 0.90
filterMethod · 0.80
evaluateMethod · 0.80
negateMethod · 0.80
assertElementExistsFunction · 0.70

Tested by

no test coverage detected