import { tooltipDriverFactory } from '../Tooltip/Tooltip.uni.driver';
import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
import { dataHooks } from './constants';
import { circularProgressBarCoreUniDriverFactory } from './CircularProgressBarCore/CircularProgressBarCore.uni.driver';
export const circularProgressBarDriverFactory = (base, body) => {
    const tooltip = base.$(`[data-hook="${dataHooks.tooltip}"]`);
    const createTooltipDriver = () => tooltipDriverFactory(tooltip, body);
    const coreProgressBarDriver = circularProgressBarCoreUniDriverFactory(base);
    const errorIcon = base => base.$(`[data-hook=${dataHooks.errorIcon}]`);
    const successIcon = base => base.$(`[data-hook=${dataHooks.successIcon}]`);
    const progressBar = base => base.$(`[data-hook=${dataHooks.circularProgressBar}]`);
    const getTooltip = () => createTooltipDriver();
    return {
        ...baseUniDriverFactory(base),
        /**
         * Checks whether the success icon is displayed
         * @returns {Promise<boolean>}
         * */
        isSuccessIconDisplayed: coreProgressBarDriver.isSuccessIconDisplayed,
        /**
         * Checks whether the error icon is displayed
         * @returns {Promise<boolean>}
         * */
        isErrorIconDisplayed: coreProgressBarDriver.isErrorIconDisplayed,
        /**
         * Checks whether the label text is displayed
         * @returns {Promise<boolean>}
         * */
        isLabelDisplayed: coreProgressBarDriver.isLabelDisplayed,
        /**
         * Gets the text content displayed
         * @returns {Promise<string>}
         */
        getLabelTextContent: coreProgressBarDriver.getLabelTextContent,
        /**
         * Checks whether the progress percentages are displayed
         * @returns {Promise<boolean>}
         */
        isPercentagesProgressDisplayed: coreProgressBarDriver.isPercentagesProgressDisplayed,
        /**
         * Gets the progress percentages value
         * @returns {Promise<string>}
         */
        getValue: coreProgressBarDriver.getValue,
        /**
         * Checks whether the progress completed (value is 100)
         * @returns {Promise<boolean>}
         */
        isCompleted: coreProgressBarDriver.isCompleted,
        /**
         * Checks whether an error occurred
         * @returns {Promise<boolean>}
         */
        hasError: coreProgressBarDriver.hasError,
        /**
         * Checks whether error icon is shown
         * @returns {Promise<boolean>}
         * */
        isErrorIconShown: () => errorIcon(base).exists(),
        /**
         * Checks whether success icon is shown
         * @returns {Promise<boolean>}
         * */
        isSuccessIconShown: () => successIcon(base).exists(),
        /**
         * Gets size.
         * @returns {Promise<string>}
         * */
        getSize: () => progressBar(base).attr('data-size'),
        /**
         * Gets the tooltip error message
         * @returns {Promise<string>}
         * */
        getTooltipErrorMessage: () => getTooltip().getTooltipText(),
        /**
         * Checks whether progress bar has a given skin
         * @param {string} skinName The progress bar skin
         * @return {Promise<boolean>}
         */
        hasSkin: async (skinName) => (await progressBar(base).attr(`data-skin`)) === skinName,
    };
};
//# sourceMappingURL=CircularProgressBar.uni.driver.js.map