snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 1s
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,304 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Group: @channels @integrations
|
||||
|
||||
/**
|
||||
* Note: This test requires webhook server running. Initiate `npm run start:webhook` to start.
|
||||
*/
|
||||
|
||||
import {
|
||||
enablePermission,
|
||||
goToSystemScheme,
|
||||
saveConfigForScheme,
|
||||
} from '../../enterprise/system_console/channel_moderation/helpers';
|
||||
|
||||
import {addNewCommand, runSlashCommand} from './helpers';
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
|
||||
describe('Slash commands', () => {
|
||||
const trigger = 'my_trigger';
|
||||
let user1;
|
||||
let user2;
|
||||
let team1;
|
||||
let commandURL;
|
||||
const userIds = [];
|
||||
let groupChannel;
|
||||
let visitLink;
|
||||
|
||||
before(() => {
|
||||
cy.requireWebhookServer();
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
user1 = user;
|
||||
team1 = team;
|
||||
|
||||
cy.apiGetChannelByName(team.name, 'town-square').then(({channel}) => {
|
||||
commandURL = `${Cypress.expose().webhookBaseUrl}/send_message_to_channel?channel_id=${channel.id}`;
|
||||
});
|
||||
|
||||
// # Create a GM with at least 3 users
|
||||
['charlie', 'diana', 'eddie'].forEach((name) => {
|
||||
cy.apiCreateUser({prefix: name, bypassTutorial: true}).then(({user: groupUser}) => {
|
||||
cy.apiAddUserToTeam(team1.id, groupUser.id);
|
||||
userIds.push(groupUser.id);
|
||||
});
|
||||
});
|
||||
|
||||
// # Add test user to the list of group members
|
||||
userIds.push(user1.id);
|
||||
|
||||
cy.apiCreateGroupChannel(userIds).then(({channel}) => {
|
||||
groupChannel = channel;
|
||||
});
|
||||
|
||||
cy.apiCreateUser().then(({user: otherUser}) => {
|
||||
user2 = otherUser;
|
||||
cy.apiAddUserToTeam(team.id, user2.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T669 Custom slash command in DM and GM', () => {
|
||||
const gmTrigger = 'gm_trigger';
|
||||
const dmTrigger = 'dm_trigger';
|
||||
|
||||
cy.apiAdminLogin(user1);
|
||||
cy.apiGetChannelByName(team1.name, groupChannel.name).then(({channel}) => {
|
||||
const customGMUrl = `${Cypress.expose().webhookBaseUrl}/send_message_to_channel?channel_id=${channel.id}`;
|
||||
|
||||
// # Add a new command to send a GM
|
||||
addNewCommand(team1, gmTrigger, customGMUrl);
|
||||
|
||||
visitLink = `/${team1.name}/channels/${groupChannel.name}`;
|
||||
|
||||
// * Verify running custom command in GM
|
||||
runSlashCommand(visitLink, gmTrigger);
|
||||
|
||||
// # Cleanup command
|
||||
deleteCommand(team1, gmTrigger);
|
||||
});
|
||||
|
||||
// # Create a new DM channel
|
||||
cy.apiCreateDirectChannel([user1.id, user2.id]).then(() => {
|
||||
visitLink = `/${team1.name}/messages/@${user2.username}`;
|
||||
cy.visit(visitLink);
|
||||
});
|
||||
|
||||
// # Get channel id to create a custom slash command in DM
|
||||
cy.getCurrentChannelId().then((channelId) => {
|
||||
const message = `hello from ${user2.username}: ${Date.now()}`;
|
||||
cy.postMessageAs({sender: user2, message, channelId});
|
||||
|
||||
const customDMUrl = `${Cypress.expose().webhookBaseUrl}/send_message_to_channel?channel_id=${channelId}`;
|
||||
|
||||
addNewCommand(team1, dmTrigger, customDMUrl);
|
||||
|
||||
// * Verify running custom command in DM
|
||||
runSlashCommand(visitLink, dmTrigger);
|
||||
|
||||
// # Cleanup command
|
||||
deleteCommand(team1, dmTrigger);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T696 Can\'t delete other user\'s slash command', () => {
|
||||
cy.apiAdminLogin(user1);
|
||||
|
||||
// # Create new Slash command
|
||||
addNewCommand(team1, trigger, 'http://dot.com');
|
||||
|
||||
goToSystemScheme();
|
||||
enablePermission('all_users-integrations-manage_slash_commands-checkbox');
|
||||
saveConfigForScheme();
|
||||
|
||||
// # Login as another user
|
||||
cy.apiLogin(user2);
|
||||
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team1.name}/integrations/commands/installed`);
|
||||
|
||||
// * Verify slash command exists
|
||||
cy.contains(`/${trigger}`);
|
||||
|
||||
// * Verify that Edit and Delete options do not show up
|
||||
cy.contains('Edit').should('not.exist');
|
||||
cy.contains('Delete').should('not.exist');
|
||||
|
||||
// # Cleanup command
|
||||
cy.apiAdminLogin(user1);
|
||||
deleteCommand(team1, trigger);
|
||||
});
|
||||
|
||||
it('MM-T697 Delete slash command', () => {
|
||||
// # Create new Slash command
|
||||
addNewCommand(team1, trigger, 'http://dot.com');
|
||||
|
||||
deleteCommand(team1, trigger);
|
||||
|
||||
// # Go back to home channel
|
||||
cy.visit(`/${team1.name}/channels/town-square`);
|
||||
|
||||
// # Run slash command
|
||||
cy.uiGetPostTextBox().clear().type(`/${trigger} {enter}`);
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify error
|
||||
cy.findByText(`Command with a trigger of '/${trigger}' not found.`).should('exist').and('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T700 Slash command - Override username', () => {
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnablePostUsernameOverride: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Create new Slash command
|
||||
addNewCommand(team1, trigger, commandURL);
|
||||
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team1.name}/integrations/commands/installed`);
|
||||
|
||||
// # Update username
|
||||
// # click on last added command's(first child) edit action
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText('Edit').click();
|
||||
cy.get('#username').type('newname');
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// # Go back to home channel
|
||||
cy.visit(`/${team1.name}/channels/town-square`);
|
||||
|
||||
// # Run slash command
|
||||
cy.postMessage(`/${trigger} `);
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify that last post is by newname
|
||||
cy.getLastPost().within(() => {
|
||||
cy.get('.post__header').find('.user-popover').as('usernameForPopover').should('have.text', 'newname');
|
||||
});
|
||||
|
||||
// # Cleanup command
|
||||
deleteCommand(team1, trigger);
|
||||
});
|
||||
|
||||
it('MM-T701 Slash command - Override profile picture', () => {
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnablePostIconOverride: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Create new Slash command
|
||||
addNewCommand(team1, trigger, commandURL);
|
||||
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team1.name}/integrations/commands/installed`);
|
||||
|
||||
// # Update icon URL
|
||||
// # click on last added command's(first child) edit action
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText('Edit').click();
|
||||
const iconURL = 'https://mattermost.com/wp-content/uploads/2022/02/icon_WS.png';
|
||||
cy.get('#iconUrl').type(iconURL);
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// # Go back to home channel
|
||||
cy.visit(`/${team1.name}/channels/town-square`);
|
||||
|
||||
// # Run slash command
|
||||
cy.postMessage(`/${trigger} `);
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify that last post has correct icon
|
||||
cy.getLastPost().within(() => {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
const encodedIconUrl = encodeURIComponent(iconURL);
|
||||
cy.get('.profile-icon > img').as('profileIconForPopover').should('have.attr', 'src', `${baseUrl}/api/v4/image?url=${encodedIconUrl}`);
|
||||
});
|
||||
|
||||
// # Cleanup command
|
||||
deleteCommand(team1, trigger);
|
||||
});
|
||||
|
||||
it('MM-T703 Show custom slash command in autocomplete', () => {
|
||||
// # Create new Slash command
|
||||
addNewCommand(team1, trigger, commandURL);
|
||||
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team1.name}/integrations/commands/installed`);
|
||||
|
||||
// # Update autocomplete
|
||||
// # click on last added command's(first child) edit action
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText('Edit').click();
|
||||
cy.get('#autocomplete').click();
|
||||
const hint = '[test-hint]';
|
||||
cy.get('#autocompleteHint').type(hint);
|
||||
const desc = 'Auto description';
|
||||
|
||||
// since there are two selectors with the same id 'description' we pick one which is the 10-th child
|
||||
cy.get(':nth-child(10) > .col-md-5 > #description').type(desc);
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// # Go back to home channel
|
||||
cy.visit(`/${team1.name}/channels/town-square`);
|
||||
|
||||
// # Type slash
|
||||
cy.uiGetPostTextBox().clear().type('/');
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify that command is in the list
|
||||
cy.contains(trigger);
|
||||
|
||||
// # Type full command
|
||||
cy.uiGetPostTextBox().type(trigger);
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify that autocomplete info is correct
|
||||
cy.get('.slash-command__title').should('have.text', `${trigger} ${hint}`);
|
||||
cy.get('.slash-command__desc').should('have.text', `${desc}`);
|
||||
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team1.name}/integrations/commands/installed`);
|
||||
|
||||
// # Remove autocomplete
|
||||
// # click on last added command's(first child) edit action
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText('Edit').click();
|
||||
cy.get('#autocomplete').click();
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// # Go back to home channel
|
||||
cy.visit(`/${team1.name}/channels/town-square`);
|
||||
|
||||
// # Run slash command
|
||||
cy.uiGetPostTextBox().clear().type('/');
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify that command is not in the list
|
||||
cy.contains(trigger).should('not.exist');
|
||||
|
||||
// # Cleanup command
|
||||
deleteCommand(team1, trigger);
|
||||
});
|
||||
});
|
||||
|
||||
function deleteCommand(team, trigger) {
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team.name}/integrations/commands/installed`);
|
||||
|
||||
// # Delete slash command
|
||||
// * Verify that last added command's details contains `/trigger`
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText(`- /${trigger}`).should('be.visible');
|
||||
|
||||
// # Click on last added command's delete action
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText('Delete').click();
|
||||
cy.get('#confirmModalButton').click();
|
||||
|
||||
// * Verify slash command no longer displays in list
|
||||
cy.get('.backstage-list').find('.backstage-list__item').first().findByText(`- /${trigger}`).should('not.exist');
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
|
||||
export function addNewCommand(team, trigger, url) {
|
||||
// # Open slash command page
|
||||
cy.visit(`/${team.name}/integrations/commands/installed`);
|
||||
|
||||
// # Add new command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Type a trigger word, url and display name
|
||||
cy.get('#trigger').type(trigger);
|
||||
cy.get('#displayName').type('Test Message');
|
||||
cy.apiGetChannelByName(team.name, 'town-square').then(({channel}) => {
|
||||
let urlToType = url;
|
||||
if (url === '') {
|
||||
urlToType = `${Cypress.expose('webhookBaseUrl')}/send_message_to_channel?channel_id=${channel.id}`;
|
||||
}
|
||||
cy.get('#url').type(urlToType);
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify we are at setup successful URL
|
||||
cy.url().should('include', '/integrations/commands/confirm');
|
||||
|
||||
// * Verify slash was successfully created
|
||||
cy.findByText('Setup Successful').should('exist').and('be.visible');
|
||||
|
||||
// * Verify token was created
|
||||
cy.findByText('Token').should('exist').and('be.visible');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} linkToVisit : Channel / Group message / DM link to visit
|
||||
* @param {*} trigger : Slash command trigger
|
||||
*/
|
||||
export function runSlashCommand(linkToVisit, trigger) {
|
||||
// # Go back to home channel
|
||||
cy.visit(linkToVisit);
|
||||
|
||||
// # Run slash command
|
||||
cy.uiGetPostTextBox().clear().type(`/${trigger}{enter}{enter}`);
|
||||
cy.wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// # Get last post message text
|
||||
cy.getLastPostId().then((postId) => {
|
||||
cy.get(`#post_${postId}`).get('.Tag').contains('BOT');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @integrations
|
||||
|
||||
/**
|
||||
* Note: This test requires webhook server running. Initiate `npm run start:webhook` to start.
|
||||
*/
|
||||
|
||||
import {addNewCommand, runSlashCommand} from './helpers';
|
||||
|
||||
describe('Slash commands page', () => {
|
||||
const trigger = 'test-message';
|
||||
let channelUrl;
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
cy.requireWebhookServer();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.apiInitSetup().then(({team}) => {
|
||||
testTeam = team;
|
||||
|
||||
// # Go to integrations
|
||||
cy.visit(`/${team.name}/integrations`);
|
||||
|
||||
// * Validate that slash command section is enabled
|
||||
cy.get('#slashCommands').should('be.visible');
|
||||
|
||||
// # Open slash command page
|
||||
cy.get('#slashCommands').click();
|
||||
channelUrl = `${testTeam.name}/channels/town-square`;
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T690 Add custom slash command: / error', () => {
|
||||
// # Add new command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Type a trigger starting with slash
|
||||
cy.get('#trigger').type('//input');
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify that we get the error message
|
||||
cy.findByText('A trigger word cannot begin with a /').should('exist').and('be.visible').scrollIntoView();
|
||||
});
|
||||
|
||||
it('MM-T691 Error: trigger word required', () => {
|
||||
// # Add new command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Do not input trigger word
|
||||
cy.get('#url').type('http://example.com');
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify that we get the error message
|
||||
cy.findByText('A trigger word is required').should('exist').and('be.visible').scrollIntoView();
|
||||
});
|
||||
|
||||
it('MM-T692 Error: no spaces in trigger word', () => {
|
||||
// # Add new command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Type a trigger word with space in it
|
||||
cy.get('#trigger').type('trigger with space');
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify that we get the error message
|
||||
cy.findByText('A trigger word must not contain spaces').should('exist').and('be.visible').scrollIntoView();
|
||||
});
|
||||
|
||||
it('MM-T693 Error: URL required', () => {
|
||||
// # Add new command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Type a trigger word
|
||||
cy.get('#trigger').type('test');
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify that we get the error message
|
||||
cy.findByText('A request URL is required').should('exist').and('be.visible').scrollIntoView();
|
||||
});
|
||||
|
||||
it('MM-T694 Error: trigger word in use', () => {
|
||||
const triggerWord = 'my_trigger_word';
|
||||
const url = 'http://test.com';
|
||||
|
||||
// # Add new command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Type a trigger word and URL
|
||||
cy.get('#trigger').type(triggerWord);
|
||||
cy.get('#url').type(url);
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// # Go to integrations
|
||||
cy.visit(`/${testTeam.name}/integrations`);
|
||||
|
||||
// * Validate that slash command section is enabled
|
||||
cy.get('#slashCommands').should('be.visible');
|
||||
|
||||
// # Open slash command page
|
||||
cy.get('#slashCommands').click();
|
||||
|
||||
// # Add same command
|
||||
cy.get('#addSlashCommand').click();
|
||||
|
||||
// # Type same trigger word and URL
|
||||
cy.get('#trigger').type(triggerWord);
|
||||
cy.get('#url').type(url);
|
||||
|
||||
// # Save
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify that we get the error message
|
||||
cy.findByText('This trigger word is already in use. Please choose another word.').should('exist').and('be.visible').scrollIntoView();
|
||||
});
|
||||
|
||||
it('MM-T695 Run custom slash command', () => {
|
||||
addNewCommand(testTeam, trigger, '');
|
||||
runSlashCommand(channelUrl, trigger);
|
||||
});
|
||||
|
||||
it('MM-T698 Cancel out of edit', () => {
|
||||
addNewCommand(testTeam, trigger, 'http://example.com');
|
||||
|
||||
// # Go to integrations
|
||||
cy.visit(`/${testTeam.name}/integrations`);
|
||||
|
||||
// # Open slash command page
|
||||
cy.get('#slashCommands').click();
|
||||
|
||||
// # Click on edit
|
||||
cy.get('a[href*="/edit"]').click();
|
||||
|
||||
// # Change url
|
||||
cy.get('#url').clear().type('http://mattermost.com');
|
||||
|
||||
// # Click on Cancel
|
||||
cy.get('a').contains('Cancel').click();
|
||||
|
||||
// # Click on edit again
|
||||
cy.get('a[href*="/edit"]').click();
|
||||
|
||||
// * Verify that url value is not changed
|
||||
cy.get('#url').should('have.value', 'http://example.com');
|
||||
});
|
||||
|
||||
it('MM-T699 Edit custom slash command', () => {
|
||||
addNewCommand(testTeam, trigger, '');
|
||||
|
||||
// # Go to integrations
|
||||
cy.visit(`/${testTeam.name}/integrations`);
|
||||
|
||||
// # Open slash command page
|
||||
cy.get('#slashCommands').click();
|
||||
|
||||
// # Click on edit
|
||||
cy.get('a[href*="/edit"]').click();
|
||||
|
||||
// # Update display name
|
||||
cy.get('#displayName').clear().type('Test Message - Edit');
|
||||
|
||||
// # Update
|
||||
cy.get('#saveCommand').click();
|
||||
|
||||
// * Verify successful update
|
||||
cy.findByText('Test Message - Edit').should('exist').and('be.visible');
|
||||
|
||||
runSlashCommand(channelUrl, trigger);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user