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');
|
2022-03-29 21:53:07 +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();
|
|
|
|
test.fail(!screensharingEnabled, 'Screensharing is disabled');
|
2021-12-02 12:12:14 +08:00
|
|
|
await startScreenshare(this);
|
2021-12-01 01:14:03 +08:00
|
|
|
await this.hasElement(e.isSharingScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
async testMobileDevice() {
|
|
|
|
await this.wasRemoved(e.startScreenSharing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-08 10:33:22 +08:00
|
|
|
class MultiUserScreenShare extends MultiUsers {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
async startSharing(page) {
|
|
|
|
const { screensharingEnabled } = getSettings();
|
|
|
|
test.fail(!screensharingEnabled, 'Screensharing is disabled');
|
|
|
|
await startScreenshare(page);
|
|
|
|
await page.hasElement(e.isSharingScreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-04 01:01:36 +08:00
|
|
|
exports.ScreenShare = ScreenShare;
|
2023-03-08 10:33:22 +08:00
|
|
|
exports.MultiUserScreenShare = MultiUserScreenShare;
|