Skip to content

Commit

Permalink
Merge branch 'develop' into medicine-administrations/archive
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Sep 27, 2023
2 parents fa76e7f + 269d00f commit a7b60be
Show file tree
Hide file tree
Showing 60 changed files with 1,214 additions and 752 deletions.
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
2 changes: 2 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
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
1 change: 1 addition & 0 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ 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);
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();
}
}
Loading

0 comments on commit a7b60be

Please sign in to comment.