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

Commit

Permalink
add e2e test for @channel, @ALL, and @here at-mentions (#2678)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekiiingbob authored and saturninoabril committed Apr 29, 2019
1 parent 8ef6c89 commit 20233ab
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion cypress/integration/at_mentions/at_mentions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************

/*eslint max-nested-callbacks: ["error", 3]*/
/*eslint max-nested-callbacks: ["error", 4]*/
/*eslint-disable func-names*/

function setNotificationSettings(desiredSettings = {first: true, username: true, shouts: true, custom: true, customText: '@'}) {
Expand Down Expand Up @@ -177,4 +177,45 @@ describe('at-mention', () => {
find(`[data-mention=${this.receiver.username}]`).
should('not.exist');
});

it('N14572 does not trigger notifications with "channel-wide mentions" unchecked', function() {
// 1. Set Notification settings
setNotificationSettings({first: false, username: false, shouts: false, custom: true});

const channelMentions = ['@here', '@all', '@channel'];

channelMentions.forEach((mention) => {
const message = `Hey ${mention} I'm message you all! ${Date.now()}`;

// 2. Use another account to post a message @-mentioning our receiver
cy.task('postMessageAs', {sender: this.sender, message, channelId: this.channelId});

// * Verify stub was not called
cy.get('@notifyStub').should('be.not.called');

// * Verify unread mentions badge does not exist
cy.get('#sidebarItem_town-square').
scrollIntoView().
find('#unreadMentions').
should('be.not.visible');

// 3. Go to the channel where you were messaged
cy.get('#sidebarItem_town-square').click();

// 4. Get last post message text
cy.getLastPostIdWithRetry().then((postId) => {
cy.get(`#postMessageText_${postId}`).as('postMessageText');
});

// * Verify message contents
cy.get('@postMessageText').
should('be.visible').
and('have.text', message);

// * Verify it's not highlighted
cy.get('@postMessageText').
find(`[data-mention=${this.receiver.username}]`).
should('not.exist');
});
});
});

0 comments on commit 20233ab

Please sign in to comment.