diff --git a/cspell.json b/cspell.json index 615efac64..44d75942e 100644 --- a/cspell.json +++ b/cspell.json @@ -62,7 +62,8 @@ "keycodes", "denysvuika", "submenu", - "submenus" + "submenus", + "dateitem" ], "dictionaries": ["html", "en-gb", "en_US"] } diff --git a/e2e/components/info-drawer/info-drawer-comments-tab.ts b/e2e/components/info-drawer/info-drawer-comments-tab.ts new file mode 100755 index 000000000..70dbb3688 --- /dev/null +++ b/e2e/components/info-drawer/info-drawer-comments-tab.ts @@ -0,0 +1,140 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2019 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, until } from 'protractor'; +import { Component } from '../component'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; + +export class CommentsTab extends Component { + private static selectors = { + root: 'adf-comments', + + commentsContainer: '.adf-comments-container', + commentsHeader: '.adf-comments-header', + commentsTextArea: '.adf-comments-input-container textarea', + addCommentButton: 'button.adf-comments-input-add', + commentsList: '.adf-comment-list', + commentsListItem: '.adf-comment-list-item', + commentById: `adf-comment-`, + commentUserName: 'comment-user', + commentUserAvatar: 'comment-user-icon', + commentMessage: 'comment-message', + commentTime: 'comment-time' + }; + + commentsContainer: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsContainer)); + commentsHeader: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsHeader)); + commentTextarea: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsTextArea)); + addCommentButton: ElementFinder = this.component.element(by.css(CommentsTab.selectors.addCommentButton)); + commentsList: ElementArrayFinder = this.component.all(by.css(CommentsTab.selectors.commentsListItem)); + + commentListItem = by.css(CommentsTab.selectors.commentsListItem); + + commentUserAvatar = by.id(CommentsTab.selectors.commentUserAvatar); + commentUser = by.id(CommentsTab.selectors.commentUserName) + commentText = by.id(CommentsTab.selectors.commentMessage); + commentTime = by.id(CommentsTab.selectors.commentTime); + + + constructor(ancestor?: ElementFinder) { + super(CommentsTab.selectors.root, ancestor); + } + + async waitForCommentsContainer() { + await browser.wait(EC.visibilityOf(this.commentsContainer), BROWSER_WAIT_TIMEOUT); + } + + async getCommentsTabHeaderText() { + return await this.commentsHeader.getText(); + } + + async isCommentTextAreaDisplayed() { + return await browser.isElementPresent(this.commentTextarea); + } + + async isAddCommentButtonEnabled() { + const present = await browser.isElementPresent(this.addCommentButton); + if (present) { + return await this.addCommentButton.isEnabled(); + } + return false; + } + + async getCommentListItem() { + return await browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2); + } + + async getCommentById(commentId?: string) { + if (commentId) { + return await browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2); + } + return await this.getCommentListItem(); + } + + async isCommentDisplayed(commentId?: string) { + return await browser.isElementPresent(await this.getCommentById(commentId)); + } + + async isCommentUserAvatarDisplayed(commentId?: string) { + const commentElement = await this.getCommentById(commentId); + return await browser.isElementPresent(commentElement.findElement(this.commentUserAvatar)); + } + + async getCommentText(commentId?: string) { + const commentElement = await this.getCommentById(commentId); + const message = await commentElement.findElement(this.commentText); + return await message.getText(); + } + + async getCommentUserName(commentId?: string) { + const commentElement = await this.getCommentById(commentId); + const user = await commentElement.findElement(this.commentUser); + return await user.getText(); + } + + async getCommentTime(commentId?: string) { + const commentElement = await this.getCommentById(commentId); + const time = await commentElement.findElement(this.commentTime); + return await time.getText(); + } + + async getNthCommentId(index: number) { + return await this.commentsList.get(index - 1).getAttribute('id'); + } + + async typeComment(text: string) { + return await this.commentTextarea.sendKeys(text); + } + + async clickAddButton() { + return await this.addCommentButton.click(); + } + + async getCommentTextFromTextArea() { + return await this.commentTextarea.getAttribute('value'); + } + +} + diff --git a/e2e/components/info-drawer/info-drawer-metadata-content.ts b/e2e/components/info-drawer/info-drawer-metadata-content.ts new file mode 100755 index 000000000..6fcb52dbb --- /dev/null +++ b/e2e/components/info-drawer/info-drawer-metadata-content.ts @@ -0,0 +1,125 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2019 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { Component } from '../component'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; + +export class ContentMetadata extends Component { + private static selectors = { + root: 'adf-content-metadata-card', + + expandedPanel: '.mat-expansion-panel.mat-expanded', + propertyList: '.adf-property-list', + property: '.adf-property', + propertyLabel: '.adf-property-label', + propertyValue: '.adf-property-value', + editProperties: `button[title='Edit']`, + editProperty: `.mat-icon[title='Edit']`, + editDateItem: `.adf-dateitem-editable`, + moreLessInformation: `[data-automation-id='meta-data-card-toggle-expand']` + }; + + expandedPanel: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.expandedPanel)); + propertyList: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyList)); + propertyListElements: ElementArrayFinder = this.component.all(by.css(ContentMetadata.selectors.property)); + propertyValue: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyValue)); + editPropertiesButton: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.editProperties)); + lessInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'Less information')); + moreInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'More information')); + + imagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`)); + expandedImagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`)); + + constructor(ancestor?: ElementFinder) { + super(ContentMetadata.selectors.root, ancestor); + } + + async isPropertiesListExpanded() { + return await browser.isElementPresent(this.expandedPanel); + } + + async waitForImagePropertiesPanelToExpand() { + return await browser.wait(EC.visibilityOf(this.expandedImagePropertiesPanel), BROWSER_WAIT_TIMEOUT); + } + + async getVisiblePropertiesLabels() { + return await this.component.all(by.css(ContentMetadata.selectors.propertyLabel)) + .filter(async (elem) => await elem.isDisplayed()) + .map(async (elem) => await elem.getText()); + } + + async getVisiblePropertiesValues() { + return await this.component.all(by.css(ContentMetadata.selectors.propertyValue)) + .filter(async (elem) => await elem.isDisplayed()) + .map(async (elem) => { + if (await elem.isElementPresent(by.css('.mat-checkbox'))) { + if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) { + return true; + } + return false + } + return await elem.getText(); + }); + } + + async isEditPropertiesButtonEnabled() { + return (await browser.isElementPresent(this.editPropertiesButton)) && (await this.editPropertiesButton.isEnabled()); + } + + async isLessInfoButtonEnabled() { + return (await browser.isElementPresent(this.lessInfoButton)) && (await this.lessInfoButton.isEnabled()); + } + + async isMoreInfoButtonEnabled() { + return (await browser.isElementPresent(this.moreInfoButton)) && (await this.moreInfoButton.isEnabled()); + } + + async isLessInfoButtonDisplayed() { + return await browser.isElementPresent(this.lessInfoButton); + } + + async isMoreInfoButtonDisplayed() { + return await browser.isElementPresent(this.moreInfoButton); + } + + async clickLessInformationButton() { + return await this.lessInfoButton.click(); + } + + async clickMoreInformationButton() { + return await this.moreInfoButton.click(); + } + + async isImagePropertiesPanelDisplayed() { + return (await browser.isElementPresent(this.imagePropertiesPanel)) && (await this.imagePropertiesPanel.isDisplayed()); + } + + async clickImagePropertiesPanel() { + return await this.imagePropertiesPanel.click(); + } + +} + diff --git a/e2e/components/info-drawer/info-drawer-metadata-library.ts b/e2e/components/info-drawer/info-drawer-metadata-library.ts new file mode 100755 index 000000000..f5f2e7657 --- /dev/null +++ b/e2e/components/info-drawer/info-drawer-metadata-library.ts @@ -0,0 +1,254 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2019 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { Component } from '../component'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; + +export class LibraryMetadata extends Component { + private static selectors = { + root: 'app-library-metadata-form', + + metadataTabContent: '.mat-card-content', + metadataTabAction: '.mat-card-actions .mat-button', + field: '.mat-form-field', + fieldLabelWrapper: '.mat-form-field-label-wrapper', + fieldInput: '.mat-input-element', + dropDown: '.mat-select', + + visibilityOption: '.mat-option .mat-option-text', + + hint: '.mat-hint', + error: '.mat-error' + }; + + metadataTabContent: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabContent)); + metadataTabAction: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabAction)); + fieldLabelWrapper: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldLabelWrapper)); + fieldInput: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldInput)); + + visibilityDropDown: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.dropDown)); + visibilityPublic: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Public')); + visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Private')); + visibilityModerated: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Moderated')); + + hint: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.hint)); + error: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.error)); + + + constructor(ancestor?: ElementFinder) { + super(LibraryMetadata.selectors.root, ancestor); + } + + getLabelWrapper(label: string) { + return this.component.element(by.cssContainingText(LibraryMetadata.selectors.fieldLabelWrapper, label)); + } + + getFieldByName(fieldName: string) { + const wrapper = this.getLabelWrapper(fieldName); + return wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.fieldInput)); + } + + async isFieldDisplayed(fieldName: string) { + return await browser.isElementPresent(this.getFieldByName(fieldName)); + } + + async isInputEnabled(fieldName: string) { + return this.getFieldByName(fieldName).isEnabled(); + } + + async getValueOfField(fieldName: string) { + return await this.getFieldByName(fieldName).getText(); + } + + async enterTextInInput(fieldName: string, text: string) { + const input = this.getFieldByName(fieldName); + await input.clear(); + return await input.sendKeys(text); + } + + + getButton(button: string) { + return this.component.element(by.cssContainingText(LibraryMetadata.selectors.metadataTabAction, button)); + } + + async isButtonDisplayed(button: string) { + return browser.isElementPresent(this.getButton(button)); + } + + async isButtonEnabled(button: string) { + return await this.getButton(button).isEnabled(); + } + + async clickButton(button: string) { + return await this.getButton(button).click(); + } + + async waitForVisibilityDropDownToOpen() { + await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT); + } + + async waitForVisibilityDropDownToClose() { + await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT); + } + + async isMessageDisplayed() { + return await browser.isElementPresent(this.hint); + } + + async getMessage() { + return await this.hint.getText(); + } + + async isErrorDisplayed() { + return await browser.isElementPresent(this.error); + } + + async getError() { + return await this.error.getText(); + } + + + async isNameDisplayed() { + return await this.isFieldDisplayed('Name'); + } + + async isNameEnabled() { + return await this.isInputEnabled('Name'); + } + + async getName() { + return await this.getValueOfField('Name'); + } + + async enterName(name: string) { + return await this.enterTextInInput('Name', name); + } + + + async isDescriptionDisplayed() { + return await this.isFieldDisplayed('Description'); + } + + async isDescriptionEnabled() { + return await this.isInputEnabled('Description'); + } + + async getDescription() { + return await this.getValueOfField('Description'); + } + + async enterDescription(desc: string) { + return await this.enterTextInInput('Description', desc); + } + + + async isVisibilityEnabled() { + const wrapper = this.getLabelWrapper('Visibility'); + const field = wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.dropDown)); + return await field.isEnabled(); + } + + async isVisibilityDisplayed() { + return await this.isFieldDisplayed('Visibility'); + } + + async getVisibility() { + return await this.getValueOfField('Visibility'); + } + + async setVisibility(visibility: string) { + const val = visibility.toLowerCase(); + + await this.visibilityDropDown.click(); + await this.waitForVisibilityDropDownToOpen(); + + if (val === 'public') { + await this.visibilityPublic.click(); + } else if (val === 'private') { + await this.visibilityPrivate.click(); + } else if (val === 'moderated') { + await this.visibilityModerated.click(); + } else { + console.log('----- invalid visibility', val); + } + + await this.waitForVisibilityDropDownToClose(); + } + + + async isLibraryIdDisplayed() { + return await this.isFieldDisplayed('Library ID'); + } + + async isLibraryIdEnabled() { + return await this.isInputEnabled('Library ID'); + } + + async getLibraryId() { + return await this.getValueOfField('Library ID'); + } + + + async isEditLibraryPropertiesEnabled() { + return await this.isButtonEnabled('Edit'); + } + + async isEditLibraryPropertiesDisplayed() { + return await this.isButtonDisplayed('Edit'); + } + + async clickEditLibraryProperties() { + return await this.clickButton('Edit'); + } + + + async isUpdateEnabled() { + return await this.isButtonEnabled('Update'); + } + + async isUpdateDisplayed() { + return await this.isButtonDisplayed('Update'); + } + + async clickUpdate() { + return await this.clickButton('Update'); + } + + + async isCancelEnabled() { + return await this.isButtonEnabled('Cancel'); + } + + async isCancelDisplayed() { + return await this.isButtonDisplayed('Cancel'); + } + + async clickCancel() { + return await this.clickButton('Cancel'); + } + +} + diff --git a/e2e/components/info-drawer/info-drawer.ts b/e2e/components/info-drawer/info-drawer.ts index b366ff435..46d8371a4 100755 --- a/e2e/components/info-drawer/info-drawer.ts +++ b/e2e/components/info-drawer/info-drawer.ts @@ -23,13 +23,16 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, until } from 'protractor'; +import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, $ } from 'protractor'; import { Component } from '../component'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { CommentsTab } from './info-drawer-comments-tab'; +import { LibraryMetadata } from './info-drawer-metadata-library'; +import { ContentMetadata } from './info-drawer-metadata-content'; export class InfoDrawer extends Component { private static selectors = { - root: 'aca-info-drawer', + root: 'adf-info-drawer', header: '.adf-info-drawer-layout-header', content: '.adf-info-drawer-layout-content', @@ -42,34 +45,13 @@ export class InfoDrawer extends Component { next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron', previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron', - headerTitle: '.adf-info-drawer-layout-header-title', - - // comments tab - commentsContainer: '.adf-comments-container', - commentsHeader: '.adf-comments-header', - commentsTextArea: '.adf-comments-input-container textarea', - addCommentButton: 'button.adf-comments-input-add', - commentsList: '.adf-comment-list', - commentsListItem: '.adf-comment-list-item', - commentById: `adf-comment-`, - commentUserName: 'comment-user', - commentUserAvatar: 'comment-user-icon', - commentMessage: 'comment-message', - commentTime: 'comment-time', - - // metadata card - metadataTabContent: '.app-metadata-tab .mat-card-content', - metadataTabAction: '.app-metadata-tab .mat-card-actions .mat-button', - field: '.mat-form-field', - fieldLabelWrapper: '.mat-form-field-label-wrapper', - fieldInput: '.mat-input-element', - dropDown: '.mat-select', - visibilityOption: '.mat-option .mat-option-text', - - hint: '.mat-hint', - error: '.mat-error' + headerTitle: '.adf-info-drawer-layout-header-title' }; + commentsTab = new CommentsTab($(InfoDrawer.selectors.root)); + aboutTab = new LibraryMetadata($(InfoDrawer.selectors.root)); + propertiesTab = new ContentMetadata($(InfoDrawer.selectors.root)); + header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header)); headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle)); tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel)); @@ -78,40 +60,14 @@ export class InfoDrawer extends Component { tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent)); - commentsContainer: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.commentsContainer)); - commentsHeader: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.commentsHeader)); - commentTextarea: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.commentsTextArea)); - addCommentButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.addCommentButton)); - commentsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.commentsListItem)); - - commentListItem = by.css(InfoDrawer.selectors.commentsListItem); - - commentUserAvatar = by.id(InfoDrawer.selectors.commentUserAvatar); - commentUser = by.id(InfoDrawer.selectors.commentUserName) - commentText = by.id(InfoDrawer.selectors.commentMessage); - commentTime = by.id(InfoDrawer.selectors.commentTime); - nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next)); previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous)); - metadataTabContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.metadataTabContent)); - metadataTabAction: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.metadataTabAction)); - fieldLabelWrapper: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.fieldLabelWrapper)); - fieldInput: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.fieldInput)); - - visibilityDropDown: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.dropDown)); - visibilityPublic: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Public')); - visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Private')); - visibilityModerated: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Moderated')); - - hint: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.hint)); - error: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.error)); constructor(ancestor?: ElementFinder) { super(InfoDrawer.selectors.root, ancestor); } - async waitForInfoDrawerToOpen() { return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT); } @@ -124,10 +80,6 @@ export class InfoDrawer extends Component { return !(await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))); } - async waitForCommentsTabContainer() { - await browser.wait(EC.visibilityOf(this.commentsContainer), BROWSER_WAIT_TIMEOUT); - } - getTabByTitle(title: string) { return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title)); } @@ -166,60 +118,6 @@ export class InfoDrawer extends Component { return await this.headerTitle.getText(); } - getLabelWrapper(label: string) { - return this.component.element(by.cssContainingText(InfoDrawer.selectors.fieldLabelWrapper, label)); - } - - getFieldByName(fieldName: string) { - const wrapper = this.getLabelWrapper(fieldName); - return wrapper.element(by.xpath('..')).element(by.css(InfoDrawer.selectors.fieldInput)); - } - - async isFieldDisplayed(fieldName: string) { - return await browser.isElementPresent(this.getFieldByName(fieldName)); - } - - async isInputEnabled(fieldName: string) { - return this.getFieldByName(fieldName).isEnabled(); - } - - async getValueOfField(fieldName: string) { - return await this.getFieldByName(fieldName).getText(); - } - - async enterTextInInput(fieldName: string, text: string) { - const input = this.getFieldByName(fieldName); - await input.clear(); - return await input.sendKeys(text); - } - - - getButton(button: string) { - return this.component.element(by.cssContainingText(InfoDrawer.selectors.metadataTabAction, button)); - } - - async isButtonDisplayed(button: string) { - return browser.isElementPresent(this.getButton(button)); - } - - async isButtonEnabled(button: string) { - return await this.getButton(button).isEnabled(); - } - - async clickButton(button: string) { - return await this.getButton(button).click(); - } - - async waitForVisibilityDropDownToOpen() { - await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT); - } - - async waitForVisibilityDropDownToClose() { - await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT); - } - - // --------------- - async isAboutTabDisplayed() { return await this.isTabDisplayed('About'); } @@ -228,236 +126,27 @@ export class InfoDrawer extends Component { return await this.isTabDisplayed('Properties'); } + async isPropertiesTabActive() { + return (await this.getActiveTabTitle()) === 'PROPERTIES'; + } + async isCommentsTabDisplayed() { return await this.isTabDisplayed('Comments'); } - async clickCommentsTab() { try { await this.getTabByTitle('Comments').click(); - await this.waitForCommentsTabContainer(); - await browser.wait(EC.visibilityOf(this.addCommentButton), BROWSER_WAIT_TIMEOUT); + await this.commentsTab.waitForCommentsContainer(); + await Promise.all([ + browser.wait(EC.visibilityOf(this.commentsTab.component), BROWSER_WAIT_TIMEOUT), + browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT) + ]); } catch (error) { console.error('--- catch error on clickCommentsTab ---'); throw error; } } - async clickAboutTab() { - try { - return await this.getTabByTitle('About').click(); - } catch (error) { - console.error('--- catch error on clickAboutTab ---'); - } - } - - - async isMessageDisplayed() { - return await browser.isElementPresent(this.hint); - } - - async getMessage() { - return await this.hint.getText(); - } - - async isErrorDisplayed() { - return await browser.isElementPresent(this.error); - } - - async getError() { - return await this.error.getText(); - } - - - async isNameDisplayed() { - return await this.isFieldDisplayed('Name'); - } - - async isNameEnabled() { - return await this.isInputEnabled('Name'); - } - - async getName() { - return await this.getValueOfField('Name'); - } - - async enterName(name: string) { - return await this.enterTextInInput('Name', name); - } - - - async isDescriptionDisplayed() { - return await this.isFieldDisplayed('Description'); - } - - async isDescriptionEnabled() { - return await this.isInputEnabled('Description'); - } - - async getDescription() { - return await this.getValueOfField('Description'); - } - - async enterDescription(desc: string) { - return await this.enterTextInInput('Description', desc); - } - - - async isVisibilityEnabled() { - const wrapper = this.getLabelWrapper('Visibility'); - const field = wrapper.element(by.xpath('..')).element(by.css(InfoDrawer.selectors.dropDown)); - return await field.isEnabled(); - } - - async isVisibilityDisplayed() { - return await this.isFieldDisplayed('Visibility'); - } - - async getVisibility() { - return await this.getValueOfField('Visibility'); - } - - async setVisibility(visibility: string) { - const val = visibility.toLowerCase(); - - await this.visibilityDropDown.click(); - await this.waitForVisibilityDropDownToOpen(); - - if (val === 'public') { - await this.visibilityPublic.click(); - } else if (val === 'private') { - await this.visibilityPrivate.click(); - } else if (val === 'moderated') { - await this.visibilityModerated.click(); - } else { - console.log('----- invalid visibility', val); - } - - await this.waitForVisibilityDropDownToClose(); - } - - - async isLibraryIdDisplayed() { - return await this.isFieldDisplayed('Library ID'); - } - - async isLibraryIdEnabled() { - return await this.isInputEnabled('Library ID'); - } - - async getLibraryId() { - return await this.getValueOfField('Library ID'); - } - - - async isEditEnabled() { - return await this.isButtonEnabled('Edit'); - } - - async isEditDisplayed() { - return await this.isButtonDisplayed('Edit'); - } - - async clickEdit() { - return await this.clickButton('Edit'); - } - - - async isUpdateEnabled() { - return await this.isButtonEnabled('Update'); - } - - async isUpdateDisplayed() { - return await this.isButtonDisplayed('Update'); - } - - async clickUpdate() { - return await this.clickButton('Update'); - } - - - async isCancelEnabled() { - return await this.isButtonEnabled('Cancel'); - } - - async isCancelDisplayed() { - return await this.isButtonDisplayed('Cancel'); - } - - async clickCancel() { - return await this.clickButton('Cancel'); - } - - - async getCommentsTabHeaderText() { - return await this.commentsHeader.getText(); - } - - async isCommentTextAreaDisplayed() { - return await browser.isElementPresent(this.commentTextarea); - } - - async isAddCommentButtonEnabled() { - const present = await browser.isElementPresent(this.addCommentButton); - if (present) { - return await this.addCommentButton.isEnabled(); - } - return false; - } - - async getCommentListItem() { - return await browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2); - } - - async getCommentById(commentId?: string) { - if (commentId) { - return await browser.wait(until.elementLocated(by.id(`${InfoDrawer.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2); - } - return await this.getCommentListItem(); - } - - async isCommentDisplayed(commentId?: string) { - return await browser.isElementPresent(await this.getCommentById(commentId)); - } - - async isCommentUserAvatarDisplayed(commentId?: string) { - const commentElement = await this.getCommentById(commentId); - return await browser.isElementPresent(commentElement.findElement(this.commentUserAvatar)); - } - - async getCommentText(commentId?: string) { - const commentElement = await this.getCommentById(commentId); - const message = await commentElement.findElement(this.commentText); - return await message.getText(); - } - - async getCommentUserName(commentId?: string) { - const commentElement = await this.getCommentById(commentId); - const user = await commentElement.findElement(this.commentUser); - return await user.getText(); - } - - async getCommentTime(commentId?: string) { - const commentElement = await this.getCommentById(commentId); - const time = await commentElement.findElement(this.commentTime); - return await time.getText(); - } - - async getNthCommentId(index: number) { - return await this.commentsList.get(index - 1).getAttribute('id'); - } - - async typeComment(text: string) { - return await this.commentTextarea.sendKeys(text); - } - - async clickAddButton() { - return await this.addCommentButton.click(); - } - - async getCommentTextFromTextArea() { - return await this.commentTextarea.getAttribute('value'); - } } diff --git a/e2e/configs.ts b/e2e/configs.ts index 542be231c..fe21ffde5 100755 --- a/e2e/configs.ts +++ b/e2e/configs.ts @@ -117,7 +117,8 @@ export const FILES = { protectedFile: { name: 'protected.pdf', password: '0000' - } + }, + jpgFile: 'file-jpg.jpg' }; export const EXTENSIBILITY_CONFIGS = { diff --git a/e2e/resources/test-files/file-jpg.jpg b/e2e/resources/test-files/file-jpg.jpg new file mode 100644 index 000000000..eb6bf4a45 Binary files /dev/null and b/e2e/resources/test-files/file-jpg.jpg differ diff --git a/e2e/suites/actions-available/context-menu-multiple-selection.test.ts b/e2e/suites/actions-available/context-menu-multiple-selection.test.ts index 8e1366c8a..5ae20fbce 100755 --- a/e2e/suites/actions-available/context-menu-multiple-selection.test.ts +++ b/e2e/suites/actions-available/context-menu-multiple-selection.test.ts @@ -360,7 +360,7 @@ describe('Context menu actions - multiple selection : ', () => { }); }); - describe('Recent Files', () => { + describe('on Recent Files', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickRecentFilesAndWait(); @@ -408,7 +408,7 @@ describe('Context menu actions - multiple selection : ', () => { }); }); - describe('Favorites', () => { + describe('on Favorites', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickFavoritesAndWait(); @@ -490,7 +490,7 @@ describe('Context menu actions - multiple selection : ', () => { }); }); - describe('Trash', () => { + describe('on Trash', () => { beforeEach(async (done) => { await Utils.pressEscape(); await page.clickTrashAndWait(); diff --git a/e2e/suites/info-drawer/comments.test.ts b/e2e/suites/info-drawer/comments.test.ts index 1bd8c446f..b7a76fe6d 100755 --- a/e2e/suites/info-drawer/comments.test.ts +++ b/e2e/suites/info-drawer/comments.test.ts @@ -35,6 +35,8 @@ describe('Comments', () => { const parent = `parent-${Utils.random()}`; let parentId; const file1 = `file1-${Utils.random()}.txt`; + const folder1 = `folder1-${Utils.random()}`; + const folder2 = `folder2-${Utils.random()}`; let folder2Id; const fileWith1Comment = `file1Comment-${Utils.random()}.txt`; let fileWith1CommentId; const fileWith2Comments = `file2Comments-${Utils.random()}.txt`; let fileWith2CommentsId; @@ -53,6 +55,7 @@ describe('Comments', () => { }; const infoDrawer = new InfoDrawer(); + const { commentsTab } = infoDrawer; const loginPage = new LoginPage(); const page = new BrowsingPage(); @@ -80,6 +83,10 @@ describe('Comments', () => { await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]); await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]); + await apis.user.nodes.createFolder(folder1, parentId); + folder2Id = (await apis.user.nodes.createFolder(folder2, parentId)).entry.id; + await apis.user.favorites.addFavoriteById('folder', folder2Id); + await loginPage.loginWith(username); done(); }); @@ -96,11 +103,6 @@ describe('Comments', () => { done(); }); - afterEach(async (done) => { - await dataTable.clearSelection(); - done(); - }); - it('Comments tab default fields - [C299173]', async () => { await dataTable.selectItem(file1); await page.toolbar.clickViewDetails(); @@ -108,9 +110,9 @@ describe('Comments', () => { await infoDrawer.clickCommentsTab(); expect(await infoDrawer.getActiveTabTitle()).toBe('COMMENTS'); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (0)'); - expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (0)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); }); it('Comment info display - [C280582]', async () => { @@ -119,15 +121,15 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); }); it('Comments are displayed ordered by created date in descending order - [C280583]', async () => { @@ -136,8 +138,8 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); - expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); + expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id); + expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id); }); it('Total number of comments is displayed - [C280585]', async () => { @@ -146,7 +148,7 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)'); }); it('Add button is enabled when typing in the comment field - [C280589]', async () => { @@ -155,25 +157,40 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - await infoDrawer.typeComment('my comment'); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(true, 'Add comment button not enabled'); + await commentsTab.typeComment('my comment'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(true, 'Add comment button not enabled'); }); - it('Add a comment - [C280590]', async () => { + it('Add a comment on a file - [C280590]', async () => { const myComment = 'my comment'; await dataTable.selectItem(file2Personal); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - await infoDrawer.typeComment(myComment); - await infoDrawer.clickAddButton(); + await commentsTab.typeComment(myComment); + await commentsTab.clickAddButton(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); - expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); + expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); + }); + + it('Add a comment on a folder - [C299208]', async () => { + const myComment = 'my comment'; + + await dataTable.selectItem(folder1); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + await infoDrawer.clickCommentsTab(); + await commentsTab.typeComment(myComment); + await commentsTab.clickAddButton(); + + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); + expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); }); it('Escape key clears the text when focus is on the textarea - [C280591]', async () => { @@ -181,19 +198,19 @@ describe('Comments', () => { await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - await infoDrawer.typeComment('myComment'); + await commentsTab.typeComment('myComment'); - expect(await infoDrawer.getCommentTextFromTextArea()).toBe('myComment'); + expect(await commentsTab.getCommentTextFromTextArea()).toBe('myComment'); await Utils.pressEscape(); - expect(await infoDrawer.getCommentTextFromTextArea()).toBe(''); + expect(await commentsTab.getCommentTextFromTextArea()).toBe(''); }); }); describe('from Favorites', () => { beforeAll(async (done) => { - await apis.user.favorites.waitForApi({ expect: 3 }); + await apis.user.favorites.waitForApi({ expect: 4 }); done(); }); @@ -203,7 +220,7 @@ describe('Comments', () => { }); afterEach(async (done) => { - await dataTable.clearSelection(); + await page.clickPersonalFiles(); done(); }); @@ -213,16 +230,16 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); // ACA-2348 expect broken because of parallel test suites - // expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + // expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); }); it('Comments are displayed ordered by created date in descending order - [C299197]', async () => { @@ -231,8 +248,8 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); - expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); + expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id); + expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id); }); it('Total number of comments is displayed - [C299198]', async () => { @@ -241,22 +258,37 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)'); }); - it('Add a comment - [C299199]', async () => { + it('Add a comment on a file - [C299199]', async () => { const myComment = 'my comment'; await dataTable.selectItem(file2Favorites); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - await infoDrawer.typeComment(myComment); - await infoDrawer.clickAddButton(); + await commentsTab.typeComment(myComment); + await commentsTab.clickAddButton(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); - expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); + expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); + }); + + it('Add a comment on a folder - [C299209]', async () => { + const myComment = 'my comment'; + + await dataTable.selectItem(folder2); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + await infoDrawer.clickCommentsTab(); + await commentsTab.typeComment(myComment); + await commentsTab.clickAddButton(); + + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); + expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); }); }); @@ -272,7 +304,7 @@ describe('Comments', () => { }); afterEach(async (done) => { - await dataTable.clearSelection(); + await page.clickPersonalFiles(); done(); }); @@ -282,15 +314,15 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); }); it('Comments are displayed ordered by created date in descending order - [C299189]', async () => { @@ -299,8 +331,8 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); - expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); + expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id); + expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id); }); it('Total number of comments is displayed - [C299190]', async () => { @@ -309,22 +341,22 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)'); }); - it('Add a comment - [C299191]', async () => { + it('Add a comment on a file - [C299191]', async () => { const myComment = 'my comment'; await dataTable.selectItem(file2Shared); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - await infoDrawer.typeComment(myComment); - await infoDrawer.clickAddButton(); + await commentsTab.typeComment(myComment); + await commentsTab.clickAddButton(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); - expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); + expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); }); }); @@ -340,7 +372,7 @@ describe('Comments', () => { }); afterEach(async (done) => { - await dataTable.clearSelection(); + await page.clickPersonalFiles(); done(); }); @@ -350,15 +382,15 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); }); it('Comments are displayed ordered by created date in descending order - [C299193]', async () => { @@ -367,8 +399,8 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); - expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); + expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id); + expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id); }); it('Total number of comments is displayed - [C299194]', async () => { @@ -377,22 +409,22 @@ describe('Comments', () => { await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)'); }); - it('Add a comment - [C299195]', async () => { + it('Add a comment on a file - [C299195]', async () => { const myComment = 'my comment'; await dataTable.selectItem(file2Recent); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); - await infoDrawer.typeComment(myComment); - await infoDrawer.clickAddButton(); + await commentsTab.typeComment(myComment); + await commentsTab.clickAddButton(); - expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); - expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`); + expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text'); }); }); diff --git a/e2e/suites/info-drawer/file-folder-properties.test.ts b/e2e/suites/info-drawer/file-folder-properties.test.ts new file mode 100755 index 000000000..16ac67113 --- /dev/null +++ b/e2e/suites/info-drawer/file-folder-properties.test.ts @@ -0,0 +1,249 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2019 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { LoginPage, BrowsingPage } from '../../pages/pages'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { InfoDrawer } from './../../components/info-drawer/info-drawer'; +import { Utils } from '../../utilities/utils'; +import { FILES } from '../../configs'; +import * as moment from 'moment'; + +describe('File / Folder properties', () => { + const username = `user1-${Utils.random()}`; + + const parent = `parent-${Utils.random()}`; let parentId; + + const file1 = { + name: `file1-${Utils.random()}.txt`, + title: 'file title', + description: 'file description', + author: 'file author' + }; + let file1Id; + + const image1 = { + name: FILES.jpgFile, + title: 'image title', + description: 'image description', + author: 'image author' + } + let image1Id; + + const folder1 = { + name: `folder1-${Utils.random()}`, + title: 'folder title', + description: 'folder description', + author: 'folder author' + }; + let folder1Id; + + const apis = { + admin: new RepoClient(), + user: new RepoClient(username, username) + }; + + const infoDrawer = new InfoDrawer(); + const { propertiesTab } = infoDrawer; + + const loginPage = new LoginPage(); + const page = new BrowsingPage(); + const { dataTable } = page; + + beforeAll(async (done) => { + await apis.admin.people.createUser({ username }); + parentId = (await apis.user.nodes.createFolder(parent)).entry.id; + file1Id = (await apis.user.nodes.createFile(file1.name, parentId, file1.title, file1.description, file1.author)).entry.id; + folder1Id = (await apis.user.nodes.createFolder(folder1.name, parentId, folder1.title, folder1.description, folder1.author)).entry.id; + image1Id = (await apis.user.upload.uploadFile(image1.name, parentId)).entry.id; + + await loginPage.loginWith(username); + done(); + }); + + afterAll(async (done) => { + await apis.user.nodes.deleteNodeById(parentId); + done(); + }); + + beforeEach(async (done) => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parent); + done(); + }); + + describe('View properties', () => { + it('Default tabs - [C299162]', async () => { + await dataTable.selectItem(file1.name); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + + expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); + expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed'); + expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed'); + expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs'); + }); + + it('File properties - [C269003]', async () => { + const apiProps = await apis.user.nodes.getNodeById(file1Id); + + const expectedPropLabels = [ + 'Name', + 'Title', + 'Creator', + 'Created Date', + 'Size', + 'Modifier', + 'Modified Date', + 'Mimetype', + 'Author', + 'Description' + ]; + const expectedPropValues = [ + file1.name, + file1.title, + apiProps.entry.createdByUser.displayName, + moment(apiProps.entry.createdAt).format('MMM DD YYYY'), + `${apiProps.entry.content.sizeInBytes} Bytes`, + apiProps.entry.modifiedByUser.displayName, + moment(apiProps.entry.modifiedAt).format('MMM DD YYYY'), + apiProps.entry.content.mimeTypeName, + file1.author, + file1.description + ]; + + await dataTable.selectItem(file1.name); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + + expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); + expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values'); + expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled'); + expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + }); + + it('Folder properties - [C307106]', async () => { + const apiProps = await apis.user.nodes.getNodeById(folder1Id); + + const expectedPropLabels = [ + 'Name', + 'Title', + 'Creator', + 'Created Date', + 'Modifier', + 'Modified Date', + 'Author', + 'Description' + ]; + const expectedPropValues = [ + folder1.name, + folder1.title, + apiProps.entry.createdByUser.displayName, + moment(apiProps.entry.createdAt).format('MMM DD YYYY'), + apiProps.entry.modifiedByUser.displayName, + moment(apiProps.entry.modifiedAt).format('MMM DD YYYY'), + folder1.author, + folder1.description + ]; + + await dataTable.selectItem(folder1.name); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + + expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); + expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values'); + expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled'); + expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + }); + + it('Less / More information buttons - [C269004]', async () => { + await dataTable.selectItem(file1.name); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + + expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); + + await propertiesTab.clickLessInformationButton(); + + expect(await propertiesTab.isLessInfoButtonDisplayed()).toBe(false, 'Less information button displayed'); + expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); + expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded'); + + await propertiesTab.clickMoreInformationButton(); + + expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed'); + expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); + }); + + it('Image properties - [C269007]', async () => { + const apiProps = await apis.user.nodes.getNodeById(image1Id); + + const expectedPropLabels = [ + 'Image Width', + 'Image Height', + 'Date and Time', + 'Exposure Time', + 'F Number', + 'Flash Activated', + 'Focal Length', + 'ISO Speed', + 'Orientation', + 'Camera Manufacturer', + 'Camera Model', + 'Camera Software' + ]; + const expectedPropValues = [ + apiProps.entry.properties['exif:pixelXDimension'].toString(), + apiProps.entry.properties['exif:pixelYDimension'].toString(), + moment(apiProps.entry.properties['exif:dateTimeOriginal']).format('MMM DD YYYY H:mm'), + apiProps.entry.properties['exif:exposureTime'].toString(), + apiProps.entry.properties['exif:fNumber'].toString(), + apiProps.entry.properties['exif:flash'], + apiProps.entry.properties['exif:focalLength'].toString(), + apiProps.entry.properties['exif:isoSpeedRatings'], + (apiProps.entry.properties['exif:orientation']).toString(), + apiProps.entry.properties['exif:manufacturer'], + apiProps.entry.properties['exif:model'], + apiProps.entry.properties['exif:software'] + ]; + + await dataTable.selectItem(image1.name); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + + await propertiesTab.clickLessInformationButton(); + await propertiesTab.clickImagePropertiesPanel(); + await propertiesTab.waitForImagePropertiesPanelToExpand(); + + expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed'); + expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); + expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values'); + expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled'); + expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); + }); + }); + +}); diff --git a/e2e/suites/info-drawer/general.test.ts b/e2e/suites/info-drawer/general.test.ts index 4add293f9..4465e5f55 100755 --- a/e2e/suites/info-drawer/general.test.ts +++ b/e2e/suites/info-drawer/general.test.ts @@ -76,15 +76,15 @@ describe('General', () => { done(); }); - it('Info drawer for a file - default tabs - [C299162]', async () => { + it('Info drawer closes on page refresh - [C268999]', async () => { await dataTable.selectItem(file1); await page.toolbar.clickViewDetails(); - await infoDrawer.waitForInfoDrawerToOpen(); + expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open'); - expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); - expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed'); - expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed'); - expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs'); + await page.refresh(); + await dataTable.waitForBody(); + + expect(await infoDrawer.isOpen()).toBe(false, 'Info drawer open'); }); }); diff --git a/e2e/suites/info-drawer/library-properties.test.ts b/e2e/suites/info-drawer/library-properties.test.ts index 032db8baa..29518cc14 100755 --- a/e2e/suites/info-drawer/library-properties.test.ts +++ b/e2e/suites/info-drawer/library-properties.test.ts @@ -62,6 +62,7 @@ describe('Library properties', () => { }; const infoDrawer = new InfoDrawer(); + const { aboutTab } = infoDrawer; const loginPage = new LoginPage(); const page = new BrowsingPage(); @@ -108,17 +109,17 @@ describe('Library properties', () => { expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); expect(await infoDrawer.isAboutTabDisplayed()).toBe(true, 'About tab is not displayed'); - expect(await infoDrawer.isNameDisplayed()).toBe(true, 'Name field not displayed'); - expect(await infoDrawer.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed'); - expect(await infoDrawer.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed'); - expect(await infoDrawer.isDescriptionDisplayed()).toBe(true, 'Description field not displayed'); + expect(await aboutTab.isNameDisplayed()).toBe(true, 'Name field not displayed'); + expect(await aboutTab.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed'); + expect(await aboutTab.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed'); + expect(await aboutTab.isDescriptionDisplayed()).toBe(true, 'Description field not displayed'); - expect(await infoDrawer.getName()).toEqual(site.name); - expect(await infoDrawer.getLibraryId()).toEqual(site.id); - expect((await infoDrawer.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase()); - expect(await infoDrawer.getDescription()).toEqual(site.description); + expect(await aboutTab.getName()).toEqual(site.name); + expect(await aboutTab.getLibraryId()).toEqual(site.id); + expect((await aboutTab.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase()); + expect(await aboutTab.getDescription()).toEqual(site.description); - expect(await infoDrawer.isEditDisplayed()).toBe(true, 'Edit action is not displayed'); + expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(true, 'Edit action is not displayed'); }); it('Editable properties - [C289338]', async () => { @@ -126,18 +127,18 @@ describe('Library properties', () => { await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled'); - await infoDrawer.clickEdit(); + expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); + await aboutTab.clickEditLibraryProperties(); - expect(await infoDrawer.isNameEnabled()).toBe(true, 'Name field not enabled'); - expect(await infoDrawer.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled'); - expect(await infoDrawer.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled'); - expect(await infoDrawer.isDescriptionEnabled()).toBe(true, 'Description field not enabled'); + expect(await aboutTab.isNameEnabled()).toBe(true, 'Name field not enabled'); + expect(await aboutTab.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled'); + expect(await aboutTab.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled'); + expect(await aboutTab.isDescriptionEnabled()).toBe(true, 'Description field not enabled'); - expect(await infoDrawer.isCancelDisplayed()).toBe(true, 'Cancel button not displayed'); - expect(await infoDrawer.isUpdateDisplayed()).toBe(true, 'Update button not displayed'); - expect(await infoDrawer.isCancelEnabled()).toBe(true, 'Cancel button not enabled'); - expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled'); + expect(await aboutTab.isCancelDisplayed()).toBe(true, 'Cancel button not displayed'); + expect(await aboutTab.isUpdateDisplayed()).toBe(true, 'Update button not displayed'); + expect(await aboutTab.isCancelEnabled()).toBe(true, 'Cancel button not enabled'); + expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled'); }); it('Edit site details - [C289339]', async () => { @@ -145,15 +146,15 @@ describe('Library properties', () => { await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled'); - await infoDrawer.clickEdit(); + expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); + await aboutTab.clickEditLibraryProperties(); - await infoDrawer.enterName(siteUpdated.name); - await infoDrawer.enterDescription(siteUpdated.description); - await infoDrawer.setVisibility(siteUpdated.visibility); - expect(await infoDrawer.isUpdateEnabled()).toBe(true, 'Update button not enabled'); + await aboutTab.enterName(siteUpdated.name); + await aboutTab.enterDescription(siteUpdated.description); + await aboutTab.setVisibility(siteUpdated.visibility); + expect(await aboutTab.isUpdateEnabled()).toBe(true, 'Update button not enabled'); - await infoDrawer.clickUpdate(); + await aboutTab.clickUpdate(); expect(await page.getSnackBarMessage()).toEqual('Library properties updated'); expect(await dataTable.isItemPresent(siteUpdated.name)).toBe(true, 'New site name not displayed in the list'); @@ -172,14 +173,14 @@ describe('Library properties', () => { await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled'); - await infoDrawer.clickEdit(); + expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); + await aboutTab.clickEditLibraryProperties(); - await infoDrawer.enterName(newName); - await infoDrawer.enterDescription(newDesc); - await infoDrawer.setVisibility(SITE_VISIBILITY.MODERATED); + await aboutTab.enterName(newName); + await aboutTab.enterDescription(newDesc); + await aboutTab.setVisibility(SITE_VISIBILITY.MODERATED); - await infoDrawer.clickCancel(); + await aboutTab.clickCancel(); expect(await dataTable.isItemPresent(newName)).toBe(false, 'New site name is displayed in the list'); expect(await dataTable.isItemPresent(site.name)).toBe(true, 'Original site name not displayed in the list'); @@ -192,37 +193,37 @@ describe('Library properties', () => { await dataTable.selectItem(siteDup); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickEdit(); + await aboutTab.clickEditLibraryProperties(); - await infoDrawer.enterName(site.name); - expect(await infoDrawer.isMessageDisplayed()).toBe(true, 'Message not displayed'); - expect(await infoDrawer.getMessage()).toEqual('Library name already in use'); + await aboutTab.enterName(site.name); + expect(await aboutTab.isMessageDisplayed()).toBe(true, 'Message not displayed'); + expect(await aboutTab.getMessage()).toEqual('Library name already in use'); }); it('Site name too long - [C289342]', async () => { await dataTable.selectItem(site.name); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickEdit(); + await aboutTab.clickEditLibraryProperties(); - await infoDrawer.enterName(Utils.string257); + await aboutTab.enterName(Utils.string257); await Utils.pressTab(); - expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed'); - expect(await infoDrawer.getError()).toEqual('Use 256 characters or less for title'); - expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled'); + expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed'); + expect(await aboutTab.getError()).toEqual('Use 256 characters or less for title'); + expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled'); }); it('Site description too long - [C289343]', async () => { await dataTable.selectItem(site.name); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickEdit(); + await aboutTab.clickEditLibraryProperties(); - await infoDrawer.enterDescription(Utils.string513); + await aboutTab.enterDescription(Utils.string513); await Utils.pressTab(); - expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed'); - expect(await infoDrawer.getError()).toEqual('Use 512 characters or less for description'); - expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled'); + expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed'); + expect(await aboutTab.getError()).toEqual('Use 512 characters or less for description'); + expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled'); }); describe('Non manager', () => { @@ -238,7 +239,7 @@ describe('Library properties', () => { await dataTable.selectItem(site.name); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - expect(await infoDrawer.isEditDisplayed()).toBe(false, 'Edit action is displayed'); + expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed'); }); it('Error notification - [C289344]', async () => { @@ -248,12 +249,12 @@ describe('Library properties', () => { await dataTable.selectItem(site.name); await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickEdit(); + await aboutTab.clickEditLibraryProperties(); await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE); - await infoDrawer.enterDescription('new description'); - await infoDrawer.clickUpdate(); + await aboutTab.enterDescription('new description'); + await aboutTab.clickUpdate(); expect(await page.getSnackBarMessage()).toEqual('There was an error updating library properties'); }); diff --git a/e2e/utilities/repo-client/apis/nodes/nodes-api.ts b/e2e/utilities/repo-client/apis/nodes/nodes-api.ts index db6b346eb..b08006e1e 100755 --- a/e2e/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/e2e/utilities/repo-client/apis/nodes/nodes-api.ts @@ -141,13 +141,14 @@ export class NodesApi extends RepoApi { return await this.createNode('cm:content', name, parentId, title, description, imageProps); } - async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, majorVersion: boolean = true) { + async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, author: string = '', majorVersion: boolean = true) { const nodeBody = { name, nodeType, properties: { 'cm:title': title, - 'cm:description': description + 'cm:description': description, + 'cm:author': author } }; if (imageProps) { @@ -155,22 +156,32 @@ export class NodesApi extends RepoApi { } await this.apiAuth(); - return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion }); + + try { + return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion }); + } catch (error) { + console.log('===========> API create node catch ==========='); + } + } - async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', majorVersion: boolean = true) { - return await this.createNode('cm:content', name, parentId, title, description, majorVersion); + async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '', majorVersion: boolean = true) { + return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion); } async createImage(name: string, parentId: string = '-my-', title: string = '', description: string = '') { return await this.createImageNode('cm:content', name, parentId, title, description); } - async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '') { - return await this.createNode('cm:folder', name, parentId, title, description); + async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '') { + try { + return await this.createNode('cm:folder', name, parentId, title, description, null, author); + } catch (error) { + console.log('======> API create folder catch =========='); + } } - async createChildren(data: NodeBodyCreate[]): Promise { + async createChildren(data: NodeBodyCreate[]) { await this.apiAuth(); return await this.nodesApi.createNode('-my-', data); } diff --git a/protractor.conf.js b/protractor.conf.js index ad1a19123..16dcf6a47 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -80,7 +80,7 @@ exports.config = { '--incognito', '--headless', '--remote-debugging-port=9222', - '--disable-gpu', + `--window-size=${width},${height}`, '--no-sandbox' ] } @@ -94,7 +94,7 @@ exports.config = { framework: 'jasmine', jasmineNodeOpts: { showColors: true, - defaultTimeoutInterval: 60000, + defaultTimeoutInterval: 100000, print: function() {} }, @@ -118,11 +118,6 @@ exports.config = { project: 'e2e/tsconfig.e2e.json' }); - browser - .manage() - .window() - .setSize(width, height); - jasmine.getEnv().addReporter( new SpecReporter({ spec: {