From d5f8699976dcc75e4d5e67fb42628f4bccd8b813 Mon Sep 17 00:00:00 2001 From: Adina Parpalita Date: Thu, 9 May 2019 14:57:32 +0300 Subject: [PATCH] [ACA-1258] automate tests for viewing file/image properties (#1101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * split InfoDrawer test component and add tests for viewing properties * add “date item” to spell ignore and remove commented code * try to increase timeout --- cspell.json | 3 +- .../info-drawer/info-drawer-comments-tab.ts | 140 +++++++ .../info-drawer-metadata-content.ts | 125 +++++++ .../info-drawer-metadata-library.ts | 254 +++++++++++++ e2e/components/info-drawer/info-drawer.ts | 349 +----------------- e2e/configs.ts | 3 +- e2e/resources/test-files/file-jpg.jpg | Bin 0 -> 22812 bytes .../context-menu-multiple-selection.test.ts | 6 +- e2e/suites/info-drawer/comments.test.ts | 204 +++++----- .../file-folder-properties.test.ts | 249 +++++++++++++ e2e/suites/info-drawer/general.test.ts | 12 +- .../info-drawer/library-properties.test.ts | 101 ++--- .../repo-client/apis/nodes/nodes-api.ts | 27 +- protractor.conf.js | 9 +- 14 files changed, 990 insertions(+), 492 deletions(-) create mode 100755 e2e/components/info-drawer/info-drawer-comments-tab.ts create mode 100755 e2e/components/info-drawer/info-drawer-metadata-content.ts create mode 100755 e2e/components/info-drawer/info-drawer-metadata-library.ts create mode 100644 e2e/resources/test-files/file-jpg.jpg create mode 100755 e2e/suites/info-drawer/file-folder-properties.test.ts 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 0000000000000000000000000000000000000000..eb6bf4a4570fa8112b945e44f6af249a47450b41 GIT binary patch literal 22812 zcmeHvcU%)`*Y+eK0YXtUC?G0T6BMNc1OyGzLkppZQCEr}iAzUCb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f;^N<^y-th@oFR#WsJl$ZVl!{AMb<;)Ju93_L;-v#l<=VGils+)klmCPtqH9=1B zIu;rm&~`teoGM4(*8ryBD`jlJR1`P0(VkFP z6_0IYCZaV%WCn@0GCMZ2qwCaWK2b%`U{IxJx7aCk>n}3=-pGZz+{6nrdL4Dyfxq!; zR?wUG?32W|d(1j4EjLDcDkd;Vj*{nrPf?bC_Tf^#DZMLz-X-Jf(cVB|S2dQ;)xv}I z!DFF+fWnWR=|Ry_^PdvO8<%;*bs)RbJI-t+*TcTJ9tZVbEpWtOrc{X(^{|6+WWi { }); }); - 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: {