Skip to content
Snippets Groups Projects
Commit b48b8233 authored by Mohamed Amine Ben Salah's avatar Mohamed Amine Ben Salah
Browse files

adds webcams layout test suite

parent 04833ce6
No related branches found
No related tags found
No related merge requests found
......@@ -190,6 +190,34 @@ class Page {
};
}
static getArgsWithAudioAndVideo() {
if (process.env.BROWSERLESS_ENABLED === 'true') {
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--lang=en-US',
];
return {
headless: true,
args,
};
}
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--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,
args,
};
}
// Returns a Promise that resolves when an element does not exist/is removed from the DOM
elementRemoved(element) {
return this.page.waitFor(element => !document.querySelector(element), {}, element);
......
......@@ -6,7 +6,7 @@ usage() {
BBB Health Check
OPTIONS:
-t <test name: whiteboard/webcam/virtualizedlist/user/sharednotes/screenshare/presentation/notifications/customparameters/chat/breakout/audio/all>
-t <test name: webcamlayout/whiteboard/webcam/virtualizedlist/user/sharednotes/screenshare/presentation/notifications/customparameters/chat/breakout/audio/all>
-h <hostname name of BigBlueButton server>
-s <Shared secret>
......
......@@ -4,3 +4,5 @@ exports.startSharingWebcam = 'button[aria-label="Start sharing"]';
exports.videoContainer = 'div[class^="videoListItem"]';
exports.webcamConnecting = '[class^="connecting-"]';
exports.presentationFullscreenButton = 'button[data-test="presentationFullscreenButton"]';
exports.webcamItemTalkingUser = 'div[data-test="webcamItemTalkingUser"]';
exports.webcamVideo = 'video[data-test="videoContainer"]';
......@@ -66,8 +66,13 @@ async function clickTestElement(element) {
document.querySelectorAll(element)[0].click();
}
async function countTestElements(element) {
return await document.querySelectorAll(element).length;
}
exports.startAndCheckForWebcams = startAndCheckForWebcams;
exports.webcamContentCheck = webcamContentCheck;
exports.evaluateCheck = evaluateCheck;
exports.getFullScreenWebcamButton = getFullScreenWebcamButton;
exports.enableWebcam = enableWebcam;
exports.countTestElements = countTestElements;
const util = require('./util');
const wle = require('./elements');
const Page = require('../core/page');
class WebcamLayout extends Page {
constructor() {
super('webcam-layout-test');
}
async share() {
await this.joinMicrophone(this);
await util.enableWebcam(this);
}
async test() {
await this.page.waitForSelector(wle.webcamConnecting);
await this.page.waitForSelector(wle.webcamVideo);
return await this.page.evaluate(util.countTestElements, wle.webcamItemTalkingUser) !== 0;
}
}
module.exports = exports = WebcamLayout;
const Page = require('./core/page');
const webcamLayout = require('./webcam/webcamlayout');
const webcamLayoutTest = () => {
beforeEach(() => {
jest.setTimeout(50000);
});
test('Join Webcam and microphone', async () => {
const test = new webcamLayout();
let response;
try {
await test.init(Page.getArgsWithAudioAndVideo());
await test.share();
response = await test.test();
} catch (e) {
console.log(e);
} finally {
await test.close();
}
expect(response).toBe(true);
});
};
module.exports = exports = webcamLayoutTest;
const webcamLayoutTest = require('./webcamlayout.obj');
describe('Webcams Layout', webcamLayoutTest);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment