bigbluebutton-Github/bigbluebutton-tests/playwright/connectionFailure/connectionFailure.spec.js
Anton Barboza de Sá 36b5a16c15
docs: Testing plan update (what's new features) (#20913)
* docs: update test links on release notes and spec files

* docs: add tests for 'what's new on 2.7' features

* Update docs/docs/testing/release-testing.md

Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>

* test: pass the bbb version in the doc links

---------

Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>
2024-08-14 09:50:03 -04:00

54 lines
2.8 KiB
JavaScript

const { test, devices } = require('@playwright/test');
const { ScreenShare, MultiUserScreenShare } = require('../screenshare/screenshare');
const { sleep, checkRootPermission } = require('../core/helpers');
const e = require('../core/elements');
const { getCurrentTCPSessions, killTCPSessions } = require('./util');
const notificationsUtil = require('../notifications/util');
const deepEqual = require('deep-equal');
test.describe.parallel('Connection failure', () => {
// https://docs.bigbluebutton.org/2.7/testing/release-testing/#sharing-screen-in-full-screen-mode-automated
test('Screen sharer', async ({ browser, browserName, page }) => {
await checkRootPermission(); // check sudo permission before starting test
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());
// I'd like to do this:
// await notificationsUtil.checkNotificationText(screenshare, "Code 1101. Try sharing the screen again.");
// 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.")]');
});
test('Screen share viewer', async ({ browser, browserName, page, context }) => {
await checkRootPermission(); // check sudo permission before starting test
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);
await screenshare.userPage.hasElement('//div[@data-test="notificationBannerBar" and contains(text(), "Connecting ...")]');
await screenshare.userPage.wasRemoved('//div[@data-test="notificationBannerBar" and contains(text(), "Connecting ...")]');
});
});