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,31 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {test} from '@mattermost/playwright-lib';
|
||||
|
||||
/**
|
||||
* @objective Verify a selected file can be removed from the message composer before posting.
|
||||
*/
|
||||
test('MM-T307 cancels a file upload', {tag: '@file_attachments'}, async ({pw}) => {
|
||||
const filename = 'vector_image.svg';
|
||||
const {adminClient, team, user} = await pw.initSetup();
|
||||
await adminClient.patchConfig({ServiceSettings: {EnableSVGs: true}});
|
||||
|
||||
// # Log in and open Off-Topic
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
await channelsPage.goto(team.name, 'off-topic');
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Select an image in the center-channel message composer
|
||||
const file = pw.getFileFromAsset(filename);
|
||||
await channelsPage.centerView.postCreate.selectFiles(file);
|
||||
|
||||
// * Verify the upload preview shows its thumbnail and filename
|
||||
await channelsPage.centerView.postCreate.toHaveFilePreview(filename);
|
||||
|
||||
// # Remove the attachment from the upload preview
|
||||
await channelsPage.centerView.postCreate.removeFilePreview(filename);
|
||||
|
||||
// * Verify the upload preview disappears
|
||||
await channelsPage.centerView.postCreate.toHaveFilePreviewCount(0);
|
||||
});
|
||||
@@ -0,0 +1,369 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import type {Page} from '@playwright/test';
|
||||
|
||||
import {test} from '@mattermost/playwright-lib';
|
||||
|
||||
/**
|
||||
* @objective Verify that users can edit a post and modify its content
|
||||
*/
|
||||
test('MM-T5654_1 should be able to add attachments while editing a post', {tag: ['@smoke']}, async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
// # Initialize user and login
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
// # Navigate to channels page and post a message
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage);
|
||||
|
||||
// # Hover over the last post to reveal the post menu
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// # Open the dot menu and click edit
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
|
||||
// # Edit the message and send
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.writeMessage('Edited message');
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
// * Verify the post was updated with the edited message
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText('Edited message');
|
||||
});
|
||||
|
||||
test('MM-T5654_2 should be able to add attachments while editing a threaded post', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.replyMenuItem.click();
|
||||
await channelsPage.sidebarRight.toBeVisible();
|
||||
await channelsPage.sidebarRight.postCreate.toBeVisible();
|
||||
await channelsPage.sidebarRight.postMessage('Replying to the post');
|
||||
await channelsPage.sidebarRight.toContainText('Replying to the post');
|
||||
|
||||
const replyPost = await channelsPage.sidebarRight.getLastPost();
|
||||
await replyPost.toBeVisible();
|
||||
await replyPost.hover();
|
||||
await replyPost.postMenu.toBeVisible();
|
||||
await replyPost.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.sidebarRight.postEdit.toBeVisible();
|
||||
await channelsPage.sidebarRight.postEdit.writeMessage('Edited reply message');
|
||||
await channelsPage.sidebarRight.postEdit.sendMessage();
|
||||
|
||||
let updatedReplyPost = await channelsPage.sidebarRight.getLastPost();
|
||||
await updatedReplyPost.toBeVisible();
|
||||
await updatedReplyPost.toContainText('Edited reply message');
|
||||
|
||||
// now we'll edit the reply post and files to it
|
||||
await updatedReplyPost.hover();
|
||||
await updatedReplyPost.postMenu.toBeVisible();
|
||||
await updatedReplyPost.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.sidebarRight.postEdit.toBeVisible();
|
||||
await channelsPage.sidebarRight.postEdit.writeMessage('Edited reply message with files');
|
||||
await channelsPage.sidebarRight.postEdit.addFiles(['sample_text_file.txt', 'mattermost.png']);
|
||||
await pw.wait(pw.duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.sendMessage();
|
||||
await pw.wait(pw.duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.toNotBeVisible();
|
||||
await updatedReplyPost.toBeVisible();
|
||||
await updatedReplyPost.toContainText('Edited reply message with files');
|
||||
await updatedReplyPost.toContainText('sample_text_file.txt');
|
||||
await updatedReplyPost.toContainText('mattermost.png');
|
||||
|
||||
// now we'll remove the files
|
||||
await updatedReplyPost.hover();
|
||||
await updatedReplyPost.postMenu.toBeVisible();
|
||||
await updatedReplyPost.postMenu.clickOnDotMenu();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.sidebarRight.postEdit.toBeVisible();
|
||||
await channelsPage.sidebarRight.postEdit.removeFile('sample_text_file.txt');
|
||||
await pw.wait(pw.duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.removeFile('mattermost.png');
|
||||
await pw.wait(pw.duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.sendMessage();
|
||||
|
||||
updatedReplyPost = await channelsPage.sidebarRight.getLastPost();
|
||||
await updatedReplyPost.toBeVisible();
|
||||
await updatedReplyPost.toContainText('Edited reply message with files');
|
||||
await updatedReplyPost.toNotContainText('sample_text_file.txt');
|
||||
await updatedReplyPost.toNotContainText('mattermost.png');
|
||||
});
|
||||
|
||||
test('MM-T5654_3 should be able to edit post message originally containing files', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage, ['sample_text_file.txt']);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.writeMessage('Edited message');
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText('Edited message');
|
||||
});
|
||||
|
||||
test('MM-T5654_4 should be able to add files when editing a post', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.writeMessage('Edited message');
|
||||
await channelsPage.centerView.postEdit.addFiles(['sample_text_file.txt']);
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText('Edited message');
|
||||
await updatedPost.toContainText('sample_text_file.txt');
|
||||
|
||||
// now we'll add multiple files
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.addFiles(['mattermost.png', 'archive.zip']);
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
const secondUpdatedPost = await channelsPage.getLastPost();
|
||||
await secondUpdatedPost.toBeVisible();
|
||||
await secondUpdatedPost.toContainText('Edited message');
|
||||
await secondUpdatedPost.toContainText('sample_text_file.txt');
|
||||
await secondUpdatedPost.toContainText('mattermost.png');
|
||||
await secondUpdatedPost.toContainText('archive.zip');
|
||||
});
|
||||
|
||||
test('MM-5654_5 should be able to remove attachments while editing a post', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage, ['sample_text_file.txt', 'mattermost.png', 'archive.zip']);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.toContainText(originalMessage);
|
||||
await post.toContainText('sample_text_file.txt');
|
||||
await post.toContainText('mattermost.png');
|
||||
await post.toContainText('archive.zip');
|
||||
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
await post.postMenu.clickOnDotMenu();
|
||||
await moveMouseAway(page);
|
||||
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.removeFile('sample_text_file.txt');
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText(originalMessage);
|
||||
await updatedPost.toContainText('mattermost.png');
|
||||
await updatedPost.toContainText('archive.zip');
|
||||
await updatedPost.toNotContainText('sample_text_file.txt');
|
||||
});
|
||||
|
||||
test('MM-T5655_1 removing message content and files should delete the post', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage, ['sample_text_file.txt']);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.toContainText(originalMessage);
|
||||
await post.toContainText('sample_text_file.txt');
|
||||
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.removeFile('sample_text_file.txt');
|
||||
await channelsPage.centerView.postEdit.writeMessage('');
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
await channelsPage.centerView.postEdit.deleteConfirmationDialog.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.deleteConfirmationDialog.confirmDeletion();
|
||||
await channelsPage.centerView.postEdit.deleteConfirmationDialog.notToBeVisible();
|
||||
|
||||
await channelsPage.toNotContainText(originalMessage);
|
||||
await channelsPage.toNotContainText('sample_text_file.txt');
|
||||
});
|
||||
|
||||
test('MM-T5655_2 should be able to remove all files when editing a post', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage, ['sample_text_file.txt', 'mattermost.png', 'archive.zip']);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.toContainText(originalMessage);
|
||||
await post.toContainText('sample_text_file.txt');
|
||||
await post.toContainText('mattermost.png');
|
||||
await post.toContainText('archive.zip');
|
||||
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
await post.postMenu.clickOnDotMenu();
|
||||
await moveMouseAway(page);
|
||||
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.removeFile('sample_text_file.txt');
|
||||
await channelsPage.centerView.postEdit.removeFile('mattermost.png');
|
||||
await channelsPage.centerView.postEdit.removeFile('archive.zip');
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText(originalMessage);
|
||||
await updatedPost.toNotContainText('archive.zip');
|
||||
await updatedPost.toNotContainText('mattermost.png');
|
||||
await updatedPost.toNotContainText('sample_text_file.txt');
|
||||
});
|
||||
|
||||
test('MM-T5656_1 should be able to restore previously edited post version that contains attachments', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
const newMessage = 'New Message';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.postMessage(originalMessage, ['sample_text_file.txt']);
|
||||
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.toContainText(originalMessage);
|
||||
await post.toContainText('sample_text_file.txt');
|
||||
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await moveMouseAway(page);
|
||||
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.editMenuItem.click();
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.removeFile('sample_text_file.txt');
|
||||
await channelsPage.centerView.postEdit.writeMessage(newMessage);
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText(newMessage);
|
||||
await updatedPost.toNotContainText('sample_text_file.txt');
|
||||
|
||||
const postID = await channelsPage.centerView.getLastPostID();
|
||||
await channelsPage.centerView.clickOnLastEditedPost(postID);
|
||||
|
||||
await channelsPage.sidebarRight.toBeVisible();
|
||||
await channelsPage.sidebarRight.verifyCurrentVersionPostMessage(postID, newMessage);
|
||||
|
||||
await channelsPage.sidebarRight.restorePreviousPostVersion();
|
||||
|
||||
await channelsPage.centerView.postEdit.restorePostConfirmationDialog.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.restorePostConfirmationDialog.confirmRestore();
|
||||
await channelsPage.centerView.postEdit.restorePostConfirmationDialog.notToBeVisible();
|
||||
|
||||
const restoredPost = await channelsPage.getLastPost();
|
||||
await restoredPost.toBeVisible();
|
||||
await restoredPost.toContainText('sample_text_file.txt');
|
||||
});
|
||||
|
||||
/**
|
||||
* Parks the cursor away from the post so it does not hover whatever menu item happens to render
|
||||
* under it. A hovered submenu item (e.g. "Remind") opens a nested MUI popover, which marks the
|
||||
* parent menu aria-hidden and makes getByRole('menu') unresolvable.
|
||||
*/
|
||||
async function moveMouseAway(page: Page) {
|
||||
await page.mouse.move(0, 0);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, test} from '@mattermost/playwright-lib';
|
||||
|
||||
/**
|
||||
* @objective Verify that users can edit a message that has an attachment,
|
||||
* the attachment is preserved after edit, and the edited indicator appears.
|
||||
*/
|
||||
test('MM-T2268 Edit Message with Attachment', async ({pw}) => {
|
||||
// # Initialize user and login
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage, page} = await pw.testBrowser.login(user);
|
||||
|
||||
// # Navigate to channels page
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Post a message with an attachment
|
||||
await channelsPage.postMessage('Test', ['mattermost.png']);
|
||||
|
||||
// # Get the last post and verify content
|
||||
const post = await channelsPage.getLastPost();
|
||||
await post.toBeVisible();
|
||||
|
||||
// * Verify the posted message is correct
|
||||
await post.toContainText('Test');
|
||||
|
||||
// * Verify attachment exists (image thumbnail)
|
||||
const attachment = post.container.getByLabel(/file thumbnail/i);
|
||||
await expect(attachment).toBeVisible();
|
||||
|
||||
// * Verify edited indicator does not exist initially
|
||||
const postId = await post.getId();
|
||||
await expect(channelsPage.centerView.editedPostIcon(postId)).not.toBeVisible();
|
||||
|
||||
// # Focus on the post textbox and press Up arrow to open edit dialog
|
||||
await channelsPage.centerView.postCreate.input.focus();
|
||||
await page.keyboard.press('ArrowUp');
|
||||
|
||||
// # Verify edit mode is active and add more text
|
||||
await channelsPage.centerView.postEdit.toBeVisible();
|
||||
await channelsPage.centerView.postEdit.input.fill('Test with some edit');
|
||||
await channelsPage.centerView.postEdit.sendMessage();
|
||||
|
||||
// # Get the updated post
|
||||
const updatedPost = await channelsPage.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
|
||||
// * Verify the new text shows
|
||||
await updatedPost.toContainText('Test with some edit');
|
||||
|
||||
// * Verify attachment still exists (image thumbnail)
|
||||
const updatedAttachment = updatedPost.container.getByLabel(/file thumbnail/i);
|
||||
await expect(updatedAttachment).toBeVisible();
|
||||
|
||||
// * Verify edited indicator now exists
|
||||
await expect(channelsPage.centerView.editedPostIcon(postId)).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, test} from '@mattermost/playwright-lib';
|
||||
|
||||
/**
|
||||
* @objective Verify that an SVG file can be uploaded and posted when SVG support is enabled.
|
||||
*
|
||||
* @precondition
|
||||
* The server must have `ServiceSettings.EnableSVGs` set to `true`.
|
||||
*/
|
||||
test('MM-T309 uploads and posts an SVG file when SVG support is enabled', {tag: '@file_attachments'}, async ({pw}) => {
|
||||
// # Create and log in as a test user, and enable SVG support
|
||||
const {user, team, adminClient} = await pw.initSetup();
|
||||
await adminClient.patchConfig({ServiceSettings: {EnableSVGs: true}});
|
||||
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
await channelsPage.goto(team.name, 'off-topic');
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Post a message with an SVG attachment
|
||||
await channelsPage.postMessage(`This is an image ${pw.random.id()}`, ['vector_image.svg']);
|
||||
|
||||
// * Verify the posted message renders the SVG as an image thumbnail
|
||||
const post = await channelsPage.getLastPost();
|
||||
await expect(post.container.getByLabel(/file thumbnail/i)).toBeVisible();
|
||||
});
|
||||
Reference in New Issue
Block a user