2020-08-06 02:44:17 +08:00
|
|
|
const Page = require('./core/page');
|
|
|
|
const Draw = require('./whiteboard/draw');
|
2021-03-30 18:49:07 +08:00
|
|
|
const Multiusers = require('./user/multiusers');
|
2020-10-09 03:25:35 +08:00
|
|
|
const { toMatchImageSnapshot } = require('jest-image-snapshot');
|
2021-02-17 04:57:10 +08:00
|
|
|
const { MAX_WHITEBOARD_TEST_TIMEOUT } = require('./core/constants');
|
2020-10-09 03:25:35 +08:00
|
|
|
|
|
|
|
expect.extend({ toMatchImageSnapshot });
|
2020-08-06 02:44:17 +08:00
|
|
|
|
|
|
|
const whiteboardTest = () => {
|
|
|
|
beforeEach(() => {
|
2021-02-17 04:57:10 +08:00
|
|
|
jest.setTimeout(MAX_WHITEBOARD_TEST_TIMEOUT);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
|
|
|
|
2021-03-30 18:49:07 +08:00
|
|
|
// Draw a rectange in whiteboard
|
|
|
|
// and expect difference in shapes before and after drawing
|
2020-08-06 02:44:17 +08:00
|
|
|
test('Draw rectangle', async () => {
|
|
|
|
const test = new Draw();
|
|
|
|
let response;
|
2020-10-09 03:25:35 +08:00
|
|
|
let screenshot;
|
2020-08-06 02:44:17 +08:00
|
|
|
try {
|
2020-10-27 23:54:55 +08:00
|
|
|
const testName = 'drawRectangle';
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.logger('begin of ', testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
await test.init(Page.getArgs(), undefined, undefined, undefined, testName);
|
|
|
|
await test.startRecording(testName);
|
2020-10-27 23:54:55 +08:00
|
|
|
await test.logger('Test Name: ', testName);
|
2020-08-06 02:44:17 +08:00
|
|
|
await test.closeAudioModal();
|
|
|
|
response = await test.test();
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.logger('end of ', testName);
|
2021-02-26 23:52:17 +08:00
|
|
|
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);
|
2020-08-06 02:44:17 +08:00
|
|
|
} finally {
|
|
|
|
await test.close();
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(0.9, screenshot);
|
2020-08-06 02:44:17 +08:00
|
|
|
});
|
2021-03-30 18:49:07 +08:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
await test.init(undefined, testName);
|
|
|
|
await test.page1.startRecording(testName);
|
|
|
|
await test.page2.startRecording(testName);
|
|
|
|
await test.page1.logger('Test Name: ', 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);
|
2021-03-30 18:49:07 +08:00
|
|
|
} finally {
|
|
|
|
await test.close(test.page1, test.page2);
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
2021-06-06 23:30:46 +08:00
|
|
|
await Page.checkRegression(0.9, screenshot);
|
2021-03-30 18:49:07 +08:00
|
|
|
});
|
2020-08-06 02:44:17 +08:00
|
|
|
};
|
|
|
|
module.exports = exports = whiteboardTest;
|