Skip to content

Commit

Permalink
fix-close notification cypress command
Browse files Browse the repository at this point in the history
  • Loading branch information
nilay-v3rma committed Dec 26, 2024
1 parent fc2efc2 commit 7007e04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 2 additions & 5 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
3 changes: 0 additions & 3 deletions src/Utils/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

Expand Down

0 comments on commit 7007e04

Please sign in to comment.