Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Release; Oct Week 1 #6380

Merged
merged 9 commits into from
Oct 1, 2023
54 changes: 54 additions & 0 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ describe("Asset", () => {
const assetSearchPage = new AssetSearchPage();
const assetFilters = new AssetFilters();
const fillFacilityName = "Dummy Facility 1";
const assetname = "Dummy Camera";
const locationName = "Dummy Location 1";
const initiallocationName = "Camera Location";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -23,6 +26,57 @@ describe("Asset", () => {
cy.awaitUrl("/assets");
});

it("Create & Edit a service history and verify reflection", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(assetname);
assetSearchPage.clickAssetByName(assetname);
assetPage.clickupdatedetailbutton();
assetPage.scrollintonotes();
assetPage.enterAssetNotes("Dummy Notes");
assetPage.enterAssetservicedate("01092023");
assetPage.clickassetupdatebutton();
assetPage.scrollintoservicehistory();
assetPage.clickedithistorybutton();
assetPage.scrollintonotes();
assetPage.enterAssetNotes("Dummy Notes Editted");
assetPage.clickassetupdatebutton();
assetPage.scrollintoservicehistory();
assetPage.viewassetservicehistorybutton();
assetPage.openassetservicehistory();
assetPage.verifyassetupdateservicehistory();
assetPage.viewassetservicehistorybutton();
});

it("Create a asset transaction and verify history", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(assetname);
assetSearchPage.clickAssetByName(assetname);
assetPage.clickupdatedetailbutton();
assetPage.clickassetlocation(locationName);
assetPage.clickUpdateAsset();
assetPage.verifyassetlocation(locationName);
assetPage.verifytransactionStatus(initiallocationName, locationName);
});

it("Verify Facility Asset Page Redirection", () => {
cy.visit("/facility");
assetSearchPage.typeSearchKeyword(fillFacilityName);
assetSearchPage.pressEnter();
facilityPage.verifyFacilityBadgeContent(fillFacilityName);
facilityPage.visitAlreadyCreatedFacility();
facilityPage.clickManageFacilityDropdown();
facilityPage.clickCreateAssetFacilityOption();
facilityPage.verifyfacilitycreateassetredirection();
facilityPage.verifyassetfacilitybackredirection();
facilityPage.clickManageFacilityDropdown();
facilityPage.clickviewAssetFacilityOption();
facilityPage.verifyfacilityviewassetredirection();
assetFilters.assertFacilityText(fillFacilityName);
facilityPage.verifyassetfacilitybackredirection();
});

it("Delete an Asset", () => {
assetPage.openCreatedAsset();
assetPage.interceptDeleteAssetApi();
Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe("Patient Creation with consultation", () => {
it("Create a new patient with no consultation", () => {
patientPage.createPatient();
patientPage.selectFacility("dummy facility");
patientPage.patientformvisibility();
patientPage.enterPatientDetails(
phone_number,
emergency_phone_number,
Expand Down Expand Up @@ -69,6 +70,7 @@ describe("Patient Creation with consultation", () => {
patientPage.interceptFacilities();
patientPage.visitUpdatePatientUrl();
patientPage.verifyStatusCode();
patientPage.patientformvisibility();
updatePatientPage.enterPatientDetails(
"Test E2E User Edited",
"O+",
Expand Down Expand Up @@ -113,6 +115,7 @@ describe("Patient Creation with consultation", () => {
patientConsultationPage.selectSymptoms("ASYMPTOMATIC");

patientConsultationPage.enterConsultationDetails(
"Stable",
"Examination details and Clinical conditions",
"70",
"170",
Expand Down
74 changes: 74 additions & 0 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,78 @@ export class AssetPage {
cy.get("#submit").contains("Import").click();
cy.wait("@importAsset").its("response.statusCode").should("eq", 201);
}

clickupdatedetailbutton() {
cy.get("[data-testid=asset-update-button]").click();
}

scrollintonotes() {
cy.get("#notes").scrollIntoView();
}

enterAssetNotes(text) {
cy.get("#notes").click().clear();
cy.get("#notes").click().type(text);
}

enterAssetservicedate(text) {
cy.get("input[name='last_serviced_on']").click();
cy.get("#date-input").click().type(text);
}

clickassetupdatebutton() {
cy.get("#submit").click();
}

viewassetservicehistorybutton() {
cy.get("#view-service-history").should("be.visible");
}

openassetservicehistory() {
cy.get("#view-service-history").click();
cy.get("#view-asset-edit-history").first().click();
}

verifyassetupdateservicehistory() {
cy.get("#edit-history-asset-servicedon").should("have.text", "01/09/2023");
cy.get("#edit-history-asset-note").should(
"have.text",
"Dummy Notes Editted"
);
cy.get("#view-history-back-button").contains("Back").click();
cy.get("#view-history-back-button").contains("Close").click();
}

scrollintoservicehistory() {
cy.get("#service-history").scrollIntoView();
}

clickedithistorybutton() {
cy.get("#edit-service-history").click();
}

verifytransactionStatus(initiallocationName: string, locationName: string) {
cy.get("#transaction-history").scrollIntoView();
cy.get("#transaction-history table tbody tr:first-child td:eq(0)").should(
"contain",
initiallocationName
);
cy.get("#transaction-history table tbody tr:first-child td:eq(1)").should(
"contain",
locationName
);
}

verifyassetlocation(locationName: string) {
cy.get("#asset-current-location").should("contain", locationName);
}

clickassetlocation(locationName: string) {
cy.get("#clear-button").click();
cy.get("[data-testid=asset-location-input] button").click();
cy.get("[data-testid=asset-location-input] button")
.click()
.type(locationName);
cy.get("[role='option']").contains(locationName).click();
}
}
4 changes: 0 additions & 4 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ class FacilityPage {
}

verifyfacilitycreateassetredirection() {
cy.intercept("GET", "**/api/v1/facility/**").as("getNewAssets");
cy.url().should("include", "/assets/new");
cy.wait("@getNewAssets").its("response.statusCode").should("eq", 200);
}

verifyassetfacilitybackredirection() {
Expand All @@ -205,9 +203,7 @@ class FacilityPage {
}

verifyfacilityviewassetredirection() {
cy.intercept("GET", "**api/v1/getallfacilities/**").as("getViewAssets");
cy.url().should("include", "/assets?facility=");
cy.wait("@getViewAssets").its("response.statusCode").should("eq", 200);
}

clickManageInventory() {
Expand Down
9 changes: 9 additions & 0 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ export class PatientConsultationPage {
}

fillIllnessHistory(history: string) {
cy.wait(5000);
cy.get("#history_of_present_illness").scrollIntoView();
cy.get("#history_of_present_illness").should("be.visible");
cy.get("#history_of_present_illness").click().type(history);
}

enterConsultationDetails(
category: string,
examinationDetails: string,
weight: string,
height: string,
Expand All @@ -30,6 +32,11 @@ export class PatientConsultationPage {
verificationBy: string
) {
cy.get("#symptoms").click();
cy.get("#category")
.click()
.then(() => {
cy.get("[role='option']").contains(category).click();
});
cy.get("#examination_details").click().type(examinationDetails);
cy.get("#weight").click().type(height);
cy.get("#height").click().type(weight);
Expand All @@ -38,10 +45,12 @@ export class PatientConsultationPage {
cy.get(
"#icd11_diagnoses_object input[placeholder='Select'][role='combobox']"
)
.scrollIntoView()
.click()
.type("1A");
cy.get("#icd11_diagnoses_object [role='option']")
.contains("1A03 Intestinal infections due to Escherichia coli")
.scrollIntoView()
.click();
cy.get("label[for='icd11_diagnoses_object']").click();
cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200);
Expand Down
4 changes: 4 additions & 0 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,8 @@ export class PatientPage {
verifyStatusCode() {
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
}

patientformvisibility() {
cy.get("[data-testid='current-address']").scrollIntoView();
}
}
17 changes: 14 additions & 3 deletions src/Components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ const AssetManage = (props: AssetManageProps) => {
</td>
<td className="gap-4 whitespace-nowrap px-6 py-4 text-left text-sm leading-5">
<ButtonV2
id="edit-service-history"
authorizeFor={NonReadOnlyUsers}
onClick={() => {
setServiceEditData({ ...service, open: true });
Expand All @@ -240,6 +241,7 @@ const AssetManage = (props: AssetManageProps) => {
<CareIcon icon="l-pen" className="text-lg" />
</ButtonV2>
<ButtonV2
id="view-service-history"
authorizeFor={NonReadOnlyUsers}
tooltip={service.edits?.length < 2 ? "No previous edits" : ""}
tooltipClassName="tooltip-left"
Expand Down Expand Up @@ -296,7 +298,10 @@ const AssetManage = (props: AssetManageProps) => {
</div>
<div className="break-words text-gray-700">{item.label}</div>
</div>
<div className="ml-8 grow-0 break-words text-lg font-semibold">
<div
className="ml-8 grow-0 break-words text-lg font-semibold"
id="asset-current-location"
>
{item.content || "--"}
</div>
</div>
Expand Down Expand Up @@ -513,7 +518,10 @@ const AssetManage = (props: AssetManageProps) => {
asset?.asset_class &&
asset?.asset_class != AssetClass.NONE && <Uptime assetId={asset?.id} />}
<div className="mb-4 mt-8 text-xl font-semibold">Service History</div>
<div className="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg">
<div
className="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg"
id="service-history"
>
<table className="min-w-full divide-y divide-gray-200">
<thead>
<tr>
Expand All @@ -540,7 +548,10 @@ const AssetManage = (props: AssetManageProps) => {
</table>
</div>
<div className="mb-4 mt-8 text-xl font-semibold">Transaction History</div>
<div className="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg">
<div
className="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg"
id="transaction-history"
>
<table className="min-w-full divide-y divide-gray-200">
<thead>
<tr>
Expand Down
15 changes: 12 additions & 3 deletions src/Components/Assets/AssetServiceEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export const AssetServiceEditModal = (props: {
{edit.edited_by.username}
</p>
</div>
<div className="flex items-center justify-center">
<div
className="flex items-center justify-center"
id="view-asset-edit-history"
>
<CareIcon icon="l-eye" className="text-lg" />
</div>
</div>
Expand All @@ -124,19 +127,25 @@ export const AssetServiceEditModal = (props: {
<p className="text-sm font-medium text-gray-500">
Serviced On
</p>
<p className="text-gray-900">
<p
className="text-gray-900"
id="edit-history-asset-servicedon"
>
{formatDate(editRecord.serviced_on)}
</p>
</div>
<div className="mt-4 grow">
<p className="text-sm font-medium text-gray-500">Notes</p>
<p className="text-gray-900">{editRecord.note || "-"}</p>
<p className="text-gray-900" id="edit-history-asset-note">
{editRecord.note || "-"}
</p>
</div>
</div>
</div>
)}
<div className="flex justify-end">
<ButtonV2
id="view-history-back-button"
variant="secondary"
onClick={() => {
editRecord ? setEditRecord(undefined) : props.handleClose();
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ExternalResult/FacilitiesSelectDialogue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const FacilitiesSelectDialog = (props: Props) => {
<Cancel onClick={handleCancel} />
<Submit
onClick={handleOk}
disabled={!selectedFacility.id}
disabled={!selectedFacility?.id}
label={t("select")}
data-testid="submit-button"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useVitalsAspectRatioConfig from "../../VitalsMonitor/useVitalsAspectRatio
import { DISCHARGE_REASONS, SYMPTOM_CHOICES } from "../../../Common/constants";
import PrescriptionsTable from "../../Medicine/PrescriptionsTable";
import Chip from "../../../CAREUI/display/Chip";
import { formatDate, formatDateTime } from "../../../Utils/utils";
import { formatAge, formatDate, formatDateTime } from "../../../Utils/utils";
import ReadMore from "../../Common/components/Readmore";
import { DailyRoundsList } from "../Consultations/DailyRoundsList";

Expand Down Expand Up @@ -621,7 +621,12 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<div>
Age {" - "}
<span className="font-semibold">
{props.patientData.age ?? "-"}
{props.patientData.age !== undefined // 0 is a valid age, so we need to check for undefined
? formatAge(
props.patientData.age,
props.patientData.date_of_birth
)
: "-"}
</span>
</div>
<div>
Expand Down
Loading