[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

@@ -71,7 +71,7 @@ export class UploadActions {
}, {});
}
async deleteFileOrFolder(nodeId) {
async deleteFileOrFolder(nodeId: string) {
const apiCall = async () => {
try {
return this.nodesApi.deleteNode(nodeId, { permanent: true });
@@ -83,13 +83,12 @@ export class UploadActions {
return ApiUtil.waitForApi(apiCall, () => true);
}
async uploadFolder(sourcePath, folder) {
async uploadFolder(sourcePath: string, folder: string): Promise<any[]> {
const files = fs.readdirSync(sourcePath);
let uploadedFiles;
let uploadedFiles: any[];
const promises = [];
if (files && files.length > 0) {
for (const fileName of files) {
const pathFile = path.join(sourcePath, fileName);
promises.push(this.uploadFile(pathFile, fileName, folder));

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, ElementFinder, browser, $$, protractor } from 'protractor';
import { ElementFinder, browser, $$, protractor } from 'protractor';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -34,18 +34,6 @@ export class DocumentListPage {
this.tableBody = rootElement.$$('.adf-datatable-body').first();
}
async checkLockedIcon(content: string): Promise<void> {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock'));
await BrowserVisibility.waitUntilElementIsVisible(lockIcon);
}
async checkUnlockedIcon(content: string): Promise<void> {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock_open'));
await BrowserVisibility.waitUntilElementIsVisible(lockIcon);
}
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
@@ -58,10 +46,7 @@ export class DocumentListPage {
await this.dataTable.selectRow('Display name', nodeName);
}
async selectRowWithKeyboard(nodeName: string): Promise<void> {
await this.dataTable.selectRowWithKeyboard('Display name', nodeName);
}
/** @deprecated Use Playwright API instead */
async selectRowsWithKeyboard(...contentNames: string[]): Promise<void> {
let option: any;
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();

View File

@@ -1,49 +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 } from '../utils/browser-actions';
import { BrowserVisibility } from '../utils/browser-visibility';
export class NotificationHistoryPage {
notificationList = $('.adf-notification-history-list');
async clickNotificationButton(): Promise<void> {
await BrowserActions.clickExecuteScript('#adf-notification-history-open-button');
}
async clickMarkAsRead(): Promise<void> {
await BrowserActions.click($('#adf-notification-history-mark-as-read'));
}
async checkNotificationIsPresent(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementHasText(this.notificationList, text);
}
async checkNotificationCenterHasNewNotifications(): Promise<void> {
const notificationListButton = $('#adf-notification-history-open-button [class*="mat-badge-active"]');
await BrowserVisibility.waitUntilElementIsVisible(notificationListButton);
}
async checkNotifyContains(text: string): Promise<void> {
await this.clickNotificationButton();
await this.checkNotificationIsPresent(text);
await this.clickMarkAsRead();
await BrowserVisibility.waitUntilElementIsNotVisible(this.notificationList);
}
}

View File

@@ -26,7 +26,6 @@ export { LoginPage as LoginSSOPage } from './login.page';
export * from './data-table-component.page';
export * from './pagination.page';
export * from './error.page';
export * from './notification-history.page';
export * from './form/public-api';
export * from './material/public-api';
export * from './card-view/public-api';

View File

@@ -45,11 +45,6 @@ export class AppListCloudPage {
return BrowserActions.getArrayText(this.nameOfAllApps);
}
async checkAppIsNotDisplayed(applicationName: string): Promise<void> {
const app = this.getAppNameLocatorByAppName(applicationName);
await BrowserVisibility.waitUntilElementIsNotVisible(app);
}
async checkAppIsDisplayed(applicationName: string): Promise<void> {
const app = this.getAppNameLocatorByAppName(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);

View File

@@ -65,7 +65,7 @@ export class ApplicationsUtil {
return publishApp;
}
async importPublishDeployApp(appFileLocation: string, option = {}): Promise<any> {
async importPublishDeployApp(appFileLocation: string, option = {}): Promise<AppDefinitionRepresentation> {
try {
const appCreated = await this.importApplication(appFileLocation, option);
const publishApp = await this.publishDeployApp(appCreated.id);

View File

@@ -19,7 +19,10 @@ import { ApplicationsUtil } from './applications.util';
import { Logger } from '../../core/utils/logger';
import { StringUtil } from '../../../shared/utils/string.util';
import { ApiService } from '../../../shared/api/api.service';
import { TasksApi, ProcessInstancesApi, TaskRepresentation, ProcessDefinitionsApi } from '@alfresco/js-api';
import {
ProcessDefinitionsApi, ProcessInstanceRepresentation, ProcessInstancesApi, TaskRepresentation, TasksApi, ProcessDefinitionRepresentation,
ResultListDataRepresentationProcessInstanceRepresentation
} from '@alfresco/js-api';
export class ProcessUtil {
@@ -37,27 +40,27 @@ export class ProcessUtil {
this.tasksApi = new TasksApi(apiService.getInstance());
}
async startProcessByDefinitionName(appName: string, processDefinitionName: string, processName?: string): Promise<any> {
async startProcessByDefinitionName(appName: string, processDefinitionName: string, processName?: string): Promise<ProcessInstanceRepresentation> {
try {
const appDefinition = await this.applicationsUtil.getAppDefinitionByName(appName);
const processDefinition = await this.getProcessDefinitionByName(appDefinition.deploymentId, processDefinitionName);
const startProcessOptions: any = { processDefinitionId: processDefinition.id, name: processName ? processName : processDefinitionName + StringUtil.generateRandomString(5).toLowerCase() };
return this.processInstancesApi.startNewProcessInstance(startProcessOptions);
return this.processInstancesApi.startNewProcessInstance({
processDefinitionId: processDefinition.id,
name: processName ? processName : processDefinitionName + StringUtil.generateRandomString(5).toLowerCase()
});
} catch (error) {
Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error)));
return null;
}
}
async startProcessByDefinitionNameWithFormValues(appName: string, processDefinitionName: string, values: any, processName?: string): Promise<any> {
async startProcessByDefinitionNameWithFormValues(appName: string, processDefinitionName: string, values: any, processName?: string): Promise<ProcessInstanceRepresentation> {
try {
const appDefinition = await this.applicationsUtil.getAppDefinitionByName(appName);
const processDefinition = await this.getProcessDefinitionByName(appDefinition.deploymentId, processDefinitionName);
const startProcessOptions: any = {
const startProcessOptions = {
processDefinitionId: processDefinition.id,
name: processName ? processName : processDefinitionName + StringUtil.generateRandomString(5).toLowerCase(),
values
@@ -66,17 +69,19 @@ export class ProcessUtil {
return this.processInstancesApi.startNewProcessInstance(startProcessOptions);
} catch (error) {
Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error)));
return null;
}
}
async startProcessOfApp(appName: string, processName?: string): Promise<any> {
async startProcessOfApp(appName: string, processName?: string): Promise<ProcessInstanceRepresentation> {
try {
const appDefinition = await this.applicationsUtil.getAppDefinitionByName(appName);
const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId: appDefinition.deploymentId });
const startProcessOptions: any = { processDefinitionId: processDefinitionList.data[0].id, name: processName ? processName : StringUtil.generateRandomString(5).toLowerCase() };
const startProcessOptions = { processDefinitionId: processDefinitionList.data[0].id, name: processName ? processName : StringUtil.generateRandomString(5).toLowerCase() };
return this.processInstancesApi.startNewProcessInstance(startProcessOptions);
} catch (error) {
Logger.error('Start Process - Service error, Response: ', JSON.parse(JSON.stringify(error)));
return null;
}
}
@@ -88,21 +93,22 @@ export class ProcessUtil {
}
}
async getProcessDefinitionByName(deploymentId: string, processName: string): Promise<any> {
async getProcessDefinitionByName(deploymentId: string, processName: string): Promise<ProcessDefinitionRepresentation> {
try {
const processDefinitionList = await this.processDefinitionsApi.getProcessDefinitions({ deploymentId });
const chosenProcess = processDefinitionList.data.find( (processDefinition) => processDefinition.name === processName);
return chosenProcess;
return processDefinitionList.data.find((processDefinition) => processDefinition.name === processName);
} catch (error) {
Logger.error('Get ProcessDefinitions - Service error, Response: ', JSON.parse(JSON.stringify(error)));
return null;
}
}
async getProcessInstanceByName(processInstanceName: string, processInstanceStatus?: string, maxNumberOfResults?: number): Promise<any> {
async getProcessInstanceByName(processInstanceName: string, processInstanceStatus?: string, maxNumberOfResults?: number): Promise<ResultListDataRepresentationProcessInstanceRepresentation> {
try {
return await this.processInstancesApi.filterProcessInstances({filter: {name: processInstanceName, state: processInstanceStatus}, size: maxNumberOfResults});
} catch (error) {
Logger.error('List process instances using a filter - Service error, Response: ', JSON.parse(JSON.stringify(error)));
return null;
}
}

View File

@@ -21,7 +21,7 @@ import { ElementFinder, $ } from 'protractor';
export class FiltersPage {
accordionMenu = $('.app-processes-menu mat-accordion');
accordionMenu = $('.app-processes-menu');
buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div');
processIcon = 'adf-icon[data-automation-id="adf-filter-icon"]';
@@ -32,10 +32,6 @@ export class FiltersPage {
await BrowserActions.click(filterElement);
}
async isFilterEnabled(filterElement: ElementFinder): Promise<boolean> {
return filterElement.isEnabled();
}
async isFilterHighlighted(filterName: string): Promise<boolean> {
const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName);
try {
@@ -65,17 +61,4 @@ export class FiltersPage {
return false;
}
}
async checkFilterHasNoIcon(name: string): Promise<void> {
const filterName = this.getLocatorForFilterByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.$(this.processIcon));
}
async getFilterIcon(name: string): Promise<string> {
const filterName = this.getLocatorForFilterByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
const icon = filterName.$(this.processIcon);
return BrowserActions.getText(icon);
}
}