wix-style-react
Version:
wix-style-react
38 lines • 1.63 kB
JavaScript
import { popoverUniDriverFactory } from '../Popover/Popover.uni.driver';
import { baseUniDriverFactory } from '../test-utils/utils/unidriver';
export const tooltipDriverFactory = (base, body) => {
const popoverDriver = popoverUniDriverFactory(base, body);
return {
...baseUniDriverFactory(base),
/** Clicks on the target element */
click: async () => popoverDriver.click(),
/** returns true if tooltip element exists on the DOM */
tooltipExists: async () => popoverDriver.isContentElementExists(),
/** mouse over the target element */
mouseEnter: async () => popoverDriver.mouseEnter(),
/** mouse leaves the target element */
mouseLeave: async () => popoverDriver.mouseLeave(),
/** clicks outside the tooltip target */
clickOutside: async () => popoverDriver.clickOutside(),
/** returns tooltips content value in string */
getTooltipText: async () => {
await popoverDriver.mouseEnter();
try {
const text = await (await popoverDriver.getContentElementUniDriver()).text();
// Clean yourself!
await popoverDriver.mouseLeave();
return text;
}
catch (e) {
return null;
}
},
/**
* Checks whether tooltip has a given size
* @param {boolean} sizeName The tooltip size
* @return {Promise<boolean>}
*/
hasSize: async (sizeName) => (await base.attr(`data-size`)) === sizeName,
};
};
//# sourceMappingURL=Tooltip.uni.driver.js.map