Move /e2e -> /e2e-tests
Этот коммит содержится в:
@@ -0,0 +1,84 @@
|
||||
// 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 @channel
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Archived channels', () => {
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit created channel
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => {
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1720 Cannot add reactions to existing reactions', () => {
|
||||
const messageText = 'Test add reaction in archive channels';
|
||||
|
||||
// # Post a message in the channel
|
||||
cy.postMessage(messageText);
|
||||
|
||||
// # Get the last post for reference of ID
|
||||
cy.getLastPostId().then((postId) => {
|
||||
// # Click the add reaction icon
|
||||
cy.clickPostReactionIcon(postId);
|
||||
|
||||
// # Search for the emoji in emoji search bar
|
||||
cy.findByPlaceholderText('Search emojis').should('exist').and('be.visible').
|
||||
clear().
|
||||
type('slightly_frowning_face', {delay: TIMEOUTS.QUARTER_SEC, force: true});
|
||||
|
||||
// # Choose "slightly_frowning_face" emoji
|
||||
cy.clickEmojiInEmojiPicker('slightly_frowning_face');
|
||||
|
||||
// * Should have added the reaction with count
|
||||
cy.get(`#postReaction-${postId}-slightly_frowning_face .Reaction__number--display`).should('have.text', '1');
|
||||
|
||||
// * Should have add reaction button
|
||||
cy.get(`#addReaction-${postId}`).should('exist');
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// * Should not have add reaction button
|
||||
cy.get(`#addReaction-${postId}`).should('not.exist');
|
||||
|
||||
// # Click on existing "slightly_frowning_face" emoji
|
||||
cy.get(`#postReaction-${postId}-slightly_frowning_face`).click();
|
||||
|
||||
// * Reaction count should not have incremented
|
||||
cy.get(`#postReaction-${postId}-slightly_frowning_face .Reaction__number--display`).should('have.text', '1');
|
||||
|
||||
// # Remove focus so we can open RHS
|
||||
cy.get('#channel_view').click();
|
||||
|
||||
// # Open RHS for the post
|
||||
cy.clickPostCommentIcon(postId);
|
||||
|
||||
cy.get(`#rhsPost_${postId}`).within(() => {
|
||||
// * Should not have add reaction button
|
||||
cy.get(`#addReaction-${postId}`).should('not.exist');
|
||||
|
||||
// # Click on existing "slightly_frowning_face" emoji
|
||||
cy.get(`#postReaction-${postId}-slightly_frowning_face`).click();
|
||||
|
||||
// * Reaction count should not have incremented
|
||||
cy.get(`#postReaction-${postId}-slightly_frowning_face .Reaction__number--display`).should('have.text', '1');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,102 @@
|
||||
// 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 @channel
|
||||
|
||||
describe('Archive channel header spec', () => {
|
||||
before(() => {
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
|
||||
// # Click reset to defaults and confirm
|
||||
cy.findByTestId('resetPermissionsToDefault').click();
|
||||
cy.get('#confirmModalButton').click();
|
||||
|
||||
// # Ensure permissions for converting channel to private is enabled
|
||||
cy.findByTestId('all_users-public_channel-convert_public_channel_to_private-checkbox').then((el) => {
|
||||
if (!el.hasClass('checked')) {
|
||||
el.click();
|
||||
}
|
||||
});
|
||||
|
||||
// # Save the settings
|
||||
cy.uiSave();
|
||||
cy.uiSaveButton().should('be.visible');
|
||||
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit create channel
|
||||
cy.apiInitSetup({loginAfter: true}).then(({channelUrl}) => {
|
||||
cy.visit(channelUrl);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1717 Archived channel details cannot be edited', () => {
|
||||
// # click on channel drop-down menu
|
||||
cy.get('#channelHeaderTitle').click();
|
||||
|
||||
// * The dropdown menu of the channel header should be visible;
|
||||
cy.get('#channelLeaveChannel').should('be.visible');
|
||||
|
||||
// * Rename menu option should be visible;
|
||||
cy.get('#channelRename').should('be.visible');
|
||||
|
||||
// * Edit header menu option should be visible;
|
||||
cy.get('#channelEditHeader').should('be.visible');
|
||||
|
||||
// * Edit purpose menu option should be visible;
|
||||
cy.get('#channelEditPurpose').should('be.visible');
|
||||
|
||||
// * Convert channel to private menu option should be visible;
|
||||
cy.get('#channelConvertToPrivate').should('be.visible');
|
||||
|
||||
// * Archive channel menu option should be visible;
|
||||
cy.get('#channelArchiveChannel').should('be.visible');
|
||||
|
||||
// * Add members menu option should be visible;
|
||||
cy.get('#channelAddMembers').should('be.visible');
|
||||
|
||||
// * Notification preferences option should be visible;
|
||||
cy.get('#channelNotificationPreferences').should('be.visible');
|
||||
|
||||
// # Close the channel dropdown menu
|
||||
cy.get('#channelHeaderTitle').click();
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// * Rename menu option should not be visible;
|
||||
cy.get('#channelRename').should('not.exist');
|
||||
|
||||
// * Edit header menu option should not be visible;
|
||||
cy.get('#channelEditHeader').should('not.exist');
|
||||
|
||||
// * Edit purpose menu option should not be visible;
|
||||
cy.get('#channelEditPurpose').should('not.exist');
|
||||
|
||||
// * Convert channel to private menu option should not be visible;
|
||||
cy.get('#channelConvertToPrivate').should('not.exist');
|
||||
|
||||
// * Archive channel menu option should not be visible;
|
||||
cy.get('#channelArchiveChannel').should('not.exist');
|
||||
|
||||
// * Add members menu option should not be visible;
|
||||
cy.get('#channelAddMembers').should('not.exist');
|
||||
|
||||
// * Notification preferences option should not be visible;
|
||||
cy.get('#channelNotificationPreferences').should('not.exist');
|
||||
|
||||
// # Close the channel dropdown menu
|
||||
cy.get('#channelHeaderTitle').click();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
// 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 @channel
|
||||
|
||||
describe('Archive channel members spec', () => {
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit create channel
|
||||
cy.apiInitSetup({loginAfter: true, promoteNewUserAsAdmin: true}).then(({team, channel}) => {
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1719 Archived channel members cannot be managed', () => {
|
||||
// # click on channel drop-down menu
|
||||
cy.get('#channelHeaderTitle').click();
|
||||
|
||||
// * View members menu option should not be visible;
|
||||
cy.get('#channelViewMembers').should('not.exist');
|
||||
|
||||
// * Manage members menu option should be visible;
|
||||
cy.get('#channelManageMembers').should('be.visible');
|
||||
|
||||
// # Close the channel dropdown menu
|
||||
cy.get('#channelHeaderTitle').click();
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # click on channel drop-down menu
|
||||
cy.get('#channelHeaderTitle').click();
|
||||
|
||||
// * Manage members menu option should not be visible;
|
||||
cy.get('#channelManageMembers').should('not.exist');
|
||||
|
||||
// # click on view members menu option;
|
||||
cy.get('#channelViewMembers button').should('be.visible').click();
|
||||
|
||||
// * Ensure there are no options to change channel roles or membership
|
||||
cy.uiGetRHS().findByText('Manage').should('not.exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,129 @@
|
||||
// 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 @channel
|
||||
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
import {createArchivedChannel} from './helpers';
|
||||
|
||||
describe('Leave an archived channel', () => {
|
||||
let testTeam;
|
||||
let testChannel;
|
||||
let testUser;
|
||||
const testArchivedMessage = `this is an archived post ${getRandomId()}`;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit test channel
|
||||
cy.apiInitSetup().then(({team, channel, user}) => {
|
||||
testTeam = team;
|
||||
testChannel = channel;
|
||||
testUser = user;
|
||||
|
||||
cy.apiCreateUser({prefix: 'second'}).then(({user: second}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, second.id);
|
||||
});
|
||||
cy.visit(`/${team.name}/channels/${testChannel.name}`);
|
||||
cy.postMessageAs({sender: testUser, message: testArchivedMessage, channelId: testChannel.id});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1704 Archived channels appear in channel switcher after refresh', () => {
|
||||
// # Archive the channel
|
||||
cy.apiLogin(testUser);
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Switch to another channel
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// # Use CTRL / CMD+K shortcut to open channel switcher.
|
||||
cy.typeCmdOrCtrl().type('K', {release: true});
|
||||
|
||||
// # Start typing the name of the archived channel in the search bar of the channel switcher
|
||||
cy.get('#quickSwitchInput').type(testChannel.display_name);
|
||||
|
||||
// * The archived channel appears in channel switcher search results
|
||||
cy.get('#suggestionList').should('be.visible');
|
||||
cy.get('#suggestionList').find(`#switchChannel_${testChannel.name}`).should('be.visible');
|
||||
|
||||
// # Reload the app (refresh the web page)
|
||||
cy.reload().then(() => {
|
||||
// # Return to the channel switcher
|
||||
cy.typeCmdOrCtrl().type('K', {release: true});
|
||||
|
||||
// # Start typing the name of the archived channel in the search bar of the channel switcher
|
||||
cy.get('#quickSwitchInput').type(testChannel.display_name).then(() => {
|
||||
// * The archived channel appears in channel switcher search results
|
||||
cy.get('#suggestionList').should('be.visible');
|
||||
cy.get('#suggestionList').find(`#switchChannel_${testChannel.name}`).should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1705 User can unarchive a public channel', () => {
|
||||
// # As a user with appropriate permission, archive a public channel:
|
||||
cy.apiAdminLogin();
|
||||
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
cy.contains('#channelHeaderTitle', 'Off-Topic');
|
||||
|
||||
const messageText = `archived text ${getRandomId()}`;
|
||||
|
||||
createArchivedChannel({prefix: 'unarchive-'}, [messageText]).then(({name}) => {
|
||||
// # View the archived channel, noting that it is read-only
|
||||
cy.uiGetPostTextBox({exist: false});
|
||||
|
||||
// # Unarchive the channel:
|
||||
cy.uiUnarchiveChannel().then(() => {
|
||||
// * Channel is no longer read-only
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// * Channel is displayed in LHS with the normal icon, not an archived channel icon
|
||||
cy.get(`#sidebarItem_${name}`).scrollIntoView().should('be.visible');
|
||||
|
||||
cy.get(`#sidebarItem_${name}`).find('.icon-globe').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1706 User can unarchive a private channel', () => {
|
||||
// # As a user with appropriate permission, archive a private channel:
|
||||
cy.apiAdminLogin();
|
||||
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
cy.contains('#channelHeaderTitle', 'Off-Topic');
|
||||
|
||||
const messageText = `archived text ${getRandomId()}`;
|
||||
const channelOptions = {
|
||||
prefix: 'private-unarchive-',
|
||||
isPrivate: true,
|
||||
};
|
||||
|
||||
createArchivedChannel(channelOptions, [messageText]).then(({name}) => {
|
||||
// # View the archived channel, noting that it is read-only
|
||||
cy.uiGetPostTextBox({exist: false});
|
||||
|
||||
// # Unarchive the channel:
|
||||
cy.uiUnarchiveChannel().then(() => {
|
||||
// * Channel is no longer read-only
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// * Channel is displayed in LHS with the normal icon, not an archived channel icon
|
||||
cy.get(`#sidebarItem_${name}`).find('.icon-lock-outline').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,132 @@
|
||||
// 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 @channel
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Archived channels', () => {
|
||||
let testTeam;
|
||||
let testUser;
|
||||
let otherUser;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit created channel
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testUser = user;
|
||||
testTeam = team;
|
||||
|
||||
cy.apiCreateUser({prefix: 'second'}).then(({user: second}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, second.id);
|
||||
otherUser = second;
|
||||
|
||||
cy.apiLogin(testUser);
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel').then(({channel}) => {
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1716 Text box in center channel and in RHS should not be visible', () => {
|
||||
// # Post a message in the channel
|
||||
cy.postMessage('Test archive reply');
|
||||
cy.getLastPostId().then((id) => {
|
||||
cy.clickPostCommentIcon(id);
|
||||
|
||||
// * RHS should be visible
|
||||
cy.get('#rhsContainer').should('be.visible');
|
||||
|
||||
// * RHS text box should be visible
|
||||
cy.uiGetReplyTextBox();
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// * Post text box should not be visible
|
||||
cy.uiGetPostTextBox({exist: false});
|
||||
|
||||
// * RHS should not be visible
|
||||
cy.get('#rhsContainer').should('not.exist');
|
||||
|
||||
// # Open RHS
|
||||
cy.clickPostCommentIcon(id);
|
||||
|
||||
cy.get('#rhsContainer').should('be.visible');
|
||||
|
||||
// * RHS text box should not be visible
|
||||
cy.uiGetReplyTextBox({exist: false});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1722 Can click reply arrow on a post from archived channel, from saved posts list', () => {
|
||||
// # Create a channel that will be archived
|
||||
cy.apiCreateChannel(testTeam.id, 'archived-channel', 'Archived Channel').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Post message
|
||||
cy.postMessage('Test');
|
||||
|
||||
// # Create permalink to post
|
||||
cy.getLastPostId().then((id) => {
|
||||
const permalink = `${Cypress.config('baseUrl')}/${testTeam.name}/pl/${id}`;
|
||||
|
||||
// # Click on ... button of last post
|
||||
cy.clickPostDotMenu(id);
|
||||
|
||||
// # Click on "Copy Link"
|
||||
cy.uiClickCopyLink(permalink, id);
|
||||
|
||||
// # Post the message in another channel
|
||||
cy.get('#sidebarItem_off-topic').click();
|
||||
cy.postMessage(permalink).wait(TIMEOUTS.ONE_SEC);
|
||||
});
|
||||
|
||||
// # Archive the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiArchiveChannel();
|
||||
});
|
||||
|
||||
// # Change user
|
||||
cy.apiLogout();
|
||||
cy.reload();
|
||||
cy.apiLogin(otherUser);
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// # Read the message and save post
|
||||
cy.get('a.markdown__link').click();
|
||||
cy.getNthPostId(1).then((postId) => {
|
||||
cy.clickPostSaveIcon(postId);
|
||||
});
|
||||
|
||||
// # View saved posts
|
||||
cy.uiGetSavedPostButton().click();
|
||||
cy.wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// * RHS should be visible
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
|
||||
// * Should be able to click on reply
|
||||
cy.get('#search-items-container div.post-message__text-container > div').last().should('have.attr', 'id').and('not.include', ':').
|
||||
invoke('replace', 'rhsPostMessageText_', '').then((rhsPostId) => {
|
||||
cy.clickPostCommentIcon(rhsPostId, 'SEARCH');
|
||||
|
||||
// * RHS text box should not be visible
|
||||
cy.uiGetReplyTextBox({exist: false});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
// 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 @channel
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Archived channels', () => {
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit created channel
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => {
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1718 Reaction icon should not be visible for archived channel posts', () => {
|
||||
const messageText = 'Test archive reaction';
|
||||
|
||||
// # Post a message in the channel
|
||||
cy.postMessage(messageText);
|
||||
|
||||
// # Get the last post for reference of ID
|
||||
cy.getLastPostId().then((postId) => {
|
||||
// # Click on post dot menu so we can check for reaction icon
|
||||
cy.clickPostDotMenu();
|
||||
|
||||
// * Reaction icon should be visible as channel is not archived
|
||||
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('be.visible');
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Click on post dot menu so we can check for reaction icon
|
||||
cy.clickPostDotMenu(postId);
|
||||
|
||||
// * Reaction icon on center channel post should not be visible anymore
|
||||
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('not.exist');
|
||||
|
||||
// # Remove focus so we can open RHS
|
||||
cy.get('#channel_view').click();
|
||||
|
||||
// # Open RHS for the post
|
||||
cy.clickPostCommentIcon(postId);
|
||||
|
||||
// # Click on post dot menu so we can check for reaction icon
|
||||
cy.clickPostDotMenu(postId, 'RHS_ROOT');
|
||||
|
||||
// * Reaction icon on post in RHS should not be visible anymore
|
||||
cy.wait(TIMEOUTS.HALF_SEC).get(`#RHS_ROOT_reaction_${postId}`).should('not.exist');
|
||||
|
||||
// # Search for "Test archive reaction"
|
||||
cy.get('#searchBox').should('be.visible').type(messageText).type('{enter}');
|
||||
|
||||
// # Click on post dot menu so we can check for reaction icon
|
||||
cy.clickPostDotMenu(postId, 'SEARCH');
|
||||
|
||||
// * Reaction icon on post in search results should not be visible anymore
|
||||
cy.wait(TIMEOUTS.HALF_SEC).get(`#searchResult_reaction_${postId}`).should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
// 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 @channel
|
||||
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
import {createArchivedChannel} from './helpers';
|
||||
|
||||
describe('archive tests while preventing viewing archived channels', () => {
|
||||
let testTeam;
|
||||
let testChannel;
|
||||
let testUser;
|
||||
const testArchivedMessage = `this is an archived post ${getRandomId()}`;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit test channel
|
||||
cy.apiInitSetup().then(({team, channel, user}) => {
|
||||
testTeam = team;
|
||||
testChannel = channel;
|
||||
testUser = user;
|
||||
|
||||
cy.apiCreateUser({prefix: 'second'}).then(({user: second}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, second.id);
|
||||
});
|
||||
cy.visit(`/${team.name}/channels/${testChannel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1707 Unarchived channels can be searched the same as before they where archived', () => {
|
||||
// # Post some text in the channel such as "Pineapple"
|
||||
const messageText = `pineapple ${getRandomId()}`;
|
||||
|
||||
// # Archive the channel
|
||||
createArchivedChannel({prefix: 'pineapple-'}, [messageText]).then(() => {
|
||||
// # Unarchive the channel
|
||||
cy.uiUnarchiveChannel().then(() => {
|
||||
// # Remove search on archived channels
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: false,
|
||||
},
|
||||
});
|
||||
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
cy.contains('#channelHeaderTitle', 'Off-Topic');
|
||||
cy.postMessage(getRandomId());
|
||||
|
||||
// # Search for the post from step 1')
|
||||
cy.get('#searchBox').click().clear().type(`${messageText}{enter}`);
|
||||
|
||||
// * Post is returned by search, since it's not archived anymore
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
cy.get('.search-item-snippet').first().contains(messageText);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1708 An archived channel can\'t be searched when "Allow users to view archived channels" is set to False in "Site Configuration > Users and Teams" in the System Console', () => {
|
||||
// # First, as system admin, ensure that System Console > Users and Teams > Allow users to view archived channels is set to `false`.
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: false,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiLogin(testUser);
|
||||
|
||||
// # Open a channel other than Town Square
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
cy.contains('#channelHeaderTitle', 'Off-Topic');
|
||||
|
||||
// # Create or locate a channel you're a member of
|
||||
cy.visit(`/${testTeam.name}/channels/${testChannel.name}`);
|
||||
cy.get('#channelHeaderTitle').should('be.visible');
|
||||
|
||||
// # Post distinctive text in the channel such as "I like pineapples"
|
||||
cy.postMessageAs({sender: testUser, message: testArchivedMessage, channelId: testChannel.id});
|
||||
|
||||
// # Select Archive Channel from the header menu
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Archive dialogue message reads "This will archive the channel from the team and make its contents inaccessible for all users" (Mobile dialogue makes no mention of the data will be accessible)
|
||||
cy.get('#searchBox').click().clear().type(`${testArchivedMessage}{enter}`);
|
||||
|
||||
// * Post is not returned by search
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
cy.get('.no-results__wrapper').should('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T1709 Archive a channel while search results are displayed in RHS', () => {
|
||||
const messageText = `search ${getRandomId()} pineapples`;
|
||||
|
||||
// # Post a unique string of text in a channel
|
||||
cy.uiCreateChannel({prefix: 'archive-while-searching'}).then(() => {
|
||||
cy.postMessage(messageText);
|
||||
|
||||
// # Search for the string of text from step 1
|
||||
cy.get('#searchBox').click().clear().type(`${messageText}{enter}`);
|
||||
|
||||
// * Post is returned by search, since it's not archived anymore
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
|
||||
// # Observe the post is displayed in RHS results
|
||||
cy.get('.search-item-snippet').first().should('contain.text', messageText);
|
||||
|
||||
// # While the RHS is still open with the results, archive the channel the post was made in
|
||||
cy.uiArchiveChannel();
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
cy.get('.no-results__wrapper').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1710 archived channels are not listed on the "in:" autocomplete', () => {
|
||||
// # Archive a channel and make a mental note of the channel name
|
||||
// # Type "in:" and note the list of channels that appear
|
||||
cy.get('#searchBox').click().clear().type(`in:${testChannel.name}`);
|
||||
cy.findByTestId(testChannel.name).should('not.exist');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
// 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: @channels @channel
|
||||
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
import {createArchivedChannel} from './helpers';
|
||||
|
||||
describe('Leave an archived channel', () => {
|
||||
let testTeam;
|
||||
let testChannel;
|
||||
const testArchivedMessage = `this is an archived post ${getRandomId()}`;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiInitSetup().then(({team, channel}) => {
|
||||
testTeam = team;
|
||||
testChannel = channel;
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1672_1 User can close archived channel (1/2)', () => {
|
||||
// # Open a channel that's not the town square
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// # repeat searching and navigating to the archived channel steps 3 times.
|
||||
[1, 2, 3].forEach((i) => {
|
||||
// * ensure we are not on an archived channel
|
||||
cy.get('#channelInfoModalLabel span.icon__archive').should('not.exist');
|
||||
|
||||
// # Search for a post in an archived channel
|
||||
cy.get('#searchBox').click().clear().type(`${testArchivedMessage}{enter}`);
|
||||
|
||||
// # Open the archived channel by selecting Jump from search results and then selecting the link to move to the most recent posts in the channel
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
|
||||
cy.get('a.search-item__jump').first().click();
|
||||
|
||||
cy.get(`#sidebarItem_${testChannel.name}`).should('be.visible');
|
||||
|
||||
cy.url().should('satisfy', (testUrl) => {
|
||||
return testUrl.endsWith(`${testTeam.name}/channels/${testChannel.name}`); // wait for permalink to turn into channel url
|
||||
});
|
||||
|
||||
if (i < 3) {
|
||||
// # Close an archived channel by clicking "Close Channel" button in the footer
|
||||
cy.get('#channelArchivedMessage button').click();
|
||||
} else {
|
||||
// # Click the header menu and select Archive Channel
|
||||
cy.uiOpenChannelMenu('Archive Channel');
|
||||
}
|
||||
|
||||
// * The user is returned to the channel they were previously viewing and the archived channel is removed from the drawer
|
||||
cy.get(`#sidebarItem_${testChannel.name}`).should('not.exist');
|
||||
cy.url().should('include', `${testTeam.name}/channels/off-topic`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1672_2 User can close archived channel (2/2)', () => {
|
||||
// # Add text to channel you land on (after closing the archived channel via Close Channel button)
|
||||
// * Able to add test
|
||||
cy.postMessage('some text');
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#${postId}_message`).should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1678 Open an archived channel using CTRL/CMD+K', () => {
|
||||
// # Select CTRL/CMD+K (or ⌘+K) to open the channel switcher
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
cy.typeCmdOrCtrl().type('K', {release: true});
|
||||
|
||||
// # Start typing the name of a public or private channel on this team that has been archived
|
||||
cy.findByRole('textbox', {name: 'quick switch input'}).type(testChannel.display_name);
|
||||
|
||||
// # Select an archived channel from the list
|
||||
cy.get('#suggestionList').should('be.visible');
|
||||
cy.findByTestId(testChannel.name).should('be.visible');
|
||||
cy.findByTestId(testChannel.name).click();
|
||||
|
||||
// * Channel name visible in header
|
||||
cy.get('#channelHeaderTitle').should('contain', testChannel.display_name);
|
||||
|
||||
// * Archived icon is visible in header
|
||||
cy.get('#channelHeaderInfo .icon-archive-outline').should('be.visible');
|
||||
|
||||
// * Channel is listed In drawer
|
||||
cy.get(`#sidebarItem_${testChannel.name}`).should('be.visible');
|
||||
cy.get(`#sidebarItem_${testChannel.name} .icon-archive-outline`).should('be.visible');
|
||||
|
||||
// * footer shows you are viewing an archived channel
|
||||
cy.get('#channelArchivedMessage').should('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T1679 Open an archived channel using jump from search results', () => {
|
||||
// # Create or locate post in an archived channel where the test user had permissions to edit channel details
|
||||
// generate a sufficiently large set of messages to make the toast appear
|
||||
const messageList = Array.from({length: 40}, (_, i) => `${i}. any - ${getRandomId()}`);
|
||||
createArchivedChannel({prefix: 'archived-search-for'}, messageList).then(({name}) => {
|
||||
// # Locate the post in a search
|
||||
cy.get('#searchBox').click().clear().type(`${messageList[1]}{enter}`);
|
||||
|
||||
// # Click jump to open an archive post in permalink view
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
cy.get('a.search-item__jump').first().click();
|
||||
|
||||
// * Archived channel is opened in permalink view
|
||||
cy.get('.post--highlight').should('be.visible');
|
||||
|
||||
// # Click on You are viewing an archived channel.
|
||||
cy.get('.toast__jump').should('be.visible').click();
|
||||
|
||||
// * Channel is listed In drawer
|
||||
// * Channel name visible in header
|
||||
cy.get(`#sidebarItem_${name}`).should('be.visible');
|
||||
cy.get(`#sidebarItem_${name} .icon-archive-outline`).should('be.visible');
|
||||
|
||||
// * Archived icon is visible in header
|
||||
cy.get('#channelHeaderInfo .icon-archive-outline').should('be.visible');
|
||||
|
||||
// * Footer shows "You are viewing an archived channel. New messages cannot be posted. Close Channel"
|
||||
cy.get('#channelArchivedMessage').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,185 @@
|
||||
// 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: @channels @channel
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Leave an archived channel', () => {
|
||||
let testTeam;
|
||||
let testUser;
|
||||
let otherUser;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit test channel
|
||||
cy.apiInitSetup({
|
||||
loginAfter: true,
|
||||
promoteNewUserAsAdmin: true,
|
||||
}).then(({team, user}) => {
|
||||
testTeam = team;
|
||||
testUser = user;
|
||||
|
||||
cy.apiCreateUser({prefix: 'second'}).then(({user: second}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, second.id);
|
||||
otherUser = second;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1670 Can view channel info for an archived channel', () => {
|
||||
cy.apiCreateArchivedChannel('archived-a', 'Archived A', 'O', testTeam.id).then((channel) => {
|
||||
// # Visit the archived channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Open channel menu and click View Info
|
||||
cy.uiOpenChannelMenu('View Info');
|
||||
|
||||
// * Channel title is shown with archived icon
|
||||
cy.get('.sidebar--right__header i.icon-archive-outline').should('be.visible');
|
||||
cy.contains('.sidebar--right__header', `${channel.display_name}`).should('be.visible');
|
||||
|
||||
// * Channel URL is listed (non-linked text)
|
||||
cy.url().then((loc) => {
|
||||
cy.contains('div[class^="ChannelLink"]', loc).should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1671 Can view members', () => {
|
||||
cy.apiCreateChannel(testTeam.id, 'archived-b', 'Archived B').then(({channel}) => {
|
||||
cy.apiAddUserToChannel(channel.id, otherUser.id);
|
||||
|
||||
// # Archive the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Open channel menu and click View Members
|
||||
cy.uiOpenChannelMenu('View Members');
|
||||
|
||||
// * Channel Members modal opens
|
||||
cy.get('div#channelMembersModal').should('be.visible');
|
||||
|
||||
// # Ensure there are no options to change channel roles or membership
|
||||
// * Membership or role cannot be changed
|
||||
cy.findAllByTestId('userListItemActions').eq(0).should('not.be.visible');
|
||||
cy.findAllByTestId('userListItemActions').eq(1).should('not.be.visible');
|
||||
|
||||
// # Use search box to refine list of members
|
||||
// * Search box works as before to refine member list
|
||||
cy.get('#searchUsersInput').type(`${otherUser.first_name.substring(0, 5)}{enter}`);
|
||||
cy.findAllByTestId('userListItemDetails').should('have.length', 2);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1673 Close channel after viewing two archived channels in a row', () => {
|
||||
// # Create an archived channel and post a message
|
||||
const messageC = 'archived channel C message';
|
||||
cy.apiCreateArchivedChannel('archived-c', 'Archived C', 'O', testTeam.id, [messageC], testUser).then((archivedChannelC) => {
|
||||
// # Create another archived channel and post a message
|
||||
const messageD = 'archived channel D message';
|
||||
cy.apiCreateArchivedChannel('archived-d', 'Archived D', 'O', testTeam.id, [messageD], testUser).then((archivedChannelD) => {
|
||||
// # Visit town-square and post a message
|
||||
const previousChannel = `/${testTeam.name}/channels/town-square`;
|
||||
cy.visit(previousChannel);
|
||||
|
||||
// # Search for content from an archived channel
|
||||
cy.get('#searchBox').click().clear().type(`${messageD}{enter}`);
|
||||
|
||||
// # Open the channel from search results
|
||||
cy.get('#searchContainer').should('be.visible');
|
||||
cy.get('#loadingSpinner').should('not.exist');
|
||||
|
||||
// # Open the channel from search result by clicking Jump
|
||||
cy.get('#searchContainer').should('be.visible').findByText('Jump').click().wait(TIMEOUTS.ONE_SEC);
|
||||
cy.url().should('contain', `${testTeam.name}/channels/${archivedChannelD.name}`);
|
||||
|
||||
// # Search for content from a different archived channel
|
||||
cy.get('#searchBox').click().clear().type(`${messageC}{enter}`);
|
||||
|
||||
// # Open the channel from search result by clicking Jump
|
||||
cy.get('#searchContainer').should('be.visible').findByText('Jump').click().wait(TIMEOUTS.ONE_SEC);
|
||||
cy.url().should('contain', `${testTeam.name}/channels/${archivedChannelC.name}`);
|
||||
|
||||
// # Select "Close Channel"
|
||||
cy.findByRole('button', {name: 'Close Channel'}).click();
|
||||
|
||||
// * User is returned to previously viewed (non-archived) channel
|
||||
cy.url().should('include', previousChannel);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1674 CTRL/CMD+K list public archived channels you are a member of', () => {
|
||||
const commonName = `common${getRandomId()}`;
|
||||
cy.apiCreateChannel(testTeam.id, `${commonName}-a`, commonName).then(({channel}) => {
|
||||
// # Create a public channel then archived
|
||||
cy.apiCreateArchivedChannel(`${commonName}-b-archived`, `${commonName} Archived E`, 'O', testTeam.id, ['any message'], testUser).then((archivedChannel) => {
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// # Select CTRL/⌘+k) to open the channel switcher
|
||||
cy.typeCmdOrCtrl().type('K', {release: true});
|
||||
|
||||
// # Start typing the name of a public channel on this team that has been archived which the test user belongs to
|
||||
cy.findByRole('textbox', {name: 'quick switch input'}).type(commonName);
|
||||
|
||||
// * Suggestion list should be visible and have three elements (the two channels and the divider)
|
||||
cy.get('#suggestionList').should('be.visible').children().should('have.length', 3);
|
||||
|
||||
// * Both active and archived public channels should be visible
|
||||
cy.findByTestId(channel.name).should('be.visible').find('.icon-globe').should('be.visible');
|
||||
cy.findByTestId(archivedChannel.name).should('be.visible').find('.icon-archive-outline').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1675 CTRL/CMD+K list private archived channels you are a member of', () => {
|
||||
const commonName = `common${getRandomId()}`;
|
||||
cy.apiCreateChannel(testTeam.id, `${commonName}-a`, commonName).then(({channel}) => {
|
||||
// # Create a private channel then archived
|
||||
cy.apiCreateArchivedChannel(`${commonName}-b-archived`, `${commonName} Archived F`, 'P', testTeam.id, ['any message'], testUser).then((archivedChannel) => {
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// # Select CTRL/⌘+k) to open the channel switcher
|
||||
cy.typeCmdOrCtrl().type('K', {release: true});
|
||||
|
||||
// # Start typing the name of a private channel on this team that has been archived which the test user belongs to
|
||||
cy.findByRole('textbox', {name: 'quick switch input'}).type(commonName);
|
||||
|
||||
// * Suggestion list should be visible and have three elements (the two channels and the divider)
|
||||
cy.get('#suggestionList').should('be.visible').children().should('have.length', 3);
|
||||
|
||||
// * Both active public and archived private channels should be visible
|
||||
cy.findByTestId(channel.name).should('be.visible').find('.icon-globe').should('be.visible');
|
||||
cy.findByTestId(archivedChannel.name).should('be.visible').find('.icon-archive-outline').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1676 CTRL/CMD+K does not show private archived channels you are not a member of', () => {
|
||||
// # As another user, create or locate a private channel that the test user is not a member of and archive the channel
|
||||
cy.apiLogin(otherUser);
|
||||
cy.apiCreateArchivedChannel('archived-g', 'Archived G', 'O', testTeam.id, ['any message'], testUser).then((archivedChannel) => {
|
||||
// # As the test user, select CTRL/CMD+K (or ⌘+k) to open the channel switcher
|
||||
cy.apiLogin(testUser);
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
cy.contains('#channelHeaderTitle', 'Off-Topic');
|
||||
cy.typeCmdOrCtrl().type('K', {release: true});
|
||||
|
||||
// * Private archived channels you are not a member of are not available on channel switcher
|
||||
cy.contains('#suggestionList', archivedChannel.name).should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
export function createArchivedChannel(channelOptions, messages, memberUsernames?) {
|
||||
return cy.uiCreateChannel(channelOptions).then((newChannel) => {
|
||||
if (memberUsernames) {
|
||||
cy.uiAddUsersToCurrentChannel(memberUsernames);
|
||||
}
|
||||
|
||||
if (messages) {
|
||||
let messageList = messages;
|
||||
if (!Array.isArray(messages)) {
|
||||
messageList = [messages];
|
||||
}
|
||||
messageList.forEach((message) => {
|
||||
cy.postMessage(message);
|
||||
});
|
||||
}
|
||||
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Wait for sometime and verify that the archived message is shown
|
||||
cy.wait(TIMEOUTS.FIVE_SEC);
|
||||
cy.get('#channelArchivedMessage', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
|
||||
return cy.wrap({name: newChannel.name});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// 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 @channel
|
||||
|
||||
import {getAdminAccount} from '../../../support/env';
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Archived channels', () => {
|
||||
let testTeam;
|
||||
let testUser;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testTeam = team;
|
||||
testUser = user;
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1682 Join an archived public channel by selecting a permalink to one of its posts', () => {
|
||||
// # Log in as another user
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Create a new channel
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel').then(({channel}) => {
|
||||
// # Make a post in the new channel and get a permalink for it
|
||||
cy.postMessageAs({
|
||||
sender: getAdminAccount(),
|
||||
message: 'post',
|
||||
channelId: channel.id,
|
||||
}).then((post) => {
|
||||
const permalink = `/${testTeam.name}/pl/${post.id}`;
|
||||
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Log out and back in as the test user
|
||||
cy.apiLogin(testUser);
|
||||
|
||||
// # Visit the permalink
|
||||
cy.visit(permalink);
|
||||
|
||||
// * Verify that we've logged in as the test user
|
||||
verifyUsername(testUser.username);
|
||||
|
||||
verifyViewingArchivedChannel(channel);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1683 Join an archived channel by selecting a link to channel', () => {
|
||||
// # Log in as another user
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Create a new channel
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel').then(({channel}) => {
|
||||
const channelLink = `/${testTeam.name}/channels/${channel.name}`;
|
||||
|
||||
// # Visit the channel and archive it
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Visit off-topic
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// # Make a post linking to the archived channel
|
||||
const linkText = `link ${getRandomId()}`;
|
||||
cy.getCurrentChannelId().then((currentChannelId) => {
|
||||
cy.postMessageAs({
|
||||
sender: getAdminAccount(),
|
||||
message: `This is a link: [${linkText}](${channelLink})`,
|
||||
channelId: currentChannelId,
|
||||
});
|
||||
});
|
||||
|
||||
// # Log out and back in as the test user
|
||||
cy.apiLogin(testUser);
|
||||
|
||||
// # Visit off-topic
|
||||
cy.visit(`/${testTeam.name}/channels/off-topic`);
|
||||
|
||||
// * Verify that we've logged in as the test user
|
||||
verifyUsername(testUser.username);
|
||||
|
||||
// * Verify that the link exists and then click on it
|
||||
cy.contains('a', linkText).should('be.visible').click();
|
||||
|
||||
verifyViewingArchivedChannel(channel);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function verifyViewingArchivedChannel(channel) {
|
||||
// * Verify that we've switched to the correct channel and that the header contains the archived icon
|
||||
cy.get('#channelHeaderTitle').should('contain', channel.display_name);
|
||||
cy.get('#channelHeaderInfo .icon__archive').should('be.visible');
|
||||
|
||||
// * Verify that the channel is visible in the sidebar with the archived icon
|
||||
cy.get(`#sidebarItem_${channel.name}`).should('be.visible').
|
||||
find('.icon-archive-outline').should('be.visible');
|
||||
|
||||
// * Verify that the archived channel banner is visible at the bottom of the channel view
|
||||
cy.get('#channelArchivedMessage').should('be.visible');
|
||||
}
|
||||
|
||||
function verifyUsername(username) {
|
||||
// * Verify that we've logged in as the test user
|
||||
cy.uiOpenUserMenu().findByText(`@${username}`);
|
||||
|
||||
// # Close the user menu
|
||||
cy.uiGetSetStatusButton().click();
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// 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 @channel
|
||||
|
||||
describe('Leaving archived channels', () => {
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team}) => {
|
||||
testTeam = team;
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1685 User can leave archived public channel', () => {
|
||||
// # Create a new public channel
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Leave the channel
|
||||
cy.uiLeaveChannel();
|
||||
|
||||
// * Verify that we've switched to Town Square
|
||||
cy.url().should('include', '/channels/town-square');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1686 User can leave archived private channel', () => {
|
||||
// # Create a new private channel
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel', 'P').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Leave the channel
|
||||
cy.uiLeaveChannel(true);
|
||||
|
||||
// * Verify that we've switched to Town Square
|
||||
cy.url().should('include', '/channels/town-square');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
// 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 @channel
|
||||
|
||||
describe('Archived channels', () => {
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit created channel
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => {
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1721 Archive channel posts menu should have copy link and reply options', () => {
|
||||
// # Click to add a channel description
|
||||
cy.findByRoleExtended('button', {name: 'Add a channel header'}).should('be.visible').click();
|
||||
|
||||
// # Add channel header for system message
|
||||
const header = 'this is a header!';
|
||||
cy.get('#editChannelHeaderModalLabel').should('be.visible');
|
||||
cy.get('textarea#edit_textbox').should('be.visible').type(`${header}{enter}`);
|
||||
|
||||
cy.getLastPostId().then((postId) => {
|
||||
// * Check post if it is the system message
|
||||
cy.get(`#postMessageText_${postId}`).should('contain', header);
|
||||
cy.clickPostDotMenu(postId).then(() => {
|
||||
// * Copy link menu item should not be visible
|
||||
cy.findByText('Copy Link').should('not.exist');
|
||||
|
||||
// * Reply post menu item should not be visible
|
||||
cy.findByText('Reply').should('not.exist');
|
||||
cy.get(`#CENTER_dropdown_${postId}`).should('be.visible').type('{esc}');
|
||||
});
|
||||
});
|
||||
|
||||
const messageText = 'Test archive channel post menu';
|
||||
|
||||
// # Post a message in the channel
|
||||
cy.postMessage(messageText);
|
||||
|
||||
// # Get the last post for reference of ID
|
||||
cy.getLastPostId().then((postId) => {
|
||||
// # Archive the channel
|
||||
cy.uiArchiveChannel();
|
||||
|
||||
// # Wait until a system message is posted that the channel has been archived
|
||||
cy.uiWaitUntilMessagePostedIncludes('archived the channel');
|
||||
|
||||
// # Click on post dot menu
|
||||
cy.clickPostDotMenu(postId);
|
||||
|
||||
// * Copy link menu item should be visible
|
||||
cy.findByText('Copy Link').scrollIntoView().should('be.visible');
|
||||
|
||||
// * Reply post menu item should be visible
|
||||
cy.findByText('Reply').should('be.visible');
|
||||
cy.get(`#CENTER_dropdown_${postId}`).should('be.visible').type('{esc}');
|
||||
});
|
||||
});
|
||||
});
|
||||
Ссылка в новой задаче
Block a user