From 318abef7d1bdcfaa65ef603270fac20fea46d738 Mon Sep 17 00:00:00 2001 From: Angel Mendez Date: Fri, 18 Oct 2024 09:57:21 -0600 Subject: [PATCH] convert elasticsearch_autocomplete/ files to ts (#28484) * convert elasticsearch_autocomplete/ files to ts - convert js files to ts - update types - fix lint issues Fixes: #21308 * fix: add missing exports elasticsearch_autocomplete - add missing export on functions: - createEmail - searchForChannel --------- Co-authored-by: Mattermost Build --- .../{channels_spec.js => channels_spec.ts} | 6 +- ... channels_with_special_characters_spec.ts} | 5 +- .../elasticsearch_autocomplete/helpers.ts | 243 +++++++++++++++++ .../helpers/index.js | 246 ------------------ .../{renaming_spec.js => renaming_spec.ts} | 8 +- ...ing_team_spec.js => renaming_team_spec.ts} | 6 +- ...console_spec.js => system_console_spec.ts} | 0 ...c.js => users_in_channel_switcher_spec.ts} | 4 +- ....js => users_in_message_input_box_spec.ts} | 4 +- .../{users_spec.js => users_spec.ts} | 7 +- 10 files changed, 267 insertions(+), 262 deletions(-) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{channels_spec.js => channels_spec.ts} (96%) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{channels_with_special_characters_spec.js => channels_with_special_characters_spec.ts} (96%) create mode 100644 e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers.ts delete mode 100644 e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers/index.js rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{renaming_spec.js => renaming_spec.ts} (90%) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{renaming_team_spec.js => renaming_team_spec.ts} (91%) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{system_console_spec.js => system_console_spec.ts} (100%) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{users_in_channel_switcher_spec.js => users_in_channel_switcher_spec.ts} (96%) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{users_in_message_input_box_spec.js => users_in_message_input_box_spec.ts} (96%) rename e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/{users_spec.js => users_spec.ts} (87%) diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_spec.ts similarity index 96% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_spec.ts index 21082a5fc1..5208a20ff4 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_spec.ts @@ -10,6 +10,8 @@ // Stage: @prod // Group: @channels @enterprise @elasticsearch @autocomplete @not_cloud +import {Team} from '@mattermost/types/teams'; +import {UserProfile} from '@mattermost/types/users'; import {getAdminAccount} from '../../../../support/env'; import { @@ -20,8 +22,8 @@ import { } from './helpers'; describe('Autocomplete with Elasticsearch - Channel', () => { - let testTeam; - let testUser; + let testTeam: Team; + let testUser: UserProfile; before(() => { cy.shouldNotRunOnCloudEdition(); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_with_special_characters_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_with_special_characters_spec.ts similarity index 96% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_with_special_characters_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_with_special_characters_spec.ts index 36246b8b77..d05f9c2c10 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_with_special_characters_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/channels_with_special_characters_spec.ts @@ -10,14 +10,15 @@ // Stage: @prod // Group: @channels @enterprise @elasticsearch @autocomplete @not_cloud +import {Channel} from '@mattermost/types/channels'; import { enableElasticSearch, searchAndVerifyChannel, } from './helpers'; describe('Autocomplete with Elasticsearch - Channel', () => { - let testChannel; - let teamName; + let testChannel: Channel; + let teamName: string; before(() => { cy.shouldNotRunOnCloudEdition(); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers.ts b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers.ts new file mode 100644 index 0000000000..74edd264bb --- /dev/null +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers.ts @@ -0,0 +1,243 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {Channel} from '@mattermost/types/channels'; +import {ChainableT} from 'tests/types'; +import * as TIMEOUTS from '../../../../fixtures/timeouts'; +import {getAdminAccount} from '../../../../support/env'; +import {SimpleUser} from '../../autocomplete/helpers'; + +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('textbox', {name: 'quick switch input'}). + should('be.visible'). + as('input'). + clear(). + type(name); +} + +function createChannel(channelType, teamId, userToAdd = null): ChainableT { + // # 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); + }); + }); + } + + // # Explicitly wait to give some time to index before searching + cy.wait(TIMEOUTS.TWO_SEC); + return cy.wrap(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('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').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 { + // 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', + }, + }; +} + +export function createPrivateChannel(teamId: string, userToAdd = null) { + // # Create a private channel as sysadmin + return createChannel('P', teamId, userToAdd); +} + +export function createPublicChannel(teamId, userToAdd = null) { + // # Create a public channel as sysadmin + return createChannel('O', teamId, userToAdd); +} + +export function 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'); + } +} + +export function 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); +} diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers/index.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers/index.js deleted file mode 100644 index 6aab3c45f3..0000000000 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/helpers/index.js +++ /dev/null @@ -1,246 +0,0 @@ -// 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 channel - 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); - }); - }); - } - - // # 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: { - EnableIndexing: true, - EnableSearching: true, - }, - }); - - // # Navigate to the elastic search setting page - cy.visit('/admin_console/environment/elasticsearch'); - cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').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); - }, - 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); - }, -}; diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_spec.ts similarity index 90% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_spec.ts index f43a14e772..04d4fed420 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_spec.ts @@ -10,6 +10,8 @@ // Stage: @prod // Group: @channels @enterprise @elasticsearch @autocomplete @not_cloud +import {Channel} from '@mattermost/types/channels'; +import {UserProfile} from '@mattermost/types/users'; import {getRandomId} from '../../../../utils'; import { @@ -19,8 +21,8 @@ import { } from './helpers'; describe('Autocomplete with Elasticsearch - Renaming', () => { - let testUser; - let testChannel; + let testUser: UserProfile; + let testChannel: Channel; before(() => { cy.shouldNotRunOnCloudEdition(); @@ -45,7 +47,7 @@ describe('Autocomplete with Elasticsearch - Renaming', () => { searchAndVerifyUser(testUser); // # Rename a user - cy.apiPatchUser(testUser.id, {username: `newusername-${getRandomId()}`}).then(({user}) => { + cy.apiPatchUser(testUser.id, {username: `newusername-${getRandomId()}`} as UserProfile).then(({user}) => { // # Verify user appears in search results post-change searchAndVerifyUser(user); }); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_team_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_team_spec.ts similarity index 91% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_team_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_team_spec.ts index 44f7c5e4ba..c27d95bb7d 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_team_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/renaming_team_spec.ts @@ -10,6 +10,8 @@ // Stage: @prod // Group: @channels @enterprise @elasticsearch @autocomplete @not_cloud +import {Channel} from '@mattermost/types/channels'; +import {UserProfile} from '@mattermost/types/users'; import {getRandomId} from '../../../../utils'; import { @@ -20,8 +22,8 @@ import { describe('Autocomplete with Elasticsearch - Renaming Team', () => { const randomId = getRandomId(); - let testUser; - let testChannel; + let testUser: UserProfile; + let testChannel: Channel; before(() => { cy.shouldNotRunOnCloudEdition(); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/system_console_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/system_console_spec.ts similarity index 100% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/system_console_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/system_console_spec.ts diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_channel_switcher_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_channel_switcher_spec.ts similarity index 96% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_channel_switcher_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_channel_switcher_spec.ts index 2af2287a59..10e610c388 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_channel_switcher_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_channel_switcher_spec.ts @@ -12,11 +12,11 @@ import {getRandomLetter} from '../../../../utils'; import {doTestQuickChannelSwitcher} from '../../autocomplete/common_test'; -import {createSearchData, enableElasticSearch} from '../../autocomplete/helpers'; +import {createSearchData, enableElasticSearch, SimpleUser} from '../../autocomplete/helpers'; describe('Autocomplete with Elasticsearch - Users', () => { const prefix = getRandomLetter(3); - let testUsers; + let testUsers: Record; before(() => { cy.shouldNotRunOnCloudEdition(); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_message_input_box_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_message_input_box_spec.ts similarity index 96% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_message_input_box_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_message_input_box_spec.ts index 5d9ae145b2..8f4f6a68c1 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_message_input_box_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_in_message_input_box_spec.ts @@ -12,11 +12,11 @@ import {getRandomLetter} from '../../../../utils'; import {doTestPostextbox} from '../../autocomplete/common_test'; -import {createSearchData, enableElasticSearch} from '../../autocomplete/helpers'; +import {createSearchData, enableElasticSearch, SimpleUser} from '../../autocomplete/helpers'; describe('Autocomplete with Elasticsearch - Users', () => { const prefix = getRandomLetter(3); - let testUsers; + let testUsers: Record; before(() => { cy.shouldNotRunOnCloudEdition(); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_spec.ts similarity index 87% rename from e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_spec.js rename to e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_spec.ts index b4940d966b..0d52b747c2 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/elasticsearch_autocomplete/users_spec.ts @@ -10,14 +10,15 @@ // Stage: @prod // Group: @channels @enterprise @elasticsearch @autocomplete @not_cloud +import {Team} from '@mattermost/types/teams'; import {getRandomLetter} from '../../../../utils'; import {doTestDMChannelSidebar, doTestUserChannelSection} from '../../autocomplete/common_test'; -import {createSearchData, enableElasticSearch} from '../../autocomplete/helpers'; +import {createSearchData, enableElasticSearch, SimpleUser} from '../../autocomplete/helpers'; describe('Autocomplete with Elasticsearch - Users', () => { const prefix = getRandomLetter(3); - let testUsers; - let testTeam; + let testUsers: Record; + let testTeam: Team; before(() => { cy.shouldNotRunOnCloudEdition();