@wix/design-system
Version:
@wix/design-system
64 lines • 2.65 kB
JavaScript
import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
import { dataHooks } from './constants';
export const floatingNotificationDriverFactory = (base) => {
const getByDataHook = (dataHook) => base.$(`[data-hook="${dataHook}"]`);
const notificationButton = getByDataHook(dataHooks.button);
const notificationTextButton = getByDataHook(dataHooks.textButton);
const notificationCloseButton = getByDataHook(dataHooks.closeButton);
const notificationText = getByDataHook(dataHooks.notificationText);
return {
...baseUniDriverFactory(base),
/**
* Clicks notification button.
*/
clickButton: async () => notificationButton.click(),
/**
* Get the notification button's text.
*/
getButtonLabel: async () => notificationButton.text(),
/**
* Clicks the notification text button.
*/
clickTextButton: async () => notificationTextButton.click(),
/**
* Get the notification text button's text
*/
getTextButtonLabel: async () => notificationTextButton.text(),
/** Clicks the notification close button
*/
clickCloseButton: async () => notificationCloseButton.click(),
/**
* Get the notification text.
*/
getText: async () => notificationText.text(),
/**
* Checks whether button with passed tag name exists.
* @param as Tag name
*/
isButtonAs: async (as) => await base.$(`${as}[data-hook="${dataHooks.button}"]`).exists(),
/**
* Get the notification button href attribute's value.
*/
getButtonHref: async () => notificationButton.attr('href'),
/**
* Get the notification button attribute's value by name.
* @param attrName Attribute name
*/
getButtonAttr: async (attrName) => notificationButton.attr(attrName),
/**
* Checks whether text button with passed tag name exists.
* @param as Tag name
*/
isTextButtonAs: async (as) => await base.$(`${as}[data-hook="${dataHooks.textButton}"]`).exists(),
/**
* Get the notification text button href attribute's value.
*/
getTextButtonHref: async () => notificationTextButton.attr('href'),
/**
* Get the notification text button attribute's value by name.
* @param attrName Attribute name
*/
getTextButtonAttr: async (attrName) => notificationTextButton.attr(attrName),
};
};
//# sourceMappingURL=FloatingNotification.uni.driver.js.map