import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
import { tabsUniDriverFactory } from '../Tabs/Tabs.uni.driver';
import { DataHooks } from './constants';
export const colorPickerUniDriverFactory = base => {
    const getConverterDriver = () => tabsUniDriverFactory(base.$(`[data-hook="${DataHooks.converter}"]`));
    return {
        ...baseUniDriverFactory(base),
        /**
         * Clicks the confirm button
         * @returns {Promise<Void>}
         * */
        confirm: async () => base.$(`[data-hook="${DataHooks.confirmButton}"]`).click(),
        /**
         * Clicks the cancel button
         * @returns {Promise<Void>}
         * */
        cancel: async () => base.$(`[data-hook="${DataHooks.cancelButton}"]`).click(),
        /**
         * Clicks the previous color selection
         * @returns {Promise<Void>}
         */
        clickOnPreviousColor: async () => base.$(`[data-hook="${DataHooks.historyPrevious}"]`).click(),
        /**
         * Checks whether the history panel exists
         * @returns {Promise<boolean>}
         */
        historyPanelExists: async () => base.$(`[data-hook="${DataHooks.history}"]`).exists(),
        /**
         * Gets the current selected color
         * @returns {Promise<string>}
         */
        historyCurrentColor: async () => (await base.$(`[data-hook="${DataHooks.historyCurrent}"]`)._prop('style'))
            .background,
        /**
         * Gets the previous color selected
         * @returns {Promise<string>}
         */
        historyPreviousColor: async () => (await base
            .$(`[data-hook="${DataHooks.historyPrevious}"]`)
            ._prop('style')).background,
        /**
         * Clicks the add new color button
         * @returns {Promise<Void>}
         */
        clickAddColor: async () => base.$(`[data-hook=${DataHooks.addColor}]`).click(),
        /**
         * Clicks on RGB tab
         * @returns {Promise<Void>}
         */
        selectRgbTab: async () => getConverterDriver().clickTabAt(1),
        /**
         * Clicks on HSB tab
         * @returns {Promise<Void>}
         */
        selectHsbTab: async () => getConverterDriver().clickTabAt(2),
        /**
         * Checks whether the converter tabs exist
         * @returns {Promise<boolean>}
         */
        hasConverter: async () => {
            return getConverterDriver().exists();
        },
        /**
         * Checks whether the eye dropper button exists
         * @returns {Promise<boolean>}
         */
        eyeDropperExists: async () => base.$(`[data-hook="${DataHooks.eyeDropper}"]`).exists(),
    };
};
export default colorPickerUniDriverFactory;
//# sourceMappingURL=ColorPicker.uni.driver.js.map