/*! * @license * Copyright © 2005-2024 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 { protractor } from 'protractor'; import { ProcessInstanceHeaderPage, TestElement, materialLocators } from '@alfresco/adf-testing'; export class ProcessDetailsPage { processInstanceHeaderPage = new ProcessInstanceHeaderPage(); processTitle = TestElement.byCss(materialLocators.Card.title.class); processDetailsMessage = TestElement.byCss('adf-process-instance-details div'); showDiagramButtonDisabled = TestElement.byCss('button[id="show-diagram-button"][disabled]'); propertiesList = TestElement.byCss('.adf-property-list'); showDiagramButton = TestElement.byId('show-diagram-button'); diagramCanvas = TestElement.byCss('svg[xmlns="http://www.w3.org/2000/svg"]'); backButton = TestElement.byCss('#btn-diagram-back'); commentInput = TestElement.byId('comment-input'); auditLogButton = TestElement.byCss('button[adf-process-audit]'); cancelProcessButton = TestElement.byCss('div[data-automation-id="header-status"] > button'); activeTask = TestElement.byCss('div[data-automation-id="active-tasks"]'); completedTask = TestElement.byCss('div[data-automation-id="completed-tasks"]'); taskTitle = TestElement.byCss('.adf-activiti-task-details__header'); checkProcessTitleIsDisplayed(): Promise { return this.processTitle.getText(); } checkProcessDetailsMessage(): Promise { return this.processDetailsMessage.getText(); } async checkProcessHeaderDetailsAreVisible(): Promise { await this.processInstanceHeaderPage.checkDetailsAreDisplayed(); } getProcessStatus(): Promise { return this.processInstanceHeaderPage.getStatusFieldValue(); } getEndDate(): Promise { return this.processInstanceHeaderPage.getEndDateFieldValue(); } getProcessCategory(): Promise { return this.processInstanceHeaderPage.getCategoryFieldValue(); } getBusinessKey(): Promise { return this.processInstanceHeaderPage.getBusinessKeyFieldValue(); } getCreatedBy(): Promise { return this.processInstanceHeaderPage.getStartedByFieldValue(); } getCreated(): Promise { return this.processInstanceHeaderPage.getStartDateFieldValue(); } getId(): Promise { return this.processInstanceHeaderPage.getIdFieldValue(); } getProcessDescription(): Promise { return this.processInstanceHeaderPage.getDescriptionFieldValue(); } async clickShowDiagram(): Promise { await this.showDiagramButton.click(); await this.diagramCanvas.waitVisible(); await this.backButton.click(); } async addComment(comment: string): Promise { await this.commentInput.waitVisible(); await this.commentInput.elementFinder.sendKeys(comment); await this.commentInput.elementFinder.sendKeys(protractor.Key.ENTER); } checkCommentIsDisplayed(comment: string): Promise { return TestElement.byText('div.adf-comment-message', comment).waitVisible(); } }