adds presentation upload notification

This commit is contained in:
Mohamed Amine Ben Salah 2020-03-19 14:01:55 -03:00
parent 1b7853b0ea
commit 475c441855
6 changed files with 54 additions and 8 deletions

View File

@ -683,7 +683,7 @@ class PresentationUploader extends Component {
disablepreview="true"
onDrop={this.handleFiledrop}
>
<Icon className={styles.dropzoneIcon} iconName="upload" />
<Icon className={styles.dropzoneIcon} data-test="dropZone" iconName="upload" />
<p className={styles.dropzoneMessage}>
{intl.formatMessage(intlMessages.dropzoneLabel)}
&nbsp;

View File

@ -6,7 +6,6 @@ exports.echoYes = 'button[aria-label="Echo is audible"]';
exports.title = '._imports_ui_components_nav_bar__styles__presentationTitle';
exports.alerts = '.toastify-content';
exports.isTalking = '[data-test="isTalking"]';
exports.wasTalking = '[data-test="wasTalking"]';
exports.joinAudio = 'button[aria-label="Join Audio"]';

View File

@ -58,4 +58,18 @@ describe('Notifications', () => {
}
expect(response).toBe('User4 joined the session');
});
test('Presentation upload notification', async () => {
const test = new Notifications();
let response;
try {
await test.initUser3();
response = await test.fileUploaderNotification();
} catch (e) {
console.log(e);
} finally {
await test.closePage3();
}
expect(response).toContain('Current presentation');
});
});

View File

@ -10,4 +10,8 @@ exports.privateChatToast = 'New Private Chat message';
exports.userListNotifiedIcon = '[class^=btnWithNotificationDot]';
exports.hasUnreadMessages = 'button[data-test="hasUnreadMessages"]';
exports.modalConfirmButton = 'button[data-test="modalConfirmButton"]';
exports.userJoinPushAlerts = '[data-test="userJoinPushAlerts"]';
exports.uploadPresentation = '[data-test="uploadPresentation"]';
exports.dropdownContent = '[data-test="dropdownContent"]';
exports.dropZone = '[data-test="dropZone"]';

View File

@ -3,6 +3,7 @@ const util = require('./util');
const MultiUsers = require('../user/multiusers');
const params = require('../params');
const ne = require('./elements');
const we = require('../whiteboard/elements');
class Notifications extends MultiUsers {
constructor() {
@ -71,10 +72,26 @@ class Notifications extends MultiUsers {
return response;
}
// File upload notification
async fileUploaderNotification() {
await util.uploadFileMenu(this.page3);
await this.page3.waitForSelector(ne.dropZone);
const inputUploadHandle = await this.page3.page.$('input[type=file]');
await inputUploadHandle.uploadFile(process.env.PDF_FILE);
await this.page3.page.evaluate(util.clickTestElement, ne.modalConfirmButton);
const resp = await util.getLastToastValue(this.page3);
await this.page3.waitForSelector(we.whiteboard);
return resp;
}
async closePages() {
await this.page3.close();
await this.page4.close();
}
async closePage3() {
await this.page3.close();
}
}
module.exports = exports = Notifications;

View File

@ -1,7 +1,7 @@
const e = require('../core/elements');
const ne = require('../notifications/elements');
const ce = require('../chat/elements');
const ule = require('../user/elements');
const ce = require('../chat/elements');
const e = require('../core/elements');
async function clickTestElement(element) {
await document.querySelectorAll(element)[0].click();
@ -55,8 +55,7 @@ async function getTestElement(element) {
await document.querySelectorAll(element)[1];
}
async function clickOnTheOtherUser(element) {
async function clickOnElement(element) {
await document.querySelectorAll(element)[0].click();
}
@ -66,7 +65,7 @@ async function clickThePrivateChatButton(element) {
async function publicChatMessageToast(page1, page2) {
// Open private Chat with the other User
await page1.page.evaluate(clickOnTheOtherUser, ule.userListItem);
await page1.page.evaluate(clickOnElement, ule.userListItem);
await page1.page.evaluate(clickThePrivateChatButton, ce.activeChat);
// send a public message
await page2.page.type(ce.publicChat, ce.publicMessage1);
@ -76,7 +75,7 @@ async function publicChatMessageToast(page1, page2) {
async function privateChatMessageToast(page2) {
// Open private Chat with the other User
await page2.page.evaluate(clickOnTheOtherUser, ule.userListItem);
await page2.page.evaluate(clickOnElement, ule.userListItem);
await page2.page.evaluate(clickThePrivateChatButton, ce.activeChat);
// send a private message
await page2.page.type(ce.privateChat, ce.message1);
@ -84,13 +83,26 @@ async function privateChatMessageToast(page2) {
return ne.privateChatToast;
}
// File upload notification
async function uploadFileMenu(test) {
await test.page.evaluate(clickOnElement, ne.dropdownContent);
await test.page.evaluate(clickOnElement, ne.uploadPresentation);
}
async function getFileItemStatus(element, value) {
document.querySelectorAll(element)[1].innerText.includes(value);
}
exports.getFileItemStatus = getFileItemStatus;
exports.privateChatMessageToast = privateChatMessageToast;
exports.publicChatMessageToast = publicChatMessageToast;
exports.enableUserJoinPopup = enableUserJoinPopup;
exports.getOtherToastValue = getOtherToastValue;
exports.getLastToastValue = getLastToastValue;
exports.enableChatPopup = enableChatPopup;
exports.uploadFileMenu = uploadFileMenu;
exports.getTestElement = getTestElement;
exports.saveSettings = saveSettings;
exports.waitForToast = waitForToast;
exports.popupMenu = popupMenu;
exports.clickTestElement = clickTestElement;