Skip to content

Commit

Permalink
Fix Patient Crud Cypress (ohcnetwork#6202)
Browse files Browse the repository at this point in the history
* Fix Patient Crud

* Fix asset creation cypress test

* Update cypress to 13.1

---------

Co-authored-by: Ashesh3 <[email protected]>
  • Loading branch information
nihal467 and Ashesh3 authored Sep 1, 2023
1 parent 1457267 commit e21652b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("Asset", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"2021-12-25",
"25122021",
"Test note for asset creation!"
);

Expand All @@ -80,7 +80,7 @@ describe("Asset", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"2021-12-25",
"25122021",
"Test note for asset creation!"
);

Expand Down
15 changes: 8 additions & 7 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
const username = "devdistrictadmin";
const password = "Coronasafe@123";
const phone_number = "9" + Math.floor(100000000 + Math.random() * 900000000);
const emergency_phone_number = "9430123487";
const emergency_phone_number =
"9" + Math.floor(100000000 + Math.random() * 900000000);
const yearOfBirth = "2023";
let patient_url = "";

Expand Down Expand Up @@ -104,9 +105,11 @@ describe("Patient Creation with consultation", () => {
cy.get("[data-testid=name] input").clear();
cy.get("[data-testid=name] input").type("Test E2E User Edited");
cy.get("#phone_number-div").clear();
cy.get("#phone_number-div").type("+919846856666");
cy.get("#phone_number-div").type("+91").type(phone_number);
cy.get("#emergency_phone_number-div").clear();
cy.get("#emergency_phone_number-div").type("+919120330220");
cy.get("#emergency_phone_number-div")
.type("+91")
.type(emergency_phone_number);
cy.get("#present_health").type("Severe Cough");
cy.get("#ongoing_medication").type("Paracetamol");
cy.get("#allergies").type("Dust");
Expand Down Expand Up @@ -142,10 +145,7 @@ describe("Patient Creation with consultation", () => {
"contain",
"Test E2E User Edited"
);
cy.get("[data-testid=patient-dashboard]").should(
"contain",
"+919120330220"
);
cy.get("[data-testid=patient-dashboard]").should("contain", phone_number);
const patientDetails_values: string[] = [
"Severe Cough",
"Paracetamol",
Expand All @@ -165,6 +165,7 @@ describe("Patient Creation with consultation", () => {
cy.intercept("GET", "**/api/v1/patient/**").as("getFacilities");
cy.visit(patient_url + "/consultation");
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("#history_of_present_illness").scrollIntoView;
cy.get("#history_of_present_illness").should("be.visible");
cy.get("#history_of_present_illness").click().type("histroy");
cy.get("#consultation_status")
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/users_spec/user_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("User management", () => {
cy.intercept(/\/api\/v1\/facility/).as("facility");
cy.get("[name='facilities']")
.click()
.type("cypress facility")
.type("Dummy Facility 1")
.wait("@facility");
cy.get("li[role='option']").first().click();
cy.get("input[type='checkbox']").click();
Expand Down Expand Up @@ -93,7 +93,7 @@ describe("User management", () => {
cy.get("button[id='facilities']").click();
cy.wait("@userFacility")
.getAttached("div[id=facility_0] > div > span")
.contains("cypress facility");
.contains("Dummy Facility 1");
});
});

Expand All @@ -102,7 +102,7 @@ describe("User management", () => {
cy.intercept(/\/api\/v1\/facility/).as("getFacilities");
cy.get("[name='facility']")
.click()
.type("cypress facility")
.type("Dummy Facility 1")
.wait("@getFacilities");
cy.get("li[role='option']").first().click();
cy.intercept(/\/api\/v1\/users\/\w+\/add_facility\//).as("addFacility");
Expand Down
7 changes: 4 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export class AssetPage {
cy.get("[data-testid=asset-support-email-input] input").type(supportEmail);
cy.get("[data-testid=asset-vendor-name-input] input").type(vendorName);
cy.get("[data-testid=asset-serial-number-input] input").type(serialNumber);
cy.get("[data-testid=asset-last-serviced-on-input] input").type(
lastServicedOn
);
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']"
).click();
cy.get("#date-input").click().type(lastServicedOn);
cy.get("[data-testid=asset-notes-input] textarea").type(notes);
}

Expand Down
34 changes: 25 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.14",
"cypress": "^12.17.4",
"cypress": "^13.1.0",
"cypress-localstorage-commands": "^2.2.3",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
Expand Down

0 comments on commit e21652b

Please sign in to comment.