Move /e2e -> /e2e-tests
Этот коммит содержится в:
@@ -0,0 +1,33 @@
|
||||
// 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 @websocket
|
||||
|
||||
import {getRandomId} from '../../../../utils';
|
||||
|
||||
describe('Handle removed user - new sidebar', () => {
|
||||
it('MM-27202 should add new channels to the sidebar when created from another session', () => {
|
||||
// # Start with a new team
|
||||
const teamName = `team-${getRandomId()}`;
|
||||
cy.createNewTeam(teamName, teamName);
|
||||
|
||||
// * Verify that we've switched to the new team
|
||||
cy.uiGetLHSHeader().findByText(teamName);
|
||||
|
||||
// # Create a new channel from another session
|
||||
const channelName = `channel-${getRandomId()}`;
|
||||
cy.apiGetTeamByName(teamName).then(({team}) => {
|
||||
cy.apiCreateChannel(team.id, channelName, channelName, 'O', '', '', false);
|
||||
});
|
||||
|
||||
// Verify that the new channel is in the sidebar
|
||||
cy.get(`#sidebarItem_${channelName}`).should('be.visible');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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 @websocket
|
||||
|
||||
import {getRandomId} from '../../../../utils';
|
||||
|
||||
describe('Handle removed user - new sidebar', () => {
|
||||
it('MM-27202 should add new channels to the sidebar when created from another session', () => {
|
||||
// # Start with a new team
|
||||
const teamName = `team-${getRandomId()}`;
|
||||
cy.createNewTeam(teamName, teamName);
|
||||
|
||||
// * Verify that we've switched to the new team
|
||||
cy.uiGetLHSHeader().findByText(teamName);
|
||||
|
||||
// # Create a new channel from another session
|
||||
const channelName = `channel-${getRandomId()}`;
|
||||
cy.apiGetTeamByName(teamName).then(({team}) => {
|
||||
cy.apiCreateChannel(team.id, channelName, channelName, 'O', '', '', false);
|
||||
});
|
||||
|
||||
// Verify that the new channel is in the sidebar
|
||||
cy.get(`#sidebarItem_${channelName}`).should('be.visible');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,165 @@
|
||||
// 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 @websocket
|
||||
|
||||
import {beRead, beUnread} from '../../../support/assertions';
|
||||
import {getAdminAccount} from '../../../support/env';
|
||||
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Handle new post', () => {
|
||||
const admin = getAdminAccount();
|
||||
let channel1;
|
||||
let team1;
|
||||
let user1;
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(({channel, team, user}) => {
|
||||
channel1 = channel;
|
||||
team1 = team;
|
||||
user1 = user;
|
||||
|
||||
cy.apiLogin(user1);
|
||||
cy.visit(`/${team.name}/channels/town-square`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T4609 - should mark channel as unread when a message is sent in another channel', () => {
|
||||
// # Explicitly click over to the test channel from Town Square
|
||||
// # to dismiss the unread + badge from adding `user` to the channel
|
||||
cy.get(`#sidebarItem_${channel1.name}`).click();
|
||||
|
||||
// * Verify those are now gone
|
||||
cy.get(`#sidebarItem_${channel1.name}`).should(beRead);
|
||||
cy.get(`#sidebarItem_${channel1.name} .badge`).should('not.exist');
|
||||
|
||||
// # Switch back to Town Square
|
||||
cy.get('#sidebarItem_town-square').click();
|
||||
|
||||
// # Have another user post in the test channel
|
||||
cy.postMessageAs({sender: admin, message: 'post', channelId: channel1.id});
|
||||
|
||||
// * Verify that the channel is now unread
|
||||
cy.get(`#sidebarItem_${channel1.name}`).should(beUnread);
|
||||
cy.get(`#sidebarItem_${channel1.name} .badge`).should('not.exist');
|
||||
});
|
||||
|
||||
it('MM-T4610 - should show the mention badge when a mention is sent in another channel', () => {
|
||||
// # Explicitly click over to the test channel from Town Square
|
||||
// # to dismiss the unread + badge from the end of the previous test
|
||||
// # (maybe should use a new channel but then the same thing has to be done
|
||||
// # for that anyways)
|
||||
cy.get(`#sidebarItem_${channel1.name}`).click();
|
||||
|
||||
cy.get(`#sidebarItem_${channel1.name}`).should(beRead);
|
||||
cy.get(`#sidebarItem_${channel1.name} .badge`).should('not.exist');
|
||||
|
||||
// # Switch back to Town Square
|
||||
cy.get('#sidebarItem_town-square').click();
|
||||
|
||||
// # Have another user post in the test channel
|
||||
cy.postMessageAs({sender: admin, message: `@${user1.username}`, channelId: channel1.id});
|
||||
|
||||
// * Verify that the channel is now unread with one mention
|
||||
cy.get(`#sidebarItem_${channel1.name}`).should(beUnread);
|
||||
cy.get(`#sidebarItem_${channel1.name} .badge`).should('exist').contains('1');
|
||||
|
||||
// # And have them post again
|
||||
cy.postMessageAs({sender: admin, message: `@${user1.username}`, channelId: channel1.id});
|
||||
|
||||
// * Verify that the channel is now unread with two mentions
|
||||
cy.get(`#sidebarItem_${channel1.name}`).should(beUnread);
|
||||
cy.get(`#sidebarItem_${channel1.name} .badge`).should('exist').contains('2');
|
||||
});
|
||||
|
||||
it('MM-T2015 - should show the mention badge when added to another channel', () => {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
// # Have another user create a new channel
|
||||
const channelName = 'channel_' + getRandomId();
|
||||
cy.externalRequest({
|
||||
user: admin,
|
||||
baseUrl,
|
||||
method: 'post',
|
||||
path: 'channels',
|
||||
data: {
|
||||
display_name: channelName,
|
||||
name: channelName,
|
||||
team_id: team1.id,
|
||||
type: 'O',
|
||||
},
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(201);
|
||||
|
||||
const channel = response.data;
|
||||
|
||||
// # And then invite the current user
|
||||
cy.externalRequest({
|
||||
user: admin,
|
||||
baseUrl,
|
||||
method: 'post',
|
||||
path: `channels/${channel.id}/members`,
|
||||
data: {
|
||||
user_id: user1.id,
|
||||
},
|
||||
}).then((addResponse) => {
|
||||
expect(addResponse.status).to.equal(201);
|
||||
});
|
||||
});
|
||||
|
||||
// * Verify that the channel is in the current user's sidebar and is unread with one mention
|
||||
cy.get(`#sidebarItem_${channelName}`).should(beUnread);
|
||||
cy.get(`#sidebarItem_${channelName} .badge`).should('exist').contains('1');
|
||||
});
|
||||
|
||||
it('MM-25452 should only show one mention added to another channel with network lag', () => {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
// # Have another user create a new channel
|
||||
const channelName = 'channel_' + getRandomId();
|
||||
cy.externalRequest({
|
||||
user: admin,
|
||||
baseUrl,
|
||||
method: 'post',
|
||||
path: 'channels',
|
||||
data: {
|
||||
display_name: channelName,
|
||||
name: channelName,
|
||||
team_id: team1.id,
|
||||
type: 'O',
|
||||
},
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(201);
|
||||
|
||||
const channel = response.data;
|
||||
|
||||
// # Add a small delay to the request to fetch the channel
|
||||
cy.delayRequestToRoutes([`channels/${channel.id}`], 100);
|
||||
|
||||
// # And then invite the current user
|
||||
cy.externalRequest({
|
||||
user: admin,
|
||||
baseUrl,
|
||||
method: 'post',
|
||||
path: `channels/${channel.id}/members`,
|
||||
data: {
|
||||
user_id: user1.id,
|
||||
},
|
||||
}).then((addResponse) => {
|
||||
expect(addResponse.status).to.equal(201);
|
||||
});
|
||||
});
|
||||
|
||||
// * Verify that the channel is in the current user's sidebar and is unread with one mention
|
||||
cy.get(`#sidebarItem_${channelName}`).should(beUnread);
|
||||
cy.get(`#sidebarItem_${channelName} .badge`).should('exist').contains('1');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
export function createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass) {
|
||||
// # Start with a new team
|
||||
cy.createNewTeam(teamName, teamName);
|
||||
|
||||
// * Verify that we've switched to the new team
|
||||
cy.uiGetLHSHeader().findByText(teamName);
|
||||
|
||||
// # Click on Off Topic
|
||||
cy.get(`${sidebarItemClass}:contains(Off-Topic)`).should('be.visible').click();
|
||||
|
||||
// * Verify that the channel changed
|
||||
cy.url().should('include', `/${teamName}/channels/off-topic`);
|
||||
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Off-Topic');
|
||||
}
|
||||
|
||||
export function removeMeFromCurrentChannel() {
|
||||
// # Remove the Guest User from channel
|
||||
let channelId;
|
||||
return cy.getCurrentChannelId().then((res) => {
|
||||
channelId = res;
|
||||
return cy.apiGetMe();
|
||||
}).then(({user}) => {
|
||||
return cy.removeUserFromChannel(channelId, user.id);
|
||||
});
|
||||
}
|
||||
|
||||
export function verifyRHS(teamName, sidebarItemClass, postId) {
|
||||
// # Dismiss the modal informing the user they were kicked out
|
||||
cy.get('#removedChannelBtn').click();
|
||||
|
||||
// * Verify that the channel changed back to Town Square
|
||||
cy.url().should('include', `/${teamName}/channels/town-square`);
|
||||
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Town Square');
|
||||
|
||||
// * Verify that Off-Topic has been removed
|
||||
cy.get(`${sidebarItemClass}:contains(Off-Topic)`).should('not.exist');
|
||||
|
||||
// * Verify that the recently posted message is no longer in the RHS
|
||||
cy.get(`#rhsPostMessageText_${postId}`).should('not.exist');
|
||||
}
|
||||
|
||||
export function shouldRemoveMentionsInRHS(teamName, sidebarItemClass) {
|
||||
let postId;
|
||||
|
||||
// # Post a unique message with a mention and retrieve its ID
|
||||
cy.apiGetMe().then(({user}) => {
|
||||
var messageText = `${Date.now()} - mention to @${user.username} `;
|
||||
cy.postMessage(messageText);
|
||||
|
||||
return cy.getLastPostId();
|
||||
}).then((lastPostId) => {
|
||||
postId = lastPostId;
|
||||
|
||||
// # Click on the Recent Mentions button to open the RHS
|
||||
cy.uiGetRecentMentionButton().click();
|
||||
|
||||
// * Verify that the recently posted message is shown in the RHS
|
||||
cy.get(`#rhsPostMessageText_${postId}`).should('exist');
|
||||
|
||||
return removeMeFromCurrentChannel();
|
||||
}).then(() => {
|
||||
verifyRHS(teamName, sidebarItemClass, postId);
|
||||
});
|
||||
}
|
||||
|
||||
export function shouldRemoveSavedPostsInRHS(teamName, sidebarItemClass) {
|
||||
let postId;
|
||||
|
||||
// # Post a unique message and retrieve its ID
|
||||
var messageText = `${Date.now()} - post to save`;
|
||||
cy.postMessage(messageText);
|
||||
|
||||
cy.getLastPostId().then((lastPostId) => {
|
||||
postId = lastPostId;
|
||||
|
||||
// # Save the last post
|
||||
cy.clickPostSaveIcon(postId);
|
||||
|
||||
// # Click on the Saved Posts button to open the RHS
|
||||
cy.uiGetSavedPostButton().click();
|
||||
|
||||
// * Verify that the recently posted message is shown in the RHS
|
||||
cy.get(`#rhsPostMessageText_${postId}`).should('exist');
|
||||
|
||||
return removeMeFromCurrentChannel();
|
||||
}).then(() => {
|
||||
verifyRHS(teamName, sidebarItemClass, postId);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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 @websocket
|
||||
|
||||
import {getRandomId} from '../../../../utils';
|
||||
|
||||
import {
|
||||
createNewTeamAndMoveToOffTopic,
|
||||
removeMeFromCurrentChannel,
|
||||
shouldRemoveSavedPostsInRHS,
|
||||
shouldRemoveMentionsInRHS,
|
||||
} from './helpers';
|
||||
|
||||
describe('Handle removed user - new sidebar', () => {
|
||||
const sidebarItemClass = '.SidebarChannel';
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => {
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be redirected to last channel when a user is removed from their current channel', () => {
|
||||
const teamName = `team-${getRandomId()}`;
|
||||
createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass);
|
||||
|
||||
removeMeFromCurrentChannel().then(() => {
|
||||
// * Verify that the channel changed back to Town Square
|
||||
cy.url().should('include', `/${teamName}/channels/town-square`);
|
||||
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Town Square');
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove mentions from RHS', () => {
|
||||
const teamName = `team-${getRandomId()}`;
|
||||
createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass);
|
||||
shouldRemoveMentionsInRHS(teamName, sidebarItemClass);
|
||||
});
|
||||
|
||||
it('should remove saved posts from RHS', () => {
|
||||
const teamName = `team-${getRandomId()}`;
|
||||
createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass);
|
||||
shouldRemoveSavedPostsInRHS(teamName, sidebarItemClass);
|
||||
});
|
||||
});
|
||||
Ссылка в новой задаче
Block a user