2022-03-29 21:53:07 +08:00
|
|
|
const { default: test } = require('@playwright/test');
|
2021-12-01 01:14:03 +08:00
|
|
|
const Page = require('../core/page');
|
2023-03-08 10:33:22 +08:00
|
|
|
const { MultiUsers } = require('../user/multiusers');
|
2024-04-19 22:31:59 +08:00
|
|
|
const { startScreenshare } = require('./util');
|
2021-12-01 01:14:03 +08:00
|
|
|
const e = require('../core/elements');
|
2022-03-29 21:53:07 +08:00
|
|
|
const { getSettings } = require('../core/settings');
|
2021-12-01 01:14:03 +08:00
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
class ScreenShare extends Page {
|
2021-12-01 01:14:03 +08:00
|
|
|
constructor(browser, page) {
|
|
|
|
super(browser, page);
|
|
|
|
}
|
|
|
|
|
|
|
|
async startSharing() {
|
2022-03-29 21:53:07 +08:00
|
|
|
const { screensharingEnabled } = getSettings();
|
2023-11-08 19:50:16 +08:00
|
|
|
|
|
|
|
if(!screensharingEnabled) {
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.joinVideo, 'should display the join video button');
|
|
|
|
return this.wasRemoved(e.startScreenSharing, 'should not display the start screenshare button');
|
2023-11-08 19:50:16 +08:00
|
|
|
}
|
2021-12-02 12:12:14 +08:00
|
|
|
await startScreenshare(this);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.isSharingScreen, 'should display the screenshare element');
|
2021-12-01 01:14:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async testMobileDevice() {
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.wasRemoved(e.startScreenSharing, 'should not display the start screenshare button');
|
2021-12-01 01:14:03 +08:00
|
|
|
}
|
2024-04-16 03:28:53 +08:00
|
|
|
|
|
|
|
async screenshareStopsExternalVideo() {
|
|
|
|
const { screensharingEnabled } = getSettings();
|
|
|
|
|
2024-04-16 19:23:53 +08:00
|
|
|
await this.waitForSelector(e.whiteboard);
|
|
|
|
|
2024-04-16 03:28:53 +08:00
|
|
|
if(!screensharingEnabled) {
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.joinVideo, 'should display the join video button');
|
|
|
|
return this.wasRemoved(e.startScreenSharing, 'should not display the screenshare button');
|
2024-04-16 03:28:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
await this.waitAndClick(e.actions);
|
|
|
|
await this.waitAndClick(e.shareExternalVideoBtn);
|
|
|
|
await this.waitForSelector(e.closeModal);
|
|
|
|
await this.type(e.videoModalInput, e.youtubeLink);
|
|
|
|
await this.waitAndClick(e.startShareVideoBtn);
|
|
|
|
|
2024-04-20 03:05:13 +08:00
|
|
|
const modFrame = await this.getYoutubeFrame();
|
2024-07-31 06:49:02 +08:00
|
|
|
await modFrame.hasElement('video', 'should display the video frame');
|
2024-04-16 03:28:53 +08:00
|
|
|
|
|
|
|
await startScreenshare(this);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.isSharingScreen, 'should display the screenshare element');
|
2024-04-16 03:28:53 +08:00
|
|
|
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.stopScreenSharing, 'should display the stop screenshare button');
|
2024-04-16 03:28:53 +08:00
|
|
|
await this.waitAndClick(e.stopScreenSharing);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.whiteboard, 'should display the whiteboard');
|
2024-04-16 03:28:53 +08:00
|
|
|
}
|
2021-12-01 01:14:03 +08:00
|
|
|
}
|
|
|
|
|
2023-03-08 10:33:22 +08:00
|
|
|
class MultiUserScreenShare extends MultiUsers {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
async startSharing(page) {
|
|
|
|
const { screensharingEnabled } = getSettings();
|
2023-11-08 19:50:16 +08:00
|
|
|
|
|
|
|
if(!screensharingEnabled) {
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.joinVideo, 'should display the join video button');
|
|
|
|
return this.wasRemoved(e.startScreenSharing, 'should not display the start screenshare button');
|
2023-11-08 19:50:16 +08:00
|
|
|
}
|
2023-03-08 10:33:22 +08:00
|
|
|
await startScreenshare(page);
|
2024-07-31 06:49:02 +08:00
|
|
|
await page.hasElement(e.isSharingScreen, 'should display the screenshare element');
|
2023-03-08 10:33:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-04 01:01:36 +08:00
|
|
|
exports.ScreenShare = ScreenShare;
|
2023-03-08 10:33:22 +08:00
|
|
|
exports.MultiUserScreenShare = MultiUserScreenShare;
|