add Presentation test: Start external video

This commit is contained in:
Anton 2021-10-28 15:37:56 -03:00
parent ff338c0198
commit f020c0da9d
5 changed files with 70 additions and 3 deletions

View File

@ -103,7 +103,7 @@ class ExternalVideoModal extends Component {
contentLabel={intl.formatMessage(intlMessages.title)}
hideBorder
>
<header data-test="videoModealHeader" className={styles.header}>
<header data-test="videoModalHeader" className={styles.header}>
<h3 className={styles.title}>{intl.formatMessage(intlMessages.title)}</h3>
</header>

View File

@ -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"]';

View File

@ -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,

View File

@ -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;

View File

@ -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;