Edit file attachment e2e tests (#29797)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
528026d6fb
Коммит
f9cff5c8d6
Двоичные данные
e2e-tests/playwright/support/asset/archive.zip
Обычный файл
Двоичные данные
e2e-tests/playwright/support/asset/archive.zip
Обычный файл
Двоичный файл не отображается.
Двоичные данные
e2e-tests/playwright/support/asset/mattermost.png
Обычный файл
Двоичные данные
e2e-tests/playwright/support/asset/mattermost.png
Обычный файл
Двоичный файл не отображается.
|
После Ширина: | Высота: | Размер: 75 KiB |
19
e2e-tests/playwright/support/asset/sample_text_file.txt
Обычный файл
19
e2e-tests/playwright/support/asset/sample_text_file.txt
Обычный файл
@@ -0,0 +1,19 @@
|
||||
Lorem dolore adipisicing occaecat do qui. Laboris duis aliquip laborum ad sint. Est minim ipsum consequat. Ullamco quis magna ut anim cupidatat esse aliquip aliqua eiusmod voluptate. Aute officia aute eiusmod cillum aliquip non in elit cupidatat excepteur occaecat. Mollit elit incididunt eu dolor pariatur cillum proident id labore do Lorem officia laborum reprehenderit cupidatat. Eu nulla proident magna id dolore Lorem.
|
||||
|
||||
Non nisi minim mollit occaecat in culpa ullamco id dolore fugiat id eiusmod ut. Est enim commodo duis sunt fugiat. In non sunt eiusmod quis irure ullamco. Nulla eiusmod exercitation aute cillum anim.
|
||||
|
||||
Incididunt cillum do velit ipsum nisi enim ipsum officia non nostrud velit dolor do. Anim magna officia duis nulla occaecat labore pariatur enim. Ea sit Lorem irure adipisicing nisi aute adipisicing reprehenderit sunt cupidatat incididunt. Do magna nisi amet nostrud eiusmod. Eiusmod enim nisi dolor irure dolor dolor ipsum deserunt eiusmod veniam ipsum incididunt eu. Proident nisi duis proident proident duis velit tempor et do cillum.
|
||||
|
||||
Ipsum eu enim anim non excepteur quis. Proident et ea minim. Duis velit exercitation occaecat adipisicing adipisicing proident reprehenderit aliqua ea. Cillum sint anim qui eiusmod consectetur sint. Nostrud in pariatur eu proident nisi nostrud nisi et adipisicing sit. Consectetur ad consectetur ipsum sit.
|
||||
|
||||
In culpa irure in esse in duis consectetur amet ullamco reprehenderit sit elit culpa velit. Cillum ipsum enim officia nisi cillum adipisicing commodo anim fugiat qui quis. Excepteur aliqua adipisicing excepteur sit elit cillum velit et pariatur. Labore sint anim voluptate. Aliquip ad proident reprehenderit Lorem voluptate voluptate fugiat ea laborum ipsum.
|
||||
|
||||
Et proident nostrud nisi. Nisi exercitation dolor incididunt ipsum sunt consequat consequat aliquip cupidatat reprehenderit tempor. Ea excepteur sint aliqua consequat culpa proident consequat incididunt incididunt ex proident exercitation occaecat. Proident dolore dolor pariatur proident anim qui commodo enim nisi nulla anim dolore qui. Velit fugiat et commodo voluptate incididunt aliqua aute. Eiusmod anim magna commodo enim fugiat.
|
||||
|
||||
Eiusmod eiusmod dolore cillum tempor sit in. Cillum non ex elit velit esse exercitation amet ipsum et sunt sunt velit in ullamco. Enim sit aliquip mollit ea occaecat qui sit deserunt. Aute adipisicing sit non aliquip pariatur dolor ad minim culpa laborum consectetur fugiat.
|
||||
|
||||
Est incididunt exercitation consectetur occaecat veniam magna sint ea ad irure qui. Id cupidatat ut ex laboris sint anim adipisicing cillum ex in minim commodo reprehenderit duis. Cillum duis consequat occaecat et commodo ullamco exercitation sint reprehenderit deserunt dolor ipsum culpa non aute. Est cupidatat laboris proident in voluptate laborum minim officia eiusmod ipsum. Irure labore mollit esse adipisicing proident magna sit reprehenderit nisi cupidatat. Excepteur id ullamco adipisicing pariatur.
|
||||
|
||||
Ullamco officia et dolor consequat exercitation. Nisi aute ad aliquip nostrud deserunt nostrud. Esse reprehenderit eu cillum ullamco excepteur tempor non excepteur deserunt esse. Nisi nulla esse elit. Nulla enim consequat esse do cillum anim velit eu nulla esse amet laborum tempor occaecat. Proident voluptate exercitation cillum minim proident quis mollit mollit aliqua deserunt nostrud.
|
||||
|
||||
Veniam ea sit duis incididunt sint nostrud labore exercitation et dolor reprehenderit amet. Esse laborum sit veniam dolor anim amet mollit aliquip id. Laborum voluptate eiusmod consectetur. Laborum cillum voluptate enim nisi culpa ullamco cillum non aliquip nostrud do ex. Lorem elit laborum eiusmod velit id exercitation do dolor laboris et nisi et sit.
|
||||
@@ -72,6 +72,7 @@ const onPremServerConfig = (): Partial<TestAdminConfig> => {
|
||||
EnableOnboardingFlow: false,
|
||||
EnableSecurityFixAlert: false,
|
||||
GiphySdkKey: 's0glxvzVg9azvPipKxcPLpXV0q1x1fVP',
|
||||
EnableTesting: true,
|
||||
},
|
||||
TeamSettings: {
|
||||
EnableOpenServer: true,
|
||||
|
||||
@@ -19,3 +19,7 @@ export async function waitForAnimationEnd(locator: Locator) {
|
||||
Promise.all(element.getAnimations({subtree: true}).map((animation) => animation.finished)),
|
||||
);
|
||||
}
|
||||
|
||||
export async function moveMouseToCenter(page: Page) {
|
||||
await page.mouse.move(0, 0);
|
||||
}
|
||||
|
||||
@@ -16,22 +16,27 @@ export default class ChannelsCenterView {
|
||||
readonly postBoxIndicator;
|
||||
readonly scheduledDraftChannelIcon;
|
||||
readonly scheduledDraftChannelInfoMessage;
|
||||
readonly scheduledDraftChannelInfoMessageLocator;
|
||||
readonly scheduledDraftChannelInfoMessageText;
|
||||
readonly scheduledDraftSeeAllLink;
|
||||
readonly postEdit;
|
||||
readonly editedPostIcon;
|
||||
|
||||
constructor(container: Locator) {
|
||||
this.container = container;
|
||||
|
||||
this.scheduledDraftChannelInfoMessageLocator = 'span:has-text("Message scheduled for")';
|
||||
this.header = new components.ChannelsHeader(this.container.locator('.channel-header'));
|
||||
this.postCreate = new components.ChannelsPostCreate(container.getByTestId('post-create'));
|
||||
this.scheduledDraftOptions = new components.ChannelsPostCreate(
|
||||
container.locator('#dropdown_send_post_options'),
|
||||
);
|
||||
this.postEdit = new components.ChannelsPostEdit(container.locator('.post-edit__container'));
|
||||
this.postBoxIndicator = container.locator('div.postBoxIndicator');
|
||||
this.scheduledDraftChannelIcon = container.locator('#create_post i.icon-draft-indicator');
|
||||
this.scheduledDraftChannelInfoMessage = container.locator('div.ScheduledPostIndicator span');
|
||||
this.scheduledDraftChannelInfoMessageText = container.locator('span:has-text("Message scheduled for")');
|
||||
this.scheduledDraftSeeAllLink = container.locator('a:has-text("See all scheduled messages")');
|
||||
this.scheduledDraftChannelInfoMessageText = container.locator(this.scheduledDraftChannelInfoMessageLocator);
|
||||
this.scheduledDraftSeeAllLink = container.locator('a:has-text("See all")');
|
||||
this.editedPostIcon = (postID: string) => container.locator(`#postEdited_${postID}`);
|
||||
}
|
||||
|
||||
async toBeVisible() {
|
||||
@@ -65,6 +70,17 @@ export default class ChannelsCenterView {
|
||||
return new components.ChannelsPost(lastPost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ID of the last post in the Center
|
||||
*/
|
||||
async getLastPostID() {
|
||||
return this.container
|
||||
.getByTestId('postView')
|
||||
.last()
|
||||
.getAttribute('id')
|
||||
.then((id) => (id ? id.split('_')[1] : null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Nth post in the Center from the top
|
||||
* @param index
|
||||
@@ -115,6 +131,12 @@ export default class ChannelsCenterView {
|
||||
const messageLocator = this.scheduledDraftChannelInfoMessage.first();
|
||||
await expect(messageLocator).toContainText('Message scheduled for');
|
||||
}
|
||||
|
||||
async clickOnLastEditedPost(postID: string | null) {
|
||||
if (postID) {
|
||||
await this.editedPostIcon(postID).click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {ChannelsCenterView};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, Locator} from '@playwright/test';
|
||||
|
||||
export default class DeletePostConfirmationDialog {
|
||||
readonly container: Locator;
|
||||
|
||||
readonly cancelButton;
|
||||
readonly confirmButton;
|
||||
|
||||
constructor(container: Locator) {
|
||||
this.container = container;
|
||||
|
||||
this.cancelButton = container.locator('button.btn.btn-tertiary');
|
||||
this.confirmButton = container.locator('button#deletePostModalButton');
|
||||
}
|
||||
|
||||
async toBeVisible() {
|
||||
await expect(this.container).toBeVisible();
|
||||
await expect(this.cancelButton).toBeVisible();
|
||||
await expect(this.confirmButton).toBeVisible();
|
||||
}
|
||||
|
||||
async notToBeVisible() {
|
||||
await expect(this.container).not.toBeVisible();
|
||||
await expect(this.cancelButton).not.toBeVisible();
|
||||
await expect(this.confirmButton).not.toBeVisible();
|
||||
}
|
||||
|
||||
async cancelDeletion() {
|
||||
await this.cancelButton.click();
|
||||
}
|
||||
|
||||
async confirmDeletion() {
|
||||
await this.confirmButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
export {DeletePostConfirmationDialog};
|
||||
@@ -2,6 +2,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, Locator} from '@playwright/test';
|
||||
import path from 'node:path';
|
||||
|
||||
export default class ChannelsPostCreate {
|
||||
readonly container: Locator;
|
||||
@@ -23,7 +24,7 @@ export default class ChannelsPostCreate {
|
||||
this.input = container.getByTestId('reply_textbox');
|
||||
}
|
||||
|
||||
this.attachmentButton = container.getByLabel('attachment');
|
||||
this.attachmentButton = container.locator('#fileUploadButton');
|
||||
this.emojiButton = container.getByLabel('select an emoji');
|
||||
this.sendMessageButton = container.getByTestId('SendMessageButton');
|
||||
this.scheduleDraftMessageButton = container.getByLabel('Schedule message');
|
||||
@@ -95,8 +96,18 @@ export default class ChannelsPostCreate {
|
||||
/**
|
||||
* Composes and sends a message
|
||||
*/
|
||||
async postMessage(message: string) {
|
||||
async postMessage(message: string, files?: string[]) {
|
||||
await this.writeMessage(message);
|
||||
|
||||
if (files) {
|
||||
const filePaths = files.map((file) => path.join(path.resolve(__dirname), '../../../asset', file));
|
||||
this.container.page().once('filechooser', async (fileChooser) => {
|
||||
await fileChooser.setFiles(filePaths);
|
||||
});
|
||||
|
||||
await this.attachmentButton.click();
|
||||
}
|
||||
|
||||
await this.sendMessage();
|
||||
}
|
||||
|
||||
|
||||
94
e2e-tests/playwright/support/ui/components/channels/post_edit.ts
Обычный файл
94
e2e-tests/playwright/support/ui/components/channels/post_edit.ts
Обычный файл
@@ -0,0 +1,94 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, Locator} from '@playwright/test';
|
||||
import path from 'node:path';
|
||||
import {components} from '@e2e-support/ui/components';
|
||||
|
||||
export default class ChannelsPostEdit {
|
||||
readonly container: Locator;
|
||||
readonly input;
|
||||
|
||||
readonly attachmentButton;
|
||||
readonly emojiButton;
|
||||
readonly sendMessageButton;
|
||||
readonly deleteConfirmationDialog;
|
||||
readonly restorePostConfirmationDialog;
|
||||
|
||||
constructor(container: Locator) {
|
||||
this.container = container;
|
||||
|
||||
this.input = container.getByTestId('edit_textbox');
|
||||
|
||||
this.attachmentButton = container.locator('#fileUploadButton');
|
||||
this.emojiButton = container.getByLabel('select an emoji');
|
||||
this.sendMessageButton = container.locator('.save');
|
||||
this.deleteConfirmationDialog = new components.DeletePostConfirmationDialog(
|
||||
container.page().locator('#deletePostModal'),
|
||||
);
|
||||
this.restorePostConfirmationDialog = new components.RestorePostConfirmationDialog(
|
||||
container.page().locator('#restorePostModal'),
|
||||
);
|
||||
}
|
||||
|
||||
async toBeVisible() {
|
||||
await expect(this.container).toBeVisible();
|
||||
|
||||
await this.input.waitFor();
|
||||
await expect(this.input).toBeVisible();
|
||||
}
|
||||
|
||||
async toNotBeVisible() {
|
||||
await expect(this.input).not.toBeVisible();
|
||||
}
|
||||
|
||||
async writeMessage(message: string) {
|
||||
await this.input.waitFor();
|
||||
await expect(this.input).toBeVisible();
|
||||
|
||||
await this.input.clear();
|
||||
await this.input.fill(message);
|
||||
}
|
||||
|
||||
async addFiles(files: string[]) {
|
||||
const filePaths = files.map((file) => path.join(path.resolve(__dirname), '../../../asset', file));
|
||||
this.container.page().once('filechooser', async (fileChooser) => {
|
||||
await fileChooser.setFiles(filePaths);
|
||||
});
|
||||
|
||||
await this.attachmentButton.click();
|
||||
}
|
||||
|
||||
async removeFile(fileName: string) {
|
||||
const files = await this.container.locator(`.file-preview`).all();
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const textContent = await files[i].textContent();
|
||||
if (textContent?.includes(fileName)) {
|
||||
const removeButton = files[i].locator('.icon-close');
|
||||
await removeButton.click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async sendMessage() {
|
||||
await this.input.scrollIntoViewIfNeeded();
|
||||
|
||||
await expect(this.sendMessageButton).toBeVisible();
|
||||
await expect(this.sendMessageButton).toBeEnabled();
|
||||
|
||||
await this.sendMessageButton.click();
|
||||
}
|
||||
|
||||
async postMessage(message: string) {
|
||||
await this.writeMessage(message);
|
||||
await this.sendMessage();
|
||||
}
|
||||
|
||||
async toContainText(text: string) {
|
||||
await expect(this.container).toContainText(text);
|
||||
}
|
||||
}
|
||||
|
||||
export {ChannelsPostEdit};
|
||||
@@ -47,6 +47,13 @@ export default class PostMenu {
|
||||
await this.dotMenuButton.waitFor();
|
||||
await this.dotMenuButton.click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks on dot menu button.
|
||||
*/
|
||||
async clickOnDotMenu() {
|
||||
await this.dotMenuButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
export {PostMenu};
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, Locator} from '@playwright/test';
|
||||
|
||||
export default class RestorePostConfirmationDialog {
|
||||
readonly container: Locator;
|
||||
|
||||
readonly cancelButton;
|
||||
readonly confirmButton;
|
||||
|
||||
constructor(container: Locator) {
|
||||
this.container = container;
|
||||
|
||||
this.cancelButton = container.locator('button.btn.btn-tertiary');
|
||||
this.confirmButton = container.locator('button.GenericModal__button.btn.btn-primary.confirm');
|
||||
}
|
||||
|
||||
async toBeVisible() {
|
||||
await expect(this.container).toBeVisible();
|
||||
await expect(this.cancelButton).toBeVisible();
|
||||
await expect(this.confirmButton).toBeVisible();
|
||||
}
|
||||
|
||||
async notToBeVisible() {
|
||||
await expect(this.container).not.toBeVisible();
|
||||
}
|
||||
|
||||
async confirmRestore() {
|
||||
await this.confirmButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
export {RestorePostConfirmationDialog};
|
||||
@@ -71,7 +71,7 @@ export default class ScheduledDraftModal {
|
||||
*/
|
||||
async selectTime() {
|
||||
await this.timeLocator.click();
|
||||
const timeButton = this.timeDropdownOptions.first();
|
||||
const timeButton = this.timeDropdownOptions.nth(1);
|
||||
await expect(timeButton).toBeVisible();
|
||||
await timeButton.click();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@ export default class ChannelsSidebarLeft {
|
||||
await expect(this.container).toBeVisible();
|
||||
}
|
||||
|
||||
async assertNoPendingScheduledDraft() {
|
||||
await expect(this.scheduledDraftCountonLHS).not.toBeVisible();
|
||||
}
|
||||
|
||||
async assertscheduledDraftCountLHS(count: string) {
|
||||
await expect(this.scheduledDraftCountonLHS).toBeVisible();
|
||||
await expect(this.scheduledDraftCountonLHS).toHaveText(count);
|
||||
|
||||
@@ -15,17 +15,27 @@ export default class ChannelsSidebarRight {
|
||||
readonly scheduledDraftChannelInfoMessage;
|
||||
readonly scheduledDraftSeeAllLink;
|
||||
readonly scheduledDraftChannelInfoMessageText;
|
||||
readonly editTextbox;
|
||||
readonly postEdit;
|
||||
readonly currentVersionEditedPosttext;
|
||||
readonly restorePreviousPostVersionIcon;
|
||||
|
||||
constructor(container: Locator) {
|
||||
this.container = container;
|
||||
|
||||
this.postBoxIndicator = container.locator('div.postBoxIndicator');
|
||||
this.scheduledDraftChannelInfoMessage = container.locator('div.ScheduledPostIndicator span');
|
||||
this.scheduledDraftSeeAllLink = container.locator('a:has-text("See all scheduled messages")');
|
||||
this.scheduledDraftSeeAllLink = container.locator('a:has-text("See all")');
|
||||
this.scheduledDraftChannelInfoMessageText = container.locator('span:has-text("Message scheduled for")');
|
||||
this.rhsPostBody = container.locator('.post-message__text');
|
||||
this.postCreate = new components.ChannelsPostCreate(container.getByTestId('comment-create'), true);
|
||||
this.closeButton = container.locator('#rhsCloseButton');
|
||||
this.editTextbox = container.locator('#edit_textbox');
|
||||
this.postEdit = new components.ChannelsPostEdit(container.locator('.post-edit__container'));
|
||||
this.currentVersionEditedPosttext = (postID: any) => container.locator(`#rhsPostMessageText_${postID} p`);
|
||||
this.restorePreviousPostVersionIcon = container.locator(
|
||||
'button[aria-label="Select to restore an old message."]',
|
||||
);
|
||||
}
|
||||
|
||||
async toBeVisible() {
|
||||
@@ -51,6 +61,12 @@ export default class ChannelsSidebarRight {
|
||||
return new components.ChannelsPost(post);
|
||||
}
|
||||
|
||||
async getFirstPost() {
|
||||
const post = this.container.getByTestId('rhsPostView').first();
|
||||
await post.waitFor();
|
||||
return new components.ChannelsPost(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the RHS
|
||||
*/
|
||||
@@ -65,6 +81,19 @@ export default class ChannelsSidebarRight {
|
||||
await this.scheduledDraftSeeAllLink.isVisible();
|
||||
await this.scheduledDraftSeeAllLink.click();
|
||||
}
|
||||
|
||||
async toContainText(text: string) {
|
||||
await expect(this.container).toContainText(text);
|
||||
}
|
||||
|
||||
async verifyCurrentVersionPostMessage(postID: string | null, postMessageContent: string) {
|
||||
expect(await this.currentVersionEditedPosttext(postID).textContent()).toBe(postMessageContent);
|
||||
}
|
||||
|
||||
async restorePreviousPostVersion() {
|
||||
await this.restorePreviousPostVersionIcon.isVisible();
|
||||
await this.restorePreviousPostVersionIcon.click();
|
||||
}
|
||||
}
|
||||
|
||||
export {ChannelsSidebarRight};
|
||||
|
||||
@@ -33,6 +33,9 @@ import {SystemUsers} from './system_console/sections/system_users/system_users';
|
||||
import {SystemUsersFilterPopover} from './system_console/sections/system_users/filter_popover';
|
||||
import {SystemUsersFilterMenu} from './system_console/sections/system_users/filter_menu';
|
||||
import {SystemUsersColumnToggleMenu} from './system_console/sections/system_users/column_toggle_menu';
|
||||
import ChannelsPostEdit from '@e2e-support/ui/components/channels/post_edit';
|
||||
import DeletePostConfirmationDialog from '@e2e-support/ui/components/channels/delete_post_confirmation_dialog';
|
||||
import RestorePostConfirmationDialog from '@e2e-support/ui/components/channels/restore_post_confirmation_dialog';
|
||||
|
||||
const components = {
|
||||
GlobalHeader,
|
||||
@@ -43,6 +46,7 @@ const components = {
|
||||
ChannelsAppBar,
|
||||
ChannelsHeader,
|
||||
ChannelsPostCreate,
|
||||
ChannelsPostEdit,
|
||||
ChannelsPost,
|
||||
FindChannelsModal,
|
||||
DeletePostModal,
|
||||
@@ -65,6 +69,8 @@ const components = {
|
||||
SystemUsersColumnToggleMenu,
|
||||
MessagePriority,
|
||||
UserProfilePopover,
|
||||
DeletePostConfirmationDialog,
|
||||
RestorePostConfirmationDialog,
|
||||
};
|
||||
|
||||
export {
|
||||
@@ -76,6 +82,7 @@ export {
|
||||
ChannelsAppBar,
|
||||
ChannelsHeader,
|
||||
ChannelsPostCreate,
|
||||
ChannelsPostEdit,
|
||||
ChannelsPost,
|
||||
FindChannelsModal,
|
||||
DeletePostModal,
|
||||
@@ -83,4 +90,5 @@ export {
|
||||
PostMenu,
|
||||
ThreadFooter,
|
||||
MessagePriority,
|
||||
DeletePostConfirmationDialog,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,351 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {test} from '@e2e-support/test_fixture';
|
||||
import {expect} from '@playwright/test';
|
||||
import {duration, wait} from '@e2e-support/util';
|
||||
import {moveMouseToCenter} from '@e2e-support/test_action';
|
||||
|
||||
test('MM-T5654_1 should be able to add attachments while editing a post', async ({pw}) => {
|
||||
const originalMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
|
||||
const {user} = await pw.initSetup();
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.centerView.postCreate.postMessage(originalMessage);
|
||||
|
||||
const post = await channelsPage.centerView.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
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.centerView.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.centerView.postCreate.postMessage(originalMessage);
|
||||
|
||||
const post = await channelsPage.centerView.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
await channelsPage.postDotMenu.toBeVisible();
|
||||
await channelsPage.postDotMenu.replyMenuItem.click();
|
||||
await channelsPage.sidebarRight.toBeVisible();
|
||||
await channelsPage.sidebarRight.postCreate.toBeVisible();
|
||||
await channelsPage.sidebarRight.postCreate.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 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 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 wait(duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.sendMessage();
|
||||
await wait(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 moveMouseToCenter(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 wait(duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.removeFile('mattermost.png');
|
||||
await wait(duration.half_sec);
|
||||
await channelsPage.sidebarRight.postEdit.sendMessage();
|
||||
|
||||
updatedReplyPost = await channelsPage.sidebarRight.getLastPost();
|
||||
await updatedReplyPost.toBeVisible();
|
||||
await updatedReplyPost.toContainText('Edited reply message with files');
|
||||
expect(updatedReplyPost).not.toContain('sample_text_file.txt');
|
||||
expect(updatedReplyPost).not.toContain('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} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.centerView.postCreate.postMessage(originalMessage, ['sample_text_file.txt']);
|
||||
|
||||
const post = await channelsPage.centerView.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
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.centerView.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} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.centerView.postCreate.postMessage(originalMessage);
|
||||
|
||||
const post = await channelsPage.centerView.getLastPost();
|
||||
await post.toBeVisible();
|
||||
await post.hover();
|
||||
await post.postMenu.toBeVisible();
|
||||
|
||||
// open the dot menu
|
||||
await post.postMenu.dotMenuButton.click();
|
||||
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.centerView.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 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.centerView.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.centerView.postCreate.postMessage(originalMessage, [
|
||||
'sample_text_file.txt',
|
||||
'mattermost.png',
|
||||
'archive.zip',
|
||||
]);
|
||||
|
||||
const post = await channelsPage.centerView.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 moveMouseToCenter(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.centerView.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText(originalMessage);
|
||||
await updatedPost.toContainText('mattermost.png');
|
||||
await updatedPost.toContainText('archive.zip');
|
||||
expect(updatedPost).not.toContain('archive.zip');
|
||||
});
|
||||
|
||||
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} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.centerView.postCreate.postMessage(originalMessage, ['sample_text_file.txt']);
|
||||
|
||||
const post = await channelsPage.centerView.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 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();
|
||||
|
||||
expect(channelsPage).not.toContain(originalMessage);
|
||||
expect(channelsPage).not.toContain('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.centerView.postCreate.postMessage(originalMessage, [
|
||||
'sample_text_file.txt',
|
||||
'mattermost.png',
|
||||
'archive.zip',
|
||||
]);
|
||||
|
||||
const post = await channelsPage.centerView.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 moveMouseToCenter(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.centerView.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText(originalMessage);
|
||||
expect(updatedPost).not.toContain('archive.zip');
|
||||
expect(updatedPost).not.toContain('mattermost.png');
|
||||
expect(updatedPost).not.toContain('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} = await pw.testBrowser.login(user);
|
||||
|
||||
await channelsPage.goto();
|
||||
await channelsPage.toBeVisible();
|
||||
await channelsPage.centerView.postCreate.postMessage(originalMessage, ['sample_text_file.txt']);
|
||||
|
||||
const post = await channelsPage.centerView.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 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.centerView.getLastPost();
|
||||
await updatedPost.toBeVisible();
|
||||
await updatedPost.toContainText(newMessage);
|
||||
expect(updatedPost).not.toContain('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.centerView.getLastPost();
|
||||
await restoredPost.toBeVisible();
|
||||
expect(restoredPost.toContainText('sample_text_file.txt'));
|
||||
});
|
||||
@@ -1,16 +1,19 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, Page} from '@playwright/test';
|
||||
import {test} from '@e2e-support/test_fixture';
|
||||
import {ChannelsPage, ScheduledDraftPage} from '@e2e-support/ui/pages';
|
||||
import {duration, wait} from '@e2e-support/util';
|
||||
|
||||
test.fixme('MM-T5643_1 should create a scheduled message from a channel', async ({pw}) => {
|
||||
test.setTimeout(120000);
|
||||
test('MM-T5643_1 should create a scheduled message from a channel', async ({pw}) => {
|
||||
test.setTimeout(duration.four_min);
|
||||
|
||||
const draftMessage = 'Scheduled Draft';
|
||||
// # Skip test if no license
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
const {user, team} = await pw.initSetup();
|
||||
const {user} = await pw.initSetup();
|
||||
const {page, channelsPage, scheduledDraftPage} = await pw.testBrowser.login(user);
|
||||
|
||||
await setupChannelPage(channelsPage, draftMessage);
|
||||
@@ -32,21 +35,18 @@ test.fixme('MM-T5643_1 should create a scheduled message from a channel', async
|
||||
await expect(channelsPage.centerView.scheduledDraftChannelInfoMessage).not.toBeVisible();
|
||||
await expect(channelsPage.sidebarLeft.scheduledDraftCountonLHS).not.toBeVisible();
|
||||
await expect(await channelsPage.getLastPost()).toHaveText(draftMessage);
|
||||
|
||||
await verifyNoscheduledDraftsPending(channelsPage, team, scheduledDraftPage, draftMessage);
|
||||
await channelsPage.sidebarLeft.assertNoPendingScheduledDraft();
|
||||
});
|
||||
|
||||
test.fixme('MM-T5643_6 should create a scheduled message under a thread post ', async ({pw}) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
test('MM-T5643_6 should create a scheduled message under a thread post ', async ({pw}) => {
|
||||
const draftMessage = 'Scheduled Threaded Message';
|
||||
// # Skip test if no license
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
const {user, team} = await pw.initSetup();
|
||||
const {user} = await pw.initSetup();
|
||||
|
||||
// # Log in as a user in new browser context
|
||||
const {page, channelsPage, scheduledDraftPage} = await pw.testBrowser.login(user);
|
||||
const {channelsPage, scheduledDraftPage} = await pw.testBrowser.login(user);
|
||||
|
||||
// # Visit default channel page
|
||||
await channelsPage.goto();
|
||||
@@ -94,22 +94,17 @@ test.fixme('MM-T5643_6 should create a scheduled message under a thread post ',
|
||||
// # Hover and verify options
|
||||
await scheduledDraftPage.verifyOnHoverActionItems(draftMessage);
|
||||
|
||||
await goBackToChannelAndWaitForMessageToArrive(page);
|
||||
await scheduledDraftPage.sendScheduledMessage(draftMessage);
|
||||
|
||||
await replyToLastPost(post);
|
||||
await sidebarRight.toBeVisible();
|
||||
(await sidebarRight.getLastPost()).toContainText(draftMessage);
|
||||
|
||||
// * Verify the message has been sent and there's no more scheduled messages
|
||||
await expect(channelsPage.sidebarRight.scheduledDraftChannelInfoMessage).not.toBeVisible();
|
||||
await expect(channelsPage.sidebarLeft.scheduledDraftCountonLHS).not.toBeVisible();
|
||||
|
||||
const lastPost = channelsPage.sidebarRight.rhsPostBody.last();
|
||||
await expect(lastPost).toHaveText(draftMessage);
|
||||
await expect(scheduledDraftPage.scheduledDraftPanel(draftMessage)).not.toBeVisible();
|
||||
|
||||
await verifyNoscheduledDraftsPending(channelsPage, team, scheduledDraftPage, draftMessage);
|
||||
await channelsPage.sidebarLeft.assertNoPendingScheduledDraft();
|
||||
});
|
||||
|
||||
test.fixme('MM-T5644 should reschedule a scheduled message', async ({pw}) => {
|
||||
test('MM-T5644 should reschedule a scheduled message', async ({pw}) => {
|
||||
const draftMessage = 'Scheduled Draft';
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
@@ -141,7 +136,7 @@ test.fixme('MM-T5644 should reschedule a scheduled message', async ({pw}) => {
|
||||
await compareMessageTimestamps(rescheduledDraftChannelInfo, scheduledDraftPageInfo, scheduledDraftPage);
|
||||
});
|
||||
|
||||
test.fixme('MM-T5645 should delete a scheduled message', async ({pw}) => {
|
||||
test('MM-T5645 should delete a scheduled message', async ({pw}) => {
|
||||
const draftMessage = 'Scheduled Draft';
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
@@ -160,7 +155,7 @@ test.fixme('MM-T5645 should delete a scheduled message', async ({pw}) => {
|
||||
await expect(scheduledDraftPage.noscheduledDraftIcon).toBeVisible();
|
||||
});
|
||||
|
||||
test.fixme('MM-T5643_9 should send a scheduled message immediately', async ({pw}) => {
|
||||
test('MM-T5643_9 should send a scheduled message immediately', async ({pw}) => {
|
||||
const draftMessage = 'Scheduled Draft';
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
@@ -174,6 +169,7 @@ test.fixme('MM-T5643_9 should send a scheduled message immediately', async ({pw}
|
||||
await verifyScheduledDraft(channelsPage, scheduledDraftPage, draftMessage, postBoxIndicator);
|
||||
|
||||
await scheduledDraftPage.sendScheduledMessage(draftMessage);
|
||||
await wait(duration.two_sec);
|
||||
|
||||
await expect(scheduledDraftPage.scheduledDraftPanel(draftMessage)).not.toBeVisible();
|
||||
|
||||
@@ -183,9 +179,7 @@ test.fixme('MM-T5643_9 should send a scheduled message immediately', async ({pw}
|
||||
await expect(await channelsPage.getLastPost()).toHaveText(draftMessage);
|
||||
});
|
||||
|
||||
test.fixme('MM-T5643_3 should create a scheduled message from a DM', async ({pw}) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
test('MM-T5643_3 should create a scheduled message from a DM', async ({pw}) => {
|
||||
const draftMessage = 'Scheduled Draft';
|
||||
// # Skip test if no license
|
||||
await pw.skipIfNoLicense();
|
||||
@@ -207,20 +201,18 @@ test.fixme('MM-T5643_3 should create a scheduled message from a DM', async ({pw}
|
||||
// # Hover and verify options
|
||||
await scheduledDraftPage.verifyOnHoverActionItems(draftMessage);
|
||||
|
||||
// # Go back and wait for message to arrive
|
||||
await goBackToChannelAndWaitForMessageToArrive(page);
|
||||
await scheduledDraftPage.sendScheduledMessage(draftMessage);
|
||||
await page.waitForSelector(channelsPage.centerView.scheduledDraftChannelInfoMessageLocator, {state: 'hidden'});
|
||||
|
||||
// * Verify the message has been sent and there's no more scheduled messages
|
||||
await expect(channelsPage.centerView.scheduledDraftChannelInfoMessage).not.toBeVisible();
|
||||
await expect(channelsPage.sidebarLeft.scheduledDraftCountonLHS).not.toBeVisible();
|
||||
await expect(await channelsPage.getLastPost()).toHaveText(draftMessage);
|
||||
|
||||
await verifyNoscheduledDraftsPending(channelsPage, team, scheduledDraftPage, draftMessage);
|
||||
await channelsPage.sidebarLeft.assertNoPendingScheduledDraft();
|
||||
});
|
||||
|
||||
test('MM-T5648 should create a draft and then schedule it', async ({pw}) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
const draftMessage = 'Draft to be Scheduled';
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
@@ -250,14 +242,12 @@ test('MM-T5648 should create a draft and then schedule it', async ({pw}) => {
|
||||
await scheduledDraftPage.assertscheduledDraftBody(draftMessage);
|
||||
});
|
||||
|
||||
test.fixme('MM-T5644 should edit scheduled message', async ({pw}) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
test('MM-T5644 should edit scheduled message', async ({pw}) => {
|
||||
const draftMessage = 'Scheduled Draft';
|
||||
// # Skip test if no license
|
||||
await pw.skipIfNoLicense();
|
||||
|
||||
const {user, team} = await pw.initSetup();
|
||||
const {user} = await pw.initSetup();
|
||||
const {page, channelsPage, scheduledDraftPage} = await pw.testBrowser.login(user);
|
||||
|
||||
await setupChannelPage(channelsPage, draftMessage);
|
||||
@@ -275,20 +265,18 @@ test.fixme('MM-T5644 should edit scheduled message', async ({pw}) => {
|
||||
const updatedText = 'updated text';
|
||||
await scheduledDraftPage.editText(updatedText);
|
||||
|
||||
// # Go back and wait for message to arrive
|
||||
await goBackToChannelAndWaitForMessageToArrive(page);
|
||||
await scheduledDraftPage.sendScheduledMessage(updatedText);
|
||||
|
||||
// * Verify the message has been sent and there's no more scheduled messages
|
||||
await page.waitForSelector(channelsPage.centerView.scheduledDraftChannelInfoMessageLocator, {state: 'hidden'});
|
||||
await expect(channelsPage.centerView.scheduledDraftChannelInfoMessage).not.toBeVisible();
|
||||
await expect(channelsPage.sidebarLeft.scheduledDraftCountonLHS).not.toBeVisible();
|
||||
await expect(await channelsPage.getLastPost()).toHaveText(draftMessage);
|
||||
await expect(await channelsPage.getLastPost()).toHaveText(updatedText);
|
||||
|
||||
await verifyNoscheduledDraftsPending(channelsPage, team, scheduledDraftPage, draftMessage);
|
||||
await channelsPage.sidebarLeft.assertNoPendingScheduledDraft();
|
||||
});
|
||||
|
||||
test.fixme('MM-T5650 should copy scheduled message', async ({pw, browserName}) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
test('MM-T5650 should copy scheduled message', async ({pw, browserName}) => {
|
||||
// Skip this test in Firefox clipboard permissions are not supported
|
||||
test.skip(browserName === 'firefox', 'Test not supported in Firefox');
|
||||
|
||||
@@ -315,28 +303,17 @@ test.fixme('MM-T5650 should copy scheduled message', async ({pw, browserName}) =
|
||||
|
||||
await channelsPage.centerView.postCreate.input.focus();
|
||||
|
||||
await page.keyboard.down('Meta');
|
||||
await page.keyboard.down('ControlOrMeta');
|
||||
await page.keyboard.press('V');
|
||||
await page.keyboard.up('Meta');
|
||||
await page.keyboard.up('ControlOrMeta');
|
||||
|
||||
// * Assert the message typed is same as the copied message
|
||||
await expect(channelsPage.centerView.postCreate.input).toHaveText(draftMessage);
|
||||
});
|
||||
|
||||
async function verifyNoscheduledDraftsPending(
|
||||
channelsPage: ChannelsPage,
|
||||
team: any,
|
||||
scheduledDraftPage: ScheduledDraftPage,
|
||||
draftMessage: string,
|
||||
): Promise<void> {
|
||||
await channelsPage.goto(team.name, 'scheduled_posts');
|
||||
await expect(scheduledDraftPage.scheduledDraftPanel(draftMessage)).not.toBeVisible();
|
||||
await expect(scheduledDraftPage.noscheduledDraftIcon).toBeVisible();
|
||||
}
|
||||
|
||||
async function goBackToChannelAndWaitForMessageToArrive(page: Page): Promise<void> {
|
||||
await page.goBack();
|
||||
await wait(duration.half_min);
|
||||
await wait(duration.two_min);
|
||||
await page.reload();
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user