Этот коммит содержится в:
Mario Vitale
2023-03-27 16:28:42 +02:00
родитель da7a6825ce
Коммит ba6b97fb62
1142 изменённых файлов: 44 добавлений и 44 удалений

Просмотреть файл

@@ -0,0 +1,123 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {getAdminAccount} from '../../../../support/env';
import {
createPrivateChannel,
createPublicChannel,
enableElasticSearch,
searchAndVerifyChannel,
} from './helpers';
describe('Autocomplete with Elasticsearch - Channel', () => {
let testTeam;
let testUser;
before(() => {
cy.shouldNotRunOnCloudEdition();
// # Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
// # Enable Elasticsearch
enableElasticSearch();
// # Login as test user and go to town-square
cy.apiInitSetup({loginAfter: true}).then(({team, user}) => {
testUser = user;
testTeam = team;
});
});
beforeEach(() => {
// # Visit town-square channel
cy.visit(`/${testTeam.name}/channels/town-square`);
});
it('MM-T2510_1 Private channel I do belong to appears', () => {
// # Create private channel and add new user to it (sets @privateChannel alias)
createPrivateChannel(testTeam.id, testUser).then((channel) => {
// # Go to off-topic channel to partially reload the page
cy.uiGetLhsSection('CHANNELS').findByText('Off-Topic').click();
// * Private channel in suggestion list should appear
searchAndVerifyChannel(channel);
});
});
it("MM-T2510_2 Private channel I don't belong to does not appear", () => {
// # Create private channel, do not add new user to it (sets @privateChannel alias)
createPrivateChannel(testTeam.id).then((channel) => {
// # Go to off-topic channel to partially reload the page
cy.uiGetLhsSection('CHANNELS').findByText('Off-Topic').click();
// * Private channel should not appear on search
searchAndVerifyChannel(channel, false);
});
});
it('MM-T2510_3 Private channel left does not appear', () => {
// # Create private channel and add new user to it (sets @privateChannel alias)
createPrivateChannel(testTeam.id, testUser).then((channel) => {
// # Visit private channel
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
// # Leave private channel
cy.uiOpenChannelMenu('Leave Channel');
cy.findByRoleExtended('button', {name: 'Yes, leave channel'}).should('be.visible').click();
// # Go to off-topic channel to partially reload the page
cy.uiGetLhsSection('CHANNELS').findByText('Off-Topic').click();
// * Private channel should not appear on search
searchAndVerifyChannel(channel, false);
});
});
it('MM-T2510_4 Channel outside of team does not appear', () => {
const teamName = 'elastic-private-' + Date.now();
// # As admin, create a new team that the new user is not a member of
cy.externalRequest({
user: getAdminAccount(),
path: 'teams',
method: 'post',
data: {
name: teamName,
display_name: teamName,
type: 'O',
},
}).then(({data: team}) => {
// # Create a private channel where the new user is not a member of
createPrivateChannel(team.id).then((channel) => {
// # Go to off-topic channel to partially reload the page
cy.uiGetLhsSection('CHANNELS').findByText('Off-Topic').click();
// * Private channel should not appear on search
searchAndVerifyChannel(channel, false);
cy.uiClose();
});
return cy.wrap({team});
}).then(({team}) => {
// # Create a private channel where the new user is not a member of
createPublicChannel(team.id).then((publicChannel) => {
// # Go to off-topic channel to partially reload the page
cy.uiGetLhsSection('CHANNELS').findByText('Off-Topic').click();
// * Public channel should not appear on search
searchAndVerifyChannel(publicChannel, false);
});
});
});
});

Просмотреть файл

@@ -0,0 +1,86 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {
enableElasticSearch,
searchAndVerifyChannel,
} from './helpers';
describe('Autocomplete with Elasticsearch - Channel', () => {
let testChannel;
let teamName;
before(() => {
cy.shouldNotRunOnCloudEdition();
// * Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
// # Enable Elasticsearch
enableElasticSearch();
// # Login as test user
cy.apiInitSetup({loginAfter: true}).then(({team}) => {
teamName = team.name;
const name = 'hellothere';
cy.apiCreateChannel(team.id, name, name).then(({channel}) => {
testChannel = channel;
});
});
});
beforeEach(() => {
// # Visit off-topic channel
cy.visit(`/${teamName}/channels/off-topic`);
});
it('MM-T2517_1 Channels with dot returned in autocomplete suggestions', () => {
const name = 'hello.there';
// # Change the name of channel
cy.apiPatchChannel(testChannel.id, {display_name: name});
// * Search for channel should work
searchAndVerifyChannel({...testChannel, display_name: name});
});
it('MM-T2517_2 Channels with dash returned in autocomplete suggestions', () => {
const name = 'hello-there';
// # Change the name of channel
cy.apiPatchChannel(testChannel.id, {display_name: name});
// * Search for channel should work
searchAndVerifyChannel({...testChannel, display_name: name});
});
it('MM-T2517_3 Channels with underscore returned in autocomplete suggestions', () => {
const name = 'hello_there';
// # Change the name of channel
cy.apiPatchChannel(testChannel.id, {display_name: name});
// * Search for channel should work
searchAndVerifyChannel({...testChannel, display_name: name});
});
it('MM-T2517_4 Channels with dot, dash and underscore returned in autocomplete suggestions', () => {
const name = 'he.llo-the_re';
// # Change the name of channel
cy.apiPatchChannel(testChannel.id, {display_name: name});
// * Search for channel should work
searchAndVerifyChannel({...testChannel, display_name: name});
});
});

Просмотреть файл

@@ -0,0 +1,252 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../../../fixtures/timeouts';
import {getAdminAccount} from '../../../../../support/env';
const admin = getAdminAccount();
function withTimestamp(string, timestamp) {
return string + '-' + timestamp;
}
function createEmail(name, timestamp) {
return name + timestamp + '@sample.mattermost.com';
}
// Helper function to start @mention
function startAtMention(string) {
// # Get the expected input
cy.get('@input').clear().type(string);
// * Suggestion list should appear
cy.get('#suggestionList').should('be.visible');
}
function searchForChannel(name) {
// # Open up channel switcher
cy.typeCmdOrCtrl().type('k').wait(TIMEOUTS.ONE_SEC);
// # Clear out and type in the name
cy.findByRole('textbox', {name: 'quick switch input'}).
should('be.visible').
as('input').
clear().
type(name);
}
function createChannel(channelType, teamId, userToAdd = null) {
// # Create a channel as sysadmin
return cy.externalRequest({
user: admin,
method: 'POST',
path: 'channels',
data: {
team_id: teamId,
name: 'test-channel' + Date.now(),
display_name: 'Test Channel ' + Date.now(),
type: channelType,
header: '',
purpose: '',
},
}).then(({data: channel}) => {
if (userToAdd) {
// # Get user profile by email
return cy.apiGetUserByEmail(userToAdd.email).then(({user}) => {
// # Add user to team
cy.externalRequest({
user: admin,
method: 'post',
path: `channels/${channel.id}/members`,
data: {user_id: user.id},
}).then(() => {
// # Explicitly wait to give some time to index before searching
cy.wait(TIMEOUTS.TWO_SEC);
return cy.wrap(channel);
});
});
}
// # Explicitly wait to give some time to index before searching
cy.wait(TIMEOUTS.TWO_SEC);
return cy.wrap(channel);
});
}
export function createPrivateChannel(teamId, userToAdd = null) {
// # Create a private channel as sysadmin
return createChannel('P', teamId, userToAdd);
}
module.exports = {
withTimestamp,
createEmail,
startAtMention,
searchForChannel,
enableElasticSearch: () => {
// # Enable elastic search via the API
cy.apiUpdateConfig({
ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true,
EnableSearching: true,
Sniff: false,
},
});
// # Navigate to the elastic search setting page
cy.visit('/admin_console/environment/elasticsearch');
// * Test the connection and verify that we are successful
cy.contains('button', 'Test Connection').click();
cy.get('.alert-success').should('have.text', 'Test successful. Configuration saved.');
// # Index so we are up to date
cy.contains('button', 'Index Now').click();
// # Small wait to ensure new row is added
cy.wait(TIMEOUTS.ONE_SEC).get('.job-table__table').find('tbody > tr').eq(0).as('firstRow');
// * Newest row should eventually result in Success
const checkFirstRow = () => {
return cy.get('@firstRow').then((el) => {
return el.find('.status-icon-success').length > 0;
});
};
const options = {
timeout: TIMEOUTS.TWO_MIN,
interval: TIMEOUTS.TWO_SEC,
errorMsg: 'Reindex did not succeed in time',
};
cy.waitUntil(checkFirstRow, options);
},
getTestUsers: () => {
// Reverse the timestamp so that on search,
// the newly created user will get on the list first.
const reverseTimeStamp = (20 * Math.pow(10, 13)) - Date.now();
return {
ironman: {
username: withTimestamp('ironman', reverseTimeStamp),
password: 'passwd',
first_name: 'Tony',
last_name: 'Stark',
email: createEmail('ironman', reverseTimeStamp),
nickname: withTimestamp('protoncannon', reverseTimeStamp),
},
hulk: {
username: withTimestamp('hulk', reverseTimeStamp),
password: 'passwd',
first_name: 'Bruce',
last_name: 'Banner',
email: createEmail('hulk', reverseTimeStamp),
nickname: withTimestamp('gammaray', reverseTimeStamp),
},
hawkeye: {
username: withTimestamp('hawkeye', reverseTimeStamp),
password: 'passwd',
first_name: 'Clint',
last_name: 'Barton',
email: createEmail('hawkeye', reverseTimeStamp),
nickname: withTimestamp('ronin', reverseTimeStamp),
},
deadpool: {
username: withTimestamp('deadpool', reverseTimeStamp),
password: 'passwd',
first_name: 'Wade',
last_name: 'Wilson',
email: createEmail('deadpool', reverseTimeStamp),
nickname: withTimestamp('merc', reverseTimeStamp),
},
captainamerica: {
username: withTimestamp('captainamerica', reverseTimeStamp),
password: 'passwd',
first_name: 'Steve',
last_name: 'Rogers',
email: createEmail('captainamerica', reverseTimeStamp),
nickname: withTimestamp('professional', reverseTimeStamp),
},
doctorstrange: {
username: withTimestamp('doctorstrange', reverseTimeStamp),
password: 'passwd',
first_name: 'Stephen',
last_name: 'Strange',
email: createEmail('doctorstrange', reverseTimeStamp),
nickname: withTimestamp('sorcerersupreme', reverseTimeStamp),
},
thor: {
username: withTimestamp('thor', reverseTimeStamp),
password: 'passwd',
first_name: 'Thor',
last_name: 'Odinson',
email: createEmail('thor', reverseTimeStamp),
nickname: withTimestamp('mjolnir', reverseTimeStamp),
},
loki: {
username: withTimestamp('loki', reverseTimeStamp),
password: 'passwd',
first_name: 'Loki',
last_name: 'Odinson',
email: createEmail('loki', reverseTimeStamp),
nickname: withTimestamp('trickster', reverseTimeStamp),
},
dot: {
username: withTimestamp('dot.dot', reverseTimeStamp),
password: 'passwd',
first_name: 'z1First',
last_name: 'z1Last',
email: createEmail('dot', reverseTimeStamp),
nickname: 'z1Nick',
},
dash: {
username: withTimestamp('dash-dash', reverseTimeStamp),
password: 'passwd',
first_name: 'z2First',
last_name: 'z2Last',
email: createEmail('dash', reverseTimeStamp),
nickname: 'z2Nick',
},
underscore: {
username: withTimestamp('under_score', reverseTimeStamp),
password: 'passwd',
first_name: 'z3First',
last_name: 'z3Last',
email: createEmail('underscore', reverseTimeStamp),
nickname: 'z3Nick',
},
};
},
createPrivateChannel: (teamId, userToAdd = null) => {
// # Create a private channel as sysadmin
return createChannel('P', teamId, userToAdd);
},
createPublicChannel: (teamId, userToAdd = null) => {
// # Create a public channel as sysadmin
return createChannel('O', teamId, userToAdd);
},
searchAndVerifyChannel: (channel, shouldExist = true) => {
const name = channel.display_name;
searchForChannel(name);
if (shouldExist) {
// * Channel should appear in suggestions list
cy.get('#suggestionList').findByTestId(channel.name).should('be.visible');
} else {
// * Suggestion list and channel item should not appear
cy.get('#suggestionList').should('not.exist');
cy.findByTestId(channel.name).should('not.exist');
}
},
searchAndVerifyUser: (user) => {
// # Start @ mentions autocomplete with username
cy.uiGetPostTextBox().
as('input').
clear().
type(`@${user.username}`);
// * Suggestion list should appear
cy.get('#suggestionList', {timeout: TIMEOUTS.FIVE_SEC}).should('be.visible');
// * Verify user appears in results post-change
return cy.uiVerifyAtMentionSuggestion(user);
},
};

Просмотреть файл

@@ -0,0 +1,66 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {getRandomId} from '../../../../utils';
import {
enableElasticSearch,
searchAndVerifyChannel,
searchAndVerifyUser,
} from './helpers';
describe('Autocomplete with Elasticsearch - Renaming', () => {
let testUser;
let testChannel;
before(() => {
cy.shouldNotRunOnCloudEdition();
// * Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
cy.apiInitSetup().then(({team, channel, user}) => {
testUser = user;
testChannel = channel;
// # Enable Elasticsearch
enableElasticSearch();
// # Visit town-square channel
cy.visit(`/${team.name}/channels/town-square`);
});
});
it('MM-T2512 Change is reflected in the search when renaming a user', () => {
// # Verify user appears in search results before change
searchAndVerifyUser(testUser);
// # Rename a user
cy.apiPatchUser(testUser.id, {username: `newusername-${getRandomId()}`}).then(({user}) => {
// # Verify user appears in search results post-change
searchAndVerifyUser(user);
});
});
it('MM-T2513 Change is reflected in the search when renaming a channel', () => {
// # Verify channel appears in search results before change
searchAndVerifyChannel(testChannel);
// # Change the channels name
cy.apiPatchChannel(testChannel.id, {name: `newname-${getRandomId()}`}).then(({channel}) => {
cy.reload();
// # Search for channel and verify it appears
searchAndVerifyChannel(channel);
});
});
});

Просмотреть файл

@@ -0,0 +1,60 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {getRandomId} from '../../../../utils';
import {
enableElasticSearch,
searchAndVerifyChannel,
searchAndVerifyUser,
} from './helpers';
describe('Autocomplete with Elasticsearch - Renaming Team', () => {
const randomId = getRandomId();
let testUser;
let testChannel;
before(() => {
cy.shouldNotRunOnCloudEdition();
// * Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
cy.apiInitSetup().then(({team, channel, user}) => {
testUser = user;
testChannel = channel;
// # Enable Elasticsearch
enableElasticSearch();
cy.visit(`/${team.name}/channels/town-square`);
// # Verify user and channel appears in search results before change
searchAndVerifyUser(user);
searchAndVerifyChannel(channel);
// # Rename the team
cy.apiPatchTeam(team.id, {display_name: 'updatedteam' + randomId});
cy.visit(`/${team.name}/channels/town-square`);
});
});
it('MM-T2514_1 Renaming a Team does not affect user autocomplete suggestions', () => {
searchAndVerifyUser(testUser);
});
it('MM-T2514_2 Renaming a Team does not affect channel autocomplete suggestions', () => {
cy.get('body').type('{esc}');
searchAndVerifyChannel(testChannel);
});
});

Просмотреть файл

@@ -0,0 +1,93 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import * as TIMEOUTS from '../../../../fixtures/timeouts';
describe('Elasticsearch system console', () => {
before(() => {
cy.shouldNotRunOnCloudEdition();
// # Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
// # Enable Elasticsearch
cy.apiUpdateConfig({
ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true,
EnableSearching: true,
Sniff: false,
},
});
// # Visit the Elasticsearch settings page
cy.visit('/admin_console/environment/elasticsearch');
// * Verify that we can connect to Elasticsearch
cy.get('#testConfig').find('button').click();
cy.get('.alert-success').should('have.text', 'Test successful. Configuration saved.');
});
it('MM-T2519 can purge indexes', () => {
cy.get('#purgeIndexesSection').within(() => {
// # Click Purge Indexes button
cy.contains('button', 'Purge Indexes').click();
// * We should see a message saying we are successful
cy.get('.alert-success').should('have.text', 'Indexes purged successfully.');
});
});
it('MM-T2520 Can perform a bulk index', () => {
// # Click the Index Now button to start the index
cy.contains('button', 'Index Now').click();
// # Small wait to ensure new row is added
cy.wait(TIMEOUTS.HALF_SEC);
// # Get the first row
cy.get('.job-table__table').
find('tbody > tr').
eq(0).
as('firstRow');
// * First row update to say Success
cy.waitUntil(() => {
return cy.get('@firstRow').then((el) => {
return el.find('.status-icon-success').length > 0;
});
}
, {
timeout: TIMEOUTS.FIVE_MIN,
interval: TIMEOUTS.TWO_SEC,
errorMsg: 'Reindex did not succeed in time',
});
cy.get('@firstRow').
find('.status-icon-success').
should('be.visible').
and('have.text', 'Success');
});
it('MM-T2521 Elasticsearch for autocomplete queries can be disabled', () => {
// Check the false checkbox for enable autocomplete
cy.get('#enableAutocompletefalse').check().should('be.checked');
// # Save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.TWO_SEC);
// * Get config from API and verify that EnableAutocomplete setting is false
cy.apiGetConfig().then(({config}) => {
expect(config.ElasticsearchSettings.EnableAutocomplete).to.be.false;
});
});
});

Просмотреть файл

@@ -0,0 +1,115 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {getRandomLetter} from '../../../../utils';
import {doTestQuickChannelSwitcher} from '../../autocomplete/common_test';
import {createSearchData, enableElasticSearch} from '../../autocomplete/helpers';
describe('Autocomplete with Elasticsearch - Users', () => {
const prefix = getRandomLetter(3);
let testUsers;
before(() => {
cy.shouldNotRunOnCloudEdition();
// * Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
// # Enable Elasticsearch
enableElasticSearch();
createSearchData(prefix).then((searchData) => {
testUsers = searchData.users;
cy.apiLogin(searchData.sysadmin);
// # Navigate to the new teams town square
cy.visit(`/${searchData.team.name}/channels/town-square`);
// # Open quick channel switcher
cy.typeCmdOrCtrl().type('k');
cy.findByRole('textbox', {name: 'quick switch input'}).should('be.visible');
});
});
describe('search for user in channel switcher', () => {
describe('by @username', () => {
it('MM-T2506_1 Full username returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}ironman`, testUsers.ironman);
});
it('MM-T2506_2 Unique partial username returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}doc`, testUsers.doctorstrange);
});
it('MM-T2506_3 Partial username returns all users that match', () => {
doTestQuickChannelSwitcher(`@${prefix}i`, testUsers.ironman);
});
});
describe('by @firstname', () => {
it('MM-T3860_1 Full first name returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}tony`, testUsers.ironman);
});
it('MM-T3860_2 Unique partial first name returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}wa`, testUsers.deadpool);
});
it('MM-T3860_3 Partial first name returns all users that match', () => {
doTestQuickChannelSwitcher(`@${prefix}ste`, testUsers.captainamerica, testUsers.doctorstrange);
});
});
describe('by @lastname', () => {
it('MM-T3861_1 Full last name returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}stark`, testUsers.ironman);
});
it('MM-T3861_2 Unique partial last name returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}ban`, testUsers.hulk);
});
it('MM-T3861_3 Partial last name returns all users that match', () => {
doTestQuickChannelSwitcher(`@${prefix}ba`, testUsers.hawkeye, testUsers.hulk);
});
});
describe('by @nickname', () => {
it('MM-T3862_1 Full nickname returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}ronin`, testUsers.hawkeye);
});
it('MM-T3862_2 Unique partial nickname returns single user', () => {
doTestQuickChannelSwitcher(`@${prefix}gam`, testUsers.hulk);
});
it('MM-T3862_3 Partial nickname returns all users that match', () => {
doTestQuickChannelSwitcher(`@${prefix}pro`, testUsers.captainamerica, testUsers.ironman);
});
});
describe('special characters in usernames are returned', () => {
it('MM-T3856_1 Username with dot', () => {
doTestQuickChannelSwitcher(`@${prefix}dot.dot`, testUsers.dot);
});
it('MM-T3856_2 Username dash', () => {
doTestQuickChannelSwitcher(`@${prefix}dash-dash`, testUsers.dash);
});
it('MM-T3856_3 Username underscore', () => {
doTestQuickChannelSwitcher(`@${prefix}under_score`, testUsers.underscore);
});
});
});
});

Просмотреть файл

@@ -0,0 +1,111 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {getRandomLetter} from '../../../../utils';
import {doTestPostextbox} from '../../autocomplete/common_test';
import {createSearchData, enableElasticSearch} from '../../autocomplete/helpers';
describe('Autocomplete with Elasticsearch - Users', () => {
const prefix = getRandomLetter(3);
let testUsers;
before(() => {
cy.shouldNotRunOnCloudEdition();
// * Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
// # Enable Elasticsearch
enableElasticSearch();
createSearchData(prefix).then((searchData) => {
testUsers = searchData.users;
cy.apiLogin(searchData.sysadmin);
// # Navigate to the new teams town square
cy.visit(`/${searchData.team.name}/channels/town-square`);
});
});
describe('search for user in message input box', () => {
describe('by @username', () => {
it('MM-T2505_1 Full username returns single user', () => {
doTestPostextbox(`@${prefix}ironman`, testUsers.ironman);
});
it('MM-T2505_2 Unique partial username returns single user', () => {
doTestPostextbox(`@${prefix}doc`, testUsers.doctorstrange);
});
it('MM-T2505_3 Partial username returns all users that match', () => {
doTestPostextbox(`@${prefix}i`, testUsers.ironman);
});
});
describe('by @firstname', () => {
it('MM-T3857_1 Full first name returns single user', () => {
doTestPostextbox(`@${prefix}tony`, testUsers.ironman);
});
it('MM-T3857_2 Unique partial first name returns single user', () => {
doTestPostextbox(`@${prefix}wa`, testUsers.deadpool);
});
it('MM-T3857_3 Partial first name returns all users that match', () => {
doTestPostextbox(`@${prefix}ste`, testUsers.captainamerica, testUsers.doctorstrange);
});
});
describe('by @lastname', () => {
it('MM-T3858_1 Full last name returns single user', () => {
doTestPostextbox(`@${prefix}stark`, testUsers.ironman);
});
it('MM-T3858_2 Unique partial last name returns single user', () => {
doTestPostextbox(`@${prefix}ban`, testUsers.hulk);
});
it('MM-T3858_3 Partial last name returns all users that match', () => {
doTestPostextbox(`@${prefix}ba`, testUsers.hawkeye, testUsers.hulk);
});
});
describe('by @nickname', () => {
it('MM-T3859_1 Full nickname returns single user', () => {
doTestPostextbox(`@${prefix}ronin`, testUsers.hawkeye);
});
it('MM-T3859_2 Unique partial nickname returns single user', () => {
doTestPostextbox(`@${prefix}gam`, testUsers.hulk);
});
it('MM-T3859_3 Partial nickname returns all users that match', () => {
doTestPostextbox(`@${prefix}pro`, testUsers.captainamerica, testUsers.ironman);
});
});
describe('special characters in usernames are returned', () => {
it('MM-T2515_1 Username with dot', () => {
doTestPostextbox(`@${prefix}dot.dot`, testUsers.dot);
});
it('MM-T2515_2 Username with dash', () => {
doTestPostextbox(`@${prefix}dash-dash`, testUsers.dash);
});
it('MM-T2515_3 Username with underscore', () => {
doTestPostextbox(`@${prefix}under_score`, testUsers.underscore);
});
});
});
});

Просмотреть файл

@@ -0,0 +1,46 @@
// 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 @enterprise @elasticsearch @autocomplete @not_cloud
import {getRandomLetter} from '../../../../utils';
import {doTestDMChannelSidebar, doTestUserChannelSection} from '../../autocomplete/common_test';
import {createSearchData, enableElasticSearch} from '../../autocomplete/helpers';
describe('Autocomplete with Elasticsearch - Users', () => {
const prefix = getRandomLetter(3);
let testUsers;
let testTeam;
before(() => {
cy.shouldNotRunOnCloudEdition();
// * Check if server has license for Elasticsearch
cy.apiRequireLicenseForFeature('Elasticsearch');
// # Enable Elasticsearch
enableElasticSearch();
createSearchData(prefix).then((searchData) => {
testUsers = searchData.users;
testTeam = searchData.team;
cy.apiLogin(searchData.sysadmin);
});
});
it('MM-T3863 Users in correct in/out of channel sections', () => {
doTestUserChannelSection(prefix, testTeam, testUsers);
});
it('MM-T2518 DM can be opened with a user not on your team or in your DM channel sidebar', () => {
doTestDMChannelSidebar(testUsers);
});
});