From 8dfcd351ff0e53ae6ee6da2b7c8c1b44b8b27452 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:15:24 +0530 Subject: [PATCH] refactor cypress policy file --- .../patient_spec/patient_registration.cy.ts | 24 ++++++++++------ .../pageobject/Patient/PatientInsurance.ts | 28 +++++-------------- vite.config.ts | 4 +-- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index 52d3a0887e5..1dce2c7c6f7 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -146,37 +146,45 @@ describe("Patient Creation with consultation", () => { // Edit the patient consultation , select none medical history and multiple health ID patientMedicalHistory.clickNoneMedicialHistory(); patientInsurance.clickAddInsruanceDetails(); - patientInsurance.typeSubscriberId( + patientInsurance.typePatientInsuranceDetail( patientOneFirstInsuranceId, + "subscriber_id", patientOneFirstSubscriberId ); - patientInsurance.typePolicyId( + patientInsurance.typePatientInsuranceDetail( patientOneFirstInsuranceId, + "policy_id", patientOneFirstPolicyId ); - patientInsurance.typeInsurerId( + patientInsurance.typePatientInsuranceDetail( patientOneFirstInsuranceId, + "insurer_id", patientOneFirstInsurerId ); - patientInsurance.typeInsurerName( + patientInsurance.typePatientInsuranceDetail( patientOneFirstInsuranceId, + "insurer_name", patientOneFirstInsurerName ); patientInsurance.clickAddInsruanceDetails(); - patientInsurance.typeSubscriberId( + patientInsurance.typePatientInsuranceDetail( patientOneSecondInsuranceId, + "subscriber_id", patientOneSecondSubscriberId ); - patientInsurance.typePolicyId( + patientInsurance.typePatientInsuranceDetail( patientOneSecondInsuranceId, + "policy_id", patientOneSecondPolicyId ); - patientInsurance.typeInsurerId( + patientInsurance.typePatientInsuranceDetail( patientOneSecondInsuranceId, + "insurer_id", patientOneSecondInsurerId ); - patientInsurance.typeInsurerName( + patientInsurance.typePatientInsuranceDetail( patientOneSecondInsuranceId, + "insurer_name", patientOneSecondInsurerName ); patientPage.clickUpdatePatient(); diff --git a/cypress/pageobject/Patient/PatientInsurance.ts b/cypress/pageobject/Patient/PatientInsurance.ts index 4d124469816..be4c25c5535 100644 --- a/cypress/pageobject/Patient/PatientInsurance.ts +++ b/cypress/pageobject/Patient/PatientInsurance.ts @@ -1,25 +1,11 @@ class PatientInsurance { - typeSubscriberId(id: string, subscriberId: string) { - cy.get(`#${id}`).within(() => { - cy.get("#subscriber_id").clear().type(subscriberId); - }); - } - - typePolicyId(id: string, policyid: string) { - cy.get(`#${id}`).within(() => { - cy.get("#policy_id").click().type(policyid); - }); - } - - typeInsurerId(id: string, insurerid: string) { - cy.get(`#${id}`).within(() => { - cy.get("#insurer_id").click().type(insurerid); - }); - } - - typeInsurerName(id: string, insurername: string) { - cy.get(`#${id}`).within(() => { - cy.get("#insurer_name").click().type(insurername); + typePatientInsuranceDetail( + containerId: string, + fieldId: string, + value: string + ) { + cy.get(`#${containerId}`).within(() => { + cy.get(`#${fieldId}`).click().type(value); }); } diff --git a/vite.config.ts b/vite.config.ts index 65cbfa296d7..cc8d944012a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -93,7 +93,7 @@ export default defineConfig({ port: 4000, proxy: { "/api": { - target: process.env.CARE_API ?? "https://careapi.ohc.network", + target: process.env.CARE_API ?? "http://192.168.0.204:9000/", changeOrigin: true, }, }, @@ -110,7 +110,7 @@ export default defineConfig({ port: 4000, proxy: { "/api": { - target: process.env.CARE_API ?? "https://careapi.ohc.network", + target: process.env.CARE_API ?? "http://192.168.0.204:9000/", changeOrigin: true, }, },