MM-47288 refactor: convert channels/channel/ files to ts (#28483)

* refactor: convert channels/channel/ files to ts

- convert js files to typescript
- update types
- fix lint issues

Fixes: 21299

* fix: solve lint issues channels/channel

- fix lint issues
- udpate types

* fix: adjustment to test case MM-T1687

- code reorganization for test case MM-T1687

* fix: update types on function apiCreateCustomAdmin

- update types for apiCreateCustomAdmin on  user.d.ts so that
lint issue is solved
Этот коммит содержится в:
Angel Mendez
2024-10-09 05:22:45 -06:00
коммит произвёл GitHub
родитель 429c41747c
Коммит 23623fc9c9
22 изменённых файлов: 168 добавлений и 103 удалений

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

@@ -42,7 +42,7 @@ declare namespace Cypress {
* // do something with roles
* });
*/
apiGetRolesByNames(names: string[]): Chainable<Role[]>;
apiGetRolesByNames(names: string[]): Chainable<{roles: Role[]}>;
/**
* Patch a role by ID.

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

@@ -193,7 +193,7 @@ declare namespace Cypress {
*
* @returns {UserProfile} `out.sysadmin` as `UserProfile` object
*/
apiCreateCustomAdmin(options: {loginAfter: boolean; hideAdminTrialModal?: boolean}): Chainable<{sysadmin: UserProfile}>;
apiCreateCustomAdmin({loginAfter = false, hideAdminTrialModal = true} = {}): Chainable<{sysadmin: UserProfile}>;
/**
* Create a new user with an options to set name prefix and be able to bypass tutorial steps.
@@ -248,7 +248,7 @@ declare namespace Cypress {
* // do something with users
* });
*/
apiGetUsers(queryParams: Record<string, any>): Chainable<UserProfile[]>;
apiGetUsers(queryParams: Record<string, any>): Chainable<{users: UserProfile[]}>;
/**
* Get list of users that are not team members.

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

@@ -1,16 +1,20 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Cypress.Commands.add('uiSearchPosts', (searchTerm) => {
import {ChainableT} from 'tests/types';
function uiSearchPosts(searchTerm: string) {
// # Enter the search terms and hit enter to start the search
cy.get('#searchBox').clear().type(searchTerm).type('{enter}');
// * Wait for the RHS to open and the search results to appear
cy.contains('.sidebar--right__header', 'Search Results').should('be.visible');
cy.get('#searchContainer .LoadingSpinner').should('not.exist');
});
}
Cypress.Commands.add('uiJumpToSearchResult', (postId) => {
Cypress.Commands.add('uiSearchPosts', uiSearchPosts);
function uiJumpToSearchResult(postId: string) {
// # Find the post in the search results and click Jump
cy.get(`#searchResult_${postId}`).contains('a', 'Jump').click();
@@ -19,4 +23,16 @@ Cypress.Commands.add('uiJumpToSearchResult', (postId) => {
// * Verify that the permalinked post is highlighted in the center channel
cy.get(`#post_${postId}.post--highlight`).should('be.visible');
});
}
Cypress.Commands.add('uiJumpToSearchResult', uiJumpToSearchResult);
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
uiSearchPosts(searchTerm: string): ChainableT;
uiJumpToSearchResult(postId: string): ChainableT;
}
}
}

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

@@ -638,7 +638,7 @@ declare global {
* @example
* cy.uiPostMessageQuickly('Hello world')
*/
uiPostMessageQuickly(message: string): void;
uiPostMessageQuickly(message: string): ChainableT<void>;
/**
* Clicks on a visible emoji in the emoji picker.