From 81cc16ca82cae3f64849358f83e8e572b664ea7b Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Tue, 4 Aug 2026 13:30:46 -0700 Subject: [PATCH 01/16] tests: part way through 1st scenario --- .../morbidityReportManagement.feature | 29 +++++++++++++++++++ .../cypress/e2e/pages/eventsTab.page.js | 4 +++ .../pages/nbs-classic/morbidityReportPage.js | 4 +-- .../step_definitions/patient.profile.step.js | 5 ++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature new file mode 100644 index 0000000000..c8eea82a0b --- /dev/null +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -0,0 +1,29 @@ +Feature: Patient File - Event Management - Morbidity Report + + Background: + Given I am logged in as secure user + And the user navigate to the patient profile page for "63000" + And Click Events tab on Patient Profile Page + + Scenario: Add new morbidity report without investigation + When user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I select "No" from the Pregnant dropdown menu + + # Scenario: Add new morbidity report and create investigation + + # Scenario: Cancel creation of a new morbidity report + + # Scenario: Edit existing morbidity report + + # Scenario: Print morbidity report + + # Scenario: Transfer ownership of morbidity report + # Scenario: Create investigation from morbidity report + # Scenario: Associate investigation from morbidity report + # Scenario: Mark morbidity report as reviewed + # Scenario: Mark morbidity report as reviewed - STD + # Scenario: Delete morbidity report \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index cf8eb62622..5374701533 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -46,6 +46,10 @@ class EventsTabPage { }); }) } + + clickEventsTabButton(buttonValue) { + cy.get('button').contains(buttonValue).click(); + } } export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index 8a16059014..95618a0fe5 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -4,7 +4,7 @@ class MorbidityReportPage { reportInformationTab = "font.boldNineYellow"; conditionField = 'input[name="conditionCd_textbox"]'; jurisdictionField = - 'input[name="morbidityReport.theObservationDT.jurisdictionCd_textbox"]'; + 'select[fieldlabel="Jurisdiction"][name="morbidityReport.theObservationDT.jurisdictionCd"]'; morbidityDateField = "#morbidityReport\\.theObservationDT\\.activityToTime_s"; facilityProviderField = 'input[name="entity-codeLookupText-Org-ReportingOrganizationUID"]'; @@ -38,7 +38,7 @@ class MorbidityReportPage { } selectJurisdiction(jurisdiction) { - cy.get(this.jurisdictionField).type(jurisdiction).type("{enter}"); + cy.get(this.jurisdictionField).select(jurisdiction, {force: true}); } clearJurisdiction() { diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index a58b42253e..a457003f10 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -1,5 +1,6 @@ import { Given, When, Then } from "@badeball/cypress-cucumber-preprocessor"; import PatientProfilePage from "cypress/e2e/pages/patientProfile.page"; +import eventsTabPage from "cypress/e2e/pages/eventsTab.page"; Then("I explor the patient profile", () => { PatientProfilePage.navigatePatinet() @@ -31,4 +32,8 @@ Then("I add invstigation - Amebiassis of patient", () => { Then("I add invstigation - Anaplasma phagocytophilum of patient", () => { PatientProfilePage.addPatientInvestigations_AnaplasmaPhagocytophilum() +}); + +When("user clicks on the {string} button within the Events tab", (buttonValue) => { + eventsTabPage.clickEventsTabButton(buttonValue); }); \ No newline at end of file From abf80e08006fc351189a17a9e39418f9598b2616 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Tue, 4 Aug 2026 14:01:23 -0700 Subject: [PATCH 02/16] tests: verifies morbidity report count increased by 1 --- .../morbidityReportManagement.feature | 7 +++- .../cypress/e2e/pages/eventsTab.page.js | 36 ++++++++++++++++++- .../pages/nbs-classic/morbidityReportPage.js | 5 +++ .../nbs-classic/dataEntry.steps.js | 6 ++++ .../step_definitions/patient.profile.step.js | 10 +++++- 5 files changed, 61 insertions(+), 3 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index c8eea82a0b..5014b3c7f6 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -6,12 +6,17 @@ Feature: Patient File - Event Management - Morbidity Report And Click Events tab on Patient Profile Page Scenario: Add new morbidity report without investigation - When user clicks on the "Add morbidity report" button within the Events tab + When I check the current count of morbidity reports in the Events tab + And user clicks on the "Add morbidity report" button within the Events tab And I select "Botulism, foodborne" from the Condition dropdown menu And I select "Cobb County" from the Jurisdiction dropdown menu And I enter the current date in the Date of Morbidity Report field And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button And I select "No" from the Pregnant dropdown menu + And I click the Submit button + And Click Events tab on Patient Profile Page + Then the morbidity report count should increase by 1 in the Events tab # Scenario: Add new morbidity report and create investigation diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 5374701533..e69f61ecd7 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -47,9 +47,43 @@ class EventsTabPage { }) } - clickEventsTabButton(buttonValue) { + clickAddButton(buttonValue) { cy.get('button').contains(buttonValue).click(); } + + getMorbidityReportCount() { + // Wait for spinner to disappear + cy.get('._indicator_1vvtd_1', { timeout: 15000 }) + .should('not.exist'); + + cy.get('div._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') + .eq(2) + .invoke('text') + .then(text => { + const count = parseInt(text.trim()); + Cypress.env('morbidityReportCount', count); + cy.log(`Saved morbidity report count: ${count}`); + }); + } + + verifyMorbidityReportCountIncreased() { + // Wait for spinner to disappear before getting the count + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + // Now get the count and verify it increased + const initialCount = Cypress.env('morbidityReportCount'); + + cy.get('._title_r9t1e_16 ._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') + .eq(2) + .invoke('text') + .then(text => { + const newCount = parseInt(text.trim(), 10); + cy.log(`📊 Initial count: ${initialCount}, New count: ${newCount}`); + expect(newCount, `Morbidity report count should increase by 1`) + .to.equal(initialCount + 1); + }); + } } export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index 95618a0fe5..8b87e5e087 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -9,6 +9,7 @@ class MorbidityReportPage { facilityProviderField = 'input[name="entity-codeLookupText-Org-ReportingOrganizationUID"]'; codeLookupButton = 'input[value="Code Lookup"]'; + pregnantDropdown = 'select[fieldlabel="Is Patient Pregnant"][validate="pregnantMale"]'; submitButton = "#Submit"; // Patient entry fields @@ -58,6 +59,10 @@ class MorbidityReportPage { cy.get(this.facilityProviderField).type(value); } + selectPregnant(value) { + cy.get(this.pregnantDropdown).select(value, { force: true }); + } + clickCodeLookup() { cy.get(this.codeLookupButton).first().click(); } diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index 5922947606..674a335e0e 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -105,6 +105,10 @@ When("I enter the current date in the Date of Morbidity Report field", () => { morbidityReportPage.enterMorbidityDate(today); }); +When("I select {string} from the Pregnant dropdown menu", (value) => { + morbidityReportPage.selectPregnant(value); +}); + When( "I enter {string} in the Facility and Provider Information field", (value) => { @@ -207,6 +211,8 @@ When("I enter patient first name {string} and last name {string}", (firstName, l morbidityReportPage.enterPatientBothNames(firstName, lastName); }); +When + // 6: Verification Steps When("I go to the Home page", () => { diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index a457003f10..9e299fbb5c 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -35,5 +35,13 @@ Then("I add invstigation - Anaplasma phagocytophilum of patient", () => { }); When("user clicks on the {string} button within the Events tab", (buttonValue) => { - eventsTabPage.clickEventsTabButton(buttonValue); + eventsTabPage.clickAddButton(buttonValue); +}); + +When("I check the current count of morbidity reports in the Events tab", () => { + eventsTabPage.getMorbidityReportCount(); +}); + +Then("the morbidity report count should increase by 1 in the Events tab", () => { + eventsTabPage.verifyMorbidityReportCountIncreased(); }); \ No newline at end of file From 8c01593c298935ae73f3dbf75ffb88c9aa17e12e Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 12:35:29 -0700 Subject: [PATCH 03/16] tests: abstract out report type count verification and finish investigation scenario --- .../morbidityReportManagement.feature | 19 ++++++++-- .../cypress/e2e/pages/eventsTab.page.js | 35 ++++++++++++++----- .../pages/nbs-classic/morbidityReportPage.js | 5 +++ .../nbs-classic/dataEntry.steps.js | 4 +++ .../step_definitions/patient.profile.step.js | 8 ++--- 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index 5014b3c7f6..81324ae9bf 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -6,7 +6,7 @@ Feature: Patient File - Event Management - Morbidity Report And Click Events tab on Patient Profile Page Scenario: Add new morbidity report without investigation - When I check the current count of morbidity reports in the Events tab + When I check the current count of "Morbidity reports" in the Events tab And user clicks on the "Add morbidity report" button within the Events tab And I select "Botulism, foodborne" from the Condition dropdown menu And I select "Cobb County" from the Jurisdiction dropdown menu @@ -16,9 +16,22 @@ Feature: Patient File - Event Management - Morbidity Report And I select "No" from the Pregnant dropdown menu And I click the Submit button And Click Events tab on Patient Profile Page - Then the morbidity report count should increase by 1 in the Events tab + Then the "Morbidity reports" count should increase by 1 in the Events tab - # Scenario: Add new morbidity report and create investigation + Scenario: Add new morbidity report and create investigation + When I check the current count of "Investigations" in the Events tab + And user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit and Create Investigation button + And I click the Submit button + And user clicks the "View File" link, the user is returned to Patient profile summary page + And Click Events tab on Patient Profile Page + Then the "Investigations" count should increase by 1 in the Events tab # Scenario: Cancel creation of a new morbidity report diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index e69f61ecd7..0667bdac4d 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -3,6 +3,18 @@ class EventsTabPage { return "section"; } + reportTypeIndexMap = { + "Investigations": 0, + "Lab reports": 1, + "Morbidity reports": 2, + "Vaccinations": 3, + "Birth records": 4, + "Treatments": 5, + "Documents": 6, + "Contacts named by patient": 7, + "Patient named by contacts": 8, + }; + selectMultipleInvestigations() { const conditionText = "Acanthamoeba Disease (Excluding Keratitis)"; const conditionColumnIndex = 3; @@ -51,39 +63,44 @@ class EventsTabPage { cy.get('button').contains(buttonValue).click(); } - getMorbidityReportCount() { + getReportCount(ReportType) { + const reportIndex = this.reportTypeIndexMap[ReportType]; + // Wait for spinner to disappear cy.get('._indicator_1vvtd_1', { timeout: 15000 }) .should('not.exist'); cy.get('div._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') - .eq(2) + .eq(reportIndex) .invoke('text') .then(text => { const count = parseInt(text.trim()); - Cypress.env('morbidityReportCount', count); - cy.log(`Saved morbidity report count: ${count}`); + Cypress.env('reportCount', count); + cy.log(`Saved report count: ${count}`); }); } - verifyMorbidityReportCountIncreased() { + verifyReportCountIncreased(ReportType) { + const reportIndex = this.reportTypeIndexMap[ReportType]; + // Wait for spinner to disappear before getting the count cy.get('._indicator_1vvtd_1', { timeout: 10000 }) .should('not.exist'); // Now get the count and verify it increased - const initialCount = Cypress.env('morbidityReportCount'); + const initialCount = Cypress.env('reportCount'); cy.get('._title_r9t1e_16 ._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') - .eq(2) + .eq(reportIndex) .invoke('text') .then(text => { const newCount = parseInt(text.trim(), 10); - cy.log(`📊 Initial count: ${initialCount}, New count: ${newCount}`); - expect(newCount, `Morbidity report count should increase by 1`) + cy.log(`Initial count: ${initialCount}, New count: ${newCount}`); + expect(newCount, `${ReportType} count should increase by 1`) .to.equal(initialCount + 1); }); } + } export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index 8b87e5e087..0cbb7aae8f 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -11,6 +11,7 @@ class MorbidityReportPage { codeLookupButton = 'input[value="Code Lookup"]'; pregnantDropdown = 'select[fieldlabel="Is Patient Pregnant"][validate="pregnantMale"]'; submitButton = "#Submit"; + submitAndCreateInvestigationButton = 'input[type="image"][name="Submit and Create Investigation"]'; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -71,6 +72,10 @@ class MorbidityReportPage { cy.get(this.submitButton).click(); } + clickSubmitAndCreateInvestigation() { + cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); + } + confirmSubmission() { cy.on("window:confirm", () => true); // Automatically confirm the popup } diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index 674a335e0e..7767c4a408 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -73,6 +73,10 @@ When("I click the submit button", () => { clickSubmitButton(); }); +When("I click the Submit and Create Investigation button", () => { + morbidityReportPage.clickSubmitAndCreateInvestigation(); +}); + When("I click on the Morbidity Report link", () => { morbidityReportPage.clickMorbidityReport(); }); diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index 9e299fbb5c..33b4b863b3 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -38,10 +38,10 @@ When("user clicks on the {string} button within the Events tab", (buttonValue) = eventsTabPage.clickAddButton(buttonValue); }); -When("I check the current count of morbidity reports in the Events tab", () => { - eventsTabPage.getMorbidityReportCount(); +When("I check the current count of {string} in the Events tab", (reportType) => { + eventsTabPage.getReportCount(reportType); }); -Then("the morbidity report count should increase by 1 in the Events tab", () => { - eventsTabPage.verifyMorbidityReportCountIncreased(); +Then("the {string} count should increase by 1 in the Events tab", (reportType) => { + eventsTabPage.verifyReportCountIncreased(reportType); }); \ No newline at end of file From eeff57addbdae08de5191a7cef7b76bff175d0ec Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 12:59:17 -0700 Subject: [PATCH 04/16] tests: cancel creation of new morbidity report scenario --- .../morbidityReportManagement.feature | 10 +++++++-- .../cypress/e2e/pages/eventsTab.page.js | 22 ++++++++++++++++++- .../pages/nbs-classic/morbidityReportPage.js | 7 ++++++ .../nbs-classic/dataEntry.steps.js | 4 ++++ .../step_definitions/patient.profile.step.js | 4 ++++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index 81324ae9bf..898dfee3f7 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -33,8 +33,14 @@ Feature: Patient File - Event Management - Morbidity Report And Click Events tab on Patient Profile Page Then the "Investigations" count should increase by 1 in the Events tab - # Scenario: Cancel creation of a new morbidity report - + Scenario: Cancel creation of a new morbidity report + When I check the current count of "Morbidity reports" in the Events tab + And user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I click the Cancel button on the Morbidity Report page + And I confirm the submission by clicking "Ok" + And I click the Cancel button on the Morbidity Report page + Then the "Morbidity reports" count should remain the same in the Events tab # Scenario: Edit existing morbidity report # Scenario: Print morbidity report diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 0667bdac4d..31e598bc8e 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -101,6 +101,26 @@ class EventsTabPage { }); } -} + verifyReportCountUnchanged(ReportType) { + const reportIndex = this.reportTypeIndexMap[ReportType]; + + // Wait for spinner to disappear before getting the count + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + // Now get the count and verify it remains the same + const initialCount = Cypress.env('reportCount'); + + cy.get('._title_r9t1e_16 ._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') + .eq(reportIndex) + .invoke('text') + .then(text => { + const newCount = parseInt(text.trim(), 10); + cy.log(`Initial count: ${initialCount}, New count: ${newCount}`); + expect(newCount, `${ReportType} count should remain the same`) + .to.equal(initialCount); + }); + } + } export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index 0cbb7aae8f..eff77fd028 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -12,6 +12,7 @@ class MorbidityReportPage { pregnantDropdown = 'select[fieldlabel="Is Patient Pregnant"][validate="pregnantMale"]'; submitButton = "#Submit"; submitAndCreateInvestigationButton = 'input[type="image"][name="Submit and Create Investigation"]'; + cancelButton = "#Cancel"; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -72,12 +73,18 @@ class MorbidityReportPage { cy.get(this.submitButton).click(); } + clickCancel() { + cy.get(this.cancelButton).click(); + } + clickSubmitAndCreateInvestigation() { cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); } confirmSubmission() { cy.on("window:confirm", () => true); // Automatically confirm the popup + // small buffer + cy.wait(500); } // Patient entry methods diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index 7767c4a408..e6ecb6b111 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -73,6 +73,10 @@ When("I click the submit button", () => { clickSubmitButton(); }); +When("I click the Cancel button on the Morbidity Report page", () => { + morbidityReportPage.clickCancel(); +}); + When("I click the Submit and Create Investigation button", () => { morbidityReportPage.clickSubmitAndCreateInvestigation(); }); diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index 33b4b863b3..b7ef2f0699 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -44,4 +44,8 @@ When("I check the current count of {string} in the Events tab", (reportType) => Then("the {string} count should increase by 1 in the Events tab", (reportType) => { eventsTabPage.verifyReportCountIncreased(reportType); +}); + +Then("the {string} count should remain the same in the Events tab", (reportType) => { + eventsTabPage.verifyReportCountUnchanged(reportType); }); \ No newline at end of file From c7cc5a77fe1eabf27ad786b2227a67a15f647a5a Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 14:13:41 -0700 Subject: [PATCH 05/16] tests: clear jurisdiction as select empty string --- .../cypress/e2e/pages/nbs-classic/morbidityReportPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index eff77fd028..ad458c1f96 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -45,7 +45,7 @@ class MorbidityReportPage { } clearJurisdiction() { - cy.get(this.jurisdictionField).clear(); + cy.get(this.jurisdictionField).select("", { force: true }); } enterMorbidityDate(date) { From 4afa93ae82b30b292b1a21bdde9cd1c87bf61189 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 14:30:22 -0700 Subject: [PATCH 06/16] tests: part way through edit existing morbidity report --- .../morbidityReportManagement.feature | 10 +++++++- .../cypress/e2e/pages/eventsTab.page.js | 5 ++++ .../pages/nbs-classic/morbidityReportPage.js | 25 +++++++++++++++++++ .../nbs-classic/dataEntry.steps.js | 17 ++++++++++++- .../step_definitions/patient.profile.step.js | 4 +++ 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index 898dfee3f7..8529765539 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -41,8 +41,16 @@ Feature: Patient File - Event Management - Morbidity Report And I confirm the submission by clicking "Ok" And I click the Cancel button on the Morbidity Report page Then the "Morbidity reports" count should remain the same in the Events tab - # Scenario: Edit existing morbidity report + Scenario: Edit existing morbidity report + When I click on the first morbidity report link in the Events tab + And I click the Edit button on the Morbidity Report page + And I enter the current date in the Treatment Date field + And I select "Acyclovir, 800 mg, PO, BID, x 5 days" from the Treatment dropdown menu + And I click the Add Treatment button + And I click the Submit button on the Morbidity Report page + And user clicks the "View File" link, the user is returned to Patient profile summary page + And Click Events tab on Patient Profile Page # Scenario: Print morbidity report # Scenario: Transfer ownership of morbidity report diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 31e598bc8e..143167c7e5 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -14,6 +14,7 @@ class EventsTabPage { "Contacts named by patient": 7, "Patient named by contacts": 8, }; + morbidityReportLinks = 'a[href="/nbs/api/profile/10000001/report/morbidity/10009436"]' selectMultipleInvestigations() { const conditionText = "Acanthamoeba Disease (Excluding Keratitis)"; @@ -121,6 +122,10 @@ class EventsTabPage { .to.equal(initialCount); }); } + + clickFirstMorbidityReportLink() { + cy.get(this.morbidityReportLinks).first().click(); + } } export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index ad458c1f96..fd44de3ea2 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -6,6 +6,9 @@ class MorbidityReportPage { jurisdictionField = 'select[fieldlabel="Jurisdiction"][name="morbidityReport.theObservationDT.jurisdictionCd"]'; morbidityDateField = "#morbidityReport\\.theObservationDT\\.activityToTime_s"; + treatmentDateField = '#treatment_s\\[i\\]\\.treatmentVO_s\\[0\\]\\.treatmentAdministeredDT_s\\[0\\]\\.effectiveFromTime_s'; + treatmentDropdown = 'select[fieldlabel="Treatment"][validate="required"]'; + addTreatmentButton = 'input#BatchEntryAddButtonTreatment[value="Add Treatment"]'; facilityProviderField = 'input[name="entity-codeLookupText-Org-ReportingOrganizationUID"]'; codeLookupButton = 'input[value="Code Lookup"]'; @@ -13,6 +16,7 @@ class MorbidityReportPage { submitButton = "#Submit"; submitAndCreateInvestigationButton = 'input[type="image"][name="Submit and Create Investigation"]'; cancelButton = "#Cancel"; + editButton = 'input[type="image"][name="Edit"]'; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -57,6 +61,15 @@ class MorbidityReportPage { cy.get(this.morbidityDateField).type(formattedDate); } + enterTreatmentDate(date) { + const [month, day, year] = date.split("/"); + const formattedDate = `${month.padStart(2, "0")}${day.padStart( + 2, + "0" + )}${year}`; + cy.get(this.treatmentDateField).type(formattedDate); + } + enterFacilityProvider(value) { cy.get(this.facilityProviderField).type(value); } @@ -65,6 +78,14 @@ class MorbidityReportPage { cy.get(this.pregnantDropdown).select(value, { force: true }); } + selectTreatment(value) { + cy.get(this.treatmentDropdown).select(value, { force: true }); + } + + clickAddTreatment() { + cy.get(this.addTreatmentButton).click(); + } + clickCodeLookup() { cy.get(this.codeLookupButton).first().click(); } @@ -77,6 +98,10 @@ class MorbidityReportPage { cy.get(this.cancelButton).click(); } + clickEdit() { + cy.get(this.editButton).click(); + } + clickSubmitAndCreateInvestigation() { cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); } diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index e6ecb6b111..438722a2d2 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -219,7 +219,22 @@ When("I enter patient first name {string} and last name {string}", (firstName, l morbidityReportPage.enterPatientBothNames(firstName, lastName); }); -When +When("I click the Edit button on the Morbidity Report page", () => { + morbidityReportPage.clickEdit(); +}); + +When("I enter the current date in the Treatment Date field", () => { + const today = new Date().toLocaleDateString("en-US"); + morbidityReportPage.enterTreatmentDate(today); +}); + +When("I select {string} from the Treatment dropdown menu", (treatment) => { + morbidityReportPage.selectTreatment(treatment); +}); + +When("I click the Add Treatment button", () => { + morbidityReportPage.clickAddTreatment(); +}); // 6: Verification Steps diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index b7ef2f0699..f6c87964e2 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -48,4 +48,8 @@ Then("the {string} count should increase by 1 in the Events tab", (reportType) = Then("the {string} count should remain the same in the Events tab", (reportType) => { eventsTabPage.verifyReportCountUnchanged(reportType); +}); + +When("I click on the first morbidity report link in the Events tab", () => { + eventsTabPage.clickFirstMorbidityReportLink(); }); \ No newline at end of file From 23287977c9cff5b9fabcde21858d2d1f61b4e273 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 15:04:26 -0700 Subject: [PATCH 07/16] tests: edit existing morbidity report scenario --- .../morbidityReportManagement.feature | 74 ++++++++++--------- .../cypress/e2e/pages/eventsTab.page.js | 45 ++++++++++- .../pages/nbs-classic/morbidityReportPage.js | 4 +- .../step_definitions/patient.profile.step.js | 8 ++ 4 files changed, 90 insertions(+), 41 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index 8529765539..26f77c0077 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -5,52 +5,54 @@ Feature: Patient File - Event Management - Morbidity Report And the user navigate to the patient profile page for "63000" And Click Events tab on Patient Profile Page - Scenario: Add new morbidity report without investigation - When I check the current count of "Morbidity reports" in the Events tab - And user clicks on the "Add morbidity report" button within the Events tab - And I select "Botulism, foodborne" from the Condition dropdown menu - And I select "Cobb County" from the Jurisdiction dropdown menu - And I enter the current date in the Date of Morbidity Report field - And I enter "2" in the Facility and Provider Information field - And I click on the Code Lookup button - And I select "No" from the Pregnant dropdown menu - And I click the Submit button - And Click Events tab on Patient Profile Page - Then the "Morbidity reports" count should increase by 1 in the Events tab + # Scenario: Add new morbidity report without investigation + # When I check the current count of "Morbidity reports" in the Events tab + # And user clicks on the "Add morbidity report" button within the Events tab + # And I select "Botulism, foodborne" from the Condition dropdown menu + # And I select "Cobb County" from the Jurisdiction dropdown menu + # And I enter the current date in the Date of Morbidity Report field + # And I enter "2" in the Facility and Provider Information field + # And I click on the Code Lookup button + # And I select "No" from the Pregnant dropdown menu + # And I click the Submit button + # And Click Events tab on Patient Profile Page + # Then the "Morbidity reports" count should increase by 1 in the Events tab - Scenario: Add new morbidity report and create investigation - When I check the current count of "Investigations" in the Events tab - And user clicks on the "Add morbidity report" button within the Events tab - And I select "Botulism, foodborne" from the Condition dropdown menu - And I select "Cobb County" from the Jurisdiction dropdown menu - And I enter the current date in the Date of Morbidity Report field - And I enter "2" in the Facility and Provider Information field - And I click on the Code Lookup button - And I select "No" from the Pregnant dropdown menu - And I click the Submit and Create Investigation button - And I click the Submit button - And user clicks the "View File" link, the user is returned to Patient profile summary page - And Click Events tab on Patient Profile Page - Then the "Investigations" count should increase by 1 in the Events tab + # Scenario: Add new morbidity report and create investigation + # When I check the current count of "Investigations" in the Events tab + # And user clicks on the "Add morbidity report" button within the Events tab + # And I select "Botulism, foodborne" from the Condition dropdown menu + # And I select "Cobb County" from the Jurisdiction dropdown menu + # And I enter the current date in the Date of Morbidity Report field + # And I enter "2" in the Facility and Provider Information field + # And I click on the Code Lookup button + # And I select "No" from the Pregnant dropdown menu + # And I click the Submit and Create Investigation button + # And I click the Submit button + # And user clicks the "View File" link, the user is returned to Patient profile summary page + # And Click Events tab on Patient Profile Page + # Then the "Investigations" count should increase by 1 in the Events tab - Scenario: Cancel creation of a new morbidity report - When I check the current count of "Morbidity reports" in the Events tab - And user clicks on the "Add morbidity report" button within the Events tab - And I select "Botulism, foodborne" from the Condition dropdown menu - And I click the Cancel button on the Morbidity Report page - And I confirm the submission by clicking "Ok" - And I click the Cancel button on the Morbidity Report page - Then the "Morbidity reports" count should remain the same in the Events tab + # Scenario: Cancel creation of a new morbidity report + # When I check the current count of "Morbidity reports" in the Events tab + # And user clicks on the "Add morbidity report" button within the Events tab + # And I select "Botulism, foodborne" from the Condition dropdown menu + # And I click the Cancel button on the Morbidity Report page + # And I confirm the submission by clicking "Ok" + # And I click the Cancel button on the Morbidity Report page + # Then the "Morbidity reports" count should remain the same in the Events tab Scenario: Edit existing morbidity report - When I click on the first morbidity report link in the Events tab + When I count the number of treatments in the first morbidity report + And I click on the first morbidity report link in the Events tab And I click the Edit button on the Morbidity Report page And I enter the current date in the Treatment Date field And I select "Acyclovir, 800 mg, PO, BID, x 5 days" from the Treatment dropdown menu And I click the Add Treatment button - And I click the Submit button on the Morbidity Report page + And I click the Submit button And user clicks the "View File" link, the user is returned to Patient profile summary page And Click Events tab on Patient Profile Page + Then the treatment count should increase by 1 in the first morbidity report # Scenario: Print morbidity report # Scenario: Transfer ownership of morbidity report diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 143167c7e5..079ca65f8f 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -121,11 +121,48 @@ class EventsTabPage { expect(newCount, `${ReportType} count should remain the same`) .to.equal(initialCount); }); - } + } + + saveInitialTreatmentCount() { + // Wait for spinner to disappear + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + // Get the first morbidity report row and find the treatment count + cy.get('#morbidity-reports-table tbody tr') + .first() + .find('td:nth-child(6)') // Treatment info column + .find('ul._treatments_t5nhh_1 li') + .its('length') + .then(count => { + Cypress.env('initialTreatmentCount', count); + cy.log(`Initial treatment count in first morbidity report: ${count}`); + }); + } + verifyTreatmentCountIncreased() { + // Wait for spinner to disappear + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + const initialCount = Cypress.env('initialTreatmentCount'); + + // Get the first morbidity report row and find the treatment count + cy.get('#morbidity-reports-table tbody tr') + .first() + .find('td:nth-child(6)') // Treatment info column + .find('ul._treatments_t5nhh_1 li') + .its('length') + .then(newCount => { + cy.log(`Initial treatment count: ${initialCount}, New count: ${newCount}`); + expect(newCount, `Treatment count should increase by 1`) + .to.equal(initialCount + 1); + }); + } - clickFirstMorbidityReportLink() { - cy.get(this.morbidityReportLinks).first().click(); - } + clickFirstMorbidityReportLink() { + cy.get(this.morbidityReportLinks).first().click(); + } + } export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index fd44de3ea2..cbd2685c95 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -16,7 +16,7 @@ class MorbidityReportPage { submitButton = "#Submit"; submitAndCreateInvestigationButton = 'input[type="image"][name="Submit and Create Investigation"]'; cancelButton = "#Cancel"; - editButton = 'input[type="image"][name="Edit"]'; + editButton = '#Edit'; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -86,6 +86,8 @@ class MorbidityReportPage { cy.get(this.addTreatmentButton).click(); } + + clickCodeLookup() { cy.get(this.codeLookupButton).first().click(); } diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index f6c87964e2..a20868e4a1 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -52,4 +52,12 @@ Then("the {string} count should remain the same in the Events tab", (reportType) When("I click on the first morbidity report link in the Events tab", () => { eventsTabPage.clickFirstMorbidityReportLink(); +}); + +When("I count the number of treatments in the first morbidity report", () => { + eventsTabPage.saveInitialTreatmentCount(); +}); + +Then("the treatment count should increase by 1 in the first morbidity report", () => { + eventsTabPage.verifyTreatmentCountIncreased(); }); \ No newline at end of file From c435b1887ee34bcb1519f0e34dc1f5d7255ef8e6 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 16:11:27 -0700 Subject: [PATCH 08/16] chore: use saved event ID for verification --- .../morbidityReportManagement.feature | 88 +++++++++++-------- .../cypress/e2e/pages/eventsTab.page.js | 68 ++++++++++++-- .../pages/nbs-classic/morbidityReportPage.js | 13 ++- .../nbs-classic/dataEntry.steps.js | 8 ++ .../step_definitions/patient.profile.step.js | 10 ++- 5 files changed, 135 insertions(+), 52 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index 26f77c0077..ac9bd86e84 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -5,46 +5,46 @@ Feature: Patient File - Event Management - Morbidity Report And the user navigate to the patient profile page for "63000" And Click Events tab on Patient Profile Page - # Scenario: Add new morbidity report without investigation - # When I check the current count of "Morbidity reports" in the Events tab - # And user clicks on the "Add morbidity report" button within the Events tab - # And I select "Botulism, foodborne" from the Condition dropdown menu - # And I select "Cobb County" from the Jurisdiction dropdown menu - # And I enter the current date in the Date of Morbidity Report field - # And I enter "2" in the Facility and Provider Information field - # And I click on the Code Lookup button - # And I select "No" from the Pregnant dropdown menu - # And I click the Submit button - # And Click Events tab on Patient Profile Page - # Then the "Morbidity reports" count should increase by 1 in the Events tab + Scenario: Add new morbidity report without investigation + When I check the current count of "Morbidity reports" in the Events tab + And user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit button + And Click Events tab on Patient Profile Page + Then the "Morbidity reports" count should increase by 1 in the Events tab - # Scenario: Add new morbidity report and create investigation - # When I check the current count of "Investigations" in the Events tab - # And user clicks on the "Add morbidity report" button within the Events tab - # And I select "Botulism, foodborne" from the Condition dropdown menu - # And I select "Cobb County" from the Jurisdiction dropdown menu - # And I enter the current date in the Date of Morbidity Report field - # And I enter "2" in the Facility and Provider Information field - # And I click on the Code Lookup button - # And I select "No" from the Pregnant dropdown menu - # And I click the Submit and Create Investigation button - # And I click the Submit button - # And user clicks the "View File" link, the user is returned to Patient profile summary page - # And Click Events tab on Patient Profile Page - # Then the "Investigations" count should increase by 1 in the Events tab + Scenario: Add new morbidity report and create investigation + When I check the current count of "Investigations" in the Events tab + And user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit and Create Investigation button + And I click the Submit button + And user clicks the "View File" link, the user is returned to Patient profile summary page + And Click Events tab on Patient Profile Page + Then the "Investigations" count should increase by 1 in the Events tab - # Scenario: Cancel creation of a new morbidity report - # When I check the current count of "Morbidity reports" in the Events tab - # And user clicks on the "Add morbidity report" button within the Events tab - # And I select "Botulism, foodborne" from the Condition dropdown menu - # And I click the Cancel button on the Morbidity Report page - # And I confirm the submission by clicking "Ok" - # And I click the Cancel button on the Morbidity Report page - # Then the "Morbidity reports" count should remain the same in the Events tab + Scenario: Cancel creation of a new morbidity report + When I check the current count of "Morbidity reports" in the Events tab + And user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I click the Cancel button on the Morbidity Report page + And I confirm the submission by clicking "Ok" + And I click the Cancel button on the Morbidity Report page + Then the "Morbidity reports" count should remain the same in the Events tab Scenario: Edit existing morbidity report When I count the number of treatments in the first morbidity report - And I click on the first morbidity report link in the Events tab + And I click on the first morbidity report link in the Events tab and store its Event ID And I click the Edit button on the Morbidity Report page And I enter the current date in the Treatment Date field And I select "Acyclovir, 800 mg, PO, BID, x 5 days" from the Treatment dropdown menu @@ -52,10 +52,22 @@ Feature: Patient File - Event Management - Morbidity Report And I click the Submit button And user clicks the "View File" link, the user is returned to Patient profile summary page And Click Events tab on Patient Profile Page - Then the treatment count should increase by 1 in the first morbidity report - # Scenario: Print morbidity report + Then the treatment count should increase by 1 in the stored morbidity report + + @skip-broken + #Not sure how to test this scenario, as it opens a new window and Cypress does not support multiple windows + Scenario: Print morbidity report + When I click on the first morbidity report link in the Events tab + And I click the Print button on the Morbidity Report page - # Scenario: Transfer ownership of morbidity report + Scenario: Transfer ownership of morbidity report + When I click on the first morbidity report link in the Events tab and store its Event ID + And I click the Transfer Ownership button on the Morbidity Report page + And I select "Gwinnett County" from the Jurisdiction dropdown menu + And I click the Submit button + And user clicks the "View File" link, the user is returned to Patient profile summary page + Then the saved morbidity report should have jurisdiction "Gwinnett County" + # Scenario: Create investigation from morbidity report # Scenario: Associate investigation from morbidity report # Scenario: Mark morbidity report as reviewed diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 079ca65f8f..8c4a4837e1 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -132,37 +132,87 @@ class EventsTabPage { cy.get('#morbidity-reports-table tbody tr') .first() .find('td:nth-child(6)') // Treatment info column - .find('ul._treatments_t5nhh_1 li') - .its('length') - .then(count => { + .then($td => { + // Check if the ul exists, if not, count is 0 + const $list = $td.find('ul._treatments_t5nhh_1 li'); + const count = $list.length || 0; Cypress.env('initialTreatmentCount', count); cy.log(`Initial treatment count in first morbidity report: ${count}`); }); - } + } + verifyTreatmentCountIncreased() { // Wait for spinner to disappear cy.get('._indicator_1vvtd_1', { timeout: 10000 }) .should('not.exist'); const initialCount = Cypress.env('initialTreatmentCount'); + const eventId = Cypress.env('morbidityEventId'); - // Get the first morbidity report row and find the treatment count + // Find the row containing the specific event ID and check its treatment count cy.get('#morbidity-reports-table tbody tr') - .first() + .contains('td:first-child a', eventId) + .parent() // Get the td + .parent() // Get the tr .find('td:nth-child(6)') // Treatment info column .find('ul._treatments_t5nhh_1 li') .its('length') .then(newCount => { cy.log(`Initial treatment count: ${initialCount}, New count: ${newCount}`); - expect(newCount, `Treatment count should increase by 1`) + expect(newCount, `Treatment count for ${eventId} should increase by 1`) .to.equal(initialCount + 1); }); } - clickFirstMorbidityReportLink() { - cy.get(this.morbidityReportLinks).first().click(); + clickFirstMorbidityReportLinkStoreEventID() { + // Wait for spinner to disappear + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + // Get the first morbidity report row + cy.get('#morbidity-reports-table tbody tr:first-child') + .scrollIntoView() + .should('be.visible') + .within(() => { + // Get the link element + cy.get('td:first-child a') + .scrollIntoView() + .should('be.visible') + .then($link => { + // Extract and store the event ID + const eventId = $link.text().trim(); + Cypress.env('morbidityEventId', eventId); + cy.log(`Stored morbidity event ID: ${eventId}`); + + // Click the link + cy.wrap($link).click(); + }); + }); } + verifySavedMorbidityReportJurisdiction(expectedJurisdiction) { + // Wait for spinner to disappear + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + const eventId = Cypress.env('morbidityEventId'); + + cy.log(`Looking for morbidity report with Event ID: ${eventId}`); + // Find the row with the specific event ID and check the jurisdiction column + cy.get('#morbidity-reports-table tbody tr') + .filter((index, row) => { + return Cypress.$(row).find('td:first-child a').text().trim() === eventId; + }) + .should('have.length', 1, `Should find exactly one row with Event ID: ${eventId}`) + .find('td:nth-child(7)') // Jurisdiction is the 7th column (1-based index) + .should('be.visible') + .invoke('text') + .then(text => { + const actualJurisdiction = text.trim(); + cy.log(`Jurisdiction for ${eventId}: "${actualJurisdiction}" (expected: "${expectedJurisdiction}")`); + expect(actualJurisdiction).to.equal(expectedJurisdiction); + }); } +} export default new EventsTabPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index cbd2685c95..182c347fe1 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -3,8 +3,7 @@ class MorbidityReportPage { patientTab = "font.boldNineYellow"; reportInformationTab = "font.boldNineYellow"; conditionField = 'input[name="conditionCd_textbox"]'; - jurisdictionField = - 'select[fieldlabel="Jurisdiction"][name="morbidityReport.theObservationDT.jurisdictionCd"]'; + jurisdictionField = 'select[fieldlabel="Jurisdiction"]'; morbidityDateField = "#morbidityReport\\.theObservationDT\\.activityToTime_s"; treatmentDateField = '#treatment_s\\[i\\]\\.treatmentVO_s\\[0\\]\\.treatmentAdministeredDT_s\\[0\\]\\.effectiveFromTime_s'; treatmentDropdown = 'select[fieldlabel="Treatment"][validate="required"]'; @@ -17,6 +16,8 @@ class MorbidityReportPage { submitAndCreateInvestigationButton = 'input[type="image"][name="Submit and Create Investigation"]'; cancelButton = "#Cancel"; editButton = '#Edit'; + printButton = "#Print"; + transferOwnershipButton = "input[id='Transfer Ownership']"; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -104,6 +105,14 @@ class MorbidityReportPage { cy.get(this.editButton).click(); } + clickPrint() { + cy.get(this.printButton).click(); + } + + clickTransferOwnership() { + cy.get(this.transferOwnershipButton).first().click(); + } + clickSubmitAndCreateInvestigation() { cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); } diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index 438722a2d2..45edc35c85 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -223,6 +223,10 @@ When("I click the Edit button on the Morbidity Report page", () => { morbidityReportPage.clickEdit(); }); +When("I click the Print button on the Morbidity Report page", () => { + morbidityReportPage.clickPrint(); +}); + When("I enter the current date in the Treatment Date field", () => { const today = new Date().toLocaleDateString("en-US"); morbidityReportPage.enterTreatmentDate(today); @@ -236,6 +240,10 @@ When("I click the Add Treatment button", () => { morbidityReportPage.clickAddTreatment(); }); +When("I click the Transfer Ownership button on the Morbidity Report page", () => { + morbidityReportPage.clickTransferOwnership(); +}); + // 6: Verification Steps When("I go to the Home page", () => { diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index a20868e4a1..c03ccab811 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -50,14 +50,18 @@ Then("the {string} count should remain the same in the Events tab", (reportType) eventsTabPage.verifyReportCountUnchanged(reportType); }); -When("I click on the first morbidity report link in the Events tab", () => { - eventsTabPage.clickFirstMorbidityReportLink(); +When("I click on the first morbidity report link in the Events tab and store its Event ID", () => { + eventsTabPage.clickFirstMorbidityReportLinkStoreEventID(); }); When("I count the number of treatments in the first morbidity report", () => { eventsTabPage.saveInitialTreatmentCount(); }); -Then("the treatment count should increase by 1 in the first morbidity report", () => { +Then("the treatment count should increase by 1 in the stored morbidity report", () => { eventsTabPage.verifyTreatmentCountIncreased(); +}); + +Then("the saved morbidity report should have jurisdiction {string}", (expectedJurisdiction) => { + eventsTabPage.verifySavedMorbidityReportJurisdiction(expectedJurisdiction); }); \ No newline at end of file From dd09058c836666b938bf3a2f2d69814b7ec1f047 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 16:33:44 -0700 Subject: [PATCH 09/16] tests: create investigation from morbidity report, clean up eventsTab with helper functions --- .../morbidityReportManagement.feature | 9 +- .../cypress/e2e/pages/eventsTab.page.js | 240 +++++++++++------- .../pages/nbs-classic/morbidityReportPage.js | 5 + .../nbs-classic/dataEntry.steps.js | 4 + .../step_definitions/patient.profile.step.js | 8 + 5 files changed, 170 insertions(+), 96 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index ac9bd86e84..ef4c1a9136 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -68,7 +68,14 @@ Feature: Patient File - Event Management - Morbidity Report And user clicks the "View File" link, the user is returned to Patient profile summary page Then the saved morbidity report should have jurisdiction "Gwinnett County" - # Scenario: Create investigation from morbidity report + Scenario: Create investigation from morbidity report + When I click on the first unassociated morbidity report link in the Events tab and store its Event ID + And I click the Create Investigation button on the Morbidity Report page + And I click the Submit button + And user clicks the "View File" link, the user is returned to Patient profile summary page + And Click Events tab on Patient Profile Page + Then the saved morbidity report should be associated with an investigation + # Scenario: Associate investigation from morbidity report # Scenario: Mark morbidity report as reviewed # Scenario: Mark morbidity report as reviewed - STD diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 8c4a4837e1..6d0bb91f3d 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -1,7 +1,11 @@ class EventsTabPage { - get table() { - return "section"; - } + // Constants + static SPINNER_SELECTOR = '._indicator_1vvtd_1'; + static COUNT_BADGE_SELECTOR = '._title_r9t1e_16 ._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76'; + static MORBIDITY_TABLE_SELECTOR = '#morbidity-reports-table tbody tr'; + static TREATMENT_COLUMN = 6; + static JURISDICTION_COLUMN = 7; + static ASSOCIATED_COLUMN = 8; reportTypeIndexMap = { "Investigations": 0, @@ -14,7 +18,43 @@ class EventsTabPage { "Contacts named by patient": 7, "Patient named by contacts": 8, }; - morbidityReportLinks = 'a[href="/nbs/api/profile/10000001/report/morbidity/10009436"]' + + waitForSpinner(timeout = 10000) { + cy.get(EventsTabPage.SPINNER_SELECTOR, { timeout }) + .should('not.exist'); + } + + getCountBadge(reportIndex) { + return cy.get(EventsTabPage.COUNT_BADGE_SELECTOR).eq(reportIndex); + } + + extractAndStoreEventId($link) { + const eventId = $link.text().trim(); + Cypress.env('morbidityEventId', eventId); + cy.log('Stored morbidity event ID: ' + eventId); + return eventId; + } + + findRowByEventId(eventId) { + return cy.get(EventsTabPage.MORBIDITY_TABLE_SELECTOR) + .filter((index, row) => { + return Cypress.$(row).find('td:first-child a').text().trim() === eventId; + }) + .should('have.length', 1, 'Should find exactly one row with Event ID: ' + eventId); + } + + getTreatmentCount($td) { + const $list = $td.find('ul._treatments_t5nhh_1 li'); + return $list.length || 0; + } + + clickLink($link) { + cy.wrap($link).click(); + } + + get table() { + return "section"; + } selectMultipleInvestigations() { const conditionText = "Acanthamoeba Disease (Excluding Keratitis)"; @@ -28,7 +68,6 @@ class EventsTabPage { .eq(conditionColumnIndex) .invoke('text') .then(text => { - if (text.includes(conditionText)) { cy.wrap($row) .find("input") @@ -36,28 +75,30 @@ class EventsTabPage { } }); }); -} + } validateTableColumns(tableName, dataTable) { const myArray = []; cy.contains("section", tableName).within(() => { cy.get("th") - .then((headerElements) => { - const headers = Cypress.$.map(headerElements, (headerElement) => { - return Cypress.$(headerElement).text().trim(); - }).filter(Boolean); - dataTable.rawTable.forEach((row) => { - const label = row[0]; - if ((label == "Investigation #") & (tableName === "Investigations")) { - myArray.push(""); - } - myArray.push(label); + .then((headerElements) => { + const headers = Cypress.$.map(headerElements, (headerElement) => { + return Cypress.$(headerElement).text().trim(); + }).filter(Boolean); + + dataTable.rawTable.forEach((row) => { + const label = row[0]; + if ((label == "Investigation #") & (tableName === "Investigations")) { + myArray.push(""); + } + myArray.push(label); + }); + + console.log("myArray", myArray); + console.log("headers", headers); + expect(headers).to.deep.equal(myArray); }); - console.log("myArray", myArray); - console.log("headers", headers); - expect(headers).to.deep.equal(myArray); - }); - }) + }); } clickAddButton(buttonValue) { @@ -66,153 +107,162 @@ class EventsTabPage { getReportCount(ReportType) { const reportIndex = this.reportTypeIndexMap[ReportType]; - - // Wait for spinner to disappear - cy.get('._indicator_1vvtd_1', { timeout: 15000 }) - .should('not.exist'); - - cy.get('div._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') - .eq(reportIndex) + this.waitForSpinner(); + + this.getCountBadge(reportIndex) .invoke('text') .then(text => { const count = parseInt(text.trim()); Cypress.env('reportCount', count); - cy.log(`Saved report count: ${count}`); + cy.log('Saved ' + ReportType + ' count: ' + count); }); } verifyReportCountIncreased(ReportType) { const reportIndex = this.reportTypeIndexMap[ReportType]; - - // Wait for spinner to disappear before getting the count - cy.get('._indicator_1vvtd_1', { timeout: 10000 }) - .should('not.exist'); + this.waitForSpinner(); - // Now get the count and verify it increased const initialCount = Cypress.env('reportCount'); - cy.get('._title_r9t1e_16 ._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') - .eq(reportIndex) + this.getCountBadge(reportIndex) .invoke('text') .then(text => { const newCount = parseInt(text.trim(), 10); - cy.log(`Initial count: ${initialCount}, New count: ${newCount}`); - expect(newCount, `${ReportType} count should increase by 1`) + cy.log(ReportType + ' - Initial: ' + initialCount + ', New: ' + newCount); + expect(newCount, ReportType + ' count should increase by 1') .to.equal(initialCount + 1); }); } verifyReportCountUnchanged(ReportType) { const reportIndex = this.reportTypeIndexMap[ReportType]; - - // Wait for spinner to disappear before getting the count - cy.get('._indicator_1vvtd_1', { timeout: 10000 }) - .should('not.exist'); + this.waitForSpinner(); - // Now get the count and verify it remains the same const initialCount = Cypress.env('reportCount'); - cy.get('._title_r9t1e_16 ._default_rfc4h_1._small_rfc4h_64._regular_rfc4h_76') - .eq(reportIndex) + this.getCountBadge(reportIndex) .invoke('text') .then(text => { const newCount = parseInt(text.trim(), 10); - cy.log(`Initial count: ${initialCount}, New count: ${newCount}`); - expect(newCount, `${ReportType} count should remain the same`) + cy.log(ReportType + ' - Initial: ' + initialCount + ', New: ' + newCount); + expect(newCount, ReportType + ' count should remain the same') .to.equal(initialCount); }); } saveInitialTreatmentCount() { - // Wait for spinner to disappear - cy.get('._indicator_1vvtd_1', { timeout: 10000 }) - .should('not.exist'); + this.waitForSpinner(); - // Get the first morbidity report row and find the treatment count - cy.get('#morbidity-reports-table tbody tr') + cy.get(EventsTabPage.MORBIDITY_TABLE_SELECTOR) .first() - .find('td:nth-child(6)') // Treatment info column + .find('td:nth-child(' + EventsTabPage.TREATMENT_COLUMN + ')') .then($td => { - // Check if the ul exists, if not, count is 0 - const $list = $td.find('ul._treatments_t5nhh_1 li'); - const count = $list.length || 0; + const count = this.getTreatmentCount($td); Cypress.env('initialTreatmentCount', count); - cy.log(`Initial treatment count in first morbidity report: ${count}`); + cy.log('Initial treatment count in first morbidity report: ' + count); }); - } + } verifyTreatmentCountIncreased() { - // Wait for spinner to disappear - cy.get('._indicator_1vvtd_1', { timeout: 10000 }) - .should('not.exist'); + this.waitForSpinner(); const initialCount = Cypress.env('initialTreatmentCount'); const eventId = Cypress.env('morbidityEventId'); - // Find the row containing the specific event ID and check its treatment count - cy.get('#morbidity-reports-table tbody tr') - .contains('td:first-child a', eventId) - .parent() // Get the td - .parent() // Get the tr - .find('td:nth-child(6)') // Treatment info column + cy.log('Looking for morbidity report with Event ID: ' + eventId); + + this.findRowByEventId(eventId) + .find('td:nth-child(' + EventsTabPage.TREATMENT_COLUMN + ')') .find('ul._treatments_t5nhh_1 li') .its('length') .then(newCount => { - cy.log(`Initial treatment count: ${initialCount}, New count: ${newCount}`); - expect(newCount, `Treatment count for ${eventId} should increase by 1`) + cy.log('Initial treatment count: ' + initialCount + ', New count: ' + newCount); + expect(newCount, 'Treatment count for ' + eventId + ' should increase by 1') .to.equal(initialCount + 1); }); } clickFirstMorbidityReportLinkStoreEventID() { - // Wait for spinner to disappear - cy.get('._indicator_1vvtd_1', { timeout: 10000 }) - .should('not.exist'); + this.waitForSpinner(); + + cy.get(EventsTabPage.MORBIDITY_TABLE_SELECTOR) + .first() + .scrollIntoView() + .should('be.visible') + .within(() => { + cy.get('td:first-child a') + .scrollIntoView() + .should('be.visible') + .then($link => { + this.extractAndStoreEventId($link); + this.clickLink($link); + }); + }); + } + + clickFirstUnassociatedMorbidityReport() { + this.waitForSpinner(); - // Get the first morbidity report row - cy.get('#morbidity-reports-table tbody tr:first-child') + cy.get(EventsTabPage.MORBIDITY_TABLE_SELECTOR) + .filter((index, row) => { + const associatedText = Cypress.$(row) + .find('td:nth-child(' + EventsTabPage.ASSOCIATED_COLUMN + ')') + .text() + .trim(); + return associatedText === '---'; + }) + .first() .scrollIntoView() .should('be.visible') .within(() => { - // Get the link element cy.get('td:first-child a') .scrollIntoView() .should('be.visible') .then($link => { - // Extract and store the event ID - const eventId = $link.text().trim(); - Cypress.env('morbidityEventId', eventId); - cy.log(`Stored morbidity event ID: ${eventId}`); - - // Click the link - cy.wrap($link).click(); + this.extractAndStoreEventId($link); + this.clickLink($link); }); }); } + verifySavedMorbidityReportJurisdiction(expectedJurisdiction) { - // Wait for spinner to disappear - cy.get('._indicator_1vvtd_1', { timeout: 10000 }) - .should('not.exist'); + this.waitForSpinner(); const eventId = Cypress.env('morbidityEventId'); - cy.log(`Looking for morbidity report with Event ID: ${eventId}`); + cy.log('Looking for morbidity report with Event ID: ' + eventId); - // Find the row with the specific event ID and check the jurisdiction column - cy.get('#morbidity-reports-table tbody tr') - .filter((index, row) => { - return Cypress.$(row).find('td:first-child a').text().trim() === eventId; - }) - .should('have.length', 1, `Should find exactly one row with Event ID: ${eventId}`) - .find('td:nth-child(7)') // Jurisdiction is the 7th column (1-based index) + this.findRowByEventId(eventId) + .find('td:nth-child(' + EventsTabPage.JURISDICTION_COLUMN + ')') .should('be.visible') .invoke('text') .then(text => { const actualJurisdiction = text.trim(); - cy.log(`Jurisdiction for ${eventId}: "${actualJurisdiction}" (expected: "${expectedJurisdiction}")`); + cy.log('Jurisdiction for ' + eventId + ': "' + actualJurisdiction + '" (expected: "' + expectedJurisdiction + '")'); expect(actualJurisdiction).to.equal(expectedJurisdiction); }); } + + verifyStoredMorbidityReportHasAssociation() { + this.waitForSpinner(); + + const eventId = Cypress.env('morbidityEventId'); + + expect(eventId, 'Morbidity event ID should exist').to.not.be.empty; + + cy.log('Looking for morbidity report with Event ID: ' + eventId); + + this.findRowByEventId(eventId) + .find('td:nth-child(' + EventsTabPage.ASSOCIATED_COLUMN + ')') + .should('be.visible') + .invoke('text') + .then(text => { + const associatedText = text.trim(); + cy.log('Associated with for ' + eventId + ': "' + associatedText + '"'); + expect(associatedText, 'Associated with should have an investigation ID') + .to.match(/CAS\d+/); + }); + } } -export default new EventsTabPage(); +export default new EventsTabPage(); \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index 182c347fe1..06418c3e7a 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -18,6 +18,7 @@ class MorbidityReportPage { editButton = '#Edit'; printButton = "#Print"; transferOwnershipButton = "input[id='Transfer Ownership']"; + createInvestigationButton = "input[id='Create Investigation']"; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -113,6 +114,10 @@ class MorbidityReportPage { cy.get(this.transferOwnershipButton).first().click(); } + clickCreateInvestigation() { + cy.get(this.createInvestigationButton).first().click(); + } + clickSubmitAndCreateInvestigation() { cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); } diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index 45edc35c85..b00cf6ad0d 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -244,6 +244,10 @@ When("I click the Transfer Ownership button on the Morbidity Report page", () => morbidityReportPage.clickTransferOwnership(); }); +When("I click the Create Investigation button on the Morbidity Report page", () => { + morbidityReportPage.clickCreateInvestigation(); +}); + // 6: Verification Steps When("I go to the Home page", () => { diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index c03ccab811..97af46c5ae 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -54,6 +54,10 @@ When("I click on the first morbidity report link in the Events tab and store its eventsTabPage.clickFirstMorbidityReportLinkStoreEventID(); }); +When("I click on the first unassociated morbidity report link in the Events tab and store its Event ID", () => { + eventsTabPage.clickFirstUnassociatedMorbidityReport(); +}); + When("I count the number of treatments in the first morbidity report", () => { eventsTabPage.saveInitialTreatmentCount(); }); @@ -64,4 +68,8 @@ Then("the treatment count should increase by 1 in the stored morbidity report", Then("the saved morbidity report should have jurisdiction {string}", (expectedJurisdiction) => { eventsTabPage.verifySavedMorbidityReportJurisdiction(expectedJurisdiction); +}); + +Then("the saved morbidity report should be associated with an investigation", () => { + eventsTabPage.verifyStoredMorbidityReportHasAssociation(); }); \ No newline at end of file From c87753b2bb386bdc205996c0a44143f917929ecd Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Wed, 5 Aug 2026 17:02:44 -0700 Subject: [PATCH 10/16] tests: start associate investigation test --- .../features/nbs-classic/morbidityReportManagement.feature | 5 ++++- .../cypress/e2e/pages/nbs-classic/morbidityReportPage.js | 5 +++++ .../cypress/step_definitions/nbs-classic/dataEntry.steps.js | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index ef4c1a9136..2ef4332033 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -76,7 +76,10 @@ Feature: Patient File - Event Management - Morbidity Report And Click Events tab on Patient Profile Page Then the saved morbidity report should be associated with an investigation - # Scenario: Associate investigation from morbidity report + Scenario: Associate investigation from morbidity report + When I click on the first unassociated morbidity report link in the Events tab and store its Event ID + And I click the Associate Investigation button on the Morbidity Report page + # Scenario: Mark morbidity report as reviewed # Scenario: Mark morbidity report as reviewed - STD # Scenario: Delete morbidity report \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index 06418c3e7a..ab3dedd66e 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -19,6 +19,7 @@ class MorbidityReportPage { printButton = "#Print"; transferOwnershipButton = "input[id='Transfer Ownership']"; createInvestigationButton = "input[id='Create Investigation']"; + associateInvestigationButton = "input[id='Associate Investigation']"; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -118,6 +119,10 @@ class MorbidityReportPage { cy.get(this.createInvestigationButton).first().click(); } + clickAssociateInvestigation() { + cy.get(this.associateInvestigationButton).first().click(); + } + clickSubmitAndCreateInvestigation() { cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); } diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index b00cf6ad0d..9a70c411f5 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -248,6 +248,10 @@ When("I click the Create Investigation button on the Morbidity Report page", () morbidityReportPage.clickCreateInvestigation(); }); +When("I click the Associate Investigation button on the Morbidity Report page", () => { + morbidityReportPage.clickAssociateInvestigation(); +}); + // 6: Verification Steps When("I go to the Home page", () => { From 1c833887a619cf912916236d98fba32bbbdfa957 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Thu, 6 Aug 2026 14:06:10 -0700 Subject: [PATCH 11/16] tests: finished associate investigation from morb report --- .../morbidityReportManagement.feature | 24 +++++-- .../cypress/e2e/pages/eventsTab.page.js | 43 ++++++------ .../pages/nbs-classic/morbidityReportPage.js | 65 ++++++++++++++++++- .../nbs-classic/openInvestigation.page.js | 15 ++++- .../nbs-classic/dataEntry.steps.js | 16 ++++- .../nbs-classic/openInvestigation.steps.js | 4 ++ .../step_definitions/patient.profile.step.js | 8 +-- 7 files changed, 141 insertions(+), 34 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index 2ef4332033..ee026804b0 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -54,11 +54,9 @@ Feature: Patient File - Event Management - Morbidity Report And Click Events tab on Patient Profile Page Then the treatment count should increase by 1 in the stored morbidity report - @skip-broken - #Not sure how to test this scenario, as it opens a new window and Cypress does not support multiple windows Scenario: Print morbidity report - When I click on the first morbidity report link in the Events tab - And I click the Print button on the Morbidity Report page + When I click on the first morbidity report link in the Events tab and store its Event ID + Then clicking the Print button should display the print preview Scenario: Transfer ownership of morbidity report When I click on the first morbidity report link in the Events tab and store its Event ID @@ -77,8 +75,24 @@ Feature: Patient File - Event Management - Morbidity Report Then the saved morbidity report should be associated with an investigation Scenario: Associate investigation from morbidity report - When I click on the first unassociated morbidity report link in the Events tab and store its Event ID + When user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit button + And Click Events tab on Patient Profile Page + And I click on the first morbidity report link in the Events tab and store its Event ID And I click the Associate Investigation button on the Morbidity Report page + And I check an investigation with the condition "Botulism, foodborne" + And I click the Submit button + And I store the Investigation ID from the association message + And user clicks the "View File" link, the user is returned to Patient profile summary page + And Click Events tab on Patient Profile Page + And I click on the stored Investigation ID in the Events tab + Then the stored morbidity report should be associated with the investigation # Scenario: Mark morbidity report as reviewed # Scenario: Mark morbidity report as reviewed - STD diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 6d0bb91f3d..9499dad4b6 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -200,31 +200,21 @@ class EventsTabPage { }); } - clickFirstUnassociatedMorbidityReport() { + clickStoredMorbidityReport() { this.waitForSpinner(); - cy.get(EventsTabPage.MORBIDITY_TABLE_SELECTOR) - .filter((index, row) => { - const associatedText = Cypress.$(row) - .find('td:nth-child(' + EventsTabPage.ASSOCIATED_COLUMN + ')') - .text() - .trim(); - return associatedText === '---'; - }) - .first() + const eventId = Cypress.env('morbidityEventId'); + + cy.log('Looking for morbidity report with Event ID: ' + eventId); + + this.findRowByEventId(eventId) + .find('td:first-child a') .scrollIntoView() .should('be.visible') - .within(() => { - cy.get('td:first-child a') - .scrollIntoView() - .should('be.visible') - .then($link => { - this.extractAndStoreEventId($link); - this.clickLink($link); - }); - }); + .click(); } + verifySavedMorbidityReportJurisdiction(expectedJurisdiction) { this.waitForSpinner(); @@ -263,6 +253,21 @@ class EventsTabPage { .to.match(/CAS\d+/); }); } + + clickStoredInvestigationId() { + // Get the stored investigation ID + const investigationId = Cypress.env('investigationId'); + + // Wait for page to load + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + // Find and click the investigation link in the Investigations table + cy.get('#investigations-table tbody tr') + .contains('td a', investigationId) + .should('be.visible') + .click(); + } } export default new EventsTabPage(); \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index ab3dedd66e..a0a2b895cf 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -20,6 +20,7 @@ class MorbidityReportPage { transferOwnershipButton = "input[id='Transfer Ownership']"; createInvestigationButton = "input[id='Create Investigation']"; associateInvestigationButton = "input[id='Associate Investigation']"; + conditionCode = "#conditionCd"; // Patient entry fields patientLastNameField = "#entity\\.lastNm"; @@ -51,6 +52,35 @@ class MorbidityReportPage { cy.get(this.jurisdictionField).select(jurisdiction, {force: true}); } + storeCondition() { + cy.get(this.conditionCode) + .invoke('text') + .then(condition => { + Cypress.env('morbidityCondition', condition); + cy.log('Stored morbidity condition: ' + condition); + }); + } + + checkFirstInvestigationWithCondition(condition) { + // Find the first row with the matching condition + cy.get('table.dtTable tbody tr') + .filter((index, row) => { + // Find the condition column (4th column, index 3) + const conditionText = Cypress.$(row).find('td:nth-child(4)').text().trim(); + return conditionText === condition; + }) + .first() + .scrollIntoView() + .should('be.visible') + .within(() => { + // Find and check the checkbox in the first column + cy.get('td:first-child input[type="checkbox"]') + .should('exist') + .and('be.visible') + .check({ force: true }); + }); + } + clearJurisdiction() { cy.get(this.jurisdictionField).select("", { force: true }); } @@ -89,8 +119,6 @@ class MorbidityReportPage { cy.get(this.addTreatmentButton).click(); } - - clickCodeLookup() { cy.get(this.codeLookupButton).first().click(); } @@ -107,8 +135,17 @@ class MorbidityReportPage { cy.get(this.editButton).click(); } - clickPrint() { + clickAndVerifyPrint() { + let printURL = '/nbs/LoadViewObservationMorb1.do?ContextAction=PrintPage'; + cy.window().then(win => { + cy.stub(win, 'open').as('open') + }); cy.get(this.printButton).click(); + cy.get("@open").should("have.been.calledWith", printURL); + cy.request(printURL, { method: 'GET' }).then((response) => { + const contentType = response.headers['content-type']; + expect(contentType).to.include('application/pdf'); + }); } clickTransferOwnership() { @@ -133,6 +170,27 @@ class MorbidityReportPage { cy.wait(500); } + storeInvestigationIdFromAssociationMessage() { + // Wait for the success message to appear + cy.get('#error1', { timeout: 10000 }) + .should('be.visible') + .invoke('text') + .then(text => { + // Extract the Investigation ID from parentheses + // Example: "Morbidity Report successfully associated to investigation: Botulism, foodborne (CAS10001000GA01)" + const match = text.match(/\(([^)]+)\)/); + + if (match && match[1]) { + const investigationId = match[1].trim(); + Cypress.env('investigationId', investigationId); + cy.log('Stored Investigation ID: ' + investigationId); + } else { + cy.log('No Investigation ID found in parentheses'); + throw new Error('Could not extract Investigation ID from: ' + text); + } + }); + } + // Patient entry methods enterPatientBothNames(firstName, lastName) { cy.get(this.patientFirstNameField).type(firstName); @@ -188,4 +246,5 @@ class MorbidityReportPage { cy.get("body").should("be.visible"); } } + export const morbidityReportPage = new MorbidityReportPage(); diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/openInvestigation.page.js b/testing/regression/cypress/e2e/pages/nbs-classic/openInvestigation.page.js index e8d7d04d4c..207cd0fde4 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/openInvestigation.page.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/openInvestigation.page.js @@ -187,7 +187,20 @@ class OpenInvestigationPage { clickSubmitBtnInCreateNotificationPage() { cy.get('#topcreatenotId input[type="button"][value="Submit"]').eq(0).click({ force: true }) } - } + + verifyMorbidityReportAssociation() { + const eventId = Cypress.env('morbidityEventId'); + cy.log('event ID is {}', eventId); + + // Find the second table in the Botulism tab (the Morbidity Reports table) + cy.get('#tabControlN108A0') + .find('table.TableInner') + .eq(1) // Second table (index 1) + .contains(eventId) + .should('exist') + } + +} export const openInvestigationPage = new OpenInvestigationPage(); \ No newline at end of file diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index 9a70c411f5..acc16af8cb 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -223,8 +223,8 @@ When("I click the Edit button on the Morbidity Report page", () => { morbidityReportPage.clickEdit(); }); -When("I click the Print button on the Morbidity Report page", () => { - morbidityReportPage.clickPrint(); +Then("clicking the Print button should display the print preview", () => { + morbidityReportPage.clickAndVerifyPrint(); }); When("I enter the current date in the Treatment Date field", () => { @@ -252,6 +252,18 @@ When("I click the Associate Investigation button on the Morbidity Report page", morbidityReportPage.clickAssociateInvestigation(); }); +When("I store the morbidity report's condition", () => { + morbidityReportPage.storeCondition(); +}); + +When("I check an investigation with the condition {string}", (condition) => { + morbidityReportPage.checkFirstInvestigationWithCondition(condition); +}); + +When("I store the Investigation ID from the association message", () => { + morbidityReportPage.storeInvestigationIdFromAssociationMessage(); +}); + // 6: Verification Steps When("I go to the Home page", () => { diff --git a/testing/regression/cypress/step_definitions/nbs-classic/openInvestigation.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/openInvestigation.steps.js index 86c4b1861c..5afcdf028b 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/openInvestigation.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/openInvestigation.steps.js @@ -155,3 +155,7 @@ Then('Click Create Notifications button from top action button group', () => { Then('Click Submit button in newly opened window Create Notification Page', () => { openInvestigationPage.clickSubmitBtnInCreateNotificationPage(); }); + +Then("the stored morbidity report should be associated with the investigation", () => { + openInvestigationPage.verifyMorbidityReportAssociation(); +}); diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index 97af46c5ae..358b9147de 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -54,10 +54,6 @@ When("I click on the first morbidity report link in the Events tab and store its eventsTabPage.clickFirstMorbidityReportLinkStoreEventID(); }); -When("I click on the first unassociated morbidity report link in the Events tab and store its Event ID", () => { - eventsTabPage.clickFirstUnassociatedMorbidityReport(); -}); - When("I count the number of treatments in the first morbidity report", () => { eventsTabPage.saveInitialTreatmentCount(); }); @@ -72,4 +68,8 @@ Then("the saved morbidity report should have jurisdiction {string}", (expectedJu Then("the saved morbidity report should be associated with an investigation", () => { eventsTabPage.verifyStoredMorbidityReportHasAssociation(); +}); + +When("I click on the stored Investigation ID in the Events tab", () => { + eventsTabPage.clickStoredInvestigationId(); }); \ No newline at end of file From 502bb5f42911661cd16ea6fe4319e8ec5409cac4 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Thu, 6 Aug 2026 14:18:30 -0700 Subject: [PATCH 12/16] tests: mark morb report as reviewed --- .../morbidityReportManagement.feature | 16 +++++++++++++++- .../pages/nbs-classic/morbidityReportPage.js | 5 +++++ .../cypress/e2e/pages/patientProfile.page.js | 19 +++++++++++++++++++ .../nbs-classic/dataEntry.steps.js | 4 ++++ .../step_definitions/patient.profile.step.js | 4 ++++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index ee026804b0..b3643b6e7f 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -94,6 +94,20 @@ Feature: Patient File - Event Management - Morbidity Report And I click on the stored Investigation ID in the Events tab Then the stored morbidity report should be associated with the investigation - # Scenario: Mark morbidity report as reviewed + Scenario: Mark morbidity report as reviewed + When user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit button + And Click Events tab on Patient Profile Page + And I click on the first morbidity report link in the Events tab and store its Event ID + And I click the Mark as Reviewed button on the Morbidity Report page + And user clicks the "View File" link, the user is returned to Patient profile summary page + Then the stored morbidity report ID should not appear in the Documents Requiring Review section + # Scenario: Mark morbidity report as reviewed - STD # Scenario: Delete morbidity report \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index a0a2b895cf..d1c41cafa4 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -20,6 +20,7 @@ class MorbidityReportPage { transferOwnershipButton = "input[id='Transfer Ownership']"; createInvestigationButton = "input[id='Create Investigation']"; associateInvestigationButton = "input[id='Associate Investigation']"; + markAsReviewedButton = "input[id='Mark as Reviewed']"; conditionCode = "#conditionCd"; // Patient entry fields @@ -135,6 +136,10 @@ class MorbidityReportPage { cy.get(this.editButton).click(); } + clickMarkAsReviewed() { + cy.get(this.markAsReviewedButton).first().click(); + } + clickAndVerifyPrint() { let printURL = '/nbs/LoadViewObservationMorb1.do?ContextAction=PrintPage'; cy.window().then(win => { diff --git a/testing/regression/cypress/e2e/pages/patientProfile.page.js b/testing/regression/cypress/e2e/pages/patientProfile.page.js index 9231969591..0d1182800f 100644 --- a/testing/regression/cypress/e2e/pages/patientProfile.page.js +++ b/testing/regression/cypress/e2e/pages/patientProfile.page.js @@ -276,6 +276,25 @@ class PatientProfilePage { cy.get("img[name='INV107_button']").type('Cobb County'); cy.get("#SubmitTop").click(); } + + verifyMorbidityEventIdNotInDocumentsRequiringReview() { + // Wait for page to load + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + const eventId = Cypress.env('morbidityEventId'); + + // Check if the event ID exists in the Documents Requiring Review table + cy.get('#documents-requiring-review-table') + .should('be.visible') + .then($table => { + const tableText = $table.text(); + expect(tableText, 'Morbidity event ID should NOT appear in Documents Requiring Review') + .to.not.include(eventId); + + }); + } + } export default new PatientProfilePage(); diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index acc16af8cb..bd7161a21b 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -264,6 +264,10 @@ When("I store the Investigation ID from the association message", () => { morbidityReportPage.storeInvestigationIdFromAssociationMessage(); }); +When("I click the Mark as Reviewed button on the Morbidity Report page", () => { + morbidityReportPage.clickMarkAsReviewed(); +}); + // 6: Verification Steps When("I go to the Home page", () => { diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index 358b9147de..f260aea85d 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -72,4 +72,8 @@ Then("the saved morbidity report should be associated with an investigation", () When("I click on the stored Investigation ID in the Events tab", () => { eventsTabPage.clickStoredInvestigationId(); +}); + +Then("the stored morbidity report ID should not appear in the Documents Requiring Review section", () => { + PatientProfilePage.verifyMorbidityEventIdNotInDocumentsRequiringReview(); }); \ No newline at end of file From 072561017e13723a8ea8bc6e97c916139997bc2d Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Thu, 6 Aug 2026 15:01:11 -0700 Subject: [PATCH 13/16] tests: delete morbidity report --- .../morbidityReportManagement.feature | 30 ++++++++++++++++-- .../cypress/e2e/pages/eventsTab.page.js | 29 +++++++++++++++++ .../pages/nbs-classic/morbidityReportPage.js | 31 +++++++++++++++++++ .../nbs-classic/dataEntry.steps.js | 8 +++++ .../step_definitions/patient.profile.step.js | 4 +++ 5 files changed, 100 insertions(+), 2 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index b3643b6e7f..ad35abbd29 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -109,5 +109,31 @@ Feature: Patient File - Event Management - Morbidity Report And user clicks the "View File" link, the user is returned to Patient profile summary page Then the stored morbidity report ID should not appear in the Documents Requiring Review section - # Scenario: Mark morbidity report as reviewed - STD - # Scenario: Delete morbidity report \ No newline at end of file + @skip-broken + # Unsure how to handle the popup for the Mark as Reviewed button, so skipping this test for now + Scenario: Mark morbidity report as reviewed - STD + When user clicks on the "Add morbidity report" button within the Events tab + And I select "AIDS" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit button + And Click Events tab on Patient Profile Page + And I click on the first morbidity report link in the Events tab and store its Event ID + And I click the Mark as Reviewed button on the Morbidity Report page and handle the popup + + Scenario: Delete morbidity report + When user clicks on the "Add morbidity report" button within the Events tab + And I select "Botulism, foodborne" from the Condition dropdown menu + And I select "Cobb County" from the Jurisdiction dropdown menu + And I enter the current date in the Date of Morbidity Report field + And I enter "2" in the Facility and Provider Information field + And I click on the Code Lookup button + And I select "No" from the Pregnant dropdown menu + And I click the Submit button + And Click Events tab on Patient Profile Page + And I click on the first morbidity report link in the Events tab and store its Event ID + And I click the delete button on the Morbidity Report page + Then the stored morbidity report ID should not appear in the Morbidity Reports section of the Events tab \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 9499dad4b6..2043a5dfed 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -268,6 +268,35 @@ class EventsTabPage { .should('be.visible') .click(); } + + verifyMorbidityEventIdNotInMorbidityReports() { + // Wait for page to load + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + const eventId = Cypress.env('morbidityEventId'); + // Check the Morbidity Reports table + cy.get('#morbidity-reports-table') + .should('be.visible') + .within(() => { + // Check all Event ID links (first column) + cy.get('tbody tr td:first-child a') + .then($links => { + let found = false; + $links.each((index, link) => { + const linkText = Cypress.$(link).text().trim(); + if (linkText === eventId) { + found = true; + } + }); + + expect(found, 'Morbidity event ID should NOT appear in Morbidity Reports table') + .to.be.false; + + }); + }); + } + } export default new EventsTabPage(); \ No newline at end of file diff --git a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js index d1c41cafa4..4500231bc4 100644 --- a/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js +++ b/testing/regression/cypress/e2e/pages/nbs-classic/morbidityReportPage.js @@ -17,6 +17,7 @@ class MorbidityReportPage { cancelButton = "#Cancel"; editButton = '#Edit'; printButton = "#Print"; + deleteButton = "#Delete"; transferOwnershipButton = "input[id='Transfer Ownership']"; createInvestigationButton = "input[id='Create Investigation']"; associateInvestigationButton = "input[id='Associate Investigation']"; @@ -169,6 +170,10 @@ class MorbidityReportPage { cy.get(this.submitAndCreateInvestigationButton).eq(0).click(); } + clickDelete() { + cy.get(this.deleteButton).first().click(); + } + confirmSubmission() { cy.on("window:confirm", () => true); // Automatically confirm the popup // small buffer @@ -196,6 +201,32 @@ class MorbidityReportPage { }); } + clickMarkAsReviewedAndHandlePopup() { + // Wait for page to load + cy.get('._indicator_1vvtd_1', { timeout: 10000 }) + .should('not.exist'); + + // Intercept the window.open call for the Mark as Reviewed popup + cy.window().then(win => { + const originalOpen = win.open; + cy.stub(win, 'open').callsFake((url, target, features) => { + cy.log('Mark as Reviewed popup URL intercepted: ' + url); + + // Instead of opening a new window, navigate to the URL in the same window + // This effectively "stubs" the popup and loads it on the same page + cy.visit(url); + win.markAsReviewed(); // Call the function to mark as reviewed + + }); + }); + + // Click the Mark as Reviewed button + cy.get('#Mark\\ as\\ Reviewed') + .should('be.visible') + .first() + .click(); + } + // Patient entry methods enterPatientBothNames(firstName, lastName) { cy.get(this.patientFirstNameField).type(firstName); diff --git a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js index bd7161a21b..28c57eb9bd 100644 --- a/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js +++ b/testing/regression/cypress/step_definitions/nbs-classic/dataEntry.steps.js @@ -268,6 +268,14 @@ When("I click the Mark as Reviewed button on the Morbidity Report page", () => { morbidityReportPage.clickMarkAsReviewed(); }); +When("I click the Mark as Reviewed button on the Morbidity Report page and handle the popup", () => { + morbidityReportPage.clickMarkAsReviewedAndHandlePopup(); +}); + +When("I click the delete button on the Morbidity Report page", () => { + morbidityReportPage.clickDelete(); +}); + // 6: Verification Steps When("I go to the Home page", () => { diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index f260aea85d..28cb1bdc6b 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -76,4 +76,8 @@ When("I click on the stored Investigation ID in the Events tab", () => { Then("the stored morbidity report ID should not appear in the Documents Requiring Review section", () => { PatientProfilePage.verifyMorbidityEventIdNotInDocumentsRequiringReview(); +}); + +Then("the stored morbidity report ID should not appear in the Morbidity Reports section of the Events tab", () => { + eventsTabPage.verifyMorbidityEventIdNotInMorbidityReports(); }); \ No newline at end of file From 31cccabb1c343c1a0378ddc4ea4a887b92acd482 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Fri, 7 Aug 2026 14:53:55 -0700 Subject: [PATCH 14/16] tests: click unassociated morbidity report --- .../cypress/e2e/pages/eventsTab.page.js | 25 +++++++++++++++++++ .../step_definitions/patient.profile.step.js | 4 +++ 2 files changed, 29 insertions(+) diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index 2043a5dfed..da872fe497 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -269,6 +269,31 @@ class EventsTabPage { .click(); } + clickFirstUnassociatedMorbidityReport() { + this.waitForSpinner(); + + cy.get(EventsTabPage.MORBIDITY_TABLE_SELECTOR) + .filter((index, row) => { + const associatedText = Cypress.$(row) + .find('td:nth-child(' + EventsTabPage.ASSOCIATED_COLUMN + ')') + .text() + .trim(); + return associatedText === '---'; + }) + .first() + .scrollIntoView() + .should('be.visible') + .within(() => { + cy.get('td:first-child a') + .scrollIntoView() + .should('be.visible') + .then($link => { + this.extractAndStoreEventId($link); + this.clickLink($link); + }); + }); + } + verifyMorbidityEventIdNotInMorbidityReports() { // Wait for page to load cy.get('._indicator_1vvtd_1', { timeout: 10000 }) diff --git a/testing/regression/cypress/step_definitions/patient.profile.step.js b/testing/regression/cypress/step_definitions/patient.profile.step.js index 28cb1bdc6b..793e475b63 100644 --- a/testing/regression/cypress/step_definitions/patient.profile.step.js +++ b/testing/regression/cypress/step_definitions/patient.profile.step.js @@ -74,6 +74,10 @@ When("I click on the stored Investigation ID in the Events tab", () => { eventsTabPage.clickStoredInvestigationId(); }); +When("I click on the first unassociated morbidity report link in the Events tab and store its Event ID", () => { + eventsTabPage.clickFirstUnassociatedMorbidityReport(); +}); + Then("the stored morbidity report ID should not appear in the Documents Requiring Review section", () => { PatientProfilePage.verifyMorbidityEventIdNotInDocumentsRequiringReview(); }); From 51ad89aeeb528ea74f5f3fe107022dc8aaa4fe20 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Fri, 7 Aug 2026 15:19:45 -0700 Subject: [PATCH 15/16] tests: deal with drr being invisible --- .../cypress/e2e/pages/patientProfile.page.js | 49 ++++++++++++++++--- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/testing/regression/cypress/e2e/pages/patientProfile.page.js b/testing/regression/cypress/e2e/pages/patientProfile.page.js index 0d1182800f..bf8d4836ba 100644 --- a/testing/regression/cypress/e2e/pages/patientProfile.page.js +++ b/testing/regression/cypress/e2e/pages/patientProfile.page.js @@ -283,16 +283,49 @@ class PatientProfilePage { .should('not.exist'); const eventId = Cypress.env('morbidityEventId'); - - // Check if the event ID exists in the Documents Requiring Review table - cy.get('#documents-requiring-review-table') - .should('be.visible') - .then($table => { - const tableText = $table.text(); + + // Check if the Documents Requiring Review section exists + cy.get('body').then($body => { + const $table = $body.find('#documents-requiring-review-table'); + + if ($table.length === 0) { + // Table doesn't exist - pass + return; + } + + // Check if the table is visible or hidden + const isVisible = $table.is(':visible'); + + if (!isVisible) { + + const tableText = $table.text().trim(); + + if (tableText === '') { + // Table is empty - pass + return; + } + + // Table has data, check for the event ID expect(tableText, 'Morbidity event ID should NOT appear in Documents Requiring Review') .to.not.include(eventId); - - }); + return; + } + + // Table is visible, check its content + const tableText = $table.text().trim(); + + if (tableText === '' || tableText.includes('No data has been added')) { + // Table is empty - pass + cy.log('Documents Requiring Review table is empty - no documents to review'); + cy.log('Verified morbidity event ID is NOT in Documents Requiring Review: ' + eventId); + return; + } + + // Table has data, check for the event ID + expect(tableText, 'Morbidity event ID should NOT appear in Documents Requiring Review') + .to.not.include(eventId); + + }); } } From 7bbb5a51104fe4739db5013936c9277d053de181 Mon Sep 17 00:00:00 2001 From: Krista Chan Date: Mon, 10 Aug 2026 13:44:12 -0700 Subject: [PATCH 16/16] tests: check both investigation and morb report count --- .../features/nbs-classic/morbidityReportManagement.feature | 2 ++ testing/regression/cypress/e2e/pages/eventsTab.page.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature index ad35abbd29..fab0f23146 100644 --- a/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature +++ b/testing/regression/cypress/e2e/features/nbs-classic/morbidityReportManagement.feature @@ -20,6 +20,7 @@ Feature: Patient File - Event Management - Morbidity Report Scenario: Add new morbidity report and create investigation When I check the current count of "Investigations" in the Events tab + And I check the current count of "Morbidity reports" in the Events tab And user clicks on the "Add morbidity report" button within the Events tab And I select "Botulism, foodborne" from the Condition dropdown menu And I select "Cobb County" from the Jurisdiction dropdown menu @@ -32,6 +33,7 @@ Feature: Patient File - Event Management - Morbidity Report And user clicks the "View File" link, the user is returned to Patient profile summary page And Click Events tab on Patient Profile Page Then the "Investigations" count should increase by 1 in the Events tab + And the "Morbidity reports" count should increase by 1 in the Events tab Scenario: Cancel creation of a new morbidity report When I check the current count of "Morbidity reports" in the Events tab diff --git a/testing/regression/cypress/e2e/pages/eventsTab.page.js b/testing/regression/cypress/e2e/pages/eventsTab.page.js index da872fe497..ce4a059378 100644 --- a/testing/regression/cypress/e2e/pages/eventsTab.page.js +++ b/testing/regression/cypress/e2e/pages/eventsTab.page.js @@ -113,7 +113,7 @@ class EventsTabPage { .invoke('text') .then(text => { const count = parseInt(text.trim()); - Cypress.env('reportCount', count); + Cypress.env(ReportType.trim() + 'Count', count); cy.log('Saved ' + ReportType + ' count: ' + count); }); } @@ -122,7 +122,7 @@ class EventsTabPage { const reportIndex = this.reportTypeIndexMap[ReportType]; this.waitForSpinner(); - const initialCount = Cypress.env('reportCount'); + const initialCount = Cypress.env(ReportType.trim() + 'Count'); this.getCountBadge(reportIndex) .invoke('text') @@ -138,7 +138,7 @@ class EventsTabPage { const reportIndex = this.reportTypeIndexMap[ReportType]; this.waitForSpinner(); - const initialCount = Cypress.env('reportCount'); + const initialCount = Cypress.env(ReportType.trim() + 'Count'); this.getCountBadge(reportIndex) .invoke('text')