From 4b4012f3529e8e283b9bd5745c1343da6202b1c4 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Nov 2023 13:34:02 +0000 Subject: [PATCH 1/6] cleanup dead code --- .../src/components/breadcrumb/breadcrumb.ts | 5 - .../src/components/components.ts | 1 - .../src/components/data-table/data-table.ts | 84 ----------------- .../datetime-picker/datetime-picker.ts | 19 +--- .../dialog/create-edit-folder-dialog.ts | 4 - .../dialog/create-from-template-dialog.ts | 83 ----------------- .../dialog/create-library-dialog.ts | 92 ------------------- .../src/components/dialog/index.ts | 4 - .../src/components/dialog/password-dialog.ts | 89 ------------------ .../dialog/select-template-dialog.ts | 64 ------------- 10 files changed, 1 insertion(+), 444 deletions(-) delete mode 100755 projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts delete mode 100755 projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts delete mode 100755 projects/aca-testing-shared/src/components/dialog/password-dialog.ts delete mode 100755 projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts diff --git a/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts b/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts index c058f8de3b..4ee63adee0 100755 --- a/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts +++ b/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts @@ -38,9 +38,4 @@ export class Breadcrumb extends Component { return str.split('\nchevron_right')[0]; }); } - - async clickItem(name: string): Promise { - const elem = this.byCss(`.adf-breadcrumb-item[title=${name}]`); - await elem.click(); - } } diff --git a/projects/aca-testing-shared/src/components/components.ts b/projects/aca-testing-shared/src/components/components.ts index 494a2774ea..988a56ede7 100755 --- a/projects/aca-testing-shared/src/components/components.ts +++ b/projects/aca-testing-shared/src/components/components.ts @@ -28,7 +28,6 @@ export * from './pageLayoutHeader/pageLayoutHeader'; export * from './data-table/data-table'; export * from './dialog/confirm-dialog'; export * from './dialog/create-edit-folder-dialog'; -export * from './dialog/password-dialog'; export * from './pagination/pagination'; export * from './sidenav/sidenav'; export * from './toolbar/toolbar'; diff --git a/projects/aca-testing-shared/src/components/data-table/data-table.ts b/projects/aca-testing-shared/src/components/data-table/data-table.ts index 7f8aca7a68..f0f3fc4181 100755 --- a/projects/aca-testing-shared/src/components/data-table/data-table.ts +++ b/projects/aca-testing-shared/src/components/data-table/data-table.ts @@ -46,14 +46,11 @@ export class DataTable extends Component { head = this.byCss('.adf-datatable-header'); body = this.byCss('.adf-datatable-body'); emptyList = this.byCss('div.adf-no-content-container'); - emptyFolderDragAndDrop = this.byCss('.adf-empty-list_template .adf-empty-folder'); emptyListTitle = this.byCss('.adf-empty-content__title'); emptyListSubtitle = this.byCss('.adf-empty-content__subtitle'); emptySearchText = this.byCss('.empty-search__text'); selectedRow = this.byCss('.adf-datatable-row.adf-is-selected'); - columnModified = this.byCss('.adf-datatable-header [data-automation-id="auto_id_modifiedAt"]'); - menu = new Menu(); constructor(ancestor?: string) { @@ -103,19 +100,6 @@ export class DataTable extends Component { } } - async sortByModified(order: 'asc' | 'desc'): Promise { - let sortOrder = await this.getSortingOrder(); - const sortColumn = await this.getSortedColumnHeaderText(); - - if (sortColumn !== 'Modified') { - await this.columnModified.click(); - sortOrder = await this.getSortingOrder(); - } - if (sortOrder !== order) { - await this.columnModified.click(); - } - } - private getSortedColumnHeader(): ElementFinder { const locator = by.css(DataTable.selectors.sortedColumnHeader); return this.head.element(locator); @@ -150,12 +134,6 @@ export class DataTable extends Component { return this.body.all(by.css('.adf-datatable-row.adf-is-selected')); } - async getSelectedRowsNames(): Promise { - return this.getSelectedRows().map((row) => { - return row.element(by.css('.adf-datatable-cell[title="Name"]')).getText(); - }); - } - async getSelectedRowsCount(): Promise { return this.getSelectedRows().count(); } @@ -174,10 +152,6 @@ export class DataTable extends Component { return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell)); } - async getRowCellsCount(itemName: string): Promise { - return this.getRowCells(itemName).count(); - } - private getRowFirstCell(name: string, location: string = ''): ElementFinder { return this.getRowCells(name, location).get(0); } @@ -218,14 +192,6 @@ export class DataTable extends Component { return ''; } - private getNameLink(itemName: string): ElementFinder { - return this.getRowNameCell(itemName).$('.adf-datatable-link [role="link"]'); - } - - async hasLinkOnName(itemName: string): Promise { - return this.getNameLink(itemName).isPresent(); - } - async doubleClickOnRowByName(name: string, location: string = ''): Promise { try { const item = this.getRowFirstCell(name, location); @@ -262,15 +228,6 @@ export class DataTable extends Component { } } - async clickItem(name: string, location: string = ''): Promise { - const item = this.getRowFirstCell(name, location); - await item.click(); - } - - async clickNameLink(itemName: string): Promise { - await this.getNameLink(itemName).click(); - } - async selectMultipleItems(names: string[], location: string = ''): Promise { await this.clearSelection(); await Utils.pressCmd(); @@ -298,12 +255,6 @@ export class DataTable extends Component { await browser.actions().click(protractor.Button.RIGHT).perform(); } - async rightClickOnMultipleSelection(): Promise { - const itemFromSelection = this.getSelectedRows().get(0); - await browser.actions().mouseMove(itemFromSelection).perform(); - await browser.actions().click(protractor.Button.RIGHT).perform(); - } - private getItemLocationEl(name: string): ElementFinder { return this.getRowByName(name).element(by.css('.aca-location-link')); } @@ -330,14 +281,6 @@ export class DataTable extends Component { return this.emptyList.isPresent(); } - async getEmptyDragAndDropText(): Promise { - const isEmpty = await this.emptyFolderDragAndDrop.isDisplayed(); - if (isEmpty) { - return this.emptyFolderDragAndDrop.getText(); - } - return ''; - } - async getEmptyStateTitle(): Promise { const isEmpty = await this.isEmpty(); if (isEmpty) { @@ -369,11 +312,6 @@ export class DataTable extends Component { }); } - async hasContextMenu(): Promise { - const count = await this.menu.getItemsCount(); - return count > 0; - } - async getLibraryRole(name: string): Promise { return this.getRowByName(name).element(by.css('adf-library-role-column')).getText(); } @@ -413,26 +351,4 @@ export class DataTable extends Component { getNthSearchResultsRow(nth: number): ElementFinder { return this.getSearchResultsRows().get(nth - 1); } - - private getSearchResultsRowByName(name: string, location: string = ''): ElementFinder { - if (location) { - return this.body - .all(by.cssContainingText(DataTable.selectors.searchResultsRow, name)) - .filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location)))) - .first(); - } - return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name)); - } - - private getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder { - return this.getSearchResultsRowByName(itemName, location).$('.aca-link'); - } - - async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise { - return this.getSearchResultNameLink(itemName, location).isPresent(); - } - - async clickSearchResultNameLink(itemName: string, location: string = ''): Promise { - await this.getSearchResultNameLink(itemName, location).click(); - } } diff --git a/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts b/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts index 5858604f76..ee11e4332e 100755 --- a/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts +++ b/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts @@ -29,12 +29,7 @@ import { BrowserActions } from '@alfresco/adf-testing'; export class DateTimePicker extends Component { calendar = this.byCss('.mat-datepicker-popup', browser); - headerTime = this.byCss('.mat-datetimepicker-calendar-header-time'); - headerDate = this.byCss('.mat-datetimepicker-calendar-header-date'); - headerYear = this.byCss('.mat-datetimepicker-calendar-header-year'); dayPicker = this.byCss('mat-month-view'); - hourPicker = this.byCss('.mat-datetimepicker-clock-hours'); - minutePicker = this.byCss('.mat-datetimepicker-clock-minutes'); nextMonthBtn = this.byCss('.mat-calendar-next-button'); rootElemLocator = by.css('.mat-datepicker-popup'); @@ -53,7 +48,7 @@ export class DateTimePicker extends Component { } async pickDateTime(): Promise { - const today = new Date() + const today = new Date(); const nextAvailableDay = new Date(); nextAvailableDay.setDate(today.getDate() + 2); if (nextAvailableDay.getMonth() !== today.getMonth()) { @@ -67,16 +62,4 @@ export class DateTimePicker extends Component { const firstActiveDayElem = this.dayPicker.element(by.cssContainingText(firstActiveDay, `${day}`)); await BrowserActions.click(firstActiveDayElem); } - - async selectHour(hour: number): Promise { - const clockCellClass = '.mat-datetimepicker-clock-cell'; - const selectedHourElem = this.hourPicker.element(by.cssContainingText(clockCellClass, `${hour}`)); - await BrowserActions.click(selectedHourElem); - } - - async selectMinute(minute: number): Promise { - const clockCellClass = '.mat-datetimepicker-clock-cell'; - const selectedMinuteElem = this.minutePicker.element(by.cssContainingText(clockCellClass, `${minute}`)); - await BrowserActions.click(selectedMinuteElem); - } } diff --git a/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts b/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts index 011658a99f..843ed412e3 100755 --- a/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts @@ -49,10 +49,6 @@ export class CreateOrEditFolderDialog extends GenericDialog { return isPresentAndEnabled(this.updateButton); } - async isCreateButtonEnabled(): Promise { - return isPresentAndEnabled(this.createButton); - } - async isCancelButtonEnabled(): Promise { return isPresentAndEnabled(this.cancelButton); } diff --git a/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts b/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts deleted file mode 100755 index 8c68319166..0000000000 --- a/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts +++ /dev/null @@ -1,83 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * 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 { by } from 'protractor'; -import { GenericDialog } from '../dialog/generic-dialog'; -import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils'; -import { BrowserActions } from '@alfresco/adf-testing'; - -export class CreateFromTemplateDialog extends GenericDialog { - createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); - cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'CANCEL')); - - nameInput = this.childElement(by.css('input[formcontrolname="name"]')); - titleInput = this.childElement(by.css('input[formcontrolname="title"]')); - descriptionTextArea = this.childElement(by.css('textarea[formcontrolname="description"]')); - validationMessage = this.childElement(by.css('.mat-error')); - - constructor() { - super('.aca-create-from-template-dialog'); - } - - async isValidationMessageDisplayed(): Promise { - return isPresentAndDisplayed(this.validationMessage); - } - - async isCreateButtonEnabled(): Promise { - return isPresentAndEnabled(this.createButton); - } - - async isCancelButtonEnabled(): Promise { - return isPresentAndEnabled(this.cancelButton); - } - - async getValidationMessage(): Promise { - if (await this.isValidationMessageDisplayed()) { - return this.validationMessage.getText(); - } else { - return ''; - } - } - - async getNameInputValue(): Promise { - return BrowserActions.getInputValue(this.nameInput); - } - - async enterName(name: string): Promise { - await typeText(this.nameInput, name); - } - - async enterTitle(title: string): Promise { - await typeText(this.titleInput, title); - } - - async enterDescription(description: string): Promise { - await typeText(this.descriptionTextArea, description); - } - - async clickCancel(): Promise { - await BrowserActions.click(this.cancelButton); - await this.waitForDialogToClose(); - } -} diff --git a/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts b/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts deleted file mode 100755 index ef6d9036d6..0000000000 --- a/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * 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 { by, ElementFinder } from 'protractor'; -import { GenericDialog } from '../dialog/generic-dialog'; -import { isPresentAndEnabled, typeText } from '../../utilities/utils'; -import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; - -export class CreateLibraryDialog extends GenericDialog { - createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); - cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Cancel')); - - nameInput = this.rootElem.element(by.css('input[formcontrolname="title"]')); - libraryIdInput = this.rootElem.element(by.css('input[formcontrolname="id"]')); - descriptionTextArea = this.rootElem.element(by.css('textarea[formcontrolname="description"]')); - visibilityPublic = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Public')); - visibilityModerated = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Moderated')); - visibilityPrivate = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Private')); - - errorMessage = this.rootElem.element(by.css('.mat-error')); - - constructor() { - super('adf-library-dialog'); - } - - async waitForDialogToOpen(): Promise { - await super.waitForDialogToOpen(); - await BrowserVisibility.waitUntilElementIsClickable(this.nameInput); - } - - async getErrorMessage(): Promise { - if (await this.errorMessage.isDisplayed()) { - return this.errorMessage.getText(); - } - return ''; - } - - async enterName(name: string): Promise { - await typeText(this.nameInput, name); - } - - async enterLibraryId(id: string): Promise { - await typeText(this.libraryIdInput, id); - } - - async enterDescription(description: string): Promise { - await typeText(this.descriptionTextArea, description); - } - - async isCreateEnabled(): Promise { - return isPresentAndEnabled(this.createButton); - } - - async isCancelEnabled(): Promise { - return isPresentAndEnabled(this.cancelButton); - } - - async clickCancel(): Promise { - await BrowserActions.click(this.cancelButton); - await this.waitForDialogToClose(); - } - - private async isChecked(target: ElementFinder): Promise { - const elemClass = await target.element(by.xpath('..')).getAttribute('class'); - return elemClass.includes('mat-radio-checked'); - } - - async isPublicChecked(): Promise { - return this.isChecked(this.visibilityPublic); - } -} diff --git a/projects/aca-testing-shared/src/components/dialog/index.ts b/projects/aca-testing-shared/src/components/dialog/index.ts index 0985fa79f9..76aec9d704 100644 --- a/projects/aca-testing-shared/src/components/dialog/index.ts +++ b/projects/aca-testing-shared/src/components/dialog/index.ts @@ -25,12 +25,8 @@ export * from './confirm-dialog'; export * from './content-node-selector-dialog'; export * from './create-edit-folder-dialog'; -export * from './create-from-template-dialog'; -export * from './create-library-dialog'; export * from './generic-dialog'; export * from './manage-versions-dialog'; -export * from './password-dialog'; -export * from './select-template-dialog'; export * from './share-dialog'; export * from './upload-new-version-dialog'; export * from './upload-files-dialog'; diff --git a/projects/aca-testing-shared/src/components/dialog/password-dialog.ts b/projects/aca-testing-shared/src/components/dialog/password-dialog.ts deleted file mode 100755 index fd99629b49..0000000000 --- a/projects/aca-testing-shared/src/components/dialog/password-dialog.ts +++ /dev/null @@ -1,89 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * 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 { by, browser } from 'protractor'; -import { GenericDialog } from '../dialog/generic-dialog'; -import { isPresentAndEnabled, typeText } from '../../utilities/utils'; -import { BrowserVisibility } from '@alfresco/adf-testing'; - -export class PasswordDialog extends GenericDialog { - closeButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-close"]')); - submitButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-submit"]')); - passwordInput = this.childElement(by.css('input[type="Password"]')); - errorMessage = this.childElement(by.css('.mat-error')); - - constructor() { - super('adf-pdf-viewer-password-dialog'); - } - - async waitForDialogToOpen(): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.passwordInput); - } - - async isDialogOpen(): Promise { - try { - await this.waitForDialogToOpen(); - return true; - } catch (error) { - return false; - } - } - - async isCloseEnabled(): Promise { - return isPresentAndEnabled(this.closeButton); - } - - async isSubmitEnabled(): Promise { - return isPresentAndEnabled(this.submitButton); - } - - async isPasswordInputDisplayed(): Promise { - const present = await browser.isElementPresent(this.passwordInput); - if (present) { - return this.passwordInput.isDisplayed(); - } else { - return false; - } - } - - async isErrorDisplayed(): Promise { - try { - await this.waitForDialogToOpen(); - return (await this.errorMessage.isPresent()) && (await this.errorMessage.isDisplayed()); - } catch (error) { - return false; - } - } - - async getErrorMessage(): Promise { - if (await this.isErrorDisplayed()) { - return this.errorMessage.getText(); - } - return ''; - } - - async enterPassword(password: string): Promise { - await typeText(this.passwordInput, password); - } -} diff --git a/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts b/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts deleted file mode 100755 index 6228fc0249..0000000000 --- a/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * 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 { by } from 'protractor'; -import { GenericDialog } from '../dialog/generic-dialog'; -import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; -import { DataTable } from '../data-table/data-table'; -import { isPresentAndEnabled } from '../../utilities/utils'; -import { BrowserActions } from '@alfresco/adf-testing'; - -export class SelectTemplateDialog extends GenericDialog { - nextButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-choose"]')); - cancelButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-cancel"]')); - - breadcrumb = new DropDownBreadcrumb(); - dataTable = new DataTable('.aca-template-node-selector-dialog'); - - constructor() { - super('.aca-template-node-selector-dialog'); - } - - get content() { - return this.rootElem.element(by.css('.adf-content-node-selector-content')); - } - - async isCancelButtonEnabled(): Promise { - return isPresentAndEnabled(this.cancelButton); - } - - async isNextButtonEnabled(): Promise { - return isPresentAndEnabled(this.nextButton); - } - - async clickCancel(): Promise { - await BrowserActions.click(this.cancelButton); - await this.waitForDialogToClose(); - } - - async clickNext(): Promise { - await BrowserActions.click(this.nextButton); - await this.waitForDialogToClose(); - } -} From 64c028332c2af96e2d1955d1645baf26eb13640b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Nov 2023 13:38:07 +0000 Subject: [PATCH 2/6] cleanup dead code --- .../info-drawer/info-drawer-comments-tab.ts | 9 ---- .../info-drawer-metadata-content.ts | 48 +------------------ .../src/components/login/login.ts | 18 ------- .../src/components/menu/menu.ts | 30 +----------- 4 files changed, 3 insertions(+), 102 deletions(-) diff --git a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts index 6d26863fa9..016bca96a4 100755 --- a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts +++ b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts @@ -101,11 +101,6 @@ export class CommentsTab extends Component { return time.getText(); } - async getNthCommentId(index: number): Promise { - const list = this.allByCss('.adf-comment-list-item'); - return list.get(index - 1).getAttribute('id'); - } - async getNthCommentText(index: number): Promise { const list = this.allByCss('mat-list-item .adf-comment-message'); return list.get(index - 1).getText(); @@ -118,8 +113,4 @@ export class CommentsTab extends Component { async clickAddButton(): Promise { await BrowserActions.click(this.addCommentButton); } - - async getCommentTextFromTextArea(): Promise { - return BrowserActions.getInputValue(this.commentTextarea); - } } diff --git a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts index 8ffd74ee7b..04dbbbf0a3 100755 --- a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts +++ b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts @@ -22,18 +22,14 @@ * along with Alfresco. If not, see . */ -import { by, browser, ElementFinder } from 'protractor'; +import { browser } from 'protractor'; import { Component } from '../component'; -import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils'; -import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; +import { isPresentAndEnabled } from '../../utilities/utils'; export class ContentMetadata extends Component { expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded'); - editPropertiesButton = this.byCss(`button[title='Edit']`); lessInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'Less information'); moreInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'More information'); - imagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`); - expandedImagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`); constructor(ancestor?: string) { super('adf-content-metadata-card', ancestor); @@ -43,32 +39,6 @@ export class ContentMetadata extends Component { return browser.isElementPresent(this.expandedPanel); } - async waitForImagePropertiesPanelToExpand(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.expandedImagePropertiesPanel); - } - - async getVisiblePropertiesLabels(): Promise { - return this.allByCss('.adf-property-label') - .filter(async (elem) => elem.isDisplayed()) - .map(async (elem) => elem.getText()); - } - - async getVisiblePropertiesValues() { - return this.allByCss('.adf-property-value') - .filter(async (elem) => elem.isDisplayed()) - .map(async (elem) => { - if (await elem.isElementPresent(by.css('.mat-checkbox'))) { - return !!(await elem.isElementPresent(by.css('.mat-checkbox-checked'))); - } - - return this.getElementValue(elem); - }); - } - - async isEditPropertiesButtonEnabled(): Promise { - return isPresentAndEnabled(this.editPropertiesButton); - } - async isLessInfoButtonEnabled(): Promise { return isPresentAndEnabled(this.lessInfoButton); } @@ -80,18 +50,4 @@ export class ContentMetadata extends Component { async isMoreInfoButtonDisplayed(): Promise { return browser.isElementPresent(this.moreInfoButton); } - - async isImagePropertiesPanelDisplayed(): Promise { - return isPresentAndDisplayed(this.imagePropertiesPanel); - } - - private async getElementValue(elem: ElementFinder): Promise { - const tagName = await elem.getTagName(); - - if (tagName === 'input' || tagName === 'textarea') { - return BrowserActions.getInputValue(elem); - } - - return elem.getText(); - } } diff --git a/projects/aca-testing-shared/src/components/login/login.ts b/projects/aca-testing-shared/src/components/login/login.ts index 0878f5debe..22244740ea 100755 --- a/projects/aca-testing-shared/src/components/login/login.ts +++ b/projects/aca-testing-shared/src/components/login/login.ts @@ -30,7 +30,6 @@ export class LoginComponent extends Component { passwordInput = this.byCss('input#password'); submitButton = this.byCss('button#login-button'); copyright = this.byCss('.adf-copyright'); - passwordVisibility = this.byCss('.adf-login-password-icon'); constructor(ancestor?: string) { super('adf-login', ancestor); @@ -48,21 +47,4 @@ export class LoginComponent extends Component { await this.enterUsername(username); await this.enterPassword(password); } - - private async getPasswordVisibility(): Promise { - const text = await this.passwordVisibility.getText(); - return text.endsWith('visibility'); - } - - async isPasswordDisplayed(): Promise { - const type = await this.passwordInput.getAttribute('type'); - if (type === 'text') { - return true; - } - return false; - } - - async isPasswordHidden() { - return !(await this.getPasswordVisibility()); - } } diff --git a/projects/aca-testing-shared/src/components/menu/menu.ts b/projects/aca-testing-shared/src/components/menu/menu.ts index 3d420291d4..780b26a286 100755 --- a/projects/aca-testing-shared/src/components/menu/menu.ts +++ b/projects/aca-testing-shared/src/components/menu/menu.ts @@ -25,7 +25,7 @@ import { ElementFinder, by, browser } from 'protractor'; import { Logger, BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; import { Component } from '../component'; -import { Utils, isPresentAndEnabled, waitForPresence, waitForStaleness } from '../../utilities/utils'; +import { Utils, waitForPresence, waitForStaleness } from '../../utilities/utils'; export class Menu extends Component { items = this.allByCss('.mat-menu-item'); @@ -33,7 +33,6 @@ export class Menu extends Component { uploadFilesInput = this.byId('app-upload-files', browser); submenus = browser.element.all(by.css('app-context-menu-item .mat-menu-item')); createFolderAction = this.byId('app.create.folder'); - createLibraryAction = this.byId('app.create.library'); createFileFromTemplateAction = this.byId('app.create.fileFromTemplate'); createFolderFromTemplateAction = this.byId('app.create.folderFromTemplate'); @@ -75,10 +74,6 @@ export class Menu extends Component { return this.byId(id); } - async getItemTooltip(menuItem: string): Promise { - return this.getItemByLabel(menuItem).getAttribute('title'); - } - async getItemIconText(menuItem: string): Promise { return this.getItemByLabel(menuItem).element(by.css('.mat-icon')).getText(); } @@ -91,13 +86,6 @@ export class Menu extends Component { return this.items.count(); } - async getMenuItems(): Promise { - return this.items.map(async (elem) => { - const span = elem.element(by.css('span')); - return span.getText(); - }); - } - async clickNthItem(nth: number): Promise { try { const elem = this.getNthItem(nth); @@ -163,20 +151,4 @@ export class Menu extends Component { return null; } } - - async isCreateFolderEnabled(): Promise { - return isPresentAndEnabled(this.createFolderAction); - } - - async isCreateLibraryEnabled(): Promise { - return isPresentAndEnabled(this.createLibraryAction); - } - - async isCreateFileFromTemplateEnabled(): Promise { - return isPresentAndEnabled(this.createFileFromTemplateAction); - } - - async isCreateFolderFromTemplateEnabled(): Promise { - return isPresentAndEnabled(this.createFolderFromTemplateAction); - } } From 4563ce86a73a2fadaad710ce8be0761ac4fac3b8 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Nov 2023 13:44:14 +0000 Subject: [PATCH 3/6] cleanup dead code --- projects/aca-testing-shared/src/configs.ts | 4 - .../src/pages/search-results-page.ts | 26 ---- .../src/utilities/admin-actions.ts | 143 +----------------- .../src/utilities/browser-utils.ts | 38 ----- .../aca-testing-shared/src/utilities/index.ts | 1 - .../src/utilities/user-actions.ts | 38 +---- .../aca-testing-shared/src/utilities/utils.ts | 4 - 7 files changed, 3 insertions(+), 251 deletions(-) delete mode 100644 projects/aca-testing-shared/src/utilities/browser-utils.ts diff --git a/projects/aca-testing-shared/src/configs.ts b/projects/aca-testing-shared/src/configs.ts index e57262f6aa..91958deb04 100755 --- a/projects/aca-testing-shared/src/configs.ts +++ b/projects/aca-testing-shared/src/configs.ts @@ -27,10 +27,6 @@ export const BROWSER_WAIT_TIMEOUT = 10000; // Application configs export const USE_HASH_STRATEGY = true; -// Dates -export const DATE_FORMAT = 'MMM D, YYYY'; -export const DATE_TIME_FORMAT = 'MMM D, YYYY, H:mm'; - // Application Routes export const APP_ROUTES = { FAVORITES: '/favorites', diff --git a/projects/aca-testing-shared/src/pages/search-results-page.ts b/projects/aca-testing-shared/src/pages/search-results-page.ts index 566d291480..94d753a279 100755 --- a/projects/aca-testing-shared/src/pages/search-results-page.ts +++ b/projects/aca-testing-shared/src/pages/search-results-page.ts @@ -22,11 +22,9 @@ * along with Alfresco. If not, see . */ -import { by } from 'protractor'; import { BrowsingPage } from './browsing-page'; import { SearchSortingPicker } from '../components/search/search-sorting-picker'; import { SearchFilters } from '../components/search/search-filters'; -import { BrowserActions } from '@alfresco/adf-testing'; export class SearchResultsPage extends BrowsingPage { root = this.byCss('aca-search-results'); @@ -36,28 +34,4 @@ export class SearchResultsPage extends BrowsingPage { async waitForResults(): Promise { await this.dataTable.waitForBody(); } - - async getName(name: string): Promise { - return this.dataTable.getRowByName(name).element(by.css('[title="Name"] div.search-file-name')).getText(); - } - - async getDescription(name: string): Promise { - return this.dataTable.getRowByName(name).element(by.css('[title="Description"]')).getText(); - } - - async getModified(name: string): Promise { - return BrowserActions.getAttribute(this.dataTable.getRowByName(name).element(by.css('[title="Modified"] span')), 'title'); - } - - async getSize(name: string): Promise { - return this.dataTable.getRowByName(name).element(by.css('[title="Size"]')).getText(); - } - - async getModifiedBy(name: string): Promise { - return this.dataTable.getRowByName(name).element(by.css('[title="Modified by"]')).getText(); - } - - async getLocation(name: string): Promise { - return this.dataTable.getRowByName(name).element(by.css('[title="Name"] a')).getText(); - } } diff --git a/projects/aca-testing-shared/src/utilities/admin-actions.ts b/projects/aca-testing-shared/src/utilities/admin-actions.ts index 3c413b427a..982054c629 100755 --- a/projects/aca-testing-shared/src/utilities/admin-actions.ts +++ b/projects/aca-testing-shared/src/utilities/admin-actions.ts @@ -22,8 +22,8 @@ * along with Alfresco. If not, see . */ -import { PersonEntry, NodeEntry, PeopleApi } from '@alfresco/js-api'; -import { PersonModel, SitesApi, UploadApi, NodesApi, NodeContentTree, Person, SharedLinksApi } from './repo-client/apis'; +import { PersonEntry, PeopleApi } from '@alfresco/js-api'; +import { PersonModel, SitesApi, UploadApi, NodesApi, Person, SharedLinksApi } from './repo-client/apis'; import { UserActions } from './user-actions'; import { browser } from 'protractor'; @@ -37,31 +37,6 @@ export class AdminActions extends UserActions { return super.login(username || browser.params.ADMIN_USERNAME, password || browser.params.ADMIN_PASSWORD); } - private async getDataDictionaryId(): Promise { - return this.nodes.getNodeIdFromParent('Data Dictionary', '-root-').catch((error) => { - super.handleError('Admin Actions - getDataDictionaryId failed : ', error); - return ''; - }); - } - - async getNodeTemplatesFolderId(): Promise { - try { - return this.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId()); - } catch (error) { - super.handleError('Admin Actions - getNodeTemplatesFolderId failed : ', error); - return ''; - } - } - - async getSpaceTemplatesFolderId(): Promise { - try { - return this.nodes.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId()); - } catch (error) { - super.handleError('Admin Actions - getSpaceTemplatesFolderId failed : ', error); - return ''; - } - } - async createUser(user: PersonModel): Promise { const person = new Person(user); const peopleApi = new PeopleApi(this.alfrescoApi); @@ -74,118 +49,4 @@ export class AdminActions extends UserActions { return null; } } - - async disableUser(username: string): Promise { - const peopleApi = new PeopleApi(this.alfrescoApi); - - await this.login(); - try { - return peopleApi.updatePerson(username, { enabled: false }); - } catch (error) { - super.handleError('Admin Actions - createUser failed : ', error); - return null; - } - } - - async changePassword(username: string, newPassword: string): Promise { - const peopleApi = new PeopleApi(this.alfrescoApi); - - await this.login(); - try { - return peopleApi.updatePerson(username, { password: newPassword }); - } catch (error) { - super.handleError('Admin Actions - changePassword failed : ', error); - return null; - } - } - - async createNodeTemplatesHierarchy(hierarchy: NodeContentTree): Promise { - return this.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`).catch((error) => { - super.handleError('Admin Actions - createNodeTemplatesHierarchy failed : ', error); - }); - } - - async createSpaceTemplatesHierarchy(hierarchy: NodeContentTree): Promise { - return this.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`).catch((error) => { - super.handleError('Admin Actions - createSpaceTemplatesHierarchy failed : ', error); - }); - } - - async removeUserAccessOnNodeTemplate(nodeName: string): Promise { - try { - const templatesRootFolderId = await this.getNodeTemplatesFolderId(); - const nodeId: string = await this.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId); - - return this.nodes.setInheritPermissions(nodeId, false); - } catch (error) { - super.handleError('Admin Actions - removeUserAccessOnNodeTemplate failed : ', error); - return null; - } - } - - async removeUserAccessOnSpaceTemplate(nodeName: string): Promise { - try { - const templatesRootFolderId = await this.getSpaceTemplatesFolderId(); - const nodeId: string = await this.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId); - - return this.nodes.setInheritPermissions(nodeId, false); - } catch (error) { - super.handleError('Admin Actions - removeUserAccessOnSpaceTemplate failed : ', error); - return null; - } - } - - async cleanupNodeTemplatesItems(nodeNames: string[]): Promise { - try { - const templatesFolderId = await this.getNodeTemplatesFolderId(); - for (const nodeName of nodeNames) { - const nodeId = await this.nodes.getNodeIdFromParent(nodeName, templatesFolderId); - await this.nodes.deleteNodeById(nodeId); - } - } catch (error) { - super.handleError('Admin Actions - cleanupNodeTemplatesItems failed : ', error); - } - } - - async cleanupSpaceTemplatesItems(nodeNames: string[]): Promise { - try { - const spaceTemplatesNodeId = await this.getSpaceTemplatesFolderId(); - for (const nodeName of nodeNames) { - const nodeId = await this.nodes.getNodeIdFromParent(nodeName, spaceTemplatesNodeId); - await this.nodes.deleteNodeById(nodeId); - } - } catch (error) { - super.handleError('Admin Actions - cleanupSpaceTemplatesFolder failed : ', error); - } - } - - async createLinkToFileName(originalFileName: string, originalFileParentId: string, destinationParentId?: string): Promise { - if (!destinationParentId) { - destinationParentId = originalFileParentId; - } - - try { - const nodeId = await this.nodes.getNodeIdFromParent(originalFileName, originalFileParentId); - - return this.nodes.createFileLink(nodeId, destinationParentId); - } catch (error) { - super.handleError('Admin Actions - createLinkToFileName failed : ', error); - return null; - } - } - - async createLinkToFolderName(originalFolderName: string, originalFolderParentId: string, destinationParentId?: string): Promise { - if (!destinationParentId) { - destinationParentId = originalFolderParentId; - } - - try { - const nodeId = await this.nodes.getNodeIdFromParent(originalFolderName, originalFolderParentId); - - return this.nodes.createFolderLink(nodeId, destinationParentId); - } catch (error) { - super.handleError('Admin Actions - createLinkToFolderName failed : ', error); - return null; - } - } } diff --git a/projects/aca-testing-shared/src/utilities/browser-utils.ts b/projects/aca-testing-shared/src/utilities/browser-utils.ts deleted file mode 100644 index 0742e2f834..0000000000 --- a/projects/aca-testing-shared/src/utilities/browser-utils.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * 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 { browser } from 'protractor'; -import { USE_HASH_STRATEGY } from '../configs'; - -export async function navigate(relativePath: string) { - const path = [ - browser.baseUrl, - browser.baseUrl.endsWith('/') ? '' : '/', - USE_HASH_STRATEGY ? '#' : '', - relativePath.startsWith('/') ? '' : '/', - relativePath - ].join(''); - - return browser.get(path); -} diff --git a/projects/aca-testing-shared/src/utilities/index.ts b/projects/aca-testing-shared/src/utilities/index.ts index 61eca7548b..5374657021 100644 --- a/projects/aca-testing-shared/src/utilities/index.ts +++ b/projects/aca-testing-shared/src/utilities/index.ts @@ -26,5 +26,4 @@ export * from './repo-client/apis'; export * from './repo-client/repo-client'; export * from './admin-actions'; export * from './user-actions'; -export * from './browser-utils'; export * from './utils'; diff --git a/projects/aca-testing-shared/src/utilities/user-actions.ts b/projects/aca-testing-shared/src/utilities/user-actions.ts index 2fded960bb..2f60a10c55 100644 --- a/projects/aca-testing-shared/src/utilities/user-actions.ts +++ b/projects/aca-testing-shared/src/utilities/user-actions.ts @@ -23,9 +23,8 @@ */ import { Logger } from '@alfresco/adf-testing'; -import { AlfrescoApi, Comment, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi, SiteEntry } from '@alfresco/js-api'; +import { AlfrescoApi, Comment, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi } from '@alfresco/js-api'; import { browser } from 'protractor'; -import { SITE_VISIBILITY } from '../configs'; import { Utils } from './utils'; export class UserActions { @@ -62,15 +61,6 @@ export class UserActions { } } - async logout(): Promise { - try { - await this.alfrescoApi.login(this.username, this.password); - return this.alfrescoApi.logout(); - } catch (error) { - this.handleError('User Actions - logout failed : ', error); - } - } - async createComment(nodeId: string, content: string): Promise { try { const comment = await this.commentsApi.createComment(nodeId, { content }); @@ -180,32 +170,6 @@ export class UserActions { } } - /** - * Create multiple sites - * @param siteNames The list of the site names - * @param visibility Default site visibility - * @returns List of site entries - */ - async createSites(siteNames: string[], visibility?: string): Promise { - const sites: SiteEntry[] = []; - - try { - if (siteNames && siteNames.length > 0) { - for (const siteName of siteNames) { - const site = await this.sitesApi.createSite({ - title: siteName, - visibility: visibility || SITE_VISIBILITY.PUBLIC, - id: siteName - }); - sites.push(site); - } - } - } catch (error) { - this.handleError(`User Actions - createSites failed : `, error); - } - return sites; - } - /** * Delete multiple sites/libraries. * @param siteIds The list of the site/library IDs to delete. diff --git a/projects/aca-testing-shared/src/utilities/utils.ts b/projects/aca-testing-shared/src/utilities/utils.ts index 4043218f76..74931f54a1 100644 --- a/projects/aca-testing-shared/src/utilities/utils.ts +++ b/projects/aca-testing-shared/src/utilities/utils.ts @@ -86,10 +86,6 @@ export class Utils { return crypto.getRandomValues(new Uint32Array(1))[0].toString(36).substring(0, 5).toLowerCase(); } - static async clearLocalStorage(): Promise { - await browser.executeScript('window.localStorage.clear();'); - } - static async setSessionStorageFromConfig(configFileName: string): Promise { const configFile = `${browser.params.e2eRootPath}/resources/extensibility-configs/${configFileName}`; const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' })); From b2289fd17b3b5be3f3a438ad9b3041ad2040a170 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Nov 2023 13:47:55 +0000 Subject: [PATCH 4/6] cleanup dead code --- .../src/components/sidenav/sidenav.ts | 32 ------------------- .../src/components/toolbar/toolbar.ts | 32 ------------------- .../src/components/viewer/viewer.ts | 10 ------ 3 files changed, 74 deletions(-) diff --git a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts index 1afb03f413..eafbe7d378 100755 --- a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts +++ b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts @@ -26,7 +26,6 @@ import { ElementFinder, by, element, browser, By } from 'protractor'; import { Logger, BrowserActions } from '@alfresco/adf-testing'; import { Menu } from '../menu/menu'; import { Component } from '../component'; -import { waitElement } from '../../utilities'; export class Sidenav extends Component { links = this.component.all(by.css('.item')); @@ -39,7 +38,6 @@ export class Sidenav extends Component { recentFiles = this.byCss(`[data-automation-id='app.navbar.recentFiles']`); favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`); trash = this.byCss(`[data-automation-id='app.navbar.trashcan']`); - sidenavToggle = this.byCss(`.aca-sidenav-header-title-logo`); menu: Menu = new Menu(); @@ -47,36 +45,11 @@ export class Sidenav extends Component { super('app-sidenav', ancestor); } - async isSidenavExpanded(): Promise { - return browser.isElementPresent(by.css(`[data-automation-id='expanded']`)); - } - - async expandSideNav(): Promise { - const expanded = await this.isSidenavExpanded(); - if (!expanded) { - await BrowserActions.click(this.sidenavToggle); - await waitElement(`[data-automation-id='expanded']`); - } - } - - async collapseSideNav(): Promise { - const expanded = await this.isSidenavExpanded(); - if (expanded) { - await BrowserActions.click(this.sidenavToggle); - await waitElement(`[data-automation-id='collapsed']`); - } - } - async openNewMenu(): Promise { await BrowserActions.click(this.newButton); await this.menu.waitForMenuToOpen(); } - async closeNewMenu(): Promise { - await BrowserActions.click(element(by.css('button[id="app.toolbar.create"] span span'))); - await this.menu.waitForMenuToClose(); - } - async openCreateFolderDialog(): Promise { await this.openNewMenu(); await BrowserActions.click(this.menu.createFolderAction); @@ -108,11 +81,6 @@ export class Sidenav extends Component { } } - async getLinkTooltip(name: string): Promise { - const link = this.getLinkLabel(name); - return link.getAttribute('title'); - } - async clickLink(name: string): Promise { try { const link = this.getLinkLabel(name); diff --git a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts index 092fdb7451..1671d39c75 100755 --- a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts +++ b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts @@ -35,11 +35,9 @@ export class Toolbar extends Component { createButton = element(By.css('[id="app.toolbar.create"]')); uploadButton = element(By.css('[id="app.toolbar.upload"]')); shareButton = element(By.css('button[data-automation-id="share-action-button"]')); - viewButton = element(By.css(`button[title='View']`)); downloadButton = element(By.css(`.mat-icon-button[title='Download']`)); viewDetailsButton = element(By.css(`button[title='View Details']`)); printButton = element(By.css(`button[title='Print']`)); - fullScreenButton = element(By.css(`button[title='Activate full-screen mode']`)); joinButton = element(By.css(`button[title='Join']`)); leaveButton = element(By.css(`button[title='Leave Library']`)); permanentlyDeleteButton = element(By.css(`button[title='Permanently Delete']`)); @@ -51,17 +49,6 @@ export class Toolbar extends Component { super('aca-toolbar', ancestor); } - async isEmpty(): Promise { - const count = await this.buttons.count(); - return count === 0; - } - - async getButtons(): Promise { - return this.buttons.map(async (elem) => { - return elem.getAttribute('title'); - }); - } - async isButtonPresent(title: string) { const element = this.byCss(`button[title="${title}"]`); return element.isPresent(); @@ -113,25 +100,6 @@ export class Toolbar extends Component { return browser.isElementPresent(this.printButton); } - async openCreateFolderDialog(): Promise { - await this.openCreateMenu(); - await BrowserActions.click(this.menu.createFolderAction); - } - - async openCreateFileFromTemplateDialog(): Promise { - await this.openCreateMenu(); - await BrowserActions.click(this.menu.createFileFromTemplateAction); - } - - async openCreateFolderFromTemplateDialog(): Promise { - await this.openCreateMenu(); - await BrowserActions.click(this.menu.createFolderFromTemplateAction); - } - - async openCreateMenu(): Promise { - await BrowserActions.click(this.createButton); - await this.menu.waitForMenuToOpen(); - } async openUploadMenu(): Promise { await BrowserActions.click(this.uploadButton); await this.menu.waitForMenuToOpen(); diff --git a/projects/aca-testing-shared/src/components/viewer/viewer.ts b/projects/aca-testing-shared/src/components/viewer/viewer.ts index 7c33ebe9de..54d0467dda 100755 --- a/projects/aca-testing-shared/src/components/viewer/viewer.ts +++ b/projects/aca-testing-shared/src/components/viewer/viewer.ts @@ -35,7 +35,6 @@ export class Viewer extends Component { closeButton = this.byCss('.adf-viewer-close-button'); fileTitle = this.byCss('.adf-viewer__file-title'); viewerExtensionContent = this.byCss('adf-preview-extension'); - pdfViewerContentPages = this.allByCss('.adf-pdf-viewer__content .page'); txtViewerContent = this.byCss('.adf-txt-viewer-content'); toolbar = new Toolbar('adf-viewer'); @@ -87,10 +86,6 @@ export class Viewer extends Component { return browser.isElementPresent(this.fileTitle); } - async getCloseButtonTooltip(): Promise { - return this.toolbar.getButtonTooltip(this.closeButton); - } - async getFileTitle(): Promise { return this.fileTitle.getText(); } @@ -107,11 +102,6 @@ export class Viewer extends Component { return ''; } - async isPdfViewerContentDisplayed(): Promise { - const count = await this.pdfViewerContentPages.count(); - return count > 0; - } - async clickCloseButton(): Promise { const closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-toolbar-back"]')); await BrowserActions.click(closeButton); From 529494930c9ca5e6e3221957dbc3d92542592d37 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Nov 2023 13:50:46 +0000 Subject: [PATCH 5/6] cleanup dead code --- .../src/components/menu/menu.ts | 2 - .../search/filters/created-date-filter.ts | 51 ------------------- 2 files changed, 53 deletions(-) diff --git a/projects/aca-testing-shared/src/components/menu/menu.ts b/projects/aca-testing-shared/src/components/menu/menu.ts index 780b26a286..95b60e3b2e 100755 --- a/projects/aca-testing-shared/src/components/menu/menu.ts +++ b/projects/aca-testing-shared/src/components/menu/menu.ts @@ -33,8 +33,6 @@ export class Menu extends Component { uploadFilesInput = this.byId('app-upload-files', browser); submenus = browser.element.all(by.css('app-context-menu-item .mat-menu-item')); createFolderAction = this.byId('app.create.folder'); - createFileFromTemplateAction = this.byId('app.create.fileFromTemplate'); - createFolderFromTemplateAction = this.byId('app.create.folderFromTemplate'); cancelEditingAction = this.byCss(`.mat-menu-item[title='Cancel Editing']`); copyAction = this.byTitleAttr('Copy'); diff --git a/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts b/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts index c5f5f9dd21..44ca03409c 100755 --- a/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts @@ -22,61 +22,10 @@ * along with Alfresco. If not, see . */ -import { by, ElementFinder, protractor } from 'protractor'; import { GenericFilter } from './generic-filter'; -import { isPresentAndDisplayed } from '../../../utilities/utils'; -import { BrowserActions } from '@alfresco/adf-testing'; export class CreatedDateFilter extends GenericFilter { constructor() { super('Created date'); } - - fromField: ElementFinder = this.filterDialogOpened.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'From')); - fromInput: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-input']`)); - fromFieldError: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-error']`)); - toField: ElementFinder = this.filterDialogOpened.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'To')); - toInput: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-input']`)); - toFieldError: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-error']`)); - async isFromErrorDisplayed(): Promise { - return isPresentAndDisplayed(this.fromFieldError); - } - async isToErrorDisplayed(): Promise { - return isPresentAndDisplayed(this.toFieldError); - } - - async getFromValue(): Promise { - return BrowserActions.getInputValue(this.fromInput); - } - - async getFromError(): Promise { - try { - return await this.fromFieldError.getText(); - } catch (err) { - return ''; - } - } - - async getToValue(): Promise { - return BrowserActions.getInputValue(this.fromInput); - } - - async getToError(): Promise { - try { - return await this.toFieldError.getText(); - } catch (err) { - return ''; - } - } - async enterFromDate(date: string): Promise { - await this.openDialog(); - await BrowserActions.clearWithBackSpace(this.fromInput); - await this.fromInput.sendKeys(date, protractor.Key.TAB); - } - - async enterToDate(date: string): Promise { - await this.openDialog(); - await BrowserActions.clearWithBackSpace(this.toInput); - await this.toInput.sendKeys(date, protractor.Key.TAB); - } } From 82383c2950d9685f149a3fd459fef25250a851c6 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Nov 2023 13:59:23 +0000 Subject: [PATCH 6/6] cleanup dead code --- .../src/components/sidenav/sidenav.ts | 2 + .../apis/favorites/favorites-api.ts | 10 ---- .../repo-client/apis/nodes/nodes-api.ts | 58 ------------------- .../repo-client/apis/sites/sites-api.ts | 19 ------ .../src/utilities/repo-client/repo-client.ts | 5 -- 5 files changed, 2 insertions(+), 92 deletions(-) diff --git a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts index eafbe7d378..f7d6b4a918 100755 --- a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts +++ b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts @@ -54,10 +54,12 @@ export class Sidenav extends Component { await this.openNewMenu(); await BrowserActions.click(this.menu.createFolderAction); } + async isActive(name: string): Promise { const cssClass = await this.getLinkLabel(name).getAttribute('class'); return cssClass.includes('action-button--active'); } + private getLinkLabel(name: string): ElementFinder { switch (name) { case 'Personal Files': diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts index b2d8152a65..c2a278c9d2 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts @@ -93,16 +93,6 @@ export class FavoritesApi extends RepoApi { } } - async getFavoriteById(nodeId: string) { - try { - await this.apiAuth(); - return await this.favoritesApi.getFavorite('-me-', nodeId); - } catch (error) { - this.handleError(`FavoritesApi getFavoriteById : catch : `, error); - return null; - } - } - async isFavorite(nodeId: string) { try { return JSON.stringify((await this.getFavorites()).list.entries).includes(nodeId); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts index 79e9d40db6..8039da2421 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts @@ -74,16 +74,6 @@ export class NodesApi extends RepoApi { } } - async getNodeTitle(name: string, parentId: string): Promise { - try { - const children = (await this.getNodeChildren(parentId)).list.entries; - return children.find((elem) => elem.entry.name === name).entry.properties['cm:title']; - } catch (error) { - this.handleError(`${this.constructor.name} ${this.getNodeTitle.name}`, error); - return ''; - } - } - async getNodeProperty(nodeId: string, property: string): Promise { try { const node = await this.getNodeById(nodeId); @@ -341,27 +331,6 @@ export class NodesApi extends RepoApi { } } - async createFileLink(originalNodeId: string, destinationId: string): Promise { - const name = (await this.getNodeById(originalNodeId)).entry.name; - const nodeBody = { - name: `Link to ${name}.url`, - nodeType: 'app:filelink', - properties: { - 'cm:destination': originalNodeId - } - }; - - try { - await this.apiAuth(); - const link = await this.nodesApi.createNode(destinationId, nodeBody); - await this.addAspects(originalNodeId, ['app:linked']); - return link; - } catch (error) { - this.handleError(`${this.constructor.name} ${this.createFileLink.name}`, error); - return null; - } - } - async createFolderLink(originalNodeId: string, destinationId: string): Promise { const name = (await this.getNodeById(originalNodeId)).entry.name; const nodeBody = { @@ -407,33 +376,6 @@ export class NodesApi extends RepoApi { } } - async renameNode(nodeId: string, newName: string): Promise { - try { - await this.apiAuth(); - return this.nodesApi.updateNode(nodeId, { name: newName }); - } catch (error) { - this.handleError(`${this.constructor.name} ${this.renameNode.name}`, error); - return null; - } - } - - // node permissions - async setInheritPermissions(nodeId: string, inheritPermissions: boolean): Promise { - const data = { - permissions: { - isInheritanceEnabled: inheritPermissions - } - }; - - try { - await this.apiAuth(); - return await this.nodesApi.updateNode(nodeId, data); - } catch (error) { - this.handleError(`${this.constructor.name} ${this.setGranularPermission.name}`, error); - return null; - } - } - async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string): Promise { const data = { permissions: { diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts index cb5ba4c7e6..cd0d350ea1 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts @@ -118,21 +118,6 @@ export class SitesApi extends RepoApi { } } - async deleteAllUserSites(permanent: boolean = true) { - try { - await this.apiAuth(); - const sites = await this.sitesApi.listSiteMembershipsForPerson(this.username); - const siteIds = sites.list.entries.map((entries) => entries.entry.id); - - return await siteIds.reduce(async (previous, current) => { - await previous; - return this.deleteSite(current, permanent); - }, Promise.resolve()); - } catch (error) { - this.handleError(`SitesApi deleteAllUserSites : catch : `, error); - } - } - async updateSiteMember(siteId: string, userId: string, role: string) { const siteRole = { role: role @@ -178,10 +163,6 @@ export class SitesApi extends RepoApi { return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_COLLABORATOR.ROLE); } - async addSiteManager(siteId: string, userId: string): Promise { - return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_MANAGER.ROLE); - } - async deleteSiteMember(siteId: string, userId: string) { try { await this.apiAuth(); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/repo-client.ts b/projects/aca-testing-shared/src/utilities/repo-client/repo-client.ts index eb79320fc4..5ce7ce3cf2 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/repo-client.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/repo-client.ts @@ -69,11 +69,6 @@ export class RepoClient { return new UploadApi(this.username, this.password); } - async logout(): Promise { - await this.apiAuth(); - return this.alfrescoApi.logout(); - } - async createFolder(name: string, parentId?: string): Promise { const response = await this.nodes.createFolder(name, parentId); return response.entry.id;