2024-06-11 01:23:30 -07:00
|
|
|
type CyGetOptions = Parameters<(typeof cy)['get']>[1];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Getters
|
|
|
|
*/
|
|
|
|
export const successToast = () => cy.get('.el-notification:has(.el-notification--success)');
|
|
|
|
export const warningToast = () => cy.get('.el-notification:has(.el-notification--warning)');
|
|
|
|
export const errorToast = (options?: CyGetOptions) =>
|
|
|
|
cy.get('.el-notification:has(.el-notification--error)', options);
|
|
|
|
export const infoToast = () => cy.get('.el-notification:has(.el-notification--info)');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Actions
|
|
|
|
*/
|
|
|
|
export const clearNotifications = () => {
|
2025-02-20 07:35:15 -08:00
|
|
|
const notificationSelector = '.el-notification:has(.el-notification--success)';
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find(notificationSelector).length) {
|
2025-02-27 22:10:09 -08:00
|
|
|
cy.get(notificationSelector).each(($el) => {
|
|
|
|
if ($el.find('.el-notification__closeBtn').length) {
|
|
|
|
cy.wrap($el).find('.el-notification__closeBtn').click({ force: true });
|
|
|
|
}
|
|
|
|
});
|
2025-01-07 07:02:06 -08:00
|
|
|
}
|
|
|
|
});
|
2024-06-11 01:23:30 -07:00
|
|
|
};
|