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

41 lines
1.2 KiB
JavaScript
Raw Normal View History

const Page = require('./core/page');
const Draw = require('./whiteboard/draw');
2020-10-09 03:25:35 +08:00
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_WHITEBOARD_TEST_TIMEOUT } = require('./core/constants');
2020-10-09 03:25:35 +08:00
expect.extend({ toMatchImageSnapshot });
const whiteboardTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_WHITEBOARD_TEST_TIMEOUT);
});
test('Draw rectangle', async () => {
const test = new Draw();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'drawRectangle';
await test.logger('begin of ', testName);
await test.init(Page.getArgs());
await test.logger('Test Name: ', testName);
await test.closeAudioModal();
response = await test.test();
await test.logger('end of ', testName);
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
} catch (e) {
await test.logger(e);
} 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: 0.9,
2020-10-09 03:25:35 +08:00
failureThresholdType: 'percent',
});
}
});
};
module.exports = exports = whiteboardTest;