Move /e2e -> /e2e-tests
Этот коммит содержится в:
@@ -0,0 +1,345 @@
|
||||
// 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 @enterprise @system_console @group_mentions
|
||||
|
||||
import ldapUsers from '../../../../fixtures/ldap_users.json';
|
||||
import * as TIMEOUTS from '../../../../fixtures/timeouts';
|
||||
|
||||
import {
|
||||
disablePermission,
|
||||
enablePermission,
|
||||
} from '../system_console/channel_moderation/helpers';
|
||||
|
||||
import {enableGroupMention} from './helpers';
|
||||
|
||||
describe('Group Mentions', () => {
|
||||
let groupID;
|
||||
let boardUser;
|
||||
let regularUser;
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
// * Check if server has license for LDAP Groups
|
||||
cy.apiRequireLicenseForFeature('LDAPGroups');
|
||||
|
||||
// # Enable GuestAccountSettings
|
||||
cy.apiUpdateConfig({
|
||||
GuestAccountsSettings: {
|
||||
Enable: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
regularUser = user;
|
||||
testTeam = team;
|
||||
});
|
||||
|
||||
// # Test LDAP configuration and server connection
|
||||
// # Synchronize user attributes
|
||||
cy.apiLDAPTest();
|
||||
cy.apiLDAPSync();
|
||||
|
||||
// # Link the LDAP Group - board
|
||||
cy.visit('/admin_console/user_management/groups');
|
||||
cy.get('#board_group', {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
|
||||
if (!el.text().includes('Edit')) {
|
||||
// # Link the Group if its not linked before
|
||||
if (el.find('.icon.fa-unlink').length > 0) {
|
||||
el.find('.icon.fa-unlink').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// # Get board group id
|
||||
cy.apiGetGroups().then((res) => {
|
||||
res.body.forEach((group) => {
|
||||
if (group.display_name === 'board') {
|
||||
// # Set groupID to navigate to group page directly
|
||||
groupID = group.id;
|
||||
|
||||
// # Set allow reference false to ensure correct data for test cases
|
||||
cy.apiPatchGroup(groupID, {allow_reference: false});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// # Login once as board user to ensure the user is created in the system
|
||||
boardUser = ldapUsers['board-1'];
|
||||
cy.apiLogin(boardUser);
|
||||
|
||||
// # Login as sysadmin
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Add board user to test team to ensure that it exists in the team and set its preferences to skip tutorial step
|
||||
cy.apiGetUserByEmail(boardUser.email).then(({user}) => {
|
||||
cy.apiGetChannelByName(testTeam.name, 'town-square').then(({channel}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
});
|
||||
|
||||
cy.apiSaveTutorialStep(user.id, '999');
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
// # Login as sysadmin and navigate to system scheme page
|
||||
cy.apiAdminLogin();
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
|
||||
// # Click reset to defaults and confirm
|
||||
cy.findByTestId('resetPermissionsToDefault').click();
|
||||
cy.get('#confirmModalButton').click();
|
||||
|
||||
// # Save
|
||||
cy.uiSaveConfig();
|
||||
});
|
||||
|
||||
it('MM-T2450 - Group Mentions when user is a Channel Admin', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Disable Group Mentions for All Users & Channel Admins
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
disablePermission('all_users-posts-use_group_mentions-checkbox');
|
||||
disablePermission('channel_admin-posts-use_group_mentions-checkbox');
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
|
||||
// # Create a new channel so that regular user can be channel admin
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Type the Group Name
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is not displayed
|
||||
cy.get('#suggestionList').should('not.exist');
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} hello`);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName}`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
|
||||
// * Verify that the group mention does not has blue colored text
|
||||
cy.get(`#postMessageText_${postId}`).find('.group-mention-link').should('not.exist');
|
||||
});
|
||||
|
||||
// # Enable Group Mentions for Channel Admins
|
||||
cy.apiAdminLogin();
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
enablePermission('channel_admin-posts-use_group_mentions-checkbox');
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// # Login as a regular user and visit the channel
|
||||
cy.apiLogin(regularUser);
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Type the Group Name
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is displayed
|
||||
cy.get('#suggestionList').should('be.visible').children().within((el) => {
|
||||
cy.wrap(el).eq(0).should('contain', 'Group Mentions');
|
||||
cy.wrap(el).eq(1).should('contain', groupName);
|
||||
});
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} hello`);
|
||||
|
||||
// * Verify if a system message is displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${boardUser.username} did not get notified by this mention because they are not in the channel. Would you like to add them to the channel? They will have access to all message history.`);
|
||||
|
||||
// * Verify if an option should be given to add them to channel
|
||||
cy.get('a.PostBody_addChannelMemberLink').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2451 - Group Mentions when user is a Team Admin', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Disable Group Mentions for All Users & Channel Admins & Team Admins
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
disablePermission('all_users-posts-use_group_mentions-checkbox');
|
||||
disablePermission('channel_admin-posts-use_group_mentions-checkbox');
|
||||
disablePermission('team_admin-posts-use_group_mentions-checkbox');
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
|
||||
// # Create a new team and channel so that regular user can be team admin
|
||||
cy.apiCreateTeam('team', 'Test NoMember').then(({team}) => {
|
||||
cy.apiCreateChannel(team.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
|
||||
// # Type the Group Name
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is not displayed
|
||||
cy.get('#suggestionList').should('not.exist');
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} hello`);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName}`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
|
||||
// * Verify that the group mention does not has blue colored text
|
||||
cy.get(`#postMessageText_${postId}`).find('.group-mention-link').should('not.exist');
|
||||
});
|
||||
|
||||
// # Enable Group Mentions for Team Admins
|
||||
cy.apiAdminLogin();
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
enablePermission('team_admin-posts-use_group_mentions-checkbox');
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// # Login as a regular user and visit the channel
|
||||
cy.apiLogin(regularUser);
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
|
||||
// # Type the Group Name
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is displayed
|
||||
cy.get('#suggestionList').should('be.visible').children().within((el) => {
|
||||
cy.wrap(el).eq(0).should('contain', 'Group Mentions');
|
||||
cy.wrap(el).eq(1).should('contain', groupName);
|
||||
});
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} hello`);
|
||||
|
||||
// * Verify if a system message is displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName} has no members on this team`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
|
||||
// * Verify that the group mention has blue colored text
|
||||
cy.get(`#postMessageText_${postId}`).find('.group-mention-link').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2452 - Group Mentions when user is a Guest User', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Verify that group mentions for all users & guests are disabled
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
cy.findByTestId('all_users-posts-use_group_mentions-checkbox').should('not.have.class', 'checked');
|
||||
cy.findByTestId('guests-guest_use_group_mentions-checkbox').should('not.have.class', 'checked');
|
||||
|
||||
// # Create a new channel as a sysadmin
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
cy.apiCreateUser().then(({user}) => { // eslint-disable-line
|
||||
// # Add user to the team and channel
|
||||
cy.apiAddUserToTeam(testTeam.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
|
||||
// # Demote the user as a guest user
|
||||
cy.apiDemoteUserToGuest(user.id);
|
||||
|
||||
// # Login as a guest user
|
||||
cy.apiLogin(user);
|
||||
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Type the Group Name
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is not displayed
|
||||
cy.get('#suggestionList').should('not.exist');
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} hello`);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName}`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
|
||||
// * Verify that the group mention does not has blue colored text
|
||||
cy.get(`#postMessageText_${postId}`).find('.group-mention-link').should('not.exist');
|
||||
});
|
||||
|
||||
// # Login as sysadmin and enable group mentions permission for guests
|
||||
cy.apiAdminLogin();
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
enablePermission('guests-guest_use_group_mentions-checkbox');
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// # Login as guest user again and visit the channel
|
||||
cy.apiLogin(user);
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Type the Group Name
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is displayed
|
||||
cy.get('#suggestionList').should('be.visible').children().within((el) => {
|
||||
cy.wrap(el).eq(0).should('contain', 'Group Mentions');
|
||||
cy.wrap(el).eq(1).should('contain', groupName);
|
||||
});
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} hello`);
|
||||
|
||||
// * Verify if a system message is displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${boardUser.username} did not get notified by this mention because they are not in the channel.`);
|
||||
|
||||
// * Verify that the option to add them to channel is not given
|
||||
cy.get('a.PostBody_addChannelMemberLink').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,288 @@
|
||||
// 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 @enterprise @system_console @group_mentions
|
||||
|
||||
import ldapUsers from '../../../../fixtures/ldap_users.json';
|
||||
import * as TIMEOUTS from '../../../../fixtures/timeouts';
|
||||
|
||||
import {enableGroupMention} from './helpers';
|
||||
|
||||
describe('Group Mentions', () => {
|
||||
let groupID1;
|
||||
let groupID2;
|
||||
let boardUser;
|
||||
let regularUser;
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
// * Check if server has license for LDAP Groups
|
||||
cy.apiRequireLicenseForFeature('LDAPGroups');
|
||||
|
||||
// # Enable GuestAccountSettings
|
||||
cy.apiUpdateConfig({
|
||||
GuestAccountsSettings: {
|
||||
Enable: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
regularUser = user;
|
||||
testTeam = team;
|
||||
});
|
||||
|
||||
// # Test LDAP configuration and server connection
|
||||
// # Synchronize user attributes
|
||||
cy.apiLDAPTest();
|
||||
cy.apiLDAPSync();
|
||||
|
||||
// # Link the LDAP Group - board
|
||||
cy.visit('/admin_console/user_management/groups');
|
||||
cy.get('#board_group', {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
|
||||
if (!el.text().includes('Edit')) {
|
||||
// # Link the Group if its not linked before
|
||||
if (el.find('.icon.fa-unlink').length > 0) {
|
||||
el.find('.icon.fa-unlink').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// # Link the LDAP Group - developers
|
||||
cy.visit('/admin_console/user_management/groups');
|
||||
cy.get('#developers_group', {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
|
||||
if (!el.text().includes('Edit')) {
|
||||
// # Link the Group if its not linked before
|
||||
if (el.find('.icon.fa-unlink').length > 0) {
|
||||
el.find('.icon.fa-unlink').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// # Get board group id
|
||||
cy.apiGetGroups().then((res) => {
|
||||
res.body.forEach((group) => {
|
||||
if (group.display_name === 'board') {
|
||||
// # Set groupID1 to navigate to group page directly
|
||||
groupID1 = group.id;
|
||||
|
||||
// # Set allow reference false to ensure correct data for test cases
|
||||
cy.apiPatchGroup(group.id, {allow_reference: false});
|
||||
}
|
||||
|
||||
if (group.display_name === 'developers') {
|
||||
// # Set groupID1 to navigate to group page directly
|
||||
groupID2 = group.id;
|
||||
|
||||
// # Set allow reference false to ensure correct data for test cases
|
||||
cy.apiPatchGroup(group.id, {allow_reference: false});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// # Login once as board user to ensure the user is created in the system
|
||||
boardUser = ldapUsers['board-1'];
|
||||
cy.apiLogin(boardUser);
|
||||
|
||||
// # Login as sysadmin
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Add board user to test team to ensure that it exists in the team and set its preferences to skip tutorial step
|
||||
cy.apiGetUserByEmail(boardUser.email).then(({user}) => {
|
||||
cy.apiGetChannelByName(testTeam.name, 'town-square').then(({channel}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
});
|
||||
|
||||
cy.apiSaveTutorialStep(user.id, '999');
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// # Login as sysadmin
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Enable Group Mention for the group - board
|
||||
cy.visit('/admin_console/user_management/groups');
|
||||
cy.get('#board_group', {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
|
||||
if (!el.text().includes('Edit')) {
|
||||
// # Link the Group if its not linked before
|
||||
if (el.find('.icon.fa-unlink').length > 0) {
|
||||
el.find('.icon.fa-unlink').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2447 - Group Mentions when group was unlinked', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID1);
|
||||
|
||||
// # Unlink the group
|
||||
cy.visit('/admin_console/user_management/groups');
|
||||
cy.get('#board_group', {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
|
||||
el.find('.icon.fa-link').click();
|
||||
});
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
|
||||
// # Create a new channel as a regular user
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Type the Group Name to check if Autocomplete dropdown is not displayed
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is not displayed
|
||||
cy.get('#suggestionList').should('not.exist');
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName}`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2460 - Group Mentions when used in Direct Message', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID1);
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Trigger DM with a user
|
||||
cy.uiAddDirectMessage().click();
|
||||
cy.get('.more-modal__row.clickable').first().click();
|
||||
cy.uiGetButton('Go').click();
|
||||
|
||||
// # Type the Group Name to check if Autocomplete dropdown is displayed
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is displayed
|
||||
cy.get('#suggestionList').should('be.visible').children().within((el) => {
|
||||
cy.wrap(el).eq(0).should('contain', 'Group Mentions');
|
||||
cy.wrap(el).eq(1).should('contain', groupName);
|
||||
});
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName}`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
|
||||
// * Verify that the group mention has blue colored text
|
||||
cy.get(`#postMessageText_${postId}`).find('.group-mention-link').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2461 - Group Mentions when used in Group Message', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID1);
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Trigger DM with couple of users
|
||||
cy.uiAddDirectMessage().click();
|
||||
cy.get('.more-modal__row.clickable').first().click();
|
||||
cy.uiGetButton('Go').click();
|
||||
|
||||
// # Type the Group Name to check if Autocomplete dropdown is displayed
|
||||
cy.uiGetPostTextBox().clear().type(`@${groupName}`).wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify if autocomplete dropdown is displayed
|
||||
cy.get('#suggestionList').should('be.visible').children().within((el) => {
|
||||
cy.wrap(el).eq(0).should('contain', 'Group Mentions');
|
||||
cy.wrap(el).eq(1).should('contain', groupName);
|
||||
});
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName}`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
|
||||
// * Verify that the group mention has blue colored text
|
||||
cy.get(`#postMessageText_${postId}`).find('.group-mention-link').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2443 - Group Mentions when Channel is Group Synced', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
const groupName2 = `developers_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID1);
|
||||
enableGroupMention(groupName2, groupID2);
|
||||
|
||||
// # Create a new channel as a regular user
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention-2', 'Group Mentions 2').then(({channel}) => {
|
||||
// # Link the group and the channel.
|
||||
cy.apiLinkGroupChannel(groupID1, channel.id);
|
||||
|
||||
cy.apiLogin({username: 'board.one', password: 'Password1'}).then(({user: boardOne}) => {
|
||||
cy.apiAddUserToChannel(channel.id, boardOne.id);
|
||||
|
||||
// # Make the channel private and group-synced.
|
||||
cy.apiPatchChannel(channel.id, {group_constrained: true, type: 'P'});
|
||||
|
||||
// # Login to create the dev user
|
||||
cy.apiLogin({username: 'dev.one', password: 'Password1'}).then(({user: devOne}) => {
|
||||
cy.apiAdminLogin();
|
||||
|
||||
cy.apiAddUserToTeam(testTeam.id, devOne.id);
|
||||
|
||||
cy.apiLogin({username: 'board.one', password: 'Password1'});
|
||||
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
cy.postMessage(`@${groupName2} `);
|
||||
|
||||
// * Verify if a system message is not displayed
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${groupName2}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,246 @@
|
||||
// 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 @enterprise @system_console @group_mentions
|
||||
|
||||
import ldapUsers from '../../../../fixtures/ldap_users.json';
|
||||
import * as TIMEOUTS from '../../../../fixtures/timeouts';
|
||||
|
||||
import {
|
||||
disablePermission,
|
||||
enablePermission,
|
||||
saveConfigForChannel,
|
||||
visitChannelConfigPage,
|
||||
} from '../system_console/channel_moderation/helpers';
|
||||
import {checkboxesTitleToIdMap} from '../system_console/channel_moderation/constants';
|
||||
|
||||
import {enableGroupMention} from './helpers';
|
||||
|
||||
describe('Group Mentions', () => {
|
||||
let groupID;
|
||||
let boardUser;
|
||||
let regularUser;
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
// * Check if server has license for LDAP Groups
|
||||
cy.apiRequireLicenseForFeature('LDAPGroups');
|
||||
|
||||
// # Enable GuestAccountSettings
|
||||
cy.apiUpdateConfig({
|
||||
GuestAccountsSettings: {
|
||||
Enable: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
regularUser = user;
|
||||
testTeam = team;
|
||||
});
|
||||
|
||||
// # Test LDAP configuration and server connection
|
||||
// # Synchronize user attributes
|
||||
cy.apiLDAPTest();
|
||||
cy.apiLDAPSync();
|
||||
|
||||
// # Link the group - board
|
||||
cy.visit('/admin_console/user_management/groups');
|
||||
cy.get('#board_group', {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
|
||||
if (!el.text().includes('Edit')) {
|
||||
// # Link the Group if its not linked before
|
||||
if (el.find('.icon.fa-unlink').length > 0) {
|
||||
el.find('.icon.fa-unlink').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// # Get board group id
|
||||
cy.apiGetGroups().then((res) => {
|
||||
res.body.forEach((group) => {
|
||||
if (group.display_name === 'board') {
|
||||
// # Set groupID to navigate to group page directly
|
||||
groupID = group.id;
|
||||
|
||||
// # Set allow reference false to ensure correct data for test cases
|
||||
cy.apiPatchGroup(groupID, {allow_reference: false});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// # Login once as board user to ensure the user is created in the system
|
||||
boardUser = ldapUsers['board-1'];
|
||||
cy.apiLogin(boardUser);
|
||||
|
||||
// # Login as sysadmin
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Add board user to test team to ensure that it exists in the team and set its preferences to skip tutorial step
|
||||
cy.apiGetUserByEmail(boardUser.email).then(({user}) => {
|
||||
cy.apiGetChannelByName(testTeam.name, 'town-square').then(({channel}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
});
|
||||
|
||||
cy.apiSaveTutorialStep(user.id, '999');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2456 - Group Mentions when group members are in the team but not in the channel', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
|
||||
// # Create a new channel as a regular user
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is displayed indicating that list of members were not notified
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).should('include.text', `@${boardUser.username} did not get notified by this mention because they are not in the channel. Would you like to add them to the channel? They will have access to all message history.`);
|
||||
|
||||
// * Verify if an option should be given to add them to channel
|
||||
cy.get('a.PostBody_addChannelMemberLink').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2457 - Group Mentions when group members are not in the team and the channel', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Create a new team and channel as a sysadmin
|
||||
cy.apiCreateTeam('team', 'Test NoMember').then(({team}) => {
|
||||
cy.apiCreateChannel(team.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
cy.apiCreateUser().then(({user}) => { // eslint-disable-line
|
||||
// # Add user to the team and channel
|
||||
cy.apiAddUserToTeam(team.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(user);
|
||||
|
||||
// # Visit the channel
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is displayed indicating that there are no members in this team
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).
|
||||
should('include.text', `@${groupName} has no members on this team`);
|
||||
|
||||
// * Verify that the group mention is not highlighted
|
||||
cy.get(`#postMessageText_${postId}`).find('.mention--highlight').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2458 - Group Mentions when group members are not in the channel as a Guest User', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Enable Group Mentions for Guest Users
|
||||
cy.visit('/admin_console/user_management/permissions/system_scheme');
|
||||
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('have.text', 'System Scheme');
|
||||
enablePermission('guests-guest_use_group_mentions-checkbox');
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// # Create a new channel as a sysadmin
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
cy.apiCreateUser().then(({user}) => { // eslint-disable-line
|
||||
// # Add user to the team and channel
|
||||
cy.apiAddUserToTeam(testTeam.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
|
||||
// # Demote the user as a guest user
|
||||
cy.apiDemoteUserToGuest(user.id);
|
||||
|
||||
// # Login as a guest user
|
||||
cy.apiLogin(user);
|
||||
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is displayed indicating that list of members were not notified
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).
|
||||
should('include.text', `@${boardUser.username} did not get notified by this mention because they are not in the channel.`);
|
||||
|
||||
// * Verify that the option to add them to channel is not given
|
||||
cy.get('a.PostBody_addChannelMemberLink').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2459 - Group Mentions when group members are not in the channel when Manage Members is disabled', () => {
|
||||
const groupName = `board_test_case_${Date.now()}`;
|
||||
|
||||
// # Login as sysadmin and enable group mention with the group name
|
||||
cy.apiAdminLogin();
|
||||
enableGroupMention(groupName, groupID, boardUser.email);
|
||||
|
||||
// # Create a new channel as a sysadmin
|
||||
cy.apiCreateChannel(testTeam.id, 'group-mention', 'Group Mentions').then(({channel}) => {
|
||||
// # Disable Manage Members permission for the channel
|
||||
visitChannelConfigPage(channel);
|
||||
disablePermission(checkboxesTitleToIdMap.MANAGE_MEMBERS_MEMBERS);
|
||||
saveConfigForChannel();
|
||||
|
||||
// # Add regular user to the channel
|
||||
cy.apiAddUserToChannel(channel.id, regularUser.id);
|
||||
|
||||
// # Login as a regular user
|
||||
cy.apiLogin(regularUser);
|
||||
|
||||
// # Visit the channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
cy.uiGetPostTextBox();
|
||||
|
||||
// # Submit a post containing the group mention
|
||||
cy.postMessage(`@${groupName} `);
|
||||
|
||||
// * Verify if a system message is displayed indicating that list of members were not notified
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#postMessageText_${postId}`).
|
||||
should('include.text', `@${boardUser.username} did not get notified by this mention because they are not in the channel.`);
|
||||
|
||||
// * Verify that the option to add them to channel is not given
|
||||
cy.get('a.PostBody_addChannelMemberLink').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import * as TIMEOUTS from '../../../../fixtures/timeouts';
|
||||
|
||||
export function enableGroupMention(groupName, groupID, userEmail) {
|
||||
// # Visit Group Configurations page
|
||||
cy.visit(`/admin_console/user_management/groups/${groupID}`);
|
||||
|
||||
// # Scroll users list into view and then make sure it has loaded before scrolling back to the top
|
||||
cy.get('#group_users', {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView();
|
||||
if (userEmail) {
|
||||
cy.findByText(userEmail).should('be.visible');
|
||||
}
|
||||
cy.get('#group_profile').scrollIntoView().wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// # Click the allow reference button
|
||||
cy.findByTestId('allowReferenceSwitch').then((el) => {
|
||||
const button = el.find('button');
|
||||
const classAttribute = button[0].getAttribute('class');
|
||||
if (!classAttribute.includes('active')) {
|
||||
button[0].click();
|
||||
}
|
||||
});
|
||||
|
||||
// # Give the group a custom name different from its DisplayName attribute
|
||||
cy.get('#groupMention').find('input').clear().type(groupName);
|
||||
|
||||
// # Click save button
|
||||
cy.uiSaveConfig();
|
||||
}
|
||||
Ссылка в новой задаче
Block a user