2022-01-20 03:50:59 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
|
|
|
const { MultiUsers } = require('../user/multiusers');
|
|
|
|
const e = require('../core/elements');
|
2022-04-08 02:34:25 +08:00
|
|
|
const { ELEMENT_WAIT_TIME } = require('../core/constants');
|
2022-01-20 03:50:59 +08:00
|
|
|
const { openConnectionStatus, checkNetworkStatus } = require('./util');
|
|
|
|
|
|
|
|
class ConnectionStatus extends MultiUsers {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
async connectionStatusModal() {
|
|
|
|
await openConnectionStatus(this.modPage);
|
|
|
|
await this.modPage.hasElement(e.connectionStatusModal);
|
|
|
|
}
|
|
|
|
|
|
|
|
async usersConnectionStatus() {
|
2022-01-29 03:52:22 +08:00
|
|
|
await this.modPage.shareWebcam();
|
2022-01-20 03:50:59 +08:00
|
|
|
await this.initUserPage();
|
|
|
|
await this.userPage.waitAndClick(e.joinAudio);
|
|
|
|
await this.userPage.joinMicrophone();
|
2022-01-29 03:52:22 +08:00
|
|
|
await this.userPage.shareWebcam();
|
2022-03-01 03:46:13 +08:00
|
|
|
await openConnectionStatus(this.modPage);
|
2022-01-20 03:50:59 +08:00
|
|
|
|
|
|
|
await this.userPage.page.waitForFunction(checkNetworkStatus,
|
2022-01-20 21:03:18 +08:00
|
|
|
e.connectionDataContainer,
|
2022-01-20 03:50:59 +08:00
|
|
|
{ timeout: ELEMENT_WAIT_TIME },
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
async reportUserInConnectionIssues() {
|
|
|
|
await openConnectionStatus(this.modPage);
|
2022-02-18 19:41:44 +08:00
|
|
|
await this.modPage.waitAndClick(e.connectionStatusTab2);
|
2022-01-20 03:50:59 +08:00
|
|
|
await this.modPage.hasElement(e.connectionStatusItemEmpty);
|
|
|
|
await this.modPage.page.evaluate(() => window.dispatchEvent(new CustomEvent('socketstats', { detail: { rtt: 2000 } })));
|
|
|
|
await this.modPage.wasRemoved(e.connectionStatusItemEmpty);
|
2022-09-23 04:17:15 +08:00
|
|
|
await this.modPage.checkElementCount(e.connectionStatusItemUser, 1);
|
2022-01-20 03:50:59 +08:00
|
|
|
}
|
2022-06-21 08:22:14 +08:00
|
|
|
|
|
|
|
async linkToSettingsTest() {
|
|
|
|
await openConnectionStatus(this.modPage);
|
|
|
|
await this.modPage.page.evaluate(() => window.dispatchEvent(new CustomEvent('socketstats', { detail: { rtt: 2000 } })));
|
|
|
|
await this.modPage.hasElement(e.connectionStatusLinkToSettings);
|
|
|
|
await this.modPage.waitAndClick(e.connectionStatusLinkToSettings);
|
|
|
|
await this.modPage.waitForSelector(e.dataSavingsTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
async copyStatsTest(context) {
|
|
|
|
await openConnectionStatus(this.modPage);
|
2022-06-30 23:01:00 +08:00
|
|
|
await this.modPage.hasElementEnabled(e.copyStats);
|
2022-06-21 08:22:14 +08:00
|
|
|
await this.modPage.waitAndClick(e.copyStats);
|
|
|
|
await context.grantPermissions(['clipboard-write', 'clipboard-read'], { origin: process.env.BBB_URL });
|
|
|
|
const copiedText = await this.modPage.page.evaluate(async () => navigator.clipboard.readText());
|
|
|
|
const check = copiedText.includes("audioCurrentUploadRate");
|
2022-06-30 23:01:00 +08:00
|
|
|
await expect(check).toBeTruthy();
|
2022-06-21 08:22:14 +08:00
|
|
|
}
|
2022-01-20 03:50:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.ConnectionStatus = ConnectionStatus;
|