bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/webcam.obj.js
Mohamed Amine Ben Salah d8c5aa46d9
multiple automated tests suites updates + add missing polling specs and move them with old ones to a polling test suite (#10766)
* updating old tests + collecting more snapshots [WIP]

* updates old test suites and collects more visual regressions screenshots

* remove snapshots and their collection temporary

* run tests from packages.json

* update test execution command/export constants from .env to core/constants.js

* update tests/puppeteer/README.md file

* update LOOP_INTERVAL variable call and assign timeouts to the webcam share spec

* redefine waitForSelector func in page.js, update chat test suite specs and add poll chat message test spec

* Merge remote-tracking branch 'upstream/develop' into updating-old-tests-visual-with-visual-regressions

* update webcam test specs collecting videoPreviewTimeout and use it to wait for videoPreview selector

* update custom parameters test suite

* update breakout test suite

* update webcam layout test suite

* update multiusers test suite

* update notifications test suite

* update presentation test suite

* whiteboard test suite

* screenshare test suite

* update sharednotes test suite

* user ELEMENT_WAIT_TIME variable from timeouts constants.js

* list TEST CONSTANTS by category

* add poll test suite and assigns the right unassigned timeouts

* set test pages to headless
2021-02-16 15:57:10 -05:00

65 lines
1.8 KiB
JavaScript

const Share = require('./webcam/share');
const Check = require('./webcam/check');
const Page = require('./core/page');
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_WEBCAM_TEST_TIMEOUT } = require('./core/constants');
expect.extend({ toMatchImageSnapshot });
const webcamTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_WEBCAM_TEST_TIMEOUT);
});
test('Shares webcam', async () => {
const test = new Share();
let response;
let screenshot;
try {
const testName = 'shareWebcam';
await test.logger('begin of ', testName);
await test.init(Page.getArgsWithVideo());
response = await test.test();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 0.81,
failureThresholdType: 'percent',
});
}
});
test('Checks content of webcam', async () => {
const test = new Check();
let response;
let screenshot;
try {
const testName = 'checkWebcamContent';
await test.logger('begin of ', testName);
await test.init(Page.getArgsWithVideo());
response = await test.test();
screenshot = await test.page.screenshot();
await test.logger('end of ', testName);
} catch (e) {
await test.logger(e);
} finally {
await test.close();
}
expect(response).toBe(true);
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 7.5,
failureThresholdType: 'percent',
});
}
});
};
module.exports = exports = webcamTest;