/// <reference types="./types/expect-webdriverio.d.ts"/>

/**
 * Augment the Jest namespace to include the WebDriverIO custom matchers only.
 * When Jest Library is used, specify `expect-webdriverio/jest` for this file in the tsconfig.json's types.
 */

declare namespace jest {

    interface Matchers<R extends void | Promise<void>, T> extends ExpectWebdriverIO.Matchers<R, T> {

        /**
         * Below are overloaded Jest's matchers not part of `expect` but of `jest-snapshot`.
         * @see https://github.com/jestjs/jest/blob/73dbef5d2d3195a1e55fb254c54cce70d3036252/packages/jest-snapshot/src/types.ts#L37
         *
         *  Note: We need to define them below so that they are correctly overloaded.
         *  Else even when extending `WdioJestOverloadedMatchers` we have typing errors.
         */

        /**
         * snapshot matcher
         * @param label optional snapshot label
         */
        toMatchSnapshot(label?: string): T extends WdioElementOrPromiseLike ? Promise<void> : R;

        /**
         * inline snapshot matcher
         * @param snapshot snapshot string (autogenerated if not specified)
         * @param label optional snapshot label
         */
        toMatchInlineSnapshot(snapshot?: string, label?: string): T extends WdioElementOrPromiseLike ? Promise<void> : R;
    }

    interface Expect extends ExpectWebdriverIO.Expect {}

    interface InverseAsymmetricMatchers extends ExpectWebdriverIO.AsymmetricMatchers {}
}
