snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 00:29:55 +05:00
commit 240db4e2a7
15309 changed files with 2173406 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
// 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 type {Team} from '@mattermost/types/teams';
import type {UserProfile} from '@mattermost/types/users';
import {
createPrivateChannel,
createPublicChannel,
enableElasticSearch,
searchAndVerifyChannel,
} from './helpers';
import {getAdminAccount} from '@/support/env';
describe('Autocomplete with Elasticsearch - Channel', () => {
let testTeam: Team;
let testUser: UserProfile;
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);
});
});
});
});

View File

@@ -0,0 +1,88 @@
// 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 type {Channel} from '@mattermost/types/channels';
import {
enableElasticSearch,
searchAndVerifyChannel,
} from './helpers';
describe('Autocomplete with Elasticsearch - Channel', () => {
let testChannel: Channel;
let teamName: string;
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});
});
});

View File

@@ -0,0 +1,246 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import type {Channel} from '@mattermost/types/channels';
import type {SimpleUser} from '../../autocomplete/helpers';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getAdminAccount} from '@/support/env';
import {newTestPassword} from '@/utils';
import type {ChainableT} from '@/types';
const admin = getAdminAccount();
export function withTimestamp(prefix: string, timestamp: number) {
return prefix + '-' + timestamp;
}
export function createEmail(name: string, timestamp: number) {
return name + timestamp + '@sample.mattermost.com';
}
// Helper function to start @mention
export function startAtMention(mention: string) {
// # Get the expected input
cy.get('@input').clear().type(mention);
// * Suggestion list should appear
cy.get('#suggestionList').should('be.visible');
}
export function searchForChannel(name: string) {
// # Open up channel switcher
cy.typeCmdOrCtrl().type('k').wait(TIMEOUTS.ONE_SEC);
// # Clear out and type in the name
cy.findByRole('combobox', {name: 'quick switch input'}).
should('be.visible').
as('input').
clear().
type(name);
}
function createChannel(channelType: string, teamId: string, userToAdd: {email: string} | null = null): ChainableT<Channel> {
// # 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 channel
return cy.externalAddUserToChannel(user.id, channel.id).then(() => {
// # Explicitly wait to give some time to index before searching
cy.wait(TIMEOUTS.TWO_SEC);
return cy.wrap<Channel>(channel);
});
});
}
// # Explicitly wait to give some time to index before searching
cy.wait(TIMEOUTS.TWO_SEC);
return cy.wrap<Channel>(channel);
});
}
export function enableElasticSearch() {
// # Enable elastic search via the API
cy.apiUpdateConfig({
ElasticsearchSettings: {
EnableIndexing: true,
EnableSearching: true,
},
});
// # Navigate to the elastic search setting page
cy.visit('/admin_console/environment/elasticsearch');
cy.get('#enableIndexingtrue').click();
// * 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);
}
export function getTestUsers(): Record<string, SimpleUser> {
// 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: newTestPassword(),
first_name: 'Tony',
last_name: 'Stark',
email: createEmail('ironman', reverseTimeStamp),
nickname: withTimestamp('protoncannon', reverseTimeStamp),
},
hulk: {
username: withTimestamp('hulk', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Bruce',
last_name: 'Banner',
email: createEmail('hulk', reverseTimeStamp),
nickname: withTimestamp('gammaray', reverseTimeStamp),
},
hawkeye: {
username: withTimestamp('hawkeye', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Clint',
last_name: 'Barton',
email: createEmail('hawkeye', reverseTimeStamp),
nickname: withTimestamp('ronin', reverseTimeStamp),
},
deadpool: {
username: withTimestamp('deadpool', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Wade',
last_name: 'Wilson',
email: createEmail('deadpool', reverseTimeStamp),
nickname: withTimestamp('merc', reverseTimeStamp),
},
captainamerica: {
username: withTimestamp('captainamerica', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Steve',
last_name: 'Rogers',
email: createEmail('captainamerica', reverseTimeStamp),
nickname: withTimestamp('professional', reverseTimeStamp),
},
doctorstrange: {
username: withTimestamp('doctorstrange', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Stephen',
last_name: 'Strange',
email: createEmail('doctorstrange', reverseTimeStamp),
nickname: withTimestamp('sorcerersupreme', reverseTimeStamp),
},
thor: {
username: withTimestamp('thor', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Thor',
last_name: 'Odinson',
email: createEmail('thor', reverseTimeStamp),
nickname: withTimestamp('mjolnir', reverseTimeStamp),
},
loki: {
username: withTimestamp('loki', reverseTimeStamp),
password: newTestPassword(),
first_name: 'Loki',
last_name: 'Odinson',
email: createEmail('loki', reverseTimeStamp),
nickname: withTimestamp('trickster', reverseTimeStamp),
},
dot: {
username: withTimestamp('dot.dot', reverseTimeStamp),
password: newTestPassword(),
first_name: 'z1First',
last_name: 'z1Last',
email: createEmail('dot', reverseTimeStamp),
nickname: 'z1Nick',
},
dash: {
username: withTimestamp('dash-dash', reverseTimeStamp),
password: newTestPassword(),
first_name: 'z2First',
last_name: 'z2Last',
email: createEmail('dash', reverseTimeStamp),
nickname: 'z2Nick',
},
underscore: {
username: withTimestamp('under_score', reverseTimeStamp),
password: newTestPassword(),
first_name: 'z3First',
last_name: 'z3Last',
email: createEmail('underscore', reverseTimeStamp),
nickname: 'z3Nick',
},
};
}
export function createPrivateChannel(teamId: string, userToAdd: {email: string} | null = null) {
// # Create a private channel as sysadmin
return createChannel('P', teamId, userToAdd);
}
export function createPublicChannel(teamId: string, userToAdd: {email: string} | null = null) {
// # Create a public channel as sysadmin
return createChannel('O', teamId, userToAdd);
}
export function searchAndVerifyChannel(channel: Cypress.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');
}
}
export function searchAndVerifyUser(user: Cypress.UserProfile) {
// # 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);
}

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************
// Stage: @prod
// Group: @channels @enterprise @elasticsearch @autocomplete @not_cloud
import type {Channel} from '@mattermost/types/channels';
import type {UserProfile} from '@mattermost/types/users';
import {
enableElasticSearch,
searchAndVerifyChannel,
searchAndVerifyUser,
} from './helpers';
import {getRandomId} from '@/utils';
describe('Autocomplete with Elasticsearch - Renaming', () => {
let testUser: UserProfile;
let testChannel: Channel;
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()}`} as UserProfile).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);
});
});
});

View File

@@ -0,0 +1,63 @@
// 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 type {Channel} from '@mattermost/types/channels';
import type {UserProfile} from '@mattermost/types/users';
import {
enableElasticSearch,
searchAndVerifyChannel,
searchAndVerifyUser,
} from './helpers';
import {getRandomId} from '@/utils';
describe('Autocomplete with Elasticsearch - Renaming Team', () => {
const randomId = getRandomId();
let testUser: UserProfile;
let testChannel: Channel;
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);
});
});

View File

@@ -0,0 +1,96 @@
// 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: {
EnableIndexing: true,
EnableSearching: true,
},
});
// # Visit the Elasticsearch settings page
cy.visit('/admin_console/environment/elasticsearch');
cy.get('#enableIndexingtrue').click();
// # Enable Auto complete
cy.get('#enableAutocompletetrue').check().should('be.checked');
// * 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('[data-testid="jobTable"]').scrollIntoView();
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;
});
});
});

View File

@@ -0,0 +1,119 @@
// 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 {doTestQuickChannelSwitcher} from '../../autocomplete/common_test';
import type {SimpleUser} from '../../autocomplete/helpers';
import {createSearchData} from '../../autocomplete/helpers';
import {enableElasticSearch} from './helpers';
import {getRandomLetter} from '@/utils';
describe('Autocomplete with Elasticsearch - Users', () => {
const prefix = getRandomLetter(3);
let testUsers: Record<string, SimpleUser>;
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('combobox', {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);
});
});
});
});

View File

@@ -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 {doTestPostextbox} from '../../autocomplete/common_test';
import type {SimpleUser} from '../../autocomplete/helpers';
import {createSearchData} from '../../autocomplete/helpers';
import {enableElasticSearch} from './helpers';
import {getRandomLetter} from '@/utils';
describe('Autocomplete with Elasticsearch - Users', () => {
const prefix = getRandomLetter(3);
let testUsers: Record<string, SimpleUser>;
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);
});
});
});
});

View File

@@ -0,0 +1,52 @@
// 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 type {Team} from '@mattermost/types/teams';
import {doTestDMChannelSidebar, doTestUserChannelSection} from '../../autocomplete/common_test';
import type {SimpleUser} from '../../autocomplete/helpers';
import {createSearchData} from '../../autocomplete/helpers';
import {enableElasticSearch} from './helpers';
import {getRandomLetter} from '@/utils';
describe('Autocomplete with Elasticsearch - Users', () => {
const prefix = getRandomLetter(3);
let testUsers: Record<string, SimpleUser>;
let testTeam: Team;
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);
});
});