| 4298 | } |
| 4299 | |
| 4300 | async function findClickable(matcher, locator) { |
| 4301 | const matchedLocator = new Locator(locator) |
| 4302 | |
| 4303 | if (!matchedLocator.isFuzzy()) { |
| 4304 | const els = await findElements.call(this, matcher, matchedLocator) |
| 4305 | return els |
| 4306 | } |
| 4307 | |
| 4308 | let els |
| 4309 | const literal = xpathLocator.literal(matchedLocator.value) |
| 4310 | |
| 4311 | try { |
| 4312 | els = await matcher.getByRole('button', { name: matchedLocator.value }).all() |
| 4313 | if (els.length) return els |
| 4314 | } catch (err) { |
| 4315 | // getByRole not supported or failed |
| 4316 | } |
| 4317 | |
| 4318 | try { |
| 4319 | els = await matcher.getByRole('link', { name: matchedLocator.value }).all() |
| 4320 | if (els.length) return els |
| 4321 | } catch (err) { |
| 4322 | // getByRole not supported or failed |
| 4323 | } |
| 4324 | |
| 4325 | els = await findElements.call(this, matcher, Locator.clickable.narrow(literal)) |
| 4326 | if (els.length) return els |
| 4327 | |
| 4328 | els = await findElements.call(this, matcher, Locator.clickable.wide(literal)) |
| 4329 | if (els.length) return els |
| 4330 | |
| 4331 | try { |
| 4332 | els = await findElements.call(this, matcher, Locator.clickable.self(literal)) |
| 4333 | if (els.length) return els |
| 4334 | } catch (err) { |
| 4335 | // Do nothing |
| 4336 | } |
| 4337 | |
| 4338 | return findElements.call(this, matcher, matchedLocator.value) // by css or xpath |
| 4339 | } |
| 4340 | |
| 4341 | async function proceedSee(assertType, text, context, strict = false) { |
| 4342 | let description |