bigbluebutton-Github/bigbluebutton-tests/puppeteer/webcam.obj.js

59 lines
1.8 KiB
JavaScript
Raw Normal View History

const Share = require('./webcam/share');
const Check = require('./webcam/check');
const Page = require('./core/page');
2020-10-09 03:25:35 +08:00
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_WEBCAM_TEST_TIMEOUT } = require('./core/constants');
2020-10-09 03:25:35 +08:00
expect.extend({ toMatchImageSnapshot });
const webcamTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_WEBCAM_TEST_TIMEOUT);
});
test('Shares webcam', async () => {
const test = new Share();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'shareWebcam';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
response = await test.test();
await test.stopRecording();
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
await Page.checkRegression(0.81, screenshot);
});
test('Checks content of webcam', async () => {
const test = new Check();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'checkWebcamContent';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
response = await test.test();
await test.stopRecording();
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
await Page.checkRegression(7.5, screenshot);
});
};
module.exports = exports = webcamTest;