diff --git a/tests/pageobjects/main-content.page.js b/tests/pageobjects/main-content.page.js index 757b01726df..d126718c329 100644 --- a/tests/pageobjects/main-content.page.js +++ b/tests/pageobjects/main-content.page.js @@ -7,10 +7,16 @@ class MainContent extends Page { get emptyFavoriteStar() { return browser.element('.toggle-favorite .icon-star-empty'); } get favoriteStar() { return browser.element('.toggle-favorite .favorite-room'); } get fileAttachmentBtn() { return browser.element('.message-buttons .icon-attach'); } + get fileAttachment() { return browser.element('.message-buttons input[type="file"]'); } get recordBtn() { return browser.element('.message-buttons .icon-mic'); } get videoCamBtn() { return browser.element('.message-buttons .icon-videocam'); } get emojiBtn() { return browser.element('.inner-left-toolbar .emoji-picker-icon'); } get channelTitle() { return browser.element('.room-title'); } + get popupFileConfirmBtn() { return browser.element('.sa-confirm-button-container .confirm'); } + get popupFilePreview() { return browser.element('.upload-preview-file'); } + get popupFileTitle() { return browser.element('.upload-preview-title'); } + get popupFileTitle() { return browser.element('.upload-preview-title'); } + get popupFileCancelBtn() { return browser.element('.sa-button-container .cancel'); } sendMessage(text) { this.messageInput.setValue(text); @@ -24,6 +30,12 @@ class MainContent extends Page { this.messageInput.waitForVisible(5000); this.messageInput.setValue(text); } + + fileUpload(filePath) { + this.sendMessage('Prepare for the file'); + this.fileAttachment.chooseFile(filePath); + browser.pause(1000); + } } module.exports = new MainContent(); \ No newline at end of file diff --git a/tests/steps/basic-usage.js b/tests/steps/basic-usage.js index c9d39dcd47c..d656d07829d 100644 --- a/tests/steps/basic-usage.js +++ b/tests/steps/basic-usage.js @@ -157,6 +157,7 @@ describe('Basic usage', function() { it('send a message', () => { mainContent.sendMessage(message); }); + describe('main content usage', () => { describe('render', () => { it('should show the title of the channel', () => { @@ -176,7 +177,7 @@ describe('Basic usage', function() { }); it('clicks the star', () => { - mainContent.emptyFavoriteStar.click(); + mainContent.favoriteStar.click(); }); it('should show the message input bar', () => { @@ -223,6 +224,36 @@ describe('Basic usage', function() { mainContent.videoCamBtn.isVisible().should.be.false; }); }); + describe('fileUpload', ()=> { + it('send a attachment', () => { + mainContent.fileUpload('/home/martin/Downloads/cat.jpg'); + }); + + it('should show the confirm button', () => { + mainContent.popupFileConfirmBtn.isVisible().should.be.true; + }); + + it('should show the cancel buttno', () => { + mainContent.popupFileCancelBtn.isVisible().should.be.true; + }); + + it('should show the file preview', () => { + mainContent.popupFilePreview.isVisible().should.be.true; + }); + + it('should show the confirm buttno', () => { + mainContent.popupFileConfirmBtn.isVisible().should.be.true; + }); + + it('should show the file title', () => { + mainContent.popupFileTitle.isVisible().should.be.true; + }); + + it('click the confirm', () => { + mainContent.popupFileConfirmBtn.click(); + }); + + }); }); }); @@ -389,3 +420,6 @@ describe('Basic usage', function() { }); }); }); + + +