import { UniDriver } from '@wix/wix-ui-test-utils/unidriver'; import { ButtonUniDriver, TooltipUniDriver, PopoverMenuUniDriver, } from '@wix/design-system/dist/testkit/unidriver'; import { baseUniDriverFactory } from '../../unidriver'; export function BulkActionToolbarUniDriver(base: UniDriver, body: UniDriver) { const button = (dataHook = 'bulk-action-button') => ButtonUniDriver(base.$(`[data-hook="${dataHook}"]`), body); const tooltip = TooltipUniDriver( base.$('[data-hook="bulk-action-button-tooltip"]'), body, ); const popover = (dataHook?: string) => PopoverMenuUniDriver(base.$(`[data-hook="${dataHook}"]`), body); return { ...baseUniDriverFactory(base), getButton: (dataHook?: string) => button(dataHook), clickButton: (dataHook?: string) => button(dataHook).click(), isButtonExists: (dataHook?: string) => button(dataHook).exists(), isButtonDisabled: (dataHook?: string) => button(dataHook).isButtonDisabled(), getButtonTextContent: (dataHook?: string) => button(dataHook).getButtonTextContent(), getPopover: (dataHook?: string) => popover(dataHook), isPopoverExists: (dataHook?: string) => popover(dataHook).exists(), isTooltipExists: tooltip.exists, getTooltipText: tooltip.getTooltipText, clickOutsideTooltip: tooltip.clickOutside, getSelectedCountText: () => base.$('[data-hook="selected-count"]').text(), }; }