From 3dd728d25105cd0d96791a78b9a1d70e63a504a7 Mon Sep 17 00:00:00 2001 From: Patrick Burns Date: Sun, 7 Apr 2024 16:18:45 -0500 Subject: [PATCH] change notifications to alerts and only number login/verify since it sets a global flag --- cypress/e2e/3-new-account-notifications.cy.js | 91 ------------------- cypress/e2e/new-account-alerts.cy.js | 91 +++++++++++++++++++ 2 files changed, 91 insertions(+), 91 deletions(-) delete mode 100644 cypress/e2e/3-new-account-notifications.cy.js create mode 100644 cypress/e2e/new-account-alerts.cy.js diff --git a/cypress/e2e/3-new-account-notifications.cy.js b/cypress/e2e/3-new-account-notifications.cy.js deleted file mode 100644 index 1dba6566..00000000 --- a/cypress/e2e/3-new-account-notifications.cy.js +++ /dev/null @@ -1,91 +0,0 @@ -// Test suite for new account notifications within the application -describe("New account notifications", () => { - // Before each test, perform login operation. Assumes cy.login() is a custom command. - beforeEach(() => { - cy.login(); - }); - - // Notification messages expected to be seen by new accounts - const locationsNotificationMessage = - "You have no station locations. Go here to create it!"; - const logbookNotificationMessage = - "You have no station logbook. Go here to create it!"; - const activeStationNotificationMessage = - "Attention: you need to set an active station location."; - const noQSONotificationMessage = - "You have made no QSOs today; time to turn on the radio!"; - - // Test to verify the locations notification message and its link - it(`should show a "${locationsNotificationMessage}" notification with a valid link to create it`, () => { - // Verify notification visibility and class for urgency - cy.get("body") - .contains(locationsNotificationMessage) - .should("be.visible") - .and("have.class", "alert-danger"); - - // Validate the hyperlink's destination within the notification - cy.contains(locationsNotificationMessage).within(() => { - cy.get("a") - .contains("here") - .should("have.attr", "href") - .and("equal", "http://localhost/index.php/station"); - }); - }); - - // Test navigation to the station creation page via the notification link - it("should navigate to the station creation page after clicking the link in the notification", () => { - // Trigger click on the link within the notification message - cy.contains(locationsNotificationMessage).within(() => { - cy.get("a").contains("here").click(); - }); - - // Assert the correct page has been loaded by checking the URL - cy.url().should("include", "/station"); - }); - - // Test to verify the logbook notification message and its link - it(`should show a "${logbookNotificationMessage}" notification with a valid link to create it`, () => { - // Verify notification visibility and class for urgency - cy.get("body") - .contains(logbookNotificationMessage) - .should("be.visible") - .and("have.class", "alert-danger"); - - // Validate the hyperlink's destination within the notification - cy.contains(logbookNotificationMessage).within(() => { - cy.get("a") - .contains("here") - .should("have.attr", "href") - .and("equal", "http://localhost/index.php/logbooks"); - }); - }); - - // Test navigation to the logbook creation page via the notification link - it("should navigate to the logbook creation page after clicking the link in the notification", () => { - // Trigger click on the link within the notification message - cy.contains(logbookNotificationMessage).within(() => { - cy.get("a").contains("here").click(); - }); - - // Assert the correct page has been loaded by checking the URL - cy.url().should("include", "/logbooks"); - }); - - // Test to verify the active station notification is properly displayed - it(`should display an "${activeStationNotificationMessage}" notification`, () => { - // Verify notification visibility and class for urgency - cy.get("body") - .contains(activeStationNotificationMessage) - .should("be.visible") - .and("have.class", "alert-danger"); - }); - - // Test to verify the no QSO notification is properly displayed - it(`should display a "${noQSONotificationMessage}" notification`, () => { - // Verify notification visibility and class for importance - cy.get("body") - .contains(noQSONotificationMessage) - .should("be.visible") - .and("have.class", "alert-warning"); - }); -}); diff --git a/cypress/e2e/new-account-alerts.cy.js b/cypress/e2e/new-account-alerts.cy.js new file mode 100644 index 00000000..61f52ef9 --- /dev/null +++ b/cypress/e2e/new-account-alerts.cy.js @@ -0,0 +1,91 @@ +// Test suite for new account alerts within the application +describe("New account alerts", () => { + // Before each test, perform login operation. Assumes cy.login() is a custom command. + beforeEach(() => { + cy.login(); + }); + + // Alert messages expected to be seen by brand new accounts + const locationsAlertMessage = + "You have no station locations. Go here to create it!"; + const logbookAlertMessage = + "You have no station logbook. Go here to create it!"; + const activeStationAlertMessage = + "Attention: you need to set an active station location."; + const noQSOAlertMessage = + "You have made no QSOs today; time to turn on the radio!"; + + // Test to verify the locations alert message and its link + it(`should show a "${locationsAlertMessage}" alert with a valid link to create it`, () => { + // Verify alert visibility and class for urgency + cy.get("body") + .contains(locationsAlertMessage) + .should("be.visible") + .and("have.class", "alert-danger"); + + // Validate the hyperlink's destination within the alert + cy.contains(locationsAlertMessage).within(() => { + cy.get("a") + .contains("here") + .should("have.attr", "href") + .and("equal", "http://localhost/index.php/station"); + }); + }); + + // Test navigation to the station creation page via the alert link + it("should navigate to the station creation page after clicking the link in the alert", () => { + // Trigger click on the link within the alert message + cy.contains(locationsAlertMessage).within(() => { + cy.get("a").contains("here").click(); + }); + + // Assert the correct page has been loaded by checking the URL + cy.url().should("include", "/station"); + }); + + // Test to verify the logbook alert message and its link + it(`should show a "${logbookAlertMessage}" alert with a valid link to create it`, () => { + // Verify alert visibility and class for urgency + cy.get("body") + .contains(logbookAlertMessage) + .should("be.visible") + .and("have.class", "alert-danger"); + + // Validate the hyperlink's destination within the alert + cy.contains(logbookAlertMessage).within(() => { + cy.get("a") + .contains("here") + .should("have.attr", "href") + .and("equal", "http://localhost/index.php/logbooks"); + }); + }); + + // Test navigation to the logbook creation page via the alert link + it("should navigate to the logbook creation page after clicking the link in the alert", () => { + // Trigger click on the link within the alert message + cy.contains(logbookAlertMessage).within(() => { + cy.get("a").contains("here").click(); + }); + + // Assert the correct page has been loaded by checking the URL + cy.url().should("include", "/logbooks"); + }); + + // Test to verify the active station alert is properly displayed + it(`should display an "${activeStationAlertMessage}" alert`, () => { + // Verify alert visibility and class for urgency + cy.get("body") + .contains(activeStationAlertMessage) + .should("be.visible") + .and("have.class", "alert-danger"); + }); + + // Test to verify the no QSO alert is properly displayed + it(`should display a "${noQSOAlertMessage}" alert`, () => { + // Verify alert visibility and class for importance + cy.get("body") + .contains(noQSOAlertMessage) + .should("be.visible") + .and("have.class", "alert-warning"); + }); +});