| 4212 | } |
| 4213 | |
| 4214 | async function findByRole(context, locator) { |
| 4215 | if (!locator || !locator.role) return null |
| 4216 | const options = {} |
| 4217 | if (locator.name) options.name = locator.name |
| 4218 | if (locator.exact !== undefined) options.exact = locator.exact |
| 4219 | return context.getByRole(locator.role, Object.keys(options).length > 0 ? options : undefined).all() |
| 4220 | } |
| 4221 | |
| 4222 | async function findElements(matcher, locator) { |
| 4223 | const isPwLocator = locator.type === 'pw' || (locator.locator && locator.locator.pw) || locator.pw |