@payfit/unity-components
Version:
34 lines (33 loc) • 1.54 kB
TypeScript
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 closeButtonLabel Optional translated label for the dialog close button. Unity's label is used by default.
* @returns An object of helpers: `findDialog`, `closeDialog`, `assertDialogIsClosed`, `assertElementExistsInDialog`, and `triggerPrimaryAction`.
*/
export declare const getTestingUtilsDialog: (context: PlayCtx, closeButtonLabel?: string) => {
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>;
};