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

66 lines
2.1 KiB
JavaScript
Raw Normal View History

const Page = require('../core/page');
const Draw = require('./draw');
const Multiusers = require('../user/multiusers');
2021-10-21 01:23:24 +08:00
const { closePages } = require('../core/util');
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);
});
// Draw a rectangle in whiteboard
// and expect difference in shapes before and after drawing
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);
2021-09-30 20:36:08 +08:00
await test.init(true, true, testName);
await test.startRecording(testName);
response = await test.test();
await test.logger('end of ', testName);
await test.stopRecording();
2020-10-09 03:25:35 +08:00
screenshot = await test.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.logger(err);
} finally {
await test.close();
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(0.9, screenshot);
});
// Give a User Whiteboard addition access
// and expect that there is only one additional user with whiteboard access
test('Give Additional Whiteboard Access', async () => {
const test = new Multiusers();
let response;
let screenshot;
try {
const testName = 'giveWhiteboardAdditionalAccess';
await test.page1.logger('begin of ', testName);
2021-09-30 20:36:08 +08:00
await test.init(testName);
await test.page1.startRecording(testName);
await test.page2.startRecording(testName);
response = await test.testWhiteboardAccess();
await test.page1.logger('end of ', testName);
await test.page1.stopRecording();
await test.page2.stopRecording();
screenshot = await test.page1.page.screenshot();
2021-08-26 22:13:18 +08:00
} catch (err) {
await test.page1.logger(err);
} finally {
2021-10-21 01:23:24 +08:00
await closePages(test.page1, test.page2);
}
expect(response).toBe(true);
2021-10-01 02:45:59 +08:00
Page.checkRegression(0.9, screenshot);
});
};
module.exports = exports = whiteboardTest;