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

102 lines
3.4 KiB
JavaScript
Raw Normal View History

const Page = require('./core/page');
const Presentation = require('./presentation/presentation');
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 () => {
2021-09-08 22:20:57 +08:00
const test = new Presentation();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'skipSlide';
2021-09-08 22:20:57 +08:00
await test.modPage.logger('begin of ', testName);
await test.initModPage(testName);
await test.modPage.startRecording(testName);
response = await test.skipSlide();
await test.modPage.stopRecording(testName);
2021-09-09 01:18:01 +08:00
screenshot = await test.modPage.page.screenshot();
2021-09-08 22:20:57 +08:00
await test.modPage.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
2021-09-08 22:20:57 +08:00
await test.modPage.logger(err);
} finally {
2021-09-08 22:20:57 +08:00
await test.closePages();
}
expect(response).toBe(true);
await Page.checkRegression(0.81, screenshot);
});
test('Upload presentation', async () => {
2021-09-08 22:20:57 +08:00
const test = new Presentation();
let response;
2020-10-09 03:25:35 +08:00
let screenshot;
try {
const testName = 'uploadPresentation';
2021-09-08 22:20:57 +08:00
await test.modPage.logger('begin of ', testName);
await test.initModPage(testName);
await test.modPage.startRecording(testName);
response = await test.uploadPresentation(testName);
await test.modPage.stopRecording();
2021-09-09 01:18:01 +08:00
screenshot = await test.modPage.page.screenshot();
2021-09-08 22:20:57 +08:00
await test.modPage.logger('end of ', testName);
2021-08-26 22:13:18 +08:00
} catch (err) {
2021-09-08 22:20:57 +08:00
await test.modPage.logger(err);
} finally {
2021-09-08 22:20:57 +08:00
await test.closePages();
}
expect(response).toBe(true);
await Page.checkRegression(24.62, screenshot);
});
test('Allow and disallow presentation download', async () => {
const test = new Presentation();
let response;
let screenshot;
try {
const testName = 'allowAndDisallowPresentationDownload';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
await test.modPage.startRecording(testName);
response = await test.allowAndDisallowDownload(testName);
await test.modPage.stopRecording();
2021-09-09 01:18:01 +08:00
screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName);
} catch (e) {
await test.modPage.logger(e);
} finally {
await test.closePages();
}
expect(response).toBe(true);
await Page.checkRegression(24.62, screenshot);
});
test.only('Remove all presentation', async () => {
const test = new Presentation();
let response;
let screenshot;
try {
const testName = 'removeAllPresentation';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
await test.modPage.startRecording(testName);
response = await test.removeAllPresentation(testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName);
} catch (e) {
await test.modPage.logger(e);
} finally {
await test.closePages();
}
expect(response).toBe(true);
await Page.checkRegression(24.62, screenshot);
});
};
module.exports = exports = presentationTest;