Skip to content

Commit

Permalink
Replace cy.get with custom command in facility test (#9910)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Jan 12, 2025
1 parent c991839 commit 83b4c51
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cypress/pageObject/facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,37 @@ export class FacilityCreation {

// Individual field methods
enterFacilityName(name: string) {
cy.get('[data-cy="facility-name"]').type(name);
cy.typeIntoField('[data-cy="facility-name"]', name);
}

selectFacilityType(facilityType: string) {
cy.clickAndSelectOption('[data-cy="facility-type"]', facilityType);
}

enterDescription(description: string) {
cy.get('[data-cy="facility-description"]').type(description);
cy.typeIntoField('[data-cy="facility-description"]', description);
}

enterPhoneNumber(phone: string) {
cy.get('[data-cy="facility-phone"]').type(phone);
cy.typeIntoField('[data-cy="facility-phone"]', phone, {
skipVerification: true,
});
}

enterPincode(pincode: string) {
cy.get('[data-cy="facility-pincode"]').type(pincode);
cy.typeIntoField('[data-cy="facility-pincode"]', pincode);
}

enterAddress(address: string) {
cy.get('[data-cy="facility-address"]').type(address);
cy.typeIntoField('[data-cy="facility-address"]', address);
}

enterLatitude(latitude: string) {
cy.get('[data-cy="facility-latitude"]').type(latitude);
cy.typeIntoField('[data-cy="facility-latitude"]', latitude);
}

enterLongitude(longitude: string) {
cy.get('[data-cy="facility-longitude"]').type(longitude);
cy.typeIntoField('[data-cy="facility-longitude"]', longitude);
}

// Combined methods using individual functions
Expand Down Expand Up @@ -93,7 +95,7 @@ export class FacilityCreation {
}

searchFacility(facilityName: string) {
cy.get('[data-cy="search-facility"]').type(facilityName);
cy.typeIntoField('[data-cy="search-facility"]', facilityName);
}

verifyFacilityNameInCard(facilityName: string) {
Expand Down

0 comments on commit 83b4c51

Please sign in to comment.