diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx index b02cbaf0a7f60996eb2e753c32b715fca01036f0..085f801968d9b1546cdf17ea7c1de367f449a9eb 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx @@ -683,7 +683,7 @@ class PresentationUploader extends Component { disablepreview="true" onDrop={this.handleFiledrop} > - <Icon className={styles.dropzoneIcon} iconName="upload" /> + <Icon className={styles.dropzoneIcon} data-test="dropZone" iconName="upload" /> <p className={styles.dropzoneMessage}> {intl.formatMessage(intlMessages.dropzoneLabel)} diff --git a/bigbluebutton-html5/tests/puppeteer/core/elements.js b/bigbluebutton-html5/tests/puppeteer/core/elements.js index b040acec230ebe741f9564aeb3a7b5a7c3d7d66b..faed3c80ffdf9a97c77d2bb3d37041e6145983c8 100644 --- a/bigbluebutton-html5/tests/puppeteer/core/elements.js +++ b/bigbluebutton-html5/tests/puppeteer/core/elements.js @@ -6,7 +6,6 @@ exports.echoYes = 'button[aria-label="Echo is audible"]'; exports.title = '._imports_ui_components_nav_bar__styles__presentationTitle'; exports.alerts = '.toastify-content'; - exports.isTalking = '[data-test="isTalking"]'; exports.wasTalking = '[data-test="wasTalking"]'; exports.joinAudio = 'button[aria-label="Join Audio"]'; diff --git a/bigbluebutton-html5/tests/puppeteer/notifications.test.js b/bigbluebutton-html5/tests/puppeteer/notifications.test.js index dac66db52f25dbf044282977a5a7e9fced8e4b75..a2d993b2994bd1ff27b9d674f3a7d31f8f09b30c 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications.test.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications.test.js @@ -58,4 +58,18 @@ describe('Notifications', () => { } expect(response).toBe('User4 joined the session'); }); + + test('Presentation upload notification', async () => { + const test = new Notifications(); + let response; + try { + await test.initUser3(); + response = await test.fileUploaderNotification(); + } catch (e) { + console.log(e); + } finally { + await test.closePage3(); + } + expect(response).toContain('Current presentation'); + }); }); diff --git a/bigbluebutton-html5/tests/puppeteer/notifications/elements.js b/bigbluebutton-html5/tests/puppeteer/notifications/elements.js index a7b780a504ade3efa30eed7d1f3ba8e8d0fd30de..7c6663d4b29d0fb35cfd2ef3bfc5eb908c1ee7e7 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications/elements.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications/elements.js @@ -10,4 +10,8 @@ exports.privateChatToast = 'New Private Chat message'; exports.userListNotifiedIcon = '[class^=btnWithNotificationDot]'; exports.hasUnreadMessages = 'button[data-test="hasUnreadMessages"]'; +exports.modalConfirmButton = 'button[data-test="modalConfirmButton"]'; exports.userJoinPushAlerts = '[data-test="userJoinPushAlerts"]'; +exports.uploadPresentation = '[data-test="uploadPresentation"]'; +exports.dropdownContent = '[data-test="dropdownContent"]'; +exports.dropZone = '[data-test="dropZone"]'; diff --git a/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js b/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js index 80da581b811e14e3672beda74cd074e3dd910d0c..831ca7493f522d19e415ffbfd49186d279b56ccf 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js @@ -3,6 +3,7 @@ const util = require('./util'); const MultiUsers = require('../user/multiusers'); const params = require('../params'); const ne = require('./elements'); +const we = require('../whiteboard/elements'); class Notifications extends MultiUsers { constructor() { @@ -71,10 +72,26 @@ class Notifications extends MultiUsers { return response; } + // File upload notification + async fileUploaderNotification() { + await util.uploadFileMenu(this.page3); + await this.page3.waitForSelector(ne.dropZone); + const inputUploadHandle = await this.page3.page.$('input[type=file]'); + await inputUploadHandle.uploadFile(process.env.PDF_FILE); + await this.page3.page.evaluate(util.clickTestElement, ne.modalConfirmButton); + const resp = await util.getLastToastValue(this.page3); + await this.page3.waitForSelector(we.whiteboard); + return resp; + } + async closePages() { await this.page3.close(); await this.page4.close(); } + + async closePage3() { + await this.page3.close(); + } } module.exports = exports = Notifications; diff --git a/bigbluebutton-html5/tests/puppeteer/notifications/util.js b/bigbluebutton-html5/tests/puppeteer/notifications/util.js index 101c7e3b8d64047dc18bd47738de6e0f56b341ac..9f95c2a78ed55d6b61a6aa57fc8eb6afc7e1b0ec 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications/util.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications/util.js @@ -1,7 +1,7 @@ -const e = require('../core/elements'); const ne = require('../notifications/elements'); -const ce = require('../chat/elements'); const ule = require('../user/elements'); +const ce = require('../chat/elements'); +const e = require('../core/elements'); async function clickTestElement(element) { await document.querySelectorAll(element)[0].click(); @@ -55,8 +55,7 @@ async function getTestElement(element) { await document.querySelectorAll(element)[1]; } - -async function clickOnTheOtherUser(element) { +async function clickOnElement(element) { await document.querySelectorAll(element)[0].click(); } @@ -66,7 +65,7 @@ async function clickThePrivateChatButton(element) { async function publicChatMessageToast(page1, page2) { // Open private Chat with the other User - await page1.page.evaluate(clickOnTheOtherUser, ule.userListItem); + await page1.page.evaluate(clickOnElement, ule.userListItem); await page1.page.evaluate(clickThePrivateChatButton, ce.activeChat); // send a public message await page2.page.type(ce.publicChat, ce.publicMessage1); @@ -76,7 +75,7 @@ async function publicChatMessageToast(page1, page2) { async function privateChatMessageToast(page2) { // Open private Chat with the other User - await page2.page.evaluate(clickOnTheOtherUser, ule.userListItem); + await page2.page.evaluate(clickOnElement, ule.userListItem); await page2.page.evaluate(clickThePrivateChatButton, ce.activeChat); // send a private message await page2.page.type(ce.privateChat, ce.message1); @@ -84,13 +83,26 @@ async function privateChatMessageToast(page2) { return ne.privateChatToast; } +// File upload notification +async function uploadFileMenu(test) { + await test.page.evaluate(clickOnElement, ne.dropdownContent); + await test.page.evaluate(clickOnElement, ne.uploadPresentation); +} + +async function getFileItemStatus(element, value) { + document.querySelectorAll(element)[1].innerText.includes(value); +} + +exports.getFileItemStatus = getFileItemStatus; exports.privateChatMessageToast = privateChatMessageToast; exports.publicChatMessageToast = publicChatMessageToast; exports.enableUserJoinPopup = enableUserJoinPopup; exports.getOtherToastValue = getOtherToastValue; exports.getLastToastValue = getLastToastValue; exports.enableChatPopup = enableChatPopup; +exports.uploadFileMenu = uploadFileMenu; exports.getTestElement = getTestElement; exports.saveSettings = saveSettings; exports.waitForToast = waitForToast; exports.popupMenu = popupMenu; +exports.clickTestElement = clickTestElement;