Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/issues/9053/prevent…
Browse files Browse the repository at this point in the history
…-negative-quantity-and-empty-description' into issues/9053/prevent-negative-quantity-and-empty-description
  • Loading branch information
JavidSumra committed Nov 21, 2024
2 parents de7d829 + fe78ab4 commit 6440d4b
Show file tree
Hide file tree
Showing 36 changed files with 949 additions and 423 deletions.
11 changes: 5 additions & 6 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { pageNavigation } from "pageobject/utils/paginationHelpers";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
const assetQRScanPage = new AssetQRScanPage();
const assetPagination = new AssetPagination();
const assetFilters = new AssetFilters();
const assetPage = new AssetPage();
const loginPage = new LoginPage();
Expand Down Expand Up @@ -79,10 +78,10 @@ describe("Asset Tab", () => {
// Verify the pagination in the page

it("Next/Previous Page", () => {
assetPagination.navigateToNextPage();
assetPagination.verifyNextUrl();
assetPagination.navigateToPreviousPage();
assetPagination.verifyPreviousUrl();
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
pageNavigation.navigateToPreviousPage();
pageNavigation.verifyCurrentPageNumber(1);
});

it("Import new asset", () => {
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/facility_spec/FacilityHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// FacilityCreation
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { pageNavigation } from "pageobject/utils/paginationHelpers";

import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import FacilityNotify from "../../pageobject/Facility/FacilityNotify";
Expand All @@ -15,7 +16,6 @@ describe("Facility Homepage Function", () => {
const facilityPage = new FacilityPage();
const manageUserPage = new ManageUserPage();
const userPage = new UserPage();
const assetPagination = new AssetPagination();
const facilitiesAlias = "downloadFacilitiesCSV";
const doctorsAlias = "downloadDoctorsCSV";
const triagesAlias = "downloadTriagesCSV";
Expand Down Expand Up @@ -83,10 +83,10 @@ describe("Facility Homepage Function", () => {

it("Search a facility in homepage and pagination", () => {
// pagination of the facility page
assetPagination.navigateToNextPage();
assetPagination.verifyNextUrl();
assetPagination.navigateToPreviousPage();
assetPagination.verifyPreviousUrl();
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
pageNavigation.navigateToPreviousPage();
pageNavigation.verifyCurrentPageNumber(1);
// search for a facility
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
Expand Down
7 changes: 3 additions & 4 deletions cypress/e2e/facility_spec/FacilityLocation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pageNavigation } from "pageobject/utils/paginationHelpers";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import FacilityLocation from "../../pageobject/Facility/FacilityLocation";
Expand All @@ -12,7 +12,6 @@ describe("Location Management Section", () => {
const userCreationPage = new UserCreationPage();
const facilityPage = new FacilityPage();
const facilityLocation = new FacilityLocation();
const assetPagination = new AssetPagination();
const facilityHome = new FacilityHome();

const EXPECTED_LOCATION_ERROR_MESSAGES = [
Expand Down Expand Up @@ -172,8 +171,8 @@ describe("Location Management Section", () => {
facilityLocation.setMultipleBeds(numberOfModifiedBeds);
assetPage.clickassetupdatebutton();
// pagination
assetPagination.navigateToNextPage();
assetPagination.navigateToPreviousPage();
pageNavigation.navigateToNextPage();
pageNavigation.navigateToPreviousPage();
facilityLocation.closeNotification();
});

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/hcx_spec/HcxClaims.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("HCX Claims configuration and approval workflow", () => {
const patientConsultationPage = new PatientConsultationPage();
const patientInsurance = new PatientInsurance();
const hcxClaims = new HcxClaims();
const hcxPatientName = "Dummy Patient 14";
const hcxPatientName = "Dummy Patient Thirteen";
const firstInsuranceIdentifier = "insurance-details-0";
const patientMemberId = "001";
const patientPolicyId = "100";
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientBedManagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe("Patient swtich bed functionality", () => {
const switchBedOne = "Dummy Bed 4";
const switchBedTwo = "Dummy Bed 1";
const switchBedThree = "Dummy Bed 7";
const switchPatientOne = "Dummy Patient 6";
const switchPatientTwo = "Dummy Patient 7";
const switchPatientOne = "Dummy Patient Six";
const switchPatientTwo = "Dummy Patient Seven";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe("Patient Consultation in multiple combination", () => {
});

it("Edit created consultation to existing patient", () => {
patientPage.visitPatient("Dummy Patient 13");
patientPage.visitPatient("Dummy Patient Thirteen");
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.typePatientIllnessHistory("editted");
patientConsultationPage.selectPatientDiagnosis(
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("Patient Discharge based on multiple reason", () => {
});

it("Discharge a LAMA patient in the consultation", () => {
patientPage.visitPatient("Dummy Patient 12");
patientPage.visitPatient("Discharge Patient One");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason4);
cy.clickSubmitButton("Confirm Discharge");
Expand All @@ -47,7 +47,7 @@ describe("Patient Discharge based on multiple reason", () => {
});

it("Discharge a expired patient in the consultation", () => {
patientPage.visitPatient("Dummy Patient 13");
patientPage.visitPatient("Discharge Patient Two");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason3);
patientDischarge.typeDischargeNote(patientDeathCause);
Expand All @@ -67,7 +67,7 @@ describe("Patient Discharge based on multiple reason", () => {
});

it("Discharge patient with referred reason to a facility", () => {
patientPage.visitPatient("Dummy Patient 16");
patientPage.visitPatient("Discharge Patient Three");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason2);
patientDischarge.typeDischargeNote(patientDischargeAdvice);
Expand All @@ -93,7 +93,7 @@ describe("Patient Discharge based on multiple reason", () => {
});

it("Discharge a recovered patient with all relevant fields", () => {
patientPage.visitPatient("Dummy Patient 15");
patientPage.visitPatient("Discharge Patient Four");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason1);
patientDischarge.typeDischargeNote(patientDischargeAdvice);
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ describe("Patient Doctor Connect in consultation page", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const doctorconnect = new DoctorConnect();
const patientName = "Dummy Patient 11";
const patientName = "Dummy Patient Eleven";
const doctorUser = "Dev Doctor";
const nurseUser = "Dev Staff";
const teleIcuUser = "Dev Doctor Two";
const teleIcuUser = "Tester Doctor";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientDoctorNotes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Patient Discussion notes in the consultation page", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientDoctorNotes = new PatientDoctorNotes();
const patientName = "Dummy Patient 4";
const patientName = "Dummy Patient Four";
const patientNurseNote = "Test nurse Notes";
const patientNurseReplyNote = "Test nurse reply Notes";
const discussionNotesSubscribeWarning =
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/patient_spec/PatientFileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ function runTests(
const cypressAudioName = "cypress audio";
const cypressFileName = "cypress name";
const newFileName = "cypress modified name";
const patientNameOne = "Dummy Patient 3";
const patientNameTwo = "Dummy Patient 4";
const patientNameThree = "Dummy Patient 5";
const patientNameOne = "Dummy Patient Three";
const patientNameTwo = "Dummy Patient Four";
const patientNameThree = "Dummy Patient Five";
before(() => {
loginPage.loginAsDistrictAdmin();
cy.saveLocalStorage();
Expand Down
7 changes: 4 additions & 3 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { pageNavigation } from "pageobject/utils/paginationHelpers";

import LoginPage from "../../pageobject/Login/LoginPage";
import PatientHome from "../../pageobject/Patient/PatientHome";
Expand Down Expand Up @@ -163,15 +164,15 @@ describe("Patient Homepage present functionalities", () => {
.invoke("text")
.then((patientOne: string) => {
firstPatientPageOne = patientOne.trim();
patientHome.clickNextPage();
patientHome.verifySecondPageUrl();
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
cy.get('[data-cy="patient"]')
.first()
.invoke("text")
.then((patientTwo: string) => {
const firstPatientPageTwo = patientTwo.trim();
expect(firstPatientPageOne).not.to.eq(firstPatientPageTwo);
patientHome.clickPreviousPage();
pageNavigation.navigateToPreviousPage();
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientInvestigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Patient Investigation Creation from Patient consultation page", () =>
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientInvestigation = new PatientInvestigation();
const patientName = "Dummy Patient 14";
const patientName = "Dummy Patient Thirteen";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/patient_spec/PatientLogUpdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
const patientInsulinDosage = "56";
const patientFluidBalance = "500";
const patientNetBalance = "1000";
const patientOne = "Dummy Patient 9";
const patientOne = "Dummy Patient Nine";
const bedOne = "Dummy Bed 5";
const patientTwo = "Dummy Patient 10";
const patientTwo = "Dummy Patient Ten";
const bedTwo = "Dummy Bed 2";
const patientThree = "Dummy Patient 8";
const patientThree = "Dummy Patient Eight";
const bedThree = "Dummy Bed 3";
const domicilaryPatient = "Dummy Patient 11";
const domicilaryPatient = "Dummy Patient Eleven";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/patient_spec/PatientPrescription.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("Patient Medicine Administration", () => {
});

it("Add a new medicine | Verify the Edit and Discontinue Medicine workflow |", () => {
patientPage.visitPatient("Dummy Patient 9");
patientPage.visitPatient("Dummy Patient Nine");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
// Add a normal Medicine to the patient
Expand Down Expand Up @@ -63,7 +63,7 @@ describe("Patient Medicine Administration", () => {
});

it("Add a PRN Prescription medicine | Group Administrate it |", () => {
patientPage.visitPatient("Dummy Patient 6");
patientPage.visitPatient("Dummy Patient Six");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
// Add First Medicine
Expand Down Expand Up @@ -97,7 +97,7 @@ describe("Patient Medicine Administration", () => {
});

it("Add a new titrated medicine for a patient | Individual Administeration |", () => {
patientPage.visitPatient("Dummy Patient 5");
patientPage.visitPatient("Dummy Patient Five");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
patientPrescription.clickAddPrescription();
Expand Down Expand Up @@ -136,7 +136,7 @@ describe("Patient Medicine Administration", () => {
});

it("Add a new medicine for a patient and verify the duplicate medicine validation", () => {
patientPage.visitPatient("Dummy Patient 4");
patientPage.visitPatient("Dummy Patient Four");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
patientPrescription.clickAddPrescription();
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("Patient Creation with consultation", () => {
const patientOneSecondInsurerName = "Care Payor";
const patientTransferPhoneNumber = "9849511866";
const patientTransferFacility = "Dummy Shifting Center";
const patientTransferName = "Dummy Patient 10";
const patientTransferName = "Dummy Patient Twelve";
const patientOccupation = "Student";

before(() => {
Expand Down Expand Up @@ -243,7 +243,7 @@ describe("Patient Creation with consultation", () => {
patientTransfer.clickTransferPatientYOB(yearOfBirth);
patientTransfer.clickTransferSubmitButton();
cy.verifyNotification(
"Patient Dummy Patient 10 (Male) transferred successfully",
`Patient ${patientTransferName} (Male) transferred successfully`,
);
patientTransfer.clickConsultationCancelButton();
// allow the transfer button of a patient
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Sample Test", () => {
const patientPage = new PatientPage();
const loginPage = new LoginPage();
const patientConsultationPage = new PatientConsultationPage();
const patientName = "Dummy Patient 11";
const patientName = "Dummy Patient Eleven";
const sampleTestType = "BA/ETA";
const icmrCategory = "Cat 0";
const icmrLabel = "Test Icmr Label";
Expand Down
11 changes: 6 additions & 5 deletions cypress/e2e/users_spec/UsersHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { pageNavigation } from "pageobject/utils/paginationHelpers";

import LoginPage from "../../pageobject/Login/LoginPage";
import { UserPage } from "../../pageobject/Users/UserSearch";
Expand All @@ -16,7 +17,7 @@ describe("User Homepage", () => {
const altPhoneNumber = "8878825662";
const homeFacility = "Dummy Facility 40";
const nurseUserName = "dummynurse1";
const doctorUserName = "devdoctor1";
const doctorUserName = "dev-doctor2";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down Expand Up @@ -84,10 +85,10 @@ describe("User Homepage", () => {
});

it("Next/Previous Page Navigation", () => {
userPage.navigateToNextPage();
userPage.verifyCurrentPageNumber(2);
userPage.navigateToPreviousPage();
userPage.verifyCurrentPageNumber(1);
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
pageNavigation.navigateToPreviousPage();
pageNavigation.verifyCurrentPageNumber(1);
});

afterEach(() => {
Expand Down
19 changes: 0 additions & 19 deletions cypress/pageobject/Asset/AssetPagination.ts
Original file line number Diff line number Diff line change
@@ -1,19 +0,0 @@
export class AssetPagination {
navigateToNextPage() {
// only works for desktop mode
cy.get("button#next-pages").click();
}

verifyNextUrl() {
cy.url().should("include", "page=2");
}

navigateToPreviousPage() {
// only works for desktop mode
cy.get("button#prev-pages").click();
}

verifyPreviousUrl() {
cy.url().should("include", "page=1");
}
}
12 changes: 0 additions & 12 deletions cypress/pageobject/Patient/PatientHome.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
class PatientHome {
clickNextPage() {
cy.get("#next-pages").click();
}

verifySecondPageUrl() {
cy.url().should("include", "/patients?page=2");
}

clickPreviousPage() {
cy.get("#prev-pages").click();
}

clickPatientExport() {
cy.get("#patient-export").click();
}
Expand Down
12 changes: 0 additions & 12 deletions cypress/pageobject/Users/UserSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ export class UserPage {
cy.get(`[data-testid="${testId}"]`).should("not.be.visible");
}

navigateToNextPage() {
cy.get("button#next-pages").click();
}

navigateToPreviousPage() {
cy.get("button#prev-pages").click();
}

verifyCurrentPageNumber(pageNumber: number) {
cy.url().should("include", `page=${pageNumber}`);
}

verifyMultipleBadgesWithSameId(alreadylinkedusersviews: string[]) {
cy.get("#user-view-name").then(($elements) => {
const userViews = $elements
Expand Down
Loading

0 comments on commit 6440d4b

Please sign in to comment.