import { baseUniDriverFactory } from '../../utils/test-utils/unidriver';
import { dataHooks } from './constants';
const byDataHook = (dataHook) => `[data-hook="${dataHook}"]`;
export const circularProgressBarCoreUniDriverFactory = (base) => {
    const getValue = async () => {
        if (!(await base.exists())) {
            return null;
        }
        return base.$(byDataHook(dataHooks.progressIndicator)).text();
    };
    return {
        ...baseUniDriverFactory(base),
        isSuccessIconDisplayed: () => base.$(byDataHook(dataHooks.successIcon)).exists(),
        isErrorIconDisplayed: () => base.$(byDataHook(dataHooks.errorIcon)).exists(),
        isLabelDisplayed: () => base.$(byDataHook(dataHooks.label)).exists(),
        getLabelTextContent: () => base.$(byDataHook(dataHooks.label)).text(),
        isPercentagesProgressDisplayed: () => base.$(byDataHook(dataHooks.progressIndicator)).exists(),
        getValue: () => getValue(),
        isCompleted: async () => (await getValue()) === '100',
        hasError: async () => (await base.attr('data-error')) === 'true',
        getAttribute: async (name) => base.attr(name),
        isSingleElementRendered: async (dataHook) => (await base.$$(byDataHook(dataHook)).count()) === 1,
    };
};
//# sourceMappingURL=CircularProgressBarCore.uni.driver.js.map