feat(e2e): Verify Test Notification on Desktop (#3162)
This commit is contained in:
30
e2e/specs/notification_trigger/helpers.js
Normal file
30
e2e/specs/notification_trigger/helpers.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
export async function triggerTestNotification(firstServer) {
|
||||
await firstServer.click('div#CustomizeYourExperienceTour > button');
|
||||
const sendNotificationButton = await firstServer.waitForSelector('.sectionNoticeButton.btn-primary');
|
||||
await sendNotificationButton.scrollIntoViewIfNeeded();
|
||||
const textBeforeClick = await sendNotificationButton.textContent();
|
||||
textBeforeClick.should.equal('Send a test notification');
|
||||
await sendNotificationButton.click();
|
||||
await asyncSleep(3000);
|
||||
const textAfterClick = await sendNotificationButton.textContent();
|
||||
textAfterClick.should.equal('Test notification sent');
|
||||
}
|
||||
|
||||
export async function verifyNotificationRecievedinDM(firstServer) {
|
||||
await firstServer.click('#accountSettingsHeader > button.close');
|
||||
const sidebarLink = await firstServer.locator('a.SidebarLink:has-text("system-bot")');
|
||||
const badgeElement = await sidebarLink.locator('span.badge');
|
||||
const badgeCount = await badgeElement.textContent();
|
||||
badgeCount.should.equal('1');
|
||||
|
||||
sidebarLink.click();
|
||||
await asyncSleep(1000);
|
||||
|
||||
const lastPostBody = await firstServer.locator('div.post__body').last();
|
||||
const textContent = await lastPostBody.textContent();
|
||||
textContent.should.equal('If you received this test notification, it worked!');
|
||||
}
|
Reference in New Issue
Block a user