Skip to content

Commit

Permalink
replace cy.get with custom command
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Jan 12, 2025
1 parent c991839 commit 5f054a3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cypress/pageObject/facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@ 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);
}

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 +93,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 5f054a3

Please sign in to comment.