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

Function proceedMultiple

lib/helper/Puppeteer.js:3326–3342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3324 const fieldType = await el.getProperty('type').then(el => el.jsonValue())
3325
3326 const proceedMultiple = async elements => {
3327 const fields = Array.isArray(elements) ? elements : [elements]
3328
3329 const elementValues = []
3330 for (const element of fields) {
3331 elementValues.push(await element.getProperty('value').then(el => el.jsonValue()))
3332 }
3333
3334 if (typeof value === 'boolean') {
3335 equals(`no. of items matching > 0: ${field}`)[assertType](value, !!elementValues.length)
3336 } else {
3337 if (assertType === 'assert') {
3338 equals(`select option by ${field}`)[assertType](true, elementValues.length > 0)
3339 }
3340 elementValues.forEach(val => stringIncludes(`fields by ${field}`)[assertType](value, val))
3341 }
3342 }
3343
3344 if (tag === 'SELECT') {
3345 const selectedOptions = await el.$$('option:checked')

Callers 1

proceedSeeInFieldFunction · 0.70

Calls 3

equalsFunction · 0.90
pushMethod · 0.80
getPropertyMethod · 0.80

Tested by

no test coverage detected