From 7007e04ece0705ff73370abb6dd07d94f79539dc Mon Sep 17 00:00:00 2001 From: Nilay <23110219@iitgn.ac.in> Date: Thu, 26 Dec 2024 12:15:34 +0530 Subject: [PATCH] fix-close notification cypress command --- cypress/support/commands.ts | 7 ++----- src/Utils/Notifications.js | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index c3e94190253..b0890c8475e 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -225,11 +225,8 @@ Cypress.Commands.add("preventPrint", () => { }); Cypress.Commands.add("closeNotification", () => { - cy.get("li[data-sonner-toast] div[data-title]") - .should("exist") - .each(($div) => { - cy.wrap($div).click({ force: true }); - }); + cy.wait(5000); //wait for the notification to disappear + cy.get("li[data-sonner-toast]").should("not.exist"); // Ensure the toast is removed from the DOM }); Cypress.Commands.add("verifyContentPresence", (selector, texts) => { diff --git a/src/Utils/Notifications.js b/src/Utils/Notifications.js index 26fd54f7ea0..1cf8dd8d42f 100644 --- a/src/Utils/Notifications.js +++ b/src/Utils/Notifications.js @@ -43,10 +43,7 @@ const notifyError = (error) => { toast.error(errorMsg, { duration: 5000 }); }; -/** Close all Notifications (Sonner doesn't need this but can be kept for custom implementations) **/ export const closeAllNotifications = () => { - // Sonner doesn't require a close method, but you can manage this with custom logic if needed - // Example: toast.dismiss() could be used to close all toasts if necessary. toast.dismiss(); };