import EventEmitter from "events";
import { ActionPayload } from "../../src/dispatcher/payloads";
import { DispatcherAction } from "../../src/dispatcher/actions";
export declare const emitPromise: (e: EventEmitter, k: string | symbol) => Promise<unknown>;
/**
 * Waits for a certain payload to be dispatched.
 * @param waitForAction The action string to wait for or the callback which is invoked for every dispatch. If this returns true, stops waiting.
 * @param timeout The max time to wait before giving up and stop waiting. If 0, no timeout.
 * @param dispatcher The dispatcher to listen on.
 * @returns A promise which resolves when the callback returns true. Resolves with the payload that made it stop waiting.
 * Rejects when the timeout is reached.
 */
export declare function untilDispatch(waitForAction: DispatcherAction | ((payload: ActionPayload) => boolean), dispatcher?: import("../../src/dispatcher/dispatcher").MatrixDispatcher, timeout?: number): Promise<ActionPayload>;
/**
 * Waits for a certain event to be emitted.
 * @param emitter The EventEmitter to listen on.
 * @param eventName The event string to wait for.
 * @param check Optional function which is invoked when the event fires. If this returns true, stops waiting.
 * @param timeout The max time to wait before giving up and stop waiting. If 0, no timeout.
 * @returns A promise which resolves when the callback returns true or when the event is emitted if
 * no callback is provided. Rejects when the timeout is reached.
 */
export declare function untilEmission(emitter: EventEmitter, eventName: string, check?: (...args: any[]) => boolean, timeout?: number): Promise<void>;
export declare const flushPromises: () => Promise<void>;
export declare const flushPromisesWithFakeTimers: () => Promise<void>;
/**
 * Call fn before calling componentDidUpdate on a react component instance, inst.
 * @param {React.Component} inst an instance of a React component.
 * @param {number} updates Number of updates to wait for. (Defaults to 1.)
 * @returns {Promise} promise that resolves when componentDidUpdate is called on
 *                    given component instance.
 */
export declare function waitForUpdate(inst: React.Component, updates?: number): Promise<void>;
/**
 * Advance jests fake timers and Date.now mock by ms
 * Useful for testing code using timeouts or intervals
 * that also checks timestamps
 */
export declare const advanceDateAndTime: (ms: number) => void;
/**
 * A horrible hack necessary to wait enough time to ensure any modal is shown after a
 * `Modal.createDialog(...)` call. We have to contend with the Modal code which renders
 * things asyncronhously and has weird sleeps which we should strive to remove.
 */
export declare const waitEnoughCyclesForModal: ({ useFakeTimers, }?: {
    useFakeTimers?: boolean;
}) => Promise<void>;
/**
 * A horrible hack necessary to make sure modals don't leak and pollute tests.
 * `@testing-library/react` automatic cleanup function does not pick up the async modal
 * rendering and the modals don't unmount when the component unmounts. We should strive
 * to fix this.
 */
export declare const clearAllModals: () => Promise<void>;
/** Install a stub object at `navigator.mediaDevices` */
export declare function useMockMediaDevices(): void;
/**
 * Clean up the JSDOM after each test.
 *
 * Registers `beforeEach` and `afterEach` functions which will deregister any event listeners and timers from the
 * `window` and `document` objects.
 *
 * Also clears out `localStorage` and `sessionStorage`.
 */
export declare function resetJsDomAfterEach(): void;
