UNPKG

@payfit/unity-components

Version:

37 lines (36 loc) 1.63 kB
import { IntlShape } from 'react-intl'; import { PlayCtx } from '../../types/testing.js'; import { UnityToastProps } from './UnityToast.js'; /** * Factory function returning a set of helpers to test Unity Toast components. * It wires Storybook's `Play` context with convenient utilities to query, * assert, and interact with toasts rendered on the canvas. * @param context The Storybook play context used to group steps and actions. * @returns An object of helpers: `getToast`, `closeToast`, `checkIfTextExistsInToast`, and `triggerToastAction`. */ export declare const getTestingUtilsToast: (context: PlayCtx, globalIntl: IntlShape) => { findToast: (variant: UnityToastProps["variant"]) => Promise<HTMLElement>; findAllToasts: (variant?: UnityToastProps["variant"]) => Promise<HTMLElement[]>; getToastContainer: () => HTMLElement; closeAllToasts: () => Promise<void>; closeToast: ({ variant, toast, }: { variant: UnityToastProps["variant"]; toast?: HTMLElement; }) => Promise<void>; triggerToastAction: ({ variant, action, closeAtEnd, }: { variant: UnityToastProps["variant"]; action: string; closeAtEnd?: boolean; }) => Promise<void>; assertTextExistsInToast: ({ variant, content, title, closeAtEnd, }: { variant: UnityToastProps["variant"]; title?: string; content?: string; closeAtEnd?: boolean; }) => Promise<void>; assertToastNotInDocument: ({ variant, title, content, }: { variant: UnityToastProps["variant"]; title?: string; content?: string; }) => Promise<void>; };