SEC-10098 E2E/Cypress chore(cypress): upgrade to v15.13 and to typescript@6.0 (#36091)

* chore(cypress): upgrade to v15.13 and to typescript@6.0

* fix comments and update exposing cypress env
This commit is contained in:
sabril
2026-04-16 13:35:26 +08:00
committed by GitHub
parent 7bd18f5dec
commit ab0a579b47
523 changed files with 6135 additions and 3166 deletions
+58 -1
View File
@@ -1,6 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as path from 'path';
import {defineConfig} from 'cypress';
export default defineConfig({
@@ -23,7 +25,8 @@ export default defineConfig({
videoCompression: true,
videosFolder: 'tests/videos',
viewportWidth: 1300,
env: {
allowCypressEnv: false,
expose: {
adminEmail: 'sysadmin@sample.mattermost.com',
adminUsername: 'sysadmin',
adminPassword: 'Sys@dmin-sample1',
@@ -59,6 +62,60 @@ export default defineConfig({
},
e2e: {
setupNodeEvents(on, config) {
// Custom webpack preprocessor for TypeScript 6 + @/ path aliases.
// @cypress/webpack-preprocessor@7.1.0 already handles TS6's
// downlevelIteration deprecation (cypress-io/cypress#33575).
// We add: ts-loader for .ts files, resolve extensions, and @/ alias.
// When Cypress >= 15.14 ships, the only custom piece needed is the @/ alias.
const webpackPreprocessor = require('@cypress/webpack-preprocessor');
const webpackOptions = {
resolve: {
extensions: ['.ts', '.js', '.json'],
alias: {
'@': path.resolve(__dirname, 'tests'),
},
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
],
},
],
},
// Restore Node.js polyfills (crypto, process, path, etc.)
// that webpack 5 no longer provides by default.
plugins: [
new (require('node-polyfill-webpack-plugin'))(),
new (require('webpack').ProvidePlugin)({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
],
};
on('file:preprocessor', webpackPreprocessor({webpackOptions}));
return require('./tests/plugins/index.js')(on, config);
},
baseUrl: process.env.MM_SERVICESETTINGS_SITEURL || 'http://localhost:8065',
+4451 -1734
View File
File diff suppressed because it is too large Load Diff
+24 -22
View File
@@ -1,14 +1,15 @@
{
"name": "cypress",
"devDependencies": {
"@aws-sdk/client-s3": "3.1001.0",
"@aws-sdk/lib-storage": "3.1001.0",
"@aws-sdk/client-s3": "3.1030.0",
"@aws-sdk/lib-storage": "3.1030.0",
"@babel/eslint-parser": "7.28.6",
"@babel/eslint-plugin": "7.27.1",
"@cypress/request": "3.0.10",
"@cypress/webpack-preprocessor": "7.1.0",
"@eslint/js": "9.39.3",
"@mattermost/client": "11.3.0",
"@mattermost/types": "11.3.0",
"@mattermost/client": "11.5.0",
"@mattermost/types": "11.5.0",
"@testing-library/cypress": "10.1.0",
"@types/async": "3.2.25",
"@types/authenticator": "1.1.4",
@@ -22,27 +23,27 @@
"@types/mochawesome": "6.2.5",
"@types/recursive-readdir": "2.2.4",
"@types/shelljs": "0.10.0",
"@typescript-eslint/eslint-plugin": "8.56.1",
"@typescript-eslint/parser": "8.56.1",
"@typescript-eslint/eslint-plugin": "8.58.2",
"@typescript-eslint/parser": "8.58.2",
"async": "3.2.6",
"authenticator": "1.1.5",
"axios": "1.13.6",
"axios": "1.15.0",
"chai": "6.2.2",
"chalk": "5.6.2",
"client-oauth2": "github:larkox/js-client-oauth2#e24e2eb5dfcbbbb3a59d095e831dbe0012b0ac49",
"cross-env": "10.1.0",
"cypress": "15.11.0",
"cypress": "15.13.1",
"cypress-file-upload": "5.0.8",
"cypress-multi-reporters": "2.0.5",
"cypress-plugin-tab": "1.0.5",
"cypress-plugin-tab": "2.0.0",
"cypress-real-events": "1.15.0",
"cypress-wait-until": "3.0.2",
"dayjs": "1.11.19",
"dayjs": "1.11.20",
"deepmerge": "4.3.1",
"dotenv": "17.3.1",
"dotenv": "17.4.2",
"eslint": "9.39.3",
"eslint-import-resolver-webpack": "0.13.10",
"eslint-plugin-cypress": "6.1.0",
"eslint-import-resolver-webpack": "0.13.11",
"eslint-plugin-cypress": "6.3.1",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-mattermost": "github:mattermost/eslint-plugin-mattermost#5b0c972eacf19286e4c66221b39113bf8728a99e",
@@ -50,9 +51,9 @@
"eslint-plugin-react": "7.37.5",
"express": "5.2.1",
"extract-zip": "2.0.1",
"globals": "17.4.0",
"globals": "17.5.0",
"jiti": "2.6.1",
"knex": "3.1.0",
"knex": "3.2.9",
"localforage": "1.10.0",
"lodash.intersection": "4.4.0",
"lodash.mapkeys": "4.6.0",
@@ -66,24 +67,25 @@
"mochawesome": "7.1.4",
"mochawesome-merge": "5.1.1",
"mochawesome-report-generator": "6.3.2",
"moment-timezone": "0.6.0",
"path": "0.12.7",
"moment-timezone": "0.6.1",
"node-polyfill-webpack-plugin": "4.1.0",
"pdf-parse": "2.4.5",
"pg": "8.19.0",
"pg": "8.20.0",
"recursive-readdir": "2.2.3",
"shelljs": "0.10.0",
"timezones.json": "1.7.2",
"typescript": "5.9.3",
"typescript-eslint": "8.56.1",
"ts-loader": "9.5.7",
"typescript": "6.0.2",
"typescript-eslint": "8.58.2",
"uuid": "13.0.0",
"yargs": "18.0.0"
},
"overrides": {
"@mattermost/client": {
"typescript": "^5.0.4"
"typescript": "^6.0.2"
},
"@mattermost/types": {
"typescript": "^5.0.4"
"typescript": "^6.0.2"
}
},
"scripts": {
@@ -10,8 +10,8 @@
// Stage: @prod
// Group: @channels @accessibility @mfa
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {isMac} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {isMac} from '@/utils';
describe('Verify Accessibility Support in different sections in Settings and Profile Dialog', () => {
const accountSettings = {
@@ -9,7 +9,7 @@
// Group: @channels @accessibility
import {getRandomId} from '../../../utils';
import {getRandomId} from '@/utils';
function postMessages(testChannel, otherUser, count) {
for (let index = 0; index < count; index++) {
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @accessibility
import {getRandomId} from '../../../utils';
import {getRandomId} from '@/utils';
function postMessages(testChannel, otherUser, count) {
for (let index = 0; index < count; index++) {
@@ -10,8 +10,8 @@
// Stage: @prod
// Group: @channels @accessibility
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Verify Accessibility Support in Post', () => {
let testUser;
@@ -9,7 +9,7 @@
// Group: @channels @accessibility @smoke
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Verify Accessibility Support in Channel Sidebar Navigation', () => {
let testUser;
@@ -10,17 +10,17 @@
// Stage: @prod
// Group: @channels @accessibility @smoke
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Verify Accessibility Support in Channel Sidebar Navigation', () => {
let testUser;
let testTeam;
let testChannel;
let offTopicUrl;
let testUser: Cypress.UserProfile;
let testTeam: Cypress.Team;
let testChannel: Cypress.Channel;
let offTopicUrl: string;
before(() => {
let otherUser;
let otherChannel;
let otherUser: Cypress.UserProfile;
let otherChannel: Cypress.Channel;
cy.apiInitSetup({promoteNewUserAsAdmin: true}).then(({team, channel, user, offTopicUrl: url}) => {
testUser = user;
@@ -238,7 +238,7 @@ describe('Accessibility tests for RHS getting focus after buttons actions', () =
});
});
function markAsFavorite(channelName) {
function markAsFavorite(channelName: string) {
// # Visit the channel
cy.get(`#sidebarItem_${channelName}`).click();
cy.get('#postListContent').should('be.visible');
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @account_setting
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Profile > Profile Settings', () => {
let otherUser: Cypress.UserProfile;
@@ -65,7 +65,7 @@ describe('Profile > Profile Settings > Position', () => {
minPositionHeader().click();
maxPositionInput().invoke('val').then((val) => {
// * Verify that the input value is 128 characters
expect(val.toString().length).to.equal(128);
expect(val!.toString().length).to.equal(128);
});
// # Try to edit the field with maximum characters
@@ -9,14 +9,14 @@
// Group: @channels @account_setting
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import {reUrl, getRandomId} from '../../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {reUrl, getRandomId} from '@/utils';
describe('Profile > Profile Settings > Email', () => {
let siteName;
let siteName: string;
let testUser: Cypress.UserProfile;
let otherUser;
let offTopicUrl;
let otherUser: Cypress.UserProfile;
let offTopicUrl: string;
let origConfig: Cypress.AdminConfig;
before(() => {
@@ -11,7 +11,7 @@
// Group: @channels @account_setting
describe('Profile > Profile Settings > Full Name', () => {
let testUser;
let testUser: Cypress.UserProfile;
before(() => {
// # Login as new user and visit off-topic
@@ -10,11 +10,11 @@
// Stage: @prod
// Group: @channels @account_setting
import {getRandomId} from '../../../../utils';
import {getRandomId} from '@/utils';
describe('Profile > Profile Settings> Full Name', () => {
let firstUser;
let secondUser;
let firstUser: Cypress.UserProfile;
let secondUser: Cypress.UserProfile;
const firstName = 'This Is a Long Name';
const lastName = 'That Should Truncate';
@@ -10,11 +10,11 @@
// Stage: @prod
// Group: @channels @account_setting
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Settings > Sidebar > General', () => {
let testUser;
let testTeam;
let testUser: Cypress.UserProfile;
let testTeam: Cypress.Team;
before(() => {
// # Login as new user and visit off-topic
@@ -176,7 +176,7 @@ describe('Settings > Sidebar > General', () => {
cy.uiClose();
});
function getInnerText(el) {
function getInnerText(el: JQuery<HTMLElement>) {
return el[0].innerText.replace(/\n/g, '').replace(/\s/g, ' ');
}
});
@@ -4,7 +4,7 @@
// Stage: @prod
// Group: @channels @account_setting
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Profile Settings', () => {
beforeEach(() => {
@@ -49,13 +49,13 @@ describe('Profile Settings', () => {
function getProfilePictureId() {
return cy.uiGetProfileHeader().find('.Avatar').invoke('attr', 'src').then((urlString) => {
const url = new URL(urlString);
const url = new URL(urlString!);
const params = new URLSearchParams(url.search);
return params.get('_');
});
}
function setInitialPicture(user) {
function setInitialPicture(user: Cypress.UserProfile) {
cy.apiUploadFile('image', 'mattermost-icon.png', {
url: `/api/v4/users/${user.id}/image`,
method: 'POST',
@@ -64,7 +64,7 @@ function setInitialPicture(user) {
}
function verifyProfilePictureDoesNotUpdateAfterCancel() {
let idOld;
let idOld: string | null | undefined;
cy.visit('/');
@@ -13,7 +13,7 @@
// TODO: Remove import once e2e/cypress/tests/support/index.ts is converted to Typescript.
import 'cypress-file-upload';
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Profile > Profile Settings > Profile Picture', () => {
before(() => {
@@ -10,14 +10,14 @@
// Stage: @prod
// Group: @channels @account_setting
import {getRandomId} from '../../../../utils';
import {getRandomId} from '@/utils';
describe('Settings > Sidebar > General > Edit', () => {
let testTeam;
let testUser;
let testChannel;
let otherUser;
let offTopicUrl;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
let testChannel: Cypress.Channel;
let otherUser: Cypress.UserProfile;
let offTopicUrl: string;
before(() => {
// # Login as admin and visit off-topic
@@ -86,7 +86,7 @@ describe('Settings > Sidebar > General > Edit', () => {
});
it('MM-T2053 Username w/ dot, dash, underscore still searches', () => {
let tempUser;
let tempUser: Cypress.UserProfile;
// # Create a temporary user
cy.apiCreateUser({prefix: 'temp'}).then(({user: user1}) => {
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @account_setting
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Profile > Security > View and Log Out of Active Sessions', () => {
const platforms = [
@@ -12,8 +12,8 @@
import moment from 'moment-timezone';
import * as TIMEOUTS from '../../../../fixtures/timeouts';
import {newTestPassword} from '../../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {newTestPassword} from '@/utils';
describe('Profile', () => {
let siteName: string;
@@ -147,7 +147,7 @@ describe('Profile', () => {
});
});
function enterPasswords(currentPassword, newPassword, confirmPassword) {
function enterPasswords(currentPassword: string, newPassword: string, confirmPassword: string) {
// # Enter Current password
cy.get('#currentPassword').should('be.visible').type(currentPassword);
@@ -14,11 +14,10 @@
// Group: @channels @enterprise @ldap @saml @keycloak
import {LdapUser} from 'tests/support/ldap_server_commands';
import {getAdminAccount} from '../../../support/env';
import {getRandomId} from '../../../utils';
import {getKeycloakServerSettings} from '../../../utils/config';
import {LdapUser} from '@/support/ldap_server_commands';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
import {getKeycloakServerSettings} from '@/utils/config';
describe('AD / LDAP', () => {
let samlLdapUser: LdapUser;
@@ -47,7 +46,7 @@ describe('AD / LDAP', () => {
cy.apiUploadSAMLIDPCert('keycloak.crt');
// # Create Keycloak user and login for the first time
cy.keycloakCreateUsers([samlLdapUser]);
cy.keycloakCreateUsers([samlLdapUser] as LdapUser[]);
cy.doKeycloakLogin(samlLdapUser);
// # Wait for the UI to be ready which indicates SAML registration is complete
@@ -14,9 +14,9 @@
// Group: @channels @enterprise @ldap @saml @keycloak
import {getAdminAccount} from '../../../support/env';
import {generateLDAPUser, LdapUser} from '../../../support/ldap_server_commands';
import {getKeycloakServerSettings} from '../../../utils/config';
import {getAdminAccount} from '@/support/env';
import {generateLDAPUser, LdapUser} from '@/support/ldap_server_commands';
import {getKeycloakServerSettings} from '@/utils/config';
describe('AD / LDAP', () => {
const nonLDAPUser = generateLDAPUser();
@@ -51,7 +51,7 @@ describe('AD / LDAP', () => {
cy.apiUploadSAMLIDPCert('keycloak.crt');
// # Create Keycloak user and login for the first time
cy.keycloakCreateUsers([samlLdapUser, nonLDAPUser]);
cy.keycloakCreateUsers([samlLdapUser, nonLDAPUser] as LdapUser[]);
cy.doKeycloakLogin(samlLdapUser);
@@ -14,11 +14,10 @@
// Group: @channels @enterprise @ldap @saml @keycloak
import {LdapUser} from 'tests/support/ldap_server_commands';
import {getAdminAccount} from '../../../support/env';
import {getRandomId} from '../../../utils';
import {getKeycloakServerSettings} from '../../../utils/config';
import {LdapUser} from '@/support/ldap_server_commands';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
import {getKeycloakServerSettings} from '@/utils/config';
describe('AD / LDAP', () => {
const admin = getAdminAccount();
@@ -49,7 +48,7 @@ describe('AD / LDAP', () => {
cy.apiUploadSAMLIDPCert('keycloak.crt');
// # Create Keycloak user and login for the first time
cy.keycloakCreateUsers([samlLdapUser]);
cy.keycloakCreateUsers([samlLdapUser] as LdapUser[]);
cy.doKeycloakLogin(samlLdapUser);
// # Wait for the UI to be ready which indicates SAML registration is complete
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @channel
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Archived channels', () => {
before(() => {
@@ -9,12 +9,12 @@
// Group: @channels @channel
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Archived channels', () => {
let testTeam;
let testUser;
let otherUser;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
let otherUser: Cypress.UserProfile;
before(() => {
// # Login as test user and visit created channel
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @channel
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Archived channels', () => {
before(() => {
@@ -10,14 +10,15 @@
// Stage: @prod
// Group: @channels @channel
import {getRandomId} from '../../../utils';
import {createArchivedChannel} from './helpers';
import {getRandomId} from '@/utils';
describe('archive channel search tests', () => {
let testTeam;
let testChannel;
let testUser;
let testTeam: Cypress.Team;
let testChannel: Cypress.Channel;
let testUser: Cypress.UserProfile;
const testArchivedMessage = `this is an archived post ${getRandomId()}`;
before(() => {
@@ -1,23 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
export function createArchivedChannel(channelOptions, messages, memberUsernames?) {
export function createArchivedChannel(channelOptions: Record<string, unknown>, messages: string[], memberUsernames?: string[]) {
return cy.uiCreateChannel(channelOptions).then((newChannel) => {
if (memberUsernames) {
cy.uiAddUsersToCurrentChannel(memberUsernames);
}
if (messages) {
let messageList = messages;
if (!Array.isArray(messages)) {
messageList = [messages];
}
messageList.forEach((message) => {
cy.postMessage(message);
});
}
messages.forEach((message) => {
cy.postMessage(message);
});
cy.uiArchiveChannel();
@@ -9,12 +9,12 @@
// Group: @channels @channel
import {getAdminAccount} from '../../../support/env';
import {getRandomId} from '../../../utils';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
describe('Archived channels', () => {
let testTeam;
let testUser;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
before(() => {
cy.apiInitSetup().then(({team, user}) => {
@@ -99,7 +99,7 @@ describe('Archived channels', () => {
});
});
function verifyViewingArchivedChannel(channel) {
function verifyViewingArchivedChannel(channel: Cypress.Channel) {
// * Verify that we've switched to the correct channel and that the header contains the archived icon
cy.get('#channelHeaderTitle').should('contain', channel.display_name);
cy.findByTestId('channel-header-archive-icon').should('be.visible');
@@ -112,7 +112,7 @@ function verifyViewingArchivedChannel(channel) {
cy.get('#channelArchivedMessage').should('be.visible');
}
function verifyUsername(username) {
function verifyUsername(username: string) {
// * Verify that we've logged in as the test user
cy.uiOpenUserMenu().findByText(`@${username}`);
@@ -11,7 +11,7 @@
// Group: @channels @channel
describe('Leaving archived channels', () => {
let testTeam;
let testTeam: Cypress.Team;
before(() => {
cy.apiInitSetup({loginAfter: true}).then(({team}) => {
@@ -10,14 +10,14 @@
// Stage: @prod
// Group: @channels @system_console @authentication
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId, newTestPassword} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId, newTestPassword} from '@/utils';
describe('Authentication', () => {
const restrictCreationToDomains = 'mattermost.com, test.com';
let testUser;
let testUserAlreadyInTeam;
let testTeam;
let testUser: Cypress.UserProfile;
let testUserAlreadyInTeam: Cypress.UserProfile;
let testTeam: Cypress.Team;
before(() => {
// # Do email test if setup properly
@@ -10,8 +10,8 @@
// Stage: @prod
// Group: @channels @system_console @authentication @mfa
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Authentication', () => {
beforeEach(() => {
@@ -10,11 +10,11 @@
// Stage: @prod
// Group: @channels @system_console @authentication
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {reUrl, getRandomId, newTestPassword} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {reUrl, getRandomId, newTestPassword} from '@/utils';
describe('Authentication', () => {
let testUser;
let testUser: Cypress.UserProfile;
before(() => {
// # Do email test if setup properly
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @system_console @authentication @not_cloud
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Authentication', () => {
before(() => {
@@ -9,7 +9,7 @@
// Group: @channels @system_console @authentication
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Authentication', () => {
before(() => {
@@ -73,7 +73,7 @@ export function doTestDMChannelSidebar(testUsers: Record<string, SimpleUser>) {
}).as('searchUsers');
cy.wait('@searchUsers').then((interception) => {
expect(interception.response.body.length === 1);
expect(interception.response?.body).to.have.length(1);
});
// * There should only be one result
@@ -10,10 +10,11 @@
// Stage: @prod
// Group: @channels @autocomplete
import {getRandomLetter} from '../../../../utils';
import {doTestQuickChannelSwitcher} from '../common_test';
import {createSearchData, SimpleUser} from '../helpers';
import {getRandomLetter} from '@/utils';
describe('Autocomplete with Database - Users', () => {
const prefix = getRandomLetter(3);
let testUsers: Record<string, SimpleUser>;
@@ -10,10 +10,11 @@
// Stage: @prod
// Group: @channels @autocomplete
import {getRandomLetter} from '../../../../utils';
import {doTestPostextbox} from '../common_test';
import {createSearchData, SimpleUser} from '../helpers';
import {getRandomLetter} from '@/utils';
describe('Autocomplete with Database - Users', () => {
const prefix = getRandomLetter(3);
let testUsers: Record<string, SimpleUser>;
@@ -10,10 +10,11 @@
// Stage: @prod
// Group: @channels @autocomplete
import {getRandomLetter} from '../../../../utils';
import {doTestDMChannelSidebar, doTestUserChannelSection} from '../common_test';
import {createSearchData, SimpleUser} from '../helpers';
import {getRandomLetter} from '@/utils';
describe('Autocomplete with Database - Users', () => {
const prefix = getRandomLetter(3);
let testUsers: Record<string, SimpleUser>;
@@ -1,18 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getAdminAccount} from '../../../support/env';
import {newTestPassword} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getAdminAccount} from '@/support/env';
import {newTestPassword} from '@/utils';
export type SimpleUser = Pick<Cypress.UserProfile, 'username' | 'first_name' | 'last_name' | 'nickname' | 'password' | 'email'>;
function createPrivateChannel(teamId: string, userToAdd: Cypress.UserProfile = null) {
function createPrivateChannel(teamId: string, userToAdd: Cypress.UserProfile | null = null) {
// # Create a private channel as sysadmin
return createChannel('P', teamId, userToAdd);
}
function createPublicChannel(teamId: string, userToAdd: Cypress.UserProfile = null) {
function createPublicChannel(teamId: string, userToAdd: Cypress.UserProfile | null = null) {
// # Create a public channel as sysadmin
return createChannel('O', teamId, userToAdd);
}
@@ -38,8 +38,8 @@ function createSearchData(prefix: string) {
}
function getTestUsers(prefix = ''): Record<string, SimpleUser> {
if (Cypress.env('searchTestUsers')) {
return JSON.parse(Cypress.env('searchTestUsers'));
if (Cypress.expose('searchTestUsers')) {
return JSON.parse(Cypress.expose('searchTestUsers'));
}
return {
@@ -189,7 +189,7 @@ function verifySuggestionAtChannelSwitcher(...expectedUsers: SimpleUser[]) {
});
}
function createChannel(channelType: string, teamId: string, userToAdd: Cypress.UserProfile = null) {
function createChannel(channelType: string, teamId: string, userToAdd: Cypress.UserProfile | null = null) {
// # Create a channel as sysadmin
return cy.externalRequest({
user: getAdminAccount(),
@@ -9,7 +9,7 @@
// Group: @channels @messaging @benchmark
import {reportBenchmarkResults} from '../../../utils/benchmark';
import {reportBenchmarkResults} from '@/utils/benchmark';
describe('Message', () => {
before(() => {
@@ -14,7 +14,7 @@ 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 * as TIMEOUTS from '@/fixtures/timeouts';
describe('Bot accounts ownership and API', () => {
let newTeam: Team;
@@ -45,7 +45,8 @@ describe('Bot accounts ownership and API', () => {
// # Create a test bot
cy.apiCreateBot().then(({bot}) => {
({user_id: botId, display_name: botName} = bot);
botId = bot.user_id;
botName = bot.display_name!;
cy.apiPatchUserRoles(bot.user_id, ['system_admin', 'system_user']);
});
});
@@ -14,7 +14,7 @@ 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 * as TIMEOUTS from '@/fixtures/timeouts';
describe('Bot accounts ownership and API', () => {
let newTeam: Team;
@@ -49,7 +49,9 @@ describe('Bot accounts ownership and API', () => {
// # Create a test bot
cy.apiCreateBot().then(({bot}) => {
({user_id: botId, username: botUsername, display_name: botName} = bot);
botId = bot.user_id;
botUsername = bot.username;
botName = bot.display_name!;
cy.apiPatchUserRoles(bot.user_id, ['system_admin', 'system_user']);
});
});
@@ -66,7 +68,7 @@ describe('Bot accounts ownership and API', () => {
const msg1 = 'this is a bot message ' + botName;
// # Create a post
cy.apiCreatePost(channel.id, msg1 + ' to @sysadmin', '', {}, token);
cy.apiCreatePost(channel.id, msg1 + ' to @sysadmin', '', {}, token!);
// # Re-login to validate post presence
cy.apiAdminLogin();
@@ -87,7 +89,7 @@ describe('Bot accounts ownership and API', () => {
const msg1 = 'this is a bot message ' + botName;
// # Post test message
cy.postBotMessage({message: msg1, token, channelId: channel.id});
cy.postBotMessage({message: msg1, token: token!, channelId: channel.id});
// # Validate post presence
cy.visit(`/${newTeam.name}/channels/` + channel.name);
@@ -104,7 +106,7 @@ describe('Bot accounts ownership and API', () => {
// # Create token for the bot
cy.apiAccessToken(botId, 'some text').then(({token}) => {
const msg1 = 'this is a bot message ' + botName;
cy.postBotMessage({channelId: newChannel.id, message: msg1, props: {attachments: [{pretext: 'Look some text', text: 'This is text'}]}, token});
cy.postBotMessage({channelId: newChannel.id, message: msg1, props: {attachments: [{pretext: 'Look some text', text: 'This is text'}]}, token: token!});
// # Visit test channel
cy.visit(`/${newTeam.name}/channels/` + newChannel.name);
@@ -120,7 +122,7 @@ describe('Bot accounts ownership and API', () => {
cy.apiUpdateConfig(newSettings);
const msg2 = 'this is a bot message2 ' + botName;
cy.postBotMessage({channelId: newChannel.id, message: msg2, props: {attachments: [{pretext: 'Look some text', text: 'This is text'}]}, token});
cy.postBotMessage({channelId: newChannel.id, message: msg2, props: {attachments: [{pretext: 'Look some text', text: 'This is text'}]}, token: token!});
cy.visit(`/${newTeam.name}/channels/` + newChannel.name);
@@ -161,7 +163,7 @@ describe('Bot accounts ownership and API', () => {
const msg1 = 'this is a bot message ' + botName;
// # Create a post
cy.postBotMessage({channelId: channel.id, message: msg1, token});
cy.postBotMessage({channelId: channel.id, message: msg1, token: token!});
cy.visit(`/${newTeam.name}/channels/` + channel.name);
@@ -182,7 +184,7 @@ describe('Bot accounts ownership and API', () => {
cy.apiLogout();
// # Create a post
cy.postBotMessage({channelId: channel.id, message: msg2, token, failOnStatus: false}).then(({status}) => {
cy.postBotMessage({channelId: channel.id, message: msg2, token: token!, failOnStatus: false}).then(({status}) => {
// * Validate that posting failed
expect(status).to.equal(401);
});
@@ -196,7 +198,7 @@ describe('Bot accounts ownership and API', () => {
// # Try to post again
// * Validate that posting works
cy.postBotMessage({channelId: channel.id, message: msg2, token});
cy.postBotMessage({channelId: channel.id, message: msg2, token: token!});
// * Validate post presence
cy.visit(`/${newTeam.name}/channels/` + channel.name);
@@ -217,7 +219,7 @@ describe('Bot accounts ownership and API', () => {
const msg1 = 'this is a bot message ' + botName;
// # Create a post
cy.postBotMessage({channelId: channel.id, message: msg1, token});
cy.postBotMessage({channelId: channel.id, message: msg1, token: token!});
// # Validate post presence
cy.visit(`/${newTeam.name}/channels/` + channel.name);
@@ -232,7 +234,7 @@ describe('Bot accounts ownership and API', () => {
cy.findByText(`${botName} (@${botUsername})`).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
cy.get(`#${id}_deactivate`).click();
});
@@ -240,7 +242,7 @@ describe('Bot accounts ownership and API', () => {
const msg2 = 'this is a bot message2 ' + botName;
// # Create a post
cy.postBotMessage({channelId: channel.id, message: msg2, token, failOnStatus: false}).then(({status}) => {
cy.postBotMessage({channelId: channel.id, message: msg2, token: token!, failOnStatus: false}).then(({status}) => {
// * Validate that posting failed
expect(status).to.equal(401);
});
@@ -251,12 +253,12 @@ describe('Bot accounts ownership and API', () => {
cy.findByText(`${botName} (@${botUsername})`).scrollIntoView().then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
cy.get(`#${id}_activate`).click().wait(TIMEOUTS.ONE_SEC);
// # Try to post again
// * Validate that posting works
cy.postBotMessage({channelId: channel.id, message: msg2, token});
cy.postBotMessage({channelId: channel.id, message: msg2, token: token!});
// # Validate post presence
cy.visit(`/${newTeam.name}/channels/` + channel.name);
@@ -278,7 +280,7 @@ describe('Bot accounts ownership and API', () => {
const msg1 = 'this is a bot message ' + botName;
// # Create a post
cy.postBotMessage({channelId: channel.id, message: msg1, token});
cy.postBotMessage({channelId: channel.id, message: msg1, token: token!});
// # Validate post presence
cy.visit(`/${newTeam.name}/channels/` + channel.name);
@@ -293,7 +295,7 @@ describe('Bot accounts ownership and API', () => {
cy.findByText(`${botName} (@${botUsername})`).scrollIntoView().then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Delete token
cy.get(`#${id}_delete`).click();
@@ -303,7 +305,7 @@ describe('Bot accounts ownership and API', () => {
const msg2 = 'this is a bot message2 ' + botName;
// # Create a post
cy.postBotMessage({channelId: channel.id, message: msg2, token, failOnStatus: false}).then(({status}) => {
cy.postBotMessage({channelId: channel.id, message: msg2, token: token!, failOnStatus: false}).then(({status}) => {
// * Validate that posting failed
expect(status).to.equal(401);
});
@@ -12,7 +12,7 @@
import {Team} from '@mattermost/types/teams';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Bot accounts ownership and API', () => {
let newTeam: Team;
@@ -13,7 +13,7 @@
import {Bot} from '@mattermost/types/bots';
import {Team} from '@mattermost/types/teams';
import {createBotPatch} from '../../../support/api/bots';
import {createBotPatch} from '@/support/api/bots';
describe('Bot channel intro and avatar', () => {
let team: Team;
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @bot_accounts
import {getRandomId} from '../../../utils';
import {getRandomId} from '@/utils';
describe('Create bot', () => {
it('MM-T1810 Create a Bot via the UI', () => {
@@ -12,10 +12,11 @@
import {Team} from '@mattermost/types/teams';
import {getRandomId} from '../../../utils';
import {createBotInteractive} from './helpers';
import {getRandomId} from '@/utils';
describe('Bot accounts - CRUD Testing', () => {
let newTeam: Team;
@@ -57,24 +58,24 @@ describe('Bot accounts - CRUD Testing', () => {
// * Check that the previously created bot is listed
cy.findByText(`Test Bot (@${botUsername})`).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Click the 'Create token' button
cy.wrap(el[0].parentElement.parentElement).findByText('Create New Token').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Create New Token').should('be.visible').click();
// # Add description
cy.wrap(el[0].parentElement.parentElement).find('input').click().type('description!');
cy.wrap(el[0].parentElement!.parentElement!).find('input').click().type('description!');
// # Save
cy.findByTestId('saveSetting').click();
// # Click Close button
cy.wrap(el[0].parentElement.parentElement).findByText('Close').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Close').should('be.visible').click();
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// * Check that token is visible
cy.wrap(el[0].parentElement.parentElement).findAllByText(/Token ID:/).should('have.length', 2);
cy.wrap(el[0].parentElement!.parentElement!).findAllByText(/Token ID:/).should('have.length', 2);
});
});
});
@@ -13,10 +13,11 @@
import {Bot} from '@mattermost/types/bots';
import {Team} from '@mattermost/types/teams';
import {getRandomId} from '../../../utils';
import {createBotInteractive} from './helpers';
import {getRandomId} from '@/utils';
describe('Bot accounts - CRUD Testing', () => {
let newTeam: Team;
let testBot: Bot & {fullDisplayName: string};
@@ -43,10 +44,10 @@ describe('Bot accounts - CRUD Testing', () => {
// * Check that the previously created bot is listed
cy.findByText(testBot.fullDisplayName).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Click the edit button
cy.wrap(el[0].parentElement.parentElement).findByText('Edit').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Edit').should('be.visible').click();
// * Validate redirect to edit screen
cy.url().should('include', `/${newTeam.name}/integrations/bots/edit`);
@@ -82,10 +83,10 @@ describe('Bot accounts - CRUD Testing', () => {
// * Check that the previously created bot is listed
cy.findByText(testBot.fullDisplayName).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Click the edit button
cy.wrap(el[0].parentElement.parentElement).findByText('Edit').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Edit').should('be.visible').click();
// * Validate redirect to edit screen
cy.url().should('include', `/${newTeam.name}/integrations/bots/edit`);
@@ -122,7 +123,7 @@ describe('Bot accounts - CRUD Testing', () => {
// * Check that the previously created bot is listed
cy.findByText(`Test Bot (@${botUsername})`).then((el) => {
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// * Validate that token is NOT visible on the next page
const token = text.substr(text.indexOf('Token: ') + 7, 26);
@@ -138,20 +139,20 @@ describe('Bot accounts - CRUD Testing', () => {
// * Check that the previously created bot is listed
cy.findByText(testBot.fullDisplayName).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Click the 'Create token' button
cy.wrap(el[0].parentElement.parentElement).findByText('Create New Token').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Create New Token').should('be.visible').click();
// # Try saving without description
cy.findByTestId('saveSetting').click();
cy.wrap(el[0].parentElement.parentElement).find('input').scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).find('input').scrollIntoView();
// * Check for error message
cy.get('#clientError').should('be.visible');
// # Add description
cy.wrap(el[0].parentElement.parentElement).find('input').click().type(testBot.username + 'description!');
cy.wrap(el[0].parentElement!.parentElement!).find('input').click().type(testBot.username + 'description!');
// # Save and check that no error is visible
cy.findByTestId('saveSetting').click();
@@ -169,33 +170,33 @@ describe('Bot accounts - CRUD Testing', () => {
// * Check that the previously created bot is listed
cy.findByText(testBot.fullDisplayName).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Click the 'Create token' button
cy.wrap(el[0].parentElement.parentElement).findByText('Create New Token').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Create New Token').should('be.visible').click();
// # Add description
cy.wrap(el[0].parentElement.parentElement).find('input').click().type('description!');
cy.wrap(el[0].parentElement!.parentElement!).find('input').click().type('description!');
// # Save
cy.findByTestId('saveSetting').click();
// # Click Close button
cy.wrap(el[0].parentElement.parentElement).findByText('Close').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Close').should('be.visible').click();
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// * Check that token is visible
cy.wrap(el[0].parentElement.parentElement).findByText(/Token ID:/).should('be.visible');
cy.wrap(el[0].parentElement!.parentElement!).findByText(/Token ID:/).should('be.visible');
// # Click Delete button
cy.wrap(el[0].parentElement.parentElement).findByText('Delete').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).findByText('Delete').should('be.visible').click();
// * Validate that confirmation dialog is visible and click the delete button
cy.get('#confirmModalButton').should('be.visible').click();
// * Check that token is not visible
cy.wrap(el[0].parentElement.parentElement).findByText(/Token ID:/).should('not.exist');
cy.wrap(el[0].parentElement!.parentElement!).findByText(/Token ID:/).should('not.exist');
});
});
});
@@ -9,7 +9,6 @@
// Group: @channels @bot_accounts
import {Bot} from '@mattermost/types/bots';
import {Channel} from '@mattermost/types/channels';
import {UserProfile} from '@mattermost/types/users';
@@ -60,7 +59,7 @@ describe('Bot display name', () => {
// # Post message as bot through api with auth token
const props = {attachments: [{pretext: 'Some Pretext', text: 'Some Text'}]};
cy.postBotMessage({token, message: firstMessage, props, channelId: offTopicChannel.id}).
cy.postBotMessage({token: token!, message: firstMessage, props, channelId: offTopicChannel.id}).
its('id').
should('exist').
as('botPost');
@@ -80,8 +79,8 @@ describe('Bot display name', () => {
should('have.text', bot.display_name);
}).then(() => {
// # Change display name after prior verification
cy.wrap(client.patchBot(bot.user_id, {display_name: `NEW ${bot.display_name}`})).then((newBot: Bot) => {
cy.postBotMessage({token, message: secondMessage, props, channelId: offTopicChannel.id}).
cy.wrap(client.patchBot(bot.user_id, {display_name: `NEW ${bot.display_name}`})).then(() => {
cy.postBotMessage({token: token!, message: secondMessage, props, channelId: offTopicChannel.id}).
its('id').
should('exist').
as('newBotPost');
@@ -93,7 +92,7 @@ describe('Bot display name', () => {
should('be.visible');
cy.findByTestId(`popover-fullname-${bot.username}`).
should('have.text', newBot.display_name);
should('have.text', `NEW ${bot.display_name}`);
});
});
});
@@ -12,8 +12,8 @@
import {Team} from '@mattermost/types/teams';
import * as MESSAGES from '../../../fixtures/messages';
import {getRandomId} from '../../../utils';
import * as MESSAGES from '@/fixtures/messages';
import {getRandomId} from '@/utils';
describe('Edit bot', () => {
let testTeam: Team;
@@ -69,7 +69,7 @@ describe('Edit bot', () => {
});
});
function createBot(userName, teamName) {
function createBot(userName: string, teamName: string) {
// # Go to bot integrations page
cy.uiOpenProductMenu('Integrations');
cy.get('a.integration-option[href$="/bots"]').click();
@@ -12,8 +12,8 @@
import {Team} from '@mattermost/types/teams';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Edit bot username', () => {
let team: Team;
@@ -74,6 +74,10 @@ describe('Edit bot username', () => {
}
return cy.wrap(null);
}).then((newBotName) => {
if (!newBotName) {
throw new Error('Expected edited bot username to be returned');
}
// * Set alias for bot entry in bot list, this also checks that the bot entry exists
cy.get('.backstage-list__item').contains('.backstage-list__item', newBotName).as('newbotEntry');
@@ -3,8 +3,8 @@
import {Team} from '@mattermost/types/teams';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
export function createBotInteractive(team: Team, username = `bot-${getRandomId()}`) {
// # Visit the Integrations > Bot Accounts page
@@ -15,9 +15,9 @@ import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {createBotPatch} from '../../../support/api/bots';
import {generateRandomUser} from '../../../support/api/user';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {createBotPatch} from '@/support/api/bots';
import {generateRandomUser} from '@/support/api/user';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Bots in lists', () => {
let team: Team;
@@ -14,15 +14,15 @@ import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {createBotPatch} from '../../../support/api/bots';
import {generateRandomUser} from '../../../support/api/user';
import {createBotPatch} from '@/support/api/bots';
import {generateRandomUser} from '@/support/api/user';
describe('Bots in lists', () => {
let team: Team;
let channel: Channel;
let testUser: UserProfile;
const STATUS_PRIORITY = {
const STATUS_PRIORITY: Record<string, number> = {
online: 0,
away: 1,
dnd: 2,
@@ -40,9 +40,9 @@ describe('Bots in lists', () => {
cy.makeClient().then(async (client) => {
// # Create bots
const bots = await Promise.all([
client.createBot(createBotPatch()),
client.createBot(createBotPatch()),
client.createBot(createBotPatch()),
client.createBot(createBotPatch() as Partial<Bot>),
client.createBot(createBotPatch() as Partial<Bot>),
client.createBot(createBotPatch() as Partial<Bot>),
]);
// # Create users
@@ -87,7 +87,7 @@ describe('Bots in lists', () => {
// # Sort 'em
const sortedUsers = Cypress._.sortBy(users, [
({is_bot: isBot}) => (isBot ? 1 : 0), // users first
({status}) => STATUS_PRIORITY[status],
({status}) => STATUS_PRIORITY[status ?? 'offline'],
({username}) => username,
]);
@@ -13,8 +13,8 @@
import {Team} from '@mattermost/types/teams';
import {Channel} from '@mattermost/types/channels';
import {createBotPatch} from '../../../support/api/bots';
import {createChannelPatch} from '../../../support/api/channel';
import {createBotPatch} from '@/support/api/bots';
import {createChannelPatch} from '@/support/api/channel';
describe('Managing bots in Teams and Channels', () => {
let team: Team;
@@ -12,8 +12,8 @@
import {Team} from '@mattermost/types/teams';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {matterpollPlugin} from '../../../utils/plugins';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {matterpollPlugin} from '@/utils/plugins';
describe('Managing bot accounts', () => {
let newTeam: Team;
@@ -59,7 +59,7 @@ describe('Managing bot accounts', () => {
cy.visit(`/${newTeam.name}/integrations/bots`);
// # Search for the other bot
cy.get('#searchInput', {timeout: TIMEOUTS.ONE_MIN}).type(bot.display_name);
cy.get('#searchInput', {timeout: TIMEOUTS.ONE_MIN}).type(bot.display_name!);
// * Validate that the plugin is still active, even though its owner is disabled
cy.get('.bot-list__disabled').should('not.exist');
@@ -12,8 +12,8 @@
import {Team} from '@mattermost/types/teams';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Managing bot accounts', () => {
let newTeam: Team;
@@ -106,7 +106,7 @@ describe('Managing bot accounts', () => {
// * Check that the previously created bot is listed
cy.findByText(bot.fullDisplayName, {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView().then((el) => {
// # Click the disable button
cy.wrap(el[0].parentElement.parentElement).find('button:nth-child(3)').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).find('button:nth-child(3)').should('be.visible').click();
});
// * Check that the bot is in the 'disabled' section
@@ -122,7 +122,7 @@ describe('Managing bot accounts', () => {
// * Check that the previously created bot is listed
cy.findByText(bot.fullDisplayName, {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView().then((el) => {
// # Click the disable button
cy.wrap(el[0].parentElement.parentElement).find('button:nth-child(3)').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).find('button:nth-child(3)').should('be.visible').click();
});
// # Filter bot
@@ -131,7 +131,7 @@ describe('Managing bot accounts', () => {
// # Re-enable the bot
cy.get('.bot-list__disabled').scrollIntoView().findByText(bot.fullDisplayName, {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView().then((el) => {
// # Click the enable button
cy.wrap(el[0].parentElement.parentElement).find('button:nth-child(1)').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).find('button:nth-child(1)').should('be.visible').click();
});
// * Check that the bot is in the 'enabled' section
@@ -148,10 +148,10 @@ describe('Managing bot accounts', () => {
// * Check that the previously created bot is listed
cy.findByText(bot.fullDisplayName, {timeout: TIMEOUTS.ONE_MIN}).then((el) => {
// # Make sure it's on the screen
cy.wrap(el[0].parentElement.parentElement).scrollIntoView();
cy.wrap(el[0].parentElement!.parentElement!).scrollIntoView();
// # Click the disable button
cy.wrap(el[0].parentElement.parentElement).find('button:nth-child(3)').should('be.visible').click();
cy.wrap(el[0].parentElement!.parentElement!).find('button:nth-child(3)').should('be.visible').click();
});
// * Validate that disabled section appears
@@ -185,7 +185,7 @@ describe('Managing bot accounts', () => {
cy.visit(`/${newTeam.name}/integrations/bots`);
// # Search for the other bot
cy.get('#searchInput', {timeout: TIMEOUTS.ONE_MIN}).type(bot.display_name);
cy.get('#searchInput', {timeout: TIMEOUTS.ONE_MIN}).type(bot.display_name!);
// * Validate that the plugin is disabled since it's owner is deactivate
cy.get('.bot-list__disabled').scrollIntoView().findByText(bot.fullDisplayName).scrollIntoView().should('be.visible');
@@ -37,7 +37,7 @@ describe('Bot post message', () => {
// # Post message as bot through api with auth token
const props = {attachments: [{pretext: 'Some Pretext', text: 'Some Text'}]};
cy.postBotMessage({token, message, props, channelId: offTopicChannel.id}).
cy.postBotMessage({token: token!, message, props, channelId: offTopicChannel.id}).
its('id').
should('exist').
as('botPost');
@@ -12,7 +12,7 @@
import {Team} from '@mattermost/types/teams';
import {createBotPatch} from '../../../support/api/bots';
import {createBotPatch} from '@/support/api/bots';
describe('Managing bots in Teams and Channels', () => {
let team: Team;
@@ -15,8 +15,8 @@ import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {createBotPatch} from '../../../support/api/bots';
import {generateRandomUser} from '../../../support/api/user';
import {createBotPatch} from '@/support/api/bots';
import {generateRandomUser} from '@/support/api/user';
describe('Bot accounts', () => {
let team: Team;
@@ -10,12 +10,13 @@
// Stage: @prod
// Group: @channels @bot_accounts
import {Bot} from '@mattermost/types/bots';
import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {createBotPatch} from '../../../support/api/bots';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {createBotPatch} from '@/support/api/bots';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Bot tags', () => {
let me: UserProfile;
@@ -29,7 +30,7 @@ describe('Bot tags', () => {
channel = out.channel;
});
let meId;
let meId: string;
cy.getCurrentUserId().then((id) => {
meId = id;
@@ -38,7 +39,7 @@ describe('Bot tags', () => {
cy.makeClient().then(async (client) => {
// # Setup state
me = await client.getUser(meId);
const bot = await client.createBot(createBotPatch());
const bot = await client.createBot(createBotPatch() as Partial<Bot>);
await client.addToTeam(team.id, bot.user_id);
await client.addToChannel(bot.user_id, channel.id);
@@ -48,7 +49,7 @@ describe('Bot tags', () => {
// # Post message as bot through api with auth token
const props = {attachments: [{pretext: 'Some Pretext', text: 'Some Text'}]};
cy.postBotMessage({token, message, props, channelId: channel.id}).then(async ({id}) => {
cy.postBotMessage({token: token!, message, props, channelId: channel.id}).then(async ({id}) => {
postId = id;
await client.pinPost(postId);
@@ -13,7 +13,7 @@
import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {getRandomId} from '../../../utils';
import {getRandomId} from '@/utils';
describe('Leave an archived channel', () => {
let testTeam: Team;
@@ -14,8 +14,8 @@ 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';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
describe('Leave an archived channel', () => {
let testTeam: Team;
@@ -45,22 +45,24 @@ describe('Leave an archived channel', () => {
type: 'P',
} as Channel;
cy.wrap(client.createChannel(channelTest)).then(async (channel: ServerChannel) => {
cy.wrap(client.createChannel(channelTest)).then(async (channel: unknown) => {
const ch = channel as ServerChannel;
// # Then invite us to it
await client.addToChannel(testUser.id, channel.id);
await client.addToChannel(testUser.id, ch.id);
return channel;
return ch;
}).then((channel) => {
// * Verify that the newly created channel is in the sidebar
cy.get(`#sidebarItem_${channel.name}`).should('be.visible');
cy.wrap(channel);
}).then(async (channel) => {
const ch = channel as ServerChannel;
// # Then archive the channel
await client.deleteChannel(channel.id);
await client.deleteChannel(ch.id);
// * Verify that the channel is no longer in the sidebar and that the app hasn't crashed
cy.get(`#sidebarItem_${channel.name}`).should('not.exist');
cy.get(`#sidebarItem_${ch.name}`).should('not.exist');
});
});
});
@@ -14,9 +14,11 @@ 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';
import * as TIMEOUTS from '@/fixtures/timeouts';
const channelType = {
all: 'Channel Type: All',
public: 'Channel Type: Public',
@@ -13,15 +13,15 @@ import {UserProfile} from '@mattermost/types/users';
// Stage: @prod
// Group: @channels @channel
function verifyNoChannelToJoinMessage(isVisible) {
function verifyNoChannelToJoinMessage(isVisible: boolean) {
cy.findByText('No public channels').should(isVisible ? 'be.visible' : 'not.exist');
}
function ensureHideJoinedCheckboxEnabled(shouldBeChecked) {
function ensureHideJoinedCheckboxEnabled(shouldBeChecked: boolean) {
cy.get('#hideJoinedPreferenceCheckbox').then(($checkbox) => {
cy.wrap($checkbox).findByText('Hide Joined').should('be.visible');
cy.wrap($checkbox).find('div.get-app__checkbox').invoke('attr', 'class').then(($classList) => {
if ($classList.split(' ').includes('checked') !== Boolean(shouldBeChecked)) {
if ($classList!.split(' ').includes('checked') !== Boolean(shouldBeChecked)) {
// We click on the button only when the XOR operands do not match
// e.g. checkbox is checked, but should not be checked; and vice-versa
cy.wrap($checkbox).click();
@@ -14,8 +14,8 @@ 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';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Channel Bookmarks', () => {
const SpaceKeyCode = 32;
@@ -14,7 +14,7 @@ import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {stubClipboard} from '../../../utils';
import {stubClipboard} from '@/utils';
describe('Channel Info RHS', () => {
let testTeam: Team;
@@ -533,7 +533,7 @@ describe('Channel Info RHS', () => {
});
});
function ensureRHSIsOpenOnChannelInfo(testChannel) {
function ensureRHSIsOpenOnChannelInfo(testChannel: Cypress.Channel) {
cy.get('#rhsContainer').then((rhsContainer) => {
cy.wrap(rhsContainer).findByText('Info').should('be.visible');
cy.wrap(rhsContainer).find('.sidebar--right__title__subtitle').should('contain', testChannel.display_name);
@@ -323,7 +323,7 @@ describe('Channel members RHS', () => {
});
});
function ensureChannelMembersRHSExists(testChannel) {
function ensureChannelMembersRHSExists(testChannel: Cypress.Channel) {
cy.get('#rhsContainer').then((rhsContainer) => {
cy.wrap(rhsContainer).findByText('Members').should('be.visible');
cy.wrap(rhsContainer).findByText(testChannel.display_name).should('be.visible');
@@ -14,7 +14,7 @@ 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 * as TIMEOUTS from '@/fixtures/timeouts';
describe('Channel', () => {
let testTeam: Team;
@@ -14,7 +14,7 @@ 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 * as TIMEOUTS from '@/fixtures/timeouts';
const timestamp = Date.now();
@@ -15,7 +15,7 @@ import {Team} from '@mattermost/types/teams';
import {
beMuted,
beUnmuted,
} from '../../../support/assertions';
} from '@/support/assertions';
describe('Channel Settings', () => {
let testTeam: Team;
@@ -5,7 +5,7 @@ import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {ChainableT} from '../../../types';
import {ChainableT} from '@/types';
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
@@ -112,7 +112,7 @@ describe('Close group messages', () => {
});
});
function createAndVisitGMChannel(users = []) {
function createAndVisitGMChannel(users: UserProfile[] = []) {
const userIds = users.map((user) => user.id);
return cy.apiCreateGroupChannel(userIds).then(({channel}) => {
// # Visit the new channel
@@ -5,7 +5,7 @@ import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {Channel} from '@mattermost/types/channels';
import {getAdminAccount} from '../../../support/env';
import {getAdminAccount} from '@/support/env';
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
@@ -51,7 +51,7 @@ describe('Channel Type Conversion (Public to Private Only)', () => {
});
};
const promoteToChannelAdmin = (userId, channelId, admin) => {
const promoteToChannelAdmin = (userId: string, channelId: string, admin: Pick<UserProfile, 'username' | 'password'>) => {
cy.externalRequest({
user: admin,
method: 'put',
@@ -85,7 +85,7 @@ describe('Group Message Conversion To Private Channel', () => {
});
it('When users belong to only one common team', () => {
let testUser4;
let testUser4: Cypress.UserProfile;
let gm2;
cy.apiCreateUser({prefix: 'other'}).then(({user}) => {
@@ -120,7 +120,7 @@ describe('Group Message Conversion To Private Channel', () => {
});
it('When users have no common team', () => {
let testUser5;
let testUser5: Cypress.UserProfile;
let gm3;
let testTeam3;
@@ -14,7 +14,7 @@ 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 * as TIMEOUTS from '@/fixtures/timeouts';
describe('Leave channel', () => {
let testTeam: Team;
@@ -9,8 +9,8 @@
// Group: @channels @channel @rhs
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as MESSAGES from '../../../fixtures/messages';
import * as TIMEOUTS from '@/fixtures/timeouts';
import * as MESSAGES from '@/fixtures/messages';
describe('Channel RHS', () => {
let testAdmin: Cypress.UserProfile;
@@ -11,9 +11,9 @@
// Group: @channels @channel
describe('Restrict Direct Message Channels', () => {
let testTeam;
let testUser;
let otherUser;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
let otherUser: Cypress.UserProfile;
before(() => {
cy.apiUpdateConfig({
@@ -33,7 +33,7 @@ describe('View Members modal', () => {
});
});
function verifyMemberDropdownAction(hasActionItem) {
function verifyMemberDropdownAction(hasActionItem: boolean) {
// # Click member count to open member rhs
cy.get('#member_rhs').click();
@@ -11,9 +11,9 @@
import {UserProfile} from '@mattermost/types/users';
import {getAdminAccount} from '../../../support/env';
import {getAdminAccount} from '@/support/env';
const demoteToChannelMember = (user, channelId, admin) => {
const demoteToChannelMember = (user: Pick<UserProfile, 'id'>, channelId: string, admin: Pick<UserProfile, 'username' | 'password'>) => {
cy.externalRequest({
user: admin,
method: 'put',
@@ -25,7 +25,7 @@ const demoteToChannelMember = (user, channelId, admin) => {
});
};
const promoteToChannelAdmin = (user, channelId, admin) => {
const promoteToChannelAdmin = (user: Pick<UserProfile, 'id'>, channelId: string, admin: Pick<UserProfile, 'username' | 'password'>) => {
cy.externalRequest({
user: admin,
method: 'put',
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @channel @channel_settings
import {getRandomId} from '../../../utils';
import {getRandomId} from '@/utils';
describe('Channel Settings', () => {
let testTeam: Cypress.Team;
@@ -43,14 +43,14 @@ describe('Channel Settings', () => {
});
// # Change permission so that regular users can't add team members
cy.apiGetRolesByNames(['team_user']).then((result: any) => {
if (result.roles) {
const role = result.roles[0];
const permissions = role.permissions.filter((permission) => {
cy.apiGetRolesByNames(['team_user']).then(({roles}) => {
if (roles?.length) {
const role = roles[0];
const permissions = role.permissions.filter((permission: string) => {
return !(['add_user_to_team'].includes(permission));
});
if (permissions.length !== role.permissions) {
if (permissions.length !== role.permissions.length) {
cy.apiPatchRole(role.id, {permissions});
}
}
@@ -117,10 +117,10 @@ describe('Channel Settings', () => {
// # First add one user in order to see them disappearing from the list
cy.get('#multiSelectList > div').not(':contains("Already in channel")').first().then((el) => {
const childNodes = Array.from(el[0].childNodes);
childNodes.map((child: HTMLElement) => usernames.push(child.innerText));
childNodes.map((child: ChildNode) => usernames.push((child as HTMLElement).innerText));
// # Get username from text for comparison
username = usernames.toString().match(/\w+/g)[0];
username = usernames.toString().match(/\w+/g)![0];
cy.get('#multiSelectList').should('contain', username);
// # Verify status wrapper is present within the modal list
@@ -13,8 +13,8 @@
import {ChannelType} from '@mattermost/types/channels';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Channel Settings', () => {
let testTeam: Cypress.Team;
@@ -10,12 +10,12 @@
// Stage: @prod
// Group: @channels @channel @channel_settings
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Channel routing', () => {
let testTeam: any;
let testUser: any;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
before(() => {
cy.apiInitSetup().then(({team, user}) => {
@@ -10,14 +10,14 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as MESSAGES from '../../../fixtures/messages';
import {getAdminAccount} from '../../../support/env';
import * as TIMEOUTS from '@/fixtures/timeouts';
import * as MESSAGES from '@/fixtures/messages';
import {getAdminAccount} from '@/support/env';
describe('Channel sidebar', () => {
const sysadmin = getAdminAccount();
let testTeam;
let testTeam: Cypress.Team;
beforeEach(() => {
// # Start with a new team
@@ -10,14 +10,15 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import {getAdminAccount} from '../../../support/env';
import {getRandomId} from '../../../utils';
import {clickCategoryMenuItem} from './helpers';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
describe('Category muting', () => {
let testTeam;
let testUser;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
before(() => {
cy.apiInitSetup({loginAfter: true}).then((({team, user}) => {
@@ -106,12 +107,13 @@ describe('Category muting', () => {
scheme_id: '',
update_at: 0,
last_root_post_at: 0,
})).then((channel: Cypress.Channel) => {
})).then((channel: unknown) => {
const ch = channel as Cypress.Channel;
// # And then invite us to it
cy.wrap(client.addToChannel(testUser.id, channel.id));
cy.wrap(client.addToChannel(testUser.id, ch.id));
// * Verify that the test channel appears in the sidebar and is unmuted
cy.get(`#sidebarItem_${channel.name}`).should('be.visible').should('not.have.class', 'muted');
cy.get(`#sidebarItem_${ch.name}`).should('be.visible').should('not.have.class', 'muted');
});
});
});
@@ -10,13 +10,14 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import {clickSortCategoryMenuItem} from './helpers';
let testTeam;
let testUser;
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
describe('Category sorting', () => {
beforeEach(() => {
@@ -105,7 +106,7 @@ describe('Category sorting', () => {
});
});
function createChannelAndAddToCategory(categoryName) {
function createChannelAndAddToCategory(categoryName: string) {
const channelName = `channel-${getRandomId()}`;
const userId = testUser.id;
cy.apiCreateChannel(testTeam.id, channelName, 'New Test Channel').then(({channel}) => {
@@ -118,9 +119,9 @@ function createChannelAndAddToCategory(categoryName) {
return channelName;
}
function verifyAlphabeticalSortingOrder(categoryName, length) {
function verifyAlphabeticalSortingOrder(categoryName: string, length: number) {
// # Go through each channel to get its name
const sortedAlphabeticalChannelNames = [];
const sortedAlphabeticalChannelNames: string[] = [];
for (let i = 0; i < length; i++) {
// Grab the elements in the order that they appear in the sidebar
cy.get(`.SidebarChannelGroup:contains(${categoryName}) .NavGroupContent li:nth-child(${i + 1}) .SidebarChannelLinkLabel`).should('be.visible').invoke('text').then((text) => {
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Category sorting', () => {
beforeEach(() => {
@@ -10,19 +10,19 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getAdminAccount} from '../../../support/env';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
function verifyChannelSwitch(displayName, url) {
function verifyChannelSwitch(displayName: string, url: string) {
cy.get('#channelHeaderTitle', {timeout: TIMEOUTS.HALF_MIN}).should('be.visible').should('contain', displayName);
cy.url().should('include', url);
}
describe('Channel sidebar', () => {
const sysadmin = getAdminAccount();
let testTeam;
let testUser;
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
before(() => {
// # Login as test user and visit town-square
@@ -10,11 +10,12 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import {clickCategoryMenuItem} from './helpers';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Channel sidebar', () => {
before(() => {
// # Login as test user and visit town-square
@@ -9,14 +9,14 @@
// Group: @channels @dm_category
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
const SpaceKeyCode = 32;
const DownArrowKeyCode = 40;
describe('MM-T3156 DM category', () => {
let testUser;
const usernames = [];
let testUser: Cypress.UserProfile;
const usernames: string[] = [];
before(() => {
// # Login as test user and visit town-square
@@ -9,10 +9,10 @@
// Group: @channels @dm_category
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('DM category', () => {
let testUser;
let testUser: Cypress.UserProfile;
before(() => {
// # Login as test user and visit town-square
@@ -9,10 +9,10 @@
// Group: @channels @dm_category
import * as MESSAGES from '../../../fixtures/messages';
import * as MESSAGES from '@/fixtures/messages';
describe('DM/GM filtering and sorting', () => {
let testUser;
let testUser: Cypress.UserProfile;
before(() => {
// # Login as test user and visit town-square
@@ -11,8 +11,8 @@
// Group: @channels @dm_category
describe('DM on sidebar', () => {
let testUser;
let otherUser;
let testUser: Cypress.UserProfile;
let otherUser: Cypress.UserProfile;
before(() => {
cy.apiCreateUser().then(({user}) => {
@@ -10,14 +10,14 @@
// Stage: @prod @smoke
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Channel sidebar', () => {
const SpaceKeyCode = 32;
const DownArrowKeyCode = 40;
let teamName;
let channelName;
let teamName: string;
let channelName: string;
before(() => {
cy.apiCreateCustomAdmin({loginAfter: true});
@@ -10,11 +10,11 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import {getAdminAccount} from '../../../support/env';
import {getAdminAccount} from '@/support/env';
describe('Channel sidebar - group unreads separately', () => {
let testTeam;
let testChannel;
let testTeam: Cypress.Team;
let testChannel: Cypress.Channel;
beforeEach(() => {
cy.apiAdminLogin().then(() => {
@@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../fixtures/timeouts';
import * as TIMEOUTS from '@/fixtures/timeouts';
type ClickCategoryMenuItemProps = {
categoryDisplayName: string;
@@ -28,7 +28,7 @@ export function clickCategoryMenuItem({categoryDisplayName, menuItemText, catego
});
}
export function clickSortCategoryMenuItem(categoryDisplayName, menuItemText) {
export function clickSortCategoryMenuItem(categoryDisplayName: string, menuItemText: string) {
clickCategoryMenuItem({categoryDisplayName, menuItemText: 'Sort', isSubMenu: true});
cy.wait(TIMEOUTS.HALF_SEC);
@@ -10,8 +10,8 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Channel sidebar', () => {
before(() => {
@@ -9,14 +9,14 @@
// Group: @channels @channel_sidebar
import {getAdminAccount} from '../../../support/env';
import {getAdminAccount} from '@/support/env';
describe('Channel switching', () => {
const sysadmin = getAdminAccount();
const cmdOrCtrl = Cypress.platform === 'darwin' ? '{cmd}' : '{ctrl}';
let testTeam;
let testChannel;
let testTeam: Cypress.Team;
let testChannel: Cypress.Channel;
beforeEach(() => {
// # Start with a new team
@@ -10,7 +10,7 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import {getRandomId} from '../../../utils';
import {getRandomId} from '@/utils';
describe('New category badge', () => {
before(() => {
@@ -10,8 +10,8 @@
// Stage: @prod
// Group: @channels @channel_sidebar
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '@/fixtures/timeouts';
import {getRandomId} from '@/utils';
describe('Channel sidebar', () => {
before(() => {
@@ -1,10 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {clickCategoryMenuItem} from './helpers';
import * as TIMEOUTS from '@/fixtures/timeouts';
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)

Some files were not shown because too many files have changed in this diff Show More