[ADF-5463] Rework Protractor tests - changes related to element/element… (#7284)

* ADF-5463 Rework Protractor tests - changes related to element/elements and duplication of locators

* Fix one which I missed

* Remove console.logs

* Remove console.logs

* Reverse the timeouts

* Fixed things TSLint

* Remove unused import

* Fixed broken tests

* Last test fixed
This commit is contained in:
MichalFidor
2021-10-08 17:28:37 +02:00
committed by GitHub
parent db6a638a2d
commit 1e62b46060
156 changed files with 1653 additions and 1647 deletions

View File

@@ -25,7 +25,7 @@ import {
TaskFormCloudComponent,
StartProcessCloudPage, ProcessCloudWidgetPage
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
@@ -96,11 +96,11 @@ describe('Task cloud visibility', async () => {
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '5');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '5');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '123');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '123');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
});
@@ -125,15 +125,15 @@ describe('Task cloud visibility', async () => {
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '5');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '5');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '123');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '123');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '4');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '4');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.clickCompleteButton();
});

View File

@@ -15,30 +15,30 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class PeopleGroupCloudComponentPage {
peopleCloudSingleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="app-people-single-mode"][class*="mat-radio-checked"]'));
peopleCloudMultipleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="app-people-multiple-mode"][class*="mat-radio-checked"]'));
peopleCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="app-people-single-mode"]'));
peopleCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="app-people-multiple-mode"]'));
peopleCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="app-people-filter-role"]'));
groupCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="app-group-single-mode"]'));
groupCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="app-group-multiple-mode"]'));
groupCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="app-group-filter-role"]'));
peopleRoleInput = element(by.css('input[data-automation-id="app-people-roles-input"]'));
peopleAppInput = element(by.css('input[data-automation-id="app-people-app-input"]'));
peoplePreselect = element(by.css('input[data-automation-id="app-people-preselect-input"]'));
groupRoleInput = element(by.css('input[data-automation-id="app-group-roles-input"]'));
groupAppInput = element(by.css('input[data-automation-id="app-group-app-input"]'));
peopleCloudSingleSelectionChecked = $('mat-radio-button[data-automation-id="app-people-single-mode"][class*="mat-radio-checked"]');
peopleCloudMultipleSelectionChecked = $('mat-radio-button[data-automation-id="app-people-multiple-mode"][class*="mat-radio-checked"]');
peopleCloudSingleSelection = $('mat-radio-button[data-automation-id="app-people-single-mode"]');
peopleCloudMultipleSelection = $('mat-radio-button[data-automation-id="app-people-multiple-mode"]');
peopleCloudFilterRole = $('mat-radio-button[data-automation-id="app-people-filter-role"]');
groupCloudSingleSelection = $('mat-radio-button[data-automation-id="app-group-single-mode"]');
groupCloudMultipleSelection = $('mat-radio-button[data-automation-id="app-group-multiple-mode"]');
groupCloudFilterRole = $('mat-radio-button[data-automation-id="app-group-filter-role"]');
peopleRoleInput = $('input[data-automation-id="app-people-roles-input"]');
peopleAppInput = $('input[data-automation-id="app-people-app-input"]');
peoplePreselect = $('input[data-automation-id="app-people-preselect-input"]');
groupRoleInput = $('input[data-automation-id="app-group-roles-input"]');
groupAppInput = $('input[data-automation-id="app-group-app-input"]');
peopleCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'People Cloud Component'));
groupCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'Groups Cloud Component'));
preselectValidation = element.all(by.css('mat-checkbox.app-preselect-value')).first();
preselectValidationStatus = element.all(by.css('mat-checkbox.app-preselect-value label input')).first();
peopleFilterByAppName = element(by.css('.app-people-control-options mat-radio-button[value="appName"]'));
groupFilterByAppName = element(by.css('.app-groups-control-options mat-radio-button[value="appName"]'));
preselectValidation = $$('mat-checkbox.app-preselect-value').first();
preselectValidationStatus = $$('mat-checkbox.app-preselect-value label input').first();
peopleFilterByAppName = $('.app-people-control-options mat-radio-button[value="appName"]');
groupFilterByAppName = $('.app-groups-control-options mat-radio-button[value="appName"]');
async checkPeopleCloudComponentTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle);

View File

@@ -16,12 +16,12 @@
*/
import { BrowserActions, BrowserVisibility, EditProcessFilterCloudComponentPage, ProcessFiltersCloudComponentPage, ProcessListCloudComponentPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { by, element, $ } from 'protractor';
export class ProcessCloudDemoPage {
createButton = element(by.css('button[data-automation-id="create-button"'));
newProcessButton = element(by.css('button[data-automation-id="btn-start-process"]'));
createButton = $('button[data-automation-id="create-button"');
newProcessButton = $('button[data-automation-id="btn-start-process"]');
processListCloud = new ProcessListCloudComponentPage();
editProcessFilterCloud = new EditProcessFilterCloudComponentPage();

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import {
BrowserVisibility,
BrowserActions,
@@ -24,15 +24,15 @@ import {
export class ServiceTaskListPage {
dataTableComponentPage = new DataTableComponentPage();
allServiceTaskButton = element(by.css('button[data-automation-id="my-service-tasks_filter"]'));
completedServiceTaskButton = element(by.css('button[data-automation-id="completed-tasks_filter"]'));
errorServiceTaskButton = element(by.css('button[data-automation-id="errored-service-tasks_filter"]'));
searchHeader = element(by.css('adf-cloud-edit-service-task-filter mat-expansion-panel-header'));
serviceTaskList = element(by.css('adf-cloud-service-task-list'));
activityNameField = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-activityName"]'));
activityStatus = element(by.css('[data-automation-id="datatable-row-0"] div[aria-label="Status"]'));
activityName = element(by.css('[data-automation-id="datatable-row-0"] div[aria-label="Activity name"]'));
resultList = element(by.css('div[role="rowgroup"].adf-datatable-body'));
allServiceTaskButton = $('button[data-automation-id="my-service-tasks_filter"]');
completedServiceTaskButton = $('button[data-automation-id="completed-tasks_filter"]');
errorServiceTaskButton = $('button[data-automation-id="errored-service-tasks_filter"]');
searchHeader = $('adf-cloud-edit-service-task-filter mat-expansion-panel-header');
serviceTaskList = $('adf-cloud-service-task-list');
activityNameField = $('input[data-automation-id="adf-cloud-edit-task-property-activityName"]');
activityStatus = $('[data-automation-id="datatable-row-0"] div[aria-label="Status"]');
activityName = $('[data-automation-id="datatable-row-0"] div[aria-label="Activity name"]');
resultList = $('div[role="rowgroup"].adf-datatable-body');
async checkServiceTaskFiltersDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.allServiceTaskButton);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { element, by, browser, $ } from 'protractor';
import {
TogglePage,
TaskFiltersCloudComponentPage,
@@ -30,12 +30,12 @@ export class TasksCloudDemoPage {
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 = element(by.css('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]'));
displayProcessDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="processDetailsRedirection"]'));
actionMenuToggle = element(by.css('mat-slide-toggle[data-automation-id="actionmenu"]'));
contextMenuToggle = element(by.css('mat-slide-toggle[data-automation-id="contextmenu"]'));
multiSelectionToggle = element(by.css('mat-slide-toggle[data-automation-id="multiSelection"]'));
testingModeToggle = element(by.css('mat-slide-toggle[data-automation-id="testingMode"]'));
displayTaskDetailsToggle = $('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]');
displayProcessDetailsToggle = $('mat-slide-toggle[data-automation-id="processDetailsRedirection"]');
actionMenuToggle = $('mat-slide-toggle[data-automation-id="actionmenu"]');
contextMenuToggle = $('mat-slide-toggle[data-automation-id="contextmenu"]');
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"));
addActionTitle = element(by.cssContainingText('.mat-card-title', 'Add Action'));
@@ -46,7 +46,7 @@ export class TasksCloudDemoPage {
disableCheckbox = TestElement.byCss(`mat-checkbox[formcontrolname='disabled']`);
visibleCheckbox = TestElement.byCss(`mat-checkbox[formcontrolname='visible']`);
spinner = TestElement.byTag('mat-progress-spinner');
modeDropdown = new DropdownPage(element(by.css('mat-form-field[data-automation-id="selectionMode"]')));
modeDropdown = new DropdownPage($('mat-form-field[data-automation-id="selectionMode"]'));
togglePage = new TogglePage();

View File

@@ -128,7 +128,6 @@ describe('Process Task - Attach content file', () => {
await processList.checkContentIsDisplayedById(processInstance.entry.id);
await processList.selectRowById(processInstance.entry.id);
await taskList.checkTaskListIsLoaded();
await taskList.selectRow(taskName);

View File

@@ -44,7 +44,6 @@ describe('Task filters cloud', () => {
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskList = new TaskListCloudComponentPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);