From f020c0da9dab0de09b1d4ae9b6fe7bce19f40fe8 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 28 Oct 2021 15:37:56 -0300 Subject: [PATCH] add Presentation test: Start external video --- .../external-video-player/modal/component.jsx | 2 +- .../puppeteer/core/elements.js | 9 +++++ bigbluebutton-tests/puppeteer/core/page.js | 1 + .../puppeteer/presentation/presentation.js | 38 ++++++++++++++++++- .../presentation/presentation.obj.js | 23 +++++++++++ 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx index 502c23f78e..51b5a93f47 100644 --- a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx @@ -103,7 +103,7 @@ class ExternalVideoModal extends Component { contentLabel={intl.formatMessage(intlMessages.title)} hideBorder > -
+

{intl.formatMessage(intlMessages.title)}

diff --git a/bigbluebutton-tests/puppeteer/core/elements.js b/bigbluebutton-tests/puppeteer/core/elements.js index c9d99a79e7..db63381f9c 100644 --- a/bigbluebutton-tests/puppeteer/core/elements.js +++ b/bigbluebutton-tests/puppeteer/core/elements.js @@ -175,6 +175,15 @@ exports.allowPresentationDownload = 'button[data-test="allowPresentationDownload exports.disallowPresentationDownload = 'button[data-test="disallowPresentationDownload"]'; exports.uploadPresentationFileName = 'uploadTest.png'; exports.presentationContainer = 'div[class^="presentationContainer--"]'; +exports.externalVideoBtn = 'li[data-test="external-video"]'; +exports.externalVideoModalHeader = 'header[data-test="videoModalHeader"]'; +exports.videoModalInput = 'input[id="video-modal-input"]'; +exports.startShareVideoBtn = 'button[aria-label="Share a new video"]'; +exports.videoPlayer = 'div[data-test="videoPlayer"]'; +// YouTube frame +exports.youtubeLink = 'https://www.youtube.com/watch?v=Hso8yLzkqj8&ab_channel=BigBlueButton'; +exports.youtubeFrame = 'iframe[title^="YouTube"]'; +exports.ytFrameTitle = 'a[class^="ytp-title-link"]'; // User exports.firstUser = '[data-test="userListItemCurrent"]'; diff --git a/bigbluebutton-tests/puppeteer/core/page.js b/bigbluebutton-tests/puppeteer/core/page.js index 7647fb59b7..08c8f01fe2 100644 --- a/bigbluebutton-tests/puppeteer/core/page.js +++ b/bigbluebutton-tests/puppeteer/core/page.js @@ -202,6 +202,7 @@ class Page { '--window-size=1150,980', '--allow-file-access', '--lang=en-US', + '--disable-features=IsolateOrigins,site-per-process', ]; return { headless: false, diff --git a/bigbluebutton-tests/puppeteer/presentation/presentation.js b/bigbluebutton-tests/puppeteer/presentation/presentation.js index d83d9e03d7..bd1d3b933e 100644 --- a/bigbluebutton-tests/puppeteer/presentation/presentation.js +++ b/bigbluebutton-tests/puppeteer/presentation/presentation.js @@ -1,8 +1,8 @@ const Page = require('../core/page'); const e = require('../core/elements'); const util = require('./util'); -const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require('../core/constants'); -const { checkElement, checkElementTextIncludes, checkElementText } = require('../core/util'); +const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); +const { checkElement, checkElementText } = require('../core/util'); class Presentation { constructor() { @@ -148,6 +148,40 @@ class Presentation { return false; } } + + async startExternalVideo(testName) { + try { + await this.modPage.waitForSelector(e.whiteboard); + await this.modPage.screenshot(testName, '01-after-close-audio-modal'); + await this.modPage.waitAndClick(e.actions); + await this.modPage.waitAndClick(e.externalVideoBtn); + await this.modPage.waitForSelector(e.externalVideoModalHeader); + await this.modPage.type(e.videoModalInput, e.youtubeLink); + await this.modPage.screenshot(testName, '02-before-start-sharing-video'); + await this.modPage.waitAndClick(e.startShareVideoBtn); + + const modFrame = await this.getFrame(this.modPage, e.youtubeFrame); + await this.modPage.screenshot(testName, '03-modPage-after-rendering-frame'); + const userFrame = await this.getFrame(this.userPage, e.youtubeFrame); + await this.userPage.screenshot(testName, '03-userPage-after-rendering-frame'); + + const resp = (await modFrame.hasElement('video')) && (await userFrame.hasElement('video')); + + return resp === true; + } catch (err) { + await this.modPage.logger(err); + return false; + } + } + + async getFrame(page, frameSelector) { + await page.waitForSelector(frameSelector); + const handleFrame = await page.page.$(frameSelector); + const contentFrame = await handleFrame.contentFrame(); + const frame = new Page(contentFrame); + await frame.waitForSelector(e.ytFrameTitle); + return frame; + } } module.exports = exports = Presentation; \ No newline at end of file diff --git a/bigbluebutton-tests/puppeteer/presentation/presentation.obj.js b/bigbluebutton-tests/puppeteer/presentation/presentation.obj.js index 408a026cb7..7b8ef5ef16 100644 --- a/bigbluebutton-tests/puppeteer/presentation/presentation.obj.js +++ b/bigbluebutton-tests/puppeteer/presentation/presentation.obj.js @@ -120,5 +120,28 @@ const presentationTest = () => { expect(response).toBe(true); Page.checkRegression(24.62, screenshot); }); + + test('Start external video', async () => { + const test = new Presentation(); + let response; + let screenshot; + try { + const testName = 'startExternalVideo'; + await test.modPage.logger('begin of ', testName); + await test.initPages(testName); + await test.modPage.startRecording(testName); + response = await test.startExternalVideo(testName); + await test.modPage.stopRecording(); + screenshot = await test.modPage.page.screenshot(); + await test.modPage.logger('end of ', testName); + } catch (e) { + await test.modPage.logger(e); + } finally { + await closePages(test.modPage, test.userPage); + } + expect(response).toBe(true); + Page.checkRegression(24.62, screenshot); + }); }; + module.exports = exports = presentationTest;