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

[MM-T561] Add e2e test for MM-T561 #7015

Merged
merged 10 commits into from
Nov 17, 2020
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// 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.
// ***************************************************************

// Group: @notifications

describe('Notifications', () => {
let user1;
let user2;
let team1;
let team2;
let testTeam1TownSquareUrl;
let siteName;

before(() => {
cy.apiInitSetup().then(({team, user}) => {
team1 = team;
user1 = user;
testTeam1TownSquareUrl = `/${team.name}/channels/town-square`;

cy.apiCreateUser().then(({user: otherUser}) => {
user2 = otherUser;
cy.apiAddUserToTeam(team.id, user2.id);
});

cy.apiCreateTeam('team-b', 'Team B').then(({team: anotherTeam}) => {
team2 = anotherTeam;
cy.apiAddUserToTeam(team2.id, user1.id);
cy.apiAddUserToTeam(team2.id, user2.id);
});

cy.apiGetConfig().then(({config}) => {
siteName = config.TeamSettings.SiteName;
});

// # Remove mention notification (for initial channel).
cy.apiLogin(user1);
cy.visit(testTeam1TownSquareUrl);
cy.get('#publicChannelList').get('.unread-title').click();
cy.apiLogout();
});
});

it('MM-T561 Browser tab and team sidebar - direct messages don\'t add indicator on team icon in team sidebar (but do in browser tab)', () => {
// # User A: Join teams A and B. Open team A
cy.apiLogin(user1);
cy.visit(testTeam1TownSquareUrl);

// # User B: Join team B
// # User B: Post a direct message to user A
cy.apiCreateDirectChannel([user1.id, user2.id]).then(({channel: ownDMChannel}) => {
cy.postMessageAs({sender: user2, message: `@${user1.username}`, channelId: ownDMChannel.id});
});

// * Browser tab shows: (1) * Town Square - [team name] Mattermost
cy.title().should('include', `(1) Town Square - ${team1.display_name} ${siteName}`);

// * Team sidebar shows: No unread / mention indicator in team sidebar on either team
cy.get(`#${team2.name}TeamButton`).parent('.unread').should('not.be.visible');
cy.get(`#${team2.name}TeamButton`).parent().within(() => {
cy.get('.badge').should('not.be.visible');
});
});
});