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 Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (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 Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
// 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 @plugin @not_cloud
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
import {demoPlugin} from '@/utils/plugins';
|
||||
|
||||
describe('Demo plugin - Webhook events', () => {
|
||||
let team1;
|
||||
let team2;
|
||||
let testUser;
|
||||
let admin;
|
||||
let testChannel;
|
||||
|
||||
before(() => {
|
||||
cy.shouldNotRunOnCloudEdition();
|
||||
cy.shouldHavePluginUploadEnabled();
|
||||
|
||||
// # Set plugin settings
|
||||
const newSettings = {
|
||||
PluginSettings: {
|
||||
Enable: true,
|
||||
},
|
||||
ServiceSettings: {
|
||||
EnableGifPicker: true,
|
||||
},
|
||||
FileSettings: {
|
||||
EnablePublicLink: true,
|
||||
},
|
||||
};
|
||||
cy.apiUpdateConfig(newSettings);
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
admin = user;
|
||||
team1 = team;
|
||||
|
||||
// # Create team before installing demo plugin
|
||||
cy.apiCreateTeam('team', 'Team').then(({team: anotherTeam}) => {
|
||||
team2 = anotherTeam;
|
||||
});
|
||||
|
||||
// # Install demo plugin by file
|
||||
cy.apiUploadAndEnablePlugin(demoPlugin);
|
||||
|
||||
// # Enable webhook events
|
||||
cy.visit(`/${team1.name}/channels/off-topic`);
|
||||
cy.postMessage('/demo_plugin true ').wait(TIMEOUTS.TWO_SEC);
|
||||
|
||||
// * Verify that hooks are enabled
|
||||
cy.getLastPost().contains('enabled', {matchCase: false});
|
||||
|
||||
// # Create channel
|
||||
cy.apiCreateChannel(team.id, 'my_test_channel', 'my_test_channel').then(({channel}) => {
|
||||
testChannel = channel.name;
|
||||
});
|
||||
|
||||
// # Join the demo channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
|
||||
// # Create another user
|
||||
cy.apiCreateUser().then(({user: otherUser}) => {
|
||||
testUser = otherUser;
|
||||
cy.apiAddUserToTeam(team.id, testUser.id);
|
||||
|
||||
// # Login another user
|
||||
cy.apiLogin(testUser);
|
||||
|
||||
// # Join the demo channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2408_1 - User posts a message Webhook event', () => {
|
||||
// # Post message
|
||||
cy.visit(`/${team1.name}/channels/off-topic`);
|
||||
cy.postMessage('MM-T2408_1');
|
||||
|
||||
// * Verify message is posted in the demo channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
cy.findAllByTestId('postView').should('contain', `MessageHasBeenPosted: @${testUser.username}, ~Town Square`);
|
||||
});
|
||||
|
||||
it('MM-T2408_2 - User joined a channel Webhook event', () => {
|
||||
// # Join channel
|
||||
cy.visit(`/${team1.name}/channels/${testChannel}`).wait(TIMEOUTS.ONE_SEC);
|
||||
cy.postMessage('MM-T2408_2');
|
||||
|
||||
// * Verify message is posted in the demo channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
cy.findAllByTestId('postView').should('contain', `UserHasJoinedChannel: @${testUser.username}, ~my_test_channel`);
|
||||
});
|
||||
|
||||
it('MM-T2408_3 - User left a channel Webhook event', () => {
|
||||
// # Leave channel
|
||||
cy.visit(`/${team1.name}/channels/${testChannel}`);
|
||||
cy.uiLeaveChannel(false);
|
||||
|
||||
// * Verify message is posted in the demo plugin channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
cy.findAllByTestId('postView').should('contain', `UserHasLeftChannel: @${testUser.username}, ~my_test_channel`);
|
||||
});
|
||||
|
||||
it('MM-T2408_4 - User edited a message Webhook event', () => {
|
||||
// # Post message
|
||||
cy.visit(`/${team1.name}/channels/off-topic`);
|
||||
cy.postMessage('MM-T2408_4');
|
||||
|
||||
// # Get last post ID
|
||||
cy.getLastPostId().then((postID) => {
|
||||
// # click dot menu button
|
||||
cy.clickPostDotMenu();
|
||||
|
||||
// # click edit post
|
||||
cy.get(`#edit_post_${postID}`).click();
|
||||
|
||||
// # Edit message and finish by hitting `enter`
|
||||
cy.get('#edit_textbox').
|
||||
should('be.visible').
|
||||
and('be.focused').
|
||||
wait(TIMEOUTS.HALF_SEC).
|
||||
type('MM-T2408_4 edited').
|
||||
type('{enter}');
|
||||
|
||||
// # Open demo plugin channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
|
||||
// * Verify event posted in the channel
|
||||
cy.findAllByTestId('postView').should('contain', `MessageHasBeenUpdated: @${testUser.username}, ~Off-Topic`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2408_5 - User adds a reaction to a message Webhook event', () => {
|
||||
// # Post message
|
||||
cy.visit(`/${team1.name}/channels/off-topic`);
|
||||
cy.postMessage('MM-T2408_5');
|
||||
|
||||
cy.getLastPostId().then((postId) => {
|
||||
// # Click the add reaction icon
|
||||
cy.clickPostReactionIcon(postId);
|
||||
|
||||
// # Choose "slightly_frowning_face" emoji
|
||||
cy.clickEmojiInEmojiPicker('slightly_frowning_face');
|
||||
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
|
||||
// * Verify event posted in the channel
|
||||
cy.findAllByTestId('postView').should('contain', `ReactionHasBeenAdded: @${testUser.username}, `).and('contain', ':slightly_frowning_face:');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2408_6 - User joined the team Webhook event', () => {
|
||||
// # Add user to the team
|
||||
cy.apiAdminLogin(admin);
|
||||
cy.apiAddUserToTeam(team2.id, testUser.id);
|
||||
|
||||
// # Open demo plugin channel
|
||||
cy.visit(`/${team2.name}/channels/demo_plugin`);
|
||||
|
||||
// * Verify event is posted in the channel
|
||||
cy.findAllByTestId('postView').should('contain', `UserHasJoinedTeam: @${testUser.username}`);
|
||||
});
|
||||
|
||||
it('MM-T2408_7 - User left a team Webhook event', () => {
|
||||
// # Delete user from team
|
||||
cy.apiDeleteUserFromTeam(team2.id, testUser.id);
|
||||
|
||||
// # Open demo plugin channel
|
||||
cy.visit(`/${team2.name}/channels/demo_plugin`);
|
||||
|
||||
// * Verify event is posted in the channel
|
||||
cy.findAllByTestId('postView').should('contain', `UserHasLeftTeam: @${testUser.username}`);
|
||||
});
|
||||
|
||||
it('MM-T2408_8 - User user login Webhook event', () => {
|
||||
// # Login
|
||||
cy.apiLogin(testUser);
|
||||
|
||||
// # Open demo plugin channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
|
||||
// * Verify event is posted in the channel
|
||||
cy.findAllByTestId('postView').should('contain', `User @${testUser.username} has logged in`);
|
||||
});
|
||||
|
||||
it('MM-T2408_9 - User user created Webhook event', () => {
|
||||
// # Login
|
||||
cy.apiAdminLogin(admin);
|
||||
|
||||
// # Create another user
|
||||
cy.apiCreateUser().then(({user: otherUser}) => {
|
||||
// # Open demo plugin channel
|
||||
cy.visit(`/${team1.name}/channels/demo_plugin`);
|
||||
|
||||
// * Verify event is posted in the channel
|
||||
cy.findAllByTestId('postView').should('contain', `User_ID @${otherUser.id} has been created in`);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user