[ADF-4028][ADF-4047]Add process list cloud selection tests (#4537)

* Add process list cloud selection tests

* Fix lint issues

* Fix lint issues

* Added columns to contentServicesPage

* Fix lint error.

* Add the possibility to test the selection mode for process details.
This commit is contained in:
cristinaj
2019-04-24 20:00:52 +03:00
committed by Eugenio Romano
parent 453415d73b
commit f2c954d911
11 changed files with 360 additions and 22 deletions

View File

@@ -318,6 +318,7 @@
"MULTISELECTION": "Multiselection",
"TESTING_MODE": "Testing Mode",
"SELECTION_MODE": "Selection Mode",
"TASK_DETAILS_REDIRECTION": "Display task details on task click"
"TASK_DETAILS_REDIRECTION": "Display task details on task click",
"PROCESS_DETAILS_REDIRECTION": "Display process details on process click"
}
}

View File

@@ -8,6 +8,9 @@
<mat-slide-toggle [color]="'primary'" [checked]="taskDetailsRedirection" (change)="toggleTaskDetailsRedirection()" data-automation-id="taskDetailsRedirection">
{{ 'SETTINGS_CLOUD.TASK_DETAILS_REDIRECTION' | translate }}
</mat-slide-toggle>
<mat-slide-toggle [color]="'primary'" [checked]="processDetailsRedirection" (change)="toggleProcessDetailsRedirection()" data-automation-id="processDetailsRedirection">
{{ 'SETTINGS_CLOUD.PROCESS_DETAILS_REDIRECTION' | translate }}
</mat-slide-toggle>
<mat-form-field data-automation-id="selectionMode">
<mat-label>
{{ 'SETTINGS_CLOUD.SELECTION_MODE' | translate }}

View File

@@ -29,6 +29,7 @@ export class CloudSettingsComponent implements OnInit {
selectionMode: string;
testingMode: boolean;
taskDetailsRedirection: boolean;
processDetailsRedirection: boolean;
selectionModeOptions = [
{ value: '', title: 'None' },
@@ -49,6 +50,7 @@ export class CloudSettingsComponent implements OnInit {
this.testingMode = settings.testingMode;
this.selectionMode = settings.selectionMode;
this.taskDetailsRedirection = settings.taskDetailsRedirection;
this.processDetailsRedirection = settings.processDetailsRedirection;
}
}
@@ -67,6 +69,11 @@ export class CloudSettingsComponent implements OnInit {
this.setSetting();
}
toggleProcessDetailsRedirection() {
this.processDetailsRedirection = !this.processDetailsRedirection;
this.setSetting();
}
onSelectionModeChange() {
this.setSetting();
}
@@ -76,7 +83,8 @@ export class CloudSettingsComponent implements OnInit {
multiselect: this.multiselect,
testingMode: this.testingMode,
selectionMode: this.selectionMode,
taskDetailsRedirection: this.taskDetailsRedirection
taskDetailsRedirection: this.taskDetailsRedirection,
processDetailsRedirection: this.processDetailsRedirection
});
}
}

View File

@@ -53,6 +53,7 @@ export class ProcessesCloudDemoComponent implements OnInit {
selectedRows: string[] = [];
testingMode: boolean;
processFilterProperties: any = { filterProperties: [], sortProperties: [], actions: [] };
processDetailsRedirection: boolean;
editedFilter: ProcessFilterCloudModel;
@@ -89,6 +90,7 @@ export class ProcessesCloudDemoComponent implements OnInit {
this.multiselect = settings.multiselect;
this.testingMode = settings.testingMode;
this.selectionMode = settings.selectionMode;
this.processDetailsRedirection = settings.processDetailsRedirection;
}
}
@@ -101,7 +103,9 @@ export class ProcessesCloudDemoComponent implements OnInit {
}
onRowClick(processInstanceId) {
this.router.navigate([`/cloud/${this.appName}/process-details/${processInstanceId}`]);
if (!this.multiselect && this.selectionMode !== 'multiple' && this.processDetailsRedirection) {
this.router.navigate([`/cloud/${this.appName}/process-details/${processInstanceId}`]);
}
}
onFilterChange(query: any) {

View File

@@ -27,6 +27,7 @@ export class CloudLayoutService {
multiselect: false,
testingMode: false,
taskDetailsRedirection: true,
processDetailsRedirection: true,
selectionMode: 'single'
};

View File

@@ -0,0 +1,112 @@
/*!
* @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 { LoginPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import TestConfig = require('../../test.config');
import resources = require('../../util/resources');
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UploadActions } from '../../actions/ACS/upload.actions';
import { DropActions } from '../../actions/drop.actions';
import { FileModel } from '../../models/ACS/fileModel';
describe('Document List Component - Properties', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBar = new NavigationBarPage();
let subFolder, parentFolder;
const uploadActions = new UploadActions();
let acsUser = null;
const pngFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': resources.Files.ADF_DOCUMENTS.PNG.file_location
});
beforeAll(() => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
});
describe('Allow drop files property', async () => {
beforeEach(async (done) => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
parentFolder = await uploadActions.createFolder(this.alfrescoJsApi, 'parentFolder', '-my-');
subFolder = await uploadActions.createFolder(this.alfrescoJsApi, 'subFolder', parentFolder.entry.id);
loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
afterEach(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, subFolder.entry.id);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, parentFolder.entry.id);
done();
});
it('[C299154] Should disallow upload content on a folder row if allowDropFiles is false', () => {
navigationBar.clickContentServicesButton();
contentServicesPage.doubleClickRow(parentFolder.entry.name);
contentServicesPage.disableDropFilesInAFolder();
const dragAndDropArea = contentServicesPage.getRowByName(subFolder.entry.name);
const dragAndDrop = new DropActions();
dragAndDrop.dropFile(dragAndDropArea, pngFile.location);
contentServicesPage.checkContentIsDisplayed(pngFile.name);
contentServicesPage.doubleClickRow(subFolder.entry.name);
contentServicesPage.checkEmptyFolderTextToBe('This folder is empty');
});
it('[C91319] Should allow upload content on a folder row if allowDropFiles is true', () => {
navigationBar.clickContentServicesButton();
contentServicesPage.doubleClickRow(parentFolder.entry.name);
contentServicesPage.enableDropFilesInAFolder();
const dragAndDropArea = contentServicesPage.getRowByName(subFolder.entry.name);
const dragAndDrop = new DropActions();
dragAndDrop.dropFile(dragAndDropArea, pngFile.location);
contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
contentServicesPage.doubleClickRow(subFolder.entry.name);
contentServicesPage.checkContentIsDisplayed(pngFile.name);
});
});
});

View File

@@ -18,6 +18,7 @@
import TestConfig = require('../../test.config');
import { CreateFolderDialog } from './dialog/createFolderDialog';
import { CreateLibraryDialog } from './dialog/createLibraryDialog';
import { FormControllersPage } from '@alfresco/adf-testing';
import { DropActions } from '../../actions/drop.actions';
import { by, element, protractor, $$, browser } from 'protractor';
@@ -27,7 +28,17 @@ import { BrowserVisibility, DocumentListPage } from '@alfresco/adf-testing';
export class ContentServicesPage {
columns = {
name: 'Display name',
size: 'Size',
nodeId: 'Node id',
createdBy: 'Created by',
created: 'Created'
};
contentList = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first());
formControllersPage = new FormControllersPage();
multipleFileUploadToggle = element(by.id('adf-document-list-enable-drop-files'));
createFolderDialog = new CreateFolderDialog();
createLibraryDialog = new CreateLibraryDialog();
dragAndDropAction = new DropActions();
@@ -165,16 +176,26 @@ export class ContentServicesPage {
return this;
}
enableDropFilesInAFolder() {
this.formControllersPage.enableToggle(this.multipleFileUploadToggle);
return this;
}
disableDropFilesInAFolder() {
this.formControllersPage.disableToggle(this.multipleFileUploadToggle);
return this;
}
getElementsDisplayedSize() {
return this.contentList.dataTablePage().getAllRowsColumnValues('Size');
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.size);
}
getElementsDisplayedName() {
return this.contentList.dataTablePage().getAllRowsColumnValues('Display name');
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.name);
}
getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues('Node id');
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
checkElementsSortedAsc(elements) {
@@ -311,7 +332,7 @@ export class ContentServicesPage {
}
getAllRowsNameColumn() {
return this.contentList.getAllRowsColumnValues('Display name');
return this.contentList.getAllRowsColumnValues(this.columns.name);
}
sortByName(sortOrder) {
@@ -336,19 +357,19 @@ export class ContentServicesPage {
}
async checkListIsSortedByNameColumn(sortOrder) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, 'Display name');
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.name);
}
async checkListIsSortedByCreatedColumn(sortOrder) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, 'Created');
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.created);
}
async checkListIsSortedByAuthorColumn(sortOrder) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, 'Created by');
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.createdBy);
}
async checkListIsSortedBySizeColumn(sortOrder) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, 'Size');
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.size);
}
sortAndCheckListIsOrderedByAuthor(sortOrder) {
@@ -396,7 +417,7 @@ export class ContentServicesPage {
}
checkContentIsDisplayed(content) {
this.contentList.dataTablePage().checkContentIsDisplayed('Display name', content);
this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content);
return this;
}
@@ -408,7 +429,7 @@ export class ContentServicesPage {
}
checkContentIsNotDisplayed(content) {
this.contentList.dataTablePage().checkContentIsNotDisplayed('Display name', content);
this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content);
return this;
}
@@ -551,7 +572,7 @@ export class ContentServicesPage {
}
getColumnValueForRow(file, columnName) {
return this.contentList.dataTablePage().getColumnValueForRow('Display name', file, columnName);
return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
}
async getStyleValueForRowText(rowName, styleName) {
@@ -651,7 +672,7 @@ export class ContentServicesPage {
}
checkRowIsDisplayed(rowName) {
const row = this.contentList.dataTablePage().getCellElementByValue('Display name', rowName);
const row = this.contentList.dataTablePage().getCellElementByValue(this.columns.name, rowName);
BrowserVisibility.waitUntilElementIsVisible(row);
}
@@ -674,4 +695,8 @@ export class ContentServicesPage {
this.multiSelectToggle.click();
}
getRowByName(rowName) {
return this.contentList.dataTable.getRow(this.columns.name, rowName);
}
}

View File

@@ -98,5 +98,4 @@ export class ProcessCloudDemoPage {
this.createButton.click();
return this;
}
}

View File

@@ -34,6 +34,7 @@ export class TasksCloudDemoPage {
modeDropDownArrow = element(by.css('mat-form-field[data-automation-id="selectionMode"] div[class*="arrow-wrapper"]'));
modeSelector = element(by.css("div[class*='mat-select-panel']"));
displayTaskDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]'));
displayProcessDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="processDetailsRedirection"]'));
multiSelectionToggle = element(by.css('mat-slide-toggle[data-automation-id="multiSelection"]'));
formControllersPage = new FormControllersPage();
@@ -45,6 +46,11 @@ export class TasksCloudDemoPage {
return this;
}
disableDisplayProcessDetails() {
this.formControllersPage.disableToggle(this.displayProcessDetailsToggle);
return this;
}
enableMultiSelection() {
this.formControllersPage.enableToggle(this.multiSelectionToggle);
return this;

View File

@@ -0,0 +1,150 @@
/*!
* @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 TestConfig = require('../test.config');
import { LoginSSOPage } from '@alfresco/adf-testing';
import { SettingsPage } from '@alfresco/adf-testing';
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
import { AppListCloudPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
import { ProcessDefinitionsService, ApiService } from '@alfresco/adf-testing';
import { ProcessInstancesService } from '@alfresco/adf-testing';
import { browser } from 'protractor';
describe('Process list cloud', () => {
describe('Process List - selection', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService;
let silentLogin;
const simpleApp = 'simple-app';
const noOfProcesses = 3;
let response;
const processInstances = [];
beforeAll(async (done) => {
silentLogin = false;
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin);
loginSSOPage.clickOnSSOButton();
browser.ignoreSynchronization = true;
loginSSOPage.loginSSOIdentityService(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
const apiService = new ApiService('activiti', TestConfig.adf.hostBPM, TestConfig.adf.hostSso, 'BPM');
await apiService.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
processDefinitionService = new ProcessDefinitionsService(apiService);
const processDefinition = await processDefinitionService.getProcessDefinitions(simpleApp);
processInstancesService = new ProcessInstancesService(apiService);
for (let i = 0; i < noOfProcesses; i++) {
response = await processInstancesService.createProcessInstance(processDefinition.list.entries[0].entry.key, simpleApp);
processInstances.push(response.entry.id);
}
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
appListCloudComponent.goToApp(simpleApp);
processCloudDemoPage.clickOnProcessFilters();
processCloudDemoPage.runningProcessesFilter().clickProcessFilter();
expect(processCloudDemoPage.getActiveFilterName()).toBe('Running Processes');
tasksCloudDemoPage.clickSettingsButton().disableDisplayProcessDetails();
tasksCloudDemoPage.clickAppButton();
done();
});
it('[C297469] Should NOT be able to select a process when settings are set to None', () => {
tasksCloudDemoPage.clickSettingsButton().selectSelectionMode('None');
tasksCloudDemoPage.clickAppButton();
expect(processCloudDemoPage.getActiveFilterName()).toEqual('Running Processes');
processCloudDemoPage.processListCloudComponent().selectRowById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().getDataTable().checkNoRowIsSelected();
});
it('[C297468] Should be able to select only one process when settings are set to Single', () => {
tasksCloudDemoPage.clickSettingsButton().selectSelectionMode('Single');
tasksCloudDemoPage.clickAppButton();
expect(processCloudDemoPage.getActiveFilterName()).toEqual('Running Processes');
processCloudDemoPage.processListCloudComponent().selectRowById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkRowIsSelectedById(processInstances[0]);
expect(processCloudDemoPage.processListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(1);
processCloudDemoPage.processListCloudComponent().selectRowById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsSelectedById(processInstances[1]);
expect(processCloudDemoPage.processListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(1);
});
it('[C297470] Should be able to select multiple processes using keyboard', () => {
tasksCloudDemoPage.clickSettingsButton().selectSelectionMode('Multiple');
tasksCloudDemoPage.clickAppButton();
expect(processCloudDemoPage.getActiveFilterName()).toEqual('Running Processes');
processCloudDemoPage.processListCloudComponent().selectRowById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkRowIsSelectedById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().selectRowWithKeyboard(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsSelectedById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkRowIsSelectedById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsNotSelectedById(processInstances[2]);
expect(processCloudDemoPage.processListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(2);
});
it('[C297465] Should be able to select multiple processes using checkboxes', () => {
tasksCloudDemoPage.clickSettingsButton().enableMultiSelection();
tasksCloudDemoPage.clickAppButton();
expect(processCloudDemoPage.getActiveFilterName()).toEqual('Running Processes');
processCloudDemoPage.processListCloudComponent().checkCheckboxById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkRowIsCheckedById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkCheckboxById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsCheckedById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsNotCheckedById(processInstances[2]);
processCloudDemoPage.processListCloudComponent().checkCheckboxById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsNotCheckedById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsCheckedById(processInstances[0]);
});
it('[C299125] Should be possible to select all the rows when multiselect is true', () => {
tasksCloudDemoPage.clickSettingsButton().enableMultiSelection();
tasksCloudDemoPage.clickAppButton();
expect(processCloudDemoPage.getActiveFilterName()).toEqual('Running Processes');
processCloudDemoPage.processListCloudComponent().getDataTable().checkAllRowsButtonIsDisplayed().checkAllRows();
processCloudDemoPage.processListCloudComponent().checkRowIsCheckedById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkRowIsCheckedById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsCheckedById(processInstances[2]);
processCloudDemoPage.processListCloudComponent().getDataTable().checkAllRowsButtonIsDisplayed().checkAllRows();
processCloudDemoPage.processListCloudComponent().checkRowIsNotCheckedById(processInstances[0]);
processCloudDemoPage.processListCloudComponent().checkRowIsNotCheckedById(processInstances[1]);
processCloudDemoPage.processListCloudComponent().checkRowIsNotCheckedById(processInstances[2]);
});
});
});

View File

@@ -21,6 +21,11 @@ import { element, by } from 'protractor';
export class ProcessListCloudComponentPage {
columns = {
id: 'Id',
name: 'Name'
};
processList = element(by.css('adf-cloud-process-list'));
noProcessFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
@@ -31,27 +36,51 @@ export class ProcessListCloudComponentPage {
}
selectRow(processName) {
return this.dataTable.selectRow('Name', processName);
return this.dataTable.selectRow(this.columns.name, processName);
}
selectRowById(processId) {
return this.dataTable.selectRow('Id', processId);
return this.dataTable.selectRow(this.columns.id, processId);
}
checkRowIsSelectedById(processId) {
return this.dataTable.checkRowIsSelected(this.columns.id, processId);
}
checkRowIsNotSelectedById(processId) {
return this.dataTable.checkRowIsNotSelected(this.columns.id, processId);
}
checkRowIsCheckedById(processId) {
return this.dataTable.checkRowIsChecked(this.columns.id, processId);
}
checkRowIsNotCheckedById(processId) {
return this.dataTable.checkRowIsNotChecked(this.columns.id, processId);
}
checkCheckboxById(processId) {
return this.dataTable.clickCheckbox(this.columns.id, processId);
}
checkContentIsDisplayedByName(processName) {
return this.dataTable.checkContentIsDisplayed('Name', processName);
return this.dataTable.checkContentIsDisplayed(this.columns.name, processName);
}
checkContentIsDisplayedById(processId) {
return this.dataTable.checkContentIsDisplayed('Id', processId);
return this.dataTable.checkContentIsDisplayed(this.columns.id, processId);
}
checkContentIsNotDisplayedById(processId) {
return this.dataTable.checkContentIsNotDisplayed('Id', processId);
return this.dataTable.checkContentIsNotDisplayed(this.columns.id, processId);
}
selectRowWithKeyboard(processId) {
return this.dataTable.selectRowWithKeyboard(this.columns.id, processId);
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues('Name');
return this.dataTable.getAllRowsColumnValues(this.columns.name);
}
checkProcessListIsLoaded() {