From 3de7e747ec1981c78639fc97edcf03fa65fa533e Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Thu, 9 Oct 2025 19:20:13 +0500 Subject: [PATCH] MM-62828 - Updating reactions tooltip (#34002) * MM-62828 - Updating reactions tooltip * Updating tests * Updating lint * Updating lint * Fixing lint * Updating test * Updating test * Updating test * Updating test * Updating tests * Updating reaction specs * Fixing cypress test * Updating intl * Updating tests --------- Co-authored-by: Mattermost Build --- .../collapsed_reply_threads/replies_spec.ts | 2 +- .../ctrl_cmd_shift_slash/helpers.js | 4 +- .../react_to_center_spec.js | 10 +- .../channels/messaging/reactions_spec.js | 8 +- .../__snapshots__/reaction.test.tsx.snap | 16 ++- .../components/post_view/reaction/index.ts | 7 +- .../post_view/reaction/reaction.test.tsx | 21 ++- .../post_view/reaction/reaction.tsx | 122 ++++++++++++++++-- .../reactions_list.test.tsx.snap | 2 +- webapp/channels/src/i18n/en.json | 4 +- 10 files changed, 151 insertions(+), 45 deletions(-) diff --git a/e2e-tests/cypress/tests/integration/channels/collapsed_reply_threads/replies_spec.ts b/e2e-tests/cypress/tests/integration/channels/collapsed_reply_threads/replies_spec.ts index 20de9c18281..e3017773d72 100644 --- a/e2e-tests/cypress/tests/integration/channels/collapsed_reply_threads/replies_spec.ts +++ b/e2e-tests/cypress/tests/integration/channels/collapsed_reply_threads/replies_spec.ts @@ -171,7 +171,7 @@ describe('Collapsed Reply Threads', () => { // * Thumbs-up reaction displays as reaction on post cy.get(`#${postId}_message`).within(() => { cy.findByLabelText('reactions').should('be.visible'); - cy.findByLabelText('remove reaction +1').should('be.visible'); + cy.findByRole('button', {name: /reacted with :\+1:/i}).should('be.visible'); }); // * Reacting to a root post should not create a thread (thread footer should not exist) diff --git a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/helpers.js b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/helpers.js index fcd6179a9bb..a4e130fec7e 100644 --- a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/helpers.js +++ b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/helpers.js @@ -33,11 +33,11 @@ export function checkReactionFromPost(postId, emoji = 'smile') { if (postId) { cy.get(`#${postId}_message`).within(() => { cy.findByLabelText('reactions').should('exist'); - cy.findByLabelText(`remove reaction ${emoji}`).should('exist'); + cy.findByLabelText(`You reacted with :${emoji}:. Click to remove.`).should('exist'); }); } else { cy.findByLabelText('reactions').should('exist'); - cy.findByLabelText(`remove reaction ${emoji}}`).should('exist'); + cy.findByLabelText(`You reacted with :${emoji}:. Click to remove.`).should('exist'); } } diff --git a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js index 8865d417435..96ab55c8ad3 100644 --- a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js @@ -85,13 +85,13 @@ describe('Keyboard shortcut CTRL/CMD+Shift+\\ for adding reaction to last messag // * Check if emoji reaction is shown in the last message in center cy.getLastPostId().then((lastPostId) => { - cy.get(`#post_${lastPostId}`).findByLabelText('remove reaction smile').should('exist'); + cy.get(`#post_${lastPostId}`).findByLabelText('You reacted with :smile:. Click to remove.').should('exist'); }); // * Check if no emoji reaction is shown from last comment both in RHS and center cy.get('@prevLastPostId').then((lastPostId) => { - cy.get(`#rhsPost_${lastPostId}`).findByLabelText('remove reaction smile').should('not.exist'); - cy.get(`#post_${lastPostId}`).findByLabelText('remove reaction smile').should('not.exist'); + cy.get(`#rhsPost_${lastPostId}`).findByLabelText('You reacted with :smile:. Click to remove.').should('not.exist'); + cy.get(`#post_${lastPostId}`).findByLabelText('You reacted with :smile:. Click to remove.').should('not.exist'); }); cy.uiCloseRHS(); @@ -143,7 +143,7 @@ describe('Keyboard shortcut CTRL/CMD+Shift+\\ for adding reaction to last messag // * Check if no emoji reaction is shown in the last comment at RHS cy.get('@postInRHS').within(() => { cy.findByLabelText('reactions').should('not.exist'); - cy.findByLabelText('remove reaction smile').should('not.exist'); + cy.findByLabelText('You reacted with :smile:. Click to remove.').should('not.exist'); }); cy.uiCloseRHS(); @@ -234,7 +234,7 @@ describe('Keyboard shortcut CTRL/CMD+Shift+\\ for adding reaction to last messag cy.getLastPostId().then((lastPostId) => { cy.get(`#${lastPostId}_message`).within(() => { cy.findByLabelText('reactions').should('not.exist'); - cy.findByLabelText('remove reaction smile').should('not.exist'); + cy.findByLabelText('You reacted with :smile:. Click to remove.').should('not.exist'); }); }); }); diff --git a/e2e-tests/cypress/tests/integration/channels/messaging/reactions_spec.js b/e2e-tests/cypress/tests/integration/channels/messaging/reactions_spec.js index 53b96c98d80..69ac88e5b78 100644 --- a/e2e-tests/cypress/tests/integration/channels/messaging/reactions_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/messaging/reactions_spec.js @@ -34,7 +34,7 @@ describe('Messaging', () => { // * Thumbs-up reaction displays as reaction on post cy.get(`#${postId}_message`).within(() => { cy.findByLabelText('reactions').should('be.visible'); - cy.findByLabelText('remove reaction +1').should('be.visible'); + cy.findByLabelText('You reacted with :+1:. Click to remove.').should('be.visible'); }); // # Close RHS @@ -62,7 +62,7 @@ describe('Messaging', () => { // * Emoji reaction is added to the post cy.get(`#${postId}_message`).within(() => { cy.findByLabelText('reactions').should('exist'); - cy.findByLabelText('remove reaction upside down face').should('exist'); + cy.findByLabelText('You reacted with :upside_down_face:. Click to remove.').should('exist'); }); // * Reaction appears in recently used section of emoji picker @@ -102,8 +102,8 @@ describe('Messaging', () => { // * Two reactions are added to the message in the expanded RHS cy.get(`#rhsPost_${postId}`).within(() => { cy.findByLabelText('reactions').should('be.visible'); - cy.findByLabelText('remove reaction smiley').should('be.visible'); - cy.findByLabelText('remove reaction upside down face').should('be.visible'); + cy.findByLabelText('You reacted with :smiley:. Click to remove.').should('be.visible'); + cy.findByLabelText('You reacted with :upside_down_face:. Click to remove.').should('be.visible'); }); // # Close RHS diff --git a/webapp/channels/src/components/post_view/reaction/__snapshots__/reaction.test.tsx.snap b/webapp/channels/src/components/post_view/reaction/__snapshots__/reaction.test.tsx.snap index 82a986037e4..f4f8ee506e2 100644 --- a/webapp/channels/src/components/post_view/reaction/__snapshots__/reaction.test.tsx.snap +++ b/webapp/channels/src/components/post_view/reaction/__snapshots__/reaction.test.tsx.snap @@ -25,7 +25,7 @@ exports[`components/post_view/Reaction should apply read-only class if user does } >