mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
Remove dead code from the e2e (#3542)
* cleanup dead code * cleanup dead code * cleanup dead code * cleanup dead code * cleanup dead code * cleanup dead code
This commit is contained in:
@@ -38,9 +38,4 @@ export class Breadcrumb extends Component {
|
||||
return str.split('\nchevron_right')[0];
|
||||
});
|
||||
}
|
||||
|
||||
async clickItem(name: string): Promise<void> {
|
||||
const elem = this.byCss(`.adf-breadcrumb-item[title=${name}]`);
|
||||
await elem.click();
|
||||
}
|
||||
}
|
||||
|
@@ -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';
|
||||
|
@@ -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<void> {
|
||||
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<string[]> {
|
||||
return this.getSelectedRows().map((row) => {
|
||||
return row.element(by.css('.adf-datatable-cell[title="Name"]')).getText();
|
||||
});
|
||||
}
|
||||
|
||||
async getSelectedRowsCount(): Promise<number> {
|
||||
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<number> {
|
||||
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<boolean> {
|
||||
return this.getNameLink(itemName).isPresent();
|
||||
}
|
||||
|
||||
async doubleClickOnRowByName(name: string, location: string = ''): Promise<void> {
|
||||
try {
|
||||
const item = this.getRowFirstCell(name, location);
|
||||
@@ -262,15 +228,6 @@ export class DataTable extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
async clickItem(name: string, location: string = ''): Promise<void> {
|
||||
const item = this.getRowFirstCell(name, location);
|
||||
await item.click();
|
||||
}
|
||||
|
||||
async clickNameLink(itemName: string): Promise<void> {
|
||||
await this.getNameLink(itemName).click();
|
||||
}
|
||||
|
||||
async selectMultipleItems(names: string[], location: string = ''): Promise<void> {
|
||||
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<void> {
|
||||
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<string> {
|
||||
const isEmpty = await this.emptyFolderDragAndDrop.isDisplayed();
|
||||
if (isEmpty) {
|
||||
return this.emptyFolderDragAndDrop.getText();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
async getEmptyStateTitle(): Promise<string> {
|
||||
const isEmpty = await this.isEmpty();
|
||||
if (isEmpty) {
|
||||
@@ -369,11 +312,6 @@ export class DataTable extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
async hasContextMenu(): Promise<boolean> {
|
||||
const count = await this.menu.getItemsCount();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
async getLibraryRole(name: string): Promise<string> {
|
||||
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<boolean> {
|
||||
return this.getSearchResultNameLink(itemName, location).isPresent();
|
||||
}
|
||||
|
||||
async clickSearchResultNameLink(itemName: string, location: string = ''): Promise<void> {
|
||||
await this.getSearchResultNameLink(itemName, location).click();
|
||||
}
|
||||
}
|
||||
|
@@ -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<void> {
|
||||
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<void> {
|
||||
const clockCellClass = '.mat-datetimepicker-clock-cell';
|
||||
const selectedHourElem = this.hourPicker.element(by.cssContainingText(clockCellClass, `${hour}`));
|
||||
await BrowserActions.click(selectedHourElem);
|
||||
}
|
||||
|
||||
async selectMinute(minute: number): Promise<void> {
|
||||
const clockCellClass = '.mat-datetimepicker-clock-cell';
|
||||
const selectedMinuteElem = this.minutePicker.element(by.cssContainingText(clockCellClass, `${minute}`));
|
||||
await BrowserActions.click(selectedMinuteElem);
|
||||
}
|
||||
}
|
||||
|
@@ -49,10 +49,6 @@ export class CreateOrEditFolderDialog extends GenericDialog {
|
||||
return isPresentAndEnabled(this.updateButton);
|
||||
}
|
||||
|
||||
async isCreateButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createButton);
|
||||
}
|
||||
|
||||
async isCancelButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.cancelButton);
|
||||
}
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<boolean> {
|
||||
return isPresentAndDisplayed(this.validationMessage);
|
||||
}
|
||||
|
||||
async isCreateButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createButton);
|
||||
}
|
||||
|
||||
async isCancelButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.cancelButton);
|
||||
}
|
||||
|
||||
async getValidationMessage(): Promise<string> {
|
||||
if (await this.isValidationMessageDisplayed()) {
|
||||
return this.validationMessage.getText();
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getNameInputValue(): Promise<string> {
|
||||
return BrowserActions.getInputValue(this.nameInput);
|
||||
}
|
||||
|
||||
async enterName(name: string): Promise<void> {
|
||||
await typeText(this.nameInput, name);
|
||||
}
|
||||
|
||||
async enterTitle(title: string): Promise<void> {
|
||||
await typeText(this.titleInput, title);
|
||||
}
|
||||
|
||||
async enterDescription(description: string): Promise<void> {
|
||||
await typeText(this.descriptionTextArea, description);
|
||||
}
|
||||
|
||||
async clickCancel(): Promise<void> {
|
||||
await BrowserActions.click(this.cancelButton);
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<void> {
|
||||
await super.waitForDialogToOpen();
|
||||
await BrowserVisibility.waitUntilElementIsClickable(this.nameInput);
|
||||
}
|
||||
|
||||
async getErrorMessage(): Promise<string> {
|
||||
if (await this.errorMessage.isDisplayed()) {
|
||||
return this.errorMessage.getText();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
async enterName(name: string): Promise<void> {
|
||||
await typeText(this.nameInput, name);
|
||||
}
|
||||
|
||||
async enterLibraryId(id: string): Promise<void> {
|
||||
await typeText(this.libraryIdInput, id);
|
||||
}
|
||||
|
||||
async enterDescription(description: string): Promise<void> {
|
||||
await typeText(this.descriptionTextArea, description);
|
||||
}
|
||||
|
||||
async isCreateEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createButton);
|
||||
}
|
||||
|
||||
async isCancelEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.cancelButton);
|
||||
}
|
||||
|
||||
async clickCancel(): Promise<void> {
|
||||
await BrowserActions.click(this.cancelButton);
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
|
||||
private async isChecked(target: ElementFinder): Promise<boolean> {
|
||||
const elemClass = await target.element(by.xpath('..')).getAttribute('class');
|
||||
return elemClass.includes('mat-radio-checked');
|
||||
}
|
||||
|
||||
async isPublicChecked(): Promise<boolean> {
|
||||
return this.isChecked(this.visibilityPublic);
|
||||
}
|
||||
}
|
@@ -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';
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<void> {
|
||||
await BrowserVisibility.waitUntilElementIsClickable(this.passwordInput);
|
||||
}
|
||||
|
||||
async isDialogOpen(): Promise<boolean> {
|
||||
try {
|
||||
await this.waitForDialogToOpen();
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isCloseEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.closeButton);
|
||||
}
|
||||
|
||||
async isSubmitEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.submitButton);
|
||||
}
|
||||
|
||||
async isPasswordInputDisplayed(): Promise<boolean> {
|
||||
const present = await browser.isElementPresent(this.passwordInput);
|
||||
if (present) {
|
||||
return this.passwordInput.isDisplayed();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isErrorDisplayed(): Promise<boolean> {
|
||||
try {
|
||||
await this.waitForDialogToOpen();
|
||||
return (await this.errorMessage.isPresent()) && (await this.errorMessage.isDisplayed());
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async getErrorMessage(): Promise<string> {
|
||||
if (await this.isErrorDisplayed()) {
|
||||
return this.errorMessage.getText();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
async enterPassword(password: string): Promise<void> {
|
||||
await typeText(this.passwordInput, password);
|
||||
}
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<boolean> {
|
||||
return isPresentAndEnabled(this.cancelButton);
|
||||
}
|
||||
|
||||
async isNextButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.nextButton);
|
||||
}
|
||||
|
||||
async clickCancel(): Promise<void> {
|
||||
await BrowserActions.click(this.cancelButton);
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
|
||||
async clickNext(): Promise<void> {
|
||||
await BrowserActions.click(this.nextButton);
|
||||
await this.waitForDialogToClose();
|
||||
}
|
||||
}
|
@@ -101,11 +101,6 @@ export class CommentsTab extends Component {
|
||||
return time.getText();
|
||||
}
|
||||
|
||||
async getNthCommentId(index: number): Promise<string> {
|
||||
const list = this.allByCss('.adf-comment-list-item');
|
||||
return list.get(index - 1).getAttribute('id');
|
||||
}
|
||||
|
||||
async getNthCommentText(index: number): Promise<string> {
|
||||
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<void> {
|
||||
await BrowserActions.click(this.addCommentButton);
|
||||
}
|
||||
|
||||
async getCommentTextFromTextArea(): Promise<string> {
|
||||
return BrowserActions.getInputValue(this.commentTextarea);
|
||||
}
|
||||
}
|
||||
|
@@ -22,18 +22,14 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.expandedImagePropertiesPanel);
|
||||
}
|
||||
|
||||
async getVisiblePropertiesLabels(): Promise<string[]> {
|
||||
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<boolean> {
|
||||
return isPresentAndEnabled(this.editPropertiesButton);
|
||||
}
|
||||
|
||||
async isLessInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.lessInfoButton);
|
||||
}
|
||||
@@ -80,18 +50,4 @@ export class ContentMetadata extends Component {
|
||||
async isMoreInfoButtonDisplayed(): Promise<boolean> {
|
||||
return browser.isElementPresent(this.moreInfoButton);
|
||||
}
|
||||
|
||||
async isImagePropertiesPanelDisplayed(): Promise<boolean> {
|
||||
return isPresentAndDisplayed(this.imagePropertiesPanel);
|
||||
}
|
||||
|
||||
private async getElementValue(elem: ElementFinder): Promise<string> {
|
||||
const tagName = await elem.getTagName();
|
||||
|
||||
if (tagName === 'input' || tagName === 'textarea') {
|
||||
return BrowserActions.getInputValue(elem);
|
||||
}
|
||||
|
||||
return elem.getText();
|
||||
}
|
||||
}
|
||||
|
@@ -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<boolean> {
|
||||
const text = await this.passwordVisibility.getText();
|
||||
return text.endsWith('visibility');
|
||||
}
|
||||
|
||||
async isPasswordDisplayed(): Promise<boolean> {
|
||||
const type = await this.passwordInput.getAttribute('type');
|
||||
if (type === 'text') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async isPasswordHidden() {
|
||||
return !(await this.getPasswordVisibility());
|
||||
}
|
||||
}
|
||||
|
@@ -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,9 +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');
|
||||
|
||||
cancelEditingAction = this.byCss(`.mat-menu-item[title='Cancel Editing']`);
|
||||
copyAction = this.byTitleAttr('Copy');
|
||||
@@ -75,10 +72,6 @@ export class Menu extends Component {
|
||||
return this.byId(id);
|
||||
}
|
||||
|
||||
async getItemTooltip(menuItem: string): Promise<string> {
|
||||
return this.getItemByLabel(menuItem).getAttribute('title');
|
||||
}
|
||||
|
||||
async getItemIconText(menuItem: string): Promise<string> {
|
||||
return this.getItemByLabel(menuItem).element(by.css('.mat-icon')).getText();
|
||||
}
|
||||
@@ -91,13 +84,6 @@ export class Menu extends Component {
|
||||
return this.items.count();
|
||||
}
|
||||
|
||||
async getMenuItems(): Promise<string[]> {
|
||||
return this.items.map(async (elem) => {
|
||||
const span = elem.element(by.css('span'));
|
||||
return span.getText();
|
||||
});
|
||||
}
|
||||
|
||||
async clickNthItem(nth: number): Promise<void> {
|
||||
try {
|
||||
const elem = this.getNthItem(nth);
|
||||
@@ -163,20 +149,4 @@ export class Menu extends Component {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async isCreateFolderEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createFolderAction);
|
||||
}
|
||||
|
||||
async isCreateLibraryEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createLibraryAction);
|
||||
}
|
||||
|
||||
async isCreateFileFromTemplateEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createFileFromTemplateAction);
|
||||
}
|
||||
|
||||
async isCreateFolderFromTemplateEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.createFolderFromTemplateAction);
|
||||
}
|
||||
}
|
||||
|
@@ -22,61 +22,10 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<boolean> {
|
||||
return isPresentAndDisplayed(this.fromFieldError);
|
||||
}
|
||||
async isToErrorDisplayed(): Promise<boolean> {
|
||||
return isPresentAndDisplayed(this.toFieldError);
|
||||
}
|
||||
|
||||
async getFromValue(): Promise<string> {
|
||||
return BrowserActions.getInputValue(this.fromInput);
|
||||
}
|
||||
|
||||
async getFromError(): Promise<string> {
|
||||
try {
|
||||
return await this.fromFieldError.getText();
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getToValue(): Promise<string> {
|
||||
return BrowserActions.getInputValue(this.fromInput);
|
||||
}
|
||||
|
||||
async getToError(): Promise<string> {
|
||||
try {
|
||||
return await this.toFieldError.getText();
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
async enterFromDate(date: string): Promise<void> {
|
||||
await this.openDialog();
|
||||
await BrowserActions.clearWithBackSpace(this.fromInput);
|
||||
await this.fromInput.sendKeys(date, protractor.Key.TAB);
|
||||
}
|
||||
|
||||
async enterToDate(date: string): Promise<void> {
|
||||
await this.openDialog();
|
||||
await BrowserActions.clearWithBackSpace(this.toInput);
|
||||
await this.toInput.sendKeys(date, protractor.Key.TAB);
|
||||
}
|
||||
}
|
||||
|
@@ -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,44 +45,21 @@ export class Sidenav extends Component {
|
||||
super('app-sidenav', ancestor);
|
||||
}
|
||||
|
||||
async isSidenavExpanded(): Promise<boolean> {
|
||||
return browser.isElementPresent(by.css(`[data-automation-id='expanded']`));
|
||||
}
|
||||
|
||||
async expandSideNav(): Promise<void> {
|
||||
const expanded = await this.isSidenavExpanded();
|
||||
if (!expanded) {
|
||||
await BrowserActions.click(this.sidenavToggle);
|
||||
await waitElement(`[data-automation-id='expanded']`);
|
||||
}
|
||||
}
|
||||
|
||||
async collapseSideNav(): Promise<void> {
|
||||
const expanded = await this.isSidenavExpanded();
|
||||
if (expanded) {
|
||||
await BrowserActions.click(this.sidenavToggle);
|
||||
await waitElement(`[data-automation-id='collapsed']`);
|
||||
}
|
||||
}
|
||||
|
||||
async openNewMenu(): Promise<void> {
|
||||
await BrowserActions.click(this.newButton);
|
||||
await this.menu.waitForMenuToOpen();
|
||||
}
|
||||
|
||||
async closeNewMenu(): Promise<void> {
|
||||
await BrowserActions.click(element(by.css('button[id="app.toolbar.create"] span span')));
|
||||
await this.menu.waitForMenuToClose();
|
||||
}
|
||||
|
||||
async openCreateFolderDialog(): Promise<void> {
|
||||
await this.openNewMenu();
|
||||
await BrowserActions.click(this.menu.createFolderAction);
|
||||
}
|
||||
|
||||
async isActive(name: string): Promise<boolean> {
|
||||
const cssClass = await this.getLinkLabel(name).getAttribute('class');
|
||||
return cssClass.includes('action-button--active');
|
||||
}
|
||||
|
||||
private getLinkLabel(name: string): ElementFinder {
|
||||
switch (name) {
|
||||
case 'Personal Files':
|
||||
@@ -108,11 +83,6 @@ export class Sidenav extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
async getLinkTooltip(name: string): Promise<string> {
|
||||
const link = this.getLinkLabel(name);
|
||||
return link.getAttribute('title');
|
||||
}
|
||||
|
||||
async clickLink(name: string): Promise<void> {
|
||||
try {
|
||||
const link = this.getLinkLabel(name);
|
||||
|
@@ -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<boolean> {
|
||||
const count = await this.buttons.count();
|
||||
return count === 0;
|
||||
}
|
||||
|
||||
async getButtons(): Promise<string[]> {
|
||||
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<void> {
|
||||
await this.openCreateMenu();
|
||||
await BrowserActions.click(this.menu.createFolderAction);
|
||||
}
|
||||
|
||||
async openCreateFileFromTemplateDialog(): Promise<void> {
|
||||
await this.openCreateMenu();
|
||||
await BrowserActions.click(this.menu.createFileFromTemplateAction);
|
||||
}
|
||||
|
||||
async openCreateFolderFromTemplateDialog(): Promise<void> {
|
||||
await this.openCreateMenu();
|
||||
await BrowserActions.click(this.menu.createFolderFromTemplateAction);
|
||||
}
|
||||
|
||||
async openCreateMenu(): Promise<void> {
|
||||
await BrowserActions.click(this.createButton);
|
||||
await this.menu.waitForMenuToOpen();
|
||||
}
|
||||
async openUploadMenu(): Promise<void> {
|
||||
await BrowserActions.click(this.uploadButton);
|
||||
await this.menu.waitForMenuToOpen();
|
||||
|
@@ -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<string> {
|
||||
return this.toolbar.getButtonTooltip(this.closeButton);
|
||||
}
|
||||
|
||||
async getFileTitle(): Promise<string> {
|
||||
return this.fileTitle.getText();
|
||||
}
|
||||
@@ -107,11 +102,6 @@ export class Viewer extends Component {
|
||||
return '';
|
||||
}
|
||||
|
||||
async isPdfViewerContentDisplayed(): Promise<boolean> {
|
||||
const count = await this.pdfViewerContentPages.count();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
async clickCloseButton(): Promise<void> {
|
||||
const closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-toolbar-back"]'));
|
||||
await BrowserActions.click(closeButton);
|
||||
|
@@ -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',
|
||||
|
@@ -22,11 +22,9 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<void> {
|
||||
await this.dataTable.waitForBody();
|
||||
}
|
||||
|
||||
async getName(name: string): Promise<string> {
|
||||
return this.dataTable.getRowByName(name).element(by.css('[title="Name"] div.search-file-name')).getText();
|
||||
}
|
||||
|
||||
async getDescription(name: string): Promise<string> {
|
||||
return this.dataTable.getRowByName(name).element(by.css('[title="Description"]')).getText();
|
||||
}
|
||||
|
||||
async getModified(name: string): Promise<string> {
|
||||
return BrowserActions.getAttribute(this.dataTable.getRowByName(name).element(by.css('[title="Modified"] span')), 'title');
|
||||
}
|
||||
|
||||
async getSize(name: string): Promise<string> {
|
||||
return this.dataTable.getRowByName(name).element(by.css('[title="Size"]')).getText();
|
||||
}
|
||||
|
||||
async getModifiedBy(name: string): Promise<string> {
|
||||
return this.dataTable.getRowByName(name).element(by.css('[title="Modified by"]')).getText();
|
||||
}
|
||||
|
||||
async getLocation(name: string): Promise<string> {
|
||||
return this.dataTable.getRowByName(name).element(by.css('[title="Name"] a')).getText();
|
||||
}
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<string> {
|
||||
return this.nodes.getNodeIdFromParent('Data Dictionary', '-root-').catch((error) => {
|
||||
super.handleError('Admin Actions - getDataDictionaryId failed : ', error);
|
||||
return '';
|
||||
});
|
||||
}
|
||||
|
||||
async getNodeTemplatesFolderId(): Promise<string> {
|
||||
try {
|
||||
return this.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId());
|
||||
} catch (error) {
|
||||
super.handleError('Admin Actions - getNodeTemplatesFolderId failed : ', error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getSpaceTemplatesFolderId(): Promise<string> {
|
||||
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<PersonEntry> {
|
||||
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<PersonEntry> {
|
||||
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<PersonEntry> {
|
||||
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<any> {
|
||||
return this.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`).catch((error) => {
|
||||
super.handleError('Admin Actions - createNodeTemplatesHierarchy failed : ', error);
|
||||
});
|
||||
}
|
||||
|
||||
async createSpaceTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> {
|
||||
return this.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`).catch((error) => {
|
||||
super.handleError('Admin Actions - createSpaceTemplatesHierarchy failed : ', error);
|
||||
});
|
||||
}
|
||||
|
||||
async removeUserAccessOnNodeTemplate(nodeName: string): Promise<NodeEntry> {
|
||||
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<NodeEntry> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
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<NodeEntry> {
|
||||
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<NodeEntry> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
@@ -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';
|
||||
|
@@ -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);
|
||||
|
@@ -74,16 +74,6 @@ export class NodesApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async getNodeTitle(name: string, parentId: string): Promise<string> {
|
||||
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<string> {
|
||||
try {
|
||||
const node = await this.getNodeById(nodeId);
|
||||
@@ -341,27 +331,6 @@ export class NodesApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async createFileLink(originalNodeId: string, destinationId: string): Promise<NodeEntry | null> {
|
||||
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<NodeEntry | null> {
|
||||
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<NodeEntry | null> {
|
||||
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<NodeEntry | null> {
|
||||
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<NodeEntry | null> {
|
||||
const data = {
|
||||
permissions: {
|
||||
|
@@ -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<SiteMemberEntry> {
|
||||
return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
}
|
||||
|
||||
async deleteSiteMember(siteId: string, userId: string) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
|
@@ -69,11 +69,6 @@ export class RepoClient {
|
||||
return new UploadApi(this.username, this.password);
|
||||
}
|
||||
|
||||
async logout(): Promise<any> {
|
||||
await this.apiAuth();
|
||||
return this.alfrescoApi.logout();
|
||||
}
|
||||
|
||||
async createFolder(name: string, parentId?: string): Promise<string> {
|
||||
const response = await this.nodes.createFolder(name, parentId);
|
||||
return response.entry.id;
|
||||
|
@@ -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<any> {
|
||||
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<Comment | null> {
|
||||
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<SiteEntry[]> {
|
||||
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.
|
||||
|
@@ -86,10 +86,6 @@ export class Utils {
|
||||
return crypto.getRandomValues(new Uint32Array(1))[0].toString(36).substring(0, 5).toLowerCase();
|
||||
}
|
||||
|
||||
static async clearLocalStorage(): Promise<void> {
|
||||
await browser.executeScript('window.localStorage.clear();');
|
||||
}
|
||||
|
||||
static async setSessionStorageFromConfig(configFileName: string): Promise<void> {
|
||||
const configFile = `${browser.params.e2eRootPath}/resources/extensibility-configs/${configFileName}`;
|
||||
const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' }));
|
||||
|
Reference in New Issue
Block a user