-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(e2e): Verify Test Notification on Desktop #3162
base: master
Are you sure you want to change the base?
Changes from all commits
5e76ce1
2759c14
37ccff3
831ad45
ee013e1
c989127
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ const downloadsLocation = path.join(userDataDir, 'Downloads'); | |
const boundsInfoPath = path.join(userDataDir, 'bounds-info.json'); | ||
const appUpdatePath = path.join(userDataDir, 'app-update.yml'); | ||
const exampleURL = 'http://example.com/'; | ||
const mattermostURL = process.env.MM_TEST_SERVER_URL || 'http://localhost:8065/'; | ||
const mattermostURL = 'https://mattermost-pr-28334.test.mattermost.cloud/'; // process.env.MM_TEST_SERVER_URL || 'http://localhost:8065/'; | ||
|
||
if (process.platform === 'win32') { | ||
const robot = require('robotjs'); | ||
|
@@ -266,8 +266,8 @@ module.exports = { | |
await window.waitForSelector('#input_password-input'); | ||
await window.waitForSelector('#saveSetting'); | ||
|
||
await window.type('#input_loginId', process.env.MM_TEST_USER_NAME); | ||
await window.type('#input_password-input', process.env.MM_TEST_PASSWORD); | ||
await window.type('#input_loginId', 'sysadmin'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
await window.type('#input_password-input', 'Sys@dmin123'); | ||
await window.click('#saveSetting'); | ||
}, | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const {asyncSleep} = require('../../modules/utils'); | ||
Check failure on line 1 in e2e/specs/notification_trigger/helpers.js GitHub Actions / build-mac-no-dmg
Check failure on line 1 in e2e/specs/notification_trigger/helpers.js GitHub Actions / build-linux
|
||
|
||
export async function triggerTestNotification(firstServer) { | ||
devinbinnie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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() | ||
Check failure on line 22 in e2e/specs/notification_trigger/helpers.js GitHub Actions / build-mac-no-dmg
Check failure on line 22 in e2e/specs/notification_trigger/helpers.js GitHub Actions / build-linux
|
||
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!"); | ||
Check failure on line 27 in e2e/specs/notification_trigger/helpers.js GitHub Actions / build-mac-no-dmg
Check failure on line 27 in e2e/specs/notification_trigger/helpers.js GitHub Actions / build-linux
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {triggerTestNotification, verifyNotificationRecievedinDM} from './helpers'; | ||
Check failure on line 4 in e2e/specs/notification_trigger/notification_badge_in_dock.test.js GitHub Actions / build-mac-no-dmg
Check failure on line 4 in e2e/specs/notification_trigger/notification_badge_in_dock.test.js GitHub Actions / build-linux
|
||
const fs = require('fs'); | ||
Check failure on line 5 in e2e/specs/notification_trigger/notification_badge_in_dock.test.js GitHub Actions / build-mac-no-dmg
Check failure on line 5 in e2e/specs/notification_trigger/notification_badge_in_dock.test.js GitHub Actions / build-linux
|
||
const env = require('../../modules/environment'); | ||
const {asyncSleep} = require('../../modules/utils'); | ||
|
||
|
||
Check failure on line 9 in e2e/specs/notification_trigger/notification_badge_in_dock.test.js GitHub Actions / build-mac-no-dmg
Check failure on line 9 in e2e/specs/notification_trigger/notification_badge_in_dock.test.js GitHub Actions / build-linux
|
||
describe('Trigger Notification From desktop', function desc() { | ||
this.timeout(400000); | ||
|
||
const config = env.demoMattermostConfig; | ||
let firstServer; | ||
|
||
beforeEach(async () => { | ||
env.cleanDataDir(); | ||
env.createTestUserDataDir(); | ||
env.cleanTestConfig(); | ||
fs.writeFileSync(env.configFilePath, JSON.stringify(config)); | ||
await asyncSleep(1000); | ||
this.app = await env.getApp(); | ||
this.serverMap = await env.getServerMap(this.app); | ||
|
||
const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); | ||
await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); | ||
firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; | ||
await env.loginToMattermost(firstServer); | ||
const textbox = await firstServer.waitForSelector('#post_textbox'); | ||
textbox.focus(); | ||
}); | ||
|
||
// This support to getBadge is only available for MacOS | ||
env.shouldTest(it, process.platform === 'darwin')('should receive a notification on macOS', async () => { | ||
await triggerTestNotification(firstServer); | ||
const badgeValue = await this.app.evaluate(async ({app}) => { | ||
return app.dock.getBadge(); | ||
}); | ||
badgeValue.should.equal('1'); | ||
await verifyNotificationRecievedinDM(firstServer); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this wasn't intended to be merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah @devinbinnie .
sorry, I should have added a note. I'll remove it once the Dev PR gets into master