wix-style-react
Version:
wix-style-react
21 lines • 1.14 kB
JavaScript
import { baseUniDriverFactory } from '../test-utils/utils/unidriver';
const toastItemDriver = (item) => ({
getStatus: () => item.attr('data-status'),
getContent: () => item.$('[data-hook="toast-text"]').text(),
isDismissExists: () => item.$('[data-hook="dismiss-button"]').exists(),
clickOnDismiss: () => item.$('[data-hook="dismiss-button"]').click(),
isActionExists: () => item.$('[data-hook="action-button"]').exists(),
getActionTitle: () => item.$('[data-hook="action-button"]').text(),
getActionHref: () => item.$('[data-hook="action-button"]').attr('href'),
clickOnAction: () => item.$('[data-hook="action-button"]').click(),
});
export const toastDriverFactory = (base) => {
const getToastItems = () => base.$$('[data-hook*="toast-item"]');
return {
...baseUniDriverFactory(base),
getItems: async () => getToastItems().map(async (item) => toastItemDriver(item)),
getItemsCount: async () => getToastItems().count(),
getItemByDataHook: async (dataHook) => toastItemDriver(base.$(`[data-hook*="${dataHook}"]`)),
};
};
//# sourceMappingURL=Toast.uni.driver.js.map