/** * Predicates for the test environment under which a UniDriver is running. * * Callers pass the result of `await base.getNative()` and branch the code path * themselves — this module owns detection only, never dispatch. * * - **jest** (jsdom): `getNative()` returns a DOM `HTMLElement`. * - **sled-2** (Puppeteer): `getNative()` returns `{ element, page, selector }`; * `page.evaluate` is the original marker used across the codebase. * - **sled-3** (Playwright): `getNative()` returns a Playwright `Locator`, which * exposes a `.locator(selector)` method (Puppeteer's `ElementHandle` does not). */ type AnyObj = Record; const isObject = (value: unknown): value is AnyObj => typeof value === 'object' && value !== null; export const isSled2 = (native: unknown): boolean => isObject(native) && isObject(native.page) && typeof native.page.evaluate === 'function'; export const isSled3 = (native: unknown): boolean => isObject(native) && typeof native.locator === 'function';