@payfit/unity-components
Version:
35 lines (34 loc) • 1.53 kB
TypeScript
import { IntlShape } from 'react-intl';
import { PlayCtx } from '../../types/testing.js';
/**
* Factory function returning a set of helpers to test Unity Dialog components.
* It wires Storybook's `Play` context with convenient utilities to query,
* assert, and interact with dialogs rendered on the canvas.
* @param context The Storybook play context used to group steps and actions.
* @param globalIntl The global intl instance to use for localization.
* @returns An object of helpers: `findDialog`, `closeDialog`, `assertDialogIsClosed`, `assertElementExistsInDialog`, and `triggerPrimaryAction`.
*/
export declare const getTestingUtilsDialog: (context: PlayCtx, globalIntl: IntlShape) => {
findDialog: ({ title }: {
title: string;
}) => Promise<HTMLElement>;
closeDialog: ({ title, closeButtonLabel, }: {
title: string;
closeButtonLabel: string;
}) => Promise<void>;
closeDialogWithDismissButton: ({ title, dismissButtonLabel, }: {
title: string;
dismissButtonLabel?: string;
}) => Promise<void>;
assertDialogIsClosed: (dialog: HTMLElement) => Promise<void>;
assertElementExistsInDialog: ({ title, content, primaryActionLabel, secondaryActionLabel, }: {
title: string;
content?: string;
primaryActionLabel?: string;
secondaryActionLabel?: string;
}) => Promise<void>;
triggerPrimaryAction: ({ title, primaryActionLabel, }: {
title: string;
primaryActionLabel: string;
}) => Promise<void>;
};