import { getAllOptionsOfHandle } from '../get-all-options-of-handle' ; import { ElementHandle } from 'playwright' ; export async function areOptionsByValueAlreadySelectedInHandle ( selector , name , expectedOptionValues ) { if ( expectedOptionValues . length === 0 ) { throw new Error ( `You must specify at least one option for selector '${ name }'` ) ; } const allOptions = await getAllOptionsOfHandle ( selector , name ) ; const result = expectedOptionValues . every ( ( expectedValue ) => allOptions . filter ( ( option ) => option . selected ) . some ( ( selectedOption ) => selectedOption . value === expectedValue ) ) ; return result ; }