@augment-vir/test
Version:
A universal testing suite that works with Mocha style test runners _and_ Node.js's built-in test runner.
17 lines (16 loc) • 518 B
JavaScript
import { assertTestContext, TestEnv, } from '../augments/universal-testing-suite/universal-test-context.js';
/**
* Find the matching (or first) "option" element.
*
* @category Internal
*/
export function getMenuOption(testContext, options) {
assertTestContext(testContext, TestEnv.Playwright);
const baseLocator = testContext.page.getByRole('option', options);
if (options && 'nth' in options) {
return baseLocator.nth(options.nth);
}
else {
return baseLocator.first();
}
}