/*! * @license * Copyright 2019 Alfresco Software, Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { BrowserActions, BrowserVisibility, DateUtil, DocumentListPage, TogglePage } from '@alfresco/adf-testing'; import { $$, browser, by, element, ElementFinder, ElementArrayFinder, protractor } from 'protractor'; import { DropActions } from '../../actions/drop.actions'; import { CreateLibraryDialogPage } from './dialog/create-library-dialog.page'; import { FolderDialogPage } from './dialog/folder-dialog.page'; import { NavigationBarPage } from './navigation-bar.page'; import path = require('path'); import { DropdownPage } from '../../../lib/testing/src/lib/material/pages/dropdown.page'; export class ContentServicesPage { columns = { name: 'Display name', size: 'Size', nodeId: 'Node id', createdBy: 'Created by', created: 'Created' }; contentList: DocumentListPage = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first()); togglePage: TogglePage = new TogglePage(); createFolderDialog: FolderDialogPage = new FolderDialogPage(); createLibraryDialog: CreateLibraryDialogPage = new CreateLibraryDialogPage(); dragAndDropAction: DropActions = new DropActions(); multipleFileUploadToggle: ElementFinder = element(by.id('adf-document-list-enable-drop-files')); uploadBorder: ElementFinder = element(by.id('document-list-container')); contentServices: ElementFinder = element(by.css('.app-sidenav-link[data-automation-id="Content Services"]')); currentFolder: ElementFinder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div')); createFolderButton: ElementFinder = element(by.css('button[data-automation-id="create-new-folder"]')); editFolderButton: ElementFinder = element(by.css('button[data-automation-id="edit-folder"]')); deleteNodesButton: ElementFinder = element(by.css('button[data-automation-id="delete-toolbar-button"]')); createLibraryButton: ElementFinder = element(by.css('button[data-automation-id="create-new-library"]')); activeBreadcrumb: ElementFinder = element(by.css('div[class*="active"]')); tooltip = by.css('div[class*="--text adf-full-width"] span'); uploadFileButton: ElementFinder = element(by.css('.adf-upload-button-file-container button')); uploadFileButtonInput: ElementFinder = element(by.css('input[data-automation-id="upload-single-file"]')); uploadMultipleFileButton: ElementFinder = element(by.css('input[data-automation-id="upload-multiple-files"]')); uploadFolderButton: ElementFinder = element(by.css('input[data-automation-id="uploadFolder"]')); errorSnackBar: ElementFinder = element(by.css('simple-snack-bar[class*="mat-simple-snackbar"]')); emptyPagination: ElementFinder = element(by.css('adf-pagination[class*="adf-pagination__empty"]')); dragAndDrop: ElementFinder = element.all(by.css('adf-upload-drag-area div')).first(); nameHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_name"] > span')); sizeHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_content.sizeInBytes"] > span')); createdByHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_createdByUser.displayName"] > span')); createdHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_createdAt"] > span')); recentFiles: ElementFinder = element(by.css('.app-container-recent')); recentFilesExpanded: ElementFinder = element(by.css('.app-container-recent mat-expansion-panel-header.mat-expanded')); recentFilesClosed: ElementFinder = element(by.css('.app-container-recent mat-expansion-panel-header')); recentFileIcon: ElementFinder = element(by.css('.app-container-recent mat-expansion-panel-header mat-icon')); emptyFolder: ElementFinder = element(by.css('.adf-empty-folder-this-space-is-empty')); emptyFolderImage: ElementFinder = element(by.css('.adf-empty-folder-image')); emptyRecent: ElementFinder = element(by.css('.app-container-recent .app-empty-list__title')); gridViewButton: ElementFinder = element(by.css('button[data-automation-id="document-list-grid-view"]')); cardViewContainer: ElementFinder = element(by.css('div.app-document-list-container div.adf-datatable-card')); shareNodeButton: ElementFinder = element(by.cssContainingText('mat-icon', ' share ')); nameColumnHeader = 'name'; createdByColumnHeader = 'createdByUser.displayName'; createdColumnHeader = 'createdAt'; deleteContentElement: ElementFinder = element(by.css('button[data-automation-id*="DELETE"]')); metadataAction: ElementFinder = element(by.css('button[data-automation-id*="METADATA"]')); versionManagerAction: ElementFinder = element(by.css('button[data-automation-id*="VERSIONS"]')); moveContentElement: ElementFinder = element(by.css('button[data-automation-id*="MOVE"]')); copyContentElement: ElementFinder = element(by.css('button[data-automation-id*="COPY"]')); lockContentElement: ElementFinder = element(by.css('button[data-automation-id="DOCUMENT_LIST.ACTIONS.LOCK"]')); downloadContent: ElementFinder = element(by.css('button[data-automation-id*="DOWNLOAD"]')); downloadButton: ElementFinder = element(by.css('button[title="Download"]')); favoriteButton: ElementFinder = element(by.css('button[data-automation-id="favorite"]')); markedFavorite: ElementFinder = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star')); notMarkedFavorite: ElementFinder = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star_border')); multiSelectToggle: ElementFinder = element(by.cssContainingText('span.mat-slide-toggle-content', ' Multiselect (with checkboxes) ')); selectAllCheckbox: ElementFinder = element(by.css('.adf-checkbox-sr-only')); selectionModeDropdown: ElementFinder = element(by.css('.mat-select[aria-label="Selection Mode"]')); selectedNodesList: ElementArrayFinder = element.all(by.css('.app-content-service-settings li')); siteListDropdown = new DropdownPage(element(by.css(`mat-select[data-automation-id='site-my-files-option']`))); sortingDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="grid-view-sorting"]'))); async pressContextMenuActionNamed(actionName): Promise { await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); } async checkContextActionIsVisible(actionName) { const actionButton: ElementFinder = element(by.css(`button[data-automation-id="context-${actionName}"`)); await BrowserVisibility.waitUntilElementIsVisible(actionButton); } async isContextActionEnabled(actionName): Promise { const actionButton: ElementFinder = element(by.css(`button[data-automation-id="context-${actionName}"`)); await BrowserVisibility.waitUntilElementIsVisible(actionButton); return actionButton.isEnabled(); } getDocumentList(): DocumentListPage { return this.contentList; } async closeActionContext(): Promise { await BrowserActions.closeMenuAndDialogs(); } async checkLockedIcon(content): Promise { return this.contentList.checkLockedIcon(content); } async checkUnlockedIcon(content): Promise { return this.contentList.checkUnlockedIcon(content); } async checkDeleteIsDisabled(content): Promise { await this.contentList.clickOnActionMenu(content); await this.waitForContentOptions(); const disabledDelete: ElementFinder = element(by.css(`button[data-automation-id*='DELETE'][disabled='true']`)); await BrowserVisibility.waitUntilElementIsVisible(disabledDelete); } async deleteContent(content): Promise { await this.contentList.clickOnActionMenu(content); await this.waitForContentOptions(); await BrowserActions.click(this.deleteContentElement); } async clickDeleteOnToolbar(): Promise { await BrowserActions.click(this.deleteNodesButton); } async checkToolbarDeleteIsDisabled(): Promise { await BrowserActions.checkIsDisabled(this.deleteNodesButton); } async metadataContent(content): Promise { await this.contentList.clickOnActionMenu(content); await this.waitForContentOptions(); await BrowserActions.click(this.metadataAction); } async versionManagerContent(content): Promise { await this.contentList.clickOnActionMenu(content); await this.waitForContentOptions(); await BrowserActions.click(this.versionManagerAction); } async copyContent(content): Promise { await this.contentList.clickOnActionMenu(content); await BrowserActions.click(this.copyContentElement); } async moveContent(content): Promise { await this.contentList.clickOnActionMenu(content); await BrowserActions.click(this.moveContentElement); } async lockContent(content): Promise { await this.contentList.clickOnActionMenu(content); await BrowserActions.click(this.lockContentElement); } async waitForContentOptions(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.copyContentElement); await BrowserVisibility.waitUntilElementIsVisible(this.moveContentElement); await BrowserVisibility.waitUntilElementIsVisible(this.deleteContentElement); await BrowserVisibility.waitUntilElementIsVisible(this.downloadContent); } async clickFileHyperlink(fileName): Promise { const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName); await BrowserActions.click(hyperlink); } async checkFileHyperlinkIsEnabled(fileName): Promise { const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName); await BrowserVisibility.waitUntilElementIsVisible(hyperlink); } async clickHyperlinkNavigationToggle(): Promise { const hyperlinkToggle: ElementFinder = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation')); await BrowserActions.click(hyperlinkToggle); } async enableDropFilesInAFolder(): Promise { await this.togglePage.enableToggle(this.multipleFileUploadToggle); } async disableDropFilesInAFolder(): Promise { await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle); await this.togglePage.disableToggle(this.multipleFileUploadToggle); } async getElementsDisplayedId() { return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId); } checkElementsDateSortedAsc(elements) { let sorted = true; let i = 0; while (elements.length > 1 && sorted === true && i < (elements.length - 1)) { const left = DateUtil.parse(elements[i], 'DD-MM-YY'); const right = DateUtil.parse(elements[i + 1], 'DD-MM-YY'); if (left > right) { sorted = false; } i++; } return sorted; } checkElementsDateSortedDesc(elements) { let sorted = true; let i = 0; while (elements.length > 1 && sorted === true && i < (elements.length - 1)) { const left = DateUtil.parse(elements[i], 'DD-MM-YY'); const right = DateUtil.parse(elements[i + 1], 'DD-MM-YY'); if (left < right) { sorted = false; } i++; } return sorted; } async checkRecentFileToBeShowed() { await BrowserVisibility.waitUntilElementIsVisible(this.recentFiles); } async expandRecentFiles(): Promise { await this.checkRecentFileToBeShowed(); await this.checkRecentFileToBeClosed(); await BrowserActions.click(this.recentFilesClosed); await this.checkRecentFileToBeOpened(); } async closeRecentFiles(): Promise { await this.checkRecentFileToBeShowed(); await this.checkRecentFileToBeOpened(); await BrowserActions.click(this.recentFilesExpanded); await this.checkRecentFileToBeClosed(); } async checkRecentFileToBeClosed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.recentFilesClosed); } async checkRecentFileToBeOpened(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.recentFilesExpanded); } async getRecentFileIcon(): Promise { return BrowserActions.getText(this.recentFileIcon); } async checkDocumentListElementsAreDisplayed(): Promise { await this.checkAcsContainer(); await this.waitForTableBody(); } async checkAcsContainer(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.uploadBorder); } async waitForTableBody(): Promise { await this.contentList.waitForTableBody(); } async goToDocumentList(): Promise { const navigationBarPage = new NavigationBarPage(); await navigationBarPage.clickContentServicesButton(); } async clickOnContentServices(): Promise { await BrowserActions.click(this.contentServices); } async numberOfResultsDisplayed(): Promise { return this.contentList.dataTablePage().numberOfRows(); } async currentFolderName(): Promise { return BrowserActions.getText(this.currentFolder); } async getAllRowsNameColumn(): Promise { return this.contentList.getAllRowsColumnValues(this.columns.name); } async sortByName(sortOrder: string): Promise { await this.contentList.dataTable.sortByColumn(sortOrder, this.nameColumnHeader); } async sortByAuthor(sortOrder: string): Promise { await this.contentList.dataTable.sortByColumn(sortOrder, this.createdByColumnHeader); } async sortByCreated(sortOrder: string): Promise { await this.contentList.dataTable.sortByColumn(sortOrder, this.createdColumnHeader); } async sortAndCheckListIsOrderedByName(sortOrder: string): Promise { await this.sortByName(sortOrder); return this.checkListIsSortedByNameColumn(sortOrder); } async checkListIsSortedByNameColumn(sortOrder: string): Promise { return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.name); } async checkListIsSortedByCreatedColumn(sortOrder: string): Promise { return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.created); } async checkListIsSortedByAuthorColumn(sortOrder: string): Promise { return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.createdBy); } async checkListIsSortedBySizeColumn(sortOrder: string): Promise { return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.size); } async sortAndCheckListIsOrderedByAuthor(sortOrder: string): Promise { await this.sortByAuthor(sortOrder); return this.checkListIsSortedByAuthorColumn(sortOrder); } async sortAndCheckListIsOrderedByCreated(sortOrder: string): Promise { await this.sortByCreated(sortOrder); return this.checkListIsSortedByCreatedColumn(sortOrder); } async doubleClickRow(nodeName): Promise { await this.contentList.doubleClickRow(nodeName); } async selectRow(nodeName): Promise { await this.contentList.selectRow(nodeName); } async clickOnCreateNewFolder(): Promise { await BrowserActions.click(this.createFolderButton); } async clickOnFavoriteButton(): Promise { await BrowserActions.click(this.favoriteButton); } async checkIsMarkedFavorite(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.markedFavorite); } async checkIsNotMarkedFavorite(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.notMarkedFavorite); } async clickOnEditFolder(): Promise { await BrowserActions.click(this.editFolderButton); } async isEditFolderButtonEnabled(): Promise { return this.editFolderButton.isEnabled(); } async openCreateLibraryDialog(): Promise { await BrowserActions.click(this.createLibraryButton); await this.createLibraryDialog.waitForDialogToOpen(); } async createNewFolder(folderName: string): Promise { await this.clickOnCreateNewFolder(); await this.createFolderDialog.addFolderName(folderName); await this.createFolderDialog.clickOnCreateUpdateButton(); } async createAndOpenNewFolder(folderName: string): Promise { await this.createNewFolder(folderName); await this.checkContentIsDisplayed(folderName); await this.openFolder(folderName); } async openFolder(folderName: string): Promise { await this.doubleClickRow(folderName); await this.checkDocumentListElementsAreDisplayed(); } async checkContentIsDisplayed(content): Promise { await this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content); } async checkContentsAreDisplayed(content): Promise { for (let i = 0; i < content.length; i++) { await this.checkContentIsDisplayed(content[i]); } } async checkContentIsNotDisplayed(content): Promise { await this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content); } async deleteAndCheckFolderNotDisplayed(folderName: string): Promise { await this.deleteContent(folderName); await this.checkContentIsNotDisplayed(folderName); } async deleteSubFolderUnderRoot(folderName: string, subFolderName: string): Promise { await this.goToDocumentList(); await this.openFolder(folderName); await this.deleteAndCheckFolderNotDisplayed(subFolderName); } async getActiveBreadcrumb(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.activeBreadcrumb); return this.activeBreadcrumb.getAttribute('title'); } async uploadFile(fileLocation): Promise { await this.checkUploadButton(); await this.uploadFileButtonInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation))); await this.checkUploadButton(); } async uploadMultipleFile(files): Promise { await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton); let allFiles = path.resolve(path.join(browser.params.testConfig.main.rootPath, files[0])); for (let i = 1; i < files.length; i++) { allFiles = allFiles + '\n' + path.resolve(path.join(browser.params.testConfig.main.rootPath, files[i])); } await this.uploadMultipleFileButton.sendKeys(allFiles); await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton); } async uploadFolder(folderLocation: string): Promise { await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton); await this.uploadFolderButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, folderLocation))); } async getSingleFileButtonTooltip(): Promise { await BrowserVisibility.waitUntilElementIsPresent(this.uploadFileButton); return this.uploadFileButtonInput.getAttribute('title'); } async getMultipleFileButtonTooltip(): Promise { await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton); return this.uploadMultipleFileButton.getAttribute('title'); } async getFolderButtonTooltip(): Promise { await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton); return this.uploadFolderButton.getAttribute('title'); } async checkUploadButton(): Promise { await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton); } async uploadButtonIsEnabled(): Promise { return this.uploadFileButton.isEnabled(); } async getErrorMessage(): Promise { return BrowserActions.getText(this.errorSnackBar); } async enableInfiniteScrolling(): Promise { const infiniteScrollButton: ElementFinder = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling')); await BrowserActions.click(infiniteScrollButton); } async enableCustomPermissionMessage(): Promise { const customPermissionMessage: ElementFinder = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable custom permission message')); await BrowserActions.click(customPermissionMessage); } async enableMediumTimeFormat(): Promise { const mediumTimeFormat: ElementFinder = element(by.css('#enableMediumTimeFormat')); await BrowserActions.click(mediumTimeFormat); } async enableThumbnails(): Promise { const thumbnailSlide: ElementFinder = element(by.id('adf-thumbnails-upload-switch')); await BrowserActions.click(thumbnailSlide); } async checkPaginationIsNotDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination); } async getDocumentListRowNumber(): Promise { const documentList: ElementFinder = element(by.css('adf-upload-drag-area adf-document-list')); await BrowserVisibility.waitUntilElementIsVisible(documentList); return $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count(); } async checkColumnNameHeader(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.nameHeader); } async checkColumnSizeHeader(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.sizeHeader); } async checkColumnCreatedByHeader(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.createdByHeader); } async checkColumnCreatedHeader(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.createdHeader); } async checkDragAndDropDIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.dragAndDrop); } async dragAndDropFile(file: string): Promise { await this.checkDragAndDropDIsDisplayed(); await this.dragAndDropAction.dropFile(this.dragAndDrop, file); } async dragAndDropFolder(folderName: string): Promise { await this.checkDragAndDropDIsDisplayed(); await this.dragAndDropAction.dropFolder(this.dragAndDrop, folderName); } async checkLockIsDisplayedForElement(name): Promise { const lockButton: ElementFinder = element(by.css(`div.adf-datatable-cell[data-automation-id="${name}"] button`)); await BrowserVisibility.waitUntilElementIsVisible(lockButton); } async getColumnValueForRow(file, columnName): Promise { return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName); } async getStyleValueForRowText(rowName, styleName): Promise { const row: ElementFinder = element(by.css(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`)); await BrowserVisibility.waitUntilElementIsVisible(row); return row.getCssValue(styleName); } async checkEmptyFolderTextToBe(text): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder); await expect(await this.emptyFolder.getText()).toContain(text); } async checkEmptyFolderImageUrlToContain(url): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolderImage); await expect(await this.emptyFolderImage.getAttribute('src')).toContain(url); } async checkEmptyRecentFileIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.emptyRecent); } async getRowIconImageUrl(fileName): Promise { const iconRow: ElementFinder = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`)); await BrowserVisibility.waitUntilElementIsVisible(iconRow); return iconRow.getAttribute('src'); } async checkGridViewButtonIsVisible(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.gridViewButton); } async clickGridViewButton(): Promise { await this.checkGridViewButtonIsVisible(); await BrowserActions.click(this.gridViewButton); } async checkCardViewContainerIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer); } async getCardElementShowedInPage(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer); return $$('div.app-document-list-container div.adf-datatable-card div.adf-cell-value img').count(); } async getDocumentCardIconForElement(elementName): Promise { const elementIcon: ElementFinder = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`)); return elementIcon.getAttribute('src'); } async checkDocumentCardPropertyIsShowed(elementName, propertyName): Promise { const elementProperty: ElementFinder = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`)); await BrowserVisibility.waitUntilElementIsVisible(elementProperty); } async getAttributeValueForElement(elementName, propertyName): Promise { const elementSize = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`)); return BrowserActions.getText(elementSize); } async checkMenuIsShowedForElementIndex(elementIndex): Promise { const elementMenu: ElementFinder = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`)); await BrowserVisibility.waitUntilElementIsVisible(elementMenu); } async navigateToCardFolder(folderName): Promise { await BrowserActions.closeMenuAndDialogs(); const folderCard: ElementFinder = element(by.css(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`)); await BrowserActions.click(folderCard); const folderSelected: ElementFinder = element(by.css(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`)); await BrowserVisibility.waitUntilElementIsVisible(folderSelected); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); } async selectGridSortingFromDropdown(sortingOption): Promise { await this.sortingDropdown.selectDropdownOption(sortingOption); } async checkRowIsDisplayed(rowName): Promise { const row = this.contentList.dataTablePage().getCellElementByValue(this.columns.name, rowName); await BrowserVisibility.waitUntilElementIsVisible(row); } async clickShareButton(): Promise { await BrowserActions.closeMenuAndDialogs(); await BrowserActions.click(this.shareNodeButton); } async checkSelectedSiteIsDisplayed(siteName): Promise { await this.siteListDropdown.checkOptionIsSelected(siteName); } async selectSite(siteName: string): Promise { await this.siteListDropdown.selectDropdownOption(siteName); } async clickDownloadButton(): Promise { await BrowserActions.closeMenuAndDialogs(); await BrowserActions.click(this.downloadButton); } async clickMultiSelectToggle() { await BrowserActions.closeMenuAndDialogs(); await BrowserActions.click(this.multiSelectToggle); } async multiSelectToggleIsEnabled(): Promise { return this.multiSelectToggle.isEnabled(); } async clickSelectAllCheckbox(): Promise { await BrowserActions.click(this.selectAllCheckbox); } getRowByName(rowName): ElementFinder { return this.contentList.dataTable.getRow(this.columns.name, rowName); } async selectFolder(folderName: string): Promise { const folderSelected: ElementFinder = element(by.css(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`)); await BrowserVisibility.waitUntilElementIsVisible(folderSelected); await BrowserActions.click(folderSelected); } async selectFolderWithCommandKey(folderName: string): Promise { await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); await this.selectRow(folderName); await browser.actions().sendKeys(protractor.Key.NULL).perform(); } async chooseSelectionMode(option: string): Promise { const dropdownPage = new DropdownPage(this.selectionModeDropdown); await dropdownPage.selectDropdownOption(option); } async getItemSelected(): Promise { return BrowserActions.getArrayText(this.selectedNodesList); } async selectItemWithCheckbox(itemName: string): Promise { const item: ElementFinder = element(by.css(`adf-datatable-row[aria-label="${itemName}"] mat-checkbox .mat-checkbox-input`)); await BrowserVisibility.waitUntilElementIsVisible(item); await BrowserActions.click(item); } async unSelectItemWithCheckbox(itemName: string): Promise { const item: ElementFinder = element(by.css(`adf-datatable-row[aria-label="${itemName} selected"] mat-checkbox .mat-checkbox-input`)); await BrowserVisibility.waitUntilElementIsVisible(item); await BrowserActions.click(item); } }