2020-03-12 21:50:54 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const util = require('./util');
|
|
|
|
const e = require('../core/elements');
|
2021-02-17 04:57:10 +08:00
|
|
|
const { ELEMENT_WAIT_TIME, VIDEO_LOADING_WAIT_TIME } = require('../core/constants');
|
2021-02-26 23:52:17 +08:00
|
|
|
const { sleep } = require('../core/helper');
|
2021-08-21 04:33:57 +08:00
|
|
|
const { checkElementLengthEqualTo } = require('../core/util');
|
2020-03-12 21:50:54 +08:00
|
|
|
|
|
|
|
class ShareScreen extends Page {
|
|
|
|
constructor() {
|
|
|
|
super('share-screen');
|
|
|
|
}
|
|
|
|
|
|
|
|
async test() {
|
2021-05-26 00:05:11 +08:00
|
|
|
try {
|
|
|
|
await util.startScreenshare(this);
|
|
|
|
await this.page.waitForSelector(e.screenshareConnecting, ELEMENT_WAIT_TIME);
|
|
|
|
await this.page.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
|
|
|
|
await sleep(5000);
|
|
|
|
const response = await util.getScreenShareContainer(this);
|
|
|
|
return response;
|
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-05-26 00:05:11 +08:00
|
|
|
async testMobileDevice(args, testName, deviceX) {
|
|
|
|
try {
|
2021-08-14 01:35:00 +08:00
|
|
|
await this.init(args, undefined, undefined, undefined, testName, undefined, deviceX);
|
|
|
|
await this.startRecording(testName);
|
|
|
|
await this.closeAudioModal();
|
2021-08-21 04:33:57 +08:00
|
|
|
const screenshareBtn = await this.page.evaluate(checkElementLengthEqualTo, e.screenShare, 1);
|
2021-05-26 00:05:11 +08:00
|
|
|
return screenshareBtn;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = ShareScreen;
|