wix-style-react
Version:
34 lines (29 loc) • 1 kB
JavaScript
import { baseUniDriverFactory, findByHook } from '../../test/utils/unidriver';
import { dataHooks } from './constants';
import { textUniDriverFactory } from '../Text/Text.uni.driver';
export const cardFolderTabsDriverFactory = base => {
const getButtonById = id => findByHook(base, dataHooks.tabButton(id));
const getTabTextById = id =>
textUniDriverFactory(findByHook(base, dataHooks.tabText(id)));
return {
...baseUniDriverFactory(base),
/**
* Checks whether tab is disabled by id
* @param {string} tabId
* @return {Promise<boolean>}
*/
isTabDisabledById: async tabId =>
(await getButtonById(tabId).attr('disabled')) !== null,
/**
* Selects tab by tab by id
* @param {string} tabId
* @return {Promise<void>}
*/
selectTabById: async tabId => (await getButtonById(tabId)).click(),
/**
* Return tab text size
* @return {Promise<string>}
*/
getSize: tabId => getTabTextById(tabId).getSize(),
};
};