diff --git a/e2e/pages/adf/content-services/breadcrumb/breadCrumbDropdownPage.ts b/e2e/pages/adf/content-services/breadcrumb/breadCrumbDropdownPage.ts index 0504bed96e..caa2995796 100644 --- a/e2e/pages/adf/content-services/breadcrumb/breadCrumbDropdownPage.ts +++ b/e2e/pages/adf/content-services/breadcrumb/breadCrumbDropdownPage.ts @@ -23,6 +23,7 @@ export class BreadCrumbDropdownPage { 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']`)); breadCrumbDropdown = element(by.css(`div[class*='mat-select-panel']`)); + currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`)); choosePath(pathName) { 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() { BrowserVisibility.waitUntilElementIsVisible(this.breadCrumbDropdown); } + + getTextOfCurrentFolder() { + return BrowserActions.getText(this.currentFolder); + } } 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 0eb5ac0d17..e846fe22f5 100644 --- a/e2e/process-services-cloud/start-task-form-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task-form-cloud.e2e.ts @@ -28,12 +28,25 @@ import { SettingsPage, GroupIdentityService, TaskFormCloudComponent, - Widget, LocalStorageUtil, StartProcessCloudPage, TaskHeaderCloudPage, ProcessHeaderCloudPage, TasksService + Widget, + LocalStorageUtil, + StartProcessCloudPage, + TaskHeaderCloudPage, + ProcessHeaderCloudPage, + TasksService, + UploadActions, + ContentNodeSelectorDialogPage, + ProcessInstancesService, + ProcessDefinitionsService } from '@alfresco/adf-testing'; import resources = require('../util/resources'); import { StartProcessCloudConfiguration } from './config/start-process-cloud.config'; import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage'; 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', () => { @@ -43,6 +56,8 @@ describe('Start Task Form', () => { const appListCloudComponent = new AppListCloudPage(); const tasksCloudDemoPage = new TasksCloudDemoPage(); const startTask = new StartTasksCloudPage(); + const contentNodeSelectorDialogPage = new ContentNodeSelectorDialogPage(); + const breadCrumbDropdownPage = new BreadCrumbDropdownPage(); const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage(); const settingsPage = new SettingsPage(); const widget = new Widget(); @@ -54,18 +69,39 @@ describe('Start Task Form', () => { browser.params.config.oauth2.clientId, 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 startProcessCloudConfig = startProcessCloudConfiguration.getConfiguration(); const standaloneTaskName = 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 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 groupIdentityService: GroupIdentityService; + const folderName = StringUtil.generateRandomString(5); + let uploadedFolder; beforeAll(async (done) => { + await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password); identityService = new IdentityService(apiService); @@ -73,12 +109,58 @@ describe('Start Task Form', () => { testUser = await identityService.createIdentityUserWithRole(apiService, [identityService.ROLES.APS_USER]); groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr'); 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.oauth2.host, - browser.params.config.identityHost); + browser.params.config.identityHost, + 'alfresco'); loginSSOPage.loginSSOIdentityService(testUser.email, testUser.password); await LocalStorageUtil.setConfigField('adf-cloud-start-process', JSON.stringify(startProcessCloudConfig)); done(); @@ -86,11 +168,12 @@ describe('Start Task Form', () => { afterAll(async (done) => { 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); const tasksService = new TasksService(apiService); - const taskID = await tasksService.getTaskId(standaloneTaskName, candidateBaseApp); - await tasksService.deleteTask(taskID, candidateBaseApp); - await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password); + const standAloneTaskId = await tasksService.getTaskId(standaloneTaskName, candidateBaseApp); + await tasksService.deleteTask(standAloneTaskId, candidateBaseApp); await identityService.deleteIdentityUser(testUser.idIdentityService); } catch (error) { } @@ -154,6 +237,7 @@ describe('Start Task Form', () => { startProcessPage.selectFromProcessDropdown('processwithstarteventform'); startProcessPage.formFields().checkFormIsDisplayed(); }); + 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'); @@ -191,10 +275,10 @@ describe('Start Task Form', () => { processCloudDemoPage.processListCloudComponent().getDataTable().selectRow('Name', startEventFormProcess); processDetailsCloudDemoPage.checkTaskIsDisplayed('StartEventFormTask'); - processId = await processHeaderCloud.getId(); + const processId = await processHeaderCloud.getId(); processDetailsCloudDemoPage.selectProcessTaskByName('StartEventFormTask'); taskFormCloudComponent.clickClaimButton(); - taskId = await taskHeaderCloudPage.getId(); + const taskId = await taskHeaderCloudPage.getId(); taskFormCloudComponent.checkCompleteButtonIsDisplayed().clickCompleteButton(); expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks'); 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'); + }); + }); }); diff --git a/e2e/resources/activiti7/candidatebaseapp.zip b/e2e/resources/activiti7/candidatebaseapp.zip index 318d6be329..5df5689ba4 100644 Binary files a/e2e/resources/activiti7/candidatebaseapp.zip and b/e2e/resources/activiti7/candidatebaseapp.zip differ diff --git a/lib/testing/src/lib/content-services/dialog/content-node-selector-dialog.page.ts b/lib/testing/src/lib/content-services/dialog/content-node-selector-dialog.page.ts index 132e75be19..e4a80e3b95 100644 --- a/lib/testing/src/lib/content-services/dialog/content-node-selector-dialog.page.ts +++ b/lib/testing/src/lib/content-services/dialog/content-node-selector-dialog.page.ts @@ -65,6 +65,14 @@ export class ContentNodeSelectorDialogPage { return BrowserActions.click(this.cancelButton); } + checkCancelButtonIsEnabled() { + return this.cancelButton.isEnabled(); + } + + checkCopyMoveButtonIsEnabled() { + return this.moveCopyButton.isEnabled(); + } + checkMoveCopyButtonIsDisplayed() { BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton); } diff --git a/lib/testing/src/lib/core/pages/data-table-component.page.ts b/lib/testing/src/lib/core/pages/data-table-component.page.ts index f3a4487f13..fb974a02ec 100644 --- a/lib/testing/src/lib/core/pages/data-table-component.page.ts +++ b/lib/testing/src/lib/core/pages/data-table-component.page.ts @@ -329,6 +329,19 @@ export class DataTableComponentPage { 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() { return BrowserActions.getText(this.copyColumnTooltip); } diff --git a/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts b/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts new file mode 100644 index 0000000000..1cbbb2385a --- /dev/null +++ b/lib/testing/src/lib/core/pages/form/widgets/attachFileWidgetCloud.ts @@ -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; + } +} diff --git a/lib/testing/src/lib/core/pages/form/widgets/widget.ts b/lib/testing/src/lib/core/pages/form/widgets/widget.ts index 8b4acb880a..38c151f3a1 100644 --- a/lib/testing/src/lib/core/pages/form/widgets/widget.ts +++ b/lib/testing/src/lib/core/pages/form/widgets/widget.ts @@ -33,6 +33,7 @@ import { AmountWidget } from './amountWidget'; import { ContainerWidget } from './containerWidget'; import { PeopleWidget } from './peopleWidget'; import { DocumentWidget } from './documentWidget'; +import { AttachFileWidgetCloud } from './attachFileWidgetCloud'; export class Widget { @@ -52,6 +53,10 @@ export class Widget { return new AttachFileWidget(); } + attachFileWidgetCloud(fieldId: string) { + return new AttachFileWidgetCloud(fieldId); + } + displayValueWidget() { return new DisplayValueWidget(); } diff --git a/lib/testing/src/lib/core/pages/settings.page.ts b/lib/testing/src/lib/core/pages/settings.page.ts index 3451afb103..685cd545d7 100644 --- a/lib/testing/src/lib/core/pages/settings.page.ts +++ b/lib/testing/src/lib/core/pages/settings.page.ts @@ -169,6 +169,23 @@ export class SettingsPage { 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) { BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText); this.logoutUrlText.clear(); diff --git a/lib/testing/src/lib/process-services-cloud/pages/task-form-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/task-form-cloud-component.page.ts index 90fe1c809a..9b468c2e6a 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/task-form-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/task-form-cloud-component.page.ts @@ -54,6 +54,11 @@ export class TaskFormCloudComponent { return this; } + clickReleaseButton() { + BrowserActions.click(this.releaseButton); + return this; + } + formFields() { return new FormFields(); } diff --git a/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts index 8fae156284..13b92a2a88 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts @@ -79,6 +79,10 @@ export class TaskListCloudComponentPage { return this.dataTable.selectRow(column.name, taskName); } + selectRowByTaskId(taskId: string) { + return this.dataTable.selectRow(column.id, taskId); + } + getRow(taskName) { return this.dataTable.getCellElementByValue(column.name, taskName); }