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
ref={(ref) => setPresentationRef(ref)}
className={styles.presentationPlaceholder}
data-test="presentationPlaceholder"
style={{
top,
left,

View File

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

View File

@ -21,7 +21,7 @@ const presentationTest = () => {
await test.modPage.startRecording(testName);
response = await test.skipSlide();
await test.modPage.stopRecording(testName);
screenshot = await test.modPage.screenshot();
screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName);
} catch (err) {
await test.modPage.logger(err);
@ -43,7 +43,7 @@ const presentationTest = () => {
await test.modPage.startRecording(testName);
response = await test.uploadPresentation(testName);
await test.modPage.stopRecording();
screenshot = await test.modPage.screenshot();
screenshot = await test.modPage.page.screenshot();
await test.modPage.logger('end of ', testName);
} catch (err) {
await test.modPage.logger(err);
@ -65,7 +65,29 @@ const presentationTest = () => {
await test.modPage.startRecording(testName);
response = await test.allowAndDisallowDownload(testName);
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);
} catch (e) {
await test.modPage.logger(e);

View File

@ -4,5 +4,8 @@ exports.prevSlide = '[data-test="prevSlide"]';
exports.fileUpload = 'input[type="file"]';
exports.upload = 'button[aria-label="Upload"]';
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"]';

View File

@ -6,7 +6,7 @@ const we = require('../whiteboard/elements');
const params = require('../params');
const util = require('./util');
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 {
constructor() {
@ -136,7 +136,28 @@ class Presentation {
return hasPresentationDownloadBtnAfterAllow && !hasPresentationDownloadBtnAfterDisallow;
} 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;
}
}