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

Function createRoleTextMatcher

lib/helper/Puppeteer.js:3598–3607  ·  view source on GitHub ↗
(expected, exactMatch)

Source from the content-addressed store, hash-verified

3596}
3597
3598function createRoleTextMatcher(expected, exactMatch) {
3599 if (expected instanceof RegExp) {
3600 return value => expected.test(value || '')
3601 }
3602 const target = String(expected)
3603 if (exactMatch) {
3604 return value => value === target
3605 }
3606 return value => typeof value === 'string' && value.includes(target)
3607}
3608
3609async function proceedSelect(context, el, option) {
3610 const role = await el.evaluate(e => e.getAttribute('role'))

Callers 1

findByRoleFunction · 0.85

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected