2020-08-06 02:44:17 +08:00
|
|
|
const Notifications = require('./notifications/notifications');
|
|
|
|
const Page = require('./core/page');
|
2020-10-09 03:25:35 +08:00
|
|
|
const { toMatchImageSnapshot } = require('jest-image-snapshot');
|
2021-02-17 04:57:10 +08:00
|
|
|
const { MAX_NOTIFICATIONS_TEST_TIMEOUT } = require('./core/constants'); // core constants (Timeouts vars imported)
|
2020-10-09 03:25:35 +08:00
|
|
|
|
|
|
|
expect.extend({ toMatchImageSnapshot });
|
2020-08-06 02:44:17 +08:00
|
|
|
|
|
|
|
const notificationsTest = () => {
|
|
|
|
beforeEach(() => {
|
2021-02-17 04:57:10 +08:00
|
|
|
jest.setTimeout(MAX_NOTIFICATIONS_TEST_TIMEOUT);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Save settings notification', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'saveSettingsNotification';
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.page1.logger('begin of ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.saveSettingsNotification(testName);
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.page1.logger('end of ', testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page1.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page1.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page1.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.close(test.page1, test.page2);
|
|
|
|
await test.page1.logger('Save Setting notification !');
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(1.56, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Public Chat notification', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'publicChatNotification';
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.page1.logger('begin of ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.publicChatNotification(testName);
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.page1.logger('end of ', testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page1.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page1.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page1.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.close(test.page1, test.page2);
|
|
|
|
await test.page1.logger('Public Chat notification !');
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(1.0, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Private Chat notification', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'privateChatNotification';
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.page1.logger('begin of ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.privateChatNotification(testName);
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.page1.logger('end of ', testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page1.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page1.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page1.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.close(test.page1, test.page2);
|
|
|
|
await test.page1.logger('Private Chat notification !');
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(0.6, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('User join notification', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'userJoinNotification';
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('begin of ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.getUserJoinPopupResponse(testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('end of ', testName);
|
|
|
|
await test.page3.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page3.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page3.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.closePages();
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('User join notification !');
|
2020-08-06 02:44:17 +08:00
|
|
|
}
|
2020-08-14 10:41:14 +08:00
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(2.0, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Presentation upload notification', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'uploadPresentationNotification';
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('begin of ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.fileUploaderNotification(testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('end of ', testName);
|
|
|
|
await test.page3.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page3.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page3.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.closePage(test.page3);
|
|
|
|
await test.page3.logger('Presentation upload notification !');
|
|
|
|
}
|
2020-08-14 10:41:14 +08:00
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(2.64, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Poll results notification', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'pollResultsNotification';
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('begin of ', testName);
|
|
|
|
await test.initUser3(Page.getArgs(), undefined, testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.publishPollResults(testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('end of ', testName);
|
|
|
|
await test.page3.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page3.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page3.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.closePage(test.page3);
|
|
|
|
await test.page3.logger('Poll results notification !');
|
|
|
|
}
|
2021-02-17 04:57:10 +08:00
|
|
|
expect(response).toContain('Poll results were published');
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(7.26, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Screenshare notification', async () => {
|
2021-02-26 23:52:17 +08:00
|
|
|
const test = new Notifications();
|
2020-08-06 02:44:17 +08:00
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'screenShareNotification';
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('begin of ', testName);
|
|
|
|
response = await test.screenshareToast(testName);
|
|
|
|
await test.page3.logger('end of ', testName);
|
|
|
|
await test.page3.stopRecording();
|
|
|
|
screenshot = await test.page3.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page3.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.closePage(test.page3);
|
|
|
|
await test.page3.logger('Screenshare notification !');
|
2020-08-06 02:44:17 +08:00
|
|
|
}
|
|
|
|
expect(response).toBe('Screenshare has started');
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(7.25, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Audio notifications', async () => {
|
|
|
|
const test = new Notifications();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
|
|
|
const testName = 'audioNotification';
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('begin of ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
response = await test.audioNotification(testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.page3.logger('end of ', testName);
|
|
|
|
await test.page3.stopRecording();
|
2020-10-09 03:25:35 +08:00
|
|
|
screenshot = await test.page3.page.screenshot();
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await test.page3.logger(err);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.closePage(test.page3);
|
|
|
|
await test.page3.logger('Audio notification !');
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(1.05, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
module.exports = exports = notificationsTest;
|