Merge pull request #9863 from daminebenq/notifications-test
bbb notifications automated test
This commit is contained in:
commit
511d9ad753
@ -3,16 +3,19 @@ const ShareScreen = require('./screenshare/screenshare');
|
||||
const Audio = require('./audio/audio');
|
||||
|
||||
describe('Notifications', () => {
|
||||
beforeEach(() => {
|
||||
jest.setTimeout(30000);
|
||||
});
|
||||
|
||||
test('Save settings notification', async () => {
|
||||
const test = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await test.init();
|
||||
response = await test.saveSettingsNotification();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
await test.close();
|
||||
await test.close(test.page1, test.page2);
|
||||
}
|
||||
expect(response).toBe(true);
|
||||
});
|
||||
@ -21,12 +24,11 @@ describe('Notifications', () => {
|
||||
const test = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await test.init();
|
||||
response = await test.publicChatNotification();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
await test.close();
|
||||
await test.close(test.page1, test.page2);
|
||||
}
|
||||
expect(response).toBe(true);
|
||||
});
|
||||
@ -35,12 +37,11 @@ describe('Notifications', () => {
|
||||
const test = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await test.init();
|
||||
response = await test.privateChatNotification();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
await test.close();
|
||||
await test.close(test.page1, test.page2);
|
||||
}
|
||||
expect(response).toBe(true);
|
||||
});
|
||||
@ -49,9 +50,6 @@ describe('Notifications', () => {
|
||||
const test = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await test.initUser3();
|
||||
await test.userJoinNotification();
|
||||
await test.initUser4();
|
||||
response = await test.getUserJoinPopupResponse();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -65,7 +63,6 @@ describe('Notifications', () => {
|
||||
const test = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await test.initUser3();
|
||||
response = await test.fileUploaderNotification();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -79,7 +76,6 @@ describe('Notifications', () => {
|
||||
const test = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await test.initUser3();
|
||||
response = await test.publishPollResults();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -91,10 +87,10 @@ describe('Notifications', () => {
|
||||
|
||||
test('Screenshare notification', async () => {
|
||||
const test = new ShareScreen();
|
||||
const page = new Notifications()
|
||||
const page = new Notifications();
|
||||
let response;
|
||||
try {
|
||||
await page.initUser3();
|
||||
await page.initUser3(undefined);
|
||||
response = await test.toast(page.page3);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -118,5 +114,5 @@ describe('Notifications', () => {
|
||||
await page.closePage(page.page3);
|
||||
}
|
||||
expect(response).toBe('You have joined the audio conference');
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
const path = require('path');
|
||||
const MultiUsers = require('../user/multiusers');
|
||||
const Page = require('../core/page');
|
||||
const params = require('../params');
|
||||
@ -15,7 +16,7 @@ class Notifications extends MultiUsers {
|
||||
}
|
||||
|
||||
async init(meetingId) {
|
||||
await this.page1.init(Page.getArgs(), meetingId, { ...params });
|
||||
await this.page1.init(Page.getArgs(), meetingId, { ...params, fullName: 'User1' });
|
||||
await this.page2.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'User2' });
|
||||
}
|
||||
|
||||
@ -29,14 +30,16 @@ class Notifications extends MultiUsers {
|
||||
|
||||
// Save Settings toast notification
|
||||
async saveSettingsNotification() {
|
||||
await this.init(undefined);
|
||||
await util.popupMenu(this.page1);
|
||||
await util.saveSettings(this.page1);
|
||||
const resp = await util.getLastToastValue(this.page1) === ne.savedSettingsToast;
|
||||
return resp;
|
||||
return resp === true;
|
||||
}
|
||||
|
||||
// Public chat toast notification
|
||||
async publicChatNotification() {
|
||||
await this.init(undefined);
|
||||
await util.popupMenu(this.page1);
|
||||
await util.enableChatPopup(this.page1);
|
||||
await util.saveSettings(this.page1);
|
||||
@ -49,6 +52,7 @@ class Notifications extends MultiUsers {
|
||||
|
||||
// Private chat toast notification
|
||||
async privateChatNotification() {
|
||||
await this.init(undefined);
|
||||
await util.popupMenu(this.page1);
|
||||
await util.enableChatPopup(this.page1);
|
||||
await util.saveSettings(this.page1);
|
||||
@ -60,13 +64,16 @@ class Notifications extends MultiUsers {
|
||||
}
|
||||
|
||||
// User join toast notification
|
||||
async userJoinNotification() {
|
||||
await util.popupMenu(this.page3);
|
||||
await util.enableUserJoinPopup(this.page3);
|
||||
await util.saveSettings(this.page3);
|
||||
async userJoinNotification(page) {
|
||||
await util.popupMenu(page);
|
||||
await util.enableUserJoinPopup(page);
|
||||
await util.saveSettings(page);
|
||||
}
|
||||
|
||||
async getUserJoinPopupResponse() {
|
||||
await this.initUser3(undefined);
|
||||
await this.userJoinNotification(this.page3);
|
||||
await this.initUser4(undefined);
|
||||
await this.page3.waitForSelector(ne.smallToastMsg);
|
||||
const response = await util.getOtherToastValue(this.page3);
|
||||
return response;
|
||||
@ -74,17 +81,20 @@ class Notifications extends MultiUsers {
|
||||
|
||||
// File upload notification
|
||||
async fileUploaderNotification() {
|
||||
await this.initUser3(undefined);
|
||||
await util.uploadFileMenu(this.page3);
|
||||
await this.page3.waitForSelector(ne.fileUploadDropZone);
|
||||
const inputUploadHandle = await this.page3.page.$('input[type=file]');
|
||||
await inputUploadHandle.uploadFile(process.env.PDF_FILE);
|
||||
await inputUploadHandle.uploadFile(path.join(__dirname, '../media/DifferentSizes.pdf'));
|
||||
await this.page3.page.evaluate(util.clickTestElement, ne.modalConfirmButton);
|
||||
const resp = await util.getLastToastValue(this.page3);
|
||||
await this.page3.waitForSelector(we.whiteboard);
|
||||
return resp;
|
||||
}
|
||||
|
||||
// Publish Poll Results notification
|
||||
async publishPollResults() {
|
||||
await this.initUser3(undefined);
|
||||
await this.page3.waitForSelector(we.whiteboard);
|
||||
await util.startPoll(this.page3);
|
||||
await this.page3.waitForSelector(ne.smallToastMsg);
|
||||
|
@ -7,9 +7,9 @@ async function clickTestElement(element) {
|
||||
await document.querySelectorAll(element)[0].click();
|
||||
}
|
||||
|
||||
async function popupMenu(page) {
|
||||
await page.page.evaluate(clickTestElement, e.options);
|
||||
await page.page.evaluate(clickTestElement, ne.settings);
|
||||
async function popupMenu(test) {
|
||||
await test.page.evaluate(clickTestElement, e.options);
|
||||
await test.page.evaluate(clickTestElement, ne.settings);
|
||||
}
|
||||
|
||||
async function enableChatPopup(test) {
|
||||
|
@ -46,9 +46,9 @@ class MultiUsers {
|
||||
}
|
||||
|
||||
// Close all Pages
|
||||
async close() {
|
||||
await this.page1.close();
|
||||
await this.page2.close();
|
||||
async close(page1, page2) {
|
||||
await page1.close();
|
||||
await page2.close();
|
||||
}
|
||||
|
||||
async closePage(page) {
|
||||
|
Loading…
Reference in New Issue
Block a user