diff --git a/bigbluebutton-html5/imports/ui/components/whiteboard/whiteboard-toolbar/component.jsx b/bigbluebutton-html5/imports/ui/components/whiteboard/whiteboard-toolbar/component.jsx index dc0883d0b4dfea1f9587d45576699b49490b3b4b..f776cc807be11d89199614684374b80706406e4e 100755 --- a/bigbluebutton-html5/imports/ui/components/whiteboard/whiteboard-toolbar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/whiteboard/whiteboard-toolbar/component.jsx @@ -292,7 +292,7 @@ class WhiteboardToolbar extends Component { * 4. Trigger initial animation for the icons */ // 1st case - if ( (this.thicknessListIconRadius && this.thicknessListIconColor) || annotationSelected.value === 'text') { + if ((this.thicknessListIconRadius && this.thicknessListIconColor) || annotationSelected.value === 'text') { if (colorSelected.value !== prevState.colorSelected.value) { // 1st case b) if (annotationSelected.value !== 'text') { @@ -779,7 +779,7 @@ class WhiteboardToolbar extends Component { } = this.props; return ( - <span className={styles.multiUserToolItem}> + <span className={styles.multiUserToolItem} data-test={multiUser ? 'multiWhiteboardTool' : 'whiteboardTool'}> {multiUser && <span className={styles.multiUserTool}>{multiUserSize}</span>} <ToolbarMenuItem disabled={!isMeteorConnected} diff --git a/bigbluebutton-html5/package.json b/bigbluebutton-html5/package.json index aa73adc1856793fd8883f2d2748d21cc83da0494..257e4063c26cc83f75cc3fbaba9bb24ad1f46868 100755 --- a/bigbluebutton-html5/package.json +++ b/bigbluebutton-html5/package.json @@ -7,7 +7,7 @@ "start:prod": "meteor reset && ROOT_URL=http://127.0.0.1/html5client meteor run --production --port=4100", "start:dev": "ROOT_URL=http://127.0.0.1/html5client meteor run --port=4100", "start:dev-fast-mongo": "env ROOT_URL=http://127.0.0.1/html5client MONGO_OPLOG_URL=mongodb://127.0.1.1/local MONGO_URL=mongodb://127.0.1.1/meteor ROOT_URL=http://127.0.0.1/html5client NODE_ENV=development meteor run --port=4100", - "test": "export REGRESSION_TESTING=false;env $(cat tests/puppeteer/.env | xargs) jest all.test.js --color --detectOpenHandles --forceExit", + "test": "export WITH_RECORD=false;export REGRESSION_TESTING=false;env $(cat tests/puppeteer/.env | xargs) jest all.test.js --color --detectOpenHandles --forceExit", "test:recording": "export WITH_RECORD=true;export REGRESSION_TESTING=false;env $(cat tests/puppeteer/.env | xargs) jest all.test.js --color --detectOpenHandles --forceExit", "test-visual-regression": "export REGRESSION_TESTING=true;env $(cat tests/puppeteer/.env | xargs) jest all.test.js --color --detectOpenHandles --forceExit", "test-visual-regression:recording": "export WITH_RECORD=true;export REGRESSION_TESTING=true;env $(cat tests/puppeteer/.env | xargs) jest all.test.js --color --detectOpenHandles --forceExit", diff --git a/bigbluebutton-html5/tests/puppeteer/.env-template b/bigbluebutton-html5/tests/puppeteer/.env-template index 40f58fa2ce3f5f28546ccdfdb208741836b58a7f..32c96977b5b52605a2fa0b5f5985f21bba06e861 100644 --- a/bigbluebutton-html5/tests/puppeteer/.env-template +++ b/bigbluebutton-html5/tests/puppeteer/.env-template @@ -10,6 +10,5 @@ BROWSERLESS_TOKEN= # token # collecting metrics BBB_COLLECT_METRICS=true # (true/false): true to collect metrics TEST_FOLDER=data # the metrics output folder -WITH_RECORD=false # enable .mp4 test session recording for manual and local testing GENERATE_EVIDENCES=true # (true/false): true to generate evidences DEBUG=true # (true/false): true to enable console debugging diff --git a/bigbluebutton-html5/tests/puppeteer/package-lock.json b/bigbluebutton-html5/tests/puppeteer/package-lock.json index b459ab4077f9b5ce9d43d453893404d17d0a7c0c..3498dd74dcab60d376b811c7ff27ed9db50be39c 100644 --- a/bigbluebutton-html5/tests/puppeteer/package-lock.json +++ b/bigbluebutton-html5/tests/puppeteer/package-lock.json @@ -3416,11 +3416,6 @@ "path": "^0.12.7" } }, - "puppeteer-recorder": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/puppeteer-recorder/-/puppeteer-recorder-1.0.7.tgz", - "integrity": "sha512-SgJ8U/HP6iiH3saNYOk/fddnEYdX1spDgfi3yxrvHsywvahD8vPO6gqvFXkAn4R6LVO9SOpgPNFhCjCMkv36IQ==" - }, "puppeteer-video-recorder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/puppeteer-video-recorder/-/puppeteer-video-recorder-1.0.3.tgz", diff --git a/bigbluebutton-html5/tests/puppeteer/package.json b/bigbluebutton-html5/tests/puppeteer/package.json index 1f358e77d9557efa5d06060ae56882e3403dd782..63c232653c225035752fd662e15a51934b771bcb 100644 --- a/bigbluebutton-html5/tests/puppeteer/package.json +++ b/bigbluebutton-html5/tests/puppeteer/package.json @@ -12,8 +12,8 @@ "jest": "^26.6.1", "js-yaml": "^4.0.0", "moment": "^2.24.0", - "puppeteer-recorder": "^1.0.7", "puppeteer-video-recorder": "^1.0.3", + "puppeteer-mass-screenshots": "^1.0.14", "sleep-promise": "9.1.0", "sha1": "^1.1.1", "yaml": "^1.7.2" diff --git a/bigbluebutton-html5/tests/puppeteer/user/multiusers.js b/bigbluebutton-html5/tests/puppeteer/user/multiusers.js index d9d42c0fdafc3b2ccaf13bf6faf0606de0f8aaaa..692f662db4abddbeff72d450d61af88757361763 100644 --- a/bigbluebutton-html5/tests/puppeteer/user/multiusers.js +++ b/bigbluebutton-html5/tests/puppeteer/user/multiusers.js @@ -5,6 +5,7 @@ const utilCustomParams = require('../customparameters/util'); const pe = require('../core/elements'); const ne = require('../notifications/elements'); const ple = require('../polling/elemens'); +const we = require('../whiteboard/elements'); const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { sleep } = require('../core/helper'); @@ -21,6 +22,11 @@ class MultiUsers { await this.page2.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'User2' }, undefined, testFolderName); } + // Join BigBlueButton meeting + async initUser3(testFolderName) { + await this.page3.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'User3' }, undefined, testFolderName); + } + // Run the test for the page async checkForOtherUser() { const firstCheck = await this.page1.page.evaluate(() => document.querySelectorAll('[data-test="userListItem"]').length > 0); @@ -42,6 +48,7 @@ class MultiUsers { await util.openPrivateChatMessage(this.page1, this.page2); const chat0 = await this.page1.page.evaluate(() => document.querySelectorAll('p[data-test="chatUserMessageText"]').length); await util.sendPrivateChatMessage(this.page1, this.page2); + await sleep(2000); const chat1 = await this.page1.page.evaluate(() => document.querySelectorAll('p[data-test="chatUserMessageText"]').length); return chat0 !== chat1; } @@ -147,6 +154,18 @@ class MultiUsers { } } + async testWhiteboardAccess() { + await this.page1.closeAudioModal(); + await this.page2.closeAudioModal(); + await this.page3.closeAudioModal(); + await this.page1.waitForSelector(we.whiteboard, ELEMENT_WAIT_TIME); + await this.page1.clickNItem(we.userListItem, true, 1); + await this.page1.clickNItem(we.changeWhiteboardAccess, true, 1); + await sleep(2000); + const resp = await this.page1.page.evaluate(async () => await document.querySelector('[data-test="multiWhiteboardTool"]').children[0].innerText === '1'); + return resp; + } + // Close all Pages async close(page1, page2) { await page1.close(); diff --git a/bigbluebutton-html5/tests/puppeteer/whiteboard.obj.js b/bigbluebutton-html5/tests/puppeteer/whiteboard.obj.js index 2b2c7f1feabbbf35e794e489d82304fcbb8a44e8..3af8a17d547bd7412c86f94b25f58aad8b8b1456 100644 --- a/bigbluebutton-html5/tests/puppeteer/whiteboard.obj.js +++ b/bigbluebutton-html5/tests/puppeteer/whiteboard.obj.js @@ -1,5 +1,6 @@ const Page = require('./core/page'); const Draw = require('./whiteboard/draw'); +const Multiusers = require('./user/multiusers'); const { toMatchImageSnapshot } = require('jest-image-snapshot'); const { MAX_WHITEBOARD_TEST_TIMEOUT } = require('./core/constants'); @@ -10,6 +11,8 @@ const whiteboardTest = () => { jest.setTimeout(MAX_WHITEBOARD_TEST_TIMEOUT); }); + // Draw a rectange in whiteboard + // and expect difference in shapes before and after drawing test('Draw rectangle', async () => { const test = new Draw(); let response; @@ -38,5 +41,39 @@ const whiteboardTest = () => { }); } }); + + // 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.initUser3(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(); + } catch (e) { + await test.page1.logger(e); + } finally { + await test.close(test.page1, test.page2); + await test.closePage(test.page3); + } + expect(response).toBe(true); + if (process.env.REGRESSION_TESTING === 'true') { + expect(screenshot).toMatchImageSnapshot({ + failureThreshold: 0.9, + failureThresholdType: 'percent', + }); + } + }); }; module.exports = exports = whiteboardTest; diff --git a/bigbluebutton-html5/tests/puppeteer/whiteboard/elements.js b/bigbluebutton-html5/tests/puppeteer/whiteboard/elements.js index 969a6e7b7f89c9363eca0ac17d324181440bcc40..b44bba0f15921dd1cc4ffc2161fce338e0710a7c 100644 --- a/bigbluebutton-html5/tests/puppeteer/whiteboard/elements.js +++ b/bigbluebutton-html5/tests/puppeteer/whiteboard/elements.js @@ -3,3 +3,5 @@ exports.tools = 'button[aria-label="Tools"]'; exports.pencil = 'button[aria-label="Pencil"]'; exports.rectangle = 'button[aria-label="Rectangle"]'; exports.drawnRectangle = 'rect[data-test="drawnRectangle"]'; +exports.userListItem = 'div[data-test="userListItem"]'; +exports.changeWhiteboardAccess = 'li[data-test="changeWhiteboardAccess"]';