|
|
|
|
@@ -16,53 +16,59 @@ test.beforeEach(async ({pw}) => {
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5643_1 should create a scheduled message from a channel', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
// Set test timeout to 4 mins to wait for the scheduled message to be sent
|
|
|
|
|
// which is expected within 2 mins.
|
|
|
|
|
test.setTimeout(pw.duration.four_min);
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5643_1 creates scheduled message from channel and posts at scheduled time',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
// Set test timeout to 4 mins to wait for the scheduled message to be sent
|
|
|
|
|
// which is expected within 2 mins.
|
|
|
|
|
test.setTimeout(pw.duration.four_min);
|
|
|
|
|
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {page, channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {page, channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a scheduled message
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 0, 1);
|
|
|
|
|
// # Create a scheduled message with short delay
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 0, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post indicator with correct date/time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
// * Verify scheduled post indicator shows correct date and time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post badge in left sidebar shows correct count
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
// * Verify scheduled post badge in left sidebar shows count of 1
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
|
|
|
|
|
// 3. Click "See all link" to navigate to scheduled posts page
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page via "See all" link
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
await verifyScheduledPost(scheduledPostsPage, {draftMessage, sendOnMessage, badgeCountOnTab: 1});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
await verifyScheduledPost(scheduledPostsPage, {draftMessage, sendOnMessage, badgeCountOnTab: 1});
|
|
|
|
|
|
|
|
|
|
// 4. Go back to the channels page
|
|
|
|
|
await page.goBack();
|
|
|
|
|
// # Return to the channels page
|
|
|
|
|
await page.goBack();
|
|
|
|
|
|
|
|
|
|
// * Verify the message has been posted and there's no more scheduled messages
|
|
|
|
|
await pw.waitUntil(
|
|
|
|
|
async () => {
|
|
|
|
|
const post = await channelsPage.getLastPost();
|
|
|
|
|
const content = await post.container.textContent();
|
|
|
|
|
// * Verify scheduled message was posted successfully
|
|
|
|
|
await pw.waitUntil(
|
|
|
|
|
async () => {
|
|
|
|
|
const post = await channelsPage.getLastPost();
|
|
|
|
|
const content = await post.container.textContent();
|
|
|
|
|
|
|
|
|
|
return content?.includes(draftMessage);
|
|
|
|
|
},
|
|
|
|
|
{timeout: pw.duration.two_min},
|
|
|
|
|
);
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(scheduledPostsPage.badge).not.toBeVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
});
|
|
|
|
|
return content?.includes(draftMessage);
|
|
|
|
|
},
|
|
|
|
|
{timeout: pw.duration.two_min},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled indicators are removed after posting
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(scheduledPostsPage.badge).not.toBeVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to create a scheduled message in a thread.
|
|
|
|
|
@@ -70,54 +76,60 @@ test('MM-T5643_1 should create a scheduled message from a channel', {tag: '@sche
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5643_6 should create a scheduled message under a thread post', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Threaded Message ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5643_6 creates scheduled message in thread and posts in thread conversation',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Threaded Message ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Post a message
|
|
|
|
|
await channelsPage.postMessage('Root Message');
|
|
|
|
|
// # Create a root message in the channel
|
|
|
|
|
await channelsPage.postMessage('Root Message');
|
|
|
|
|
|
|
|
|
|
// 3. Reply to a message
|
|
|
|
|
const {sidebarRight} = await channelsPage.replyToLastPost('Replying to a thread');
|
|
|
|
|
// # Start a thread by replying to the message
|
|
|
|
|
const {sidebarRight} = await channelsPage.replyToLastPost('Replying to a thread');
|
|
|
|
|
|
|
|
|
|
// 4. Create a scheduled message from the thread
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessageFromThread(draftMessage, 1);
|
|
|
|
|
// # Create a scheduled message within the thread
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessageFromThread(draftMessage, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post indicator with correct date/time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(sidebarRight.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
// * Verify scheduled post indicator shows correct date and time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(sidebarRight.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// 5. Navigate to scheduled posts page
|
|
|
|
|
await sidebarRight.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page using indicator link
|
|
|
|
|
await sidebarRight.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 6. Hover over the scheduled post and send now
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
// # Send the scheduled message immediately
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
|
|
|
|
|
// * Verify the message has been posted and there's no more scheduled messages
|
|
|
|
|
await sidebarRight.toBeVisible();
|
|
|
|
|
const lastPost = await sidebarRight.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toContainText(draftMessage);
|
|
|
|
|
await sidebarRight.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(scheduledPostsPage.noScheduledDrafts).toBeVisible();
|
|
|
|
|
await expect(scheduledPostsPage.badge).not.toBeVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
});
|
|
|
|
|
// * Verify message is posted in the thread
|
|
|
|
|
await sidebarRight.toBeVisible();
|
|
|
|
|
const lastPost = await sidebarRight.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toContainText(draftMessage);
|
|
|
|
|
|
|
|
|
|
// * Verify all scheduled message indicators are removed
|
|
|
|
|
await sidebarRight.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(scheduledPostsPage.noScheduledDrafts).toBeVisible();
|
|
|
|
|
await expect(scheduledPostsPage.badge).not.toBeVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to reschedule a scheduled message.
|
|
|
|
|
@@ -125,49 +137,51 @@ test('MM-T5643_6 should create a scheduled message under a thread post', {tag: '
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5644 should reschedule a scheduled message', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5644_2 reschedules message to a future date from scheduled posts page',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a scheduled message with 1 day offset
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
// # Create a scheduled message for tomorrow
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled message indicator appears with correct date/time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
// * Verify scheduled message indicator shows correct date and time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post badge in left sidebar shows correct count
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
// * Verify scheduled post badge appears with count of 1
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
|
|
|
|
|
// 3. Navigate to scheduled posts page
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page via indicator link
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 4. Reschedule message to 2 days from today
|
|
|
|
|
const {selectedDate: newSelectedDate, selectedTime: newSelectedTime} = await scheduledPostsPage.rescheduleMessage(
|
|
|
|
|
scheduledPost,
|
|
|
|
|
2,
|
|
|
|
|
);
|
|
|
|
|
// # Reschedule the message to a different date (2 days from now)
|
|
|
|
|
const {selectedDate: newSelectedDate, selectedTime: newSelectedTime} =
|
|
|
|
|
await scheduledPostsPage.rescheduleMessage(scheduledPost, 2);
|
|
|
|
|
|
|
|
|
|
// 5. Return to channel page
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
// # Return to channel page
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
|
|
|
|
|
// * Verify the message shows updated scheduled time
|
|
|
|
|
const newIndicatorMessage = `Message scheduled for ${newSelectedDate} at ${newSelectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, newIndicatorMessage);
|
|
|
|
|
});
|
|
|
|
|
// * Verify indicator shows the updated scheduled time
|
|
|
|
|
const newIndicatorMessage = `Message scheduled for ${newSelectedDate} at ${newSelectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, newIndicatorMessage);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to delete a scheduled message.
|
|
|
|
|
@@ -175,45 +189,50 @@ test('MM-T5644 should reschedule a scheduled message', {tag: '@scheduled_message
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5645 should delete a scheduled message', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5645 deletes scheduled message from scheduled posts page and removes all indicators',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a scheduled message with 1 day offset
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
// # Create a scheduled message for tomorrow
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled message indicator appears with correct date/time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
// * Verify scheduled message indicator shows correct date and time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// 3. Navigate to scheduled posts page
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page via indicator link
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 4. Delete the scheduled message
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.deleteButton.click();
|
|
|
|
|
// # Delete the scheduled message
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.deleteButton.click();
|
|
|
|
|
|
|
|
|
|
await scheduledPostsPage.deleteScheduledPostModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.deleteScheduledPostModal.deleteButton.click();
|
|
|
|
|
// # Confirm deletion in the modal
|
|
|
|
|
await scheduledPostsPage.deleteScheduledPostModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.deleteScheduledPostModal.deleteButton.click();
|
|
|
|
|
|
|
|
|
|
// * Verify the scheduled message is removed from the scheduled posts page
|
|
|
|
|
await expect(scheduledPostsPage.noScheduledDrafts).toBeVisible();
|
|
|
|
|
await expect(scheduledPostsPage.badge).not.toBeVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
});
|
|
|
|
|
// * Verify the scheduled message is removed and no longer appears
|
|
|
|
|
await expect(scheduledPostsPage.noScheduledDrafts).toBeVisible();
|
|
|
|
|
await expect(scheduledPostsPage.badge).not.toBeVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to send a scheduled message immediately.
|
|
|
|
|
@@ -221,46 +240,54 @@ test('MM-T5645 should delete a scheduled message', {tag: '@scheduled_messages'},
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5643_9 should send a scheduled message immediately', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5643_9 sends scheduled message immediately from scheduled posts page',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user, townSquareUrl} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user, townSquareUrl} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a scheduled message with 1 day offset
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
// # Create a scheduled message for tomorrow
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled message indicator appears with correct date/time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
// * Verify scheduled message indicator shows correct date and time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// 3. Navigate to scheduled posts page
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page via indicator link
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 4. Send the scheduled message immediately
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
// # Send the scheduled message immediately instead of waiting
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
|
|
|
|
|
// * Verify it redirects to the channels page, the message has been posted and there's no more scheduled messages
|
|
|
|
|
await expect(channelsPage.page).toHaveURL(townSquareUrl);
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
const lastPost = await channelsPage.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toContainText(draftMessage);
|
|
|
|
|
});
|
|
|
|
|
// * Verify page redirects to the channel
|
|
|
|
|
await expect(channelsPage.page).toHaveURL(townSquareUrl);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled indicators are removed
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// * Verify message was posted in the channel
|
|
|
|
|
const lastPost = await channelsPage.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toContainText(draftMessage);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to create a scheduled message from a direct message (DM).
|
|
|
|
|
@@ -268,59 +295,67 @@ test('MM-T5643_9 should send a scheduled message immediately', {tag: '@scheduled
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5643_3 should create a scheduled message from a DM', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5643_3 creates scheduled message from DM channel and posts at scheduled time',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user and another user
|
|
|
|
|
const {user, team, adminClient} = await pw.initSetup();
|
|
|
|
|
const otherUser = await adminClient.createUser(pw.random.user(), '', '');
|
|
|
|
|
// # Initialize test setup with main user and create a second user
|
|
|
|
|
const {user, team, adminClient} = await pw.initSetup();
|
|
|
|
|
const otherUser = await adminClient.createUser(pw.random.user(), '', '');
|
|
|
|
|
|
|
|
|
|
// 2. Login the first user and navigate to a DM channel with the other user
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto(team.name, `@${otherUser.username}`);
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Login as first user and navigate to DM channel with second user
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto(team.name, `@${otherUser.username}`);
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 3. Create a scheduled message with 1 day offset
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
// # Create a scheduled message for tomorrow in the DM
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled message indicator appears with correct date/time
|
|
|
|
|
let indicatorMessage;
|
|
|
|
|
if (pw.isOutsideRemoteUserHour(otherUser.timezone)) {
|
|
|
|
|
indicatorMessage = 'You have one scheduled message.';
|
|
|
|
|
} else {
|
|
|
|
|
indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
}
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeVisible();
|
|
|
|
|
await expect(channelsPage.centerView.scheduledPostIndicator.messageText).toContainText(indicatorMessage);
|
|
|
|
|
// * Verify appropriate scheduled message indicator appears
|
|
|
|
|
let indicatorMessage;
|
|
|
|
|
if (pw.isOutsideRemoteUserHour(otherUser.timezone)) {
|
|
|
|
|
indicatorMessage = 'You have one scheduled message.';
|
|
|
|
|
} else {
|
|
|
|
|
indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
}
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeVisible();
|
|
|
|
|
await expect(channelsPage.centerView.scheduledPostIndicator.messageText).toContainText(indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// 4. Navigate to scheduled posts page
|
|
|
|
|
if (pw.isOutsideRemoteUserHour(otherUser.timezone)) {
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.scheduledMessageLink.click();
|
|
|
|
|
} else {
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
}
|
|
|
|
|
// # Navigate to scheduled posts page using appropriate link
|
|
|
|
|
if (pw.isOutsideRemoteUserHour(otherUser.timezone)) {
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.scheduledMessageLink.click();
|
|
|
|
|
} else {
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 5. Send the scheduled message immediately
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
// # Send the scheduled message immediately instead of waiting
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
|
|
|
|
|
// * Verify it redirects to the DM channel, message is posted and there's no more scheduled messages
|
|
|
|
|
await expect(channelsPage.page).toHaveURL(`/${team.name}/messages/@${otherUser.username}`);
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
const lastPost = await channelsPage.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toContainText(draftMessage);
|
|
|
|
|
});
|
|
|
|
|
// * Verify page redirects to the DM channel
|
|
|
|
|
await expect(channelsPage.page).toHaveURL(`/${team.name}/messages/@${otherUser.username}`);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled indicators are removed
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// * Verify message was posted in the DM channel
|
|
|
|
|
const lastPost = await channelsPage.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toContainText(draftMessage);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to convert a draft message to a scheduled message.
|
|
|
|
|
@@ -328,40 +363,46 @@ test('MM-T5643_3 should create a scheduled message from a DM', {tag: '@scheduled
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5648 should create a draft and then schedule it', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5648 converts draft message to scheduled message from drafts page',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user, team} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, draftsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user, team} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, draftsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a draft message
|
|
|
|
|
await channelsPage.centerView.postCreate.input.fill(draftMessage);
|
|
|
|
|
// # Create a draft message without sending it
|
|
|
|
|
await channelsPage.centerView.postCreate.input.fill(draftMessage);
|
|
|
|
|
|
|
|
|
|
// 3. Go to drafts page
|
|
|
|
|
await draftsPage.goto(team.name);
|
|
|
|
|
await draftsPage.toBeVisible();
|
|
|
|
|
expect(await draftsPage.getBadgeCountOnTab()).toBe('1');
|
|
|
|
|
// # Navigate to the drafts page
|
|
|
|
|
await draftsPage.goto(team.name);
|
|
|
|
|
await draftsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// * Verify draft message exists
|
|
|
|
|
const draftedPost = await draftsPage.getLastPost();
|
|
|
|
|
await expect(draftedPost.panelBody).toContainText(draftMessage);
|
|
|
|
|
// * Verify draft count badge shows one draft
|
|
|
|
|
expect(await draftsPage.getBadgeCountOnTab()).toBe('1');
|
|
|
|
|
|
|
|
|
|
// 4. Open schedule modal from draft and schedule it to the next 2 days
|
|
|
|
|
await draftedPost.hover();
|
|
|
|
|
await draftedPost.scheduleButton.click();
|
|
|
|
|
await draftsPage.scheduleMessageModal.toBeVisible();
|
|
|
|
|
const {selectedDate, selectedTime} = await draftsPage.scheduleMessageModal.scheduleMessage(2);
|
|
|
|
|
// * Verify draft message content appears correctly
|
|
|
|
|
const draftedPost = await draftsPage.getLastPost();
|
|
|
|
|
await expect(draftedPost.panelBody).toContainText(draftMessage);
|
|
|
|
|
|
|
|
|
|
// 5. Navigate to scheduled posts page
|
|
|
|
|
await scheduledPostsPage.goto(team.name);
|
|
|
|
|
// # Schedule the draft for 2 days in the future
|
|
|
|
|
await draftedPost.hover();
|
|
|
|
|
await draftedPost.scheduleButton.click();
|
|
|
|
|
await draftsPage.scheduleMessageModal.toBeVisible();
|
|
|
|
|
const {selectedDate, selectedTime} = await draftsPage.scheduleMessageModal.scheduleMessage(2);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
await verifyScheduledPost(scheduledPostsPage, {draftMessage, sendOnMessage, badgeCountOnTab: 1});
|
|
|
|
|
});
|
|
|
|
|
// # Navigate to scheduled posts page
|
|
|
|
|
await scheduledPostsPage.goto(team.name);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
await verifyScheduledPost(scheduledPostsPage, {draftMessage, sendOnMessage, badgeCountOnTab: 1});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to edit a scheduled message before it's sent.
|
|
|
|
|
@@ -369,62 +410,70 @@ test('MM-T5648 should create a draft and then schedule it', {tag: '@scheduled_me
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5644 should edit scheduled message', {tag: '@scheduled_messages'}, async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5644_1 edits scheduled message content while preserving scheduled time',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw}) => {
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user, townSquareUrl} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user, townSquareUrl} = await pw.initSetup();
|
|
|
|
|
const {channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a scheduled message with 2 days offset
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 2);
|
|
|
|
|
// # Create a scheduled message for 2 days in the future
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 2);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled message indicator appears with correct date/time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
// * Verify scheduled message indicator shows correct date and time
|
|
|
|
|
const indicatorMessage = `Message scheduled for ${selectedDate} at ${selectedTime}.`;
|
|
|
|
|
await verifyScheduledPostIndicator(channelsPage.centerView.scheduledPostIndicator, indicatorMessage);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post badge in left sidebar shows correct count
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
// * Verify scheduled post badge shows count of 1
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
|
|
|
|
|
// 3. Navigate to scheduled posts page
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page via indicator link
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 4. Hover and click edit button
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.editButton.click();
|
|
|
|
|
// # Edit the scheduled message content
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.editButton.click();
|
|
|
|
|
const updatedText = 'updated text';
|
|
|
|
|
await scheduledPost.editTextBox.fill(updatedText);
|
|
|
|
|
await scheduledPost.saveButton.click();
|
|
|
|
|
|
|
|
|
|
// 5. Edit the scheduled message
|
|
|
|
|
const updatedText = 'updated text';
|
|
|
|
|
await scheduledPost.editTextBox.fill(updatedText);
|
|
|
|
|
await scheduledPost.saveButton.click();
|
|
|
|
|
// * Verify the edited message content is updated
|
|
|
|
|
await expect(scheduledPost.panelBody).toContainText(updatedText);
|
|
|
|
|
|
|
|
|
|
// 6. Verify the edited message appears in the channel
|
|
|
|
|
await expect(scheduledPost.panelBody).toContainText(updatedText);
|
|
|
|
|
await expect(scheduledPost.panelHeader).toContainText(`Send on ${selectedDate} at ${selectedTime}`);
|
|
|
|
|
// * Verify scheduled date/time remains unchanged
|
|
|
|
|
await expect(scheduledPost.panelHeader).toContainText(`Send on ${selectedDate} at ${selectedTime}`);
|
|
|
|
|
|
|
|
|
|
// 7. Send the message immediately
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
// # Send the edited message immediately
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.sendNowButton.click();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.toBeVisible();
|
|
|
|
|
await scheduledPostsPage.sendMessageNowModal.sendNowButton.click();
|
|
|
|
|
|
|
|
|
|
// * Verify it redirects to the channels page, the message has been posted and there's no more scheduled messages
|
|
|
|
|
await expect(channelsPage.page).toHaveURL(townSquareUrl);
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
const lastPost = await channelsPage.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toHaveText(updatedText);
|
|
|
|
|
});
|
|
|
|
|
// * Verify page redirects to the channel
|
|
|
|
|
await expect(channelsPage.page).toHaveURL(townSquareUrl);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled indicators are removed
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.toBeNotVisible();
|
|
|
|
|
await expect(channelsPage.sidebarLeft.scheduledPostBadge).not.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// * Verify edited message was posted in the channel
|
|
|
|
|
const lastPost = await channelsPage.getLastPost();
|
|
|
|
|
await expect(lastPost.body).toHaveText(updatedText);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @objective Verify the ability to copy a scheduled message to clipboard.
|
|
|
|
|
@@ -432,51 +481,55 @@ test('MM-T5644 should edit scheduled message', {tag: '@scheduled_messages'}, asy
|
|
|
|
|
* @precondition
|
|
|
|
|
* A test server with valid license to support scheduled message features
|
|
|
|
|
*/
|
|
|
|
|
test('MM-T5650 should copy scheduled message', {tag: '@scheduled_messages'}, async ({pw, browserName}) => {
|
|
|
|
|
// Skip this test in Firefox clipboard permissions are not supported
|
|
|
|
|
test.skip(browserName === 'firefox', 'Test not supported in Firefox');
|
|
|
|
|
test(
|
|
|
|
|
'MM-T5650 copies scheduled message text to clipboard for reuse',
|
|
|
|
|
{tag: '@scheduled_messages'},
|
|
|
|
|
async ({pw, browserName}) => {
|
|
|
|
|
// # Skip this test in Firefox since clipboard permissions are not supported
|
|
|
|
|
test.skip(browserName === 'firefox', 'Test not supported in Firefox');
|
|
|
|
|
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
const draftMessage = `Scheduled Draft ${pw.random.id()}`;
|
|
|
|
|
|
|
|
|
|
// 1. Setup test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {page, channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
// # Initialize test user, login and navigate to a channel
|
|
|
|
|
const {user} = await pw.initSetup();
|
|
|
|
|
const {page, channelsPage, scheduledPostsPage} = await pw.testBrowser.login(user);
|
|
|
|
|
await channelsPage.goto();
|
|
|
|
|
await channelsPage.toBeVisible();
|
|
|
|
|
|
|
|
|
|
// 2. Create a scheduled message with 1 day offset
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
// # Create a scheduled message for tomorrow
|
|
|
|
|
const {selectedDate, selectedTime} = await channelsPage.scheduleMessage(draftMessage, 1);
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled post badge in left sidebar shows correct count
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
// * Verify scheduled post badge shows count of 1
|
|
|
|
|
await verifyScheduledPostBadgeOnLeftSidebar(channelsPage, 1);
|
|
|
|
|
|
|
|
|
|
// 3. Navigate to scheduled posts page
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
// # Navigate to scheduled posts page via indicator link
|
|
|
|
|
await channelsPage.centerView.scheduledPostIndicator.seeAllLink.click();
|
|
|
|
|
|
|
|
|
|
// * Verify scheduled posts page displays correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
// * Verify scheduled post appears with correct information
|
|
|
|
|
const sendOnMessage = `Send on ${selectedDate} at ${selectedTime}`;
|
|
|
|
|
const scheduledPost = await verifyScheduledPost(scheduledPostsPage, {
|
|
|
|
|
draftMessage,
|
|
|
|
|
sendOnMessage,
|
|
|
|
|
badgeCountOnTab: 1,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 4. Copy the scheduled message
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.copyTextButton.click();
|
|
|
|
|
// # Copy the scheduled message text to clipboard
|
|
|
|
|
await scheduledPost.hover();
|
|
|
|
|
await scheduledPost.copyTextButton.click();
|
|
|
|
|
|
|
|
|
|
// 5. Return to channel page
|
|
|
|
|
await page.goBack();
|
|
|
|
|
// # Return to the channel page
|
|
|
|
|
await page.goBack();
|
|
|
|
|
|
|
|
|
|
// 6. Paste the copied message in post creator
|
|
|
|
|
await channelsPage.centerView.postCreate.input.focus();
|
|
|
|
|
await page.keyboard.down('ControlOrMeta');
|
|
|
|
|
await page.keyboard.press('V');
|
|
|
|
|
await page.keyboard.up('ControlOrMeta');
|
|
|
|
|
// # Paste the copied message into the post input box
|
|
|
|
|
await channelsPage.centerView.postCreate.input.focus();
|
|
|
|
|
await page.keyboard.down('ControlOrMeta');
|
|
|
|
|
await page.keyboard.press('V');
|
|
|
|
|
await page.keyboard.up('ControlOrMeta');
|
|
|
|
|
|
|
|
|
|
// * Verify the copied message is pasted in the post input box
|
|
|
|
|
await expect(channelsPage.centerView.postCreate.input).toHaveText(draftMessage);
|
|
|
|
|
});
|
|
|
|
|
// * Verify the clipboard content was pasted correctly
|
|
|
|
|
await expect(channelsPage.centerView.postCreate.input).toHaveText(draftMessage);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Verifies that the scheduled post indicator is visible and displays the correct date and time.
|
|
|
|
|
|