2020-03-14 04:08:30 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const util = require('./util');
|
|
|
|
const MultiUsers = require('../user/multiusers');
|
|
|
|
const params = require('../params');
|
|
|
|
const ne = require('./elements');
|
2020-03-20 01:01:55 +08:00
|
|
|
const we = require('../whiteboard/elements');
|
2020-03-14 04:08:30 +08:00
|
|
|
|
|
|
|
class Notifications extends MultiUsers {
|
|
|
|
constructor() {
|
|
|
|
super('notifications');
|
|
|
|
this.page1 = new Page();
|
|
|
|
this.page2 = new Page();
|
2020-03-18 01:13:30 +08:00
|
|
|
this.page3 = new Page();
|
|
|
|
this.page4 = new Page();
|
2020-03-14 04:08:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async init(meetingId) {
|
|
|
|
await this.page1.init(Page.getArgs(), meetingId, { ...params });
|
|
|
|
await this.page2.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'User2' });
|
|
|
|
}
|
|
|
|
|
2020-03-18 01:13:30 +08:00
|
|
|
async initUser3(meetingId) {
|
|
|
|
await this.page3.init(Page.getArgs(), meetingId, { ...params, fullName: 'User3' });
|
|
|
|
}
|
|
|
|
|
|
|
|
async initUser4() {
|
|
|
|
await this.page4.init(Page.getArgs(), this.page3.meetingId, { ...params, fullName: 'User4' });
|
|
|
|
}
|
|
|
|
|
|
|
|
// Save Settings toast notification
|
|
|
|
async saveSettingsNotification() {
|
2020-03-14 04:08:30 +08:00
|
|
|
await util.popupMenu(this.page1);
|
|
|
|
await util.saveSettings(this.page1);
|
|
|
|
const resp = await util.getLastToastValue(this.page1) === ne.savedSettingsToast;
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
2020-03-18 01:13:30 +08:00
|
|
|
// Public chat toast notification
|
2020-03-14 04:08:30 +08:00
|
|
|
async publicChatNotification() {
|
|
|
|
await util.popupMenu(this.page1);
|
|
|
|
await util.enableChatPopup(this.page1);
|
|
|
|
await util.saveSettings(this.page1);
|
|
|
|
const expectedToastValue = await util.publicChatMessageToast(this.page1, this.page2);
|
|
|
|
await this.page1.waitForSelector(ne.smallToastMsg);
|
|
|
|
await this.page1.waitForSelector(ne.hasUnreadMessages);
|
|
|
|
const lastToast = await util.getOtherToastValue(this.page1);
|
|
|
|
return expectedToastValue === lastToast;
|
|
|
|
}
|
|
|
|
|
2020-03-18 01:13:30 +08:00
|
|
|
// Private chat toast notification
|
2020-03-14 04:08:30 +08:00
|
|
|
async privateChatNotification() {
|
|
|
|
await util.popupMenu(this.page1);
|
|
|
|
await util.enableChatPopup(this.page1);
|
|
|
|
await util.saveSettings(this.page1);
|
|
|
|
const expectedToastValue = await util.privateChatMessageToast(this.page2);
|
|
|
|
await this.page1.waitForSelector(ne.smallToastMsg);
|
|
|
|
await this.page1.waitForSelector(ne.hasUnreadMessages);
|
|
|
|
const lastToast = await util.getOtherToastValue(this.page1);
|
|
|
|
return expectedToastValue === lastToast;
|
|
|
|
}
|
2020-03-18 01:13:30 +08:00
|
|
|
|
|
|
|
// User join toast notification
|
|
|
|
async userJoinNotification() {
|
|
|
|
await util.popupMenu(this.page3);
|
|
|
|
await util.enableUserJoinPopup(this.page3);
|
|
|
|
await util.saveSettings(this.page3);
|
|
|
|
}
|
|
|
|
|
|
|
|
async getUserJoinPopupResponse() {
|
|
|
|
await this.page3.waitForSelector(ne.smallToastMsg);
|
|
|
|
const response = await util.getOtherToastValue(this.page3);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
2020-03-20 01:01:55 +08:00
|
|
|
// File upload notification
|
|
|
|
async fileUploaderNotification() {
|
|
|
|
await util.uploadFileMenu(this.page3);
|
2020-03-20 01:26:01 +08:00
|
|
|
await this.page3.waitForSelector(ne.fileUploadDropZone);
|
2020-03-20 01:01:55 +08:00
|
|
|
const inputUploadHandle = await this.page3.page.$('input[type=file]');
|
|
|
|
await inputUploadHandle.uploadFile(process.env.PDF_FILE);
|
|
|
|
await this.page3.page.evaluate(util.clickTestElement, ne.modalConfirmButton);
|
|
|
|
const resp = await util.getLastToastValue(this.page3);
|
|
|
|
await this.page3.waitForSelector(we.whiteboard);
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
2020-03-20 22:42:04 +08:00
|
|
|
async publishPollResults() {
|
|
|
|
await this.page3.waitForSelector(we.whiteboard);
|
|
|
|
await util.startPoll(this.page3);
|
|
|
|
await this.page3.waitForSelector(ne.smallToastMsg);
|
|
|
|
const resp = await util.getLastToastValue(this.page3);
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
2020-03-23 20:15:10 +08:00
|
|
|
async closePages() {
|
2020-03-18 01:13:30 +08:00
|
|
|
await this.page3.close();
|
|
|
|
await this.page4.close();
|
|
|
|
}
|
2020-03-14 04:08:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Notifications;
|