From fec14102eb8c1a8022ad54050d202672738f899e Mon Sep 17 00:00:00 2001 From: Jennifer Q <66472237+latin-panda@users.noreply.github.com> Date: Thu, 7 Dec 2023 16:08:50 +0700 Subject: [PATCH] feat(#8660) - add link in conversation to navigate to sender's contact page (#8717) --- ...c.js => messages-sender-data.wdio-spec.js} | 18 ++++++- .../default/sms/messages.wdio.page.js | 7 +++ .../components/sender/sender.component.html | 14 +++--- .../ts/components/sender/sender.component.ts | 13 ++++- .../ts/components/sender.component.spec.ts | 50 +++++++++++++++++-- 5 files changed, 90 insertions(+), 12 deletions(-) rename tests/e2e/default/sms/{messages-breadcrumbs.wdio-spec.js => messages-sender-data.wdio-spec.js} (79%) diff --git a/tests/e2e/default/sms/messages-breadcrumbs.wdio-spec.js b/tests/e2e/default/sms/messages-sender-data.wdio-spec.js similarity index 79% rename from tests/e2e/default/sms/messages-breadcrumbs.wdio-spec.js rename to tests/e2e/default/sms/messages-sender-data.wdio-spec.js index 988d9561960..7182669c193 100644 --- a/tests/e2e/default/sms/messages-breadcrumbs.wdio-spec.js +++ b/tests/e2e/default/sms/messages-sender-data.wdio-spec.js @@ -5,8 +5,9 @@ const userFactory = require('@factories/cht/users/users'); const placeFactory = require('@factories/cht/contacts/place'); const personFactory = require('@factories/cht/contacts/person'); const messagesPage = require('@page-objects/default/sms/messages.wdio.page'); +const contactsPage = require('@page-objects/default/contacts/contacts.wdio.page'); -describe('Message tab breadcrumbs', () => { +describe('Message Tab - Sender Data', () => { const places = placeFactory.generateHierarchy(); const clinic = places.get('clinic'); const health_center = places.get('health_center'); @@ -84,4 +85,19 @@ describe('Message tab breadcrumbs', () => { expect(lineage).to.equal(expectedLineage); }); + it('should display conversation with link and navigate to contact', async () => { + await loginPage.login(offlineUser); + await commonElements.waitForPageLoaded(); + await commonElements.goToMessages(); + + await messagesPage.openMessage(patient._id); + const header = await messagesPage.getMessageHeader(); + expect(header.name).to.equal(patient.name); + expect(header.phone).to.equal(patient.phone); + + await messagesPage.navigateFromConversationToContact(); + const title = await contactsPage.getContactInfoName(); + expect(title).to.equal(patient.name); + }); + }); diff --git a/tests/page-objects/default/sms/messages.wdio.page.js b/tests/page-objects/default/sms/messages.wdio.page.js index 83457876598..bf0f0fbda1b 100644 --- a/tests/page-objects/default/sms/messages.wdio.page.js +++ b/tests/page-objects/default/sms/messages.wdio.page.js @@ -45,6 +45,12 @@ const getMessageHeader = async () => { }; }; +const navigateFromConversationToContact = async () => { + await $(`${MESSAGE_HEADER} a.name`).waitForClickable(); + await $(`${MESSAGE_HEADER} a.name`).click(); + await commonPage.waitForPageLoaded(); +}; + const getMessageContent = async (index = 1) => { const sms = await $(`${MESSAGE_CONTENT} li:nth-child(${index})`); await sms.waitForDisplayed(); @@ -140,5 +146,6 @@ module.exports = { sendReply, replyAddRecipients, getAmountOfMessagesByPhone, + navigateFromConversationToContact, getMessagesModalDetails, }; diff --git a/webapp/src/ts/components/sender/sender.component.html b/webapp/src/ts/components/sender/sender.component.html index b3fd49d6dec..449777069ba 100644 --- a/webapp/src/ts/components/sender/sender.component.html +++ b/webapp/src/ts/components/sender/sender.component.html @@ -1,15 +1,17 @@