import { baseUniDriverFactory } from '../../unidriver';
import { ButtonUniDriver, TextButtonUniDriver, } from '@wix/design-system/dist/testkit/unidriver';
export default (base, body) => {
    const tryAgainButton = () => TextButtonUniDriver(base.$(`[data-hook="error-card-state-action-button"]`), body);
    const stepCta = (id) => ButtonUniDriver(base.$(`[data-hook="setup-step-cta-${id}"]`), body);
    return {
        /** Widget title text. */
        getTitle: () => base.$(`[data-hook="setup-widget-title"]`).text(),
        /** "X/Y completed" progress label text. */
        getProgressLabel: () => base.$(`[data-hook="setup-widget-progress"]`).text(),
        /** Titles of all rendered steps, in order. */
        getStepTitles: () => base.$$(`[data-hook^="setup-step-title-"]`).map((el) => el.text()),
        /** Whether a given step row/card is rendered. */
        stepExists: (id) => base.$(`[data-hook="setup-step-${id}"]`).exists(),
        /** Click a step's row/card (triggers inline toggle or navigate). */
        clickStep: (id) => base.$(`[data-hook="setup-step-${id}"]`).click(),
        /** Click a step's CTA button. */
        clickStepCta: (id) => stepCta(id).click(),
        /** Whether a step's CTA is rendered. */
        stepCtaExists: (id) => base.$(`[data-hook="setup-step-cta-${id}"]`).exists(),
        /** Whether a disabled step's permission tooltip wraps its CTA. */
        disabledTooltipExists: (id) => base.$(`[data-hook="setup-step-disabled-tooltip-${id}"]`).exists(),
        /** Whether a step's inline-expansion content is shown. */
        isStepExpanded: (id) => base.$(`[data-hook="setup-step-content-${id}"]`).exists(),
        /** Whether an aggregated group's children are shown. */
        isGroupExpanded: (id) => base.$(`[data-hook="setup-step-children-${id}"]`).exists(),
        /** Click an arbitrary element by data-hook within the widget. */
        clickByDataHook: (dataHook) => base.$(`[data-hook="${dataHook}"]`).click(),
        /** Whether the all-complete success surface is shown. */
        isAllComplete: () => base.$(`[data-hook="setup-all-complete"]`).exists(),
        /** Whether the loading skeleton is shown. */
        isLoading: () => base.$(`[data-hook="setup-widget-skeleton"]`).exists(),
        /** Whether the error state is shown. */
        isError: () => base.$(`[data-hook="error-card-state"]`).exists(),
        /** Click the error state's "try again" button (refetches). */
        clickTryAgain: () => tryAgainButton().click(),
        ...baseUniDriverFactory(base),
    };
};
//# sourceMappingURL=SetupWidget.uni.driver.js.map