From a8947d955d9ddfd382df11de89f8889d67fa287a Mon Sep 17 00:00:00 2001 From: Fernando Terra Date: Mon, 16 Dec 2024 17:39:04 -0300 Subject: [PATCH] add links to email address and phone numbers --- .../src/pages/client-details/LocationView.vue | 20 ++++++++++++----- .../pages/client-details/LocationView.cy.ts | 22 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/frontend/src/pages/client-details/LocationView.vue b/frontend/src/pages/client-details/LocationView.vue index 57fd00969..ddeae4ec4 100644 --- a/frontend/src/pages/client-details/LocationView.vue +++ b/frontend/src/pages/client-details/LocationView.vue @@ -56,7 +56,9 @@ const indexString = props.data.clientLocnCode;
- {{ data.emailAddress }} + + {{ data.emailAddress }} +
- {{ data.businessPhone }} + + {{ data.businessPhone }} + - {{ data.cellPhone }} + + {{ data.cellPhone }} + - {{ data.faxNumber }} + + {{ data.faxNumber }} + - {{ data.homePhone }} + + {{ data.homePhone }} +
", () => { .as("vueWrapper"); }; - const testField = (selector: string, value: string) => { + const testField = (selector: string, value: string, linkPrefix?: string) => { cy.get(selector).should("be.visible"); cy.get(selector).contains(value); expect(value.length).to.be.greaterThan(0); + + if (linkPrefix) { + cy.get(selector).within(() => { + cy.get("a").should("have.attr", "href", `${linkPrefix}${value}`); + }); + } }; const testFieldHidden = (selector: string) => { @@ -67,15 +73,19 @@ describe("", () => { testField("#location-00-deliveryInformation", currentProps.data.addressThree); }); + const emailPrefix = "mailto:"; + cy.get("#location-00-email-section").within(() => { - testField("#location-00-emailAddress", currentProps.data.emailAddress); + testField("#location-00-emailAddress", currentProps.data.emailAddress, emailPrefix); }); + const phonePrefix = "tel:"; + cy.get("#location-00-phone-section").within(() => { - testField("#location-00-primaryPhoneNumber", currentProps.data.businessPhone); - testField("#location-00-secondaryPhoneNumber", currentProps.data.cellPhone); - testField("#location-00-fax", currentProps.data.faxNumber); - testField("#location-00-other", currentProps.data.homePhone); + testField("#location-00-primaryPhoneNumber", currentProps.data.businessPhone, phonePrefix); + testField("#location-00-secondaryPhoneNumber", currentProps.data.cellPhone, phonePrefix); + testField("#location-00-fax", currentProps.data.faxNumber, phonePrefix); + testField("#location-00-other", currentProps.data.homePhone, phonePrefix); }); cy.get("#location-00-notes-section").within(() => {