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

71 lines
2.2 KiB
JavaScript
Raw Normal View History

const Page = require('./core/page');
const Slide = require('./presentation/slide');
const Upload = require('./presentation/upload');
2020-10-09 03:25:35 +08:00
const { toMatchImageSnapshot } = require('jest-image-snapshot');
const { MAX_PRESENTATION_TEST_TIMEOUT } = require('./core/constants'); // core constants (Timeouts vars imported)
2020-10-09 03:25:35 +08:00
expect.extend({ toMatchImageSnapshot });
const presentationTest = () => {
beforeEach(() => {
jest.setTimeout(MAX_PRESENTATION_TEST_TIMEOUT);
});
test('Skip slide', async () => {
const test = new Slide();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'skipSlide';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
await test.closeAudioModal();
response = await test.test();
await test.stopRecording(testName);
2020-10-09 03:25:35 +08:00
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);
2020-10-09 03:25:35 +08:00
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 0.81,
2020-10-09 03:25:35 +08:00
failureThresholdType: 'percent',
});
}
});
test('Upload presentation', async () => {
const test = new Upload();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'uploadPresentation';
await test.logger('begin of ', testName);
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
await test.startRecording(testName);
await test.closeAudioModal();
response = await test.test(testName);
await test.stopRecording();
2020-10-09 03:25:35 +08:00
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);
2020-10-09 03:25:35 +08:00
if (process.env.REGRESSION_TESTING === 'true') {
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 24.62,
2020-10-09 03:25:35 +08:00
failureThresholdType: 'percent',
});
}
});
};
module.exports = exports = presentationTest;