diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx index ec7b1acb777ebbf2dc3db36de4fb40ea4412ce62..c89a30a828c511e4b3cbe7dd71302c731300d6e2 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx @@ -128,6 +128,7 @@ class ActionsDropdown extends PureComponent { ? ( <DropdownListItem icon="polling" + data-test="polling" label={formatMessage(pollBtnLabel)} description={formatMessage(pollBtnDesc)} key={this.pollId} diff --git a/bigbluebutton-html5/imports/ui/components/poll/component.jsx b/bigbluebutton-html5/imports/ui/components/poll/component.jsx index ff61eb4f92109e2cf3459becd7354b9cc19d058b..3efbc9a188ab83d1948f34f4842a69258fedcfc2 100644 --- a/bigbluebutton-html5/imports/ui/components/poll/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/poll/component.jsx @@ -174,6 +174,7 @@ class Poll extends Component { label={label} color="default" className={styles.pollBtn} + data-test="pollBtn" key={_.uniqueId('quick-poll-')} onClick={() => { Session.set('pollInitiated', true); @@ -338,6 +339,7 @@ class Poll extends Component { <header className={styles.header}> <Button ref={(node) => { this.hideBtn = node; }} + data-test="hidePollDesc" tabIndex={0} label={intl.formatMessage(intlMessages.pollPaneTitle)} icon="left_arrow" diff --git a/bigbluebutton-html5/imports/ui/components/poll/live-result/component.jsx b/bigbluebutton-html5/imports/ui/components/poll/live-result/component.jsx index 5556b4873dd3a05f95c4c3811132750815e5e263..1ce68a8d1993aa351f2486bd7b27b35743bbf3b9 100644 --- a/bigbluebutton-html5/imports/ui/components/poll/live-result/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/poll/live-result/component.jsx @@ -206,6 +206,7 @@ class LiveResult extends PureComponent { stopPoll(); }} label={intl.formatMessage(intlMessages.publishLabel)} + data-test="publishLabel" color="primary" className={styles.btn} /> diff --git a/bigbluebutton-html5/tests/puppeteer/notifications.test.js b/bigbluebutton-html5/tests/puppeteer/notifications.test.js index 97e397d6c078d438deb2106c35957f5422012391..a2a20b4b40dd51d6fd87aed633fa7ffed03ea63f 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications.test.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications.test.js @@ -72,4 +72,18 @@ describe('Notifications', () => { } expect(response).toContain('Current presentation'); }); + + test('Poll results notification', async () => { + const test = new Notifications(); + let response; + try { + await test.initUser3(); + response = await test.publishPollResults(); + } catch (e) { + console.log(e); + } finally { + await test.closePage3(); + } + expect(response).toContain('Poll results were published to Public Chat and Whiteboard'); + }); }); diff --git a/bigbluebutton-html5/tests/puppeteer/notifications/elements.js b/bigbluebutton-html5/tests/puppeteer/notifications/elements.js index 3417621f4655f2594a8a3026d3febe75fce177dc..1bc0dab8cce6946b237e2192a48196ff94b9b45d 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications/elements.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications/elements.js @@ -15,3 +15,7 @@ exports.userJoinPushAlerts = '[data-test="userJoinPushAlerts"]'; exports.uploadPresentation = '[data-test="uploadPresentation"]'; exports.dropdownContent = '[data-test="dropdownContent"]'; exports.fileUploadDropZone = '[data-test="fileUploadDropZone"]'; +exports.polling = '[data-test="polling"]'; +exports.hidePollDesc = '[data-test="hidePollDesc"]'; +exports.pollBtn = '[data-test="pollBtn"]'; +exports.publishLabel = '[data-test="publishLabel"]'; diff --git a/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js b/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js index ebabaf967c7b81d1158e0c186a00e9d0c655d389..3100bbc21aa2360f5f2a70de5a012bc255e55f8d 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications/notifications.js @@ -84,6 +84,14 @@ class Notifications extends MultiUsers { return resp; } + async publishPollResults() { + await this.page3.waitForSelector(we.whiteboard); + await util.startPoll(this.page3); + await this.page3.waitForSelector(ne.smallToastMsg); + const resp = await util.getLastToastValue(this.page3); + return resp; + } + async closePage3and4() { await this.page3.close(); await this.page4.close(); diff --git a/bigbluebutton-html5/tests/puppeteer/notifications/util.js b/bigbluebutton-html5/tests/puppeteer/notifications/util.js index 9f95c2a78ed55d6b61a6aa57fc8eb6afc7e1b0ec..fdb4f39809be0be129e756415f8c99527a9043fd 100644 --- a/bigbluebutton-html5/tests/puppeteer/notifications/util.js +++ b/bigbluebutton-html5/tests/puppeteer/notifications/util.js @@ -93,6 +93,21 @@ async function getFileItemStatus(element, value) { document.querySelectorAll(element)[1].innerText.includes(value); } +async function clickRandomPollOption(element) { + document.querySelector(element).click(); +} + +async function startPoll(test) { + await test.page.evaluate(clickOnElement, ne.dropdownContent); + await test.page.evaluate(clickOnElement, ne.polling); + await test.waitForSelector(ne.hidePollDesc); + await test.waitForSelector(ne.pollBtn); + await test.page.evaluate(clickRandomPollOption, ne.pollBtn); + await test.waitForSelector(ne.publishLabel); + await test.page.evaluate(clickOnElement, ne.publishLabel); + await test.waitForSelector(ne.smallToastMsg); +} + exports.getFileItemStatus = getFileItemStatus; exports.privateChatMessageToast = privateChatMessageToast; exports.publicChatMessageToast = publicChatMessageToast; @@ -106,3 +121,5 @@ exports.saveSettings = saveSettings; exports.waitForToast = waitForToast; exports.popupMenu = popupMenu; exports.clickTestElement = clickTestElement; +exports.startPoll = startPoll; +exports.clickOnElement = clickOnElement;