Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[MM-28295] e2e/messaging/reactions: add reactions spec #6535

Merged
merged 5 commits into from
Sep 25, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add remaning cases
  • Loading branch information
isacikgoz committed Sep 24, 2020
commit 78cce460ee608d011c19ff39e41b01a1425ba4cc
161 changes: 148 additions & 13 deletions e2e/cypress/integration/messaging/reactions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,16 @@

// Group: @messaging

describe('Messaging', () => {
let testTeam;
let testChannel;
let testUser;
import * as TIMEOUTS from '../../fixtures/timeouts';

describe('Messaging', () => {
before(() => {
cy.apiInitSetup().then(({team, channel, user}) => {
testUser = user;
testTeam = team;
testChannel = channel;
cy.apiLogin(testUser);
cy.apiLogin(user);
cy.visit(`/${team.name}/channels/${channel.name}`);
});
});

beforeEach(() => {
cy.visit(`/${testTeam.name}/channels/${testChannel.name}`);
});

it('MM-T2189 Emoji reaction - type +:+1:', () => {
// # Post a message
cy.postMessage('Hello');
Expand All @@ -39,10 +31,153 @@ describe('Messaging', () => {
cy.postMessageReplyInRHS('+:+1:{enter}');

// * 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');
});

// # Clos RHS
isacikgoz marked this conversation as resolved.
Show resolved Hide resolved
cy.closeRHS();
});
});

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.get('.emoji-picker__items #emoji-1f631').wait(TIMEOUTS.HALF_SEC).click();

// $ Click the `+` button next to the existing reactions (visible on hover)
isacikgoz marked this conversation as resolved.
Show resolved Hide resolved
cy.get(`#addReaction-${postId}`).should('exist').click({force: true});

// # Click to select an emoji from the picker
cy.get('.emoji-picker__items #emoji-1f643').wait(TIMEOUTS.HALF_SEC).click();

// * Emoji reaction is added to the post
cy.get(`#${postId}_message`).within(() => {
cy.findByLabelText('reactions').should('exist');
cy.findByLabelText('remove reaction +1').should('exist');
cy.findByLabelText('remove reaction upside down face').should('exist');
});

// * Reaction appears in recently used section of emoji picker
cy.get('#emojiPickerButton').click().then(() => {
cy.findAllByTestId('emojiItem').first().within(($el) => {
cy.wrap($el).findByTestId('upside_down_face').should('be.visible');
});
});
});
});

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.findByLabelText('Expand').click();

// # 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.get('.emoji-picker__items #emoji-1f631').wait(TIMEOUTS.HALF_SEC).click();

// # 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.get('.emoji-picker__items #emoji-1f643').wait(TIMEOUTS.HALF_SEC).click();

// * 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 scream').should('be.visible');
cy.findByLabelText('remove reaction upside down face').should('be.visible');
});

// # Clos RHS
isacikgoz marked this conversation as resolved.
Show resolved Hide resolved
cy.closeRHS();
});
});
});

it('MM-T2195 Emoji reaction - not available on system message Flag - not available on system message Pin - not available on system message Can delete your own system message', () => {
lindy65 marked this conversation as resolved.
Show resolved Hide resolved
// # click add a channel description
isacikgoz marked this conversation as resolved.
Show resolved Hide resolved
cy.get('#channelHeaderDescription button').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');

// * Flag - 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
isacikgoz marked this conversation as resolved.
Show resolved Hide resolved
cy.get(`#delete_post_${postId}`).click();

// # Check that confirmation dialog is open.
isacikgoz marked this conversation as resolved.
Show resolved Hide resolved
cy.get('#deletePostModal').should('be.visible');

// # Confirm deletion.
cy.get('#deletePostModalButton').click();
});
});

it('MM-T2196 Emoji reaction - not available on ephemeral message Flag - not available on ephemeral message Pin - not available on ephemeral message Timestamp - not a link on ephemeral message Can close ephemeral message', () => {
lindy65 marked this conversation as resolved.
Show resolved Hide resolved
// # 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');

// * Flag 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');
});
});
});