mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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
This commit is contained in:
parent
429c41747c
commit
23623fc9c9
@ -10,11 +10,13 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Leave an archived channel', () => {
|
||||
let testTeam;
|
||||
let offTopicUrl;
|
||||
let testTeam: Team;
|
||||
let offTopicUrl: string;
|
||||
const channelType = {
|
||||
all: 'Channel Type: All',
|
||||
public: 'Channel Type: Public',
|
||||
@ -63,13 +65,13 @@ describe('Leave an archived channel', () => {
|
||||
|
||||
// # Search for the new post and jump to it from the search results
|
||||
cy.uiSearchPosts(otherPostText);
|
||||
cy.get('@otherPostId').then((otherPostId) => cy.uiJumpToSearchResult(otherPostId));
|
||||
cy.get<string>('@otherPostId').then((otherPostId) => cy.uiJumpToSearchResult(otherPostId));
|
||||
|
||||
// # Search for a post in the archived channel
|
||||
cy.uiSearchPosts(archivedPostText);
|
||||
|
||||
// # Open it in the RHS
|
||||
cy.get('@archivedPostId').then((archivedPostId) => {
|
||||
cy.get<string>('@archivedPostId').then((archivedPostId) => {
|
||||
cy.clickPostCommentIcon(archivedPostId, 'SEARCH');
|
||||
|
||||
// * Verify that the RHS has switched from search results to the thread
|
||||
@ -114,8 +116,8 @@ describe('Leave an archived channel', () => {
|
||||
});
|
||||
|
||||
it('MM-T1699 - Browse Channels for all channel types shows archived channels option', () => {
|
||||
let archivedPrivateChannel;
|
||||
let archivedPublicChannel;
|
||||
let archivedPrivateChannel: Channel;
|
||||
let archivedPublicChannel: Channel;
|
||||
|
||||
// # Create private channel
|
||||
cy.uiCreateChannel({isPrivate: true, isNewSidebar: true}).as('channel').then((channel) => {
|
||||
@ -161,8 +163,8 @@ describe('Leave an archived channel', () => {
|
||||
});
|
||||
|
||||
it('MM-T1700 - All archived public channels are shown Important', () => {
|
||||
let archivedPublicChannel1;
|
||||
let archivedPublicChannel2;
|
||||
let archivedPublicChannel1: Channel;
|
||||
let archivedPublicChannel2: Channel;
|
||||
|
||||
// # Create public channel
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel').then(({channel}) => {
|
||||
@ -214,8 +216,8 @@ describe('Leave an archived channel', () => {
|
||||
});
|
||||
|
||||
it('MM-T1701 - Only Private channels you are a member of are displayed', () => {
|
||||
let archivedPrivateChannel1;
|
||||
let archivedPrivateChannel2;
|
||||
let archivedPrivateChannel1: Channel;
|
||||
let archivedPrivateChannel2: Channel;
|
||||
|
||||
// # Create private channel
|
||||
cy.uiCreateChannel({isPrivate: true, isNewSidebar: true}).as('channel').then((channel) => {
|
||||
@ -268,7 +270,7 @@ describe('Leave an archived channel', () => {
|
||||
});
|
||||
|
||||
it('MM-T1703 - User can open archived channels', () => {
|
||||
let archivedChannel;
|
||||
let archivedChannel: Channel;
|
||||
|
||||
// # Create a public channel
|
||||
cy.apiCreateChannel(testTeam.id, 'channel', 'channel').then(({channel}) => {
|
@ -10,12 +10,15 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel
|
||||
|
||||
import {Channel, ServerChannel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import {getAdminAccount} from '../../../support/env';
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Leave an archived channel', () => {
|
||||
let testTeam;
|
||||
let testUser;
|
||||
let testTeam: Team;
|
||||
let testUser: UserProfile;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
@ -37,19 +40,21 @@ describe('Leave an archived channel', () => {
|
||||
});
|
||||
|
||||
it('MM-T1687 App does not crash when another user archives a channel', () => {
|
||||
cy.makeClient({user: getAdminAccount()}).then((client) => {
|
||||
cy.makeClient({user: getAdminAccount()}).then(async (client) => {
|
||||
// # Have another user create a private channel
|
||||
const channelName = `channel${getRandomId()}`;
|
||||
cy.wrap(client.createChannel({
|
||||
const channelTest = {
|
||||
display_name: channelName,
|
||||
name: channelName,
|
||||
team_id: testTeam.id,
|
||||
type: 'P',
|
||||
})).then(async (channel) => {
|
||||
} as Channel;
|
||||
|
||||
cy.wrap(client.createChannel(channelTest)).then(async (channel: ServerChannel) => {
|
||||
// # Then invite us to it
|
||||
await client.addToChannel(testUser.id, channel.id);
|
||||
|
||||
cy.wrap(channel);
|
||||
return channel;
|
||||
}).then((channel) => {
|
||||
// * Verify that the newly created channel is in the sidebar
|
||||
cy.get(`#sidebarItem_${channel.name}`).should('be.visible');
|
@ -10,6 +10,9 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
import {createPrivateChannel} from '../enterprise/elasticsearch_autocomplete/helpers';
|
||||
@ -21,10 +24,10 @@ const channelType = {
|
||||
};
|
||||
|
||||
describe('Channels', () => {
|
||||
let testUser;
|
||||
let otherUser;
|
||||
let testTeam;
|
||||
let testChannel;
|
||||
let testUser: UserProfile;
|
||||
let otherUser: UserProfile;
|
||||
let testTeam: Team;
|
||||
let testChannel: Channel;
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
@ -151,7 +154,7 @@ describe('Channels', () => {
|
||||
cy.apiLogin(otherUser);
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
|
||||
let newChannel;
|
||||
let newChannel: Channel;
|
||||
cy.apiCreateChannel(testTeam.id, 'channel-to-leave', 'Channel to leave').then(({channel}) => {
|
||||
newChannel = channel;
|
||||
cy.visit(`/${testTeam.name}/channels/${newChannel.name}`);
|
||||
@ -185,9 +188,9 @@ describe('Channels', () => {
|
||||
ExperimentalViewArchivedChannels: true,
|
||||
},
|
||||
});
|
||||
let newChannel;
|
||||
let testArchivedChannel;
|
||||
let testPrivateArchivedChannel;
|
||||
let newChannel: Channel;
|
||||
let testArchivedChannel: Channel;
|
||||
let testPrivateArchivedChannel: Channel;
|
||||
|
||||
cy.apiCreateTeam('team', 'Test NoMember').then(({team}) => {
|
||||
cy.apiCreateChannel(team.id, 'not-archived-channel', 'Not Archived Channel').then(({channel}) => {
|
@ -1,6 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@ -15,9 +18,9 @@ function verifyNoChannelToJoinMessage(isVisible) {
|
||||
}
|
||||
|
||||
describe('browse public channels', () => {
|
||||
let testUser;
|
||||
let otherUser;
|
||||
let testTeam;
|
||||
let testUser: UserProfile;
|
||||
let otherUser: UserProfile;
|
||||
let testTeam: Team;
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
@ -10,6 +10,9 @@
|
||||
// Group: @channels @channel @channel_bookmarks
|
||||
// node run_tests.js --group='@channel'
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import {getRandomId} from '../../../utils';
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
@ -17,14 +20,12 @@ describe('Channel Bookmarks', () => {
|
||||
const SpaceKeyCode = 32;
|
||||
const RightArrowKeyCode = 39;
|
||||
|
||||
let testTeam: Cypress.Team;
|
||||
let testTeam: Team;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let user1: Cypress.UserProfile;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let admin: Cypress.UserProfile;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let channel: Cypress.Channel;
|
||||
let user1: UserProfile;
|
||||
let admin: UserProfile;
|
||||
let channel: Channel;
|
||||
|
||||
before(() => {
|
||||
cy.apiGetMe().then(({user: adminUser}) => {
|
||||
|
@ -10,17 +10,20 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel @rhs @channel_info
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import {stubClipboard} from '../../../utils';
|
||||
|
||||
describe('Channel Info RHS', () => {
|
||||
let testTeam;
|
||||
let testChannel;
|
||||
let groupChannel;
|
||||
let directChannel;
|
||||
let directUser;
|
||||
let admin;
|
||||
let user;
|
||||
const otherUsers = [];
|
||||
let testTeam: Team;
|
||||
let testChannel: Channel;
|
||||
let groupChannel: Channel;
|
||||
let directChannel: Channel;
|
||||
let directUser: UserProfile;
|
||||
let admin: UserProfile;
|
||||
let user: UserProfile;
|
||||
const otherUsers: UserProfile[] = [];
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup({promoteNewUserAsAdmin: true}).then(({team, user: newAdmin}) => {
|
||||
@ -41,7 +44,7 @@ describe('Channel Info RHS', () => {
|
||||
// Users used for GM/DM
|
||||
cy.apiCreateUser().then(({user: newUser}) => {
|
||||
otherUsers.push(newUser);
|
||||
cy.apiPatchUser(newUser.id, {position: 'Upside down'}).then(({user: patchedUser}) => {
|
||||
cy.apiPatchUser(newUser.id, {position: 'Upside down'} as UserProfile).then(({user: patchedUser}) => {
|
||||
cy.apiCreateDirectChannel([newAdmin.id, newUser.id]).then(({channel}) => {
|
||||
directChannel = channel;
|
||||
});
|
||||
@ -66,7 +69,7 @@ describe('Channel Info RHS', () => {
|
||||
return !(['manage_public_channel_members', 'manage_private_channel_members', 'manage_public_channel_properties', 'manage_private_channel_properties'].includes(permission));
|
||||
});
|
||||
|
||||
if (permissions.length !== role.permissions) {
|
||||
if (permissions.length !== role.permissions.length) {
|
||||
cy.apiPatchRole(role.id, {permissions});
|
||||
}
|
||||
});
|
@ -1,6 +1,10 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
const {generateRandomUser} = require('../../../support/api/user');
|
||||
|
||||
// ***************************************************************
|
||||
@ -12,7 +16,7 @@ const {generateRandomUser} = require('../../../support/api/user');
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel @rhs @channel_members
|
||||
|
||||
function openChannelMembersRhs(testTeam, testChannel) {
|
||||
function openChannelMembersRhs(testTeam: Team, testChannel: Channel) {
|
||||
// # Go to test channel
|
||||
cy.visit(`/${testTeam.name}/channels/${testChannel.name}`);
|
||||
|
||||
@ -24,10 +28,10 @@ function openChannelMembersRhs(testTeam, testChannel) {
|
||||
}
|
||||
|
||||
describe('Channel members RHS', () => {
|
||||
let testTeam;
|
||||
let testChannel;
|
||||
let admin;
|
||||
let user;
|
||||
let testTeam: Team;
|
||||
let testChannel: Channel;
|
||||
let admin: UserProfile;
|
||||
let user: UserProfile;
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup({promoteNewUserAsAdmin: true}).then(({team, user: newAdmin}) => {
|
||||
@ -53,7 +57,7 @@ describe('Channel members RHS', () => {
|
||||
return !(['manage_public_channel_members', 'manage_private_channel_members', 'manage_public_channel_properties', 'manage_private_channel_properties'].includes(permission));
|
||||
});
|
||||
|
||||
if (permissions.length !== role.permissions) {
|
||||
if (permissions.length !== role.permissions.length) {
|
||||
cy.apiPatchRole(role.id, {permissions});
|
||||
}
|
||||
});
|
||||
@ -168,7 +172,7 @@ describe('Channel members RHS', () => {
|
||||
|
||||
it('should hide deactivated members', () => {
|
||||
cy.apiCreateChannel(testTeam.id, 'hide-test-channel', 'Hide Test Channel', 'O').then(({channel}) => {
|
||||
let testUser = null;
|
||||
let testUser: UserProfile;
|
||||
cy.apiCreateUser().then(({user: newUser}) => {
|
||||
cy.apiAddUserToTeam(testTeam.id, newUser.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, newUser.id).then(() => {
|
@ -10,14 +10,17 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Channel', () => {
|
||||
let testTeam;
|
||||
let ownChannel;
|
||||
let otherChannel;
|
||||
let testUser;
|
||||
let offTopicUrl;
|
||||
let testTeam: Team;
|
||||
let ownChannel: Channel;
|
||||
let otherChannel: Channel;
|
||||
let testUser: UserProfile;
|
||||
let offTopicUrl: string;
|
||||
|
||||
const myChannelsDividerText = 'My Channels';
|
||||
const otherChannelsDividerText = 'Other Channels';
|
@ -10,11 +10,14 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel @not_cloud
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
const timestamp = Date.now();
|
||||
|
||||
function verifyChannel(channel, verifyExistence = true) {
|
||||
function verifyChannel(channel: Channel, verifyExistence = true) {
|
||||
// # Wait for Channel to be created
|
||||
cy.wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
@ -35,9 +38,9 @@ function verifyChannel(channel, verifyExistence = true) {
|
||||
}
|
||||
|
||||
describe('channel name tooltips', () => {
|
||||
let loggedUser;
|
||||
let longUser;
|
||||
let testTeam;
|
||||
let loggedUser: UserProfile;
|
||||
let longUser: UserProfile;
|
||||
let testTeam: Team;
|
||||
|
||||
before(() => {
|
||||
cy.shouldNotRunOnCloudEdition();
|
@ -1,6 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@ -11,10 +14,10 @@
|
||||
// Group: @channels @channel
|
||||
|
||||
describe('Channel routing', () => {
|
||||
let testUser;
|
||||
let otherUser1;
|
||||
let otherUser2;
|
||||
let testTeam;
|
||||
let testUser: UserProfile;
|
||||
let otherUser1: UserProfile;
|
||||
let otherUser2: UserProfile;
|
||||
let testTeam: Team;
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
@ -10,13 +10,14 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel @channel_settings
|
||||
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {
|
||||
beMuted,
|
||||
beUnmuted,
|
||||
} from '../../../support/assertions';
|
||||
|
||||
describe('Channel Settings', () => {
|
||||
let testTeam;
|
||||
let testTeam: Team;
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testTeam = team;
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@ -11,9 +13,9 @@
|
||||
// Group: @channels @channel @smoke
|
||||
|
||||
describe('Channel Switcher', () => {
|
||||
let testTeam;
|
||||
let testChannelName;
|
||||
let offTopicUrl;
|
||||
let testTeam: Team;
|
||||
let testChannelName: string;
|
||||
let offTopicUrl: string;
|
||||
const channelNamePrefix = 'aswitchchannel';
|
||||
const channelDisplayNamePrefix = 'ASwitchChannel';
|
||||
|
@ -1,6 +1,11 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import {ChainableT} from '../../../types';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@ -13,7 +18,7 @@
|
||||
// Make sure that the current channel is Town Square and that the
|
||||
// channel identified by the passed name is no longer in the channel
|
||||
// sidebar
|
||||
function verifyChannelWasProperlyClosed(channelName) {
|
||||
function verifyChannelWasProperlyClosed(channelName: string) {
|
||||
// * Make sure that we have switched channels
|
||||
cy.get('#channelHeaderTitle').should('contain', 'Town Square');
|
||||
|
||||
@ -22,9 +27,9 @@ function verifyChannelWasProperlyClosed(channelName) {
|
||||
}
|
||||
|
||||
describe('Close direct messages', () => {
|
||||
let testUser;
|
||||
let otherUser;
|
||||
let testTeam;
|
||||
let testUser: UserProfile;
|
||||
let otherUser: UserProfile;
|
||||
let testTeam: Team;
|
||||
|
||||
before(() => {
|
||||
cy.shouldNotRunOnCloudEdition();
|
||||
@ -54,7 +59,7 @@ describe('Close direct messages', () => {
|
||||
});
|
||||
});
|
||||
|
||||
function createAndVisitDMChannel(userIds) {
|
||||
function createAndVisitDMChannel(userIds: string[]): ChainableT<Channel> {
|
||||
return cy.apiCreateDirectChannel(userIds).then(({channel}) => {
|
||||
// # Visit the new channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
@ -68,10 +73,10 @@ describe('Close direct messages', () => {
|
||||
});
|
||||
|
||||
describe('Close group messages', () => {
|
||||
let testUser;
|
||||
let otherUser1;
|
||||
let otherUser2;
|
||||
let testTeam;
|
||||
let testUser: UserProfile;
|
||||
let otherUser1: UserProfile;
|
||||
let otherUser2: UserProfile;
|
||||
let testTeam: Team;
|
||||
|
||||
before(() => {
|
||||
cy.apiAdminLogin();
|
@ -1,6 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@ -11,8 +14,8 @@
|
||||
// Group: @channels @channel
|
||||
|
||||
describe('Channels', () => {
|
||||
let testUser;
|
||||
let testTeam;
|
||||
let testUser: UserProfile;
|
||||
let testTeam: Team;
|
||||
|
||||
before(() => {
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
@ -1,6 +1,10 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team, TeamMembership} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@ -11,14 +15,14 @@
|
||||
// Group: @channels @channel
|
||||
|
||||
describe('Group Message Conversion To Private Channel', () => {
|
||||
let testTeam1;
|
||||
let testTeam2;
|
||||
let testTeam1: Team;
|
||||
let testTeam2: Team;
|
||||
|
||||
let testUser1;
|
||||
let testUser2;
|
||||
let testUser3;
|
||||
let testUser1: UserProfile;
|
||||
let testUser2: UserProfile;
|
||||
let testUser3: UserProfile;
|
||||
|
||||
let gm;
|
||||
let gm: Channel;
|
||||
|
||||
before(() => {
|
||||
// we need two teams, and a set of users belonging to both teams
|
||||
@ -36,9 +40,9 @@ describe('Group Message Conversion To Private Channel', () => {
|
||||
testUser3 = user3;
|
||||
|
||||
const teamMembers1 = [testUser1, testUser2, testUser3].map((u) => ({team_id: testTeam1.id, user_id: u.id}));
|
||||
cy.apiAddUsersToTeam(testTeam1.id, teamMembers1).then(() => {
|
||||
cy.apiAddUsersToTeam(testTeam1.id, teamMembers1 as TeamMembership[]).then(() => {
|
||||
const teamMembers2 = [testUser1, testUser2, testUser3].map((u) => ({team_id: testTeam2.id, user_id: u.id}));
|
||||
cy.apiAddUsersToTeam(testTeam2.id, teamMembers2).then(() => {
|
||||
cy.apiAddUsersToTeam(testTeam2.id, teamMembers2 as TeamMembership[]).then(() => {
|
||||
cy.apiCreateGroupChannel([testUser1.id, testUser2.id, testUser3.id]).then(({channel}) => {
|
||||
gm = channel;
|
||||
});
|
||||
@ -91,7 +95,7 @@ describe('Group Message Conversion To Private Channel', () => {
|
||||
user_id: u.id,
|
||||
}));
|
||||
|
||||
cy.apiAddUsersToTeam(testTeam2.id, teamMembers).then(() => {
|
||||
cy.apiAddUsersToTeam(testTeam2.id, teamMembers as TeamMembership[]).then(() => {
|
||||
cy.apiCreateGroupChannel([testUser1.id, testUser2.id, testUser3.id, testUser4.id]).then(({channel}) => {
|
||||
gm2 = channel;
|
||||
|
||||
@ -130,7 +134,7 @@ describe('Group Message Conversion To Private Channel', () => {
|
||||
user_id: testUser5.id,
|
||||
}];
|
||||
|
||||
cy.apiAddUsersToTeam(testTeam3.id, teamMembers).then(() => {
|
||||
cy.apiAddUsersToTeam(testTeam3.id, teamMembers as TeamMembership[]).then(() => {
|
||||
cy.apiCreateGroupChannel([testUser1.id, testUser2.id, testUser3.id, testUser5.id]).then(({channel}) => {
|
||||
gm3 = channel;
|
||||
|
@ -10,12 +10,15 @@
|
||||
// Stage: @prod
|
||||
// Group: @channels @channel
|
||||
|
||||
import {Channel} from '@mattermost/types/channels';
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Leave channel', () => {
|
||||
let testTeam;
|
||||
let testUser;
|
||||
let testChannel;
|
||||
let testTeam: Team;
|
||||
let testUser: UserProfile;
|
||||
let testChannel: Channel;
|
||||
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
@ -9,6 +9,7 @@
|
||||
|
||||
// Group: @channels @channel
|
||||
|
||||
import {UserProfile} from '@mattermost/types/users';
|
||||
import {getAdminAccount} from '../../../support/env';
|
||||
|
||||
const demoteToChannelMember = (user, channelId, admin) => {
|
||||
@ -37,8 +38,8 @@ const promoteToChannelAdmin = (user, channelId, admin) => {
|
||||
|
||||
describe('Change Roles', () => {
|
||||
const admin = getAdminAccount();
|
||||
let testUser;
|
||||
let testChannelId;
|
||||
let testUser: UserProfile;
|
||||
let testChannelId: string;
|
||||
|
||||
beforeEach(() => {
|
||||
// # Login as test user and visit test channel
|
||||
@ -57,7 +58,7 @@ describe('Change Roles', () => {
|
||||
return !(['manage_public_channel_members', 'manage_private_channel_members', 'manage_public_channel_properties', 'manage_private_channel_properties'].includes(permission));
|
||||
});
|
||||
|
||||
if (permissions.length !== role.permissions) {
|
||||
if (permissions.length !== role.permissions.length) {
|
||||
cy.apiPatchRole(role.id, {permissions});
|
||||
}
|
||||
});
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user