diff --git a/e2e/process-services-cloud/start-task-form-cloud.e2e.ts b/e2e/process-services-cloud/start-task-form-cloud.e2e.ts index 728fd212ec..45cda4e953 100644 --- a/e2e/process-services-cloud/start-task-form-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task-form-cloud.e2e.ts @@ -37,7 +37,8 @@ import { UploadActions, ContentNodeSelectorDialogPage, ProcessInstancesService, - ProcessDefinitionsService + ProcessDefinitionsService, + FileBrowserUtil } from '@alfresco/adf-testing'; import { StartProcessCloudConfiguration } from './config/start-process-cloud.config'; import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage'; @@ -83,7 +84,7 @@ describe('Start Task Form', () => { let processDefinitionService: ProcessDefinitionsService; let processInstancesService: ProcessInstancesService; let processDefinition, uploadLocalFileProcess, uploadContentFileProcess, uploadDefaultFileProcess, - cancelUploadFileProcess, completeUploadFileProcess; + cancelUploadFileProcess, completeUploadFileProcess, downloadContentFileProcess; const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name; const pdfFile = new FileModel({ 'name': browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name }); const pdfFileModel = new FileModel({ @@ -142,6 +143,11 @@ describe('Start Task Form', () => { 'businessKey': StringUtil.generateRandomString() }); + downloadContentFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, { + 'name': StringUtil.generateRandomString(), + 'businessKey': StringUtil.generateRandomString() + }); + acsUser = await new AcsUserModel({ email: testUser.email, password: testUser.password, @@ -504,5 +510,41 @@ describe('Start Task Form', () => { await contentFileWidget.checkFileIsAttached(testFileModel.name); await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile'); }); + + it('[C315292] Should be able to download attached file from acs repository', async () => { + await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(downloadContentFileProcess.entry.name); + await processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', downloadContentFileProcess.entry.name); + await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask'); + await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask'); + await taskFormCloudComponent.clickClaimButton(); + + const contentFileWidget = await widget.attachFileWidgetCloud('Attachsinglecontentfile'); + await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile'); + await contentNodeSelectorDialogPage.checkDialogIsDisplayed(); + await contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName); + await contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded(); + await contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name); + await contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name); + + await contentNodeSelectorDialogPage.clickMoveCopyButton(); + await contentNodeSelectorDialogPage.checkDialogIsNotDisplayed(); + await contentFileWidget.checkFileIsAttached(testFileModel.name); + + await contentFileWidget.downloadFile(testFileModel.name); + await expect(await FileBrowserUtil.isFileDownloaded(testFileModel.name)).toBe(true); + + const taskId = await taskHeaderCloudPage.getId(); + await taskFormCloudComponent.clickCompleteButton(); + await expect(await tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks'); + await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId); + + await tasksCloudDemoPage.completedTasksFilter().clickTaskFilter(); + await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId); + await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(taskId); + await contentFileWidget.checkFileIsAttached(testFileModel.name); + await contentFileWidget.downloadFile(testFileModel.name); + await expect(await FileBrowserUtil.isFileDownloaded(testFileModel.name)).toBe(true); + }); + }); }); diff --git a/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts b/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts index c4b327f98d..d1b667a5be 100644 --- a/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts +++ b/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts @@ -75,23 +75,25 @@ export class AttachFileWidgetCloud { return fileAttached.getAttribute('id'); } - async removeFile(fileName: string): Promise { + async clickActionMenu(fileName: string, actionName: string): Promise { const fileId = await this.getFileId(fileName); const optionMenu = this.widget.element(by.css(`button[id='${fileId}-option-menu']`)); await BrowserActions.click(optionMenu); await BrowserActions.waitUntilActionMenuIsVisible(); - const deleteButton = element(by.css(`button#${fileId}-remove`)); - await BrowserActions.click(deleteButton); - await BrowserVisibility.waitUntilElementIsNotVisible(deleteButton); + const actionButton = element(by.css(`button#${fileId}-${actionName}`)); + await BrowserActions.click(actionButton); + await BrowserVisibility.waitUntilElementIsNotVisible(actionButton); } - async showFile(name): Promise { - const fileId = await this.getFileId(name); - const optionMenu = this.widget.element(by.css(`button[id='${fileId}-option-menu']`)); - await BrowserActions.click(optionMenu); - await BrowserActions.waitUntilActionMenuIsVisible(); - const showButton = element(by.css(`button#${fileId}-show-file`)); - await BrowserActions.click(showButton); - await BrowserVisibility.waitUntilElementIsNotVisible(showButton); + async removeFile(fileName: string): Promise { + await this.clickActionMenu(fileName, 'remove'); + } + + async downloadFile(fileName: string): Promise { + await this.clickActionMenu(fileName, 'download-file'); + } + + async viewFile(fileName: string): Promise { + await this.clickActionMenu(fileName, 'show-file'); } }