[ADF-4697] attach content to processcloudtaskform using upload widget (#4882)

* automated upload local and content file from task from upload widget.

* automated upload local and content file from task from upload widget.

* reverting the git ignore change

* updated the app with the new process definition using the form with upload widgets

* Save error screenshot

* creating the processes through api call rather than through ui. and added -log to watch the travis build on process-cloud

* creating the processes through api call rather than through ui. and added -log to watch the travis build on process-cloud

* removed the wait till clickable, as not relevant here.

* Update process-services-cloud-e2e.sh
This commit is contained in:
Geeta Mandakini Ayyalasomayajula
2019-07-02 22:00:14 +01:00
committed by Eugenio Romano
parent 0d6140be77
commit 4d0c98d753
10 changed files with 444 additions and 10 deletions

View File

@@ -23,6 +23,7 @@ export class BreadCrumbDropdownPage {
breadCrumb = element(by.css(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`)); breadCrumb = element(by.css(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`));
parentFolder = this.breadCrumb.element(by.css(`button[data-automation-id='dropdown-breadcrumb-trigger']`)); parentFolder = this.breadCrumb.element(by.css(`button[data-automation-id='dropdown-breadcrumb-trigger']`));
breadCrumbDropdown = element(by.css(`div[class*='mat-select-panel']`)); breadCrumbDropdown = element(by.css(`div[class*='mat-select-panel']`));
currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`));
choosePath(pathName) { choosePath(pathName) {
const path = this.breadCrumbDropdown.element(by.cssContainingText(`mat-option[data-automation-class='dropdown-breadcrumb-path-option'] span[class='mat-option-text']`, const path = this.breadCrumbDropdown.element(by.cssContainingText(`mat-option[data-automation-class='dropdown-breadcrumb-path-option'] span[class='mat-option-text']`,
@@ -38,4 +39,8 @@ export class BreadCrumbDropdownPage {
checkBreadCrumbDropdownIsDisplayed() { checkBreadCrumbDropdownIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.breadCrumbDropdown); BrowserVisibility.waitUntilElementIsVisible(this.breadCrumbDropdown);
} }
getTextOfCurrentFolder() {
return BrowserActions.getText(this.currentFolder);
}
} }

View File

@@ -28,12 +28,25 @@ import {
SettingsPage, SettingsPage,
GroupIdentityService, GroupIdentityService,
TaskFormCloudComponent, TaskFormCloudComponent,
Widget, LocalStorageUtil, StartProcessCloudPage, TaskHeaderCloudPage, ProcessHeaderCloudPage, TasksService Widget,
LocalStorageUtil,
StartProcessCloudPage,
TaskHeaderCloudPage,
ProcessHeaderCloudPage,
TasksService,
UploadActions,
ContentNodeSelectorDialogPage,
ProcessInstancesService,
ProcessDefinitionsService
} from '@alfresco/adf-testing'; } from '@alfresco/adf-testing';
import resources = require('../util/resources'); import resources = require('../util/resources');
import { StartProcessCloudConfiguration } from './config/start-process-cloud.config'; import { StartProcessCloudConfiguration } from './config/start-process-cloud.config';
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage'; import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
import { ProcessDetailsCloudDemoPage } from '../pages/adf/demo-shell/process-services-cloud/processDetailsCloudDemoPage'; import { ProcessDetailsCloudDemoPage } from '../pages/adf/demo-shell/process-services-cloud/processDetailsCloudDemoPage';
import { FileModel } from '../models/ACS/fileModel';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { AcsUserModel } from '../models/ACS/acsUserModel';
import { BreadCrumbDropdownPage } from '../pages/adf/content-services/breadcrumb/breadCrumbDropdownPage';
describe('Start Task Form', () => { describe('Start Task Form', () => {
@@ -43,6 +56,8 @@ describe('Start Task Form', () => {
const appListCloudComponent = new AppListCloudPage(); const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage(); const tasksCloudDemoPage = new TasksCloudDemoPage();
const startTask = new StartTasksCloudPage(); const startTask = new StartTasksCloudPage();
const contentNodeSelectorDialogPage = new ContentNodeSelectorDialogPage();
const breadCrumbDropdownPage = new BreadCrumbDropdownPage();
const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage(); const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage();
const settingsPage = new SettingsPage(); const settingsPage = new SettingsPage();
const widget = new Widget(); const widget = new Widget();
@@ -54,18 +69,39 @@ describe('Start Task Form', () => {
browser.params.config.oauth2.clientId, browser.params.config.oauth2.clientId,
browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers
); );
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: browser.params.config.bpmHost
});
const uploadActions = new UploadActions(this.alfrescoJsApi);
const startProcessCloudConfiguration = new StartProcessCloudConfiguration(); const startProcessCloudConfiguration = new StartProcessCloudConfiguration();
const startProcessCloudConfig = startProcessCloudConfiguration.getConfiguration(); const startProcessCloudConfig = startProcessCloudConfiguration.getConfiguration();
const standaloneTaskName = StringUtil.generateRandomString(5); const standaloneTaskName = StringUtil.generateRandomString(5);
const startEventFormProcess = StringUtil.generateRandomString(5); const startEventFormProcess = StringUtil.generateRandomString(5);
let testUser, groupInfo, processId, taskId; let testUser, acsUser, groupInfo;
let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService;
let processDefinition, uploadLocalFileProcess, uploadContentFileProcess, uploadDefaultFileProcess, cancelUploadFileProcess, completeUploadFileProcess;
const candidateBaseApp = resources.ACTIVITI7_APPS.CANDIDATE_BASE_APP.name; const candidateBaseApp = resources.ACTIVITI7_APPS.CANDIDATE_BASE_APP.name;
const pdfFile = new FileModel({'name': resources.Files.ADF_DOCUMENTS.PDF.file_name});
const pdfFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
const testFileModel = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location
});
let identityService: IdentityService; let identityService: IdentityService;
let groupIdentityService: GroupIdentityService; let groupIdentityService: GroupIdentityService;
const folderName = StringUtil.generateRandomString(5);
let uploadedFolder;
beforeAll(async (done) => { beforeAll(async (done) => {
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password); await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
identityService = new IdentityService(apiService); identityService = new IdentityService(apiService);
@@ -73,12 +109,58 @@ describe('Start Task Form', () => {
testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id); await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.email, testUser.password);
await settingsPage.setProviderBpmSso( await apiService.login(testUser.email, testUser.password);
processDefinitionService = new ProcessDefinitionsService(apiService);
processInstancesService = new ProcessInstancesService(apiService);
processDefinition = await processDefinitionService.getProcessDefinitionByName('uploadFileProcess', candidateBaseApp);
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
uploadLocalFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
'name': StringUtil.generateRandomString(),
'businessKey': StringUtil.generateRandomString()
});
uploadContentFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
'name': StringUtil.generateRandomString(),
'businessKey': StringUtil.generateRandomString()
});
uploadDefaultFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
'name': StringUtil.generateRandomString(),
'businessKey': StringUtil.generateRandomString()
});
cancelUploadFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
'name': StringUtil.generateRandomString(),
'businessKey': StringUtil.generateRandomString()
});
completeUploadFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
'name': StringUtil.generateRandomString(),
'businessKey': StringUtil.generateRandomString()
});
acsUser = await new AcsUserModel({
email: testUser.email,
password: testUser.password,
id: testUser.username,
firstName: testUser.firstName,
lastName: testUser.lastName
});
await this.alfrescoJsApi.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
await uploadActions.uploadFile(testFileModel.location, testFileModel.name, uploadedFolder.entry.id);
await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, uploadedFolder.entry.id);
await settingsPage.setProviderEcmBpmSso(
browser.params.config.bpmHost,
browser.params.config.bpmHost, browser.params.config.bpmHost,
browser.params.config.oauth2.host, browser.params.config.oauth2.host,
browser.params.config.identityHost); browser.params.config.identityHost,
'alfresco');
loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password); loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-start-process', JSON.stringify(startProcessCloudConfig)); await LocalStorageUtil.setConfigField('adf-cloud-start-process', JSON.stringify(startProcessCloudConfig));
done(); done();
@@ -86,11 +168,12 @@ describe('Start Task Form', () => {
afterAll(async (done) => { afterAll(async (done) => {
try { try {
await this.alfrescoJsApi.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
await uploadActions.deleteFileOrFolder(uploadedFolder.entry.id);
await apiService.login(testUser.email, testUser.password); await apiService.login(testUser.email, testUser.password);
const tasksService = new TasksService(apiService); const tasksService = new TasksService(apiService);
const taskID = await tasksService.getTaskId(standaloneTaskName, candidateBaseApp); const standAloneTaskId = await tasksService.getTaskId(standaloneTaskName, candidateBaseApp);
await tasksService.deleteTask(taskID, candidateBaseApp); await tasksService.deleteTask(standAloneTaskId, candidateBaseApp);
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
await identityService.deleteIdentityUser(testUser.idIdentityService); await identityService.deleteIdentityUser(testUser.idIdentityService);
} catch (error) { } catch (error) {
} }
@@ -154,6 +237,7 @@ describe('Start Task Form', () => {
startProcessPage.selectFromProcessDropdown('processwithstarteventform'); startProcessPage.selectFromProcessDropdown('processwithstarteventform');
startProcessPage.formFields().checkFormIsDisplayed(); startProcessPage.formFields().checkFormIsDisplayed();
}); });
it('[C311277] Should be able to start a process with a start event form - default values', async () => { it('[C311277] Should be able to start a process with a start event form - default values', async () => {
expect(widget.textWidget().getFieldValue('FirstName')).toBe('sample name'); expect(widget.textWidget().getFieldValue('FirstName')).toBe('sample name');
@@ -191,10 +275,10 @@ describe('Start Task Form', () => {
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', startEventFormProcess); processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', startEventFormProcess);
processDetailsCloudDemoPage.checkTaskIsDisplayed('StartEventFormTask'); processDetailsCloudDemoPage.checkTaskIsDisplayed('StartEventFormTask');
processId = await processHeaderCloud.getId(); const processId = await processHeaderCloud.getId();
processDetailsCloudDemoPage.selectProcessTaskByName('StartEventFormTask'); processDetailsCloudDemoPage.selectProcessTaskByName('StartEventFormTask');
taskFormCloudComponent.clickClaimButton(); taskFormCloudComponent.clickClaimButton();
taskId = await taskHeaderCloudPage.getId(); const taskId = await taskHeaderCloudPage.getId();
taskFormCloudComponent.checkCompleteButtonIsDisplayed().clickCompleteButton(); taskFormCloudComponent.checkCompleteButtonIsDisplayed().clickCompleteButton();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks'); expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId); tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId);
@@ -208,4 +292,203 @@ describe('Start Task Form', () => {
}); });
}); });
describe('Attach content to process-cloud task form using upload widget', async () => {
beforeEach(async (done) => {
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
appListCloudComponent.checkAppIsDisplayed(candidateBaseApp);
appListCloudComponent.goToApp(candidateBaseApp);
processCloudDemoPage.clickOnProcessFilters();
processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
processCloudDemoPage.processListCloudComponent().checkProcessListIsLoaded();
done();
});
it('[C310358] Should be able to attach a file to a form from local', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(uploadLocalFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', uploadLocalFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
taskFormCloudComponent.clickClaimButton();
const localFileWidget = widget.attachFileWidgetCloud('Attachlocalfile');
browser.sleep(5000);
localFileWidget.attachLocalFile(pdfFile.location);
localFileWidget.checkFileIsAttached(pdfFile.name);
localFileWidget.removeFile(pdfFile.name);
localFileWidget.checkFileIsNotAttached(pdfFile.name);
});
it('[C311285] Should be able to attach a file to a form from acs repository', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(uploadContentFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', uploadContentFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
contentNodeSelectorDialogPage.clickMoveCopyButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.removeFile(testFileModel.name);
contentFileWidget.checkFileIsNotAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsDisplayed('Attachsinglecontentfile');
});
it('[C311287] Content node selector default location when attaching a file to a form from acs repository', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(uploadDefaultFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', uploadDefaultFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
expect(breadCrumbDropdownPage.getTextOfCurrentFolder()).toBe(testUser.username);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowContentIsDisplayed(folderName);
expect(contentNodeSelectorDialogPage.checkCancelButtonIsEnabled()).toBe(true);
expect(contentNodeSelectorDialogPage.checkCopyMoveButtonIsEnabled()).toBe(false);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(folderName);
expect(contentNodeSelectorDialogPage.checkCancelButtonIsEnabled()).toBe(true);
expect(contentNodeSelectorDialogPage.checkCopyMoveButtonIsEnabled()).toBe(false);
contentNodeSelectorDialogPage.clickCancelButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
});
it('[C311288] No file should be attached when canceling the content node selector', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(cancelUploadFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', cancelUploadFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowContentIsDisplayed(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
contentNodeSelectorDialogPage.clickCancelButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
contentFileWidget.checkFileIsNotAttached(testFileModel.name);
});
it('[C311289] Should be able to attach single file', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(uploadContentFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', uploadContentFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
contentNodeSelectorDialogPage.clickMoveCopyButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
});
it('[C311292] Attached file is not displayed anymore after release if the form is not saved', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(uploadContentFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', uploadContentFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
contentNodeSelectorDialogPage.clickMoveCopyButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
taskFormCloudComponent.clickReleaseButton();
taskFormCloudComponent.clickClaimButton();
contentFileWidget.checkFileIsNotAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsDisplayed('Attachsinglecontentfile');
});
it('[C311293] Attached file is displayed after release if the form was saved', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(uploadContentFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', uploadContentFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
contentNodeSelectorDialogPage.clickMoveCopyButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
taskFormCloudComponent.clickSaveButton();
taskFormCloudComponent.clickReleaseButton();
taskFormCloudComponent.clickClaimButton();
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
});
it('[C311295] Attached file is displayed after complete', async () => {
processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedByName(completeUploadFileProcess.entry.name);
processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', completeUploadFileProcess.entry.name);
processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
contentNodeSelectorDialogPage.checkDialogIsDisplayed();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
contentNodeSelectorDialogPage.clickMoveCopyButton();
contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
const taskId = await taskHeaderCloudPage.getId();
taskFormCloudComponent.checkCompleteButtonIsDisplayed().clickCompleteButton();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId);
tasksCloudDemoPage.completedTasksFilter().clickTaskFilter();
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId);
tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(taskId);
contentFileWidget.checkFileIsAttached(testFileModel.name);
contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
});
});
}); });

View File

@@ -65,6 +65,14 @@ export class ContentNodeSelectorDialogPage {
return BrowserActions.click(this.cancelButton); return BrowserActions.click(this.cancelButton);
} }
checkCancelButtonIsEnabled() {
return this.cancelButton.isEnabled();
}
checkCopyMoveButtonIsEnabled() {
return this.moveCopyButton.isEnabled();
}
checkMoveCopyButtonIsDisplayed() { checkMoveCopyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton); BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton);
} }

View File

@@ -329,6 +329,19 @@ export class DataTableComponentPage {
BrowserActions.click(resultElement); BrowserActions.click(resultElement);
} }
checkRowContentIsDisplayed(content) {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
BrowserVisibility.waitUntilElementIsVisible(resultElement);
return this;
}
doubleClickRowByContent(name) {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
BrowserActions.click(resultElement);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
}
getCopyContentTooltip() { getCopyContentTooltip() {
return BrowserActions.getText(this.copyColumnTooltip); return BrowserActions.getText(this.copyColumnTooltip);
} }

View File

@@ -0,0 +1,94 @@
/*!
* @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 { FormFields } from '../formFields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import * as remote from 'selenium-webdriver/remote';
import { element, by, browser, ElementFinder } from 'protractor';
export class AttachFileWidgetCloud {
widget: ElementFinder;
constructor(fieldId: string) {
this.widget = this.formFields.getWidget(fieldId);
}
formFields = new FormFields();
contentButton = element(by.css('button[id="attach-Alfresco Content"]'));
filesListLocator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachLocalFile(fileLocation: string) {
browser.setFileDetector(new remote.FileDetector());
const uploadButton = this.widget.element(by.css(`a input`));
BrowserVisibility.waitUntilElementIsVisible(uploadButton);
uploadButton.sendKeys(browser.params.rootPath + '/e2e' + fileLocation);
BrowserVisibility.waitUntilElementIsVisible(uploadButton);
return this;
}
clickAttachContentFile(fileId: string) {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
BrowserActions.click(uploadButton);
BrowserActions.click(this.contentButton);
}
checkUploadContentButtonIsDisplayed(fileId: string) {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
BrowserVisibility.waitUntilElementIsVisible(uploadButton);
return this;
}
checkUploadContentButtonIsNotDisplayed(fileId: string) {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
BrowserVisibility.waitUntilElementIsNotVisible(uploadButton);
return this;
}
checkFileIsAttached(name) {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
return this;
}
checkFileIsNotAttached(name) {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
return this;
}
async getFileId(name: string) {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
const fileId = await fileAttached.getAttribute('id');
return fileId;
}
async removeFile(fileName: string) {
const fileId = await this.getFileId(fileName);
const deleteButton = this.widget.element(by.css(`button[id='${fileId}-remove']`));
BrowserActions.click(deleteButton);
return this;
}
viewFile(name) {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserActions.click(fileView);
browser.actions().doubleClick(fileView).perform();
return this;
}
}

View File

@@ -33,6 +33,7 @@ import { AmountWidget } from './amountWidget';
import { ContainerWidget } from './containerWidget'; import { ContainerWidget } from './containerWidget';
import { PeopleWidget } from './peopleWidget'; import { PeopleWidget } from './peopleWidget';
import { DocumentWidget } from './documentWidget'; import { DocumentWidget } from './documentWidget';
import { AttachFileWidgetCloud } from './attachFileWidgetCloud';
export class Widget { export class Widget {
@@ -52,6 +53,10 @@ export class Widget {
return new AttachFileWidget(); return new AttachFileWidget();
} }
attachFileWidgetCloud(fieldId: string) {
return new AttachFileWidgetCloud(fieldId);
}
displayValueWidget() { displayValueWidget() {
return new DisplayValueWidget(); return new DisplayValueWidget();
} }

View File

@@ -169,6 +169,23 @@ export class SettingsPage {
await browser.sleep(1000); await browser.sleep(1000);
} }
async setProviderEcmBpmSso(contentServicesURL: string, processServiceURL, authHost, identityHost, clientId: string, silentLogin = true, implicitFlow = true) {
await this.goToSettingsPage();
this.setProvider(this.ecmAndBpm.option, this.ecmAndBpm.text);
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
this.clickSsoRadioButton();
this.setClientId(clientId);
this.setContentServicesURL(contentServicesURL);
this.setProcessServicesURL(processServiceURL);
this.setAuthHost(authHost);
this.setIdentityHost(identityHost);
this.setSilentLogin(silentLogin);
this.setImplicitFlow(implicitFlow);
await this.clickApply();
await browser.sleep(1000);
}
async setLogoutUrl(logoutUrl) { async setLogoutUrl(logoutUrl) {
BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText); BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText);
this.logoutUrlText.clear(); this.logoutUrlText.clear();

View File

@@ -54,6 +54,11 @@ export class TaskFormCloudComponent {
return this; return this;
} }
clickReleaseButton() {
BrowserActions.click(this.releaseButton);
return this;
}
formFields() { formFields() {
return new FormFields(); return new FormFields();
} }

View File

@@ -79,6 +79,10 @@ export class TaskListCloudComponentPage {
return this.dataTable.selectRow(column.name, taskName); return this.dataTable.selectRow(column.name, taskName);
} }
selectRowByTaskId(taskId: string) {
return this.dataTable.selectRow(column.id, taskId);
}
getRow(taskName) { getRow(taskName) {
return this.dataTable.getCellElementByValue(column.name, taskName); return this.dataTable.getCellElementByValue(column.name, taskName);
} }