Skip to content

Commit

Permalink
Merge branch 'develop' into gsoc-doctor-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
UdaySagar-Git authored Oct 13, 2024
2 parents 5d869c4 + e588270 commit 93f3f86
Show file tree
Hide file tree
Showing 54 changed files with 2,367 additions and 2,206 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ describe("Asset Tab", () => {
it("Export asset", () => {
assetPage.selectassetimportbutton();
cy.wait(2000);
assetPage.selectjsonexportbutton();
assetPage.selectJsonExportButton();
assetPage.selectassetimportbutton();
assetPage.selectcsvexportbutton();
assetPage.selectCsvExportButton();
});

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/assets_spec/AssetsCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe("Asset", () => {
"d5694af2-21e2-4a39-9bad-2fb98d9818bd",
);
assetPage.clickConfigureAsset();
assetPage.verifyAssetConfiguration(200);
assetPage.verifyAssetConfiguration();
});

it("Add an vital monitor asset and configure it", () => {
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/patient_spec/PatientFileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientFileUpload = new PatientFileUpload();

function runTests(testDescription, visitPatientFileUploadSection) {
function runTests(
testDescription: string,
visitPatientFileUploadSection: () => void,
) {
describe(testDescription, () => {
const cypressAudioName = "cypress audio";
const cypressFileName = "cypress name";
Expand Down
128 changes: 128 additions & 0 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ import PatientHome from "../../pageobject/Patient/PatientHome";
describe("Patient Homepage present functionalities", () => {
const loginPage = new LoginPage();
const patientHome = new PatientHome();
const patientGender = "Male";
const patientCategory = "Moderate";
const patientMinimumAge = "18";
const patientMaximumAge = "24";
const patientLastAdmittedBed = "No bed assigned";
const PatientLastConsentType = "No consents";
const patientTelemedicinePerference = "No";
const patientReviewStatus = "No";
const patientMedicoStatus = "Non-Medico-Legal";
const patientIcdDiagnosis = "1A00";
const facilityName = "Dummy Facility 40";
const facilityType = "Private Hospital";
const facilityLsgBody = "Aikaranad Grama Panchayat, Ernakulam District";
const facilityDistrict = "Ernakulam";
const patientFromDate = "01122023";
const patientToDate = "07122023";
const patientFromDateBadge = "2023-12-01";
const patientToDateBadge = "2023-12-07";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -16,6 +34,116 @@ describe("Patient Homepage present functionalities", () => {
cy.awaitUrl("/patients");
});

it("Date based advance filters applied in the patient tab", () => {
patientHome.clickPatientAdvanceFilters();
patientHome.typePatientCreatedBeforeDate(patientFromDate);
patientHome.typePatientCreatedAfterDate(patientToDate);
patientHome.typePatientModifiedBeforeDate(patientFromDate);
patientHome.typePatientModifiedAfterDate(patientToDate);
patientHome.typePatientAdmitedBeforeDate(patientFromDate);
patientHome.typePatientAdmitedAfterDate(patientToDate);
patientHome.clickPatientFilterApply();
patientHome.verifyTotalPatientCount("1");
// verify the badge and clear the count
patientHome.verifyPatientCreatedBeforeDate(patientToDateBadge);
patientHome.verifyPatientCreatedAfterDate(patientFromDateBadge);
patientHome.verifyPatientModifiedBeforeDate(patientToDateBadge);
patientHome.verifyPatientModifiedAfterDate(patientFromDateBadge);
patientHome.verifyPatientAdmittedBeforeDate(patientToDateBadge);
patientHome.verifyPatientAdmittedAfterDate(patientFromDateBadge);
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
});

it("Facility Geography based advance filters applied in the patient tab", () => {
patientHome.clickPatientAdvanceFilters();
patientHome.typeFacilityName(facilityName);
patientHome.selectFacilityType(facilityType);
patientHome.typeFacilityLsgBody(facilityLsgBody);
patientHome.typeFacilityDistrict(facilityDistrict);
patientHome.clickPatientFilterApply();
patientHome.verifyTotalPatientCount("1");
// Clear the badges and verify the patient count along with badges
patientHome.verifyFacilityNameBadgeContent(facilityName);
patientHome.verifyFacilityTypeBadgeContent(facilityType);
patientHome.verifyFacilityLsgBadgeContent(facilityLsgBody);
patientHome.verifyFacilityDistrictContent(facilityDistrict);
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
});

it("Patient diagnosis based advance filters applied in the patient tab", () => {
// Patient Filtering based on icd-11 data
patientHome.clickPatientAdvanceFilters();
patientHome.selectAnyIcdDiagnosis(patientIcdDiagnosis, patientIcdDiagnosis);
patientHome.selectConfirmedIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.selectUnconfirmedIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.selectProvisionalIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.selectDifferentialIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.clickPatientFilterApply();
patientHome.verifyTotalPatientCount("0");
// verify the badges presence in the platform
patientHome.verifyAnyDiagnosisBadgeContent(patientIcdDiagnosis);
patientHome.verifyConfirmedDiagnosisBadgeContent(patientIcdDiagnosis);
patientHome.verifyUnconfirmedDiagnosisBadgeContent(patientIcdDiagnosis);
patientHome.verifyProvisionalDiagnosisBadgeContent(patientIcdDiagnosis);
patientHome.verifyDifferentialDiagnosisBadgeContent(patientIcdDiagnosis);
// Clear the badges and verify the patient count along with badges
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
// Apply Any and confirmed diagonsis to verify patient count 17
patientHome.clickPatientAdvanceFilters();
patientHome.selectAnyIcdDiagnosis(patientIcdDiagnosis, patientIcdDiagnosis);
patientHome.selectConfirmedIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.clickPatientFilterApply();
patientHome.verifyTotalPatientCount("1");
});

it("Patient Details based advance filters applied in the patient tab", () => {
// Patient Filtering based on patient details
patientHome.clickPatientAdvanceFilters();
patientHome.selectPatientGenderfilter(patientGender);
patientHome.selectPatientCategoryfilter(patientCategory);
patientHome.typePatientMinimumAgeFilter(patientMinimumAge);
patientHome.typePatientMaximumAgeFilter(patientMaximumAge);
patientHome.selectPatientLastAdmittedBed(patientLastAdmittedBed);
patientHome.selectPatientLastConsentType(PatientLastConsentType);
patientHome.selectPatientTelemedicineFilter(patientTelemedicinePerference);
patientHome.selectPatientReviewFilter(patientReviewStatus);
patientHome.selectPatientMedicoFilter(patientMedicoStatus);
patientHome.clickPatientFilterApply();
cy.get("a[data-cy='patient']").should("contain.text", "Dummy Patient");
patientHome.verifyTotalPatientCount("1");
// Verify the presence of badges
patientHome.verifyGenderBadgeContent(patientGender);
patientHome.verifyCategoryBadgeContent(patientCategory);
patientHome.verifyMinAgeBadgeContent(patientMinimumAge);
patientHome.verifyMaxAgeBadgeContent(patientMaximumAge);
patientHome.verifyLastAdmittedBedBadgeContent(patientLastAdmittedBed);
patientHome.verifyLastConsentTypeBadgeContent("No Consents");
patientHome.verifyTelemedicineBadgeContent("false");
patientHome.verifyReviewMissedBadgeContent("false");
patientHome.verifyMedicoBadgeContent("false");
// Clear the badges and verify the patient count along with badges
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
});

it("Export the live patient list based on a date range", () => {
patientHome.clickPatientExport();
cy.verifyNotification("Please select a seven day period");
Expand Down
8 changes: 2 additions & 6 deletions cypress/e2e/sample_test_spec/SampleTestHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ describe("Sample List", () => {
it("Search by District name", () => {
cy.intercept(/\/api\/v1\/test_sample/).as("test_sample");
cy.get("[name='district_name']").type("Test");
cy.wait("@test_sample").then((interception) => {
expect(interception.response.statusCode).to.equal(200);
});
cy.wait("@test_sample").its("response.statusCode").should("eq", 200);
cy.url().should("include", "Test");
});

it("Search by Patient Name", () => {
cy.intercept(/\/api\/v1\/test_sample/).as("test_sample");
cy.get("[name='patient_name']").type("Test");
cy.wait("@test_sample").then((interception) => {
expect(interception.response.statusCode).to.equal(200);
});
cy.wait("@test_sample").its("response.statusCode").should("eq", 200);
cy.url().should("include", "Test");
});

Expand Down
20 changes: 6 additions & 14 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ export class AssetPage {
cy.intercept(/\/api\/v1\/asset/).as("asset");
}

verifyAssetConfiguration(statusCode: number) {
cy.wait("@asset").then((interception) => {
expect(interception.response.statusCode).to.equal(statusCode);
});
verifyAssetConfiguration() {
cy.wait("@asset").its("response.statusCode").should("eq", 200);
}

clickConfigureAsset() {
Expand Down Expand Up @@ -222,22 +220,16 @@ export class AssetPage {
cy.get("[data-testid=import-asset-button]").click();
}

selectjsonexportbutton() {
selectJsonExportButton() {
cy.intercept("GET", "**/api/v1/asset/?**json=true**").as("getJsonexport");
cy.get("#export-json-option").click();
cy.wait("@getJsonexport").then(({ request, response }) => {
expect(response.statusCode).to.eq(200);
expect(request.url).to.include("json=true");
});
cy.wait("@getJsonexport").its("response.statusCode").should("eq", 200);
}

selectcsvexportbutton() {
selectCsvExportButton() {
cy.intercept("GET", "**/api/v1/asset/?**csv=true**").as("getCsvexport");
cy.get("#export-csv-option").click();
cy.wait("@getCsvexport").then(({ request, response }) => {
expect(response.statusCode).to.eq(200);
expect(request.url).to.include("csv=true");
});
cy.wait("@getCsvexport").its("response.statusCode").should("eq", 200);
}

selectImportOption() {
Expand Down
8 changes: 4 additions & 4 deletions cypress/pageobject/Asset/AssetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export class AssetFilters {
cy.get("#close-slide-over").click();
}
// Assertions
assertFacilityText(text) {
assertFacilityText(text: string) {
cy.get("[data-testid=Facility]").should("contain", text);
}
assertAssetClassText(text) {
assertAssetClassText(text: string) {
cy.get("[data-testid='Asset Class']").should("contain", text);
}
assertStatusText(text) {
assertStatusText(text: string) {
cy.get("[data-testid=Status]").should("contain", text);
}
assertLocationText(text) {
assertLocationText(text: string) {
cy.get("[data-testid=Location]").should("contain", text);
}
}
24 changes: 12 additions & 12 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class FacilityPage {
.should("eq", 200);
}

typeFacilitySearch(facilityName) {
typeFacilitySearch(facilityName: string) {
cy.get("#search").click().clear();
cy.get("#search").click().type(facilityName);
}
Expand All @@ -21,7 +21,7 @@ class FacilityPage {
cy.get("#manage-facility-dropdown button").should("be.visible");
}

clickUpdateFacilityType(facilityType) {
clickUpdateFacilityType(facilityType: string) {
cy.get("#facility_type")
.click()
.then(() => {
Expand Down Expand Up @@ -225,11 +225,11 @@ class FacilityPage {
}

fillTriageEntryFields(
visited,
homeQuarantine,
isolation,
referred,
confirmedPositive,
visited: string,
homeQuarantine: string,
isolation: string,
referred: string,
confirmedPositive: string,
) {
cy.get("#num_patients_visited").clear().click().type(visited);
cy.get("#num_patients_home_quarantine")
Expand All @@ -244,7 +244,7 @@ class FacilityPage {
.type(confirmedPositive);
}

fillEntryDate(date) {
fillEntryDate(date: string) {
cy.get("#entry_date").click();
cy.get("#date-input").click().type(date);
}
Expand All @@ -253,13 +253,13 @@ class FacilityPage {
cy.get("#edit-button").click();
}

clickButtonsMultipleTimes(selector) {
clickButtonsMultipleTimes(selector: string) {
cy.get(selector).each(($button) => {
cy.wrap($button).click();
});
}

verifyTriageTableContains(value) {
verifyTriageTableContains(value: string) {
cy.get("#triage-table").contains(value);
}

Expand Down Expand Up @@ -430,7 +430,7 @@ class FacilityPage {
return cy.get("#district");
}

selectStateOnPincode(stateName) {
selectStateOnPincode(stateName: string) {
this.getStateElement()
.scrollIntoView()
.wait(2000)
Expand All @@ -444,7 +444,7 @@ class FacilityPage {
});
}

selectDistrictOnPincode(districtName) {
selectDistrictOnPincode(districtName: string) {
this.getDistrictElement()
.scrollIntoView()
.wait(2000)
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Facility/FacilityHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FacilityHome {
cy.get("#facility-detailspage-cns").click();
}

selectLocation(location) {
selectLocation(location: string) {
cy.get("#location").click().type(location);
cy.get("li[role=option]").contains(location).click();
}
Expand Down Expand Up @@ -99,7 +99,7 @@ class FacilityHome {
return cy.url();
}

verifyURLContains(searchText) {
verifyURLContains(searchText: string) {
const encodedText = encodeURIComponent(searchText).replace(/%20/g, "+");
this.getURL().should("include", `search=${encodedText}`);
}
Expand Down
Loading

0 comments on commit 93f3f86

Please sign in to comment.