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

Function findCheckable

lib/helper/Playwright.js:4372–4398  ·  view source on GitHub ↗
(locator, context)

Source from the content-addressed store, hash-verified

4370}
4371
4372async function findCheckable(locator, context) {
4373 let contextEl = await this.context
4374 if (typeof context === 'string') {
4375 contextEl = await findElements.call(this, contextEl, new Locator(context, 'css').simplify())
4376 contextEl = contextEl[0]
4377 }
4378
4379 // Handle role locators with text/exact options
4380 const roleElements = await handleRoleLocator(contextEl, locator)
4381 if (roleElements) return roleElements
4382
4383 const matchedLocator = new Locator(locator)
4384 if (!matchedLocator.isFuzzy()) {
4385 return findElements.call(this, contextEl, matchedLocator)
4386 }
4387
4388 const literal = xpathLocator.literal(matchedLocator.value)
4389 let els = await findElements.call(this, contextEl, Locator.checkable.byText(literal))
4390 if (els.length) {
4391 return els
4392 }
4393 els = await findElements.call(this, contextEl, Locator.checkable.byName(literal))
4394 if (els.length) {
4395 return els
4396 }
4397 return findElements.call(this, contextEl, matchedLocator.value)
4398}
4399
4400async function proceedIsChecked(assertType, option) {
4401 let els = await findCheckable.call(this, option)

Callers

nothing calls this directly

Calls 3

isFuzzyMethod · 0.95
handleRoleLocatorFunction · 0.85
simplifyMethod · 0.65

Tested by

no test coverage detected