From c715a462d9b660666205364f7bf6382eeab296ee Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Wed, 21 Jun 2023 14:44:20 +0200 Subject: [PATCH] Delete notifications before test --- cypress/e2e/notifications.cy.js | 7 +++---- .../vbv_lernwelt/core/management/commands/cypress_reset.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/notifications.cy.js b/cypress/e2e/notifications.cy.js index ca32fd86..2dd45713 100644 --- a/cypress/e2e/notifications.cy.js +++ b/cypress/e2e/notifications.cy.js @@ -9,7 +9,6 @@ describe("notification list page", () => { it("can paginate notifications", () => { login("admin", "test"); cy.visit("/notifications"); - cy.wait(2000); cy.get('[data-cy="no-notifications"]').should("not.exist"); cy.get("[data-cy^=notification-idx-]").should("have.length", 7); @@ -22,7 +21,7 @@ describe("notification list page", () => { // We load additional 7 notifications cy.get('[data-cy="load-more-notifications"]').click(); - cy.get("[data-cy^=notification-idx-]").should("have.length", 14); + cy.get("[data-cy^=notification-idx-]").should("have.length", 13); for (let i = 0; i < 7; i++) { cy.get(`[data-cy=notification-idx-${i}]`).within(() => { @@ -65,7 +64,6 @@ describe("notification popover", () => { it("displays four notifications", () => { login("admin", "test"); cy.visit("/"); - cy.wait(1000); toggleNotificationPopover(); cy.get("[data-cy^=notification-idx-]").should("have.length", 4); @@ -74,7 +72,6 @@ describe("notification popover", () => { it("can show all notifications", () => { login("admin", "test"); cy.visit("/"); - cy.wait(1000); toggleNotificationPopover(); cy.get('[data-cy="show-all-notifications"]').click({ force: true }); @@ -111,6 +108,7 @@ describe("email notification settings", () => { cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').click(); cy.get('[data-cy="it-checkbox-INFORMATION"]').click(); + cy.wait(500); cy.reload(); cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').should( "have.class", @@ -128,6 +126,7 @@ describe("email notification settings", () => { cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').click(); cy.get('[data-cy="it-checkbox-INFORMATION"]').click(); + cy.wait(500); cy.reload(); cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').should( "have.class", diff --git a/server/vbv_lernwelt/core/management/commands/cypress_reset.py b/server/vbv_lernwelt/core/management/commands/cypress_reset.py index 1c6507ad..9d1ad15d 100644 --- a/server/vbv_lernwelt/core/management/commands/cypress_reset.py +++ b/server/vbv_lernwelt/core/management/commands/cypress_reset.py @@ -22,7 +22,7 @@ from vbv_lernwelt.notify.models import Notification def command(create_completion): print("cypress reset data") CourseCompletion.objects.all().delete() - Notification.objects.all().mark_all_as_deleted() + Notification.objects.all().delete() AssignmentCompletion.objects.all().delete() User.objects.all().update(language="de") User.objects.all().update(additional_json_data={})