import type { MaybeSomeWdioElementOrArrayMaybePromiseOrMultiRemoteElements, MaybeArray, WdioMultiRemoteElements, MaybeArrayOrMultiRemoteValuesWithArray } from '../types.js'; import type { MaybeArrayOrMultiRemoteValues, MultiRemoteValues } from '../publicTypes/expectWebdriverIO.js'; export type CompareResult = { success: boolean; actual: Actual; /** * The value that the matcher compared, after the string options (`trim`, `ignoreCase`, `replace`), if it is one value. * In a strategy result, it has the shape of `actual`: one value, an array for `$$()`, per-instance values for multi-remote. */ compared?: unknown; /** * The verdict of each part of one value, when the matcher compares the parts apart, e.g. each property of `toHaveStyle`. * The failure message shows a part that passed as no difference. Without it, the verdict is `success`. */ verdict?: unknown; }; export type MultiRemoteCompareResult = { success: boolean; actual: Actual; multiRemoteBrowserName: string; }; export type StrategyResult = { subject: Subject; expected?: Expected; abort?: boolean; /** * - isSome: `some()` was used * - matchingIndexes: for `$$()`, the indexes of the elements that matched, with the matcher's own comparison * (string options, each class...): the failure message of `.not` highlights them */ context?: { isSome: boolean; matchingIndexes?: number[]; }; /** * Whether each element or instance matched, with the matcher's own comparison, in the shape of `actual`: a boolean * for one element or browser, an array for `$$()`, per-instance values for multi-remote. Not set on a structural * failure. The failure message uses it to show an element that passed as no difference. */ verdict?: unknown; } & CompareResult | undefined>; /** * Fetch element(s) and route them to the appropriate comparison strategy. * * @param unresolvedElements awaited or non-awaited element(s) to be resolved and compared * @param singleElementCompare compare a single element with expected value(s) * @param isNot indicates if the assertion is inverted (e.g., using `.not`) * @param configuration configuration options for the strategy * @returns An object containing the subject, success status, actual values, and results of the comparison */ export declare function executeCommandWithStrategy({ unresolvedElements, expectedValues, singleElementCompare, context: { isNot, iteration }, supportsArrayContaining, matcherName, strictConfiguration }: { unresolvedElements: MaybeSomeWdioElementOrArrayMaybePromiseOrMultiRemoteElements | WdioMultiRemoteElements | unknown; expectedValues: MaybeArrayOrMultiRemoteValues | unknown; singleElementCompare(awaitedElement: WebdriverIO.Element, expectedValues: MaybeArray | undefined, index?: number, wholeList?: boolean): Promise>; context: { isNot?: boolean; iteration: number; }; /** Compare collection snapshots using singleElementCompare(element, undefined, index, true). 'arrayOnly' rejects scalar subjects. */ supportsArrayContaining?: boolean | 'arrayOnly'; /** The name of the matcher, for the error of a list matcher on one element with `'arrayOnly'` */ matcherName?: string; /** * - allowEmptyElements: an empty element set passes instead of failing (e.g. `.not.toExist()`) * - allowObjectExpectedValue: the expected value itself can be a plain object (e.g. styles), so for multi-remote a plain * object is always a literal and per-instance values require `expect.multiRemote()` */ strictConfiguration?: { allowEmptyElements?: boolean; allowObjectExpectedValue?: boolean; }; }): Promise>>; type SingleElementCompare = (awaitedElement: WebdriverIO.Element, expectedValues: MaybeArray | undefined, index?: number, wholeList?: boolean) => Promise>; /** * Multiple element comparison strategy. * * Handles element arrays consistently: * - By default, if there is no element or an empty array, it returns a failure result. * - For a standard successful result, all elements must pass the compare strategy. * - For `.not` assertions, it ensures that all elements fail the compare strategy to pass. * * In rare cases (e.g., matchers using `isExisting`), the strategy can be configured via * `allowEmptyElements` to let an empty element set pass the assertion instead of failing. */ export declare const multipleElementResultsStrategy: (unresolvedElements: MaybeSomeWdioElementOrArrayMaybePromiseOrMultiRemoteElements | WdioMultiRemoteElements | unknown, expectedValues: MaybeArrayOrMultiRemoteValues | undefined, singleElementCompare: SingleElementCompare, { isNot, isSome, iteration, matcherName }: { isNot: boolean; isSome: boolean; iteration: number; matcherName?: string; }, { allowEmptyElements, allowObjectExpectedValue, listMatcherNeedsArray, listMatcherComparesList }?: { allowEmptyElements?: boolean | undefined; allowObjectExpectedValue?: boolean | undefined; listMatcherComparesList?: boolean | undefined; listMatcherNeedsArray?: boolean | undefined; }) => Promise>>; export {};