mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-07 18:25:09 +00:00
[AAE-1948] Form Attach File cloud widget E2E (#5543)
* [AAE-1948] Form Attach File widget E2E AAE. * * Modified attach content file e2e * * Fixed comments. * * Taking task and process name from resource file * * Fixed comments * * Used API to create process * * Fixed comments * * FIxed comments * * Fixed comment
This commit is contained in:
parent
a5a82eb649
commit
71ba89cbe7
@ -0,0 +1,142 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* 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 { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
import {
|
||||||
|
AppListCloudPage,
|
||||||
|
LoginSSOPage,
|
||||||
|
StringUtil,
|
||||||
|
TaskFormCloudComponent,
|
||||||
|
ProcessCloudWidgetPage,
|
||||||
|
ViewerPage,
|
||||||
|
UploadActions,
|
||||||
|
ContentNodeSelectorDialogPage,
|
||||||
|
ProcessDefinitionsService,
|
||||||
|
ProcessInstancesService,
|
||||||
|
ApiService
|
||||||
|
} from '@alfresco/adf-testing';
|
||||||
|
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/process-cloud-demo.page';
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigation-bar.page';
|
||||||
|
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasks-cloud-demo.page';
|
||||||
|
|
||||||
|
describe('Process Task - Attach content file', () => {
|
||||||
|
|
||||||
|
const loginSSOPage = new LoginSSOPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const appListCloudComponent = new AppListCloudPage();
|
||||||
|
const processCloudDemoPage = new ProcessCloudDemoPage();
|
||||||
|
const tasksCloudDemoPage = new TasksCloudDemoPage();
|
||||||
|
const taskFormCloudComponent = new TaskFormCloudComponent();
|
||||||
|
const processCloudWidget = new ProcessCloudWidgetPage();
|
||||||
|
const contentNodeSelectorDialog = new ContentNodeSelectorDialogPage();
|
||||||
|
const viewerPage = new ViewerPage();
|
||||||
|
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
|
||||||
|
const processDefinitionName = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.uploadSingleMultipleFiles;
|
||||||
|
const uploadWidgetId = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.uploadSingleMultiple.widgets.contentMultipleAttachFileId;
|
||||||
|
const taskName = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.tasks.uploadSingleMultipleFiles;
|
||||||
|
const folderName = StringUtil.generateRandomString(5);
|
||||||
|
|
||||||
|
let processDefinitionService: ProcessDefinitionsService;
|
||||||
|
let processInstancesService: ProcessInstancesService;
|
||||||
|
let uploadedFolder: any;
|
||||||
|
let processInstance: any;
|
||||||
|
|
||||||
|
const pdfFileOne = {
|
||||||
|
'name': browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
|
||||||
|
'location': browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_location
|
||||||
|
};
|
||||||
|
|
||||||
|
const pdfFileTwo = {
|
||||||
|
'name': browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
|
||||||
|
'location': browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_location
|
||||||
|
};
|
||||||
|
|
||||||
|
const apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, 'BPM');
|
||||||
|
this.alfrescoJsApi = new AlfrescoApi({ provider: 'ECM', hostEcm: browser.params.config.bpmHost });
|
||||||
|
const uploadActions = new UploadActions(this.alfrescoJsApi);
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
await apiService.login(browser.params.testConfig.hrUser.email, browser.params.testConfig.hrUser.password);
|
||||||
|
processDefinitionService = new ProcessDefinitionsService(apiService);
|
||||||
|
const processDefinition = await processDefinitionService.getProcessDefinitionByName(processDefinitionName, simpleApp);
|
||||||
|
processInstancesService = new ProcessInstancesService(apiService);
|
||||||
|
processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
|
||||||
|
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.hrUser.email, browser.params.testConfig.hrUser.password);
|
||||||
|
await this.alfrescoJsApi.login(browser.params.testConfig.hrUser.email, browser.params.testConfig.hrUser.password);
|
||||||
|
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
|
||||||
|
await uploadActions.uploadFile(pdfFileOne.location, pdfFileOne.name, uploadedFolder.entry.id);
|
||||||
|
await uploadActions.uploadFile(pdfFileTwo.location, pdfFileTwo.name, uploadedFolder.entry.id);
|
||||||
|
await navigationBarPage.navigateToProcessServicesCloudPage();
|
||||||
|
await appListCloudComponent.checkApsContainer();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await uploadActions.deleteFileOrFolder(uploadedFolder.entry.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C311290] Should be able to attach multiple files when widget allows multiple files to be attached from content', async () => {
|
||||||
|
await appListCloudComponent.checkAppIsDisplayed(simpleApp);
|
||||||
|
await appListCloudComponent.goToApp(simpleApp);
|
||||||
|
|
||||||
|
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
|
||||||
|
await processCloudDemoPage.processFilterCloudComponent.clickRunningProcessesFilter();
|
||||||
|
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('Running Processes');
|
||||||
|
|
||||||
|
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(processInstance.entry.id);
|
||||||
|
await processCloudDemoPage.processListCloudComponent().selectRowById(processInstance.entry.id);
|
||||||
|
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().selectRow(taskName);
|
||||||
|
|
||||||
|
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
|
||||||
|
await taskFormCloudComponent.formFields().checkWidgetIsVisible(uploadWidgetId);
|
||||||
|
const contentUploadFileWidget = await processCloudWidget.attachFileWidgetCloud(uploadWidgetId);
|
||||||
|
await contentUploadFileWidget.clickAttachContentFile(uploadWidgetId);
|
||||||
|
|
||||||
|
await contentNodeSelectorDialog.attachFileFromContentNode(folderName, pdfFileOne.name);
|
||||||
|
await viewAttachedFile(contentUploadFileWidget, pdfFileOne.name);
|
||||||
|
|
||||||
|
await taskFormCloudComponent.formFields().checkWidgetIsVisible(uploadWidgetId);
|
||||||
|
await contentUploadFileWidget.clickAttachContentFile(uploadWidgetId);
|
||||||
|
|
||||||
|
await contentNodeSelectorDialog.attachFileFromContentNode(folderName, pdfFileTwo.name);
|
||||||
|
await viewAttachedFile(contentUploadFileWidget, pdfFileTwo.name);
|
||||||
|
await taskFormCloudComponent.clickCompleteButton();
|
||||||
|
|
||||||
|
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(taskName);
|
||||||
|
|
||||||
|
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter();
|
||||||
|
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(taskName);
|
||||||
|
|
||||||
|
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
|
||||||
|
await processCloudDemoPage.processFilterCloudComponent.clickCompletedProcessesFilter();
|
||||||
|
|
||||||
|
await expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('Completed Processes');
|
||||||
|
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(processInstance.entry.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function viewAttachedFile(contentUploadWidget, fileName: string): Promise<void> {
|
||||||
|
await contentUploadWidget.checkFileIsAttached(fileName);
|
||||||
|
await contentUploadWidget.viewFile(fileName);
|
||||||
|
|
||||||
|
await viewerPage.checkFileThumbnailIsDisplayed();
|
||||||
|
await viewerPage.checkFileNameIsDisplayed(fileName);
|
||||||
|
await viewerPage.clickCloseButton();
|
||||||
|
}
|
||||||
|
});
|
@ -20,6 +20,7 @@ import { DocumentListPage } from '../pages/document-list.page';
|
|||||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||||
import { DropdownPage } from '../../material/pages/dropdown.page';
|
import { DropdownPage } from '../../material/pages/dropdown.page';
|
||||||
|
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
|
||||||
|
|
||||||
export class ContentNodeSelectorDialogPage {
|
export class ContentNodeSelectorDialogPage {
|
||||||
dialog: ElementFinder = element(by.css(`adf-content-node-selector`));
|
dialog: ElementFinder = element(by.css(`adf-content-node-selector`));
|
||||||
@ -31,6 +32,7 @@ export class ContentNodeSelectorDialogPage {
|
|||||||
moveCopyButton: ElementFinder = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`));
|
moveCopyButton: ElementFinder = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`));
|
||||||
|
|
||||||
contentList: DocumentListPage = new DocumentListPage(this.dialog);
|
contentList: DocumentListPage = new DocumentListPage(this.dialog);
|
||||||
|
dataTable: DataTableComponentPage = this.contentList.dataTablePage();
|
||||||
siteListDropdown = new DropdownPage(this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`)));
|
siteListDropdown = new DropdownPage(this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`)));
|
||||||
|
|
||||||
async checkDialogIsDisplayed(): Promise<void> {
|
async checkDialogIsDisplayed(): Promise<void> {
|
||||||
@ -90,7 +92,7 @@ export class ContentNodeSelectorDialogPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async numberOfResultsDisplayed(): Promise<number> {
|
async numberOfResultsDisplayed(): Promise<number> {
|
||||||
return this.contentList.dataTablePage().numberOfRows();
|
return this.dataTable.numberOfRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
async typeIntoNodeSelectorSearchField(text): Promise<void> {
|
async typeIntoNodeSelectorSearchField(text): Promise<void> {
|
||||||
@ -99,13 +101,32 @@ export class ContentNodeSelectorDialogPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickContentNodeSelectorResult(name): Promise<void> {
|
async clickContentNodeSelectorResult(name): Promise<void> {
|
||||||
await this.contentList.dataTablePage().clickRowByContent(name);
|
await this.dataTable.clickRowByContent(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
async doubleClickContentNodeSelectorResult(name): Promise<void> {
|
async doubleClickContentNodeSelectorResult(name): Promise<void> {
|
||||||
// First click to select from search mode and second click to actually open node
|
// First click to select from search mode and second click to actually open node
|
||||||
await this.contentList.dataTablePage().doubleClickRowByContent(name);
|
await this.dataTable.doubleClickRowByContent(name);
|
||||||
await this.contentList.dataTablePage().doubleClickRowByContent(name);
|
await this.dataTable.doubleClickRowByContent(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
async attachFileFromContentNode(folderName: string, fileName: string): Promise<void> {
|
||||||
|
await this.checkDialogIsDisplayed();
|
||||||
|
await this.checkSearchInputIsDisplayed();
|
||||||
|
await this.checkCancelButtonIsDisplayed();
|
||||||
|
|
||||||
|
await this.dataTable.waitForTableBody();
|
||||||
|
await this.dataTable.waitTillContentLoaded();
|
||||||
|
await this.dataTable.checkRowContentIsDisplayed(folderName);
|
||||||
|
await this.dataTable.doubleClickRowByContent(folderName);
|
||||||
|
|
||||||
|
await this.dataTable.waitForTableBody();
|
||||||
|
await this.dataTable.waitTillContentLoaded();
|
||||||
|
await this.dataTable.checkRowContentIsDisplayed(fileName);
|
||||||
|
|
||||||
|
await this.clickContentNodeSelectorResult(fileName);
|
||||||
|
await this.checkCopyMoveButtonIsEnabled();
|
||||||
|
await this.clickMoveCopyButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
contentListPage(): DocumentListPage {
|
contentListPage(): DocumentListPage {
|
||||||
|
@ -147,7 +147,10 @@ export const ACTIVITI_CLOUD_APPS: any = {
|
|||||||
name: 'resultcollectionform'
|
name: 'resultcollectionform'
|
||||||
},
|
},
|
||||||
uploadSingleMultiple: {
|
uploadSingleMultiple: {
|
||||||
name: 'upload-single-multiple'
|
name: 'upload-single-multiple',
|
||||||
|
widgets: {
|
||||||
|
contentMultipleAttachFileId: 'UploadMultipleFileFromContentId'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
formWithJsonWidget: {
|
formWithJsonWidget: {
|
||||||
name: 'form-with-json-widget'
|
name: 'form-with-json-widget'
|
||||||
@ -158,7 +161,8 @@ export const ACTIVITI_CLOUD_APPS: any = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
tasks: {
|
tasks: {
|
||||||
processstring: 'inputtask'
|
processstring: 'inputtask',
|
||||||
|
uploadSingleMultipleFiles: 'UploadSingleMultipleFiles'
|
||||||
},
|
},
|
||||||
security: [
|
security: [
|
||||||
{ 'role': 'ACTIVITI_ADMIN', 'groups': [], 'users': ['superadminuser', 'processadminuser'] },
|
{ 'role': 'ACTIVITI_ADMIN', 'groups': [], 'users': ['superadminuser', 'processadminuser'] },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user