[ACS-5761] Demo Shell Cleanup (part 2) (#8807)

cleanup demo shell
This commit is contained in:
Denys Vuika
2023-08-10 22:18:21 +01:00
committed by GitHub
parent ca60b392d4
commit f201efd56a
203 changed files with 1005 additions and 10703 deletions

View File

@@ -24,12 +24,12 @@ import { createApiService,
UsersActions
} from '@alfresco/adf-testing';
import { FolderModel } from '../models/ACS/folder.model';
import { ContentServicesPage } from '../core/pages/content-services.page';
import { ContentServicesPage } from './pages/content-services.page';
import { InfinitePaginationPage } from './pages/infinite-pagination.page';
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
import { NavigationBarPage } from './pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Enable infinite scrolling', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const infinitePaginationPage = new InfinitePaginationPage();
@@ -45,9 +45,9 @@ describe('Enable infinite scrolling', () => {
const nrOfFiles = 30;
let deleteFileNames = [];
const nrOfDeletedFiles = 22;
let deleteUploaded;
let deleteUploaded: NodeEntry;
const pageSize = 20;
let emptyFolderModel;
let emptyFolderModel: NodeEntry;
const files = {
base: 'newFile',

View File

@@ -21,12 +21,10 @@ import {
BrowserVisibility,
DateUtil,
DocumentListPage,
TogglePage,
DropdownPage,
Logger
} from '@alfresco/adf-testing';
import { $$, browser, by, element, ElementFinder, protractor, $ } from 'protractor';
import { CreateLibraryDialogPage } from './dialog/create-library-dialog.page';
import { $$, browser, by, element, protractor, $ } from 'protractor';
import { FolderDialogPage } from './dialog/folder-dialog.page';
import { NavigationBarPage } from './navigation-bar.page';
@@ -43,18 +41,10 @@ export class ContentServicesPage {
};
contentList = new DocumentListPage($$('adf-upload-drag-area adf-document-list').first());
togglePage = new TogglePage();
createFolderDialog = new FolderDialogPage();
createLibraryDialog = new CreateLibraryDialogPage();
multipleFileUploadToggle = $('#adf-document-list-enable-drop-files');
uploadBorder = $('#document-list-container');
currentFolder = $('div[class*="adf-breadcrumb-item adf-active"] div');
createFolderButton = $('button[data-automation-id="create-new-folder"]');
editFolderButton = $('button[data-automation-id="edit-folder"]');
deleteNodesButton = $('button[data-automation-id="delete-toolbar-button"]');
createLibraryButton = $('button[data-automation-id="create-new-library"]');
activeBreadcrumb = $('div[class*="active"]');
uploadFileButton = $('.adf-upload-button-file-container button');
uploadFileButtonInput = $('input[data-automation-id="upload-single-file"]');
uploadMultipleFileButton = $('input[data-automation-id="upload-multiple-files"]');
@@ -69,21 +59,14 @@ export class ContentServicesPage {
emptyFolderImage = $('.adf-empty-folder-image');
gridViewButton = $('button[data-automation-id="document-list-grid-view"]');
cardViewContainer = $('div.app-document-list-container div.adf-datatable-card');
shareNodeButton = element(by.cssContainingText('mat-icon', 'share'));
nameColumnHeader = 'name';
createdByColumnHeader = 'createdByUser.displayName';
createdColumnHeader = 'createdAt';
deleteContentElement = $('button[data-automation-id="Delete"]');
metadataAction = $('button[data-automation-id="Info"]');
versionManagerAction = $('button[data-automation-id="Manage versions"]');
moveContentElement = $('button[data-automation-id="Move"]');
copyContentElement = $('button[data-automation-id="Copy"]');
lockContentElement = $('button[data-automation-id="Lock"]');
downloadContent = $('button[data-automation-id="Download"]');
downloadButton = $('button[title="Download"]');
favoriteButton = $('button[data-automation-id="favorite"]');
markedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star'));
notMarkedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star_border'));
multiSelectToggle = $('[data-automation-id="multiSelectToggle"]');
selectAllCheckbox = $$('.adf-checkbox-sr-only').first();
selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]');
@@ -95,11 +78,6 @@ export class ContentServicesPage {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
}
async checkContextActionIsVisible(actionName) {
const actionButton = $(`button[data-automation-id="context-${actionName}"`);
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
}
async isContextActionEnabled(actionName): Promise<boolean> {
const actionButton = $(`button[data-automation-id="context-${actionName}"`);
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
@@ -110,18 +88,6 @@ export class ContentServicesPage {
return this.contentList;
}
async closeActionContext(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
}
async checkLockedIcon(content): Promise<void> {
return this.contentList.checkLockedIcon(content);
}
async checkUnlockedIcon(content): Promise<void> {
return this.contentList.checkUnlockedIcon(content);
}
async checkDeleteIsDisabled(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
const disabledDelete = $(`button[data-automation-id='Delete'][disabled='true']`);
@@ -134,14 +100,6 @@ export class ContentServicesPage {
await this.checkContentIsNotDisplayed(content);
}
async clickDeleteOnToolbar(): Promise<void> {
await BrowserActions.click(this.deleteNodesButton);
}
async checkToolbarDeleteIsDisabled(): Promise<boolean> {
return !(await this.deleteNodesButton.isEnabled());
}
async metadataContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.metadataAction);
@@ -152,21 +110,6 @@ export class ContentServicesPage {
await BrowserActions.click(this.versionManagerAction);
}
async copyContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.copyContentElement);
}
async moveContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.moveContentElement);
}
async lockContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.lockContentElement);
}
async clickFileHyperlink(fileName): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserActions.click(hyperlink);
@@ -182,15 +125,6 @@ export class ContentServicesPage {
await BrowserActions.click(hyperlinkToggle);
}
async enableDropFilesInAFolder(): Promise<void> {
await this.togglePage.enableToggle(this.multipleFileUploadToggle);
}
async disableDropFilesInAFolder(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.togglePage.disableToggle(this.multipleFileUploadToggle);
}
async getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
@@ -313,31 +247,6 @@ export class ContentServicesPage {
await BrowserActions.click(this.createFolderButton);
}
async clickOnFavoriteButton(): Promise<void> {
await BrowserActions.click(this.favoriteButton);
}
async checkIsMarkedFavorite(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.markedFavorite);
}
async checkIsNotMarkedFavorite(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.notMarkedFavorite);
}
async clickOnEditFolder(): Promise<void> {
await BrowserActions.click(this.editFolderButton);
}
async isEditFolderButtonEnabled(): Promise<boolean> {
return this.editFolderButton.isEnabled();
}
async openCreateLibraryDialog(): Promise<void> {
await BrowserActions.click(this.createLibraryButton);
await this.createLibraryDialog.libraryDialog.waitVisible();
}
async createNewFolder(folderName: string): Promise<void> {
await this.clickOnCreateNewFolder();
await this.createFolderDialog.addFolderName(folderName);
@@ -355,17 +264,17 @@ export class ContentServicesPage {
await this.contentList.dataTablePage().waitTillContentLoaded();
}
async checkContentIsDisplayed(content): Promise<void> {
async checkContentIsDisplayed(content: string): Promise<void> {
await this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content);
}
async checkContentsAreDisplayed(content): Promise<void> {
for (let i = 0; i < content.length; i++) {
await this.checkContentIsDisplayed(content[i]);
async checkContentsAreDisplayed(content: string[]): Promise<void> {
for (const item of content) {
await this.checkContentIsDisplayed(item);
}
}
async checkContentIsNotDisplayed(content): Promise<void> {
async checkContentIsNotDisplayed(content: string): Promise<void> {
await this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content);
}
@@ -380,17 +289,13 @@ export class ContentServicesPage {
await this.deleteAndCheckFolderNotDisplayed(subFolderName);
}
async getActiveBreadcrumb(): Promise<string> {
return BrowserActions.getAttribute(this.activeBreadcrumb, 'title');
}
async uploadFile(fileLocation): Promise<void> {
async uploadFile(fileLocation: string): Promise<void> {
await this.checkUploadButton();
await this.uploadFileButtonInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await this.checkUploadButton();
}
async uploadMultipleFile(files): Promise<void> {
async uploadMultipleFile(files: string[]): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
let allFiles = path.resolve(path.join(browser.params.testConfig.main.rootPath, files[0]));
for (let i = 1; i < files.length; i++) {
@@ -405,16 +310,6 @@ export class ContentServicesPage {
await this.uploadFolderButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, folderLocation)));
}
async getSingleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFileButton);
return BrowserActions.getAttribute(this.uploadFileButtonInput, 'title');
}
async getMultipleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
return BrowserActions.getAttribute(this.uploadMultipleFileButton, 'title');
}
async checkUploadButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
}
@@ -514,27 +409,27 @@ export class ContentServicesPage {
return $$('div.app-document-list-container div.adf-datatable-card div.adf-cell-value img').count();
}
async getDocumentCardIconForElement(elementName): Promise<string> {
async getDocumentCardIconForElement(elementName: string): Promise<string> {
const elementIcon = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`);
return BrowserActions.getAttribute(elementIcon, 'src');
}
async checkDocumentCardPropertyIsShowed(elementName, propertyName): Promise<void> {
async checkDocumentCardPropertyIsShowed(elementName: string, propertyName: string): Promise<void> {
const elementProperty = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(elementProperty);
}
async getAttributeValueForElement(elementName, propertyName): Promise<string> {
async getAttributeValueForElement(elementName: string, propertyName: string): Promise<string> {
const elementSize = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`);
return BrowserActions.getText(elementSize);
}
async checkMenuIsShowedForElementIndex(elementIndex): Promise<void> {
async checkMenuIsShowedForElementIndex(elementIndex: number): Promise<void> {
const elementMenu = $(`button[data-automation-id="action_menu_${elementIndex}"]`);
await BrowserVisibility.waitUntilElementIsVisible(elementMenu);
}
async navigateToCardFolder(folderName): Promise<void> {
async navigateToCardFolder(folderName: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const folderCard = $(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`);
await BrowserActions.click(folderCard);
@@ -543,22 +438,16 @@ export class ContentServicesPage {
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
async selectGridSortingFromDropdown(sortingOption): Promise<void> {
async selectGridSortingFromDropdown(sortingOption: string): Promise<void> {
await this.sortingDropdown.selectDropdownOption(sortingOption);
}
async checkRowIsDisplayed(rowName): Promise<void> {
async checkRowIsDisplayed(rowName: string): Promise<void> {
const row = this.contentList.dataTablePage().getCellElementByValue(this.columns.name, rowName);
await BrowserVisibility.waitUntilElementIsVisible(row);
}
async clickShareButton(): Promise<void> {
await browser.sleep(2000);
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.shareNodeButton);
}
async checkSelectedSiteIsDisplayed(siteName): Promise<void> {
async checkSelectedSiteIsDisplayed(siteName: string): Promise<void> {
await this.siteListDropdown.checkOptionIsSelected(siteName);
}
@@ -580,10 +469,6 @@ export class ContentServicesPage {
await BrowserActions.click(this.selectAllCheckbox);
}
getRowByName(rowName: string): ElementFinder {
return this.contentList.dataTable.getRow(this.columns.name, rowName);
}
async selectFolder(folderName: string): Promise<void> {
const folderSelected = $(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`);
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);

View File

@@ -1,79 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
import { $ } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
const source = {
favorites: 'Favorites',
recent: 'Recent',
sharedLinks: 'Shared Links',
sites: 'Sites',
mySites: 'My Sites',
trashcan: 'Trashcan',
root: 'Root',
my: 'My',
shared: 'Shared'
};
const column = {
status: 'Status'
};
export class CustomSourcesPage {
dataTable = new DataTableComponentPage();
navigationBarPage = new NavigationBarPage();
toolbar = $('app-custom-sources .adf-toolbar-title');
selectModeDropdown = new DropdownPage($('mat-select[data-automation-id="custom-sources-select"]'));
async waitForToolbarToBeVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
}
async navigateToCustomSources(): Promise<void> {
await this.navigationBarPage.clickCustomSources();
await this.waitForToolbarToBeVisible();
}
async selectMySitesSourceType(): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(source.mySites);
}
async selectFavoritesSourceType(): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(source.favorites);
}
async selectSharedLinksSourceType(): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(source.sharedLinks);
}
checkRowIsDisplayed(rowName: string): Promise<void> {
return this.dataTable.checkContentIsDisplayed('Name', rowName);
}
checkRowIsNotDisplayed(rowName: string): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed('Name', rowName);
}
async getStatusCell(rowName: string): Promise<string> {
const cell = this.dataTable.getCellByRowContentAndColumn('Name', rowName, column.status);
return BrowserActions.getText(cell);
}
}

View File

@@ -1,44 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $, $$ } from 'protractor';
import { BrowserActions, TestElement } from '@alfresco/adf-testing';
export class CreateLibraryDialogPage {
libraryDialog = TestElement.byCss('[role="dialog"]');
libraryTitle = TestElement.byCss('.adf-library-dialog>h2');
libraryNameField = TestElement.byCss('input[formcontrolname="title"]');
libraryIdField = TestElement.byCss('input[formcontrolname="id"]');
libraryDescriptionField = TestElement.byCss('textarea[formcontrolname="description"]');
publicRadioButton = TestElement.byCss('[data-automation-id="PUBLIC"]>label');
privateRadioButton = TestElement.byCss('[data-automation-id="PRIVATE"]>label');
moderatedRadioButton = TestElement.byCss('[data-automation-id="MODERATED"]>label');
cancelButton = TestElement.byCss('button[data-automation-id="cancel-library-id"]');
createButton = TestElement.byCss('button[data-automation-id="create-library-id"]');
errorMessage = TestElement.byCss('.mat-dialog-content .mat-error');
errorMessages = $$('.mat-dialog-content .mat-error');
libraryNameHint = TestElement.byCss('adf-library-dialog .mat-hint');
async getSelectedRadio(): Promise<string> {
const radio = $('.mat-radio-button[class*="checked"]');
return BrowserActions.getText(radio);
}
async getErrorMessages(position: number): Promise<string> {
return BrowserActions.getText(this.errorMessages.get(position));
}
}

View File

@@ -15,73 +15,21 @@
* limitations under the License.
*/
import { $$, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { $$ } from 'protractor';
import { BrowserActions } from '@alfresco/adf-testing';
export class FolderDialogPage {
folderDialog = $$('adf-folder-dialog').first();
folderNameField = this.folderDialog.$('#adf-folder-name-input');
folderDescriptionField = this.folderDialog.$('#adf-folder-description-input');
createUpdateButton = this.folderDialog.$('#adf-folder-create-button');
cancelButton = this.folderDialog.$('#adf-folder-cancel-button');
folderTitle = this.folderDialog.$('h2.mat-dialog-title');
validationMessage = this.folderDialog.$('div.mat-form-field-subscript-wrapper mat-hint span');
async getDialogTitle(): Promise<string> {
return BrowserActions.getText(this.folderTitle);
}
async checkFolderDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.folderDialog);
}
async checkFolderDialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.folderDialog);
}
async clickOnCreateUpdateButton(): Promise<void> {
await BrowserActions.click(this.createUpdateButton);
}
async clickOnCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
async addFolderName(folderName): Promise<void> {
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
}
async addFolderDescription(folderDescription): Promise<void> {
await BrowserActions.clearSendKeys(this.folderDescriptionField, folderDescription);
}
async getFolderName(): Promise<string> {
return BrowserActions.getInputValue(this.folderNameField);
}
async getValidationMessage(): Promise<string> {
return BrowserActions.getText(this.validationMessage);
}
async checkValidationMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.validationMessage);
}
getFolderNameField(): ElementFinder {
return this.folderNameField;
}
getFolderDescriptionField(): ElementFinder {
return this.folderDescriptionField;
}
async checkCreateUpdateBtnIsEnabled(): Promise<boolean> {
return this.createUpdateButton.isEnabled();
}
async checkCancelBtnIsEnabled(): Promise<void> {
await this.cancelButton.isEnabled();
}
}

View File

@@ -1,114 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $$, $ } from 'protractor';
import { BrowserVisibility, TogglePage, BrowserActions, DateTimePickerPage } from '@alfresco/adf-testing';
import { format, add } from 'date-fns';
export class ShareDialogPage {
togglePage = new TogglePage();
dateTimePickerPage = new DateTimePickerPage();
shareDialog = $('adf-share-dialog');
dialogTitle = $$('[data-automation-id="adf-share-dialog-title"]').first();
shareToggle = $('[data-automation-id="adf-share-toggle"] label');
expireToggle = $(`[data-automation-id="adf-expire-toggle"] label`);
shareToggleChecked = $('mat-dialog-container mat-slide-toggle.mat-checked');
shareLink = $('[data-automation-id="adf-share-link"]');
closeButton = $('button[data-automation-id="adf-share-dialog-close"]');
copySharedLinkButton = $('.adf-input-action');
expirationDateInput = $('input[formcontrolname="time"]');
confirmationDialog = $('adf-confirm-dialog');
confirmationCancelButton = $('#adf-confirm-cancel');
confirmationRemoveButton = $('#adf-confirm-accept');
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle);
}
async clickUnShareFile() {
await this.togglePage.enableToggle(this.shareToggle);
}
async clickExpireToggle() {
await this.togglePage.enableToggle(this.expireToggle);
}
async clickConfirmationDialogCancelButton(): Promise<void> {
await BrowserActions.click(this.confirmationCancelButton);
}
async clickConfirmationDialogRemoveButton(): Promise<void> {
await BrowserActions.click(this.confirmationRemoveButton);
}
async checkShareLinkIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
}
async getShareLink(): Promise<string> {
return BrowserActions.getInputValue(this.shareLink);
}
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
async clickShareLinkButton(): Promise<void> {
await BrowserActions.click(this.copySharedLinkButton);
}
async shareToggleButtonIsChecked(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.shareToggleChecked);
}
async dialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(this.shareDialog);
}
async clickDateTimePickerButton(): Promise<void> {
await this.dateTimePickerPage.clickDateTimePicker();
}
async calendarTodayDayIsDisabled(): Promise<void> {
const tomorrow = format(add(new Date(), {days: 1}), 'd');
if (tomorrow !== '1') {
await this.dateTimePickerPage.checkCalendarTodayDayIsDisabled();
}
}
async setDefaultDay(): Promise<void> {
const tomorrow = format(add(new Date(), {days: 1}), 'd');
await this.dateTimePickerPage.setDate(tomorrow);
}
async dateTimePickerDialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale($('mat-datetimepicker-content'));
}
async getExpirationDate(): Promise<string> {
return BrowserActions.getInputValue(this.expirationDateInput);
}
async expirationDateInputHasValue(value): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(this.expirationDateInput, value);
}
async confirmationDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.confirmationDialog);
}
}

View File

@@ -26,7 +26,6 @@ export class UploadDialogPage {
uploadedStatusIcon = 'mat-icon[class*="status--done"]';
cancelledStatusIcon = 'div[class*="status--cancelled"]';
errorStatusIcon = 'div[class*="status--error"] mat-icon';
errorTooltip = $('div.mat-tooltip');
rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row');
title = $('span[class*="upload-dialog__title"]');
minimizeButton = $('mat-icon[title="Minimize"]');
@@ -121,6 +120,6 @@ export class UploadDialogPage {
}
async getTooltip(): Promise<string> {
return BrowserActions.getText(this.errorTooltip);
return BrowserActions.getAttribute($(this.errorStatusIcon), 'title');
}
}

View File

@@ -90,18 +90,6 @@ export class NavigationBarPage {
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async clickTrashcanButton(): Promise<void> {
await this.clickNavigationBarItem('Trashcan');
}
async clickCustomSources(): Promise<void> {
await this.clickNavigationBarItem('Custom Sources');
}
async clickOverlayViewerButton(): Promise<void> {
await this.clickNavigationBarItem('Overlay Viewer');
}
async clickTreeViewButton(): Promise<void> {
await this.clickNavigationBarItem('Tree View');
}

View File

@@ -25,13 +25,13 @@ import { createApiService,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { NodeEntry } from '@alfresco/js-api';
import { browser } from 'protractor';
import { FileModel } from '../models/ACS/file.model';
import { FolderModel } from '../models/ACS/folder.model';
import { ContentServicesPage } from '../core/pages/content-services.page';
import { ContentServicesPage } from './pages/content-services.page';
describe('Pagination - returns to previous page when current is empty', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const paginationPage = new PaginationPage();
@@ -48,8 +48,8 @@ describe('Pagination - returns to previous page when current is empty', () => {
const nrOfFiles = 6;
const nrOfFolders = 5;
const lastFile = 'newFile6.txt';
let lastFolderResponse;
let pngFileUploaded;
let lastFolderResponse: NodeEntry;
let pngFileUploaded: any;
const folderNames = ['t1', 't2', 't3', 't4', 't5', 't6'];
const itemsPerPage = {

View File

@@ -15,11 +15,10 @@
* limitations under the License.
*/
import { createApiService, LoginPage, SettingsPage, UserInfoPage, UsersActions } from '@alfresco/adf-testing';
import { createApiService, LoginPage, SettingsPage, UserInfoPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser } from 'protractor';
describe('User Info - SSO', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginPage();
const userInfoPage = new UserInfoPage();
@@ -27,16 +26,21 @@ describe('User Info - SSO', () => {
const apiService = createApiService({ authType: 'OAUTH', provider: 'ECM' });
const usersActions = new UsersActions(apiService);
let identityUser;
let identityUser: UserModel;
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
identityUser = await usersActions.createUser();
await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost,
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost, false, true, browser.params.testConfig.appConfig.oauth2.clientId);
browser.params.testConfig.appConfig.identityHost,
false,
true,
browser.params.testConfig.appConfig.oauth2.clientId
);
await loginSSOPage.loginSSOIdentityService(identityUser.username, identityUser.password);
});

View File

@@ -39,8 +39,6 @@ describe('Content Services Viewer', () => {
const versionManagePage = new VersionManagePage();
const metadataViewPage = new MetadataViewPage();
let zoom;
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
firstPageText: browser.params.resources.Files.ADF_DOCUMENTS.PDF.first_page_text,
@@ -241,7 +239,7 @@ describe('Content Services Viewer', () => {
await viewerPage.checkPercentageIsDisplayed();
zoom = await viewerPage.getZoom();
let zoom = await viewerPage.getZoom();
await viewerPage.clickZoomInButton();
await viewerPage.checkZoomedIn(zoom);
@@ -401,36 +399,6 @@ describe('Content Services Viewer', () => {
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.clickCloseButton();
});
it('[C268901] Should need a password when opening a protected file', async () => {
await contentServicesPage.doubleClickRow(protectedFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkPasswordDialogIsDisplayed();
await viewerPage.checkPasswordSubmitDisabledIsDisplayed();
await viewerPage.enterPassword('random password');
await viewerPage.clickPasswordSubmit();
await viewerPage.checkPasswordErrorIsDisplayed();
await viewerPage.checkPasswordInputIsDisplayed();
await viewerPage.enterPassword(protectedFile.password);
await viewerPage.clickPasswordSubmit();
await viewerPage.checkFileContent('1', protectedFile.firstPageText);
await viewerPage.clickCloseButton();
});
it('[C307985] Should close the viewer when password dialog is cancelled', async () => {
await contentServicesPage.doubleClickRow(protectedFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkPasswordDialogIsDisplayed();
await viewerPage.clickClosePasswordDialog();
await contentServicesPage.checkContentIsDisplayed(protectedFile.name);
});
});
describe('Viewer - version update with unsupported file', () => {

View File

@@ -1,133 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createApiService,
BrowserActions,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { ShareDialogPage } from '../../core/pages/dialog/share-dialog.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import CONSTANTS = require('../../util/constants');
import { SharedlinksApi, SitesApi } from '@alfresco/js-api';
describe('Viewer', () => {
const viewerPage = new ViewerPage();
const navigationBarPage = new NavigationBarPage();
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const shareDialog = new ShareDialogPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const sharedlinksApi = new SharedlinksApi(apiService);
let site;
const acsUser = new UserModel();
let pngFileUploaded;
const contentList = contentServicesPage.getDocumentList();
const pngFileInfo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const wordFileInfo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_path
});
let pngFileShared; let wordFileUploaded;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(site.entry.id, {
id: acsUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
await apiService.login(acsUser.username, acsUser.password);
pngFileUploaded = await uploadActions.uploadFile(pngFileInfo.location, pngFileInfo.name, site.entry.guid);
await apiService.login(acsUser.username, acsUser.password);
wordFileUploaded = await uploadActions.uploadFile(wordFileInfo.location, wordFileInfo.name, '-my-');
pngFileShared = await sharedlinksApi.createSharedLink({ nodeId: pngFileUploaded.entry.id });
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.deleteFileOrFolder(wordFileUploaded.entry.id);
});
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
});
it('[C260105] Should be able to open an image file shared via API', async () => {
await BrowserActions.getUrl(browser.baseUrl + '/preview/s/' + pngFileShared.entry.id);
await viewerPage.checkImgContainerIsDisplayed();
await BrowserActions.getUrl(browser.baseUrl);
await navigationBarPage.clickLogoutButton();
await BrowserActions.getUrl(browser.baseUrl + '/preview/s/' + pngFileShared.entry.id);
await viewerPage.checkImgContainerIsDisplayed();
});
it('[C260106] Should be able to open a Word file shared via API', async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentList.selectRow(wordFileInfo.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickShareLinkButton();
const sharedLink = await shareDialog.getShareLink();
await BrowserActions.getUrl(sharedLink);
await viewerPage.checkFileIsLoaded();
await viewerPage.checkFileNameIsDisplayed(wordFileInfo.name);
await BrowserActions.getUrl(browser.baseUrl);
await navigationBarPage.clickLogoutButton();
await BrowserActions.getUrl(sharedLink);
await viewerPage.checkFileIsLoaded();
await viewerPage.checkFileNameIsDisplayed(wordFileInfo.name);
});
});