2020-03-12 21:50:54 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const util = require('./util');
|
|
|
|
const e = require('../core/elements');
|
2021-09-22 21:11:56 +08:00
|
|
|
const { VIDEO_LOADING_WAIT_TIME } = require('../core/constants');
|
2020-03-12 21:50:54 +08:00
|
|
|
|
|
|
|
class ShareScreen extends Page {
|
|
|
|
constructor() {
|
2021-09-23 03:22:47 +08:00
|
|
|
super();
|
2020-03-12 21:50:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async test() {
|
2021-05-26 00:05:11 +08:00
|
|
|
try {
|
|
|
|
await util.startScreenshare(this);
|
2021-09-23 00:51:35 +08:00
|
|
|
await this.waitForSelector(e.screenshareConnecting);
|
|
|
|
await this.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
|
|
|
|
const response = await this.hasElement(e.isSharingScreen, true);
|
|
|
|
|
|
|
|
return response === true;
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await this.logger(err);
|
2021-05-26 00:05:11 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2020-03-23 22:14:56 +08:00
|
|
|
|
2021-09-30 20:36:08 +08:00
|
|
|
async testMobileDevice(testName, deviceX) {
|
2021-05-26 00:05:11 +08:00
|
|
|
try {
|
2021-09-30 20:36:08 +08:00
|
|
|
await this.init(true, true, testName, undefined, undefined, undefined, undefined, deviceX);
|
2021-08-14 01:35:00 +08:00
|
|
|
await this.startRecording(testName);
|
2021-09-23 06:13:12 +08:00
|
|
|
return this.wasRemoved(e.startScreenSharing);
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
|
|
|
await this.logger(err);
|
2021-05-26 00:05:11 +08:00
|
|
|
return false;
|
|
|
|
}
|
2020-03-12 21:50:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-30 20:36:08 +08:00
|
|
|
module.exports = exports = ShareScreen;
|