Refactor/migrate/autocomplete database speabase specs to ts (#27837)

* refactor: migrate database/users_spec.js to ts

- migrate file autocomplete/database/users_spec.js to typescripts
- udpate system.d.ts data type adding type
for shouldHaveElasticsearchDisabled

* refactor: migrate users_in_channel_switcher_spec.js

- migrate file users_in_channel_switcher_spec to typescript
- fix issue with data type on file autocomplete/helpers.ts
function verifySuggestionAtChannelSwitcher
- fix issue with data type on file autocomplete/common_test.ts
function doTestQuickChannelSwitcher

* refactor: migrate users_in_message_input_box_spec to ts

- migrate file database/users_in_message_input_box_spec.js to typescript
- migrate file support/ui/suggestion_list.js to typescript and update
docs and type definitions
- update references to doTestPostextbox function
- update references to verifySuggestionAtPostTextbox function

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Angel Mendez
2024-09-02 04:48:40 -06:00
коммит произвёл GitHub
родитель 073d4ff959
Коммит 84f10a8773
9 изменённых файлов: 90 добавлений и 90 удалений

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

@@ -16,13 +16,13 @@ import {
verifySuggestionAtPostTextbox,
} from './helpers';
export function doTestPostextbox(mention: string, ...suggestion: Cypress.UserProfile[]) {
export function doTestPostextbox(mention: string, ...suggestion: SimpleUser[]) {
getPostTextboxInput();
startAtMention(mention);
verifySuggestionAtPostTextbox(...suggestion);
}
export function doTestQuickChannelSwitcher(mention: string, ...suggestion: Cypress.UserProfile[]) {
export function doTestQuickChannelSwitcher(mention: string, ...suggestion: SimpleUser[]) {
getQuickChannelSwitcherInput();
startAtMention(mention);
verifySuggestionAtChannelSwitcher(...suggestion);
@@ -49,10 +49,10 @@ export function doTestUserChannelSection(prefix: string, testTeam: Cypress.Team,
type(`@${prefix}odinson`);
// * Thor should be a channel member
cy.uiVerifyAtMentionInSuggestionList(thor as Cypress.UserProfile, true);
cy.uiVerifyAtMentionInSuggestionList(thor, true);
// * Loki should NOT be a channel member
cy.uiVerifyAtMentionInSuggestionList(loki as Cypress.UserProfile, false);
cy.uiVerifyAtMentionInSuggestionList(loki, false);
}
export function doTestDMChannelSidebar(testUsers: Record<string, SimpleUser>) {

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

@@ -12,11 +12,11 @@
import {getRandomLetter} from '../../../../utils';
import {doTestQuickChannelSwitcher} from '../common_test';
import {createSearchData} from '../helpers';
import {createSearchData, SimpleUser} from '../helpers';
describe('Autocomplete with Database - Users', () => {
const prefix = getRandomLetter(3);
let testUsers;
let testUsers: Record<string, SimpleUser>;
before(() => {
cy.apiGetClientLicense().then(({isCloudLicensed}) => {

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

@@ -12,11 +12,11 @@
import {getRandomLetter} from '../../../../utils';
import {doTestPostextbox} from '../common_test';
import {createSearchData} from '../helpers';
import {createSearchData, SimpleUser} from '../helpers';
describe('Autocomplete with Database - Users', () => {
const prefix = getRandomLetter(3);
let testUsers;
let testUsers: Record<string, SimpleUser>;
before(() => {
cy.apiGetClientLicense().then(({isCloudLicensed}) => {

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

@@ -12,12 +12,12 @@
import {getRandomLetter} from '../../../../utils';
import {doTestDMChannelSidebar, doTestUserChannelSection} from '../common_test';
import {createSearchData} from '../helpers';
import {createSearchData, SimpleUser} from '../helpers';
describe('Autocomplete with Database - Users', () => {
const prefix = getRandomLetter(3);
let testUsers;
let testTeam;
let testUsers: Record<string, SimpleUser>;
let testTeam: Cypress.Team;
before(() => {
cy.apiGetClientLicense().then(({isCloudLicensed}) => {

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

@@ -210,14 +210,14 @@ function startAtMention(string: string) {
cy.get('#suggestionList').should('be.visible');
}
function verifySuggestionAtPostTextbox(...expectedUsers: Cypress.UserProfile[]) {
function verifySuggestionAtPostTextbox(...expectedUsers: SimpleUser[]) {
expectedUsers.forEach((user) => {
cy.wait(TIMEOUTS.HALF_SEC);
cy.uiVerifyAtMentionSuggestion(user);
});
}
function verifySuggestionAtChannelSwitcher(...expectedUsers: Cypress.UserProfile[]) {
function verifySuggestionAtChannelSwitcher(...expectedUsers: SimpleUser[]) {
expectedUsers.forEach((user) => {
cy.findByTestId(user.username).
should('be.visible').