Merge pull request #11826 from daminebenq/add-connection-status-test-spec

Add connection status (++ webcams, screenshare) test specs
This commit is contained in:
Anton Georgiev 2021-04-06 09:33:34 -04:00 committed by GitHub
commit 42e3477003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 498 additions and 29 deletions

View File

@ -86,7 +86,10 @@ class ConnectionStatusComponent extends PureComponent {
const { intl } = this.props;
return (
<div className={styles.item}>
<div
className={styles.item}
data-test="connectionStatusItemEmpty"
>
<div className={styles.left}>
<div className={styles.name}>
<div className={styles.text}>
@ -117,6 +120,7 @@ class ConnectionStatusComponent extends PureComponent {
<div
key={index}
className={cx(styles.item, itemStyle)}
data-test="connectionStatusItemUser"
>
<div className={styles.left}>
<div className={styles.avatar}>
@ -179,6 +183,7 @@ class ConnectionStatusComponent extends PureComponent {
onChange={() => this.handleDataSavingChange('viewParticipantsWebcams')}
ariaLabelledBy="webcam"
ariaLabel={intl.formatMessage(intlMessages.webcam)}
data-test="dataSavingWebcams"
/>
</div>
<div className={styles.saving}>
@ -191,6 +196,7 @@ class ConnectionStatusComponent extends PureComponent {
onChange={() => this.handleDataSavingChange('viewScreenshare')}
ariaLabelledBy="screenshare"
ariaLabel={intl.formatMessage(intlMessages.screenshare)}
data-test="dataSavingScreenshare"
/>
</div>
</div>

View File

@ -115,7 +115,11 @@ const UserName = (props) => {
{
userNameSub.length
? (
<span aria-hidden className={styles.userNameSub}>
<span
aria-hidden
className={styles.userNameSub}
data-test={user.mobile ? 'mobileUser' : undefined}
>
{userNameSub.reduce((prev, curr) => [prev, ' | ', curr])}
</span>
)

View File

@ -1,4 +1,4 @@
exports.audioDialog = '[aria-label="Join audio modal"]';
exports.audioDialog = 'div[aria-label="Join audio modal"]';
exports.closeAudio = 'button[aria-label="Close Join audio modal"]';
exports.microphoneButton = 'button[aria-label="Microphone"]';
exports.listenButton = 'button[aria-label="Listen Only"]';

View File

@ -11,6 +11,7 @@ const { ELEMENT_WAIT_TIME } = require('../core/constants');
const e = require('./elements');
const ue = require('../user/elements');
const PuppeteerVideoRecorder = require('puppeteer-video-recorder');
const { NETWORK_PRESETS, USER_AGENTS, MOBILE_DEVICES } = require('./profiles');
class Page {
constructor(name) {
@ -37,7 +38,7 @@ class Page {
}
// Join BigBlueButton meeting
async init(args, meetingId, newParams, customParameter, testFolderName) {
async init(args, meetingId, newParams, customParameter, testFolderName, connectionPreset) {
try {
this.effectiveParams = newParams || params;
const isModerator = this.effectiveParams.moderatorPW;
@ -49,7 +50,17 @@ class Page {
this.browser = await puppeteer.launch(args);
}
this.page = await this.browser.newPage();
await this.page.setViewport({ width: 1280, height: 720 });
// Connect to Chrome DevTools
const client = await this.page.target().createCDPSession();
// Set throttling property
await client.send('Network.emulateNetworkConditions', connectionPreset || NETWORK_PRESETS.WiFi);
if (process.env.DEVICE_NAME === 'Desktop') {
await this.page.setViewport({ width: 1280, height: 720 });
}
this.page.setDefaultTimeout(3600000);
// Getting all page console logs
@ -65,13 +76,12 @@ class Page {
const joinURL = helper.getJoinURL(this.meetingId, this.effectiveParams, isModerator, customParameter);
await this.page.goto(joinURL, { waitUntil: 'networkidle2' });
const checkForGetMetrics = async () => {
if (process.env.BBB_COLLECT_METRICS === 'true') {
await this.waitForSelector(ue.anyUser, ELEMENT_WAIT_TIME);
await this.getMetrics(testFolderName);
}
};
await checkForGetMetrics();
await this.getUserAgent();
if (process.env.BBB_COLLECT_METRICS === 'true' && process.env.IS_MOBILE !== 'true') {
await this.waitForSelector(ue.anyUser, ELEMENT_WAIT_TIME);
await this.getMetrics(testFolderName);
}
} catch (e) {
this.logger(e);
}
@ -153,10 +163,33 @@ class Page {
return await document.querySelectorAll(element)[0];
}
async getUserAgent() {
const useragent = await this.page.evaluate('navigator.userAgent');
console.log({ useragent });
return useragent;
}
// Get the default arguments for creating a page
static getArgs() {
const args = ['--no-sandbox', '--use-fake-ui-for-media-stream', '--window-size=1280,720', '--lang=en-US'];
return { headless: true, args };
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--no-default-browser-check',
'--window-size=1280,1000',
'--lang=en-US',
];
return {
headless: false,
args,
defaultViewport: {
width: 1280,
height: 805,
},
ignoreDefaultArgs: [
'--enable-automation',
],
};
}
static getArgsWithAudio() {
@ -177,14 +210,22 @@ class Page {
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--window-size=1280,720',
'--no-default-browser-check',
'--window-size=1280,1000',
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
'--allow-file-access',
'--lang=en-US',
];
return {
headless: true,
headless: false,
args,
defaultViewport: {
width: 1280,
height: 805,
},
ignoreDefaultArgs: [
'--enable-automation',
],
};
}
@ -206,14 +247,22 @@ class Page {
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--window-size=1280,720',
'--no-default-browser-check',
'--window-size=1280,1000',
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video_rgb.y4m')}`,
'--allow-file-access',
'--lang=en-US',
];
return {
headless: true,
headless: false,
args,
defaultViewport: {
width: 1280,
height: 805,
},
ignoreDefaultArgs: [
'--enable-automation',
],
};
}
@ -235,18 +284,90 @@ class Page {
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--window-size=1280,720',
'--no-default-browser-check',
'--window-size=1280,1000',
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video_rgb.y4m')}`,
'--allow-file-access',
'--lang=en-US',
];
return {
headless: true,
headless: false,
args,
defaultViewport: {
width: 1280,
height: 805,
},
ignoreDefaultArgs: [
'--enable-automation',
],
};
}
static iPhoneXArgs() {
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--user-agent=${USER_AGENTS.iPhoneX}`,
`--window-size=${MOBILE_DEVICES.iPhoneX.defaultViewport.width + 250},${MOBILE_DEVICES.iPhoneX.defaultViewport.height}`,
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video_rgb.y4m')}`,
'--allow-file-access',
'--lang=en-US',
];
const mobileArgs = MOBILE_DEVICES.iPhoneX;
return {
headless: false,
args,
...mobileArgs,
};
}
static iPadArgs() {
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--user-agent=${USER_AGENTS.iPad}`,
`--window-size=${MOBILE_DEVICES.iPad.defaultViewport.width},${MOBILE_DEVICES.iPad.defaultViewport.height}`,
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video_rgb.y4m')}`,
'--allow-file-access',
'--lang=en-US',
];
const mobileArgs = MOBILE_DEVICES.iPad;
return {
headless: false,
args,
...mobileArgs,
};
}
static galaxyNote3Args() {
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--user-agent=${USER_AGENTS.GalaxyNote3}`,
`--window-size=${MOBILE_DEVICES.GalaxyNote3.defaultViewport.width + 250},${MOBILE_DEVICES.GalaxyNote3.defaultViewport.height}`,
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video_rgb.y4m')}`,
'--allow-file-access',
'--lang=en-US',
];
const mobileArgs = MOBILE_DEVICES.GalaxyNote3;
return {
headless: false,
args,
...mobileArgs,
};
}
// async emulateMobile(userAgent) {
// await this.page.setUserAgent(userAgent);
// }
// Returns a Promise that resolves when an element does not exist/is removed from the DOM
async waitForElementHandleToBeRemoved(element) {
await this.page.waitForTimeout(1000);
@ -415,8 +536,8 @@ class Page {
}
await this.waitForSelector(ue.anyUser, ELEMENT_WAIT_TIME);
const totalNumberOfUsersMongo = await this.page.evaluate(() => {
const collection = require('/imports/api/users/index.js');
const users = collection.default._collection.find({ connectionStatus: 'online' }).count();
const collection = require('/imports/api/users-persistent-data/index.js');
const users = collection.default._collection.find({}, {}, {}, {}, {}, { loggedOut: 'false' }).count();
return users;
});
const totalNumberOfUsersDom = await this.page.evaluate(() => document.querySelectorAll('[data-test^="userListItem"]').length);

View File

@ -0,0 +1,94 @@
// Network Profiles (GPRS, Regular2G, Good2G, Regular3G, Good3G, Regular4G, DSL, WiFi)
exports.NETWORK_PRESETS = {
GPRS: {
offline: false,
downloadThroughput: 50 * 1024 / 8,
uploadThroughput: 20 * 1024 / 8,
latency: 500,
},
Regular2G: {
offline: false,
downloadThroughput: 250 * 1024 / 8,
uploadThroughput: 50 * 1024 / 8,
latency: 300,
},
Good2G: {
offline: false,
downloadThroughput: 450 * 1024 / 8,
uploadThroughput: 150 * 1024 / 8,
latency: 150,
},
Regular3G: {
offline: false,
downloadThroughput: 750 * 1024 / 8,
uploadThroughput: 250 * 1024 / 8,
latency: 100,
},
Good3G: {
offline: false,
downloadThroughput: 1.5 * 1024 * 1024 / 8,
uploadThroughput: 750 * 1024 / 8,
latency: 40,
},
Regular4G: {
offline: false,
downloadThroughput: 4 * 1024 * 1024 / 8,
uploadThroughput: 3 * 1024 * 1024 / 8,
latency: 20,
},
DSL: {
offline: false,
downloadThroughput: 2 * 1024 * 1024 / 8,
uploadThroughput: 1 * 1024 * 1024 / 8,
latency: 5,
},
WiFi: {
offline: false,
downloadThroughput: 30 * 1024 * 1024 / 8,
uploadThroughput: 15 * 1024 * 1024 / 8,
latency: 2,
},
};
// Mobile Devices (iPhoneX, GalaxyA31, iPad)
exports.MOBILE_DEVICES = {
iPhoneX: {
devtools: true,
ignoreHTTPSErrors: true,
defaultViewport: {
width: 375,
height: 812,
isMobile: true,
},
},
GalaxyNote3: {
devtools: true,
ignoreHTTPSErrors: true,
defaultViewport: {
width: 360,
height: 640,
isMobile: true,
},
},
iPad: {
devtools: true,
ignoreHTTPSErrors: true,
defaultViewport: {
width: 765,
height: 850,
isMobile: true,
},
},
};
// User Agents (iPhoneX, GalaxyNote3, iPad, Desktop)
exports.USER_AGENTS = {
iPhoneX:
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1',
GalaxyNote3:
'Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N900V 4G Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4408.2 Mobile Safari/537.36',
iPad:
'Mozilla/5.0 (iPad; CPU OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1',
Desktop:
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36',
};

View File

@ -10,6 +10,11 @@ async function getTestElement(element) {
(await document.querySelectorAll(element)[0]) !== null;
}
async function waitForScreenshareContainer(test) {
await test.waitForSelector(e.screenshareConnecting, ELEMENT_WAIT_TIME);
await test.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
}
async function getScreenShareContainer(test) {
await test.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
const screenShareContainer = await test.page.evaluate(getTestElement, e.screenShareVideo);
@ -28,3 +33,4 @@ exports.getScreenShareBreakoutContainer = getScreenShareBreakoutContainer;
exports.getScreenShareContainer = getScreenShareContainer;
exports.getTestElement = getTestElement;
exports.startScreenshare = startScreenshare;
exports.waitForScreenshareContainer = waitForScreenshareContainer;

View File

@ -2,7 +2,8 @@ const Page = require('./core/page');
const Status = require('./user/status');
const MultiUsers = require('./user/multiusers');
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_MULTIUSERS_TEST_TIMEOUT } = require('./core/constants'); // core constants (Timeouts vars imported)
const { MAX_MULTIUSERS_TEST_TIMEOUT, TEST_DURATION_TIME } = require('./core/constants'); // core constants (Timeouts vars imported)
const { NETWORK_PRESETS, USER_AGENTS, MOBILE_DEVICES } = require('./core/profiles');
expect.extend({ toMatchImageSnapshot });
@ -11,6 +12,36 @@ const userTest = () => {
jest.setTimeout(MAX_MULTIUSERS_TEST_TIMEOUT);
});
// Mobile User Should have 'Mobile' tag under his name in Userslist
test('Mobile Tag Name For Mobile User', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'mobileTagName';
await test.logger('begin of ', testName);
await test.init(Page.iPhoneXArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
await test.closeAudioModal();
response = await test.mobileTagName();
await test.logger('end of ', testName);
await test.stopRecording();
screenshot = await test.page.screenshot();
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 1.08,
failureThresholdType: 'percent',
});
}
});
// Change user status icon and check if it has changed
test('Change status', async () => {
const test = new Status();
let response;
@ -39,6 +70,7 @@ const userTest = () => {
}
});
// Connect with 2 users and check if User1 sees User2
test('Multi user presence check', async () => {
const test = new MultiUsers();
let response;
@ -55,7 +87,7 @@ const userTest = () => {
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
await test.page1.logger('begin of ', testName);
await test.page1.logger('end of ', testName);
} catch (err) {
await test.page1.logger(err);
} finally {
@ -69,5 +101,121 @@ const userTest = () => {
});
}
});
// Open Connection Status Modal and check if appears
test('Connections Status Modal', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'connectionStatusModal';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
await test.closeAudioModal();
response = await test.findConnectionStatusModal();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 19.93,
failureThresholdType: 'percent',
});
}
});
// Open Connection Status Modal, start Webcam Share, disable Webcams in
// Connection Status Modal and check if webcam sharing is still available
test('Disable Webcams From Connection Status Modal', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'disableWebcamsFromConnectionStatus';
await test.logger('begin of ', testName);
await test.init(Page.getArgsWithVideo(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
response = await test.disableWebcamsFromConnectionStatus();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 19.93,
failureThresholdType: 'percent',
});
}
});
// Open Connection Status Modal, start Screenshare, disable Screenshare in
// Connection Status Modal and check if Screensharing is still available
test('Disable Screenshare From Connection Status Modal', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'disableScreenshareFromConnectionStatus';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
response = await test.disableScreenshareFromConnectionStatus();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 19.93,
failureThresholdType: 'percent',
});
}
});
// Connect with a Good3G NETWORK_PRESET profil, Open Connection Status Modal
// and check if User1 appears in reported connection issues
test('Report a User in Connection Issues', async () => {
const test = new Status();
let response;
let screenshot;
try {
const testName = 'reportUserInConnectionIssues';
await test.logger('begin of ', testName);
await test.init(Page.getArgsWithAudioAndVideo(), undefined, undefined, undefined, testName, NETWORK_PRESETS.Regular4G);
await test.startRecording(testName);
response = await test.reportUserInConnectionIssues();
await test.stopRecording();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 19.93,
failureThresholdType: 'percent',
});
}
}, TEST_DURATION_TIME);
};
module.exports = exports = userTest;

View File

@ -4,6 +4,18 @@ exports.anyUser = '[data-test^="userListItem"]';
exports.setStatus = '[data-test="setstatus"]';
exports.away = '[data-test="away"]';
exports.applaud = '[data-test="applause"]';
exports.applauseIcon = 'div[data-test="userAvatar"] > div > i[class="icon-bbb-applause"]';
exports.awayIcon = 'div[data-test="userAvatar"] > div > i[class="icon-bbb-time"]';
exports.clearStatus = '[data-test="clearStatus"]';
exports.statusIcon = '[data-test="userAvatar"]';
exports.setPresenter = 'li[data-test="setPresenter"]';
exports.connectionStatusModal = 'div[aria-label="Connection status modal"]';
exports.dataSavingWebcams = 'input[data-test="dataSavingWebcams"]';
exports.dataSavingScreenshare = 'input[data-test="dataSavingScreenshare"]';
exports.closeConnectionStatusModal = 'button[aria-label="Close Connection status modal"]';
exports.webcamsIsDisabledInDataSaving = 'button[aria-label="Webcam sharing is disabled in Data Saving"]';
exports.screenshareLocked = 'button[aria-label="Screenshare locked"]';
exports.connectionStatusItemEmpty = 'div[data-test="connectionStatusItemEmpty"]';
exports.connectionStatusItemUser = 'div[data-test="connectionStatusItemUser"]';
exports.mobileUser = 'span[data-test="mobileUser"]';
exports.userList = '[aria-label="Users and messages toggle"]';

View File

@ -1,7 +1,11 @@
const { ELEMENT_WAIT_TIME } = require('../core/constants');
const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const Page = require('../core/page');
const e = require('./elements');
const util = require('./util');
const utilWebcam = require('../webcam/util');
const utilScreenshare = require('../screenshare/util');
const utilB = require('../breakout/util');
const { sleep } = require('../core/helper');
class Status extends Page {
constructor() {
@ -10,15 +14,84 @@ class Status extends Page {
async test() {
await util.setStatus(this, e.applaud);
const resp1 = await this.page.evaluate(util.countTestElements, 'div[data-test="userAvatar"] > div > i[class="icon-bbb-applause"]');
const resp1 = await this.page.evaluate(util.countTestElements, e.applauseIcon);
await util.setStatus(this, e.away);
const resp2 = await this.page.evaluate(util.countTestElements, 'div[data-test="userAvatar"] > div > i[class="icon-bbb-time"]');
const resp2 = await this.page.evaluate(util.countTestElements, e.awayIcon);
await this.click(e.firstUser, true);
await this.waitForSelector(e.clearStatus, ELEMENT_WAIT_TIME);
await this.click(e.clearStatus, true);
return resp1 === resp2;
}
}
async mobileTagName() {
await this.page.waitForSelector(e.userList, ELEMENT_WAIT_TIME);
await this.page.click(e.userList, true);
await this.page.waitForSelector(e.firstUser, ELEMENT_WAIT_TIME);
const response = await this.page.evaluate(util.countTestElements, e.mobileUser) === true;
return response;
}
async findConnectionStatusModal() {
await util.connectionStatus(this.page);
const resp = await this.page.evaluate(util.countTestElements, e.connectionStatusModal) === true;
return resp;
}
async disableWebcamsFromConnectionStatus() {
try {
await this.closeAudioModal();
await utilWebcam.enableWebcam(this, ELEMENT_WAIT_LONGER_TIME);
await util.connectionStatus(this);
await this.waitForSelector(e.dataSavingWebcams, ELEMENT_WAIT_TIME);
await this.page.evaluate(utilB.clickTestElement, e.dataSavingWebcams);
await this.waitForSelector(e.closeConnectionStatusModal, ELEMENT_WAIT_TIME);
await this.page.evaluate(utilB.clickTestElement, e.closeConnectionStatusModal);
await sleep(2000);
const webcamsIsDisabledInDataSaving = await this.page.evaluate(util.countTestElements, e.webcamsIsDisabledInDataSaving) === true;
return webcamsIsDisabledInDataSaving === true;
} catch (e) {
console.log(e);
return false;
}
}
async disableScreenshareFromConnectionStatus() {
try {
await this.closeAudioModal();
await utilScreenshare.startScreenshare(this);
await utilScreenshare.waitForScreenshareContainer(this);
await util.connectionStatus(this);
await this.waitForSelector(e.dataSavingScreenshare, ELEMENT_WAIT_TIME);
await this.page.evaluate(utilB.clickTestElement, e.dataSavingScreenshare);
await this.waitForSelector(e.closeConnectionStatusModal, ELEMENT_WAIT_TIME);
await this.page.evaluate(utilB.clickTestElement, e.closeConnectionStatusModal);
await sleep(2000);
const webcamsIsDisabledInDataSaving = await this.page.evaluate(util.countTestElements, e.screenshareLocked) === true;
return webcamsIsDisabledInDataSaving === true;
} catch (e) {
console.log(e);
return false;
}
}
async reportUserInConnectionIssues() {
try {
await this.page.evaluate(() => window.dispatchEvent(new CustomEvent('socketstats', { detail: { rtt: 2000 } })));
await this.joinMicrophone();
await utilWebcam.enableWebcam(this, ELEMENT_WAIT_LONGER_TIME);
await utilScreenshare.startScreenshare(this);
await utilScreenshare.waitForScreenshareContainer(this);
await util.connectionStatus(this);
await sleep(5000);
const connectionStatusItemEmpty = await this.page.evaluate(util.countTestElements, e.connectionStatusItemEmpty) === false;
const connectionStatusItemUser = await this.page.evaluate(util.countTestElements, e.connectionStatusItemUser) === true;
return connectionStatusItemUser && connectionStatusItemEmpty;
} catch (e) {
console.log(e);
return false;
}
}
}
module.exports = exports = Status;

View File

@ -10,10 +10,15 @@ async function setStatus(test, status) {
await test.click(status, true);
}
async function countTestElements(element) {
return document.querySelectorAll(element).length !== 0;
}
async function connectionStatus(test) {
await test.click('button[data-test="connectionStatusButton"]', true);
await test.waitForSelector('div[aria-label="Connection status modal"]', ELEMENT_WAIT_TIME);
}
exports.countTestElements = countTestElements;
exports.setStatus = setStatus;
exports.connectionStatus = connectionStatus;