add remove all presentation test

This commit is contained in:
Anton Barboza 2021-09-08 14:18:01 -03:00
parent b4d4b9f50b
commit 34369b8897
5 changed files with 54 additions and 6 deletions

View File

@ -23,6 +23,7 @@ const PresentationPlaceholder = ({
<div <div
ref={(ref) => setPresentationRef(ref)} ref={(ref) => setPresentationRef(ref)}
className={styles.presentationPlaceholder} className={styles.presentationPlaceholder}
data-test="presentationPlaceholder"
style={{ style={{
top, top,
left, left,

View File

@ -808,6 +808,7 @@ class PresentationUploader extends Component {
disabled={disableActions} disabled={disableActions}
className={cx(styles.itemAction, styles.itemActionRemove)} className={cx(styles.itemAction, styles.itemActionRemove)}
label={intl.formatMessage(intlMessages.removePresentation)} label={intl.formatMessage(intlMessages.removePresentation)}
data-test="removePresentation"
aria-label={`${intl.formatMessage(intlMessages.removePresentation)} ${item.filename}`} aria-label={`${intl.formatMessage(intlMessages.removePresentation)} ${item.filename}`}
size="sm" size="sm"
icon="delete" icon="delete"

View File

@ -21,7 +21,7 @@ const presentationTest = () => {
await test.modPage.startRecording(testName); await test.modPage.startRecording(testName);
response = await test.skipSlide(); response = await test.skipSlide();
await test.modPage.stopRecording(testName); await test.modPage.stopRecording(testName);
screenshot = await test.modPage.screenshot(); screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName); await test.modPage.logger('end of ', testName);
} catch (err) { } catch (err) {
await test.modPage.logger(err); await test.modPage.logger(err);
@ -43,7 +43,7 @@ const presentationTest = () => {
await test.modPage.startRecording(testName); await test.modPage.startRecording(testName);
response = await test.uploadPresentation(testName); response = await test.uploadPresentation(testName);
await test.modPage.stopRecording(); await test.modPage.stopRecording();
screenshot = await test.modPage.screenshot(); screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName); await test.modPage.logger('end of ', testName);
} catch (err) { } catch (err) {
await test.modPage.logger(err); await test.modPage.logger(err);
@ -65,7 +65,29 @@ const presentationTest = () => {
await test.modPage.startRecording(testName); await test.modPage.startRecording(testName);
response = await test.allowAndDisallowDownload(testName); response = await test.allowAndDisallowDownload(testName);
await test.modPage.stopRecording(); await test.modPage.stopRecording();
screenshot = await test.modPage.screenshot(); screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName);
} catch (e) {
await test.modPage.logger(e);
} finally {
await test.closePages();
}
expect(response).toBe(true);
await Page.checkRegression(24.62, screenshot);
});
test.only('Remove all presentation', async () => {
const test = new Presentation();
let response;
let screenshot;
try {
const testName = 'removeAllPresentation';
await test.modPage.logger('begin of ', testName);
await test.initPages(testName);
await test.modPage.startRecording(testName);
response = await test.removeAllPresentation(testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName); await test.modPage.logger('end of ', testName);
} catch (e) { } catch (e) {
await test.modPage.logger(e); await test.modPage.logger(e);

View File

@ -4,5 +4,8 @@ exports.prevSlide = '[data-test="prevSlide"]';
exports.fileUpload = 'input[type="file"]'; exports.fileUpload = 'input[type="file"]';
exports.upload = 'button[aria-label="Upload"]'; exports.upload = 'button[aria-label="Upload"]';
exports.cancel = 'button[aria-label="Cancel]'; exports.cancel = 'button[aria-label="Cancel]';
exports.uploadPresentation = '[data-test="uploadPresentation"]'; exports.uploadPresentation = 'li[data-test="uploadPresentation"]';
exports.removePresentation = 'button[data-test="removePresentation"]';
exports.presentationPlaceholder = 'div[data-test="presentationPlaceholder"]';
exports.presentationPlaceholderLabel = 'Waiting for a presentation to be uploaded';
exports.skipSlide = '[data-test="skipSlide"]'; exports.skipSlide = '[data-test="skipSlide"]';

View File

@ -6,7 +6,7 @@ const we = require('../whiteboard/elements');
const params = require('../params'); const params = require('../params');
const util = require('./util'); const util = require('./util');
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require('../core/constants'); const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require('../core/constants');
const { checkElement, checkElementTextIncludes } = require('../core/util'); const { checkElement, checkElementTextIncludes, checkElementText } = require('../core/util');
class Presentation { class Presentation {
constructor() { constructor() {
@ -136,7 +136,28 @@ class Presentation {
return hasPresentationDownloadBtnAfterAllow && !hasPresentationDownloadBtnAfterDisallow; return hasPresentationDownloadBtnAfterAllow && !hasPresentationDownloadBtnAfterDisallow;
} catch (err) { } catch (err) {
this.modPage.logger(err); await this.modPage.logger(err);
return false;
}
}
async removeAllPresentation(testName) {
try {
await this.modPage.waitForSelector(we.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.click(ce.actions);
await this.modPage.click(e.uploadPresentation);
await this.modPage.screenshot(testName, `1-modPage-before-remove-download-[${this.modPage.meetingId}]`);
await this.modPage.click(e.removePresentation);
await this.modPage.click(ce.confirmManagePresentation);
await this.modPage.waitForSelector(ce.actions, ELEMENT_WAIT_TIME);
await this.modPage.screenshot(testName, `2-modPage-after-remove-download-[${this.modPage.meetingId}]`);
await this.userPage.screenshot(testName, `3-userPage-after-remove-download-[${this.modPage.meetingId}]`);
const modPagePlaceholder = await this.modPage.page.evaluate(checkElementText, e.presentationPlaceholder, e.presentationPlaceholderLabel);
const userPagePlaceholder = await this.userPage.page.evaluate(checkElementText, e.presentationPlaceholder, e.presentationPlaceholderLabel);
return modPagePlaceholder && userPagePlaceholder;
} catch (err) {
await this.modPage.logger(err);
return false; return false;
} }
} }