[ACS-6136] cleanup e2e files (protractor) (#9009)

* cleanup e2e

* clean e2e
This commit is contained in:
Denys Vuika
2023-10-19 09:14:14 +01:00
committed by GitHub
parent b49c86fda5
commit d13db25609
9 changed files with 15 additions and 912 deletions
@@ -15,51 +15,24 @@
* limitations under the License.
*/
import { element, by, browser, $ } from 'protractor';
import {
TogglePage,
TaskFiltersCloudComponentPage,
EditTaskFilterCloudComponentPage,
TaskListCloudComponentPage,
BrowserActions, DropdownPage, TestElement, DataTableComponentPage
BrowserActions,
TestElement,
DataTableComponentPage
} from '@alfresco/adf-testing';
export class TasksCloudDemoPage {
createButton = TestElement.byCss('button[data-automation-id="create-button"');
newTaskButton = TestElement.byCss('button[data-automation-id="btn-start-task"]');
settingsButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Settings')).first();
appButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'App')).first();
displayTaskDetailsToggle = $('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]');
displayProcessDetailsToggle = $('mat-slide-toggle[data-automation-id="processDetailsRedirection"]');
multiSelectionToggle = $('mat-slide-toggle[data-automation-id="multiSelection"]');
testingModeToggle = $('mat-slide-toggle[data-automation-id="testingMode"]');
selectedRows = element(by.xpath('//div[text()=\' Selected Rows: \']'));
noOfSelectedRows = element.all(by.xpath('//div[text()=\' Selected Rows: \']//li'));
spinner = TestElement.byTag('mat-progress-spinner');
modeDropdown = new DropdownPage($('mat-form-field[data-automation-id="selectionMode"]'));
togglePage = new TogglePage();
editTaskFilterCloud = new EditTaskFilterCloudComponentPage();
taskFilterCloudComponent = new TaskFiltersCloudComponentPage();
dataTableComponentPage = new DataTableComponentPage();
async disableDisplayTaskDetails(): Promise<void> {
await this.togglePage.disableToggle(this.displayTaskDetailsToggle);
}
async disableDisplayProcessDetails(): Promise<void> {
await this.togglePage.disableToggle(this.displayProcessDetailsToggle);
}
async enableMultiSelection(): Promise<void> {
await this.togglePage.enableToggle(this.multiSelectionToggle);
}
async enableTestingMode(): Promise<void> {
await this.togglePage.enableToggle(this.testingModeToggle);
}
taskListCloudComponent(): TaskListCloudComponentPage {
return new TaskListCloudComponentPage();
}
@@ -69,37 +42,6 @@ export class TasksCloudDemoPage {
await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]');
}
async clickSettingsButton(): Promise<void> {
await BrowserActions.click(this.settingsButton);
await browser.sleep(400);
await new TestElement(this.multiSelectionToggle).waitVisible();
await this.modeDropdown.checkDropdownIsClickable();
}
async clickAppButton(): Promise<void> {
await BrowserActions.click(this.appButton);
}
async selectSelectionMode(mode: string): Promise<void> {
await this.modeDropdown.clickDropdown();
await this.modeDropdown.selectOption(mode);
}
checkSelectedRowsIsDisplayed(): Promise<void> {
return new TestElement(this.selectedRows).waitVisible();
}
async getNoOfSelectedRows(): Promise<number> {
await this.checkSelectedRowsIsDisplayed();
return this.noOfSelectedRows.count();
}
async getSelectedTaskRowText(rowNo: string): Promise<string> {
await this.checkSelectedRowsIsDisplayed();
const row = element(by.xpath(`//div[text()=' Selected Rows: ']//li[${rowNo}]`));
return BrowserActions.getText(row);
}
async clickStartNewTaskButton() {
await this.createButton.click();
await this.newTaskButton.click();
@@ -1,197 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, AppListCloudPage, GroupIdentityService, IdentityService, LoginPage, ProcessDefinitionsService, ProcessInstancesService, LocalStorageUtil } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessDetailsCloudDemoPage } from './../pages/process-details-cloud-demo.page';
import { EditProcessFilterConfiguration } from './../config/edit-process-filter.config';
import CONSTANTS = require('../../util/constants');
describe('Process list cloud', () => {
describe('Process List - selection', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processList = processCloudDemoPage.processListCloudComponent();
const processFilter = processCloudDemoPage.processFilterCloudComponent;
const tasksCloudDemoPage = new TasksCloudDemoPage();
const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
let testUser; let groupInfo;
const noOfProcesses = 3;
const processInstances = [];
const editProcessFilterConfiguration = new EditProcessFilterConfiguration();
const editProcessFilterConfigFile = editProcessFilterConfiguration.getConfiguration();
const PROCESSES = CONSTANTS.PROCESS_FILTERS;
const checkRowIsSelectedById = async (mode = 'Single') => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.selectSelectionMode(mode);
await tasksCloudDemoPage.clickAppButton();
await processFilter.isProcessFiltersListVisible();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await editProcessFilter.setFilter({ initiator: `${testUser.firstName} ${testUser.lastName}`});
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRowById(processInstances[0]);
await processList.checkRowIsSelectedById(processInstances[0]);
};
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.simpleProcess, simpleApp);
for (let i = 0; i < noOfProcesses; i++) {
const response = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
processInstances.push(response.entry.id);
}
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-edit-process-filter', JSON.stringify(editProcessFilterConfigFile));
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await expect(processInstances.length).toEqual(noOfProcesses, 'Wrong preconditions');
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await processFilter.clickOnProcessFilters();
await processFilter.clickRunningProcessesFilter();
await expect(await processFilter.getActiveFilterName()).toBe(PROCESSES.RUNNING);
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayProcessDetails();
await tasksCloudDemoPage.clickAppButton();
});
it('[C297469] Should NOT be able to select a process when settings are set to None', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.selectSelectionMode('None');
await tasksCloudDemoPage.clickAppButton();
await processFilter.isProcessFiltersListVisible();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await editProcessFilter.openFilter();
await editProcessFilter.setInitiator(`${testUser.firstName} ${testUser.lastName}`);
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRowById(processInstances[0]);
await processList.getDataTable().checkNoRowIsSelected();
});
it('[C297468] Should be able to select only one process when settings are set to Single', async () => {
await checkRowIsSelectedById();
await expect(await processList.getDataTable().getNumberOfSelectedRows()).toEqual(1);
await processList.selectRowById(processInstances[1]);
await processList.checkRowIsSelectedById(processInstances[1]);
await expect(await processList.getDataTable().getNumberOfSelectedRows()).toEqual(1);
});
it('[C297470] Should be able to select multiple processes using keyboard', async () => {
await checkRowIsSelectedById('Multiple');
await processList.selectRowWithKeyboard(processInstances[1]);
await processList.checkRowIsSelectedById(processInstances[0]);
await processList.checkRowIsSelectedById(processInstances[1]);
await processList.checkRowIsNotSelectedById(processInstances[2]);
await expect(await processList.getDataTable().getNumberOfSelectedRows()).toEqual(2);
});
it('[C297465] Should be able to select multiple processes using checkboxes', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.clickAppButton();
await processFilter.isProcessFiltersListVisible();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await editProcessFilter.setFilter({ initiator: `${testUser.firstName} ${testUser.lastName}`});
await processList.getDataTable().waitTillContentLoaded();
await processList.checkCheckboxById(processInstances[0]);
await processList.checkRowIsCheckedById(processInstances[0]);
await processList.checkCheckboxById(processInstances[1]);
await processList.checkRowIsCheckedById(processInstances[1]);
await processList.checkRowIsNotCheckedById(processInstances[2]);
await processList.checkCheckboxById(processInstances[1]);
await processList.checkRowIsNotCheckedById(processInstances[1]);
await processList.checkRowIsCheckedById(processInstances[0]);
});
it('[C299125] Should be possible to select all the rows when multiselect is true', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.clickAppButton();
await processFilter.isProcessFiltersListVisible();
await editProcessFilter.setFilter({ initiator: `${testUser.firstName} ${testUser.lastName}`});
await processList.getDataTable().waitTillContentLoaded();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await browser.sleep(1000);
await processList.getDataTable().checkAllRowsButtonIsDisplayed();
await processList.getDataTable().checkAllRows();
await processList.checkRowIsCheckedById(processInstances[0]);
await processList.checkRowIsCheckedById(processInstances[1]);
await processList.checkRowIsCheckedById(processInstances[2]);
await processList.getDataTable().checkAllRowsButtonIsDisplayed();
await processList.getDataTable().uncheckAllRows();
await processList.checkRowIsNotCheckedById(processInstances[0]);
await processList.checkRowIsNotCheckedById(processInstances[1]);
await processList.checkRowIsNotCheckedById(processInstances[2]);
});
it('[C297467] Should be able to see selected processes', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.enableTestingMode();
await tasksCloudDemoPage.clickAppButton();
await processFilter.isProcessFiltersListVisible();
await expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await editProcessFilter.setFilter({ initiator: `${testUser.firstName} ${testUser.lastName}`});
await processList.getDataTable().waitTillContentLoaded();
await processList.checkCheckboxById(processInstances[0]);
await processList.checkRowIsCheckedById(processInstances[0]);
await processDetailsCloudDemoPage.checkListedSelectedProcessInstance(processInstances[0]);
await processList.checkCheckboxById(processInstances[1]);
await processList.checkRowIsCheckedById(processInstances[1]);
await processDetailsCloudDemoPage.checkListedSelectedProcessInstance(processInstances[1]);
});
});
});
@@ -1,183 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage,
StringUtil,
TasksService
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Task list cloud - selection', () => {
describe('Task list cloud - selection', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const noOfTasks = 3;
let response; let testUser; let groupInfo;
const tasks = [];
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
for (let i = 0; i < noOfTasks; i++) {
response = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(response.entry.id, simpleApp);
tasks.push(response.entry.name);
}
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
});
it('[C291914] Should not be able to select any row when selection mode is set to None', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.selectSelectionMode('None');
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkNoRowIsSelected();
});
it('[C291918] Should be able to select only one row when selection mode is set to Single', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.selectSelectionMode('Single');
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[0]);
await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(1);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[1]);
await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().getNumberOfSelectedRows()).toEqual(1);
});
it('[C291919] Should be able to select only one row when selection mode is set to Multiple', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().selectRowWithKeyboard(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsSelected(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsNotSelected(tasks[2]);
});
it('[C291916] Should be able to select multiple row when multiselect is true', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[2]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsNotChecked(tasks[2]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsNotChecked(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[0]);
});
it('[C291915] Should be possible select all the rows when multiselect is true', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkAllRowsButtonIsDisplayed();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkAllRows();
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().checkRowIsChecked(tasks[2]);
});
it('[C297472] Should be able to see selected tasks with Multiselection and Testing switched on', async () => {
await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.enableMultiSelection();
await tasksCloudDemoPage.enableTestingMode();
await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[0]);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(tasks[1]);
await tasksCloudDemoPage.taskListCloudComponent().clickCheckbox(tasks[1]);
await expect(await tasksCloudDemoPage.getNoOfSelectedRows()).toBe(2);
await expect(await tasksCloudDemoPage.getSelectedTaskRowText('1')).toBe(tasks[0]);
await expect(await tasksCloudDemoPage.getSelectedTaskRowText('2')).toBe(tasks[1]);
});
});
});