[ADF-4823] [e2e] Displaying a file in a form does not work (#5069)

* [ADF-4823] [e2e] Displaying a file in a form does not work

* * delete removed

* * comments fixed

* * e2e fixed

* * await removed

* * form name fixed

* * rebase conflicts

* * fixed e2e
This commit is contained in:
dhrn 2019-11-26 16:41:04 +05:30 committed by Eugenio Romano
parent 90402ac43d
commit 809b38aa2b
2 changed files with 58 additions and 14 deletions

View File

@ -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);
});
});
});

View File

@ -75,23 +75,25 @@ export class AttachFileWidgetCloud {
return fileAttached.getAttribute('id');
}
async removeFile(fileName: string): Promise<void> {
async clickActionMenu(fileName: string, actionName: string): Promise<void> {
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<void> {
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<void> {
await this.clickActionMenu(fileName, 'remove');
}
async downloadFile(fileName: string): Promise<void> {
await this.clickActionMenu(fileName, 'download-file');
}
async viewFile(fileName: string): Promise<void> {
await this.clickActionMenu(fileName, 'show-file');
}
}