2024-03-06 22:26:03 +08:00
|
|
|
const { test } = require('../fixtures');
|
2023-03-08 10:33:22 +08:00
|
|
|
const { ScreenShare, MultiUserScreenShare } = require('../screenshare/screenshare');
|
2024-03-06 22:26:03 +08:00
|
|
|
const { checkRootPermission } = require('../core/helpers');
|
2023-03-08 10:33:22 +08:00
|
|
|
const e = require('../core/elements');
|
|
|
|
const { getCurrentTCPSessions, killTCPSessions } = require('./util');
|
|
|
|
const deepEqual = require('deep-equal');
|
|
|
|
|
|
|
|
test.describe.parallel('Connection failure', () => {
|
|
|
|
// https://docs.bigbluebutton.org/2.6/release-tests.html#sharing-screen-in-full-screen-mode-automated
|
2023-03-08 11:56:28 +08:00
|
|
|
test('Screen sharer', async ({ browser, browserName, page }) => {
|
2023-06-09 01:27:18 +08:00
|
|
|
await checkRootPermission(); // check sudo permission before starting test
|
2023-03-08 10:33:22 +08:00
|
|
|
test.skip(browserName === 'firefox' && process.env.DISPLAY === undefined,
|
|
|
|
"Screenshare tests not able in Firefox browser without desktop");
|
|
|
|
const screenshare = new ScreenShare(browser, page);
|
|
|
|
await screenshare.init(true, true);
|
|
|
|
await screenshare.startSharing();
|
|
|
|
|
|
|
|
await killTCPSessions(await getCurrentTCPSessions());
|
|
|
|
|
2023-03-08 11:56:28 +08:00
|
|
|
// I'd like to do this:
|
|
|
|
// await notificationsUtil.checkNotificationText(screenshare, "Code 1101. Try sharing the screen again.");
|
2023-03-08 10:33:22 +08:00
|
|
|
|
2023-03-08 11:56:28 +08:00
|
|
|
// but that code only checks the first toast, and there's a bunch of toasts that show up
|
|
|
|
// on this test. So instead I use xpath, like this: (should we do it this way in checkNotificationText?)
|
|
|
|
await screenshare.hasElement('//div[@data-test="toastSmallMsg"]/span[contains(text(), "Code 1101. Try sharing the screen again.")]');
|
2023-03-08 10:33:22 +08:00
|
|
|
});
|
|
|
|
|
2023-03-08 11:56:28 +08:00
|
|
|
test('Screen share viewer', async ({ browser, browserName, page, context }) => {
|
2023-06-09 01:27:18 +08:00
|
|
|
await checkRootPermission(); // check sudo permission before starting test
|
2023-03-08 10:33:22 +08:00
|
|
|
test.skip(browserName === 'firefox' && process.env.DISPLAY === undefined,
|
|
|
|
"Screenshare tests not able in Firefox browser without desktop");
|
|
|
|
const screenshare = new MultiUserScreenShare(browser, context);
|
|
|
|
|
|
|
|
await screenshare.initModPage(page);
|
|
|
|
await screenshare.startSharing(screenshare.modPage);
|
|
|
|
|
|
|
|
const tcpModeratorSessions = await getCurrentTCPSessions();
|
|
|
|
|
|
|
|
await screenshare.initUserPage(false);
|
|
|
|
await screenshare.userPage.joinMicrophone();
|
|
|
|
await screenshare.userPage.hasElement(e.screenShareVideo);
|
|
|
|
|
|
|
|
const tcpSessions = await getCurrentTCPSessions();
|
|
|
|
// Other comparisons, like == or the array includes method, don't do a deep comparison
|
|
|
|
// and will always return false since the two arrays contain different objects.
|
|
|
|
const tcpUserSessions = tcpSessions.filter(x => !tcpModeratorSessions.some(e => deepEqual(e,x)));
|
|
|
|
killTCPSessions(tcpUserSessions);
|
|
|
|
|
2023-03-08 11:56:28 +08:00
|
|
|
await screenshare.userPage.hasElement('//div[@data-test="notificationBannerBar" and contains(text(), "Connecting ...")]');
|
|
|
|
await screenshare.userPage.wasRemoved('//div[@data-test="notificationBannerBar" and contains(text(), "Connecting ...")]');
|
2023-03-08 10:33:22 +08:00
|
|
|
});
|
|
|
|
});
|