Files
upstream-mattermost/e2e-tests/cypress/tests/integration/channels/messaging/reactions_spec.js
upstream-mirror 240db4e2a7
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 00:29:55 +05:00

198 lines
8.6 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************
// Stage: @prod
// Group: @channels @messaging
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Messaging', () => {
before(() => {
cy.apiInitSetup().then(({team, channel, user}) => {
cy.apiLogin(user);
cy.visit(`/${team.name}/channels/${channel.name}`);
});
});
// These tests share a page (testIsolation is off) and each one assumes the RHS is closed. A test
// that fails before its own uiCloseRHS() would otherwise leave it open over the center channel
// and take the rest of the file down with it, including its own retry.
beforeEach(() => {
cy.get('body').type('{esc}');
cy.uiCloseRHS();
cy.get('#post_textbox').should('be.visible');
});
it('MM-T2189 Emoji reaction - type +:+1:', () => {
// # Post a message
cy.postMessage('Hello');
cy.getLastPostId().then((postId) => {
// # Click reply to open the post in the right hand side
cy.clickPostCommentIcon(postId);
// # Type "+:+1:" in comment box to react to the post with a thumbs-up and post
cy.postMessageReplyInRHS('+:+1:');
// * Thumbs-up reaction displays as reaction on post
cy.get(`#${postId}_message`).within(() => {
cy.findByLabelText('reactions').should('be.visible');
cy.findByLabelText('You reacted with :+1:. Click to remove.').should('be.visible');
});
// # Close RHS
cy.uiCloseRHS();
});
});
it('MM-T2190 Emoji reaction - click `+` next to existing reaction (center)', () => {
// # Post a message
cy.postMessage('Hello to yourself');
cy.getLastPostId().then((postId) => {
// # Click the add reaction icon
cy.clickPostReactionIcon(postId);
// # Add a reaction to the post
cy.clickEmojiInEmojiPicker('smiley');
// # Click the `+` button next to the existing reactions (visible on hover)
cy.get(`#addReaction-${postId}`).should('exist').click({force: true});
// # Click to select an emoji from the picker
cy.clickEmojiInEmojiPicker('upside_down_face');
// * Emoji reaction is added to the post
cy.get(`#${postId}_message`).within(() => {
cy.findByLabelText('reactions').should('exist');
cy.findByLabelText('You reacted with :upside_down_face:. Click to remove.').should('exist');
});
// * Reaction appears in recently used section of emoji picker
cy.uiOpenEmojiPicker().then(() => {
cy.findAllByTestId('emojiItem').first().within(($el) => {
cy.wrap($el).findByTestId('upside_down_face').should('exist');
});
});
});
});
it('MM-T2192 RHS (reply) shows emoji picker for reactions - Reply box and plus icon', () => {
// # Post a message
cy.postMessage('Hello to you all');
cy.getLastPostId().then((postId) => {
// # Click a reply arrow to open reply RHS
cy.clickPostCommentIcon(postId).then(() => {
// # Click the expand arrows in top right to expand RHS
cy.uiExpandRHS();
// # mouse ove the root post
cy.get(`#rhsPost_${postId}`).trigger('mouseover');
// # Hover over the message, observe emoji picker icon
cy.get(`#RHS_ROOT_reaction_${postId}`).should('exist').click({force: true});
// # Click the emoji picker icon to react to the message, select a reaction
cy.clickEmojiInEmojiPicker('smiley');
// # Hover over the post again and observe the `+` icon next to your reaction
cy.get(`#addReaction-${postId}`).should('exist').click({force: true});
// # Click the `+` icon and select a different reaction
cy.clickEmojiInEmojiPicker('upside_down_face');
// * Two reactions are added to the message in the expanded RHS
cy.get(`#rhsPost_${postId}`).within(() => {
cy.findByLabelText('reactions').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
cy.uiCloseRHS();
});
});
});
it('MM-T2195 Emoji reaction - not available on system message Save - not available on system message Pin - not available on system message Can delete your own system message', () => {
// # Click add a channel header
cy.get('button.header-placeholder').invoke('show').trigger('mouseover');
cy.findByRoleExtended('button', {name: 'Add a channel header'}).trigger('mouseover').should('be.visible').click();
// # Add or update a channel header
cy.get('#editChannelHeaderModalLabel').should('be.visible');
cy.get('textarea#edit_textbox').should('be.visible').type('This is a channel description{enter}');
cy.getLastPostId().then((postId) => {
// * Emoji reaction - not available on system message
cy.get(`#post_${postId}`).trigger('mouseover', {force: true});
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('not.exist');
// * Save - not available on system message
cy.get(`#post_${postId}`).trigger('mouseover', {force: true});
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_flagIcon_${postId}`).should('not.exist');
// * Pin - not available on system message
cy.get(`#post_${postId}`).should('be.visible').within(() => {
cy.get('.post-menu').should('be.visible').within(() => {
return cy.findByText('Pin to Channel').should('not.exist');
});
});
// * If permissions allow, can click [...] >
cy.clickPostDotMenu(postId);
// # Delete to delete system message
cy.get(`#delete_post_${postId}`).click();
// * Check that confirmation dialog is open.
cy.get('#deletePostModal').should('be.visible');
// # Confirm deletion.
cy.get('#deletePostModalButton').click();
});
});
it('MM-T2196 Emoji reaction - not available on ephemeral message Save - not available on ephemeral message Pin - not available on ephemeral message Timestamp - not a link on ephemeral message Can close ephemeral message', () => {
// # Post `/away` to create an ephemeral message
cy.postMessage('/away ');
cy.getLastPostId().then((postId) => {
// * (Only visible to you) displays next to timestamp (standard view) or after message text (compact view)
cy.get(`#post_${postId}`).should('be.visible').within(() => {
cy.findByText('(Only visible to you)').should('exist');
});
// * Emoji reactions are not available on ephemeral messages
cy.get(`#post_${postId}`).trigger('mouseover', {force: true});
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('not.exist');
// * Save not available on ephemeral messages
cy.get(`#post_${postId}`).trigger('mouseover', {force: true});
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_flagIcon_${postId}`).should('not.exist');
// * Pin not available on ephemeral messages
cy.get(`#post_${postId}`).within(() => {
cy.wait(TIMEOUTS.HALF_SEC).get('.post-menu').should('not.exist');
});
// * Timestamp is not a link on ephemeral messages
cy.get(`#post_${postId}`).then((post) => {
cy.wrap(post).find('time.post__time').invoke('text');
cy.url().should('not.include', postId);
});
// * Can click `x` to close ephemeral message
cy.wait(TIMEOUTS.HALF_SEC).get('button.post__remove').click({force: true});
cy.get(`#post_${postId}`).should('not.exist');
});
});
});