bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/webcamlayout.obj.js

42 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-09-09 23:51:56 +08:00
const Page = require('./core/page');
2020-10-19 01:33:06 +08:00
const Share = require('./webcam/share');
2020-10-09 03:25:35 +08:00
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_WEBCAM_LAYOUT_TEST_TIMEOUT } = require('./core/constants');
2020-10-09 03:25:35 +08:00
expect.extend({ toMatchImageSnapshot });
2020-09-09 23:51:56 +08:00
const webcamLayoutTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_WEBCAM_LAYOUT_TEST_TIMEOUT);
2020-09-09 23:51:56 +08:00
});
test('Join Webcam and microphone', async () => {
2020-10-19 01:33:06 +08:00
const test = new Share();
2020-09-09 23:51:56 +08:00
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
2020-09-09 23:51:56 +08:00
try {
const testName = 'joinWebcamAndMicrophone';
await test.logger('begin of ', testName);
await test.init(Page.getArgsWithAudioAndVideo(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
2020-10-19 01:33:06 +08:00
await test.webcamLayoutStart();
response = await test.webcamLayoutTest(testName);
await test.logger('end of ', testName);
await test.stopRecording();
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
2020-09-09 23:51:56 +08:00
} catch (e) {
await test.logger(e);
2020-09-09 23:51:56 +08:00
} finally {
await test.close();
}
expect(response).toBe(true);
2020-10-09 03:25:35 +08:00
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 10.83,
2020-10-09 03:25:35 +08:00
failureThresholdType: 'percent',
});
}
2020-09-09 23:51:56 +08:00
});
};
module.exports = exports = webcamLayoutTest;