bigbluebutton-Github/bigbluebutton-tests/puppeteer/user/user.obj.js

440 lines
16 KiB
JavaScript
Raw Normal View History

2021-04-15 00:16:41 +08:00
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const Page = require('../core/page');
const Status = require('./status');
const MultiUsers = require('./multiusers');
2021-10-21 01:23:24 +08:00
const { closePages } = require('../core/util');
const { MAX_MULTIUSERS_TEST_TIMEOUT, TEST_DURATION_TIME } = require('../core/constants'); // core constants (Timeouts vars imported)
const { NETWORK_PRESETS } = require('../core/profiles');
const devices = require('../core/devices');
const iPhonex = devices['iPhone X'];
const galaxyNote3 = devices['Galaxy Note 3'];
2020-10-09 03:25:35 +08:00
expect.extend({ toMatchImageSnapshot });
const userTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_MULTIUSERS_TEST_TIMEOUT);
});
2021-04-05 05:53:31 +08:00
// Mobile User Should have 'Mobile' tag under his name in Userslist
test('Mobile Tag Name For Mobile User', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'mobileTagName';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, true, testName, 'Moderator', undefined, undefined, undefined, iPhonex);
2021-04-05 05:53:31 +08:00
await test.startRecording(testName);
response = await test.mobileTagName();
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
2021-04-05 05:53:31 +08:00
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-05 05:53:31 +08:00
});
2021-04-02 08:54:55 +08:00
2021-04-05 05:53:31 +08:00
// Change user status icon and check if it has changed
test('Change status', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'changeUserStatus';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, true, testName);
2021-04-05 05:53:31 +08:00
await test.startRecording(testName);
response = await test.test();
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
2021-04-05 05:53:31 +08:00
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-05 05:53:31 +08:00
});
2021-04-05 05:53:31 +08:00
// Connect with 2 users and check if User1 sees User2
test('Multi user presence check', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'multiUsersPresenceCheck';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(testName);
2021-04-05 05:53:31 +08:00
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
response = await test.test();
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end osf ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
2021-04-05 05:53:31 +08:00
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
2021-04-05 05:53:31 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-05 05:53:31 +08:00
});
2021-04-05 05:53:31 +08:00
// Open Connection Status Modal and check if appears
test('Connections Status Modal', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'connectionStatusModal';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, true, testName);
2021-04-05 05:53:31 +08:00
await test.startRecording(testName);
response = await test.findConnectionStatusModal();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
2021-04-05 05:53:31 +08:00
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-05 05:53:31 +08:00
});
2021-04-05 05:53:31 +08:00
// Open Connection Status Modal, start Webcam Share, disable Webcams in
// Connection Status Modal and check if webcam sharing is still available
test('Disable Webcams From Connection Status Modal', async () => {
const test = new MultiUsers();
2021-04-05 05:53:31 +08:00
let response;
let screenshot;
try {
const testName = 'disableWebcamsFromConnectionStatus';
await test.page1.logger('begin of ', testName);
await test.init(testName);
await test.page1.startRecording(testName);
2021-04-05 05:53:31 +08:00
response = await test.disableWebcamsFromConnectionStatus();
await test.page1.stopRecording();
screenshot = await test.page1.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
2021-04-05 05:53:31 +08:00
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
2021-04-05 05:53:31 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-05 05:53:31 +08:00
});
2021-04-05 05:53:31 +08:00
// Open Connection Status Modal, start Screenshare, disable Screenshare in
// Connection Status Modal and check if Screensharing is still available
test('Disable Screenshare From Connection Status Modal', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'disableScreenshareFromConnectionStatus';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, true, testName);
2021-04-05 05:53:31 +08:00
await test.startRecording(testName);
response = await test.disableScreenshareFromConnectionStatus();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
2021-04-05 05:53:31 +08:00
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-05 05:53:31 +08:00
});
// Connect with a Good3G NETWORK_PRESET profil, Open Connection Status Modal
// and check if User1 appears in reported connection issues
test('Report a User in Connection Issues', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'reportUserInConnectionIssues';
await test.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(true, false, testName, 'Moderator', undefined, undefined, NETWORK_PRESETS.Regular4G);
await test.startRecording(testName);
response = await test.reportUserInConnectionIssues();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
}, TEST_DURATION_TIME);
// Force bad connection profile, force disconnection
// and appear with offline status in Connection Status Modal
test('User Offline due to connection problem appears in Connection Status Modal', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'userOfflineWithInternetProblem';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(testName);
await test.page1.startRecording(testName);
response = await test.userOfflineWithInternetProblem();
await test.page1.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await test.page1.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
}, TEST_DURATION_TIME);
test('Show network data in Connection Status', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'connectionNetworkStatus';
await test.page1.logger('begin of ', testName);
await test.initMod1(testName);
await test.page1.startRecording(testName);
response = await test.usersConnectionStatus(testName);
await test.page1.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.userPage);
}
expect(response).toBe(true);
Page.checkRegression(2.0, screenshot);
});
// Raise and Lower Hand and make sure that the User2 Avatar color
// and its avatar in raised hand toast are the same
test('Raise Hand Toast', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'raiseAndLowerHandToast';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(testName);
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
const response1 = await test.raiseHandTest();
const responseColors = await test.getAvatarColorAndCompareWithUserListItem();
const response2 = await test.lowerHandTest();
response = response1 && responseColors && response2;
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
});
2021-04-15 00:16:41 +08:00
// Set Guest policy to ASK_MODERATOR
// and expect user in guest wait list
test('Guest policy: ASK_MODERATOR', async () => {
2021-09-23 05:03:12 +08:00
const test = new MultiUsers();
2021-04-15 00:16:41 +08:00
let response;
let screenshot;
try {
const testName = 'askModeratorGuestPolicy';
await test.page1.logger('begin of ', testName);
await test.page1.startRecording(testName);
response = await test.askModeratorGuestPolicy(testName);
await test.page1.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
2021-04-15 00:16:41 +08:00
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.userPage);
2021-04-15 00:16:41 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-15 00:16:41 +08:00
});
// Set Guest policy to ALWAYS_ACCEPT
// and expect user to get accepted automatically
test('Guest policy: ALWAYS_ACCEPT', async () => {
2021-09-23 05:03:12 +08:00
const test = new MultiUsers();
2021-04-15 00:16:41 +08:00
let response;
let screenshot;
try {
const testName = 'alwaysAcceptGuestPolicy';
await test.page1.logger('begin of ', testName);
await test.page1.startRecording(testName);
response = await test.alwaysAcceptGuestPolicy(testName);
await test.page1.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
2021-04-15 00:16:41 +08:00
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.userPage);
2021-04-15 00:16:41 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-15 00:16:41 +08:00
});
// Set Guest policy to ALWAYS_DENY
// and expect user to get denied
test('Guest policy: ALWAYS_DENY', async () => {
2021-09-23 05:03:12 +08:00
const test = new MultiUsers();
2021-04-15 00:16:41 +08:00
let response;
let screenshot;
try {
const testName = 'alwaysDenyGuestPolicy';
await test.page1.logger('begin of ', testName);
await test.page1.startRecording(testName);
response = await test.alwaysDenyGuestPolicy(testName);
await test.page1.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
2021-04-15 00:16:41 +08:00
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.userPage);
2021-04-15 00:16:41 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
});
// Whiteboard shouldn't be accessible when
// chat panel or userlist are active
test('Whiteboard should not be accessible when chat panel or userlist are active on mobile devices', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'whiteboardNotAppearOnMobile';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.page1.init(true, true, testName, 'Mod1', undefined, undefined, undefined, iPhonex);
await test.page2.init(true, true, testName, 'Mod2', undefined, undefined, undefined, galaxyNote3);
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
response = await test.whiteboardNotAppearOnMobile(testName);
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
2021-04-15 00:16:41 +08:00
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
});
// Userlist and chat panel should not appear at page
// load in iPhone and Android Mobile devices
test('Userlist does not appear at page load on iPhone and Android', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'userlistNotAppearOnMobile';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.page1.init(true, true, testName, 'Mod1', undefined, undefined, undefined, iPhonex);
await test.page2.init(true, true, testName, 'Mod2', undefined, undefined, undefined, galaxyNote3);
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
response = await test.userlistNotAppearOnMobile(testName);
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
});
// Userslist shouldn't appear when Chat Panel or Whiteboard
// are active on small mobile devices
test('Userslist should not appear when Chat Panel or Whiteboard are active on small mobile devices', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'userlistNotAppearOnMobile';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.page1.init(true, true, testName, 'Mod1', undefined, undefined, undefined, iPhonex);
await test.page2.init(true, true, testName, 'Mod2', undefined, undefined, undefined, galaxyNote3);
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
response = await test.userlistNotAppearOnMobile();
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
});
// Chat Panel shouldn't appear when Userlist or Whiteboard
// are active on small mobile devices
test('Chat Panel should not appear when Userlist or Whiteboard are active on small mobile devices', async () => {
const test = new MultiUsers();
let response;
let screenshot;
try {
const testName = 'chatPanelNotAppearOnMobile';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.page1.init(true, true, testName, 'Mod1', undefined, undefined, undefined, iPhonex);
await test.page2.init(true, true, testName, 'Mod2', undefined, undefined, undefined, galaxyNote3);
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
response = await test.chatPanelNotAppearOnMobile();
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(2.0, screenshot);
2021-04-15 00:16:41 +08:00
});
};
module.exports = exports = userTest;