Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shivankacker committed Oct 11, 2024
1 parent 16aa346 commit c3162fb
Show file tree
Hide file tree
Showing 33 changed files with 1,272 additions and 1,226 deletions.
8 changes: 4 additions & 4 deletions cypress/e2e/assets_spec/AssetsCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("Asset", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"25/12/2021",
"25122021",
"Test note for asset creation!",
);

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

Expand All @@ -104,7 +104,7 @@ describe("Asset", () => {
"Customer Support's Name Edited",
"Vendor's Name Edited",
"Test note for asset creation edited!",
"25/12/2021",
"25122021",
);

assetPage.clickUpdateAsset();
Expand Down Expand Up @@ -152,7 +152,7 @@ describe("Asset", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"25/12/2021",
"25122021",
"Test note for asset creation!",
);
assetPage.interceptAssetCreation();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/assets_spec/AssetsManage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("Asset", () => {
assetPage.clickupdatedetailbutton();
assetPage.scrollintonotes();
assetPage.enterAssetNotes("Dummy Notes");
assetPage.enterAssetservicedate("01/09/2023");
assetPage.enterAssetservicedate("01092023");
assetPage.clickassetupdatebutton();
assetPage.scrollintoservicehistory();
assetPage.clickedithistorybutton();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/FacilityCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Facility Creation", () => {
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
const facilityNumber = "9898469865";
const triageDate = "02/12/2023";
const triageDate = "02122023";
const initialTriageValue = "60";
const modifiedTriageValue = "50";
const facilityErrorMessage = [
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/FacilityLocation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe("Location Management Section", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"25/12/2021",
"25122021",
"Test note for asset creation!",
);
assetPage.clickassetupdatebutton();
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4);
patientTreatmentPlan.clickAddProcedure();
patientTreatmentPlan.typeProcedureName(procedureName);
patientTreatmentPlan.typeProcedureTime("22/02/2024 12:30 pm");
patientTreatmentPlan.typeProcedureTime("220220241230");
patientTreatmentPlan.typeTreatmentPlan(patientTreatment);
patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction);
patientTreatmentPlan.typeSpecialInstruction(specialInstruction);
Expand Down Expand Up @@ -182,12 +182,12 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.typeCauseOfDeath("Cause of Death");
patientConsultationPage.typePatientConsultationDate(
"#death_datetime",
"22/02/2024 12:30 pm",
"220220241230",
);
patientConsultationPage.typeDeathConfirmedBy(doctorName);
patientConsultationPage.typePatientConsultationDate(
"#encounter_date",
"22/02/2024 12:30 pm",
"220220241230",
);
cy.submitButton("Create Consultation");
cy.verifyNotification(
Expand Down Expand Up @@ -245,7 +245,7 @@ describe("Patient Consultation in multiple combination", () => {
);
patientConsultationPage.typePatientConsultationDate(
"#icu_admission_date",
"23/02/2024 12:30 pm",
"230220241230",
);
// add investigation
patientInvestigation.clickAddInvestigation();
Expand Down Expand Up @@ -293,7 +293,7 @@ describe("Patient Consultation in multiple combination", () => {
);
// verify the free text in referring facility name
patientConsultationPage.typeReferringFacility("Life Care Hospital");
patientConsultationPage.selectSymptomsDate("01/01/2024");
patientConsultationPage.selectSymptomsDate("01012024");
patientConsultationPage.typeAndMultiSelectSymptoms("s", [
"Sore throat",
"Sputum",
Expand Down Expand Up @@ -338,7 +338,7 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room",
);
// Select the Symptoms - Breathlessness and Bleeding symptoms
patientConsultationPage.selectSymptomsDate("01/01/2024");
patientConsultationPage.selectSymptomsDate("01012024");
patientConsultationPage.typeAndMultiSelectSymptoms("b", [
"Breathlessness",
"Bleeding",
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientLogUpdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.selectSymptomsDate("01/01/2024");
patientLogupdate.selectSymptomsDate("01012024");
patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]);
patientLogupdate.clickAddSymptom();
patientLogupdate.typeSystolic(patientSystolic);
Expand Down Expand Up @@ -268,7 +268,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.selectSymptomsDate("01/01/2024");
patientLogupdate.selectSymptomsDate("01012024");
patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]);
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeSystolic(patientSystolic);
Expand Down
12 changes: 7 additions & 5 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const getRelativeDateString = (deltaDays = 0) => {
if (deltaDays) {
date.setDate(date.getDate() + deltaDays);
}
return date.toLocaleDateString("en-IN", {
day: "2-digit",
month: "2-digit",
year: "numeric",
});
return date
.toLocaleDateString("en-IN", {
day: "2-digit",
month: "2-digit",
year: "numeric",
})
.replace("/", "");
};

describe("Patient Creation with consultation", () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("User Creation", () => {
userCreationPage.typeIntoElementByIdPostClear("weekly_working_hours", "14");
userCreationPage.typeIntoElementByIdPostClearDob(
"date_of_birth",
"01/01/1998",
"01011998",
);
userCreationPage.clickElementById("submit");
userCreationPage.verifyElementContainsText(
Expand Down Expand Up @@ -146,7 +146,7 @@ describe("User Creation", () => {
userCreationPage.typeIntoElementById("password", "Test@123");
userCreationPage.selectHomeFacility("Dummy Shifting Center");
userCreationPage.typeIntoElementById("phone_number", phone_number);
userCreationPage.setInputDate("date_of_birth", "date-input", "25/08/1999");
userCreationPage.setInputDate("date_of_birth", "25081999");
userCreationPage.selectDropdownOption("user_type", "Doctor");
userCreationPage.typeIntoElementById("c_password", "Test@123");
userCreationPage.typeIntoElementById("qualification", "MBBS");
Expand Down
82 changes: 0 additions & 82 deletions cypress/e2e/users_spec/user_profile.cy.ts

This file was deleted.

15 changes: 12 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export class AssetPage {
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']",
).click();
cy.get("#date-input").click().type(lastServicedOn);
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click(0, 0)
.type(lastServicedOn);
cy.get("body").click(0, 0);
cy.get("[data-testid=asset-notes-input] textarea").type(notes);
}
Expand Down Expand Up @@ -121,7 +123,12 @@ export class AssetPage {
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']",
).click();
cy.get("#date-input").click().clear().type(lastServicedOn);
cy.get(
'[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]',
).click();
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(lastServicedOn);
cy.get("body").click(0, 0);
cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes);
}
Expand Down Expand Up @@ -278,7 +285,9 @@ export class AssetPage {

enterAssetservicedate(text: string) {
cy.get("input[name='last_serviced_on']").click();
cy.get("#date-input").click().type(text);
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(text);
cy.get("body").click(0, 0);
}

Expand Down
4 changes: 3 additions & 1 deletion cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ class FacilityPage {

fillEntryDate(date) {
cy.get("#entry_date").click();
cy.get("#date-input").click().type(date);
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(date);
cy.get("body").click(0, 0);
}

Expand Down
7 changes: 6 additions & 1 deletion cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ export class PatientConsultationPage {

typePatientConsultationDate(selector: string, date: string) {
cy.get(selector).click();
cy.get("#date-input").clear().type(date);
cy.get(
'[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]',
).click();
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(date);
cy.get("body").click(0, 0);
}

Expand Down
12 changes: 9 additions & 3 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export class PatientPage {
cy.clickAndSelectOption("#patientAge", "DOB");
cy.get("#date_of_birth").scrollIntoView();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type(dateOfBirth);
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(dateOfBirth);
cy.get("body").click(0, 0);
}

Expand Down Expand Up @@ -82,13 +84,17 @@ export class PatientPage {

typeLastMenstruationStartDate(date: string) {
cy.get("#last_menstruation_start_date").click();
cy.get("#date-input").click().type(date);
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(date);
cy.get("body").click(0, 0);
}

typeDateOfDelivery(date: string) {
cy.get("#date_of_delivery").click();
cy.get("#date-input").click().type(date);
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(date);
cy.get("body").click(0, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientPredefined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PatientPredefined {
const emergency_phone_number = generateEmergencyPhoneNumber();
patientPage.typePatientPhoneNumber(phone_number);
patientPage.typePatientEmergencyNumber(emergency_phone_number);
patientPage.typePatientDateOfBirth("01/01/2001");
patientPage.typePatientDateOfBirth("01012001");
patientPage.typePatientName("Patient With Predefined Data");
patientPage.selectPatientGender("Male");
patientPage.typePatientAddress("Test Patient Address");
Expand Down
7 changes: 6 additions & 1 deletion cypress/pageobject/Patient/PatientTreatmentPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ class PatientTreatmentPlan {

typeProcedureTime(time: string) {
cy.get("#procedure-time").click();
cy.get("#date-input").clear().type(time);
cy.get(
'[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]',
).click();
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(time);
cy.get("body").click(0, 0);
}

Expand Down
15 changes: 8 additions & 7 deletions cypress/pageobject/Users/UserCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export class UserCreationPage {
}
typeIntoElementByIdPostClearDob(elementId: string, value: string) {
cy.get("#" + elementId).click();
cy.get("#date-input").clear().type(value);
cy.get(
'[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]',
).click();
cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]')
.click()
.type(value);
}
clearIntoElementById(elementId: string) {
cy.get("#" + elementId)
Expand Down Expand Up @@ -54,13 +59,9 @@ export class UserCreationPage {
this.selectOptionContainingText(name);
}

setInputDate(
dateElementId: string,
inputElementId: string,
dateValue: string,
) {
setInputDate(dateElementId: string, dateValue: string) {
this.clickElementById(dateElementId);
this.typeIntoElementById(inputElementId, dateValue);
cy.get(`[data-test-id="date-input"]:visible`).click().type(dateValue);
}

selectDropdownOption(dropdownId: string, optionText: string) {
Expand Down
Loading

0 comments on commit c3162fb

Please sign in to comment.