UNPKG

expect-webdriverio

Version:

WebdriverIO Assertion Library

17 lines (16 loc) 561 B
import { executeCommandBe } from '../../utils.js'; import { DEFAULT_OPTIONS } from '../../constants.js'; export async function toBeFocused(received, options = DEFAULT_OPTIONS) { this.expectation = this.expectation || 'focused'; await options.beforeAssertion?.({ matcherName: 'toBeFocused', options, }); const result = await executeCommandBe.call(this, received, el => el?.isFocused(), options); await options.afterAssertion?.({ matcherName: 'toBeFocused', options, result }); return result; }