[MM-56073] MMCTL delete post command (#27539)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
@@ -1,6 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {getAdminAccount} from 'tests/support/env';
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
@@ -8,10 +10,16 @@
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @messaging
|
||||
// Group: @channels @deleting_messages
|
||||
|
||||
describe('Message deletion', () => {
|
||||
before(() => {
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnableAPIPostDeletion: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and visit off-topic
|
||||
cy.apiInitSetup({loginAfter: true}).then(({offTopicUrl}) => {
|
||||
cy.visit(offTopicUrl);
|
||||
@@ -70,4 +78,17 @@ describe('Message deletion', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Permanently delete a post and ensure it\'s reflected in the UI', () => {
|
||||
// # Post message in center.
|
||||
cy.postMessage('test message deletion');
|
||||
|
||||
cy.getLastPostId().then((parentMessageId) => {
|
||||
const admin = getAdminAccount();
|
||||
|
||||
cy.apiDeletePost(parentMessageId, admin, true);
|
||||
|
||||
cy.get(`#post_${parentMessageId}`).should('contain', '(message deleted)');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -74,11 +74,11 @@ function apiCreatePost(channelId: string, message: string, rootId: string, props
|
||||
|
||||
Cypress.Commands.add('apiCreatePost', apiCreatePost);
|
||||
|
||||
function apiDeletePost(postId: string, user: User = getAdminAccount()): Cypress.Chainable<{status: number}> {
|
||||
function apiDeletePost(postId: string, user: User = getAdminAccount(), permanent = false): Cypress.Chainable<{status: number}> {
|
||||
return cy.externalRequest({
|
||||
user,
|
||||
method: 'delete',
|
||||
path: `posts/${postId}`,
|
||||
path: `posts/${postId}?permanent=${permanent}`,
|
||||
}).then((response) => {
|
||||
// * Validate that request was successful
|
||||
expect(response.status).to.equal(200);
|
||||
|
||||
@@ -166,6 +166,7 @@ const defaultServerConfig: AdminConfig = {
|
||||
EnableAPITeamDeletion: false,
|
||||
EnableAPITriggerAdminNotifications: false,
|
||||
EnableAPIUserDeletion: false,
|
||||
EnableAPIPostDeletion: false,
|
||||
ExperimentalEnableHardenedMode: false,
|
||||
ExperimentalStrictCSRFEnforcement: false,
|
||||
EnableEmailInvitations: false,
|
||||
|
||||
Ссылка в новой задаче
Block a user