refactor: migrate group_mentions tests to ts (#28239)

- convert test files to typescript
- convert helpers.js to ts
- return chainable on function externalActivateUser
Этот коммит содержится в:
Angel Mendez
2024-10-08 15:20:13 -06:00
коммит произвёл GitHub
родитель 3d38d239ff
Коммит 54a5ecb721
4 изменённых файлов: 26 добавлений и 17 удалений

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

@@ -9,6 +9,7 @@
// Group: @channels @enterprise @system_console @group_mentions
import {Team} from '@mattermost/types/teams';
import ldapUsers from '../../../../fixtures/ldap_users.json';
import * as TIMEOUTS from '../../../../fixtures/timeouts';
@@ -18,12 +19,14 @@ import {
} from '../system_console/channel_moderation/helpers';
import {enableGroupMention} from './helpers';
import {UserProfile} from '@mattermost/types/users';
import {Group} from '@mattermost/types/groups';
describe('Group Mentions', () => {
let groupID;
let groupID: string;
let boardUser;
let regularUser;
let testTeam;
let regularUser: UserProfile;
let testTeam: Team;
before(() => {
// * Check if server has license for LDAP Groups
@@ -59,7 +62,7 @@ describe('Group Mentions', () => {
// # Get board group id
cy.apiGetGroups().then((res) => {
res.body.forEach((group) => {
res.body.forEach((group: Group) => {
if (group.display_name === 'board') {
// # Set groupID to navigate to group page directly
groupID = group.id;

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

@@ -9,17 +9,20 @@
// Group: @channels @enterprise @system_console @group_mentions
import {UserProfile} from '@mattermost/types/users';
import ldapUsers from '../../../../fixtures/ldap_users.json';
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import {enableGroupMention} from './helpers';
import {Team} from '@mattermost/types/teams';
import {Group} from '@mattermost/types/groups';
describe('Group Mentions', () => {
let groupID1;
let groupID2;
let groupID1: string;
let groupID2: string;
let boardUser;
let regularUser;
let testTeam;
let regularUser: UserProfile;
let testTeam: Team;
before(() => {
// * Check if server has license for LDAP Groups
@@ -66,7 +69,7 @@ describe('Group Mentions', () => {
// # Get board group id
cy.apiGetGroups().then((res) => {
res.body.forEach((group) => {
res.body.forEach((group: Group) => {
if (group.display_name === 'board') {
// # Set groupID1 to navigate to group page directly
groupID1 = group.id;
@@ -257,19 +260,19 @@ describe('Group Mentions', () => {
// # Link the group and the channel.
cy.apiLinkGroupChannel(groupID1, channel.id);
cy.apiLogin({username: 'board.one', password: 'Password1'}).then(({user: boardOne}) => {
cy.apiLogin({username: 'board.one', password: 'Password1'} as any).then((boardOne) => {
cy.apiAddUserToChannel(channel.id, boardOne.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'}).then(({user: devOne}) => {
cy.apiLogin({username: 'dev.one', password: 'Password1'} as any).then((devOne) => {
cy.apiAdminLogin();
cy.apiAddUserToTeam(testTeam.id, devOne.id);
cy.apiLogin({username: 'board.one', password: 'Password1'});
cy.apiLogin({username: 'board.one', password: 'Password1'} as any);
// # Visit the channel
cy.visit(`/${testTeam.name}/channels/${channel.name}`);

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

@@ -21,12 +21,15 @@ import {
import {checkboxesTitleToIdMap} from '../system_console/channel_moderation/constants';
import {enableGroupMention} from './helpers';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {Group} from '@mattermost/types/groups';
describe('Group Mentions', () => {
let groupID;
let groupID: string;
let boardUser;
let regularUser;
let testTeam;
let regularUser: UserProfile;
let testTeam: Team;
before(() => {
// * Check if server has license for LDAP Groups
@@ -62,7 +65,7 @@ describe('Group Mentions', () => {
// # Get board group id
cy.apiGetGroups().then((res) => {
res.body.forEach((group) => {
res.body.forEach((group: Group) => {
if (group.display_name === 'board') {
// # Set groupID to navigate to group page directly
groupID = group.id;

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

@@ -3,7 +3,7 @@
import * as TIMEOUTS from '../../../../fixtures/timeouts';
export function enableGroupMention(groupName, groupID, userEmail) {
export function enableGroupMention(groupName: string, groupID: string, userEmail?: string): void {
// # Visit Group Configurations page
cy.visit(`/admin_console/user_management/groups/${groupID}`);