MM-47287 Refactor/migrate bot accounts to typescript (#28347)
* refactor: convert bot_api_1_spec.js to typescript - convert file bot_accounts/bot_api_1_spec.js to typescript - update related data types in order to fix argument issues * refactor: convert bot_api_not_cloud_spec.js to ts - convert file bot_accounts/bot_api_not_cloud_spec.js to typescript - update related data types in order to fix argument issues * refactor: convert bot_channel_intro_spec.js to ts - convert file bot_accounts/bot_channel_intro_spec.js to typescript - convert support/api/bots.js to typescript - remove data type bot.d.ts and include docs and definitions in support/api/bots.ts * refactor: convert bot_accounts files to ts - convert files from js to typescript - move declaration files to ts - update js docs - fix lint and type errors Related to #21303 * fix: replace params undefined on client.createUser - replace undefined params with empty strings as suggested in review * fix: add types to variables on spec tags_spec.ts - add types to variables * fix: update args for apiCreateBot on api/bots.ts - update args so that lint issue is fixed * Apply suggestions from code review update assertion to 401 --------- Co-authored-by: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f4c85a875d
Коммит
a358bef3cd
@@ -260,17 +260,17 @@ describe('Group Mentions', () => {
|
||||
// # Link the group and the channel.
|
||||
cy.apiLinkGroupChannel(groupID1, channel.id);
|
||||
|
||||
cy.apiLogin({username: 'board.one', password: 'Password1'} as any).then((boardOne) => {
|
||||
cy.apiAddUserToChannel(channel.id, boardOne.id);
|
||||
cy.apiLogin({username: 'board.one', password: 'Password1'} as any).then(({user}: {user: UserProfile}) => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
|
||||
// # Make the channel private and group-synced.
|
||||
cy.apiPatchChannel(channel.id, {group_constrained: true, type: 'P'});
|
||||
|
||||
// # Login to create the dev user
|
||||
cy.apiLogin({username: 'dev.one', password: 'Password1'} as any).then((devOne) => {
|
||||
cy.apiLogin({username: 'dev.one', password: 'Password1'} as any).then(({user}: {user: UserProfile}) => {
|
||||
cy.apiAdminLogin();
|
||||
|
||||
cy.apiAddUserToTeam(testTeam.id, devOne.id);
|
||||
cy.apiAddUserToTeam(testTeam.id, user.id);
|
||||
|
||||
cy.apiLogin({username: 'board.one', password: 'Password1'} as any);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
reUrl,
|
||||
verifyEmailBody,
|
||||
} from '../../../../utils';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
describe('Guest Accounts', () => {
|
||||
let sysadmin: Cypress.UserProfile;
|
||||
@@ -40,7 +41,7 @@ describe('Guest Accounts', () => {
|
||||
});
|
||||
|
||||
// # Log in as a team admin.
|
||||
cy.apiAdminLogin().then((user) => {
|
||||
cy.apiAdminLogin().then(({user}: {user: UserProfile}) => {
|
||||
sysadmin = user;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @enterprise @ldap
|
||||
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import ldapUsers from '../../../../fixtures/ldap_users.json';
|
||||
import {getRandomId} from '../../../../utils';
|
||||
|
||||
@@ -220,7 +221,7 @@ function setLDAPTestSettings(config) {
|
||||
}
|
||||
|
||||
function disableOnboardingTaskList(ldapLogin) {
|
||||
cy.apiLogin(ldapLogin).then((user) => {
|
||||
cy.apiLogin(ldapLogin).then(({user}: {user: UserProfile}) => {
|
||||
cy.apiSaveOnboardingTaskListPreference(user.id, 'onboarding_task_list_open', 'false');
|
||||
cy.apiSaveOnboardingTaskListPreference(user.id, 'onboarding_task_list_show', 'false');
|
||||
cy.apiSaveSkipStepsPreference(user.id, 'true');
|
||||
@@ -228,7 +229,7 @@ function disableOnboardingTaskList(ldapLogin) {
|
||||
}
|
||||
|
||||
function removeUserFromAllTeams(testUser) {
|
||||
cy.apiGetUsersByUsernames([testUser.username]).then((users) => {
|
||||
cy.apiGetUsersByUsernames([testUser.username]).then(({users}) => {
|
||||
if (users.length > 0) {
|
||||
users.forEach((user) => {
|
||||
cy.apiGetTeamsForUser(user.id).then((teams) => {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// * Change mattermost-server utils/license.go to test public key
|
||||
// * e.g. see (https://github.com/mattermost/mattermost-server/pull/16778/files)
|
||||
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import * as TIMEOUTS from '../../../../fixtures/timeouts';
|
||||
|
||||
function verifyPurchaseModal() {
|
||||
@@ -136,7 +137,7 @@ function getCurrentUsers(): Cypress.Chainable<number> {
|
||||
}
|
||||
|
||||
describe('Self hosted Purchase', () => {
|
||||
let adminUser: Cypress.UserProfile | undefined;
|
||||
let adminUser: UserProfile;
|
||||
|
||||
beforeEach(() => {
|
||||
// prevent failed tests from bleeding over
|
||||
@@ -145,9 +146,9 @@ describe('Self hosted Purchase', () => {
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(() => {
|
||||
cy.apiAdminLogin().then((result) => {
|
||||
cy.apiAdminLogin().then(({user}) => {
|
||||
// assertion because current typings are wrong.
|
||||
adminUser = (result as unknown as {user: Cypress.UserProfile}).user;
|
||||
adminUser = user;
|
||||
cy.apiDeleteLicense();
|
||||
cy.visit('/');
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user