From 1e62b46060f2a319c721fb2dce23bfec0b777492 Mon Sep 17 00:00:00 2001 From: MichalFidor <42964298+MichalFidor@users.noreply.github.com> Date: Fri, 8 Oct 2021 17:28:37 +0200 Subject: [PATCH] =?UTF-8?q?[ADF-5463]=20Rework=20Protractor=20tests=20-=20?= =?UTF-8?q?changes=20related=20to=20element/element=E2=80=A6=20(#7284)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../document-list-folder-actions.e2e.ts | 4 +- .../pages/permissions.page.ts | 4 +- e2e/content-services/pages/social.page.ts | 4 +- e2e/content-services/pages/tag.page.ts | 6 +- e2e/content-services/pages/tree-view.page.ts | 16 +- e2e/core/pages/card-view-component.page.ts | 58 +++--- e2e/core/pages/comments.page.ts | 16 +- e2e/core/pages/content-services.page.ts | 129 ++++++------- e2e/core/pages/custom-sources.page.ts | 6 +- e2e/core/pages/data-table.page.ts | 24 +-- .../dialog/create-library-dialog.page.ts | 6 +- e2e/core/pages/dialog/folder-dialog.page.ts | 16 +- e2e/core/pages/dialog/share-dialog.page.ts | 28 +-- e2e/core/pages/dialog/upload-dialog.page.ts | 64 +++--- e2e/core/pages/dialog/upload-toggles.page.ts | 28 +-- e2e/core/pages/icons.page.ts | 11 +- e2e/core/pages/infinite-pagination.page.ts | 10 +- e2e/core/pages/login-shell.page.ts | 54 +++--- e2e/core/pages/logout.page.ts | 4 +- e2e/core/pages/metadata-view.page.ts | 87 +++++---- e2e/core/pages/navigation-bar.page.ts | 54 +++--- e2e/core/pages/notification.page.ts | 24 +-- e2e/core/pages/trashcan.page.ts | 16 +- e2e/core/pages/version-manager.page.ts | 8 +- e2e/core/pagination-empty-current-page.e2e.ts | 4 - .../task-visibility-condition.e2e.ts | 12 +- .../people-group-cloud-component.page.ts | 36 ++-- .../pages/process-cloud-demo.page.ts | 6 +- .../pages/service-task-list.page.ts | 20 +- .../pages/tasks-cloud-demo.page.ts | 16 +- ...cess-task-attach-content-file-cloud.e2e.ts | 1 - .../task-list/tasks-custom-filters.e2e.ts | 1 - .../form/attach-form-component.e2e.ts | 4 +- e2e/process-services/pages/analytics.page.ts | 10 +- .../pages/attach-form.page.ts | 18 +- .../pages/attachment-list.page.ts | 28 +-- .../pages/dialog/app-settings-toggles.page.ts | 8 +- .../dialog/create-checklist-dialog.page.ts | 10 +- .../pages/dialog/start-task-dialog.page.ts | 20 +- e2e/process-services/pages/filters.page.ts | 8 +- e2e/process-services/pages/form-demo.page.ts | 10 +- .../pages/process-filters.page.ts | 60 +++--- .../pages/process-list-demo.page.ts | 14 +- .../pages/process-list.page.ts | 6 +- .../pages/process-services.page.ts | 30 +-- .../pages/task-details.page.ts | 118 ++++++------ .../pages/task-filters-demo.page.ts | 14 +- .../pages/task-filters.page.ts | 10 +- .../pages/task-list-demo.page.ts | 34 ++-- e2e/process-services/pages/tasks-list.page.ts | 6 +- e2e/process-services/pages/tasks.page.ts | 30 ++- .../comment-component-processes.e2e.ts | 1 - .../tasks/start-task-custom-app.e2e.ts | 12 +- .../tasks/start-task-task-app.e2e.ts | 14 +- e2e/protractor.conf.js | 2 +- e2e/search/pages/search-bar.page.ts | 30 ++- e2e/search/pages/search-filters.page.ts | 36 ++-- e2e/search/pages/search-results.page.ts | 4 +- e2e/search/search-multiselect.e2e.ts | 6 +- .../dialog/add-permissions-dialog.page.ts | 28 +-- .../content-node-selector-dialog.page.ts | 20 +- .../dialog/download-dialog.page.ts | 4 +- .../breadcrumb/breadcrumb-dropdown.page.ts | 10 +- .../pages/document-list.page.ts | 12 +- .../content-services/pages/like.page.ts | 8 +- .../content-services/pages/rate.page.ts | 23 ++- .../pages/search/date-range-filter.page.ts | 66 +++---- .../pages/search/number-range-filter.page.ts | 76 ++++---- .../pages/search/search-categories.page.ts | 6 +- .../pages/search/search-check-list.page.ts | 56 +++--- .../pages/search/search-radio.page.ts | 12 +- .../pages/search/search-slider.page.ts | 30 +-- .../search/search-sorting-picker.page.ts | 6 +- .../pages/search/search-text.page.ts | 8 +- .../pages/upload-button.page.ts | 14 +- .../core/dialog/edit-json-dialog.ts | 6 +- .../lib/protractor/core/pages/about.page.ts | 34 ++-- .../protractor/core/pages/bread-crumb.page.ts | 8 +- .../card-view/card-view-boolean-item.page.ts | 10 +- .../card-view/card-view-date-item.page.ts | 14 +- .../card-view/card-view-select-item.page.ts | 16 +- .../card-view/card-view-text-item.page.ts | 40 ++-- .../core/pages/config-editor-page.ts | 8 +- .../core/pages/context-menu.page.ts | 6 +- .../core/pages/data-table-component.page.ts | 111 +++++------ .../core/pages/data-table/data-table-item.ts | 10 +- .../lib/protractor/core/pages/error.page.ts | 8 +- .../protractor/core/pages/form/form-fields.ts | 58 +++--- .../protractor/core/pages/form/form.page.ts | 10 +- .../pages/form/widgets/amount-widget.page.ts | 14 +- .../form/widgets/attach-file-widget.page.ts | 71 +++---- .../form/widgets/attach-folder-widget.page.ts | 25 +-- .../form/widgets/checkbox-widget.page.ts | 10 +- .../form/widgets/container-widget.page.ts | 2 +- .../form/widgets/date-time-widget.page.ts | 14 +- .../pages/form/widgets/date-widget.page.ts | 12 +- .../form/widgets/display-value-widget.page.ts | 6 +- .../form/widgets/dropdown-widget.page.ts | 6 +- .../form/widgets/dynamic-table-widget.page.ts | 28 +-- .../pages/form/widgets/group-widget.page.ts | 6 +- .../form/widgets/hyperlink-widget.page.ts | 4 +- .../pages/form/widgets/json-widget.page.ts | 8 +- .../widgets/multiline-text-widget.page.ts | 2 +- .../pages/form/widgets/number-widget.page.ts | 8 +- .../pages/form/widgets/people-widget.page.ts | 12 +- .../form/widgets/radio-buttons-widget.page.ts | 4 +- .../core/pages/form/widgets/tab.page.ts | 4 +- .../pages/form/widgets/text-widget.page.ts | 2 +- .../form/widgets/typeahead-widget.page.ts | 16 +- .../lib/protractor/core/pages/header.page.ts | 28 +-- .../protractor/core/pages/info-drawer.page.ts | 10 +- .../lib/protractor/core/pages/login.page.ts | 22 +-- .../material/date-picker-calendar.page.ts | 18 +- .../core/pages/material/date-picker.page.ts | 6 +- .../date-time-picker-calendar.page.ts | 24 +-- .../pages/material/date-time-picker.page.ts | 6 +- .../core/pages/material/dropdown.page.ts | 12 +- .../core/pages/material/tabs.page.ts | 4 +- .../core/pages/material/toggle.page.ts | 6 +- .../core/pages/notification-history.page.ts | 8 +- .../protractor/core/pages/pagination.page.ts | 44 ++--- .../protractor/core/pages/settings.page.ts | 28 +-- .../protractor/core/pages/snackbar.page.ts | 12 +- .../protractor/core/pages/user-info.page.ts | 36 ++-- .../lib/protractor/core/pages/viewer.page.ts | 182 +++++++++--------- .../src/lib/protractor/core/test-element.ts | 4 +- .../protractor/core/utils/browser-actions.ts | 6 +- .../core/utils/browser-visibility.ts | 4 +- .../protractor/core/utils/protractor.util.ts | 4 +- .../app/app-list-cloud.page.ts | 16 +- .../dialog/edit-process-filter-dialog.page.ts | 22 +-- .../dialog/edit-task-filter-dialog.page.ts | 24 +-- ...dit-process-filter-cloud-component.page.ts | 59 +++--- .../edit-task-filter-cloud-component.page.ts | 56 +++--- .../pages/form-cloud-component.page.ts | 10 +- .../widget/attach-file-widget-cloud.page.ts | 26 +-- .../pages/group-cloud-component.page.ts | 23 +-- .../pages/people-cloud-component.page.ts | 34 ++-- .../process-filters-cloud-component.page.ts | 15 +- .../process-header-cloud-component.page.ts | 18 +- .../process-list-cloud-component.page.ts | 18 +- .../start-process-cloud-component.page.ts | 30 +-- .../pages/start-tasks-cloud-component.page.ts | 24 +-- .../task-filters-cloud-component.page.ts | 24 +-- .../pages/task-form-cloud-component.page.ts | 32 +-- .../pages/task-header-cloud-component.page.ts | 10 +- .../pages/task-list-cloud-component.page.ts | 19 +- .../external-node-selector-dialog.page.ts | 20 +- .../process-services/pages/filters.page.ts | 25 +-- .../pages/process-filters.page.ts | 10 +- .../pages/process-instance-tasks.page.ts | 8 +- .../pages/select-apps-dialog.page.ts | 10 +- .../pages/start-process.page.ts | 30 +-- .../pages/task-filters.page.ts | 14 +- .../process-services/pages/task-form.page.ts | 8 +- lib/testing/src/lib/shared/api/api.service.ts | 1 + 156 files changed, 1672 insertions(+), 1666 deletions(-) diff --git a/e2e/content-services/document-list/document-list-folder-actions.e2e.ts b/e2e/content-services/document-list/document-list-folder-actions.e2e.ts index 245e6ea90f9..2222fcf60c0 100644 --- a/e2e/content-services/document-list/document-list-folder-actions.e2e.ts +++ b/e2e/content-services/document-list/document-list-folder-actions.e2e.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { createApiService, BreadcrumbPage, BreadcrumbDropdownPage, @@ -47,7 +47,7 @@ describe('Document List Component - Actions', () => { const usersActions = new UsersActions(apiService); const uploadActions = new UploadActions(apiService); - const infinitePaginationPage = new InfinitePaginationPage(element(by.css('adf-content-node-selector'))); + const infinitePaginationPage = new InfinitePaginationPage($('adf-content-node-selector')); describe('Folder Actions - Copy and Move', () => { const folderModel1 = new FolderModel({ name: StringUtil.generateRandomString() }); diff --git a/e2e/content-services/pages/permissions.page.ts b/e2e/content-services/pages/permissions.page.ts index e3043d256f9..8a71964ab11 100644 --- a/e2e/content-services/pages/permissions.page.ts +++ b/e2e/content-services/pages/permissions.page.ts @@ -22,7 +22,7 @@ import { DropdownPage, TestElement } from '@alfresco/adf-testing'; -import { browser, by } from 'protractor'; +import { browser } from 'protractor'; export class PermissionsPage { @@ -55,7 +55,7 @@ export class PermissionsPage { async clickRoleDropdownByUserOrGroupName(name: string): Promise { const row = this.dataTableComponentPage.getRow('Users and Groups', name); await row.click(); - await BrowserActions.click(row.element(by.css('[id="adf-select-role-permission"] .mat-select-trigger'))); + await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger')); await TestElement.byCss('.mat-select-panel').waitVisible(); } diff --git a/e2e/content-services/pages/social.page.ts b/e2e/content-services/pages/social.page.ts index 0d66cd4f2fc..9fde52f8739 100644 --- a/e2e/content-services/pages/social.page.ts +++ b/e2e/content-services/pages/social.page.ts @@ -15,12 +15,12 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '@alfresco/adf-testing'; export class SocialPage { - nodeIdField = element(by.css(`input[id="nodeId"]`)); + nodeIdField = $(`input[id="nodeId"]`); async getNodeIdFieldValue(): Promise { return BrowserActions.getInputValue(this.nodeIdField); diff --git a/e2e/content-services/pages/tag.page.ts b/e2e/content-services/pages/tag.page.ts index 7c1b7a0a4ed..5f81e224d30 100644 --- a/e2e/content-services/pages/tag.page.ts +++ b/e2e/content-services/pages/tag.page.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import { element, by, protractor, browser } from 'protractor'; +import { by, protractor, browser, $, $$ } from 'protractor'; import { BrowserActions, TestElement } from '@alfresco/adf-testing'; export class TagPage { addTagButton = TestElement.byCss('#add-tag'); - insertNodeIdElement = element(by.css('input[id="nodeId"]')); + insertNodeIdElement = $('input[id="nodeId"]'); newTagInput = TestElement.byCss('input[id="new-tag-text"]'); tagListRow = TestElement.byCss('adf-tag-node-actions-list mat-list-item'); tagListByNodeIdRow = TestElement.byCss('adf-tag-node-list mat-chip'); @@ -30,7 +30,7 @@ export class TagPage { showDeleteButton = TestElement.byCss('#adf-remove-button-tag'); showMoreButton = TestElement.byCss('button[data-automation-id="show-more-tags"]'); showLessButton = TestElement.byCss('button[data-automation-id="show-fewer-tags"]'); - tagsOnPage = element.all(by.css('div[class*="adf-list-tag"]')); + tagsOnPage = $$('div[class*="adf-list-tag"]'); confirmTag = TestElement.byCss('#adf-tag-node-send'); getNodeId(): Promise { diff --git a/e2e/content-services/pages/tree-view.page.ts b/e2e/content-services/pages/tree-view.page.ts index b0be3c5d9d8..83bb935ad98 100644 --- a/e2e/content-services/pages/tree-view.page.ts +++ b/e2e/content-services/pages/tree-view.page.ts @@ -15,15 +15,15 @@ * limitations under the License. */ -import { element, by, protractor } from 'protractor'; +import { element, by, protractor, $, $$ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class TreeViewPage { treeViewTitle = element(by.cssContainingText('app-tree-view div', 'TREE VIEW TEST')); - nodeIdInput = element(by.css('input[data-placeholder="Node Id"]')); - noNodeMessage = element(by.id('adf-tree-view-missing-node')); - nodesOnPage = element.all(by.css('mat-tree-node')); + nodeIdInput = $('input[data-placeholder="Node Id"]'); + noNodeMessage = $('#adf-tree-view-missing-node'); + nodesOnPage = $$('mat-tree-node'); async checkTreeViewTitleIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.treeViewTitle); @@ -34,17 +34,17 @@ export class TreeViewPage { } async clickNode(nodeName: string): Promise { - const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"] button')); + const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"] button'); await BrowserActions.click(node); } async checkNodeIsDisplayedAsClosed(nodeName: string): Promise { - const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]')); + const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]'); await BrowserVisibility.waitUntilElementIsVisible(node); } async checkNodeIsDisplayedAsOpen(nodeName: string): Promise { - const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]')); + const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]'); await BrowserVisibility.waitUntilElementIsVisible(node); } @@ -54,7 +54,7 @@ export class TreeViewPage { } async checkNodeIsNotDisplayed(nodeName: string): Promise { - const node = element(by.id('' + nodeName + '-tree-child-node')); + const node = $('#' + nodeName + '-tree-child-node'); await BrowserVisibility.waitUntilElementIsNotVisible(node); } diff --git a/e2e/core/pages/card-view-component.page.ts b/e2e/core/pages/card-view-component.page.ts index a13b0d2f60f..9b63b895e17 100644 --- a/e2e/core/pages/card-view-component.page.ts +++ b/e2e/core/pages/card-view-component.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $, by, element } from 'protractor'; import { BrowserVisibility, BrowserActions, @@ -29,19 +29,19 @@ export class CardViewComponentPage { addButton = element(by.className('adf-card-view__key-value-pairs__add-btn')); nameCardTextItem = new CardTextItemPage('name'); booleanCardBooleanItem = new CardBooleanItemPage('boolean'); - intField = element(by.css(`input[data-automation-id='card-textitem-editinput-int']`)); - floatField = element(by.css(`input[data-automation-id='card-textitem-editinput-float']`)); + intField = $(`input[data-automation-id='card-textitem-editinput-int']`); + floatField = $(`input[data-automation-id='card-textitem-editinput-float']`); valueInputField = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Value']`)); nameInputField = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Name']`)); consoleLog = element(by.className('app-console')); deleteButton = element.all(by.className('adf-card-view__key-value-pairs__remove-btn')).first(); - resetButton = element(by.css(`#adf-reset-card-log`)); - editableSwitch = element(by.id('app-toggle-editable')); - clearDateSwitch = element(by.id('app-toggle-clear-date')); - noneOptionSwitch = element(by.id('app-toggle-none-option')); - clickableField = element(by.css(`[data-automation-id="card-textitem-toggle-click"]`)); + resetButton = $(`#adf-reset-card-log`); + editableSwitch = $('#app-toggle-editable'); + clearDateSwitch = $('#app-toggle-clear-date'); + noneOptionSwitch = $('#app-toggle-none-option'); + clickableField = $(`[data-automation-id="card-textitem-toggle-click"]`); - selectDropdown = new DropdownPage(element(by.css('mat-select[data-automation-class="select-box"]'))); + selectDropdown = new DropdownPage($('mat-select[data-automation-class="select-box"]')); async clickOnAddButton(): Promise { await BrowserActions.click(this.addButton); @@ -72,18 +72,18 @@ export class CardViewComponentPage { } async clickOnIntField(): Promise { - const toggleText = element(by.css('div[data-automation-id="card-textitem-toggle-int"]')); + const toggleText = $('div[data-automation-id="card-textitem-toggle-int"]'); await BrowserActions.click(toggleText); await BrowserVisibility.waitUntilElementIsVisible(this.intField); } async clickOnIntClearIcon(): Promise { - const clearIcon = element(by.css('button[data-automation-id="card-textitem-reset-int"]')); + const clearIcon = $('button[data-automation-id="card-textitem-reset-int"]'); await BrowserActions.click(clearIcon); } async clickOnIntSaveIcon(): Promise { - const saveIcon = element(by.css('button[data-automation-id="card-textitem-update-int"]')); + const saveIcon = $('button[data-automation-id="card-textitem-update-int"]'); await BrowserActions.click(saveIcon); } @@ -92,28 +92,28 @@ export class CardViewComponentPage { } getIntFieldText(): Promise { - const textField = element(by.css('span[data-automation-id="card-textitem-value-int"]')); + const textField = $('span[data-automation-id="card-textitem-value-int"]'); return BrowserActions.getText(textField); } getErrorInt(): Promise { - const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]')); + const errorElement = $('mat-error[data-automation-id="card-textitem-error-int"]'); return BrowserActions.getText(errorElement); } async clickOnFloatField(): Promise { - const toggleText = element(by.css('div[data-automation-id="card-textitem-toggle-float"]')); + const toggleText = $('div[data-automation-id="card-textitem-toggle-float"]'); await BrowserActions.click(toggleText); await BrowserVisibility.waitUntilElementIsVisible(this.floatField); } async clickOnFloatClearIcon(): Promise { - const clearIcon = element(by.css(`button[data-automation-id="card-textitem-reset-float"]`)); + const clearIcon = $(`button[data-automation-id="card-textitem-reset-float"]`); await BrowserActions.click(clearIcon); } async clickOnFloatSaveIcon(): Promise { - const saveIcon = element(by.css(`button[data-automation-id="card-textitem-update-float"]`)); + const saveIcon = $(`button[data-automation-id="card-textitem-update-float"]`); await BrowserActions.click(saveIcon); } @@ -122,12 +122,12 @@ export class CardViewComponentPage { } getFloatFieldText(): Promise { - const textField = element(by.css('span[data-automation-id="card-textitem-value-float"]')); + const textField = $('span[data-automation-id="card-textitem-value-float"]'); return BrowserActions.getText(textField); } getErrorFloat(): Promise { - const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]')); + const errorElement = $('mat-error[data-automation-id="card-textitem-error-float"]'); return BrowserActions.getText(errorElement); } @@ -144,7 +144,7 @@ export class CardViewComponentPage { } getOutputText(index: number): Promise { - return BrowserActions.getText(this.consoleLog.all(by.css('p')).get(index)); + return BrowserActions.getText(this.consoleLog.$$('p').get(index)); } async deletePairsValues(): Promise { @@ -177,22 +177,22 @@ export class CardViewComponentPage { } async getDateValue(): Promise { - const dateValue = element(by.css('span[data-automation-id="card-date-value-date"]')); + const dateValue = $('span[data-automation-id="card-date-value-date"]'); return dateValue.getText(); } async getDateTimeValue(): Promise { - const dateTimeValue = element(by.css('span[data-automation-id="card-datetime-value-datetime"]')); + const dateTimeValue = $('span[data-automation-id="card-datetime-value-datetime"]'); return dateTimeValue.getText(); } async clearDateField(): Promise { - const clearDateButton = element(by.css('mat-icon[data-automation-id="datepicker-date-clear-date"]')); + const clearDateButton = $('mat-icon[data-automation-id="datepicker-date-clear-date"]'); await BrowserActions.click(clearDateButton); } async clearDateTimeField(): Promise { - const clearDateButton = element(by.css('mat-icon[data-automation-id="datepicker-date-clear-datetime"]')); + const clearDateButton = $('mat-icon[data-automation-id="datepicker-date-clear-datetime"]'); await BrowserActions.click(clearDateButton); } @@ -200,7 +200,7 @@ export class CardViewComponentPage { const switchClass = await BrowserActions.getAttribute(this.editableSwitch, 'class'); if (switchClass.indexOf('mat-checked') === -1) { await this.clearDateSwitch.click(); - const clearDateChecked = element(by.css('mat-slide-toggle[id="app-toggle-clear-date"][class*="mat-checked"]')); + const clearDateChecked = $('mat-slide-toggle[id="app-toggle-clear-date"][class*="mat-checked"]'); await BrowserVisibility.waitUntilElementIsVisible(clearDateChecked); } } @@ -209,13 +209,13 @@ export class CardViewComponentPage { const switchClass = await BrowserActions.getAttribute(this.noneOptionSwitch, 'class'); if (switchClass.indexOf('mat-checked') === -1) { await this.noneOptionSwitch.click(); - const noneOptionChecked = element(by.css('mat-slide-toggle[id="app-toggle-none-option"][class*="mat-checked"]')); + const noneOptionChecked = $('mat-slide-toggle[id="app-toggle-none-option"][class*="mat-checked"]'); await BrowserVisibility.waitUntilElementIsVisible(noneOptionChecked); } } async isErrorNotDisplayed(): Promise { - const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]')); + const errorElement = $('mat-error[data-automation-id="card-textitem-error-int"]'); try { await BrowserVisibility.waitUntilElementIsNotVisible(errorElement); return true; @@ -231,10 +231,10 @@ export class CardViewComponentPage { async updateClickableField(text: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.clickableField); await BrowserActions.click(this.clickableField); - const inputField = element(by.css('input[data-automation-id="card-textitem-editinput-click"]')); + const inputField = $('input[data-automation-id="card-textitem-editinput-click"]'); await BrowserVisibility.waitUntilElementIsPresent(inputField); await BrowserActions.clearSendKeys(inputField, text); - const save = element(by.css('[data-automation-id="card-textitem-update-click"]')); + const save = $('[data-automation-id="card-textitem-update-click"]'); await BrowserVisibility.waitUntilElementIsVisible(save); await BrowserActions.click(save); } diff --git a/e2e/core/pages/comments.page.ts b/e2e/core/pages/comments.page.ts index b15727c10d0..c2e4ecaf017 100644 --- a/e2e/core/pages/comments.page.ts +++ b/e2e/core/pages/comments.page.ts @@ -16,18 +16,18 @@ */ import { BrowserActions, BrowserVisibility, TabsPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $, $$ } from 'protractor'; export class CommentsPage { tabsPage = new TabsPage(); - numberOfComments = element(by.id('comment-header')); - commentUserIcon = element.all(by.id('comment-user-icon')); - commentUserName = element.all(by.id('comment-user')); - commentMessage = element.all(by.id('comment-message')); - commentTime = element.all(by.id('comment-time')); - commentInput = element(by.id('comment-input')); - addCommentButton = element(by.css("[data-automation-id='comments-input-add']")); + numberOfComments = $('#comment-header'); + commentUserIcon = $$('#comment-user-icon'); + commentUserName = $$('#comment-user'); + commentMessage = $$('#comment-message'); + commentTime = $$('#comment-time'); + commentInput = $('#comment-input'); + addCommentButton = $("[data-automation-id='comments-input-add']"); async getTotalNumberOfComments(text: string): Promise { await BrowserVisibility.waitUntilElementHasText(this.numberOfComments, text); diff --git a/e2e/core/pages/content-services.page.ts b/e2e/core/pages/content-services.page.ts index 9f033309301..dd6eb68047c 100644 --- a/e2e/core/pages/content-services.page.ts +++ b/e2e/core/pages/content-services.page.ts @@ -25,7 +25,7 @@ import { DropdownPage, Logger } from '@alfresco/adf-testing'; -import { Locator, $$, browser, by, element, ElementFinder, protractor } from 'protractor'; +import { $$, browser, by, element, ElementFinder, protractor, $ } from 'protractor'; import { CreateLibraryDialogPage } from './dialog/create-library-dialog.page'; import { FolderDialogPage } from './dialog/folder-dialog.page'; import { NavigationBarPage } from './navigation-bar.page'; @@ -42,74 +42,73 @@ export class ContentServicesPage { created: 'Created' }; - contentList = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first()); + contentList = new DocumentListPage($$('adf-upload-drag-area adf-document-list').first()); togglePage = new TogglePage(); createFolderDialog = new FolderDialogPage(); createLibraryDialog = new CreateLibraryDialogPage(); - multipleFileUploadToggle = element(by.id('adf-document-list-enable-drop-files')); - uploadBorder = element(by.id('document-list-container')); - contentServices = element(by.css('.app-sidenav-link[data-automation-id="Content Services"]')); - currentFolder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div')); - createFolderButton = element(by.css('button[data-automation-id="create-new-folder"]')); - editFolderButton = element(by.css('button[data-automation-id="edit-folder"]')); - deleteNodesButton = element(by.css('button[data-automation-id="delete-toolbar-button"]')); - createLibraryButton = element(by.css('button[data-automation-id="create-new-library"]')); - activeBreadcrumb = element(by.css('div[class*="active"]')); - tooltip: Locator = by.css('div[class*="--text adf-full-width"] span'); - uploadFileButton = element(by.css('.adf-upload-button-file-container button')); - uploadFileButtonInput = element(by.css('input[data-automation-id="upload-single-file"]')); - uploadMultipleFileButton = element(by.css('input[data-automation-id="upload-multiple-files"]')); - uploadFolderButton = element(by.css('input[data-automation-id="uploadFolder"]')); - errorSnackBar = element(by.css('simple-snack-bar[class*="mat-simple-snackbar"]')); - emptyPagination = element(by.css('adf-pagination[class*="adf-pagination__empty"]')); - dragAndDrop = element.all(by.css('adf-upload-drag-area div')).first(); - nameHeader = element.all(by.css('div[data-automation-id="auto_id_name"] > span')).first(); - sizeHeader = element.all(by.css('div[data-automation-id="auto_id_content.sizeInBytes"] > span')).first(); - createdByHeader = element.all(by.css('div[data-automation-id="auto_id_createdByUser.displayName"] > span')).first(); - createdHeader = element.all(by.css('div[data-automation-id="auto_id_createdAt"] > span')).first(); - recentFiles = element(by.css('.app-container-recent')); - recentFilesExpanded = element(by.css('.app-container-recent mat-expansion-panel-header.mat-expanded')); - recentFilesClosed = element(by.css('.app-container-recent mat-expansion-panel-header')); - recentFileIcon = element(by.css('.app-container-recent mat-expansion-panel-header mat-icon')); - emptyFolder = element(by.css('.adf-empty-folder-this-space-is-empty')); - emptyFolderImage = element(by.css('.adf-empty-folder-image')); - emptyRecent = element(by.css('.app-container-recent .app-empty-list__title')); - gridViewButton = element(by.css('button[data-automation-id="document-list-grid-view"]')); - cardViewContainer = element(by.css('div.app-document-list-container div.adf-datatable-card')); + multipleFileUploadToggle = $('#adf-document-list-enable-drop-files'); + uploadBorder = $('#document-list-container'); + contentServices = $('.app-sidenav-link[data-automation-id="Content Services"]'); + currentFolder = $('div[class*="adf-breadcrumb-item adf-active"] div'); + createFolderButton = $('button[data-automation-id="create-new-folder"]'); + editFolderButton = $('button[data-automation-id="edit-folder"]'); + deleteNodesButton = $('button[data-automation-id="delete-toolbar-button"]'); + createLibraryButton = $('button[data-automation-id="create-new-library"]'); + activeBreadcrumb = $('div[class*="active"]'); + uploadFileButton = $('.adf-upload-button-file-container button'); + uploadFileButtonInput = $('input[data-automation-id="upload-single-file"]'); + uploadMultipleFileButton = $('input[data-automation-id="upload-multiple-files"]'); + uploadFolderButton = $('input[data-automation-id="uploadFolder"]'); + errorSnackBar = $('simple-snack-bar[class*="mat-simple-snackbar"]'); + emptyPagination = $('adf-pagination[class*="adf-pagination__empty"]'); + dragAndDrop = $$('adf-upload-drag-area div').first(); + nameHeader = $$('div[data-automation-id="auto_id_name"] > span').first(); + sizeHeader = $$('div[data-automation-id="auto_id_content.sizeInBytes"] > span').first(); + createdByHeader = $$('div[data-automation-id="auto_id_createdByUser.displayName"] > span').first(); + createdHeader = $$('div[data-automation-id="auto_id_createdAt"] > span').first(); + recentFiles = $('.app-container-recent'); + recentFilesExpanded = $('.app-container-recent mat-expansion-panel-header.mat-expanded'); + recentFilesClosed = $('.app-container-recent mat-expansion-panel-header'); + recentFileIcon = $('.app-container-recent mat-expansion-panel-header mat-icon'); + emptyFolder = $('.adf-empty-folder-this-space-is-empty'); + emptyFolderImage = $('.adf-empty-folder-image'); + emptyRecent = $('.app-container-recent .app-empty-list__title'); + gridViewButton = $('button[data-automation-id="document-list-grid-view"]'); + cardViewContainer = $('div.app-document-list-container div.adf-datatable-card'); shareNodeButton = element(by.cssContainingText('mat-icon', ' share ')); nameColumnHeader = 'name'; createdByColumnHeader = 'createdByUser.displayName'; createdColumnHeader = 'createdAt'; - deleteContentElement = element(by.css('button[data-automation-id*="DELETE"]')); - metadataAction = element(by.css('button[data-automation-id*="METADATA"]')); - versionManagerAction = element(by.css('button[data-automation-id*="VERSIONS"]')); - moveContentElement = element(by.css('button[data-automation-id*="MOVE"]')); - copyContentElement = element(by.css('button[data-automation-id*="COPY"]')); - lockContentElement = element(by.css('button[data-automation-id="DOCUMENT_LIST.ACTIONS.LOCK"]')); - downloadContent = element(by.css('button[data-automation-id*="DOWNLOAD"]')); - downloadButton = element(by.css('button[title="Download"]')); - favoriteButton = element(by.css('button[data-automation-id="favorite"]')); + deleteContentElement = $('button[data-automation-id*="DELETE"]'); + metadataAction = $('button[data-automation-id*="METADATA"]'); + versionManagerAction = $('button[data-automation-id*="VERSIONS"]'); + moveContentElement = $('button[data-automation-id*="MOVE"]'); + copyContentElement = $('button[data-automation-id*="COPY"]'); + lockContentElement = $('button[data-automation-id="DOCUMENT_LIST.ACTIONS.LOCK"]'); + downloadContent = $('button[data-automation-id*="DOWNLOAD"]'); + downloadButton = $('button[title="Download"]'); + favoriteButton = $('button[data-automation-id="favorite"]'); markedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star')); notMarkedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star_border')); - multiSelectToggle = element(by.css('[data-automation-id="multiSelectToggle"]')); - selectAllCheckbox = element.all(by.css('.adf-checkbox-sr-only')).first(); - selectionModeDropdown = element(by.css('.mat-select[aria-label="Selection Mode"]')); - selectedNodesList = element.all(by.css('.app-content-service-settings li')); - siteListDropdown = new DropdownPage(element(by.css(`mat-select[data-automation-id='site-my-files-option']`))); - sortingDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="grid-view-sorting"]'))); + multiSelectToggle = $('[data-automation-id="multiSelectToggle"]'); + selectAllCheckbox = $$('.adf-checkbox-sr-only').first(); + selectionModeDropdown = $('.mat-select[aria-label="Selection Mode"]'); + selectedNodesList = $$('.app-content-service-settings li'); + siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`)); + sortingDropdown = new DropdownPage($('mat-select[data-automation-id="grid-view-sorting"]')); async pressContextMenuActionNamed(actionName): Promise { await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); } async checkContextActionIsVisible(actionName) { - const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`)); + const actionButton = $(`button[data-automation-id="context-${actionName}"`); await BrowserVisibility.waitUntilElementIsVisible(actionButton); } async isContextActionEnabled(actionName): Promise { - const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`)); + const actionButton = $(`button[data-automation-id="context-${actionName}"`); await BrowserVisibility.waitUntilElementIsVisible(actionButton); return actionButton.isEnabled(); } @@ -132,7 +131,7 @@ export class ContentServicesPage { async checkDeleteIsDisabled(content): Promise { await this.contentList.clickOnActionMenu(content); - const disabledDelete = element(by.css(`button[data-automation-id*='DELETE'][disabled='true']`)); + const disabledDelete = $(`button[data-automation-id*='DELETE'][disabled='true']`); await BrowserVisibility.waitUntilElementIsVisible(disabledDelete); } @@ -489,12 +488,12 @@ export class ContentServicesPage { } async enableMediumTimeFormat(): Promise { - const mediumTimeFormat = element(by.css('#enableMediumTimeFormat')); + const mediumTimeFormat = $('#enableMediumTimeFormat'); await BrowserActions.click(mediumTimeFormat); } async enableThumbnails(): Promise { - const thumbnailSlide = element(by.id('adf-thumbnails-upload-switch')); + const thumbnailSlide = $('#adf-thumbnails-upload-switch'); await BrowserActions.click(thumbnailSlide); } @@ -503,7 +502,7 @@ export class ContentServicesPage { } async getDocumentListRowNumber(): Promise { - const documentList = element(by.css('adf-upload-drag-area adf-document-list')); + const documentList = $('adf-upload-drag-area adf-document-list'); await BrowserVisibility.waitUntilElementIsVisible(documentList); return $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count(); } @@ -539,7 +538,7 @@ export class ContentServicesPage { } async checkLockIsDisplayedForElement(name): Promise { - const lockButton = element(by.css(`div.adf-datatable-cell[data-automation-id="${name}"] button`)); + const lockButton = $(`div.adf-datatable-cell[data-automation-id="${name}"] button`); await BrowserVisibility.waitUntilElementIsVisible(lockButton); } @@ -548,7 +547,7 @@ export class ContentServicesPage { } async getStyleValueForRowText(rowName, styleName): Promise { - const row = element(by.css(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`)); + const row = $(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`); await BrowserVisibility.waitUntilElementIsVisible(row); return row.getCssValue(styleName); } @@ -567,7 +566,7 @@ export class ContentServicesPage { } async getRowIconImageUrl(fileName): Promise { - const iconRow = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`)); + const iconRow = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`); return BrowserActions.getAttribute(iconRow, 'src'); } @@ -590,30 +589,30 @@ export class ContentServicesPage { } async getDocumentCardIconForElement(elementName): Promise { - const elementIcon = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`)); + const elementIcon = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`); return BrowserActions.getAttribute(elementIcon, 'src'); } async checkDocumentCardPropertyIsShowed(elementName, propertyName): Promise { - const elementProperty = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`)); + const elementProperty = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`); await BrowserVisibility.waitUntilElementIsVisible(elementProperty); } async getAttributeValueForElement(elementName, propertyName): Promise { - const elementSize = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`)); + const elementSize = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`); return BrowserActions.getText(elementSize); } async checkMenuIsShowedForElementIndex(elementIndex): Promise { - const elementMenu = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`)); + const elementMenu = $(`button[data-automation-id="action_menu_${elementIndex}"]`); await BrowserVisibility.waitUntilElementIsVisible(elementMenu); } async navigateToCardFolder(folderName): Promise { await BrowserActions.closeMenuAndDialogs(); - const folderCard = element(by.css(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`)); + const folderCard = $(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`); await BrowserActions.click(folderCard); - const folderSelected = element(by.css(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`)); + const folderSelected = $(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`); await BrowserVisibility.waitUntilElementIsVisible(folderSelected); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); } @@ -660,7 +659,7 @@ export class ContentServicesPage { } async selectFolder(folderName: string): Promise { - const folderSelected = element(by.css(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`)); + const folderSelected = $(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`); await BrowserVisibility.waitUntilElementIsVisible(folderSelected); await BrowserActions.click(folderSelected); } @@ -681,13 +680,13 @@ export class ContentServicesPage { } async selectItemWithCheckbox(itemName: string): Promise { - const item = element(by.css(`adf-datatable-row[aria-label="${itemName}"] mat-checkbox .mat-checkbox-input`)); + const item = $(`adf-datatable-row[aria-label="${itemName}"] mat-checkbox .mat-checkbox-input`); await BrowserVisibility.waitUntilElementIsVisible(item); await BrowserActions.click(item); } async unSelectItemWithCheckbox(itemName: string): Promise { - const item = element(by.css(`adf-datatable-row[aria-label="${itemName} selected"] mat-checkbox .mat-checkbox-input`)); + const item = $(`adf-datatable-row[aria-label="${itemName} selected"] mat-checkbox .mat-checkbox-input`); await BrowserVisibility.waitUntilElementIsVisible(item); await BrowserActions.click(item); } diff --git a/e2e/core/pages/custom-sources.page.ts b/e2e/core/pages/custom-sources.page.ts index 46fff319aca..e3d3562db52 100644 --- a/e2e/core/pages/custom-sources.page.ts +++ b/e2e/core/pages/custom-sources.page.ts @@ -16,7 +16,7 @@ */ import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; const source = { @@ -39,8 +39,8 @@ export class CustomSourcesPage { dataTable = new DataTableComponentPage(); navigationBarPage = new NavigationBarPage(); - toolbar = element(by.css('app-custom-sources .adf-toolbar-title')); - selectModeDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="custom-sources-select"]'))); + toolbar = $('app-custom-sources .adf-toolbar-title'); + selectModeDropdown = new DropdownPage($('mat-select[data-automation-id="custom-sources-select"]')); async waitForToolbarToBeVisible(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.toolbar); diff --git a/e2e/core/pages/data-table.page.ts b/e2e/core/pages/data-table.page.ts index 18b7e198456..ffb54be000d 100644 --- a/e2e/core/pages/data-table.page.ts +++ b/e2e/core/pages/data-table.page.ts @@ -16,7 +16,7 @@ */ import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing'; -import { browser, by, element, ElementFinder, protractor } from 'protractor'; +import { $, $$, browser, by, element, ElementFinder, protractor } from 'protractor'; export class DataTablePage { @@ -33,30 +33,30 @@ export class DataTablePage { }; dataTable: DataTableComponentPage; - multiSelect = element(by.css(`div[data-automation-id='multiselect'] label > .mat-checkbox-inner-container`)); + multiSelect = $(`div[data-automation-id='multiselect'] label > .mat-checkbox-inner-container`); reset = element(by.xpath(`//span[contains(text(),'Reset to default')]/..`)); - allSelectedRows = element.all(by.css(`adf-datatable-row[class*='is-selected']`)); - selectedRowNumber = element(by.css(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`)); - selectAll = element(by.css(`div[class*='header'] label`)); + allSelectedRows = $$(`adf-datatable-row[class*='is-selected']`); + selectedRowNumber = $(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`); + selectAll = $(`div[class*='header'] label`); addRowElement = element(by.xpath(`//span[contains(text(),'Add row')]/..`)); replaceRowsElement = element(by.xpath(`//span[contains(text(),'Replace rows')]/..`)); replaceColumnsElement = element(by.xpath(`//span[contains(text(),'Replace columns')]/..`)); - createdOnColumn = element(by.css(`div[data-automation-id='auto_id_createdOn']`)); - idColumnHeader = element(by.css(`div[data-automation-id='auto_id_id']`)); - pasteClipboardInput = element(by.css(`input[data-automation-id='paste clipboard input']`)); + createdOnColumn = $(`div[data-automation-id='auto_id_createdOn']`); + idColumnHeader = $(`div[data-automation-id='auto_id_id']`); + pasteClipboardInput = $(`input[data-automation-id='paste clipboard input']`); - selectModeDropdown = new DropdownPage(element(by.css(`mat-select[data-automation-id='datatable-selection-mode']`))); + selectModeDropdown = new DropdownPage($(`mat-select[data-automation-id='datatable-selection-mode']`)); constructor(data?) { if (this.data[data]) { - this.dataTable = new DataTableComponentPage(element(by.css(`div[data-automation-id='` + this.data[data] + `']`))); + this.dataTable = new DataTableComponentPage($(`div[data-automation-id='` + this.data[data] + `']`)); } else { - this.dataTable = new DataTableComponentPage(element(by.css(`div[data-automation-id='` + this.data.defaultTable + `']`))); + this.dataTable = new DataTableComponentPage($(`div[data-automation-id='` + this.data.defaultTable + `']`)); } } async insertFilter(filterText: string): Promise { - const inputFilter = element(by.css(`#adf-datatable-filter-input`)); + const inputFilter = $(`#adf-datatable-filter-input`); await BrowserActions.clearSendKeys(inputFilter, filterText); } diff --git a/e2e/core/pages/dialog/create-library-dialog.page.ts b/e2e/core/pages/dialog/create-library-dialog.page.ts index 78d47e256b9..dcb29b74659 100644 --- a/e2e/core/pages/dialog/create-library-dialog.page.ts +++ b/e2e/core/pages/dialog/create-library-dialog.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $, $$ } from 'protractor'; import { BrowserActions, TestElement } from '@alfresco/adf-testing'; export class CreateLibraryDialogPage { @@ -30,11 +30,11 @@ export class CreateLibraryDialogPage { cancelButton = TestElement.byCss('button[data-automation-id="cancel-library-id"]'); createButton = TestElement.byCss('button[data-automation-id="create-library-id"]'); errorMessage = TestElement.byCss('.mat-dialog-content .mat-error'); - errorMessages = element.all(by.css('.mat-dialog-content .mat-error')); + errorMessages = $$('.mat-dialog-content .mat-error'); libraryNameHint = TestElement.byCss('adf-library-dialog .mat-hint'); async getSelectedRadio(): Promise { - const radio = element(by.css('.mat-radio-button[class*="checked"]')); + const radio = $('.mat-radio-button[class*="checked"]'); return BrowserActions.getText(radio); } diff --git a/e2e/core/pages/dialog/folder-dialog.page.ts b/e2e/core/pages/dialog/folder-dialog.page.ts index e7f1b7a307c..06afce1f8ce 100644 --- a/e2e/core/pages/dialog/folder-dialog.page.ts +++ b/e2e/core/pages/dialog/folder-dialog.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { by, element, ElementFinder } from 'protractor'; +import { $$, ElementFinder } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class FolderDialogPage { - folderDialog = element.all(by.css('adf-folder-dialog')).first(); - folderNameField = this.folderDialog.element(by.id('adf-folder-name-input')); - folderDescriptionField = this.folderDialog.element(by.id('adf-folder-description-input')); - createUpdateButton = this.folderDialog.element(by.id('adf-folder-create-button')); - cancelButton = this.folderDialog.element(by.id('adf-folder-cancel-button')); - folderTitle = this.folderDialog.element((by.css('h2.mat-dialog-title'))); - validationMessage = this.folderDialog.element(by.css('div.mat-form-field-subscript-wrapper mat-hint span')); + folderDialog = $$('adf-folder-dialog').first(); + folderNameField = this.folderDialog.$('#adf-folder-name-input'); + folderDescriptionField = this.folderDialog.$('#adf-folder-description-input'); + createUpdateButton = this.folderDialog.$('#adf-folder-create-button'); + cancelButton = this.folderDialog.$('#adf-folder-cancel-button'); + folderTitle = this.folderDialog.$('h2.mat-dialog-title'); + validationMessage = this.folderDialog.$('div.mat-form-field-subscript-wrapper mat-hint span'); async getDialogTitle(): Promise { return BrowserActions.getText(this.folderTitle); diff --git a/e2e/core/pages/dialog/share-dialog.page.ts b/e2e/core/pages/dialog/share-dialog.page.ts index 3c5b07fe634..c1af62a1d79 100644 --- a/e2e/core/pages/dialog/share-dialog.page.ts +++ b/e2e/core/pages/dialog/share-dialog.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $$, $ } from 'protractor'; import { BrowserVisibility, TogglePage, BrowserActions, DateTimePickerPage } from '@alfresco/adf-testing'; import moment = require('moment'); @@ -23,18 +23,18 @@ export class ShareDialogPage { togglePage = new TogglePage(); dateTimePickerPage = new DateTimePickerPage(); - shareDialog = element(by.css('adf-share-dialog')); - dialogTitle = element.all(by.css('[data-automation-id="adf-share-dialog-title"]')).first(); - shareToggle = element(by.css('[data-automation-id="adf-share-toggle"] label')); - expireToggle = element(by.css(`[data-automation-id="adf-expire-toggle"] label`)); - shareToggleChecked = element(by.css('mat-dialog-container mat-slide-toggle.mat-checked')); - shareLink = element(by.css('[data-automation-id="adf-share-link"]')); - closeButton = element(by.css('button[data-automation-id="adf-share-dialog-close"]')); - copySharedLinkButton = element(by.css('.adf-input-action')); - expirationDateInput = element(by.css('input[formcontrolname="time"]')); - confirmationDialog = element(by.css('adf-confirm-dialog')); - confirmationCancelButton = element(by.id('adf-confirm-cancel')); - confirmationRemoveButton = element(by.id('adf-confirm-accept')); + shareDialog = $('adf-share-dialog'); + dialogTitle = $$('[data-automation-id="adf-share-dialog-title"]').first(); + shareToggle = $('[data-automation-id="adf-share-toggle"] label'); + expireToggle = $(`[data-automation-id="adf-expire-toggle"] label`); + shareToggleChecked = $('mat-dialog-container mat-slide-toggle.mat-checked'); + shareLink = $('[data-automation-id="adf-share-link"]'); + closeButton = $('button[data-automation-id="adf-share-dialog-close"]'); + copySharedLinkButton = $('.adf-input-action'); + expirationDateInput = $('input[formcontrolname="time"]'); + confirmationDialog = $('adf-confirm-dialog'); + confirmationCancelButton = $('#adf-confirm-cancel'); + confirmationRemoveButton = $('#adf-confirm-accept'); async checkDialogIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle); @@ -106,7 +106,7 @@ export class ShareDialogPage { } async dateTimePickerDialogIsClosed(): Promise { - await BrowserVisibility.waitUntilElementIsStale(element(by.css('mat-datetimepicker-content'))); + await BrowserVisibility.waitUntilElementIsStale($('mat-datetimepicker-content')); } async getExpirationDate(): Promise { diff --git a/e2e/core/pages/dialog/upload-dialog.page.ts b/e2e/core/pages/dialog/upload-dialog.page.ts index 01b9e439dfb..1e69ee46ff7 100644 --- a/e2e/core/pages/dialog/upload-dialog.page.ts +++ b/e2e/core/pages/dialog/upload-dialog.page.ts @@ -15,28 +15,28 @@ * limitations under the License. */ -import { element, by, browser, ElementFinder, Locator } from 'protractor'; +import { element, by, browser, ElementFinder, $, $$ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class UploadDialogPage { - closeButton = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]'))); - dialog = element(by.css('div[id="upload-dialog"]')); - minimizedDialog = element(by.css('div[class*="upload-dialog--minimized"]')); - uploadedStatusIcon: Locator = by.css('mat-icon[class*="status--done"]'); - cancelledStatusIcon: Locator = by.css('div[class*="status--cancelled"]'); - errorStatusIcon: Locator = by.css('div[class*="status--error"] mat-icon'); - errorTooltip = element(by.css('div.mat-tooltip')); + closeButton = $('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]'); + dialog = $('div[id="upload-dialog"]'); + minimizedDialog = $('div[class*="upload-dialog--minimized"]'); + uploadedStatusIcon = 'mat-icon[class*="status--done"]'; + cancelledStatusIcon = 'div[class*="status--cancelled"]'; + errorStatusIcon = 'div[class*="status--error"] mat-icon'; + errorTooltip = $('div.mat-tooltip'); rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row'); - title = element(by.css('span[class*="upload-dialog__title"]')); - minimizeButton = element(by.css('mat-icon[title="Minimize"]')); - maximizeButton = element(by.css('mat-icon[title="Maximize"]')); - canUploadConfirmationTitle = element(by.css('.upload-dialog__confirmation--title')); - canUploadConfirmationDescription = element(by.css('.upload-dialog__confirmation--text')); + title = $('span[class*="upload-dialog__title"]'); + minimizeButton = $('mat-icon[title="Minimize"]'); + maximizeButton = $('mat-icon[title="Maximize"]'); + canUploadConfirmationTitle = $('.upload-dialog__confirmation--title'); + canUploadConfirmationDescription = $('.upload-dialog__confirmation--text'); confirmationDialogNoButton = element(by.partialButtonText('No')); confirmationDialogYesButton = element(by.partialButtonText('Yes')); - cancelUploadsElement = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-cancel-all"]'))); - cancelUploadInProgressButton = element(by.css('div[data-automation-id="cancel-upload-progress"]')); + cancelUploadsElement = $('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-cancel-all"]'); + cancelUploadInProgressButton = $('div[data-automation-id="cancel-upload-progress"]'); async clickOnCloseButton(): Promise { await this.checkCloseButtonIsDisplayed(); @@ -59,24 +59,20 @@ export class UploadDialogPage { await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog); } - getRowsByName(content: string): ElementFinder { - return element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first(); - } - async getRowByRowName(content: string): Promise { - const rows = this.getRowsByName(content); - await BrowserVisibility.waitUntilElementIsVisible(rows); - return rows.element(this.rowByRowName); + const row = await $$(`div[class*='uploading-row'] span[title="${content}"]`).last(); + await BrowserVisibility.waitUntilElementIsVisible(row); + return row.element(this.rowByRowName); } async fileIsUploaded(content: string): Promise { - const row = await this.getRowByRowName(content); - await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon), 60000); + const row: ElementFinder = await this.getRowByRowName(content); + await BrowserVisibility.waitUntilElementIsVisible(row.$(this.uploadedStatusIcon), 10000); } async fileIsError(content: string) { - const row = await this.getRowByRowName(content); - await BrowserVisibility.waitUntilElementIsVisible(row.element(this.errorStatusIcon)); + const row: ElementFinder = await this.getRowByRowName(content); + await BrowserVisibility.waitUntilElementIsVisible(row.$(this.errorStatusIcon)); } async filesAreUploaded(content: string[]): Promise { @@ -86,7 +82,7 @@ export class UploadDialogPage { } async fileIsNotDisplayedInDialog(content: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`div[class*='uploading-row'] span[title="${content}"]`))); + await BrowserVisibility.waitUntilElementIsNotVisible($(`div[class*='uploading-row'] span[title="${content}"]`)); } async cancelUploads(): Promise { @@ -102,16 +98,16 @@ export class UploadDialogPage { } async fileIsCancelled(content: string): Promise { - const row = await this.getRowByRowName(content); + const row: ElementFinder = await this.getRowByRowName(content); await BrowserVisibility.waitUntilElementIsVisible(row); - await BrowserVisibility.waitUntilElementIsVisible(row.element(this.cancelledStatusIcon), 10000); + await BrowserVisibility.waitUntilElementIsVisible(row.$(this.cancelledStatusIcon), 10000); } async removeUploadedFile(content: string): Promise { - const row = await this.getRowByRowName(content); - await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon)); + const row: ElementFinder = await this.getRowByRowName(content); + await BrowserVisibility.waitUntilElementIsVisible(row.$(this.uploadedStatusIcon)); const elementRow = await this.getRowByRowName(content); - await BrowserActions.click(elementRow.element(this.uploadedStatusIcon)); + await BrowserActions.click(elementRow.$(this.uploadedStatusIcon)); } async getTitleText(): Promise { @@ -156,8 +152,8 @@ export class UploadDialogPage { } async displayTooltip(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(this.errorStatusIcon)); - await browser.actions().mouseMove(element(this.errorStatusIcon)).perform(); + await BrowserVisibility.waitUntilElementIsVisible($(this.errorStatusIcon)); + await browser.actions().mouseMove($(this.errorStatusIcon)).perform(); } async getTooltip(): Promise { diff --git a/e2e/core/pages/dialog/upload-toggles.page.ts b/e2e/core/pages/dialog/upload-toggles.page.ts index fd226af8ad5..ec368049b66 100644 --- a/e2e/core/pages/dialog/upload-toggles.page.ts +++ b/e2e/core/pages/dialog/upload-toggles.page.ts @@ -15,20 +15,20 @@ * limitations under the License. */ -import { browser, by, element } from 'protractor'; +import { $, browser } from 'protractor'; import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing'; export class UploadTogglesPage { togglePage = new TogglePage(); - multipleFileUploadToggle = element(by.id('adf-multiple-upload-switch')); - uploadFolderToggle = element(by.css('#adf-folder-upload-switch')); - extensionFilterToggle = element(by.id('adf-extension-filter-upload-switch')); - maxSizeToggle = element(by.id('adf-max-size-filter-upload-switch')); - versioningToggle = element(by.id('adf-version-upload-switch')); - extensionAcceptedField = element(by.css('input[data-automation-id="accepted-files-type"]')); - maxSizeField = element(by.css('input[data-automation-id="max-files-size"]')); - disableUploadCheckbox = element(by.css('[id="adf-disable-upload"]')); + multipleFileUploadToggle = $('#adf-multiple-upload-switch'); + uploadFolderToggle = $('#adf-folder-upload-switch'); + extensionFilterToggle = $('#adf-extension-filter-upload-switch'); + maxSizeToggle = $('#adf-max-size-filter-upload-switch'); + versioningToggle = $('#adf-version-upload-switch'); + extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]'); + maxSizeField = $('input[data-automation-id="max-files-size"]'); + disableUploadCheckbox = $('[id="adf-disable-upload"]'); async enableMultipleFileUpload(): Promise { await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle); @@ -46,7 +46,7 @@ export class UploadTogglesPage { async checkFolderUploadToggleIsEnabled(): Promise { try { - const enabledFolderUpload = element(by.css('mat-slide-toggle[id="adf-folder-upload-switch"][class*="mat-checked"]')); + const enabledFolderUpload = $('mat-slide-toggle[id="adf-folder-upload-switch"][class*="mat-checked"]'); await BrowserVisibility.waitUntilElementIsVisible(enabledFolderUpload); return true; } catch { @@ -55,17 +55,17 @@ export class UploadTogglesPage { } async checkMultipleFileUploadToggleIsEnabled(): Promise { - const enabledToggle = element(by.css('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]')); + const enabledToggle = $('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]'); await BrowserVisibility.waitUntilElementIsVisible(enabledToggle); } async checkMaxSizeToggleIsEnabled(): Promise { - const enabledToggle = element(by.css('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]')); + const enabledToggle = $('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]'); await BrowserVisibility.waitUntilElementIsVisible(enabledToggle); } async checkVersioningToggleIsEnabled(): Promise { - const enabledToggle = element(by.css('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]')); + const enabledToggle = $('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]'); await BrowserVisibility.waitUntilElementIsVisible(enabledToggle); } @@ -74,7 +74,7 @@ export class UploadTogglesPage { } async checkFolderUploadToggleIsNotEnabled(): Promise { try { - const inactiveToggleFolder = element(by.css('#adf-folder-upload-switch .mat-slide-toggle-label')); + const inactiveToggleFolder = $('#adf-folder-upload-switch .mat-slide-toggle-label'); await BrowserVisibility.waitUntilElementIsVisible(inactiveToggleFolder); return true; } catch { diff --git a/e2e/core/pages/icons.page.ts b/e2e/core/pages/icons.page.ts index 1c444f2482e..9fa0bfed386 100644 --- a/e2e/core/pages/icons.page.ts +++ b/e2e/core/pages/icons.page.ts @@ -15,18 +15,13 @@ * limitations under the License. */ -import { by, element, ElementFinder } from 'protractor'; +import { $, ElementFinder } from 'protractor'; import { BrowserVisibility } from '@alfresco/adf-testing'; export class IconsPage { - locateCustomIcon(name: string): ElementFinder { - return element(by.css(`adf-icon[value='${name}'] svg`)); - } - - locateLigatureIcon(name: string): ElementFinder { - return element(by.css(`adf-icon[value='${name}'] .material-icons`)); - } + locateCustomIcon = (name: string): ElementFinder => $(`adf-icon[value='${name}'] svg`); + locateLigatureIcon = (name: string): ElementFinder => $(`adf-icon[value='${name}'] .material-icons`); async isCustomIconDisplayed(name: string) { const present = await BrowserVisibility.waitUntilElementIsVisible(this.locateCustomIcon(name)); diff --git a/e2e/core/pages/infinite-pagination.page.ts b/e2e/core/pages/infinite-pagination.page.ts index 702337e59d8..cab608b2ce8 100644 --- a/e2e/core/pages/infinite-pagination.page.ts +++ b/e2e/core/pages/infinite-pagination.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { element, by, ElementFinder } from 'protractor'; +import { ElementFinder, $, $$ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class InfinitePaginationPage { rootElement: ElementFinder; - loadMoreButton; - loading = element(by.css('[data-automation-id="adf-infinite-pagination-spinner"]')); + loadMoreButton: ElementFinder; + loading = $('[data-automation-id="adf-infinite-pagination-spinner"]'); - constructor(rootElement = element.all(by.css('adf-infinite-pagination')).first()) { + constructor(rootElement = $$('adf-infinite-pagination').first()) { this.rootElement = rootElement; - this.loadMoreButton = this.rootElement.element(by.css('button[data-automation-id="adf-infinite-pagination-button"]')); + this.loadMoreButton = this.rootElement.$('button[data-automation-id="adf-infinite-pagination-button"]'); } async clickLoadMoreButton(): Promise { diff --git a/e2e/core/pages/login-shell.page.ts b/e2e/core/pages/login-shell.page.ts index ec4b0251202..ea9dd6dc8be 100644 --- a/e2e/core/pages/login-shell.page.ts +++ b/e2e/core/pages/login-shell.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { browser, by, element } from 'protractor'; +import { $, browser, by, element } from 'protractor'; import { TogglePage, BrowserActions, BrowserVisibility, LoginPage } from '@alfresco/adf-testing'; export class LoginShellPage { @@ -24,33 +24,33 @@ export class LoginShellPage { loginSSOPage = new LoginPage(); togglePage = new TogglePage(); - txtUsername = element(by.css('input[id="username"]')); - txtPassword = element(by.css('input[id="password"]')); - logoImg = element(by.css('img[id="adf-login-img-logo"]')); - successRouteTxt = element(by.css('input[data-automation-id="adf-success-route"]')); - logoTxt = element(by.css('input[data-automation-id="adf-url-logo"]')); - usernameError = element(by.css('span[data-automation-id="username-error"]')); - passwordError = element(by.css('span[data-automation-id="password-required"]')); - loginError = element(by.css('.adf-login-error-message')); - usernameInactive = element(by.css('input[id="username"][aria-invalid="false"]')); - passwordInactive = element(by.css('input[id="password"][aria-invalid="false"]')); - adfLogo = element(by.css('.adf-img-logo')); - - usernameHighlighted = element(by.css('input[id="username"][aria-invalid="true"]')); - passwordHighlighted = element(by.css('input[id="password"][aria-invalid="true"]')); - signInButton = element(by.id('login-button')); - showPasswordElement = element(by.css('button[data-automation-id="show_password"]')); - hidePasswordElement = element(by.css('button[data-automation-id="hide_password"]')); - rememberMe = element(by.css('mat-checkbox[id="adf-login-remember"]')); - needHelp = element(by.id('adf-login-action-left')); - register = element(by.id('adf-login-action-right')); - footerSwitch = element(by.id('switch4')); - rememberMeSwitch = element(by.id('adf-toggle-show-rememberme')); - successRouteSwitch = element(by.id('adf-toggle-show-successRoute')); - logoSwitch = element(by.id('adf-toggle-logo')); - header = element(by.id('adf-header')); + txtUsername = $('input[id="username"]'); + txtPassword = $('input[id="password"]'); + logoImg = $('img[id="adf-login-img-logo"]'); + successRouteTxt = $('input[data-automation-id="adf-success-route"]'); + logoTxt = $('input[data-automation-id="adf-url-logo"]'); + usernameError = $('span[data-automation-id="username-error"]'); + passwordError = $('span[data-automation-id="password-required"]'); + loginError = $('.adf-login-error-message'); + usernameInactive = $('input[id="username"][aria-invalid="false"]'); + passwordInactive = $('input[id="password"][aria-invalid="false"]'); + adfLogo = $('.adf-img-logo'); + + usernameHighlighted = $('input[id="username"][aria-invalid="true"]'); + passwordHighlighted = $('input[id="password"][aria-invalid="true"]'); + signInButton = $('#login-button'); + showPasswordElement = $('button[data-automation-id="show_password"]'); + hidePasswordElement = $('button[data-automation-id="hide_password"]'); + rememberMe = $('mat-checkbox[id="adf-login-remember"]'); + needHelp = $('#adf-login-action-left'); + register = $('#adf-login-action-right'); + footerSwitch = $('#switch4'); + rememberMeSwitch = $('#adf-toggle-show-rememberme'); + successRouteSwitch = $('#adf-toggle-show-successRoute'); + logoSwitch = $('#adf-toggle-logo'); + header = $('#adf-header'); settingsIcon = element(by.cssContainingText('a[data-automation-id="settings"] mat-icon', 'settings')); - sidenavLayout = element(by.css(`[data-automation-id="sidenav-layout"]`)); + sidenavLayout = $(`[data-automation-id="sidenav-layout"]`); async goToLoginPage(): Promise { await BrowserActions.getUrl(this.loginURL); diff --git a/e2e/core/pages/logout.page.ts b/e2e/core/pages/logout.page.ts index cbb60de9561..bdfaec629b7 100644 --- a/e2e/core/pages/logout.page.ts +++ b/e2e/core/pages/logout.page.ts @@ -15,12 +15,12 @@ * limitations under the License. */ -import { by, element, ElementFinder } from 'protractor'; +import { $ } from 'protractor'; import { BrowserVisibility } from '@alfresco/adf-testing'; export class LogoutPage { - logoutSection: ElementFinder = element(by.css('div[data-automation-id="adf-logout-section"]')); + logoutSection = $('div[data-automation-id="adf-logout-section"]'); async checkLogoutSectionIsDisplayed() { await BrowserVisibility.waitUntilElementIsVisible(this.logoutSection); diff --git a/e2e/core/pages/metadata-view.page.ts b/e2e/core/pages/metadata-view.page.ts index d26b3ae267a..99b5e4c88cc 100644 --- a/e2e/core/pages/metadata-view.page.ts +++ b/e2e/core/pages/metadata-view.page.ts @@ -15,45 +15,48 @@ * limitations under the License. */ -import { by, element, Key, Locator, protractor } from 'protractor'; +import { $, by, element, Key, protractor, ElementFinder } from 'protractor'; import { BrowserActions, BrowserVisibility, DropdownPage, TestElement, Logger } from '@alfresco/adf-testing'; export class MetadataViewPage { - title = element(by.css(`div[info-drawer-title]`)); - expandedAspect = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`)); - aspectTitle: Locator = by.css(`mat-panel-title`); - name = element(by.css(`[data-automation-id='card-textitem-value-properties.cm:name']`)); - creator = element(by.css(`[data-automation-id='card-textitem-value-createdByUser.displayName']`)); - createdDate = element(by.css(`span[data-automation-id='card-dateitem-createdAt']`)); - modifier = element(by.css(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`)); - modifiedDate = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt']`)); - mimetypeName = element(by.css(`[data-automation-id='card-textitem-value-content.mimeTypeName']`)); - size = element(by.css(`[data-automation-id='card-textitem-value-content.sizeInBytes']`)); - description = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description']`)); - author = element(by.css(`[data-automation-id='card-textitem-value-properties.cm:author']`)); - titleProperty = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`)); - editIcon = element(by.css(`button[data-automation-id='meta-data-card-toggle-edit']`)); - informationButton = element(by.css(`button[data-automation-id='meta-data-card-toggle-expand']`)); - informationSpan = element(by.css(`span[data-automation-id='meta-data-card-toggle-expand-label']`)); - informationIcon = element(by.css(`span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon`)); - displayEmptySwitch = element(by.id(`adf-metadata-empty`)); - readonlySwitch = element(by.id(`adf-metadata-readonly`)); - multiSwitch = element(by.id(`adf-metadata-multi`)); - presetSwitch = element(by.id('adf-toggle-custom-preset')); - defaultPropertiesSwitch = element(by.id('adf-metadata-default-properties')); + title = $(`div[info-drawer-title]`); + expandedAspect = $(`mat-expansion-panel-header[aria-expanded='true']`); + aspectTitle = `mat-panel-title`; + name = $(`[data-automation-id='card-textitem-value-properties.cm:name']`); + creator = $(`[data-automation-id='card-textitem-value-createdByUser.displayName']`); + createdDate = $(`span[data-automation-id='card-dateitem-createdAt']`); + modifier = $(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`); + modifiedDate = $(`span[data-automation-id='card-dateitem-modifiedAt']`); + mimetypeName = $(`[data-automation-id='card-textitem-value-content.mimeTypeName']`); + size = $(`[data-automation-id='card-textitem-value-content.sizeInBytes']`); + description = $(`span[data-automation-id='card-textitem-value-properties.cm:description']`); + author = $(`[data-automation-id='card-textitem-value-properties.cm:author']`); + titleProperty = $(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`); + editIcon = $(`button[data-automation-id='meta-data-card-toggle-edit']`); + informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`); + informationSpan = $(`span[data-automation-id='meta-data-card-toggle-expand-label']`); + informationIcon = $(`span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon`); + displayEmptySwitch = $(`#adf-metadata-empty`); + readonlySwitch = $(`#adf-metadata-readonly`); + multiSwitch = $(`#adf-metadata-multi`); + presetSwitch = $('#adf-toggle-custom-preset'); + defaultPropertiesSwitch = $('#adf-metadata-default-properties'); closeButton = element(by.cssContainingText('button.mat-button span', 'Close')); - displayAspect = element(by.css(`input[data-placeholder='Display Aspect']`)); + displayAspect = $(`input[data-placeholder='Display Aspect']`); applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect')); - saveMetadataButton = element(by.css(`[data-automation-id='save-metadata']`)); - resetMetadataButton = element(by.css(`[data-automation-id='reset-metadata']`)); + saveMetadataButton = $(`[data-automation-id='save-metadata']`); + resetMetadataButton = $(`[data-automation-id='reset-metadata']`); + + private getMetadataGroupLocator = async (groupName: string): Promise => $(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"]`); + private getExpandedMetadataGroupLocator = async (groupName: string): Promise => $(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"] > mat-expansion-panel-header`); async getTitle(): Promise { return BrowserActions.getText(this.title); } async getExpandedAspectName(): Promise { - return BrowserActions.getText(this.expandedAspect.element(this.aspectTitle)); + return BrowserActions.getText(this.expandedAspect.$(this.aspectTitle)); } async getName(): Promise { @@ -138,79 +141,79 @@ export class MetadataViewPage { } async editPropertyIconIsDisplayed(propertyName: string) { - const editPropertyIcon = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon')); + const editPropertyIcon = $('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'); await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon); } async clickResetButton(): Promise { - const clearPropertyIcon = element(by.css('button[data-automation-id="reset-metadata"]')); + const clearPropertyIcon = $('button[data-automation-id="reset-metadata"]'); await BrowserActions.click(clearPropertyIcon); } async enterPropertyText(propertyName: string, text: string | number): Promise { - const textField = element(by.css('input[data-automation-id="card-textitem-value-' + propertyName + '"]')); + const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]'); await BrowserActions.clearSendKeys(textField, text.toString()); await textField.sendKeys(protractor.Key.ENTER); } async enterPresetText(text: string): Promise { - const presetField = element(by.css('input[data-automation-id="adf-text-custom-preset"]')); + const presetField = $('input[data-automation-id="adf-text-custom-preset"]'); await BrowserActions.clearSendKeys(presetField, text.toString()); await presetField.sendKeys(protractor.Key.ENTER); - const applyButton = element(by.css('button[id="adf-metadata-aplly"]')); + const applyButton = $('button[id="adf-metadata-aplly"]'); await BrowserActions.click(applyButton); } async enterDescriptionText(text: string): Promise { - const textField = element(by.css('textarea[data-automation-id="card-textitem-value-properties.cm:description"]')); + const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]'); await BrowserActions.clearSendKeys(textField, text); await textField.sendKeys(Key.TAB); } async getPropertyText(propertyName: string, type?: string): Promise { const propertyType = type || 'textitem'; - const textField = element(by.css('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]')); + const textField = $('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]'); return BrowserActions.getInputValue(textField); } async getPropertyIconTooltip(propertyName: string): Promise { - const editPropertyIcon = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon')); + const editPropertyIcon = $('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'); return BrowserActions.getAttribute(editPropertyIcon, 'title'); } async clickMetadataGroup(groupName: string): Promise { - const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]')); + const group = await this.getMetadataGroupLocator(groupName); await BrowserActions.click(group); } async checkMetadataGroupIsPresent(groupName: string): Promise { - const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]')); + const group = await this.getMetadataGroupLocator(groupName); await BrowserVisibility.waitUntilElementIsVisible(group); } async checkMetadataGroupIsNotPresent(groupName: string): Promise { - const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]')); + const group = await this.getMetadataGroupLocator(groupName); await BrowserVisibility.waitUntilElementIsNotVisible(group); } async checkMetadataGroupIsExpand(groupName: string): Promise { - const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header')); + const group = await this.getExpandedMetadataGroupLocator(groupName); await expect(await BrowserActions.getAttribute(group, 'class')).toContain('mat-expanded'); } async checkMetadataGroupIsNotExpand(groupName: string): Promise { - const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header')); + const group = await this.getExpandedMetadataGroupLocator(groupName); await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded'); } async getMetadataGroupTitle(groupName: string): Promise { - const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title')); + const group = $('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title'); return BrowserActions.getText(group); } async checkPropertyIsVisible(propertyName: string, type: string): Promise { - const property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]')); + const property = $('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'); await BrowserVisibility.waitUntilElementIsVisible(property); } diff --git a/e2e/core/pages/navigation-bar.page.ts b/e2e/core/pages/navigation-bar.page.ts index a57b0306c01..13cf085a999 100644 --- a/e2e/core/pages/navigation-bar.page.ts +++ b/e2e/core/pages/navigation-bar.page.ts @@ -16,32 +16,34 @@ */ import { AppListCloudPage, BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing'; -import { browser, by, element, ElementFinder } from 'protractor'; +import { $, browser, ElementFinder } from 'protractor'; import { ProcessServicesPage } from '../../process-services/pages/process-services.page'; export class NavigationBarPage { - linkListContainer = element(by.css('.app-sidenav-linklist')); - linkMenuChildrenContainer = element(by.css('.nestedMenu')); - dataTableNestedButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Datatable"]')); - dataTableCopyContentButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Copy Content"]')); - dataTableDragAndDropButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Drag and Drop"]')); - processServicesNestedButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="App"]')); - processServicesCloudHomeButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Home"]')); - themeButton = element(by.css('button[data-automation-id="theme menu"]')); - themeMenuContent = element(by.css('div[class*="mat-menu-panel"]')); - appTitle = element(by.css('.adf-app-title')); - menuButton = element(by.css('button[data-automation-id="adf-menu-icon"]')); - formButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Form"]')); - peopleGroupCloudButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="People/Group Cloud"]')); - serviceTaskListButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Service Task List"]')); - logoutSection: ElementFinder = element(by.css('div[data-automation-id="adf-logout-section"]')); - personalFiles: ElementFinder = element(by.css('div [title="Personal Files"]')); + linkListContainer = $('.app-sidenav-linklist'); + linkMenuChildrenContainer = $('.nestedMenu'); + dataTableNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Datatable"]'); + dataTableCopyContentButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Copy Content"]'); + dataTableDragAndDropButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Drag and Drop"]'); + processServicesNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="App"]'); + processServicesCloudHomeButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Home"]'); + themeButton = $('button[data-automation-id="theme menu"]'); + themeMenuContent = $('div[class*="mat-menu-panel"]'); + appTitle = $('.adf-app-title'); + menuButton = $('button[data-automation-id="adf-menu-icon"]'); + formButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Form"]'); + peopleGroupCloudButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="People/Group Cloud"]'); + serviceTaskListButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Service Task List"]'); + logoutSection = $('div[data-automation-id="adf-logout-section"]'); + personalFiles = $('div [title="Personal Files"]'); + + getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`); async clickNavigationBarItem(title: string, untilElementIsVisible?: ElementFinder): Promise { Logger.log(`clickNavigationBarItem ${title}`); - const menu = element(by.css(`.app-sidenav-link[data-automation-id="${title}"]`)); + const menu = $(`.app-sidenav-link[data-automation-id="${title}"]`); await BrowserActions.closeMenuAndDialogs(); if (untilElementIsVisible) { @@ -69,7 +71,7 @@ export class NavigationBarPage { async clickProcessCloudButton() { await BrowserActions.closeMenuAndDialogs(); - await BrowserActions.clickUntilIsNotVisible(this.getMenuItem('Process Cloud'), this.linkMenuChildrenContainer); + await BrowserActions.clickUntilIsNotVisible(this.getMenuItemLocator('Process Cloud'), this.linkMenuChildrenContainer); } async navigateToProcessServicesCloudPage(): Promise { @@ -99,11 +101,7 @@ export class NavigationBarPage { private async clickProcessServicesButton() { await BrowserActions.closeMenuAndDialogs(); - await BrowserActions.clickUntilIsNotVisible(this.getMenuItem('Process Services'), this.linkMenuChildrenContainer); - } - - private getMenuItem(title: string) { - return element(by.css(`.app-sidenav-link[data-automation-id="${title}"]`)); + await BrowserActions.clickUntilIsNotVisible(this.getMenuItemLocator('Process Services'), this.linkMenuChildrenContainer); } async navigateToProcessServicesPage(): Promise { @@ -205,7 +203,7 @@ export class NavigationBarPage { } async clickOnSpecificThemeButton(themeName): Promise { - const themeElement = element(by.css(`button[data-automation-id="${themeName}"]`)); + const themeElement = $(`button[data-automation-id="${themeName}"]`); await BrowserActions.click(themeElement); await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer); } @@ -223,12 +221,12 @@ export class NavigationBarPage { } async checkToolbarColor(color: string): Promise { - const toolbarColor = element(by.css(`mat-toolbar[class*="mat-${color}"]`)); + const toolbarColor = $(`mat-toolbar[class*="mat-${color}"]`); await BrowserVisibility.waitUntilElementIsVisible(toolbarColor); } async clickAppLogo(logoTitle: string): Promise { - const appLogo = element(by.css('a[title="' + logoTitle + '"]')); + const appLogo = $('a[title="' + logoTitle + '"]'); await BrowserActions.click(appLogo); } @@ -237,7 +235,7 @@ export class NavigationBarPage { } async checkLogoTooltip(logoTooltipTitle: string): Promise { - const logoTooltip = element(by.css('a[title="' + logoTooltipTitle + '"]')); + const logoTooltip = $('a[title="' + logoTooltipTitle + '"]'); await BrowserVisibility.waitUntilElementIsVisible(logoTooltip); } diff --git a/e2e/core/pages/notification.page.ts b/e2e/core/pages/notification.page.ts index 66d35793a41..16d43bc0d24 100644 --- a/e2e/core/pages/notification.page.ts +++ b/e2e/core/pages/notification.page.ts @@ -15,24 +15,24 @@ * limitations under the License. */ -import { element, by, browser } from 'protractor'; +import { element, by, browser, $, $$ } from 'protractor'; import { BrowserVisibility, BrowserActions, DropdownPage, SnackbarPage } from '@alfresco/adf-testing'; export class NotificationDemoPage { snackbarPage = new SnackbarPage(); - messageField = element(by.css('input[data-automation-id="notification-message"]')); - durationField = element(by.css('input[data-automation-id="notification-duration"]')); - actionToggle = element(by.css('mat-slide-toggle[data-automation-id="notification-action-toggle"]')); - notificationSnackBar = element.all(by.css('simple-snack-bar')).first(); - actionOutput = element(by.css('div[data-automation-id="notification-action-output"]')); - notificationsPage = element(by.css('.app-sidenav-link[data-automation-id="Notifications"]')); - notificationConfig = element(by.css('p[data-automation-id="notification-custom-object"]')); + messageField = $('input[data-automation-id="notification-message"]'); + durationField = $('input[data-automation-id="notification-duration"]'); + actionToggle = $('mat-slide-toggle[data-automation-id="notification-action-toggle"]'); + notificationSnackBar = $$('simple-snack-bar').first(); + actionOutput = $('div[data-automation-id="notification-action-output"]'); + notificationsPage = $('.app-sidenav-link[data-automation-id="Notifications"]'); + notificationConfig = $('p[data-automation-id="notification-custom-object"]'); - horizontalPositionDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="notification-horizontal-position"]'))); - verticalPositionDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="notification-vertical-position"]'))); - directionDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="notification-direction"]'))); + horizontalPositionDropdown = new DropdownPage($('mat-select[data-automation-id="notification-horizontal-position"]')); + verticalPositionDropdown = new DropdownPage($('mat-select[data-automation-id="notification-vertical-position"]')); + directionDropdown = new DropdownPage($('mat-select[data-automation-id="notification-direction"]')); async checkNotifyContains(message): Promise { await BrowserVisibility.waitUntilElementIsVisible(element.all(by.cssContainingText('simple-snack-bar', message)).first()); @@ -79,7 +79,7 @@ export class NotificationDemoPage { } async clickNotificationButton(): Promise { - const button = element(by.css('button[data-automation-id="notification-custom-config-button"]')); + const button = $('button[data-automation-id="notification-custom-config-button"]'); await BrowserActions.click(button); } diff --git a/e2e/core/pages/trashcan.page.ts b/e2e/core/pages/trashcan.page.ts index ff94afd0c45..8f7d4632744 100644 --- a/e2e/core/pages/trashcan.page.ts +++ b/e2e/core/pages/trashcan.page.ts @@ -16,19 +16,19 @@ */ import { BrowserActions, BrowserVisibility, DocumentListPage } from '@alfresco/adf-testing'; -import { Locator, element, by, browser } from 'protractor'; +import { browser, $$, $ } from 'protractor'; export class TrashcanPage { - contentList = new DocumentListPage(element(by.css('adf-document-list'))); - rows: Locator = by.css('adf-document-list div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]'); - tableBody = element.all(by.css('adf-document-list .adf-datatable-body')).first(); - pagination = element(by.css('adf-pagination')); - emptyTrashcan = element(by.css('adf-empty-content')); - restoreButton = element(by.css(`button[title='Restore']`)); + contentList = new DocumentListPage($('adf-document-list')); + rows = $$('adf-document-list div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]'); + tableBody = $$('adf-document-list .adf-datatable-body').first(); + pagination = $('adf-pagination'); + emptyTrashcan = $('adf-empty-content'); + restoreButton = $(`button[title='Restore']`); async numberOfResultsDisplayed(): Promise { - return element.all(this.rows).count(); + return this.rows.count(); } async waitForTableBody(): Promise { diff --git a/e2e/core/pages/version-manager.page.ts b/e2e/core/pages/version-manager.page.ts index ed32deb4aee..c0fdcfde30c 100644 --- a/e2e/core/pages/version-manager.page.ts +++ b/e2e/core/pages/version-manager.page.ts @@ -17,7 +17,7 @@ import * as path from 'path'; import { BrowserActions, TestElement, TogglePage } from '@alfresco/adf-testing'; -import { browser, by, element } from 'protractor'; +import { $, browser } from 'protractor'; export class VersionManagePage { @@ -31,9 +31,9 @@ export class VersionManagePage { majorRadio = TestElement.byId('adf-new-version-major'); minorRadio = TestElement.byId('adf-new-version-minor'); commentText = TestElement.byId('adf-new-version-text-area'); - readOnlySwitch = element(by.id('adf-version-manager-switch-readonly')); - downloadSwitch = element(by.id('adf-version-manager-switch-download')); - commentsSwitch = element(by.id('adf-version-manager-switch-comments')); + readOnlySwitch = $('#adf-version-manager-switch-readonly'); + downloadSwitch = $('#adf-version-manager-switch-download'); + commentsSwitch = $('#adf-version-manager-switch-comments'); confirmAccept = TestElement.byId('adf-confirm-accept'); confirmCancel = TestElement.byId('adf-confirm-cancel'); diff --git a/e2e/core/pagination-empty-current-page.e2e.ts b/e2e/core/pagination-empty-current-page.e2e.ts index 09e2ecaede8..449cc611d5a 100644 --- a/e2e/core/pagination-empty-current-page.e2e.ts +++ b/e2e/core/pagination-empty-current-page.e2e.ts @@ -106,18 +106,14 @@ describe('Pagination - returns to previous page when current is empty', () => { await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five); await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue); - let list = await contentServicesPage.getAllRowsNameColumn(); await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true); - await paginationPage.clickOnNextPage(); await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded(); await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five); - list = await contentServicesPage.getAllRowsNameColumn(); await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(5, 6))).toEqual(true); - await contentServicesPage.deleteContent(lastFile); await contentServicesPage.checkContentIsNotDisplayed(lastFile); diff --git a/e2e/process-services-cloud/form-field/task-visibility-condition.e2e.ts b/e2e/process-services-cloud/form-field/task-visibility-condition.e2e.ts index b9b7faf7db2..698efce5139 100644 --- a/e2e/process-services-cloud/form-field/task-visibility-condition.e2e.ts +++ b/e2e/process-services-cloud/form-field/task-visibility-condition.e2e.ts @@ -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(); }); diff --git a/e2e/process-services-cloud/pages/people-group-cloud-component.page.ts b/e2e/process-services-cloud/pages/people-group-cloud-component.page.ts index 8b9aa6f2061..c8d6910a09a 100644 --- a/e2e/process-services-cloud/pages/people-group-cloud-component.page.ts +++ b/e2e/process-services-cloud/pages/people-group-cloud-component.page.ts @@ -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 { await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle); diff --git a/e2e/process-services-cloud/pages/process-cloud-demo.page.ts b/e2e/process-services-cloud/pages/process-cloud-demo.page.ts index 400f43f756a..dd222fb2c65 100644 --- a/e2e/process-services-cloud/pages/process-cloud-demo.page.ts +++ b/e2e/process-services-cloud/pages/process-cloud-demo.page.ts @@ -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(); diff --git a/e2e/process-services-cloud/pages/service-task-list.page.ts b/e2e/process-services-cloud/pages/service-task-list.page.ts index e0032b2b0b9..882471a6899 100644 --- a/e2e/process-services-cloud/pages/service-task-list.page.ts +++ b/e2e/process-services-cloud/pages/service-task-list.page.ts @@ -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 { await BrowserVisibility.waitUntilElementIsVisible(this.allServiceTaskButton); diff --git a/e2e/process-services-cloud/pages/tasks-cloud-demo.page.ts b/e2e/process-services-cloud/pages/tasks-cloud-demo.page.ts index a34d829b394..d7f9f047fa4 100644 --- a/e2e/process-services-cloud/pages/tasks-cloud-demo.page.ts +++ b/e2e/process-services-cloud/pages/tasks-cloud-demo.page.ts @@ -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(); diff --git a/e2e/process-services-cloud/process/process-task-attach-content-file-cloud.e2e.ts b/e2e/process-services-cloud/process/process-task-attach-content-file-cloud.e2e.ts index 557aa9c84f9..a8ba18e6d70 100644 --- a/e2e/process-services-cloud/process/process-task-attach-content-file-cloud.e2e.ts +++ b/e2e/process-services-cloud/process/process-task-attach-content-file-cloud.e2e.ts @@ -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); diff --git a/e2e/process-services-cloud/task-list/tasks-custom-filters.e2e.ts b/e2e/process-services-cloud/task-list/tasks-custom-filters.e2e.ts index 11c5f4c592e..4f933455e21 100644 --- a/e2e/process-services-cloud/task-list/tasks-custom-filters.e2e.ts +++ b/e2e/process-services-cloud/task-list/tasks-custom-filters.e2e.ts @@ -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); diff --git a/e2e/process-services/form/attach-form-component.e2e.ts b/e2e/process-services/form/attach-form-component.e2e.ts index 9027718bf24..f15096c479a 100644 --- a/e2e/process-services/form/attach-form-component.e2e.ts +++ b/e2e/process-services/form/attach-form-component.e2e.ts @@ -23,7 +23,7 @@ import { createApiService, TaskUtil, UsersActions } from '@alfresco/adf-testing'; -import { browser, by } from 'protractor'; +import { browser } from 'protractor'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { AttachFormPage } from './../pages/attach-form.page'; import { TasksPage } from './../pages/tasks.page'; @@ -126,7 +126,7 @@ describe('Attach Form Component', () => { await attachFormPage.selectAttachFormOption(testNames.formName); await attachFormPage.clickAttachFormButton(); - await formFields.setFieldValue(by.id, formTextField, testNames.formFieldValue); + await formFields.setFieldValue(formTextField, testNames.formFieldValue); await formFields.completeForm(); await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS); diff --git a/e2e/process-services/pages/analytics.page.ts b/e2e/process-services/pages/analytics.page.ts index 18479255817..c23981127bf 100644 --- a/e2e/process-services/pages/analytics.page.ts +++ b/e2e/process-services/pages/analytics.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { element, by, protractor } from 'protractor'; +import { element, by, protractor, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class AnalyticsPage { - toolbarTitleInput = element(by.css('input[data-automation-id="reportName"]')); - toolbarTitleContainer = element(by.css('adf-toolbar-title')); + toolbarTitleInput = $('input[data-automation-id="reportName"]'); + toolbarTitleContainer = $('adf-toolbar-title'); toolbarTitle = element(by.xpath('//mat-toolbar/adf-toolbar-title/div/h4')); - reportMessage = element(by.css('div[class="ng-star-inserted"] span')); + reportMessage = $('div[class="ng-star-inserted"] span'); async getReport(title: string): Promise { - const reportTitle = element(by.css(`mat-icon[data-automation-id="${title}_filter"]`)); + const reportTitle = $(`mat-icon[data-automation-id="${title}_filter"]`); await BrowserActions.click(reportTitle); } diff --git a/e2e/process-services/pages/attach-form.page.ts b/e2e/process-services/pages/attach-form.page.ts index 03917ec103a..86576a81cd7 100644 --- a/e2e/process-services/pages/attach-form.page.ts +++ b/e2e/process-services/pages/attach-form.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserVisibility, BrowserActions, DropdownPage } from '@alfresco/adf-testing'; export class AttachFormPage { - noFormMessage = element(by.css('.adf-empty-content__title')); - attachFormButton = element(by.id('adf-attach-form-attach-button')); - completeButton = element(by.id('adf-attach-form-complete-button')); - formDropdown = element(by.id('form_id')); - cancelButton = element(by.id('adf-attach-form-cancel-button')); - defaultTitle = element(by.css('.mat-card-title')); - attachFormDropdown = new DropdownPage(element(by.css('.adf-attach-form-row'))); + noFormMessage = $('.adf-empty-content__title'); + attachFormButton = $('#adf-attach-form-attach-button'); + completeButton = $('#adf-attach-form-complete-button'); + formDropdown = $('#form_id'); + cancelButton = $('#adf-attach-form-cancel-button'); + defaultTitle = $('.mat-card-title'); + attachFormDropdown = new DropdownPage($('.adf-attach-form-row')); async checkNoFormMessageIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage); @@ -70,6 +70,6 @@ export class AttachFormPage { } async checkAttachFormButtonIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="adf-attach-form-attach-button"][disabled]'))); + await BrowserVisibility.waitUntilElementIsVisible($('button[id="adf-attach-form-attach-button"][disabled]')); } } diff --git a/e2e/process-services/pages/attachment-list.page.ts b/e2e/process-services/pages/attachment-list.page.ts index 1bcf484d37f..28ab6e47e7d 100644 --- a/e2e/process-services/pages/attachment-list.page.ts +++ b/e2e/process-services/pages/attachment-list.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { element, by, protractor, browser } from 'protractor'; +import { protractor, browser, $, $$ } from 'protractor'; import * as path from 'path'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class AttachmentListPage { - attachFileButton = element(by.css("input[type='file']")); - buttonMenu = element(by.css("button[data-automation-id='action_menu_0']")); - viewButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']")); - removeButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']")); - downloadButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']")); - noContentContainer = element(by.css("div[class*='adf-no-content-container']")); + attachFileButton = $("input[type='file']"); + buttonMenu = $("button[data-automation-id='action_menu_0']"); + viewButton = $("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']"); + removeButton = $("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']"); + downloadButton = $("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']"); + noContentContainer = $("div[class*='adf-no-content-container']"); async checkEmptyAttachmentList(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer); @@ -39,7 +39,7 @@ export class AttachmentListPage { } async checkFileIsAttached(name: string): Promise { - const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first(); + const fileAttached = $$('div[data-automation-id="' + name + '"]').first(); await BrowserVisibility.waitUntilElementIsVisible(fileAttached); } @@ -49,7 +49,7 @@ export class AttachmentListPage { async viewFile(name: string): Promise { await BrowserActions.closeMenuAndDialogs(); - await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first()); + await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first()); await BrowserActions.click(this.buttonMenu); await browser.sleep(500); await BrowserActions.click(this.viewButton); @@ -58,7 +58,7 @@ export class AttachmentListPage { async removeFile(name: string): Promise { await BrowserActions.closeMenuAndDialogs(); - await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first()); + await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first()); await BrowserActions.click(this.buttonMenu); await browser.sleep(500); await BrowserActions.click(this.removeButton); @@ -67,7 +67,7 @@ export class AttachmentListPage { async downloadFile(name: string): Promise { await BrowserActions.closeMenuAndDialogs(); - await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first()); + await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first()); await BrowserActions.click(this.buttonMenu); await browser.sleep(500); await BrowserActions.click(this.downloadButton); @@ -75,14 +75,14 @@ export class AttachmentListPage { async doubleClickFile(name: string): Promise { await BrowserActions.closeMenuAndDialogs(); - await BrowserVisibility.waitUntilElementIsVisible(element.all(by.css(`div[data-automation-id="${name}"]`)).first()); - const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first(); + await BrowserVisibility.waitUntilElementIsVisible($$(`div[data-automation-id="${name}"]`).first()); + const fileAttached = $$(`div[data-automation-id="${name}"]`).first(); await BrowserActions.click(fileAttached); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); } async checkFileIsRemoved(name: string): Promise { - const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first(); + const fileAttached = $$(`div[data-automation-id="${name}"]`).first(); await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached); } diff --git a/e2e/process-services/pages/dialog/app-settings-toggles.page.ts b/e2e/process-services/pages/dialog/app-settings-toggles.page.ts index 0c04d0e4053..a38cdb97fb1 100644 --- a/e2e/process-services/pages/dialog/app-settings-toggles.page.ts +++ b/e2e/process-services/pages/dialog/app-settings-toggles.page.ts @@ -16,15 +16,15 @@ */ import { TogglePage } from '@alfresco/adf-testing'; -import { element, by } from 'protractor'; +import { $ } from 'protractor'; export class AppSettingsTogglesPage { togglePage = new TogglePage(); - showDetailsHeaderToggle = element(by.id('adf-show-header')); - showTaskFilterIconsToggle = element(by.id('adf-show-task-filter-icon')); - showProcessFilterIconsToggle = element(by.id('adf-show-process-filter-icon')); + showDetailsHeaderToggle = $('#adf-show-header'); + showTaskFilterIconsToggle = $('#adf-show-task-filter-icon'); + showProcessFilterIconsToggle = $('#adf-show-process-filter-icon'); async enableShowHeader(): Promise { await this.togglePage.enableToggle(this.showDetailsHeaderToggle); diff --git a/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts b/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts index f098c2cd406..db0e2ce12ce 100644 --- a/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts +++ b/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts @@ -15,15 +15,15 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class ChecklistDialog { - nameField = element(by.css('input[data-automation-id="checklist-name"]')); - addChecklistButton = element(by.css('button[id="add-check"] span')); - closeButton = element(by.css('button[id="close-check-dialog"] span')); - dialogTitle = element(by.id('add-checklist-title')); + nameField = $('input[data-automation-id="checklist-name"]'); + addChecklistButton = $('button[id="add-check"] span'); + closeButton = $('button[id="close-check-dialog"] span'); + dialogTitle = $('#add-checklist-title'); async addName(name: string): Promise { await BrowserActions.clearSendKeys(this.nameField, name); diff --git a/e2e/process-services/pages/dialog/start-task-dialog.page.ts b/e2e/process-services/pages/dialog/start-task-dialog.page.ts index 14d3cd2bb05..0f0ecbd98e4 100644 --- a/e2e/process-services/pages/dialog/start-task-dialog.page.ts +++ b/e2e/process-services/pages/dialog/start-task-dialog.page.ts @@ -15,20 +15,20 @@ * limitations under the License. */ -import { element, by, Key, ElementFinder } from 'protractor'; +import { element, by, Key, ElementFinder, $ } from 'protractor'; import { BrowserVisibility, BrowserActions, DropdownPage } from '@alfresco/adf-testing'; export class StartTaskDialogPage { - name = element(by.css('input[id="name_id"]')); - dueDate = element(by.css('input[id="date_id"]')); - description = element(by.css('textarea[id="description_id"]')); - assignee = element(by.css('div#people-widget-content input')); - startButton = element(by.css('button[id="button-start"]')); - startButtonEnabled = element(by.css('button[id="button-start"]:not(disabled)')); - cancelButton = element(by.css('button[id="button-cancel"]')); + name = $('input[id="name_id"]'); + dueDate = $('input[id="date_id"]'); + description = $('textarea[id="description_id"]'); + assignee = $('div#people-widget-content input'); + startButton = $('button[id="button-start"]'); + startButtonEnabled = $('button[id="button-start"]:not(disabled)'); + cancelButton = $('button[id="button-cancel"]'); - selectFormDropdown = new DropdownPage(element(by.css('mat-select[id="form_id"]'))); + selectFormDropdown = new DropdownPage($('mat-select[id="form_id"]')); selectAssigneeDropdown = new DropdownPage(); async addName(userName: string): Promise { @@ -74,7 +74,7 @@ export class StartTaskDialogPage { } async checkStartButtonIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled'))); + await BrowserVisibility.waitUntilElementIsVisible($('button[id="button-start"]:disabled')); } async clickCancelButton(): Promise { diff --git a/e2e/process-services/pages/filters.page.ts b/e2e/process-services/pages/filters.page.ts index 4c60c99a5f5..6a55175a54a 100644 --- a/e2e/process-services/pages/filters.page.ts +++ b/e2e/process-services/pages/filters.page.ts @@ -16,11 +16,11 @@ */ import { BrowserActions, BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $ } from 'protractor'; export class FiltersPage { - activeFilter = element(by.css('.adf-active')); + activeFilter = $('.adf-active'); dataTable: DataTableComponentPage = new DataTableComponentPage(); async getActiveFilter(): Promise { @@ -29,7 +29,7 @@ export class FiltersPage { async goToFilter(filterName): Promise { await BrowserActions.closeMenuAndDialogs(); - const filter = element(by.css(`button[data-automation-id="${filterName}_filter"]`)); + const filter = $(`button[data-automation-id="${filterName}_filter"]`); await BrowserActions.click(filter); await this.dataTable.waitTillContentLoaded(); } @@ -43,7 +43,7 @@ export class FiltersPage { } async checkFilterIsHighlighted(filterName: string): Promise { - const highlightedFilter = element(by.css(`.adf-active [data-automation-id='${filterName}_filter']`)); + const highlightedFilter = $(`.adf-active [data-automation-id='${filterName}_filter']`); await BrowserVisibility.waitUntilElementIsVisible(highlightedFilter); } } diff --git a/e2e/process-services/pages/form-demo.page.ts b/e2e/process-services/pages/form-demo.page.ts index 37320fce716..e5e8d1badbf 100644 --- a/e2e/process-services/pages/form-demo.page.ts +++ b/e2e/process-services/pages/form-demo.page.ts @@ -16,12 +16,12 @@ */ import { BrowserActions, BrowserVisibility, ConfigEditorPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $$, $ } from 'protractor'; export class FormDemoPage { - formCloudEditor = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1); - formCloudRender = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0); + formCloudEditor = $$('.mat-tab-list .mat-tab-label').get(1); + formCloudRender = $$('.mat-tab-list .mat-tab-label').get(0); configEditorPage = new ConfigEditorPage(); @@ -34,8 +34,8 @@ export class FormDemoPage { } async setConfigToEditor(text: string): Promise { - const configEditor = element(by.id('adf-form-config-editor')); - const form = element(by.css('adf-form')); + const configEditor = $('#adf-form-config-editor'); + const form = $('adf-form'); await this.goToEditor(); await BrowserVisibility.waitUntilElementIsVisible(configEditor); await this.configEditorPage.enterBulkConfiguration(text); diff --git a/e2e/process-services/pages/process-filters.page.ts b/e2e/process-services/pages/process-filters.page.ts index f54e33dbe6f..539a0552d1c 100644 --- a/e2e/process-services/pages/process-filters.page.ts +++ b/e2e/process-services/pages/process-filters.page.ts @@ -16,25 +16,23 @@ */ import { BrowserActions, BrowserVisibility, DataTableComponentPage, StartProcessPage } from '@alfresco/adf-testing'; -import { Locator, by, element } from 'protractor'; +import { $, $$ } from 'protractor'; export class ProcessFiltersPage { dataTable = new DataTableComponentPage(); - runningFilter = element(by.css('button[data-automation-id="Running_filter"]')); - completedFilter = element(by.css('button[data-automation-id="Completed_filter"]')); - allFilter = element(by.css('button[data-automation-id="All_filter"]')); - createProcessButton = element(by.css('.app-processes-menu button[data-automation-id="create-button"] > span')); - newProcessButton = element(by.css('div > button[data-automation-id="btn-start-process"]')); - processesPage = element(by.id('app-processes-menu')); - accordionMenu = element(by.css('.app-processes-menu mat-accordion')); - buttonWindow = element(by.css('div > button[data-automation-id="btn-start-process"] > div')); - noContentMessage = element.all(by.css('.adf-empty-content__title')).first(); - rows: Locator = by.css('adf-process-instance-list .adf-datatable-body adf-datatable-row[class*="adf-datatable-row"]'); - tableBody = element.all(by.css('adf-datatable .adf-datatable-body')).first(); - nameColumn: Locator = by.css('div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"] div[title="Name"] span'); - processIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]'); - startProcessEl = element(by.css('adf-start-process .adf-start-process')); + createProcessButton = $('.app-processes-menu button[data-automation-id="create-button"] > span'); + newProcessButton = $('div > button[data-automation-id="btn-start-process"]'); + processesPage = $('#app-processes-menu'); + accordionMenu = $('.app-processes-menu mat-accordion'); + buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div'); + noContentMessage = $$('.adf-empty-content__title').first(); + rows = $$('adf-process-instance-list .adf-datatable-body adf-datatable-row[class*="adf-datatable-row"]'); + tableBody = $$('adf-datatable .adf-datatable-body').first(); + processIcon = 'adf-icon[data-automation-id="adf-filter-icon"]'; + startProcessEl = $('adf-start-process .adf-start-process'); + + getButtonFilterLocatorByName = (name: string) => $(`button[data-automation-id='${name}_filter']`); async startProcess(): Promise { await this.clickCreateProcessButton(); @@ -43,17 +41,19 @@ export class ProcessFiltersPage { } async clickRunningFilterButton(): Promise { - await BrowserActions.click(this.runningFilter); + await BrowserActions.click(await this.getButtonFilterLocatorByName('Running')); } async clickCompletedFilterButton(): Promise { - await BrowserActions.click(this.completedFilter); - await expect(await this.completedFilter.isEnabled()).toBe(true); + const completedFilterButtonLocator = await this.getButtonFilterLocatorByName('Completed'); + await BrowserActions.click(completedFilterButtonLocator); + await expect(await completedFilterButtonLocator.isEnabled()).toBe(true); } async clickAllFilterButton(): Promise { - await BrowserActions.click(this.allFilter); - await expect(await this.allFilter.isEnabled()).toBe(true); + const allFilterButtonLocator = await this.getButtonFilterLocatorByName('All'); + await BrowserActions.click(allFilterButtonLocator); + await expect(await allFilterButtonLocator.isEnabled()).toBe(true); } async clickCreateProcessButton(): Promise { @@ -78,18 +78,18 @@ export class ProcessFiltersPage { async selectFromProcessList(title: string): Promise { await BrowserActions.closeMenuAndDialogs(); - const processName = element.all(by.css(`div[data-automation-id="text_${title}"]`)).first(); + const processName = $$(`div[data-automation-id="text_${title}"]`).first(); await BrowserActions.click(processName); } async checkFilterIsHighlighted(filterName: string): Promise { - const processNameHighlighted = element(by.css(`adf-process-instance-filters .adf-active button[data-automation-id='${filterName}_filter']`)); + const processNameHighlighted = $(`adf-process-instance-filters .adf-active button[data-automation-id='${filterName}_filter']`); await BrowserVisibility.waitUntilElementIsVisible(processNameHighlighted); } async numberOfProcessRows(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element.all(this.rows).first()); - return element.all(this.rows).count(); + await BrowserVisibility.waitUntilElementIsVisible(await this.rows.first()); + return this.rows.count(); } async waitForTableBody(): Promise { @@ -110,25 +110,25 @@ export class ProcessFiltersPage { } async checkFilterIsDisplayed(name: string): Promise { - const filterName = element(by.css(`button[data-automation-id='${name}_filter']`)); + const filterName = await this.getButtonFilterLocatorByName(name); await BrowserVisibility.waitUntilElementIsVisible(filterName); } async checkFilterHasNoIcon(name: string): Promise { - const filterName = element(by.css(`button[data-automation-id='${name}_filter']`)); + const filterName = await this.getButtonFilterLocatorByName(name); await BrowserVisibility.waitUntilElementIsVisible(filterName); - await BrowserVisibility.waitUntilElementIsNotVisible(filterName.element(this.processIcon)); + await BrowserVisibility.waitUntilElementIsNotVisible(filterName.$(this.processIcon)); } async getFilterIcon(name: string): Promise { - const filterName = element(by.css(`button[data-automation-id='${name}_filter']`)); + const filterName = await this.getButtonFilterLocatorByName(name); await BrowserVisibility.waitUntilElementIsVisible(filterName); - const icon = filterName.element(this.processIcon); + const icon = filterName.$(this.processIcon); return BrowserActions.getText(icon); } async checkFilterIsNotDisplayed(name: string): Promise { - const filterName = element(by.css(`button[data-automation-id='${name}_filter']`)); + const filterName = await this.getButtonFilterLocatorByName(name); await BrowserVisibility.waitUntilElementIsNotVisible(filterName); } diff --git a/e2e/process-services/pages/process-list-demo.page.ts b/e2e/process-services/pages/process-list-demo.page.ts index a41334ff4bb..d7c22b7154d 100644 --- a/e2e/process-services/pages/process-list-demo.page.ts +++ b/e2e/process-services/pages/process-list-demo.page.ts @@ -16,18 +16,18 @@ */ import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing'; -import { by, element, protractor } from 'protractor'; +import { $, by, element, protractor } from 'protractor'; export class ProcessListDemoPage { - appIdInput = element(by.css('input[data-automation-id="app-id"]')); + appIdInput = $('input[data-automation-id="app-id"]'); resetButton = element(by.cssContainingText('button span', 'Reset')); - emptyProcessContent = element(by.css('.adf-empty-content')); - processDefinitionInput = element(by.css('input[data-automation-id="process-definition-id"]')); - processInstanceInput = element(by.css('input[data-automation-id="process-instance-id"]')); + emptyProcessContent = $('.adf-empty-content'); + processDefinitionInput = $('input[data-automation-id="process-definition-id"]'); + processInstanceInput = $('input[data-automation-id="process-instance-id"]'); - stateDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="state"'))); - sortDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="sort"'))); + stateDropdown = new DropdownPage($('mat-select[data-automation-id="state"')); + sortDropdown = new DropdownPage($('mat-select[data-automation-id="sort"')); dataTable = new DataTableComponentPage(); diff --git a/e2e/process-services/pages/process-list.page.ts b/e2e/process-services/pages/process-list.page.ts index 73a42f7f6c5..f064071d745 100644 --- a/e2e/process-services/pages/process-list.page.ts +++ b/e2e/process-services/pages/process-list.page.ts @@ -16,12 +16,12 @@ */ import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; -import { element, by } from 'protractor'; +import { $ } from 'protractor'; export class ProcessListPage { - processListTitle = element(by.css('.adf-empty-content__title')); - processInstanceList = element(by.css('adf-process-instance-list')); + processListTitle = $('.adf-empty-content__title'); + processInstanceList = $('adf-process-instance-list'); getDisplayedProcessListTitle(): Promise { return BrowserActions.getText(this.processListTitle); diff --git a/e2e/process-services/pages/process-services.page.ts b/e2e/process-services/pages/process-services.page.ts index bc8fa236981..6f622936e86 100644 --- a/e2e/process-services/pages/process-services.page.ts +++ b/e2e/process-services/pages/process-services.page.ts @@ -17,23 +17,24 @@ import { ProcessServiceTabBarPage } from './process-service-tab-bar.page'; -import { Locator, element, by, browser } from 'protractor'; +import { browser, $, ElementFinder } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; import { TasksPage } from './tasks.page'; export class ProcessServicesPage { - apsAppsContainer = element(by.css('.adf-app-listgrid')); - taskApp = element(by.css('mat-card[title="Task App"]')); - iconTypeLocator: Locator = by.css('mat-icon[class*="card-logo-icon"]'); - descriptionLocator: Locator = by.css('mat-card-subtitle[class*="subtitle"]'); + apsAppsContainer = $('.adf-app-listgrid'); + iconTypeLocator = 'mat-icon[class*="card-logo-icon"]'; + descriptionLocator = 'mat-card-subtitle[class*="subtitle"]'; + + getApplicationNameLocator = (name: string): ElementFinder => $(`mat-card[title="${name}"]`); async checkApsContainer(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer); } async goToApp(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getApplicationNameLocator(applicationName); await BrowserActions.click(app); const taskPage = new TasksPage(); await taskPage.tasksListPage().checkTaskListIsLoaded(); @@ -41,7 +42,8 @@ export class ProcessServicesPage { } async goToTaskApp(): Promise { - await BrowserActions.click(this.taskApp); + const taskAppLocator = this.getApplicationNameLocator('Task App'); + await BrowserActions.click(taskAppLocator); return new ProcessServiceTabBarPage(); } @@ -53,32 +55,32 @@ export class ProcessServicesPage { } async getAppIconType(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getApplicationNameLocator(applicationName); await BrowserVisibility.waitUntilElementIsVisible(app); - const iconType = app.element(this.iconTypeLocator); + const iconType = await app.$(this.iconTypeLocator); return BrowserActions.getText(iconType); } async getBackgroundColor(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getApplicationNameLocator(applicationName); await BrowserVisibility.waitUntilElementIsVisible(app); return app.getCssValue('background-color'); } async getDescription(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getApplicationNameLocator(applicationName); await BrowserVisibility.waitUntilElementIsVisible(app); - const description = app.element(this.descriptionLocator); + const description = await app.$(this.descriptionLocator); return BrowserActions.getText(description); } async checkAppIsNotDisplayed(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getApplicationNameLocator(applicationName); await BrowserVisibility.waitUntilElementIsNotVisible(app); } async checkAppIsDisplayed(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getApplicationNameLocator(applicationName); await BrowserVisibility.waitUntilElementIsVisible(app); } } diff --git a/e2e/process-services/pages/task-details.page.ts b/e2e/process-services/pages/task-details.page.ts index fc334602daa..8106f9ed421 100644 --- a/e2e/process-services/pages/task-details.page.ts +++ b/e2e/process-services/pages/task-details.page.ts @@ -16,73 +16,73 @@ */ import { BrowserActions, BrowserVisibility, DropdownPage, TabsPage } from '@alfresco/adf-testing'; -import { browser, by, element, Key } from 'protractor'; +import { browser, by, element, Key, $, $$ } from 'protractor'; import { AppSettingsTogglesPage } from './dialog/app-settings-toggles.page'; export class TaskDetailsPage { appSettingsTogglesClass = new AppSettingsTogglesPage(); - formContent = element(by.css('adf-form')); - - formNameField = element(by.css('[data-automation-id="card-textitem-value-formName"]')); - formNameButton = element(by.css('[data-automation-id="card-textitem-toggle-formName"]')); - assigneeField = element(by.css('[data-automation-id="card-textitem-value-assignee"]')); - assigneeButton = element(by.css('[data-automation-id="card-textitem-toggle-assignee"]')); - statusField = element(by.css('[data-automation-id="card-textitem-value-status"]')); - categoryField = element(by.css('[data-automation-id="card-textitem-value-category"] ')); - parentNameField = element(by.css('span[data-automation-id*="parentName"] span')); - parentTaskIdField = element(by.css('[data-automation-id="card-textitem-value-parentTaskId"] ')); - durationField = element(by.css('[data-automation-id="card-textitem-value-duration"] ')); - endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first(); - createdField = element(by.css('span[data-automation-id="card-dateitem-created"]')); - idField = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first(); - descriptionField = element(by.css('[data-automation-id="card-textitem-value-description"]')); - dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first(); - activitiesTitle = element(by.css('div[class*="adf-info-drawer-layout-header-title"] div')); - commentField = element(by.id('comment-input')); - addCommentButton = element(by.css('[data-automation-id="comments-input-add"]')); - involvePeopleButton = element(by.css('div[class*="add-people"]')); - addPeopleField = element(by.css('input[data-automation-id="adf-people-search-input"]')); - addInvolvedUserButton = element(by.css('button[id="add-people"]')); + formContent = $('adf-form'); + + formNameField = $('[data-automation-id="card-textitem-value-formName"]'); + formNameButton = $('[data-automation-id="card-textitem-toggle-formName"]'); + assigneeField = $('[data-automation-id="card-textitem-value-assignee"]'); + assigneeButton = $('[data-automation-id="card-textitem-toggle-assignee"]'); + statusField = $('[data-automation-id="card-textitem-value-status"]'); + categoryField = $('[data-automation-id="card-textitem-value-category"] '); + parentNameField = $('span[data-automation-id*="parentName"] span'); + parentTaskIdField = $('[data-automation-id="card-textitem-value-parentTaskId"] '); + durationField = $('[data-automation-id="card-textitem-value-duration"] '); + endDateField = $$('span[data-automation-id*="endDate"] span').first(); + createdField = $('span[data-automation-id="card-dateitem-created"]'); + idField = $$('[data-automation-id="card-textitem-value-id"]').first(); + descriptionField = $('[data-automation-id="card-textitem-value-description"]'); + dueDateField = $$('span[data-automation-id*="dueDate"] span').first(); + activitiesTitle = $('div[class*="adf-info-drawer-layout-header-title"] div'); + commentField = $('#comment-input'); + addCommentButton = $('[data-automation-id="comments-input-add"]'); + involvePeopleButton = $('div[class*="add-people"]'); + addPeopleField = $('input[data-automation-id="adf-people-search-input"]'); + addInvolvedUserButton = $('button[id="add-people"]'); taskDetailsInfoDrawer = element(by.tagName('adf-info-drawer')); - taskDetailsSection = element(by.css('div[data-automation-id="app-tasks-details"]')); - taskDetailsEmptySection = element(by.css('div[data-automation-id="adf-tasks-details--empty"]')); - completeTask = element(by.css('button[id="adf-no-form-complete-button"]')); - completeFormTask = element(by.css('button[id="adf-form-complete"]')); - taskDetailsTitle = element(by.css('.adf-activiti-task-details__header span')); - auditLogButton = element(by.css('button[adf-task-audit]')); - noPeopleInvolved = element(by.id('no-people-label')); - cancelInvolvePeopleButton = element(by.id('close-people-search')); - involvePeopleHeader = element(by.css('.adf-search-text-header')); - removeInvolvedPeople = element(by.css('button[data-automation-id="Remove"]')); - peopleTitle = element(by.id('people-title')); - noFormMessage = element(by.css('span[id*="no-form-message"]')); - cancelAttachForm = element(by.id('adf-no-form-cancel-button')); - attachFormButton = element(by.id('adf-no-form-attach-form-button')); - disabledAttachFormButton = element(by.css('button[id="adf-no-form-attach-form-button"][disabled]')); - removeAttachForm = element(by.id('adf-attach-form-remove-button')); - attachFormName = element(by.css('.adf-form-title')); - emptyTaskDetails = element(by.css('adf-task-details > div > div')); - priority = element(by.css('[data-automation-id*="card-textitem-value-priority"]')); - editableAssignee = element(by.css('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]')); - claimElement = element(by.css('[data-automation-id="header-claim-button"]')); - releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]')); - saveFormButton = element(by.css('button[id="adf-form-save"]')); - - attachFormDropdown = new DropdownPage(element(by.css('.adf-attach-form-row'))); + taskDetailsSection = $('div[data-automation-id="app-tasks-details"]'); + taskDetailsEmptySection = $('div[data-automation-id="adf-tasks-details--empty"]'); + completeTask = $('button[id="adf-no-form-complete-button"]'); + completeFormTask = $('button[id="adf-form-complete"]'); + taskDetailsTitle = $('.adf-activiti-task-details__header span'); + auditLogButton = $('button[adf-task-audit]'); + noPeopleInvolved = $('#no-people-label'); + cancelInvolvePeopleButton = $('#close-people-search'); + involvePeopleHeader = $('.adf-search-text-header'); + removeInvolvedPeople = $('button[data-automation-id="Remove"]'); + peopleTitle = $('#people-title'); + noFormMessage = $('span[id*="no-form-message"]'); + cancelAttachForm = $('#adf-no-form-cancel-button'); + attachFormButton = $('#adf-no-form-attach-form-button'); + disabledAttachFormButton = $('button[id="adf-no-form-attach-form-button"][disabled]'); + removeAttachForm = $('#adf-attach-form-remove-button'); + attachFormName = $('.adf-form-title'); + emptyTaskDetails = $('adf-task-details > div > div'); + priority = $('[data-automation-id*="card-textitem-value-priority"]'); + editableAssignee = $('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]'); + claimElement = $('[data-automation-id="header-claim-button"]'); + releaseElement = $('[data-automation-id="header-unclaim-button"]'); + saveFormButton = $('button[id="adf-form-save"]'); + + attachFormDropdown = new DropdownPage($('.adf-attach-form-row')); async checkEditableAssigneeIsNotDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsNotVisible(this.editableAssignee); } async checkEditableFormIsNotDisplayed(): Promise { - const editableForm = element(by.css('[data-automation-id="card-textitem-value-formName"][class*="clickable"]')); + const editableForm = $('[data-automation-id="card-textitem-value-formName"][class*="clickable"]'); await BrowserVisibility.waitUntilElementIsNotVisible(editableForm); } async checkDueDatePickerButtonIsNotDisplayed(): Promise { - const dueDatePickerButton = element(by.css('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]')); + const dueDatePickerButton = $('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]'); await BrowserVisibility.waitUntilElementIsNotVisible(dueDatePickerButton); } @@ -219,33 +219,33 @@ export class TaskDetailsPage { async updatePriority(priority?: string): Promise { await BrowserActions.click(this.priority); await BrowserActions.clearWithBackSpace(this.priority); - await BrowserActions.clearSendKeys(element(by.css('input[data-automation-id="card-textitem-value-priority"]')), priority, 500); + await BrowserActions.clearSendKeys($('input[data-automation-id="card-textitem-value-priority"]'), priority, 500); await this.priority.sendKeys(Key.TAB); await browser.sleep(1000); } async updateDueDate(): Promise { await BrowserActions.click(this.dueDateField); - await BrowserActions.click(element.all(by.css('.mat-datetimepicker-calendar-body-cell')).first()); + await BrowserActions.click($$('.mat-datetimepicker-calendar-body-cell').first()); await browser.sleep(1000); } async updateDescription(description?: string): Promise { await BrowserActions.click(this.descriptionField); await BrowserActions.clearWithBackSpace(this.descriptionField); - await BrowserActions.clearSendKeys(element(by.css('[data-automation-id="card-textitem-value-description"]')), description ? description : ''); + await BrowserActions.clearSendKeys($('[data-automation-id="card-textitem-value-description"]'), description ? description : ''); await this.descriptionField.sendKeys(Key.TAB); await browser.sleep(1000); } async updateAssignee(fullName: string): Promise { await BrowserActions.click(this.assigneeButton); - await BrowserActions.clearSendKeys(element(by.css('[id="userSearchText"]')), fullName); + await BrowserActions.clearSendKeys($('[id="userSearchText"]'), fullName); await BrowserActions.click(element(by.cssContainingText('.adf-people-full-name', fullName))); - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`adf-datatable-row[class*='is-selected']`))); + await BrowserVisibility.waitUntilElementIsVisible($(`adf-datatable-row[class*='is-selected']`)); await browser.sleep(2000); - await BrowserActions.click(element(by.css('button[id="add-people"]'))); + await BrowserActions.click($('button[id="add-people"]')); } getTitle(): Promise { @@ -304,19 +304,19 @@ export class TaskDetailsPage { } getRowsUser(user: string) { - return element(by.css(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`)); + return $(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`); } async removeInvolvedUser(user): Promise { const row = this.getRowsUser(user).element(by.xpath('ancestor::adf-datatable-row[contains(@class, "adf-datatable-row")]')); - await BrowserActions.click(row.element(by.css('button[data-automation-id="action_menu_0"]'))); + await BrowserActions.click(row.$('button[data-automation-id="action_menu_0"]')); await BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople); await BrowserActions.click(this.removeInvolvedPeople); } async getInvolvedUserEmail(user): Promise { - return BrowserActions.getText(element(by.css(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`))); + return BrowserActions.getText($(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`)); } async clickAuditLogButton(): Promise { diff --git a/e2e/process-services/pages/task-filters-demo.page.ts b/e2e/process-services/pages/task-filters-demo.page.ts index cb1596ef047..c2f99c8a526 100644 --- a/e2e/process-services/pages/task-filters-demo.page.ts +++ b/e2e/process-services/pages/task-filters-demo.page.ts @@ -16,16 +16,16 @@ */ import { BrowserActions } from '@alfresco/adf-testing'; -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { TaskFiltersPage } from './task-filters.page'; export class TaskFiltersDemoPage { - myTasks = element(by.css('button[data-automation-id="My Tasks_filter"]')); - queuedTask = element(by.css('button[data-automation-id="Queued Tasks_filter"]')); - completedTask = element(by.css('button[data-automation-id="Completed Tasks_filter"]')); - involvedTask = element(by.css('button[data-automation-id="Involved Tasks_filter"]')); - activeFilter = element(by.css('adf-task-filters .adf-active')); + myTasks = $('button[data-automation-id="My Tasks_filter"]'); + queuedTask = $('button[data-automation-id="Queued Tasks_filter"]'); + completedTask = $('button[data-automation-id="Completed Tasks_filter"]'); + involvedTask = $('button[data-automation-id="Involved Tasks_filter"]'); + activeFilter = $('adf-task-filters .adf-active'); myTasksFilter(): TaskFiltersPage { return new TaskFiltersPage(this.myTasks); @@ -44,7 +44,7 @@ export class TaskFiltersDemoPage { } customTaskFilter(filterName: string): TaskFiltersPage { - return new TaskFiltersPage(element(by.css(`button[data-automation-id="${filterName}_filter"]`))); + return new TaskFiltersPage($(`button[data-automation-id="${filterName}_filter"]`)); } async checkActiveFilterActive(): Promise { diff --git a/e2e/process-services/pages/task-filters.page.ts b/e2e/process-services/pages/task-filters.page.ts index 1a1d96d6ef0..3b53f4764fa 100644 --- a/e2e/process-services/pages/task-filters.page.ts +++ b/e2e/process-services/pages/task-filters.page.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import { Locator, by, ElementFinder } from 'protractor'; +import { ElementFinder } from 'protractor'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class TaskFiltersPage { - filter; - taskIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]'); + filter: ElementFinder; + taskIcon = 'adf-icon[data-automation-id="adf-filter-icon"]'; constructor(filter: ElementFinder) { this.filter = filter; @@ -33,13 +33,13 @@ export class TaskFiltersPage { async getTaskFilterIcon(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const icon = this.filter.element(this.taskIcon); + const icon = this.filter.$(this.taskIcon); return BrowserActions.getText(icon); } async checkTaskFilterHasNoIcon(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.taskIcon)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.taskIcon)); } async clickTaskFilter(): Promise { diff --git a/e2e/process-services/pages/task-list-demo.page.ts b/e2e/process-services/pages/task-list-demo.page.ts index 1b76b074a49..bc0a68a4bb6 100644 --- a/e2e/process-services/pages/task-list-demo.page.ts +++ b/e2e/process-services/pages/task-list-demo.page.ts @@ -16,26 +16,26 @@ */ import { BrowserActions, BrowserVisibility, DropdownPage, PaginationPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { TasksListPage } from './tasks-list.page'; export class TaskListDemoPage { taskListPage = new TasksListPage(); - appId = element(by.css("input[data-automation-id='appId input']")); - itemsPerPage = element(by.css("input[data-automation-id='items per page']")); - itemsPerPageForm = element(by.css("mat-form-field[data-automation-id='items per page']")); - processDefinitionId = element(by.css("input[data-automation-id='process definition id']")); - processInstanceId = element(by.css("input[data-automation-id='process instance id']")); - page = element(by.css("input[data-automation-id='page']")); - pageForm = element(by.css("mat-form-field[data-automation-id='page']")); - taskName = element(by.css("input[data-automation-id='task name']")); - resetButton = element(by.css('.app-reset-button button')); - dueBefore = element(by.css("input[data-automation-id='due before']")); - dueAfter = element(by.css("input[data-automation-id='due after']")); - taskId = element(by.css("input[data-automation-id='task id']")); - - stateDropDownArrow = element(by.css("mat-form-field[data-automation-id='state']")); + appId = $("input[data-automation-id='appId input']"); + itemsPerPage = $("input[data-automation-id='items per page']"); + itemsPerPageForm = $("mat-form-field[data-automation-id='items per page']"); + processDefinitionId = $("input[data-automation-id='process definition id']"); + processInstanceId = $("input[data-automation-id='process instance id']"); + page = $("input[data-automation-id='page']"); + pageForm = $("mat-form-field[data-automation-id='page']"); + taskName = $("input[data-automation-id='task name']"); + resetButton = $('.app-reset-button button'); + dueBefore = $("input[data-automation-id='due before']"); + dueAfter = $("input[data-automation-id='due after']"); + taskId = $("input[data-automation-id='task id']"); + + stateDropDownArrow = $("mat-form-field[data-automation-id='state']"); stateDropdown = new DropdownPage(this.stateDropDownArrow); taskList(): TasksListPage { @@ -97,7 +97,7 @@ export class TaskListDemoPage { async getItemsPerPageFieldErrorMessage(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageForm); - const errorMessage = this.itemsPerPageForm.element(by.css('mat-error')); + const errorMessage = this.itemsPerPageForm.$('mat-error'); return BrowserActions.getText(errorMessage); } @@ -111,7 +111,7 @@ export class TaskListDemoPage { async getPageFieldErrorMessage(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.pageForm); - const errorMessage = this.pageForm.element(by.css('mat-error')); + const errorMessage = this.pageForm.$('mat-error'); return BrowserActions.getText(errorMessage); } diff --git a/e2e/process-services/pages/tasks-list.page.ts b/e2e/process-services/pages/tasks-list.page.ts index fb33eb6cad3..35af6209d42 100644 --- a/e2e/process-services/pages/tasks-list.page.ts +++ b/e2e/process-services/pages/tasks-list.page.ts @@ -16,12 +16,12 @@ */ import { BrowserActions, BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing'; -import { browser, by, element } from 'protractor'; +import { browser, $, $$ } from 'protractor'; export class TasksListPage { - taskList = element(by.css('adf-tasklist')); - noTasksFound = element.all(by.css('.adf-empty-content__title')).first(); + taskList = $('adf-tasklist'); + noTasksFound = $$('.adf-empty-content__title').first(); dataTable = new DataTableComponentPage(this.taskList); getDataTable(): DataTableComponentPage { diff --git a/e2e/process-services/pages/tasks.page.ts b/e2e/process-services/pages/tasks.page.ts index e140aca0e25..506f1050e14 100644 --- a/e2e/process-services/pages/tasks.page.ts +++ b/e2e/process-services/pages/tasks.page.ts @@ -21,22 +21,20 @@ import { TaskDetailsPage } from './task-details.page'; import { FiltersPage } from './filters.page'; import { ChecklistDialog } from './dialog/create-checklist-dialog.page'; import { TasksListPage } from './tasks-list.page'; -import { Locator, element, by } from 'protractor'; +import { element, by, $ } from 'protractor'; import { BrowserVisibility, BrowserActions, FormFields } from '@alfresco/adf-testing'; export class TasksPage { - createButton = element(by.css('button[data-automation-id="create-button"')); - newTaskButton = element(by.css('button[data-automation-id="btn-start-task"]')); - addChecklistButton = element(by.css('button[class*="adf-add-to-checklist-button"]')); + createButton = $('button[data-automation-id="create-button"'); + newTaskButton = $('button[data-automation-id="btn-start-task"]'); + addChecklistButton = $('button[class*="adf-add-to-checklist-button"]'); rowByRowName = by.xpath('ancestor::mat-chip'); - checklistContainer: Locator = by.css('div[class*="checklist-menu"]'); + checklistContainer = $('div[class*="checklist-menu"]'); taskTitle = '.adf-activiti-task-details__header span'; - rows: Locator = by.css('div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"] div[class*="adf-datatable-cell"]'); - completeButtonNoForm = element(by.id('adf-no-form-complete-button')); - checklistDialog = element(by.id('checklist-dialog')); - checklistNoMessage = element(by.id('checklist-none-message')); - numberOfChecklists = element(by.css('[data-automation-id="checklist-label"] mat-chip')); - sortByName: Locator = by.css('div[data-automation-id="auto_id_name"]'); + completeButtonNoForm = $('#adf-no-form-complete-button'); + checklistDialog = $('#checklist-dialog'); + checklistNoMessage = $('#checklist-none-message'); + numberOfChecklists = $('[data-automation-id="checklist-label"] mat-chip'); async createNewTask(): Promise { await this.clickOnCreateButton(); @@ -89,7 +87,7 @@ export class TasksPage { } getRowsName(name: string) { - return element(this.checklistContainer).element(by.cssContainingText('span', name)); + return this.checklistContainer.element(by.cssContainingText('span', name)); } getChecklistByName(name: string) { @@ -104,11 +102,11 @@ export class TasksPage { } async checkChecklistIsNotDisplayed(name: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(element(this.checklistContainer).element(by.cssContainingText('span', name))); + await BrowserVisibility.waitUntilElementIsNotVisible(this.checklistContainer.element(by.cssContainingText('span', name))); } async checkTaskTitle(taskName: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(this.taskTitle))); + await BrowserVisibility.waitUntilElementIsVisible($(this.taskTitle)); const title = element(by.cssContainingText(this.taskTitle, taskName)); await BrowserVisibility.waitUntilElementIsVisible(title); } @@ -140,13 +138,13 @@ export class TasksPage { async removeChecklists(name: string): Promise { const elem = this.getRowsName(name); const row = elem.element(this.rowByRowName); - await BrowserActions.click(row.element(by.css('mat-icon'))); + await BrowserActions.click(row.$('mat-icon')); } async checkChecklistsRemoveButtonIsNotDisplayed(name: string): Promise { const elem = this.getRowsName(name); const row = elem.element(this.rowByRowName); - await BrowserVisibility.waitUntilElementIsNotVisible(row.element(by.css('mat-icon'))); + await BrowserVisibility.waitUntilElementIsNotVisible(row.$('mat-icon')); } async clickSortByNameAsc(): Promise { diff --git a/e2e/process-services/process/comment-component-processes.e2e.ts b/e2e/process-services/process/comment-component-processes.e2e.ts index 18e86f63e5e..7dfb1565353 100644 --- a/e2e/process-services/process/comment-component-processes.e2e.ts +++ b/e2e/process-services/process/comment-component-processes.e2e.ts @@ -51,7 +51,6 @@ describe('Comment component for Processes', () => { await apiService.loginWithProfile('admin'); user = await usersActions.createUser(); - await apiService.login(user.username, user.password); const importedApp = await applicationsService.importPublishDeployApp(app.file_path); diff --git a/e2e/process-services/tasks/start-task-custom-app.e2e.ts b/e2e/process-services/tasks/start-task-custom-app.e2e.ts index d7368dd843d..cb99a536a6e 100644 --- a/e2e/process-services/tasks/start-task-custom-app.e2e.ts +++ b/e2e/process-services/tasks/start-task-custom-app.e2e.ts @@ -16,7 +16,7 @@ */ import { createApiService, ApplicationsUtil, LoginPage, UserModel, UsersActions } from '@alfresco/adf-testing'; -import { browser, by } from 'protractor'; +import { browser } from 'protractor'; import { FileModel } from '../../models/ACS/file.model'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; @@ -148,21 +148,21 @@ describe('Start Task - Custom App', () => { await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]); - await taskPage.formFields().setFieldValue(by.id, formTextField, formFieldValue); + await taskPage.formFields().setFieldValue(formTextField, formFieldValue); await taskPage.formFields().refreshForm(); - await taskPage.formFields().checkFieldValue(by.id, formTextField, ''); + await taskPage.formFields().checkFieldValue(formTextField, ''); await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]); - await taskPage.formFields().setFieldValue(by.id, formTextField, formFieldValue); + await taskPage.formFields().setFieldValue(formTextField, formFieldValue); - await taskPage.formFields().checkFieldValue(by.id, formTextField, formFieldValue); + await taskPage.formFields().checkFieldValue(formTextField, formFieldValue); await taskPage.formFields().saveForm(); - await taskPage.formFields().checkFieldValue(by.id, formTextField, formFieldValue); + await taskPage.formFields().checkFieldValue(formTextField, formFieldValue); }); it('[C263951] Should be possible to assign a user', async () => { diff --git a/e2e/process-services/tasks/start-task-task-app.e2e.ts b/e2e/process-services/tasks/start-task-task-app.e2e.ts index 97f8fda12ae..9c7bf9ce656 100644 --- a/e2e/process-services/tasks/start-task-task-app.e2e.ts +++ b/e2e/process-services/tasks/start-task-task-app.e2e.ts @@ -23,14 +23,14 @@ import { createApiService, UserModel, UsersActions } from '@alfresco/adf-testing'; -import { browser, by } from 'protractor'; +import { browser } from 'protractor'; import { FileModel } from '../../models/ACS/file.model'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { AttachmentListPage } from './../pages/attachment-list.page'; import { ChecklistDialog } from './../pages/dialog/create-checklist-dialog.page'; import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page'; import { TasksPage } from './../pages/tasks.page'; -import CONSTANTS = require('../../util/constants'); +import * as CONSTANTS from '../../util/constants'; describe('Start Task - Task App', () => { @@ -133,17 +133,17 @@ describe('Start Task - Task App', () => { await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]); const formFields = await taskPage.formFields(); - await formFields.setFieldValue(by.id, formTextField, formFieldValue); + await formFields.setFieldValue(formTextField, formFieldValue); await formFields.refreshForm(); - await formFields.checkFieldValue(by.id, formTextField, ''); + await formFields.checkFieldValue(formTextField, ''); await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]); - await formFields.setFieldValue(by.id, formTextField, formFieldValue); - await formFields.checkFieldValue(by.id, formTextField, formFieldValue); + await formFields.setFieldValue(formTextField, formFieldValue); + await formFields.checkFieldValue(formTextField, formFieldValue); await taskPage.formFields().saveForm(); - await formFields.checkFieldValue(by.id, formTextField, formFieldValue); + await formFields.checkFieldValue(formTextField, formFieldValue); }); it('[C260425] Should be possible to assign a user', async () => { diff --git a/e2e/protractor.conf.js b/e2e/protractor.conf.js index 44de30671f9..e7ce41732d4 100644 --- a/e2e/protractor.conf.js +++ b/e2e/protractor.conf.js @@ -64,7 +64,7 @@ let specs = function () { } else { const FOLDER = process.env.FOLDER || ''; setProvider(FOLDER); - const specsToRun = FOLDER ? `./${FOLDER}/**/*.e2e.ts` : './**/*.ts'; + const specsToRun = FOLDER ? `./${FOLDER}/**/*.e2e.ts` : './**/*.e2e.ts'; arraySpecs = [specsToRun]; } diff --git a/e2e/search/pages/search-bar.page.ts b/e2e/search/pages/search-bar.page.ts index 1feeb389df2..0e0d515d5f3 100644 --- a/e2e/search/pages/search-bar.page.ts +++ b/e2e/search/pages/search-bar.page.ts @@ -15,23 +15,25 @@ * limitations under the License. */ -import { Locator, browser, by, element, ElementFinder, protractor } from 'protractor'; +import { browser, ElementFinder, protractor, $ } from 'protractor'; import { BrowserVisibility, BrowserActions, TestElement } from '@alfresco/adf-testing'; export class SearchBarPage { - searchIcon = element(by.css(`button[class*='adf-search-button']`)); - searchBar = element(by.css(`adf-search-control input`)); + searchIcon = $(`button[class*='adf-search-button']`); + searchBar = $(`adf-search-control input`); searchBarExpanded: TestElement = TestElement.byCss(`adf-search-control mat-form-field[class*="mat-focused"] input`); - noResultMessage = element(by.css(`p[class*='adf-search-fixed-text']`)); - rowsAuthor: Locator = by.css(`.mat-list-text p[class*='adf-search-fixed-text']`); - completeName: Locator = by.css(`h4[class*='adf-search-fixed-text']`); - highlightName: Locator = by.css(`.adf-highlight`); - searchBarPage = element(by.css(`mat-list[id='autocomplete-search-result-list']`)); + noResultMessage = $(`p[class*='adf-search-fixed-text']`); + rowsAuthor = `.mat-list-text p[class*='adf-search-fixed-text']`; + completeName = `h4[class*='adf-search-fixed-text']`; + highlightName = `.adf-highlight`; + searchBarPage = $(`mat-list[id='autocomplete-search-result-list']`); + + getRowByRowName = (name: string): ElementFinder => $(`mat-list-item[data-automation-id='autocomplete_for_${name}']`); async pressDownArrowAndEnter(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.searchBar); - await this.searchBar.sendKeys(protractor.Key.ARROW_DOWN); + await BrowserActions.clearSendKeys(this.searchBar, protractor.Key.ARROW_DOWN); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); } @@ -80,20 +82,16 @@ export class SearchBarPage { await BrowserActions.click(this.getRowByRowName(fileName)); } - getRowByRowName(name: string): ElementFinder { - return element(by.css(`mat-list-item[data-automation-id='autocomplete_for_${name}']`)); - } - async getSpecificRowsHighlightName(fileName: string): Promise { - return BrowserActions.getText(this.getRowByRowName(fileName).element(this.highlightName)); + return BrowserActions.getText(this.getRowByRowName(fileName).$(this.highlightName)); } async getSpecificRowsCompleteName(fileName: string): Promise { - return BrowserActions.getText(this.getRowByRowName(fileName).element(this.completeName)); + return BrowserActions.getText(this.getRowByRowName(fileName).$(this.completeName)); } async getSpecificRowsAuthor(fileName: string): Promise { - return BrowserActions.getText(this.getRowByRowName(fileName).element(this.rowsAuthor)); + return BrowserActions.getText(this.getRowByRowName(fileName).$(this.rowsAuthor)); } async clearText(): Promise { diff --git a/e2e/search/pages/search-filters.page.ts b/e2e/search/pages/search-filters.page.ts index e875578112d..53fc6b74412 100644 --- a/e2e/search/pages/search-filters.page.ts +++ b/e2e/search/pages/search-filters.page.ts @@ -16,28 +16,28 @@ */ import { BrowserVisibility, DateRangeFilterPage, NumberRangeFilterPage, SearchCategoriesPage, SearchCheckListPage, SearchRadioPage, SearchSliderPage, SearchTextPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $, by } from 'protractor'; export class SearchFiltersPage { searchCategoriesPage: SearchCategoriesPage = new SearchCategoriesPage(); - searchFilters = element(by.css('adf-search-filter')); - fileTypeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]')); - creatorFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]')); - fileSizeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]')); - nameFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Name"]')); - checkListFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]')); - createdDateRangeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]')); - typeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type"]')); - sizeRangeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]')); - sizeSliderFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]')); - facetQueriesDefaultGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' + - 'mat-expansion-panel[data-automation-id="expansion-panel-My facet queries"]')); - facetQueriesTypeGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]')); - facetQueriesSizeGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]')); - facetIntervalsByCreated = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]')); - facetIntervalsByModified = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]')); + searchFilters = $('adf-search-filter'); + fileTypeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]'); + creatorFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]'); + fileSizeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]'); + nameFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Name"]'); + checkListFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]'); + createdDateRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]'); + typeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Type"]'); + sizeRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]'); + sizeSliderFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]'); + facetQueriesDefaultGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' + + 'mat-expansion-panel[data-automation-id="expansion-panel-My facet queries"]'); + facetQueriesTypeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]'); + facetQueriesSizeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]'); + facetIntervalsByCreated = $('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]'); + facetIntervalsByModified = $('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]'); async checkSearchFiltersIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.searchFilters); @@ -72,7 +72,7 @@ export class SearchFiltersPage { } async checkCustomFacetFieldLabelIsDisplayed(fieldLabel: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`))); + await BrowserVisibility.waitUntilElementIsVisible($(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`)); } sizeSliderFilterPage(): SearchSliderPage { diff --git a/e2e/search/pages/search-results.page.ts b/e2e/search/pages/search-results.page.ts index cbecc3d7d2b..b118fb3cbe5 100644 --- a/e2e/search/pages/search-results.page.ts +++ b/e2e/search/pages/search-results.page.ts @@ -16,12 +16,12 @@ */ import { BrowserVisibility, DataTableComponentPage, SearchSortingPickerPage } from '@alfresco/adf-testing'; -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { ContentServicesPage } from '../../core/pages/content-services.page'; export class SearchResultsPage { - noResultsMessage = element(by.css('.app-no-result-message')); + noResultsMessage = $('.app-no-result-message'); dataTable = new DataTableComponentPage(); searchSortingPicker = new SearchSortingPickerPage(); contentServices = new ContentServicesPage(); diff --git a/e2e/search/search-multiselect.e2e.ts b/e2e/search/search-multiselect.e2e.ts index f8822fdbdea..135031976ad 100644 --- a/e2e/search/search-multiselect.e2e.ts +++ b/e2e/search/search-multiselect.e2e.ts @@ -90,7 +90,7 @@ describe('Search Component - Multi-Select Facet', () => { afterAll(async () => { await apiService.loginWithProfile('admin'); - + const sitesApi = new SitesApi(apiService.getInstance()); await Promise.all([ uploadActions.deleteFileOrFolder(jpgFile.entry.id), uploadActions.deleteFileOrFolder(jpgFileSite.entry.id), @@ -214,7 +214,7 @@ describe('Search Component - Multi-Select Facet', () => { await usersActions.createUser(acsUser); await apiService.login(acsUser.username, acsUser.password); - + const sitesApi = new SitesApi(apiService.getInstance()); site = await sitesApi.createSite({ title: StringUtil.generateRandomString(8), visibility: 'PUBLIC' @@ -236,7 +236,7 @@ describe('Search Component - Multi-Select Facet', () => { afterAll(async () => { await apiService.loginWithProfile('admin'); await uploadActions.deleteFileOrFolder(txtFile.entry.id); - + const sitesApi = new SitesApi(apiService.getInstance()); await sitesApi.deleteSite(site.entry.id, { permanent: true }); }); diff --git a/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts b/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts index e478ca49588..5d89ad6d125 100644 --- a/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts +++ b/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $, by, element, $$ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; @@ -29,13 +29,17 @@ const column = { export class AddPermissionsDialogPage { dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage(); - userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage(element(by.css('[data-automation-id="adf-user-role-selection-table"]'))); + userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage($('[data-automation-id="adf-user-role-selection-table"]')); - addPermissionDialog = element(by.css('adf-add-permission-dialog')); - searchUserInput = element(by.id('searchInput')); - searchResults = element(by.css('#adf-add-permission-authority-results #adf-search-results-content')); - addButton = element(by.css('[data-automation-id="add-permission-dialog-confirm-button"]')); - closeButton = element(by.id('add-permission-dialog-close-button')); + addPermissionDialog = $('adf-add-permission-dialog'); + searchUserInput = $('#searchInput'); + searchResults = $('#adf-add-permission-authority-results #adf-search-results-content'); + addButton = $('[data-automation-id="add-permission-dialog-confirm-button"]'); + closeButton = $('#add-permission-dialog-close-button'); + + getRoleDropdownOptions() { + return $$('.mat-option-text'); + } async clickCloseButton(): Promise { await BrowserActions.click(this.closeButton); @@ -69,7 +73,7 @@ export class AddPermissionsDialogPage { } async checkPermissionsDatatableIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('[class*="adf-datatable-permission"]'))); + await BrowserVisibility.waitUntilElementIsVisible($('[class*="adf-datatable-permission"]')); } async getRoleCellValue(rowName: string): Promise { @@ -79,11 +83,7 @@ export class AddPermissionsDialogPage { async clickRoleDropdownByUserOrGroupName(name: string): Promise { const row = this.dataTableComponentPage.getRow('Users and Groups', name); - await BrowserActions.click(row.element(by.id('adf-select-role-permission'))); - } - - getRoleDropdownOptions() { - return element.all(by.css('.mat-option-text')); + await BrowserActions.click(row.$('adf-select-role-permission')); } async selectOption(name: string): Promise { @@ -105,7 +105,7 @@ export class AddPermissionsDialogPage { async selectRole(name: string, role: string) { const row = this.userRoleDataTableComponentPage.getRow('Users and Groups', name); - await BrowserActions.click(row.element(by.css('[id="adf-select-role-permission"] .mat-select-trigger'))); + await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger')); await TestElement.byCss('.mat-select-panel').waitVisible(); await this.selectOption(role); } diff --git a/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts b/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts index 350550525d4..c93836a80a8 100644 --- a/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts +++ b/lib/testing/src/lib/protractor/content-services/dialog/content-node-selector-dialog.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $, $$, by } from 'protractor'; import { DocumentListPage } from '../pages/document-list.page'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; @@ -27,22 +27,22 @@ import { UploadButtonPage } from '../pages/upload-button.page'; import { FileModel } from '../../core/models/file.model'; export class ContentNodeSelectorDialogPage { - dialog = element(by.css(`adf-content-node-selector`)); - header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`)); - searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`)); - searchLabel = this.dialog.element(by.css('.adf-content-node-selector-content-input .mat-form-field-label')); - selectedRow = this.dialog.element(by.css(`adf-datatable-row[class*="adf-is-selected"]`)); - cancelButton = element(by.css(`button[data-automation-id='content-node-selector-actions-cancel']`)); - moveCopyButton = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`)); + dialog = $(`adf-content-node-selector`); + header = this.dialog.$(`header[data-automation-id='content-node-selector-title']`); + searchInputElement = this.dialog.$(`input[data-automation-id='content-node-selector-search-input']`); + searchLabel = this.dialog.$('.adf-content-node-selector-content-input .mat-form-field-label'); + selectedRow = this.dialog.$(`adf-datatable-row[class*="adf-is-selected"]`); + cancelButton = $(`button[data-automation-id='content-node-selector-actions-cancel']`); + moveCopyButton = $(`button[data-automation-id='content-node-selector-actions-choose']`); contentList = new DocumentListPage(this.dialog); dataTable = this.contentList.dataTablePage(); - siteListDropdown = new DropdownPage(this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`))); + siteListDropdown = new DropdownPage(this.dialog.$(`mat-select[data-automation-id='site-my-files-option']`)); breadcrumbDropdown = new BreadcrumbDropdownPage(); tabPage: TabPage = new TabPage(); uploadButtonComponent = new UploadButtonPage(); - uploadFromLocalTab = element.all(by.css('*[role="tab"]')).get(1); + uploadFromLocalTab = $$('*[role="tab"]').get(1); uploadFromLocalTabName = 'Upload from your device'; repositoryTabName = 'Repository'; diff --git a/lib/testing/src/lib/protractor/content-services/dialog/download-dialog.page.ts b/lib/testing/src/lib/protractor/content-services/dialog/download-dialog.page.ts index 539a784d0bc..bdca71227a1 100644 --- a/lib/testing/src/lib/protractor/content-services/dialog/download-dialog.page.ts +++ b/lib/testing/src/lib/protractor/content-services/dialog/download-dialog.page.ts @@ -15,11 +15,11 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; export class DownloadDialogPage { - cancelButton = element(by.id(`cancel-button`)); + cancelButton = $(`#cancel-button`); async clickCancelButton(): Promise { await BrowserActions.click(this.cancelButton); diff --git a/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts b/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts index 1865a3fa473..ff898f54096 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/breadcrumb/breadcrumb-dropdown.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $, $$ } from 'protractor'; import { BrowserActions } from '../../../core/utils/browser-actions'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { DropdownPage } from '../../../core/pages/material/dropdown.page'; 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']`)); - currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`)); + breadCrumb = $(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`); + parentFolder = this.breadCrumb.$(`button[data-automation-id='dropdown-breadcrumb-trigger']`); + currentFolder = this.breadCrumb.$(`div span[data-automation-id="current-folder"]`); - breadCrumbDropdown = new DropdownPage(element.all(by.css(`div[class*='mat-select-panel']`)).first()); + breadCrumbDropdown = new DropdownPage($$(`div[class*='mat-select-panel']`).first()); async choosePath(pathName: string): Promise { await this.breadCrumbDropdown.selectOption(pathName); diff --git a/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts b/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts index 2f8ef81b3f8..cb5110219a5 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/document-list.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Locator, by, element, ElementFinder, browser } from 'protractor'; +import { by, ElementFinder, browser, $$ } from 'protractor'; import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; @@ -24,14 +24,14 @@ import { Logger } from '../../core/utils/logger'; export class DocumentListPage { rootElement: ElementFinder; - optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]'); + optionButton = 'button[data-automation-id*="action_menu_"]'; tableBody: ElementFinder; dataTable: DataTableComponentPage; - constructor(rootElement = element.all(by.css('adf-document-list')).first()) { + constructor(rootElement = $$('adf-document-list').first()) { this.rootElement = rootElement; this.dataTable = new DataTableComponentPage(this.rootElement); - this.tableBody = rootElement.all(by.css('.adf-datatable-body')).first(); + this.tableBody = rootElement.$$('.adf-datatable-body').first(); } async checkLockedIcon(content: string): Promise { @@ -70,7 +70,7 @@ export class DocumentListPage { Logger.log(`Click action menu ${content}`); await BrowserActions.closeMenuAndDialogs(); const row = this.dataTable.getRow('Display name', content); - await BrowserActions.click(row.element(this.optionButton)); + await BrowserActions.click(row.$(this.optionButton)); await BrowserActions.waitUntilActionMenuIsVisible(); await browser.sleep(500); } @@ -96,7 +96,7 @@ export class DocumentListPage { } async getLibraryRole(name: string): Promise { - return this.dataTable.getRow('Display name', name).element(by.css('adf-library-role-column')).getText(); + return this.dataTable.getRow('Display name', name).$('adf-library-role-column').getText(); } } diff --git a/lib/testing/src/lib/protractor/content-services/pages/like.page.ts b/lib/testing/src/lib/protractor/content-services/pages/like.page.ts index 1bb72cdccd3..9cd606a3b17 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/like.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/like.page.ts @@ -15,15 +15,15 @@ * limitations under the License. */ -import { browser, by, element } from 'protractor'; +import { $, browser } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; export class LikePage { - likeCounter = element(by.css(`div[id="adf-like-counter"]`)); - likeButton = element(by.css(`.adf-like-grey`)); - unlikeButton = element(by.css(`.adf-like-select`)); + likeCounter = $(`div[id="adf-like-counter"]`); + likeButton = $(`.adf-like-grey`); + unlikeButton = $(`.adf-like-select`); async checkLikeCounter(counter: number): Promise { await BrowserVisibility.waitUntilElementHasText(this.likeCounter, counter); diff --git a/lib/testing/src/lib/protractor/content-services/pages/rate.page.ts b/lib/testing/src/lib/protractor/content-services/pages/rate.page.ts index 8d5b76e9e7d..e093399844a 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/rate.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/rate.page.ts @@ -15,49 +15,52 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; export class RatePage { + private ratingsCounter = $(`div[id="adf-rating-counter"]`); + private coloredStar = async (rateValue: number) => $(`span[id="adf-rate-${rateValue}"] mat-icon`); + private greyStar = async (rateValue: number) => $(`mat-icon[id="adf-grey-star-${rateValue}"]`); + async rateComponent(rateValue: number) { - const unratedStar = element(by.css(`span[id="adf-rate-${rateValue}"]`)); + const unratedStar = await this.coloredStar(rateValue); await BrowserActions.click(unratedStar); } async removeRating(rateValue: number): Promise { - const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`)); + const ratedStar = await this.coloredStar(rateValue); await BrowserActions.click(ratedStar); } async checkRatingCounter(rating: number): Promise { - const ratingsCounter = element(by.css(`div[id="adf-rating-counter"]`)); - await BrowserVisibility.waitUntilElementHasText(ratingsCounter, rating); + await BrowserVisibility.waitUntilElementHasText(this.ratingsCounter, rating); } async isStarRated(rateValue: number): Promise { - const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`)); + const ratedStar = await this.coloredStar(rateValue); await BrowserVisibility.waitUntilElementIsVisible(ratedStar); } async isNotStarRated(rateValue: number): Promise { - const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`)); + const unratedStar = await this.greyStar(rateValue); await BrowserVisibility.waitUntilElementIsVisible(unratedStar); } async getRatedStarColor(rateValue: number): Promise { - const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`)); + const ratedStar = await this.coloredStar(rateValue); return BrowserActions.getColor(ratedStar); } async getUnratedStarColor(rateValue: number): Promise { - const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`)); + const unratedStar = await this.greyStar(rateValue); return BrowserActions.getColor(unratedStar); } async getAverageStarColor(rateValue: number): Promise { - const coloredStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`)); + const coloredStar = await this.coloredStar(rateValue); return BrowserActions.getColor(coloredStar); } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/date-range-filter.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/date-range-filter.page.ts index 377a5ad212c..c46afc4bba0 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/date-range-filter.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/date-range-filter.page.ts @@ -15,21 +15,21 @@ * limitations under the License. */ -import { by, protractor, ElementFinder, Locator, element } from 'protractor'; +import { protractor, ElementFinder, $ } from 'protractor'; import { DatePickerCalendarPage } from '../../../core/pages/material/date-picker-calendar.page'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { BrowserActions } from '../../../core/utils/browser-actions'; export class DateRangeFilterPage { - fromField: Locator = by.css('input[data-automation-id="date-range-from-input"]'); - fromDateToggle: Locator = by.css('mat-datepicker-toggle[data-automation-id="date-range-from-date-toggle"]'); - toField: Locator = by.css('input[data-automation-id="date-range-to-input"]'); - toDateToggle: Locator = by.css('mat-datepicker-toggle[data-automation-id="date-range-to-date-toggle"]'); - applyButton: Locator = by.css('button[data-automation-id="date-range-apply-btn"]'); - clearButton: Locator = by.css('button[data-automation-id="date-range-clear-btn"]'); - fromErrorMessage: Locator = by.css('mat-error[data-automation-id="date-range-from-error"]'); - toErrorMessage: Locator = by.css('mat-error[data-automation-id="date-range-to-error"]'); + fromField = 'input[data-automation-id="date-range-from-input"]'; + fromDateToggle = 'mat-datepicker-toggle[data-automation-id="date-range-from-date-toggle"]'; + toField = 'input[data-automation-id="date-range-to-input"]'; + toDateToggle = 'mat-datepicker-toggle[data-automation-id="date-range-to-date-toggle"]'; + applyButton = 'button[data-automation-id="date-range-apply-btn"]'; + clearButton = 'button[data-automation-id="date-range-clear-btn"]'; + fromErrorMessage = 'mat-error[data-automation-id="date-range-from-error"]'; + toErrorMessage = 'mat-error[data-automation-id="date-range-to-error"]'; filter: ElementFinder; constructor(filter: ElementFinder) { @@ -37,13 +37,13 @@ export class DateRangeFilterPage { } async getFromDate(): Promise { - return BrowserActions.getInputValue(this.filter.element(this.fromField)); + return BrowserActions.getInputValue(this.filter.$(this.fromField)); } async putFromDate(date): Promise { await this.checkFromFieldIsDisplayed(); - await BrowserActions.clearSendKeys(this.filter.element(this.fromField), date); - await this.filter.element(this.fromField).sendKeys(protractor.Key.ENTER); + await BrowserActions.clearSendKeys(this.filter.$(this.fromField), date); + await this.filter.$(this.fromField).sendKeys(protractor.Key.ENTER); } async getFromCalendarSelectedDate(): Promise { @@ -54,7 +54,7 @@ export class DateRangeFilterPage { } async openFromDatePicker(): Promise { - await BrowserActions.click(this.filter.element(this.fromDateToggle)); + await BrowserActions.click(this.filter.$(this.fromDateToggle)); const datePicker = new DatePickerCalendarPage(); await datePicker.checkDatePickerIsDisplayed(); @@ -62,82 +62,82 @@ export class DateRangeFilterPage { } async openToDatePicker(): Promise { - await BrowserActions.click(this.filter.element(this.toDateToggle)); + await BrowserActions.click(this.filter.$(this.toDateToggle)); const datePicker = new DatePickerCalendarPage(); await datePicker.checkDatePickerIsDisplayed(); return datePicker; } async clickFromField(): Promise { - await BrowserActions.click(this.filter.element(this.fromField)); + await BrowserActions.click(this.filter.$(this.fromField)); } async checkFromErrorMessageIsDisplayed(msg: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorMessage)); - const text = await BrowserActions.getText(this.filter.element(this.fromErrorMessage)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorMessage)); + const text = await BrowserActions.getText(this.filter.$(this.fromErrorMessage)); await expect(text).toEqual(msg); } async checkFromErrorMessageIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorMessage)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorMessage)); } async checkFromFieldIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromField)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromField)); } async checkFromDateToggleIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromDateToggle)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromDateToggle)); } async getToDate(): Promise { - return BrowserActions.getInputValue(this.filter.element(this.toField)); + return BrowserActions.getInputValue(this.filter.$(this.toField)); } async putToDate(date): Promise { await this.checkToFieldIsDisplayed(); - await BrowserActions.clearSendKeys(element(this.toField), date); - await this.filter.element(this.toField).sendKeys(protractor.Key.ENTER); + await BrowserActions.clearSendKeys($(this.toField), date); + await this.filter.$(this.toField).sendKeys(protractor.Key.ENTER); } async clickToField(): Promise { - await BrowserActions.click(this.filter.element(this.toField)); + await BrowserActions.click(this.filter.$(this.toField)); } async checkToErrorMessageIsDisplayed(msg): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorMessage)); - const text = await BrowserActions.getText(this.filter.element(this.toErrorMessage)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorMessage)); + const text = await BrowserActions.getText(this.filter.$(this.toErrorMessage)); await expect(text).toEqual(msg); } async checkToFieldIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toField)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toField)); } async checkToDateToggleIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toDateToggle)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toDateToggle)); } async clickApplyButton(): Promise { - await BrowserActions.click(this.filter.element(this.applyButton)); + await BrowserActions.click(this.filter.$(this.applyButton)); } async checkApplyButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.applyButton)); } async checkApplyButtonIsEnabled(): Promise { - const isEnabled = await this.filter.element(this.applyButton).isEnabled(); + const isEnabled = await this.filter.$(this.applyButton).isEnabled(); await expect(isEnabled).toBe(true); } async checkApplyButtonIsDisabled(): Promise { - const isEnabled = await this.filter.element(this.applyButton).isEnabled(); + const isEnabled = await this.filter.$(this.applyButton).isEnabled(); await expect(isEnabled).toBe(false); } async checkClearButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton)); } } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/number-range-filter.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/number-range-filter.page.ts index 1eff602ec2c..628553a9788 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/number-range-filter.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/number-range-filter.page.ts @@ -14,20 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { by, ElementFinder, Locator, protractor } from 'protractor'; +import { ElementFinder, protractor } from 'protractor'; import { BrowserActions } from '../../../core/utils/browser-actions'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; export class NumberRangeFilterPage { - fromInput: Locator = by.css('input[data-automation-id="number-range-from-input"]'); - toInput: Locator = by.css('input[data-automation-id="number-range-to-input"]'); - applyButton: Locator = by.css('button[data-automation-id="number-range-btn-apply"]'); - clearButton: Locator = by.css('button[data-automation-id="number-range-btn-clear"]'); - fromErrorInvalid: Locator = by.css('mat-error[data-automation-id="number-range-from-error-invalid"]'); - fromErrorRequired: Locator = by.css('mat-error[data-automation-id="number-range-from-error-required"]'); - toErrorInvalid: Locator = by.css('mat-error[data-automation-id="number-range-to-error-invalid"]'); - toErrorRequired: Locator = by.css('mat-error[data-automation-id="number-range-to-error-required"]'); + fromInput = 'input[data-automation-id="number-range-from-input"]'; + toInput = 'input[data-automation-id="number-range-to-input"]'; + applyButton = 'button[data-automation-id="number-range-btn-apply"]'; + clearButton = 'button[data-automation-id="number-range-btn-clear"]'; + fromErrorInvalid = 'mat-error[data-automation-id="number-range-from-error-invalid"]'; + fromErrorRequired = 'mat-error[data-automation-id="number-range-from-error-required"]'; + toErrorInvalid = 'mat-error[data-automation-id="number-range-to-error-invalid"]'; + toErrorRequired = 'mat-error[data-automation-id="number-range-to-error-required"]'; filter: ElementFinder; constructor(filter: ElementFinder) { @@ -35,99 +35,99 @@ export class NumberRangeFilterPage { } async clearFromField(): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromInput)); - await BrowserActions.clearWithBackSpace(this.filter.element(this.fromInput)); + await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.fromInput)); + await BrowserActions.clearWithBackSpace(this.filter.$(this.fromInput)); } async getFromNumber(): Promise { - return BrowserActions.getInputValue(this.filter.element(this.fromInput)); + return BrowserActions.getInputValue(this.filter.$(this.fromInput)); } async putFromNumber(value): Promise { await this.checkFromFieldIsDisplayed(); - await BrowserActions.clearSendKeys(this.filter.element(this.fromInput), value); - await this.filter.element(this.fromInput).sendKeys(protractor.Key.ENTER); + await BrowserActions.clearSendKeys(this.filter.$(this.fromInput), value); + await this.filter.$(this.fromInput).sendKeys(protractor.Key.ENTER); } async getFromErrorRequired(): Promise { - return BrowserActions.getText(this.filter.element(this.fromErrorRequired)); + return BrowserActions.getText(this.filter.$(this.fromErrorRequired)); } async checkFromErrorRequiredIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorRequired)); } async getFromErrorInvalid(): Promise { - return BrowserActions.getText(this.filter.element(this.fromErrorInvalid)); + return BrowserActions.getText(this.filter.$(this.fromErrorInvalid)); } async checkFromErrorInvalidIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorInvalid)); } async checkFromFieldIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromInput)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromInput)); } async clearToField(): Promise { - await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toInput)); - await BrowserActions.clearWithBackSpace(this.filter.element(this.toInput)); + await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.toInput)); + await BrowserActions.clearWithBackSpace(this.filter.$(this.toInput)); } async getToNumber(): Promise { - return BrowserActions.getInputValue(this.filter.element(this.toInput)); + return BrowserActions.getInputValue(this.filter.$(this.toInput)); } async putToNumber(value): Promise { await this.checkToFieldIsDisplayed(); - await BrowserActions.clearSendKeys(this.filter.element(this.toInput), value); - await this.filter.element(this.toInput).sendKeys(protractor.Key.ENTER); + await BrowserActions.clearSendKeys(this.filter.$(this.toInput), value); + await this.filter.$(this.toInput).sendKeys(protractor.Key.ENTER); } async getToErrorRequired(): Promise { - return BrowserActions.getText(this.filter.element(this.toErrorRequired)); + return BrowserActions.getText(this.filter.$(this.toErrorRequired)); } async checkToErrorRequiredIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorRequired)); } async getToErrorInvalid(): Promise { - return BrowserActions.getText(this.filter.element(this.toErrorInvalid)); + return BrowserActions.getText(this.filter.$(this.toErrorInvalid)); } async checkToErrorInvalidIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorInvalid)); } async checkToFieldIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toInput)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toInput)); } async clickApplyButton(): Promise { - await BrowserActions.click(this.filter.element(this.applyButton)); + await BrowserActions.click(this.filter.$(this.applyButton)); } async checkApplyButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.applyButton)); } async checkApplyButtonIsEnabled(): Promise { - return this.filter.element(this.applyButton).isEnabled(); + return this.filter.$(this.applyButton).isEnabled(); } async clickClearButton(): Promise { - await BrowserActions.click(this.filter.element(this.clearButton)); + await BrowserActions.click(this.filter.$(this.clearButton)); } async checkClearButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton)); } async checkNoErrorMessageIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorInvalid)); - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorRequired)); - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorInvalid)); - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorRequired)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorInvalid)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorRequired)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorInvalid)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorRequired)); } } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/search-categories.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/search-categories.page.ts index 1a0ba56fac9..7cb3c6d98de 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/search-categories.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/search-categories.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, ElementFinder } from 'protractor'; +import { ElementFinder } from 'protractor'; import { SearchTextPage } from './search-text.page'; import { SearchCheckListPage } from './search-check-list.page'; import { SearchRadioPage } from './search-radio.page'; @@ -56,11 +56,11 @@ export class SearchCategoriesPage { } async clickFilter(filter: ElementFinder): Promise { - await BrowserActions.click(filter.element(by.css('mat-expansion-panel-header'))); + await BrowserActions.click(filter.$('mat-expansion-panel-header')); } async clickFilterHeader(filter: ElementFinder): Promise { - const fileSizeFilterHeader = filter.element(by.css('mat-expansion-panel-header')); + const fileSizeFilterHeader = filter.$('mat-expansion-panel-header'); await BrowserActions.click(fileSizeFilterHeader); } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/search-check-list.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/search-check-list.page.ts index 97b92cfaca1..0db642e3bc0 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/search-check-list.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/search-check-list.page.ts @@ -15,17 +15,17 @@ * limitations under the License. */ -import { Locator, element, by, ElementFinder, browser } from 'protractor'; +import { element, by, ElementFinder, browser } from 'protractor'; import { BrowserActions } from '../../../core/utils/browser-actions'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; export class SearchCheckListPage { filter: ElementFinder; - inputBy: Locator = by.css('div[class*="mat-expansion-panel-content"] input'); - showMoreBy: Locator = by.css('button[title="Show more"]'); - showLessBy: Locator = by.css('button[title="Show less"]'); - clearAllButton: Locator = by.css('button'); + inputBy = 'div[class*="mat-expansion-panel-content"] input'; + showMoreBy = 'button[title="Show more"]'; + showLessBy = 'button[title="Show less"]'; + clearAllButton = 'button'; constructor(filter: ElementFinder) { this.filter = filter; @@ -33,20 +33,20 @@ export class SearchCheckListPage { async clickCheckListOption(option: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const result = this.filter.all(by.css(`mat-checkbox[data-automation-id*='${option}'] .mat-checkbox-inner-container`)).first(); + const result = this.filter.$$(`mat-checkbox[data-automation-id*='${option}'] .mat-checkbox-inner-container`).first(); await BrowserActions.click(result); } async checkChipIsDisplayed(option: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon'))); + await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).$('mat-icon')); } async checkChipIsNotDisplayed(option: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon'))); + await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip', option)).$('mat-icon')); } async removeFilterOption(option: string): Promise { - const cancelChipButton = element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')); + const cancelChipButton = element(by.cssContainingText('mat-chip', option)).$('mat-icon'); await BrowserActions.click(cancelChipButton); } @@ -59,50 +59,50 @@ export class SearchCheckListPage { } async checkSearchFilterInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.all(this.inputBy).first()); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$$(this.inputBy).first()); } async searchInFilter(option: string): Promise { await BrowserVisibility.waitUntilElementIsClickable(this.filter); - const inputElement = this.filter.all(this.inputBy).first(); + const inputElement = this.filter.$$(this.inputBy).first(); await BrowserVisibility.waitUntilElementIsClickable(inputElement); await BrowserActions.clearSendKeys(inputElement, option); } async checkShowLessButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showLessBy)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showLessBy)); } async checkShowLessButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showLessBy)); } async checkShowMoreButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showMoreBy)); } async checkShowMoreButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showMoreBy)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showMoreBy)); } async clickShowMoreButtonUntilIsNotDisplayed(): Promise { - const visible = await browser.isElementPresent(this.filter.element(this.showMoreBy)); + const visible = await browser.isElementPresent(this.filter.$(this.showMoreBy)); if (visible) { - await BrowserActions.click(this.filter.element(this.showMoreBy)); + await BrowserActions.click(this.filter.$(this.showMoreBy)); await this.clickShowMoreButtonUntilIsNotDisplayed(); } } async clickShowLessButtonUntilIsNotDisplayed(): Promise { - const visible = await browser.isElementPresent(this.filter.element(this.showLessBy)); + const visible = await browser.isElementPresent(this.filter.$(this.showLessBy)); if (visible) { - await BrowserActions.click(this.filter.element(this.showLessBy)); + await BrowserActions.click(this.filter.$(this.showLessBy)); await this.clickShowLessButtonUntilIsNotDisplayed(); } } async getBucketNumberOfFilterType(option: string): Promise { - const fileTypeFilter = this.filter.all(by.css('mat-checkbox[data-automation-id*=".' + option + '"] span')).first(); + const fileTypeFilter = this.filter.$$('mat-checkbox[data-automation-id*=".' + option + '"] span').first(); await BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter); const valueOfBucket = await BrowserActions.getText(fileTypeFilter); const numberOfBucket = valueOfBucket.split('(')[1]; @@ -112,47 +112,47 @@ export class SearchCheckListPage { async checkCheckListOptionIsDisplayed(option: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}']`)); + const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}']`); await BrowserVisibility.waitUntilElementIsVisible(result); } async checkCheckListOptionIsNotSelected(option: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`)); + const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`); await BrowserVisibility.waitUntilElementIsNotVisible(result); } async checkCheckListOptionIsSelected(option: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`)); + const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`); await BrowserVisibility.waitUntilElementIsVisible(result); } async checkClearAllButtonIsDisplayed() { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const result = this.filter.element(this.clearAllButton); + const result = this.filter.$(this.clearAllButton); await BrowserVisibility.waitUntilElementIsVisible(result); } async clickClearAllButton(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const result = this.filter.element(this.clearAllButton); + const result = this.filter.$(this.clearAllButton); await BrowserActions.click(result); } async getCheckListOptionsNumberOnPage(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - const checkListOptions = this.filter.all(by.css('.checklist mat-checkbox')); + const checkListOptions = this.filter.$$('.checklist mat-checkbox'); return checkListOptions.count(); } async clickShowMoreButton(): Promise { - await BrowserActions.click(this.filter.element(this.showMoreBy)); + await BrowserActions.click(this.filter.$(this.showMoreBy)); } async clickShowLessButton(): Promise { - await BrowserActions.click(this.filter.element(this.showLessBy)); + await BrowserActions.click(this.filter.$(this.showLessBy)); } } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/search-radio.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/search-radio.page.ts index 0ad873aa064..37c90c46013 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/search-radio.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/search-radio.page.ts @@ -15,27 +15,27 @@ * limitations under the License. */ -import { element, by, browser, ElementFinder } from 'protractor'; +import { browser, ElementFinder, $, $$ } from 'protractor'; import { BrowserActions } from '../../../core/utils/browser-actions'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; export class SearchRadioPage { filter: ElementFinder; - showMoreButton = element(by.css('adf-search-radio button[title="Show more"]')); - showLessButton = element(by.css('adf-search-radio button[title="Show less"]')); + showMoreButton = $('adf-search-radio button[title="Show more"]'); + showLessButton = $('adf-search-radio button[title="Show less"]'); constructor(filter: ElementFinder) { this.filter = filter; } async checkFilterRadioButtonIsDisplayed(filterName: string): Promise { - const filterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"]')); + const filterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"]`); await BrowserVisibility.waitUntilElementIsVisible(filterType); } async checkFilterRadioButtonIsChecked(filterName: string): Promise { - const selectedFilterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"][class*="checked"]')); + const selectedFilterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"][class*="checked"]`); await BrowserVisibility.waitUntilElementIsVisible(selectedFilterType); } @@ -44,7 +44,7 @@ export class SearchRadioPage { } async getRadioButtonsNumberOnPage(): Promise { - const radioButtons = element.all(by.css('mat-radio-button')); + const radioButtons = $$('mat-radio-button'); return radioButtons.count(); } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/search-slider.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/search-slider.page.ts index 40b4bb66738..4b913054332 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/search-slider.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/search-slider.page.ts @@ -15,64 +15,64 @@ * limitations under the License. */ -import { Locator, browser, by, ElementFinder } from 'protractor'; +import { browser, ElementFinder } from 'protractor'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { BrowserActions } from '../../../core/utils/browser-actions'; export class SearchSliderPage { filter: ElementFinder; - slider: Locator = by.css('mat-slider[data-automation-id="slider-range"]'); - clearButton: Locator = by.css('button[data-automation-id="slider-btn-clear"]'); - sliderWithThumbLabel: Locator = by.css('mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]'); + slider = 'mat-slider[data-automation-id="slider-range"]'; + clearButton = 'button[data-automation-id="slider-btn-clear"]'; + sliderWithThumbLabel = 'mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]'; constructor(filter: ElementFinder) { this.filter = filter; } async getMaxValue() { - return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuemax'); + return BrowserActions.getAttribute(this.filter.$(this.slider), 'aria-valuemax'); } async getMinValue() { - return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuemin'); + return BrowserActions.getAttribute(this.filter.$(this.slider), 'aria-valuemin'); } async getValue() { - return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuenow'); + return BrowserActions.getAttribute(this.filter.$(this.slider), 'aria-valuenow'); } async setValue(value: number): Promise { - const elem = this.filter.element(this.slider).element(by.css('.mat-slider-wrapper')); + const elem = this.filter.$(this.slider).$('.mat-slider-wrapper'); await browser.actions().mouseMove(elem, { x: 0, y: 0 }).perform(); await browser.actions().mouseDown().mouseMove({x: value * 10, y: 0}).mouseUp().perform(); } async checkSliderIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.slider)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.slider)); } async checkSliderIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.slider)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.slider)); } async checkSliderWithThumbLabelIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.sliderWithThumbLabel)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.sliderWithThumbLabel)); } async clickClearButton(): Promise { - await BrowserActions.click(this.filter.element(this.clearButton)); + await BrowserActions.click(this.filter.$(this.clearButton)); } async checkClearButtonIsEnabled() { - return this.filter.element(this.clearButton).isEnabled(); + return this.filter.$(this.clearButton).isEnabled(); } async checkClearButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton)); + await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton)); } async checkClearButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.clearButton)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.clearButton)); } } diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/search-sorting-picker.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/search-sorting-picker.page.ts index 7351de053bf..2436c7e9b81 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/search-sorting-picker.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/search-sorting-picker.page.ts @@ -15,15 +15,15 @@ * limitations under the License. */ -import { browser, by, element } from 'protractor'; +import { $, browser, by, element } from 'protractor'; import { BrowserActions } from '../../../core/utils/browser-actions'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { DropdownPage } from '../../../core/pages/material/dropdown.page'; export class SearchSortingPickerPage { - sortingDropdown = new DropdownPage(element(by.css('.adf-sorting-picker .mat-select-arrow'))); - orderArrow = element(by.css('adf-sorting-picker button mat-icon')); + sortingDropdown = new DropdownPage($('.adf-sorting-picker .mat-select-arrow')); + orderArrow = $('adf-sorting-picker button mat-icon'); async sortBy(sortOrder: string, sortType: string | RegExp): Promise { await this.sortingDropdown.clickDropdown(); diff --git a/lib/testing/src/lib/protractor/content-services/pages/search/search-text.page.ts b/lib/testing/src/lib/protractor/content-services/pages/search/search-text.page.ts index 9920fb78c2d..1810278d0f2 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/search/search-text.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/search/search-text.page.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -import { protractor, by, ElementFinder, Locator } from 'protractor'; +import { protractor, ElementFinder } from 'protractor'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { BrowserActions } from '../../../core/utils/browser-actions'; export class SearchTextPage { filter: ElementFinder; - inputBy: Locator = by.css('input'); + inputBy = 'input'; constructor(filter: ElementFinder) { this.filter = filter; @@ -30,7 +30,7 @@ export class SearchTextPage { async searchByName(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.filter); - await BrowserActions.clearSendKeys(this.filter.element(this.inputBy), name); - await this.filter.element(this.inputBy).sendKeys(protractor.Key.ENTER); + await BrowserActions.clearSendKeys(this.filter.$(this.inputBy), name); + await this.filter.$(this.inputBy).sendKeys(protractor.Key.ENTER); } } diff --git a/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts b/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts index b5c0d892bbe..136b9753336 100644 --- a/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts +++ b/lib/testing/src/lib/protractor/content-services/pages/upload-button.page.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { FileModel } from '../../core/models/file.model'; export class UploadButtonPage { - uploadButton = element(by.css('adf-upload-button input')); + uploadButton = $('adf-upload-button input'); async attachFiles(files: FileModel[]): Promise { await BrowserVisibility.waitUntilElementIsPresent(this.uploadButton); @@ -31,11 +31,13 @@ export class UploadButtonPage { } async isButtonNotDisplayed(): Promise { + let result = false; + try { await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadButton); - return true; - } catch (e) { - return false; - } + result = true; + } catch (e) { /* do nothing */ } + + return result; } } diff --git a/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts b/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts index 4730f25495c..c3042f6a24a 100644 --- a/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts +++ b/lib/testing/src/lib/protractor/core/dialog/edit-json-dialog.ts @@ -15,15 +15,15 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $, by, element } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; export class EditJsonDialog { - dialog = element(by.css(`.adf-edit-json-dialog`)); + dialog = $(`.adf-edit-json-dialog`); closeButton = element(by.cssContainingText(`button span`, 'Close')); - dialogContent = this.dialog.element(by.css(`mat-dialog-content textarea`)); + dialogContent = this.dialog.$(`mat-dialog-content textarea`); async checkDialogIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.dialog); diff --git a/lib/testing/src/lib/protractor/core/pages/about.page.ts b/lib/testing/src/lib/protractor/core/pages/about.page.ts index 55f92e05814..3a56be62c01 100644 --- a/lib/testing/src/lib/protractor/core/pages/about.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/about.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { DataTableComponentPage } from './data-table-component.page'; @@ -47,21 +47,21 @@ export class AboutPage { version: 'version' }; - appTitle = element(by.css('[data-automation-id="adf-github-app-title"]')); - sourceCodeTitle = element(by.css('[data-automation-id="adf-github-source-code-title"]')); - githubUrl = element(by.css('[data-automation-id="adf-github-url"]')); - githubVersion = element(by.css('[data-automation-id="adf-github-version"]')); - bpmHost = element(by.css('[data-automation-id="adf-process-service-host"]')); - ecmHost = element(by.css('[data-automation-id="adf-content-service-host"]')); - productVersionTitle = element(by.css('[data-automation-id="adf-about-product-version-title"]')); - bpmEdition = element(by.css('[data-automation-id="adf-about-bpm-edition"]')); - ecmEdition = element(by.css('[data-automation-id="adf-about-ecm-edition"]')); - bpmVersion = element(by.css('[data-automation-id="adf-about-bpm-version"]')); - ecmVersion = element(by.css('[data-automation-id="adf-about-ecm-version"]')); - ecmStatusTitle = element(by.css('[data-automation-id="adf-about-ecm-status-title"]')); - ecmLicenseTitle = element(by.css('[data-automation-id="adf-about-ecm-license-title"]')); - ecmModulesTitle = element(by.css('[data-automation-id="adf-about-ecm-modules-title"]')); - aboutModulesTitle = element(by.css('[data-automation-id="adf-about-modules-title"]')); + appTitle = $('[data-automation-id="adf-github-app-title"]'); + sourceCodeTitle = $('[data-automation-id="adf-github-source-code-title"]'); + githubUrl = $('[data-automation-id="adf-github-url"]'); + githubVersion = $('[data-automation-id="adf-github-version"]'); + bpmHost = $('[data-automation-id="adf-process-service-host"]'); + ecmHost = $('[data-automation-id="adf-content-service-host"]'); + productVersionTitle = $('[data-automation-id="adf-about-product-version-title"]'); + bpmEdition = $('[data-automation-id="adf-about-bpm-edition"]'); + ecmEdition = $('[data-automation-id="adf-about-ecm-edition"]'); + bpmVersion = $('[data-automation-id="adf-about-bpm-version"]'); + ecmVersion = $('[data-automation-id="adf-about-ecm-version"]'); + ecmStatusTitle = $('[data-automation-id="adf-about-ecm-status-title"]'); + ecmLicenseTitle = $('[data-automation-id="adf-about-ecm-license-title"]'); + ecmModulesTitle = $('[data-automation-id="adf-about-ecm-modules-title"]'); + aboutModulesTitle = $('[data-automation-id="adf-about-modules-title"]'); dataTable = new DataTableComponentPage(); @@ -158,7 +158,7 @@ export class AboutPage { } async checkColumnIsDisplayed(column: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_${column}"]`))); + await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_${column}"]`)); } } diff --git a/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts b/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts index 50a8532a885..769a3bfd4c5 100644 --- a/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/bread-crumb.page.ts @@ -15,16 +15,16 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '../utils/browser-actions'; export class BreadcrumbPage { - breadcrumb = element(by.css(`adf-breadcrumb nav[data-automation-id='breadcrumb']`)); - currentItem = element(by.css('.adf-breadcrumb-item-current')); + breadcrumb = $(`adf-breadcrumb nav[data-automation-id='breadcrumb']`); + currentItem = $('.adf-breadcrumb-item-current'); async chooseBreadCrumb(breadCrumbItem: string): Promise { - const path = this.breadcrumb.element(by.css(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`)); + const path = this.breadcrumb.$(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`); await BrowserActions.click(path); } diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts index 40e1b4c96f6..f74ff7348ca 100644 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-boolean-item.page.ts @@ -15,25 +15,25 @@ * limitations under the License. */ -import { element, by, ElementFinder, Locator } from 'protractor'; +import { element, by, ElementFinder } from 'protractor'; import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; export class CardBooleanItemPage { rootElement: ElementFinder; - labelLocator: Locator = by.css('div[data-automation-id*="card-boolean-label"]'); - checkbox: Locator = by.css('mat-checkbox[data-automation-id*="card-boolean"]'); + labelLocator = 'div[data-automation-id*="card-boolean-label"]'; + checkbox = 'mat-checkbox[data-automation-id*="card-boolean"]'; constructor(label: string = 'required') { this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-boolitem`)); } async checkboxClick(): Promise { - await BrowserActions.click(this.rootElement.element(this.checkbox)); + await BrowserActions.click(this.rootElement.$(this.checkbox)); } async checkLabelIsPresent(): Promise { - const labelElement = this.rootElement.element(this.labelLocator); + const labelElement = this.rootElement.$(this.labelLocator); await BrowserVisibility.waitUntilElementIsPresent(labelElement); } } diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts index d832ed4e42c..8a9328a22cc 100644 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-date-item.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Locator, element, by, ElementFinder } from 'protractor'; +import { element, by, ElementFinder, $$ } from 'protractor'; import { DateTimePickerPage } from '../material/date-time-picker.page'; import { DatePickerPage } from '../material/date-picker.page'; import { BrowserVisibility } from '../../utils/browser-visibility'; @@ -26,10 +26,10 @@ export class CardDateItemPage { dateTimePickerPage: DateTimePickerPage; datePickerPage = new DatePickerPage(); - labelLocator: Locator = by.css('div[data-automation-id*="card-dateitem-label"]'); - valueLocator: Locator = by.css('span[data-automation-id*="card-date"]'); - dateTimePicker = element.all(by.css('.mat-datetimepicker-toggle')).first(); - saveButton: Locator = by.css('button[data-automation-id*="card-dateitem-update"]'); + labelLocator = 'div[data-automation-id*="card-dateitem-label"]'; + valueLocator = 'span[data-automation-id*="card-date"]'; + dateTimePicker = $$('.mat-datetimepicker-toggle').first(); + saveButton = 'button[data-automation-id*="card-dateitem-update"]'; constructor(label: string = 'minDate') { this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-dateitem`)); @@ -45,11 +45,11 @@ export class CardDateItemPage { } async getDateValue(): Promise { - return this.rootElement.element(this.valueLocator).getText(); + return this.rootElement.$(this.valueLocator).getText(); } async checkLabelIsVisible(): Promise { - const labelElement = this.rootElement.element(this.labelLocator); + const labelElement = this.rootElement.$(this.labelLocator); await BrowserVisibility.waitUntilElementIsVisible(labelElement); } } diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts index 4a25b6d2b85..45828192e52 100644 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-select-item.page.ts @@ -15,24 +15,24 @@ * limitations under the License. */ -import { element, by, ElementFinder, Locator } from 'protractor'; +import { element, by, ElementFinder } from 'protractor'; import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; import { DropdownPage } from '../material/dropdown.page'; export class CardSelectItemPage { rootElement: ElementFinder; - labelLocator: Locator = by.css('div[data-automation-id*="card-select-label"]'); - readOnlyField: Locator = by.css('[data-automation-class="read-only-value"]'); + labelLocator = 'div[data-automation-id*="card-select-label"]'; + readOnlyField = '[data-automation-class="read-only-value"]'; dropdown: DropdownPage; constructor(label: string = 'fileSource') { this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-selectitem`)); - this.dropdown = new DropdownPage(this.rootElement.element(by.css('mat-select'))); + this.dropdown = new DropdownPage(this.rootElement.$('mat-select')); } async checkLabelIsPresent(): Promise { - const labelElement = this.rootElement.element(this.labelLocator); + const labelElement = this.rootElement.$(this.labelLocator); await BrowserVisibility.waitUntilElementIsPresent(labelElement); } @@ -41,8 +41,8 @@ export class CardSelectItemPage { } async getReadonlyValue(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField)); - return BrowserActions.getText(this.rootElement.element(this.readOnlyField)); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField)); + return BrowserActions.getText(this.rootElement.$(this.readOnlyField)); } async selectDropdownOption(option: string): Promise { @@ -50,6 +50,6 @@ export class CardSelectItemPage { } async checkElementIsReadonly(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField)); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField)); } } diff --git a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts index 69eef105c29..ee3bed158c1 100644 --- a/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/card-view/card-view-text-item.page.ts @@ -15,63 +15,63 @@ * limitations under the License. */ -import { Locator, element, by, ElementFinder, Key } from 'protractor'; +import { element, by, ElementFinder, Key } from 'protractor'; import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; export class CardTextItemPage { rootElement: ElementFinder; - textField: Locator = by.css('[data-automation-id*="card-textitem-value"]'); - saveButton: Locator = by.css('button[data-automation-id*="card-textitem-update"]'); - clearButton: Locator = by.css('button[data-automation-id*="card-textitem-reset"]'); - field: Locator = by.css('[data-automation-id*="card-textitem-value"]'); - labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]'); - errorMessage: Locator = by.css('.adf-textitem-editable-error'); - clickableElement: Locator = by.css('.adf-textitem-clickable'); - readOnlyField: Locator = by.css('.adf-property-read-only'); + textField = '[data-automation-id*="card-textitem-value"]'; + saveButton = 'button[data-automation-id*="card-textitem-update"]'; + clearButton = 'button[data-automation-id*="card-textitem-reset"]'; + field = '[data-automation-id*="card-textitem-value"]'; + labelLocator = 'div[data-automation-id*="card-textitem-label"]'; + errorMessage = '.adf-textitem-editable-error'; + clickableElement = '.adf-textitem-clickable'; + readOnlyField = '.adf-property-read-only'; constructor(label: string = 'assignee') { this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "card-textitem-label-${label}")]//ancestor::adf-card-view-textitem`)); } async getFieldValue(): Promise { - const fieldElement = this.rootElement.element(this.field); + const fieldElement = this.rootElement.$(this.field); return BrowserActions.getInputValue(fieldElement); } async checkLabelIsPresent(): Promise { - const labelElement = this.rootElement.element(this.labelLocator); + const labelElement = this.rootElement.$(this.labelLocator); await BrowserVisibility.waitUntilElementIsPresent(labelElement); } async checkLabelIsVisible(): Promise { - const labelElement = this.rootElement.element(this.labelLocator); + const labelElement = this.rootElement.$(this.labelLocator); await BrowserVisibility.waitUntilElementIsVisible(labelElement); } async enterTextField(text: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField)); - await BrowserActions.clearSendKeys(this.rootElement.element(this.textField), text, 500); - await this.rootElement.element(this.textField).sendKeys(Key.TAB); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.textField)); + await BrowserActions.clearSendKeys(this.rootElement.$(this.textField), text, 500); + await this.rootElement.$(this.textField).sendKeys(Key.TAB); } async clickOnSaveButton(): Promise { - await BrowserActions.click(this.rootElement.element(this.saveButton)); + await BrowserActions.click(this.rootElement.$(this.saveButton)); } async clickOnClearButton(): Promise { - await BrowserActions.click(this.rootElement.element(this.clearButton)); + await BrowserActions.click(this.rootElement.$(this.clearButton)); } async getErrorMessage(): Promise { - const errorField = this.rootElement.element(this.errorMessage); + const errorField = this.rootElement.$(this.errorMessage); return BrowserActions.getText(errorField); } async checkElementIsReadonly(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField)); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField)); } async clickField(): Promise { - await BrowserActions.click(this.rootElement.element(by.css(`button[data-automation-id*='clickable-icon']`))); + await BrowserActions.click(this.rootElement.$(`button[data-automation-id*='clickable-icon']`)); } } diff --git a/lib/testing/src/lib/protractor/core/pages/config-editor-page.ts b/lib/testing/src/lib/protractor/core/pages/config-editor-page.ts index 32ea64b4596..2a40ffbe321 100644 --- a/lib/testing/src/lib/protractor/core/pages/config-editor-page.ts +++ b/lib/testing/src/lib/protractor/core/pages/config-editor-page.ts @@ -15,26 +15,26 @@ * limitations under the License. */ -import { element, by, browser } from 'protractor'; +import { browser, $ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; export class ConfigEditorPage { - textField = element(by.css('#adf-form-config-editor div.overflow-guard > textarea')); + textField = $('#adf-form-config-editor div.overflow-guard > textarea'); async enterConfiguration(text: string): Promise { await BrowserActions.clearSendKeys(this.textField, text); } async clickSaveButton(): Promise { - const saveButton = element(by.id('app-form-config-save')); + const saveButton = $('#app-form-config-save'); await BrowserActions.click(saveButton); } async clickClearButton(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.textField); - const clearButton = element(by.id('app-form-config-clear')); + const clearButton = $('#app-form-config-clear'); await BrowserActions.click(clearButton); } diff --git a/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts b/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts index 1b2024cd422..f2865d57857 100644 --- a/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/context-menu.page.ts @@ -15,12 +15,12 @@ * limitations under the License. */ +import { $ } from 'protractor'; import { BrowserActions } from '../utils/browser-actions'; -import { element, by } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; export class ContextMenuPage { - contextMenu = element(by.id('adf-context-menu-content')); + contextMenu = $('#adf-context-menu-content'); async isContextMenuDisplayed(): Promise { try { @@ -32,6 +32,6 @@ export class ContextMenuPage { } async clickContextMenuActionNamed(actionName: string): Promise { - await BrowserActions.click(element(by.css(`button[data-automation-id="context-${actionName}"]`))); + await BrowserActions.click($(`button[data-automation-id="context-${actionName}"]`)); } } diff --git a/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts b/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts index b844b356331..010977e4dcd 100644 --- a/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/data-table-component.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Locator, browser, by, element, protractor, ElementFinder, ElementArrayFinder } from 'protractor'; +import { browser, by, element, protractor, ElementFinder, ElementArrayFinder, $, $$ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; import { Logger } from '../utils/logger'; @@ -26,7 +26,6 @@ export class DataTableComponentPage { list: ElementArrayFinder; contents: ElementArrayFinder; tableBody: ElementFinder; - rows: Locator = by.css(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`); allColumns: ElementArrayFinder; selectedRowNumber: ElementFinder; allSelectedRows: ElementArrayFinder; @@ -36,21 +35,27 @@ export class DataTableComponentPage { emptyListTitle: ElementFinder; emptyListSubtitle: ElementFinder; + rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`; + MAX_LOADING_TIME = 120000; - constructor(rootElement = element.all(by.css('adf-datatable')).first()) { + constructor(rootElement = $$('adf-datatable').first()) { this.rootElement = rootElement; - this.list = this.rootElement.all(by.css(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`)); - this.contents = this.rootElement.all(by.css('.adf-datatable-body span')); - this.tableBody = this.rootElement.all(by.css(`.adf-datatable-body`)).first(); - this.allColumns = this.rootElement.all(by.css('div[data-automation-id*="auto_id_entry."]')); - this.selectedRowNumber = this.rootElement.element(by.css(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`)); - this.allSelectedRows = this.rootElement.all(by.css(`adf-datatable-row[class*='is-selected']`)); - this.selectAll = this.rootElement.element(by.css(`div[class*='adf-datatable-header'] mat-checkbox`)); - this.copyColumnTooltip = this.rootElement.element(by.css(`adf-copy-content-tooltip span`)); - this.emptyList = this.rootElement.element(by.css(`adf-empty-content`)); - this.emptyListTitle = this.rootElement.element(by.css(`.adf-empty-content__title`)); - this.emptyListSubtitle = this.rootElement.element(by.css(`.adf-empty-content__subtitle`)); + this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`); + this.contents = this.rootElement.$$('.adf-datatable-body span'); + this.tableBody = this.rootElement.$$(`.adf-datatable-body`).first(); + this.allColumns = this.rootElement.$$('div[data-automation-id*="auto_id_entry."]'); + this.selectedRowNumber = this.rootElement.$(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`); + this.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`); + this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox`); + this.copyColumnTooltip = this.rootElement.$(`adf-copy-content-tooltip span`); + this.emptyList = this.rootElement.$(`adf-empty-content`); + this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`); + this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`); + } + + geCellElementDetail(detail: string): ElementArrayFinder { + return $$(`adf-datatable div[title="${detail}"] span`); } async checkAllRowsButtonIsDisplayed(): Promise { @@ -59,12 +64,12 @@ export class DataTableComponentPage { async checkAllRows(): Promise { await BrowserActions.click(this.selectAll); - await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.element(by.css('input[aria-checked="true"]'))); + await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]')); } async uncheckAllRows(): Promise { await BrowserActions.click(this.selectAll); - await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]'))); + await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.$('input[aria-checked="true"]')); } async clickCheckbox(columnName: string, columnValue: string): Promise { @@ -73,16 +78,16 @@ export class DataTableComponentPage { } async checkRowIsNotChecked(columnName: string, columnValue: string): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]'))); + await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).$('input[aria-checked="true"]')); } async checkRowIsChecked(columnName: string, columnValue: string): Promise { const rowCheckbox = this.getRowCheckbox(columnName, columnValue); - await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]'))); + await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.$('input[aria-checked="true"]')); } getRowCheckbox(columnName: string, columnValue: string): ElementFinder { - return this.getRow(columnName, columnValue).element(by.css('mat-checkbox')); + return this.getRow(columnName, columnValue).$('mat-checkbox'); } async checkNoRowIsSelected(): Promise { @@ -140,7 +145,7 @@ export class DataTableComponentPage { async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise { const row = this.getRow(identifyingColumn, identifyingValue); await BrowserVisibility.waitUntilElementIsVisible(row); - const rowColumn = row.element(by.css(`div[title="${columnName}"] span`)); + const rowColumn = row.$(`div[title="${columnName}"] span`); return BrowserActions.getText(rowColumn); } @@ -153,7 +158,7 @@ export class DataTableComponentPage { * @return 'true' if the list is sorted as await expected and 'false' if it isn't */ async checkListIsSorted(sortOrder: string, columnTitle: string, listType: string = 'STRING'): Promise { - const column = element.all(by.css(`div.adf-datatable-cell[title='${columnTitle}'] span`)); + const column = $$(`div.adf-datatable-cell[title='${columnTitle}'] span`); await BrowserVisibility.waitUntilElementIsVisible(column.first()); const initialList = []; @@ -212,7 +217,7 @@ export class DataTableComponentPage { async rightClickOnRow(columnName: string, columnValue: string): Promise { await this.rightClickOnItem(columnName, columnValue); - await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content'))); + await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content')); } async getTooltip(columnName: string, columnValue: string): Promise { @@ -222,7 +227,7 @@ export class DataTableComponentPage { async rightClickOnRowByIndex(index: number): Promise { const row = this.getRowByIndex(index); await BrowserActions.rightClick(row); - await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content'))); + await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content')); } async rightClickOnItem(columnName: string, columnValue: string): Promise { @@ -237,35 +242,37 @@ export class DataTableComponentPage { async numberOfRows(): Promise { try { await this.waitForFirstRow(); - return this.rootElement.all(this.rows).count(); + return this.rootElement.$$(this.rows).count(); } catch (e) { return 0; } } async waitForFirstRow(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(this.rows).first()); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first()); } async getAllRowsColumnValues(column: string): Promise { let columnValues: string[] = []; - const columnLocator: Locator = by.css("adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title='" + column + "'] span"); + const columnLocator = $$(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title="${column}"] span`); + await BrowserVisibility.waitUntilElementIsPresent(await columnLocator.first(), 1000); try { - await BrowserVisibility.waitUntilElementIsPresent(element.all(columnLocator).first(), 1000); - columnValues = await element.all(columnLocator) + await BrowserVisibility.waitUntilElementIsPresent(columnLocator.first(), 1000); + columnValues = await columnLocator .filter(async (el) => el.isPresent()) .map(async (el) => el.getText()); } catch (error) { + Logger.log(error); } return columnValues; } async getRowsWithSameColumnValues(columnName: string, columnValue: string) { - const columnLocator: Locator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`); - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first()); - return this.rootElement.all(columnLocator).getText(); + const columnLocator = `div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`; + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(columnLocator).first()); + return this.rootElement.$$(columnLocator).getText(); } async doubleClickRow(columnName: string, columnValue: string): Promise { @@ -279,36 +286,32 @@ export class DataTableComponentPage { } async getFirstElementDetail(detail: string): Promise { - const firstNode = element.all(by.css(`adf-datatable div[title="${detail}"] span`)).first(); + const firstNode = $$(`adf-datatable div[title="${detail}"] span`).first(); return BrowserActions.getText(firstNode); } - geCellElementDetail(detail: string): ElementArrayFinder { - return element.all(by.css(`adf-datatable div[title="${detail}"] span`)); - } - /** * Sort the list by name column. * * @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant */ async sortByColumn(sortOrder: string, titleColumn: string): Promise { - const locator: Locator = by.css(`div[data-automation-id="auto_id_${titleColumn}"]`); - await BrowserVisibility.waitUntilElementIsVisible(element(locator)); - const result = await BrowserActions.getAttribute(element(locator), 'class'); + const locator = $(`div[data-automation-id="auto_id_${titleColumn}"]`); + await BrowserVisibility.waitUntilElementIsVisible(locator); + const result = await BrowserActions.getAttribute(locator, 'class'); if (sortOrder.toLocaleLowerCase() === 'asc') { if (!result.includes('sorted-asc')) { if (result.includes('sorted-desc') || result.includes('sortable')) { - await BrowserActions.click(element(locator)); + await BrowserActions.click(locator); } } } else { if (result.includes('sorted-asc')) { - await BrowserActions.click(element(locator)); + await BrowserActions.click(locator); } else if (result.includes('sortable')) { - await BrowserActions.click(element(locator)); - await BrowserActions.click(element(locator)); + await BrowserActions.click(locator); + await BrowserActions.click(locator); } } } @@ -359,7 +362,7 @@ export class DataTableComponentPage { } getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder { - return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`)).first(); + return this.rootElement.$$(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`).first(); } async tableIsLoaded(): Promise { @@ -456,7 +459,7 @@ export class DataTableComponentPage { } async checkColumnIsDisplayed(column: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`))); + await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_entry.${column}"]`)); } async getNumberOfColumns(): Promise { @@ -468,11 +471,11 @@ export class DataTableComponentPage { } getCellByRowNumberAndColumnName(rowNumber: number, columnName: string): ElementFinder { - return this.list.get(rowNumber).all(by.css(`div[title="${columnName}"] span`)).first(); + return this.list.get(rowNumber).$$(`div[title="${columnName}"] span`).first(); } getCellByRowContentAndColumn(rowColumn: string, rowContent: string, columnName: string): ElementFinder { - return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`)); + return this.getRow(rowColumn, rowContent).$(`div[title='${columnName}']`); } async selectRowByContent(content: string): Promise { @@ -500,33 +503,33 @@ export class DataTableComponentPage { } async clickRowByContent(name: string): Promise { - const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first(); + const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first(); await BrowserActions.click(resultElement); } async clickRowByContentCheckbox(name: string): Promise { - const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`)); + const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`)); await browser.actions().mouseMove(resultElement); await BrowserActions.click(resultElement); } async checkRowContentIsDisplayed(content: string): Promise { - const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first(); + const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first(); await BrowserVisibility.waitUntilElementIsVisible(resultElement); } async checkRowContentIsNotDisplayed(content: string): Promise { - const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first(); + const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first(); await BrowserVisibility.waitUntilElementIsNotVisible(resultElement); } async checkRowContentIsDisabled(content: string): Promise { - const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`)).first(); + const resultElement = this.rootElement.$$(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`).first(); await BrowserVisibility.waitUntilElementIsVisible(resultElement); } async doubleClickRowByContent(name: string): Promise { - const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first(); + const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first(); await BrowserActions.click(resultElement); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); } @@ -566,7 +569,7 @@ export class DataTableComponentPage { async getEmptyListText(): Promise { const isEmpty = await this.isEmpty(); if (isEmpty) { - return this.rootElement.by.css('adf-custom-empty-content-template').getText(); + return this.rootElement.$('adf-custom-empty-content-template').getText(); } return ''; } diff --git a/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts b/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts index 4d34f25e5cf..38d95d78543 100644 --- a/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts +++ b/lib/testing/src/lib/protractor/core/pages/data-table/data-table-item.ts @@ -16,16 +16,16 @@ */ import { Column } from './column'; -import { by, element, ElementFinder, Locator, protractor, browser } from 'protractor'; +import { by, element, ElementFinder, protractor, browser, $$ } from 'protractor'; import { BrowserActions } from '../../utils/browser-actions'; import { BrowserVisibility } from '../../utils/browser-visibility'; export class DataTableItem { columns = new Array(); rootElement: ElementFinder; - rows: Locator = by.css(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`); + rows = `div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`; - constructor(rootElement = element.all(by.css('adf-datatable')).first()) { + constructor(rootElement = $$('adf-datatable').first()) { this.rootElement = rootElement; } @@ -58,7 +58,7 @@ export class DataTableItem { } async waitForFirstRow(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(this.rows).first()); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first()); } async clickAndEnterOnRow(columnName: string, columnValue: string): Promise { @@ -70,7 +70,7 @@ export class DataTableItem { async getColumnValueForRow(identifyingColumnName: string, identifyingColumnValue: string, columnName: string): Promise { const row = await this.getRow(identifyingColumnName, identifyingColumnValue); await BrowserVisibility.waitUntilElementIsVisible(row); - const rowColumn = row.element(by.css(`div[title="${columnName}"] span`)); + const rowColumn = row.$(`div[title="${columnName}"] span`); return BrowserActions.getText(rowColumn); } diff --git a/lib/testing/src/lib/protractor/core/pages/error.page.ts b/lib/testing/src/lib/protractor/core/pages/error.page.ts index 5874c54f357..5f759d986d8 100644 --- a/lib/testing/src/lib/protractor/core/pages/error.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/error.page.ts @@ -16,14 +16,14 @@ */ import { BrowserVisibility } from '../utils/browser-visibility'; -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '../utils/browser-actions'; export class ErrorPage { - errorPageCode = element(by.css('adf-error-content .adf-error-content-code')); - errorPageTitle = element(by.css('adf-error-content .adf-error-content-title')); - errorPageDescription = element(by.css('adf-error-content .adf-error-content-description')); + errorPageCode = $('adf-error-content .adf-error-content-code'); + errorPageTitle = $('adf-error-content .adf-error-content-title'); + errorPageDescription = $('adf-error-content .adf-error-content-description'); async checkErrorCode(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode); diff --git a/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts b/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts index 98c5ef79c37..56610e3dcd5 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/form-fields.ts @@ -15,37 +15,43 @@ * limitations under the License. */ -import { browser, Locator, by, element, ElementFinder } from 'protractor'; +import { browser, Locator, by, element, ElementFinder, $, $$ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../utils/public-api'; import { DropdownPage } from '../material/dropdown.page'; export class FormFields { - formContent = element(by.css('adf-form-renderer')); - refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon')); + selectFormDropdown = new DropdownPage($$('.adf-attach-form .mat-select-arrow').first()); + formContent = $('adf-form-renderer'); + refreshButton = $('div[class*="form-reload-button"] mat-icon'); saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE')); valueLocator: Locator = by.css('input'); labelLocator: Locator = by.css('label'); - noFormMessage = element(by.css('.adf-empty-content__title')); - noFormMessageStandaloneTask = element(by.css('adf-task-standalone #adf-no-form-message')); - noFormTemplate = element(by.css('adf-empty-content')); - completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p')); - completedStandaloneTaskNoFormMessage = element(by.css('adf-task-standalone #adf-completed-form-message')); - attachFormButton = element(by.id('adf-attach-form-attach-button')); - completeButton = element(by.id('adf-form-complete')); - completeNoFormButton = element(by.id('adf-no-form-complete-button')); - cancelButton = element(by.id('adf-no-form-cancel-button')); + noFormMessage = $('.adf-empty-content__title'); + noFormMessageStandaloneTask = $('adf-task-standalone #adf-no-form-message'); + noFormTemplate = $('adf-empty-content'); + completedTaskNoFormMessage = $('div[id*="completed-form-message"] p'); + completedStandaloneTaskNoFormMessage = $('adf-task-standalone #adf-completed-form-message'); + attachFormButton = $('#adf-attach-form-attach-button'); + completeButton = $('#adf-form-complete'); + completeNoFormButton = $('#adf-no-form-complete-button'); + cancelButton = $('#adf-no-form-cancel-button'); errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text'); - selectFormDropdown = new DropdownPage(element.all(by.css('.adf-attach-form .mat-select-arrow')).first()); + getWidget = (fieldId: string): ElementFinder => $(`adf-form-field div[id='field-${fieldId}-container']`); - async setFieldValue(locator, field, value: string): Promise { - const fieldElement = element(locator(field)); + async setFieldValue(field: string, value: string): Promise { + const fieldElement = $(`#${field}`); await BrowserActions.clearSendKeys(fieldElement, value); } + async checkFieldValue(field: string, value: string): Promise { + const fieldElement = $(`#${field}`); + await BrowserVisibility.waitUntilElementHasValue(fieldElement, value); + } + async checkWidgetIsVisible(fieldId: string): Promise { - const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first(); + const fieldElement = $$(`adf-form-field div[id='field-${fieldId}-container']`).first(); await BrowserVisibility.waitUntilElementIsVisible(fieldElement); } @@ -56,19 +62,15 @@ export class FormFields { } async checkWidgetIsClickable(fieldId: string): Promise { - const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first(); + const fieldElement = $$(`adf-form-field div[id='field-${fieldId}-container']`).first(); await BrowserVisibility.waitUntilElementIsClickable(fieldElement); } async checkWidgetIsHidden(fieldId: string): Promise { - const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); + const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container']`); await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000); } - getWidget(fieldId: string): ElementFinder { - return element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); - } - async getFieldValue(fieldId: string, valueLocatorParam?: any): Promise { const valueWidget = await (await this.getWidget(fieldId)).element(valueLocatorParam || this.valueLocator); await BrowserVisibility.waitUntilElementIsVisible(valueWidget); @@ -92,15 +94,11 @@ export class FormFields { } async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise { - const placeHolderLocator = element(by.css(`${locator}#${fieldId}`)); + const placeHolderLocator = $(`${locator}#${fieldId}`); await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator); return BrowserActions.getAttribute(placeHolderLocator, 'data-placeholder'); } - async checkFieldValue(locator, field, val): Promise { - await BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val); - } - async refreshForm(): Promise { await BrowserActions.click(this.refreshButton); await browser.sleep(500); @@ -177,13 +175,13 @@ export class FormFields { } async checkWidgetIsReadOnlyMode(fieldId: string): Promise { - const widget = element(by.css(`adf-form-field #field-${fieldId}-container .adf-readonly`)); + const widget = $(`adf-form-field #field-${fieldId}-container .adf-readonly`); await BrowserVisibility.waitUntilElementIsVisible(widget); return widget; } async isFormFieldEnabled(formFieldId: string): Promise { - return element(by.id(`${formFieldId}`)).isEnabled(); + return $(`#${formFieldId}`).isEnabled(); } async completeForm(): Promise { @@ -199,7 +197,7 @@ export class FormFields { } async setValueInInputById(fieldId: string, value: string): Promise { - const input = element(by.id(fieldId)); + const input = $(`#${fieldId}`); await BrowserActions.clearSendKeys(input, value); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/form.page.ts b/lib/testing/src/lib/protractor/core/pages/form/form.page.ts index 3e96a49bd18..99b045060eb 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/form.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/form.page.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { element, by, $ } from 'protractor'; import { BrowserVisibility } from '../../utils/browser-visibility'; import { BrowserActions } from '../../utils/public-api'; export class FormPage { - errorLog = element(by.css('div[class*="console"]')); + errorLog = $('div[class*="console"]'); saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE')); async checkErrorMessageForWidgetIsDisplayed(errorMessage: string): Promise { @@ -47,7 +47,7 @@ export class FormPage { } async isSaveButtonDisabled(): Promise { - const saveButtonDisabled = element(by.css('.adf-form-mat-card-actions [disabled]')); + const saveButtonDisabled = $('.adf-form-mat-card-actions [disabled]'); try { await saveButtonDisabled.isDisplayed(); return true; @@ -57,7 +57,7 @@ export class FormPage { } async isValidationIconBlue(): Promise { - const validationIcon = element(by.css('#adf-valid-form-icon')); + const validationIcon = $('#adf-valid-form-icon'); try { await validationIcon.isDisplayed(); return true; @@ -67,7 +67,7 @@ export class FormPage { } async isValidationIconRed(): Promise { - const validationIcon = element(by.css('#adf-invalid-form-icon')); + const validationIcon = $('#adf-invalid-form-icon'); try { await validationIcon.isDisplayed(); return true; diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts index 9bfaad0572b..61b905db35c 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/amount-widget.page.ts @@ -15,23 +15,23 @@ * limitations under the License. */ -import { element, by, Locator } from 'protractor'; +import { $$, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; import { FormFields } from '../form-fields'; export class AmountWidgetPage { - currency: Locator = by.css('.adf-amount-widget__prefix-spacing'); + currency = '.adf-amount-widget__prefix-spacing'; formFields: FormFields = new FormFields(); async getAmountFieldLabel(fieldId: string): Promise { - const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first(); + const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); return BrowserActions.getText(label); } async getAmountFieldCurrency(fieldId: string): Promise { const widget = await this.formFields.getWidget(fieldId); - return BrowserActions.getText(widget.element(this.currency)); + return BrowserActions.getText(widget.$(this.currency)); } async setFieldValue(fieldId: string, value: any): Promise { @@ -39,12 +39,12 @@ export class AmountWidgetPage { } async removeFromAmountWidget(fieldId: string) { - const amountWidgetInput = element(by.id(fieldId)); + const amountWidgetInput = $(`#${fieldId}`); await BrowserActions.clearWithBackSpace(amountWidgetInput); } async clearFieldValue(fieldId: string): Promise { - const numberField = element(by.id(fieldId)); + const numberField = $(`#${fieldId}`); await BrowserVisibility.waitUntilElementIsVisible(numberField); await numberField.clear(); } @@ -54,7 +54,7 @@ export class AmountWidgetPage { } async getErrorMessage(fieldId: string): Promise { - const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`)); + const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); return BrowserActions.getText(errorMessage); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts index 5ce95aad08a..6b0266fdfcb 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-file-widget.page.ts @@ -17,33 +17,33 @@ import { FormFields } from '../form-fields'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; -import { Locator, element, by, browser } from 'protractor'; +import { by, browser, $ } from 'protractor'; import { TestElement } from '../../../test-element'; export class AttachFileWidgetPage { formFields = new FormFields(); - alfrescoTypeUploadLocator: Locator = by.css('button[id="attachfile"]'); - localStorageButton = element(by.css('input[id="attachfile"]')); - filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]'); - attachFileWidget = element(by.css('#attachfile')); - attachedFileMenu = element(by.css('mat-list-item button')); - attachedFileOptions = element(by.css('.mat-menu-panel .mat-menu-content')); - viewFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`)); - downloadFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`)); + alfrescoTypeUploadLocator = 'button[id="attachfile"]'; + localStorageButton = $('input[id="attachfile"]'); + filesListLocator = 'div[id="adf-attach-widget-readonly-list"]'; + attachFileWidget = $('#attachfile'); + attachedFileMenu = $('mat-list-item button'); + attachedFileOptions = $('.mat-menu-panel .mat-menu-content'); + viewFileOptionButton = $(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`); + downloadFileOptionButton = $(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`); removeFileOptionButton = TestElement.byCss(`.mat-menu-panel .mat-menu-content button[id$="remove"]`); - async attachFile(fieldId, fileLocation): Promise { + async attachFile(fieldId: string, fileLocation: string): Promise { const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.element(this.alfrescoTypeUploadLocator); + const uploadButton = await widget.$(this.alfrescoTypeUploadLocator); await BrowserActions.click(uploadButton); await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton); await this.localStorageButton.sendKeys(fileLocation); } - async checkNoFileIsAttached(fieldId): Promise { + async checkNoFileIsAttached(fieldId: string): Promise { const widget = await this.formFields.getWidget(fieldId); - const fileItem = widget.element(this.filesListLocator).element(by.css('mat-list-item')); + const fileItem = widget.$(this.filesListLocator).$('mat-list-item'); await BrowserVisibility.waitUntilElementIsNotVisible(fileItem); } @@ -54,8 +54,7 @@ export class AttachFileWidgetPage { } async checkFileIsAttached(fieldId: string, name: string): Promise { - const widget = await this.formFields.getWidget(fieldId); - const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name); await BrowserVisibility.waitUntilElementIsVisible(fileAttached); } @@ -65,14 +64,13 @@ export class AttachFileWidgetPage { } } - async checkFileIsNotAttached(fieldId, name): Promise { - const widget = await this.formFields.getWidget(fieldId); - const fileNotAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + async checkFileIsNotAttached(fieldId: string, name: string): Promise { + const fileNotAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name); await BrowserVisibility.waitUntilElementIsNotVisible(fileNotAttached); } async viewFile(name: string): Promise { - const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + const fileView = $(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); await BrowserActions.click(fileView); await browser.actions().doubleClick(fileView).perform(); } @@ -84,10 +82,10 @@ export class AttachFileWidgetPage { async toggleAttachedFileMenu(fieldId: string, fileName: string): Promise { await BrowserActions.closeMenuAndDialogs(); const widget = await this.formFields.getWidget(fieldId); - const fileAttached = await widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', fileName)); + const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, fileName); await BrowserVisibility.waitUntilElementIsVisible(fileAttached); const id = await BrowserActions.getAttribute(fileAttached, 'id'); - const optionMenu = widget.element(by.css(`button[id='${id}-option-menu']`)); + const optionMenu = widget.$(`button[id='${id}-option-menu']`); await BrowserActions.click(optionMenu); } @@ -129,39 +127,44 @@ export class AttachFileWidgetPage { return this.removeFileOptionButton.isEnabled(); } - async checkUploadIsNotVisible(fieldId): Promise { - const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`); + async checkUploadIsNotVisible(fieldId: string): Promise { + const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`; const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.element(alfrescoTypeUploadLocator); + const uploadButton = await widget.$(alfrescoTypeUploadLocator); await BrowserVisibility.waitUntilElementIsNotPresent(uploadButton); } - async checkUploadIsVisible(fieldId): Promise { - const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`); + async checkUploadIsVisible(fieldId: string): Promise { + const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`; const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.element(alfrescoTypeUploadLocator); + const uploadButton = await widget.$(alfrescoTypeUploadLocator); await BrowserVisibility.waitUntilElementIsPresent(uploadButton); } - async checkLocalTypeUploadIsPresent(fieldId): Promise { - const localTypeUpload = element(by.css(`input[id="${fieldId}"]`)); + async checkLocalTypeUploadIsPresent(fieldId: string): Promise { + const localTypeUpload = $(`input[id="${fieldId}"]`); await BrowserVisibility.waitUntilElementIsPresent(localTypeUpload); } - async checkLocalTypeUploadIsNotPresent(fieldId): Promise { - const localTypeUpload = element(by.css(`input[id="${fieldId}"]`)); + async checkLocalTypeUploadIsNotPresent(fieldId: string): Promise { + const localTypeUpload = $(`input[id="${fieldId}"]`); await BrowserVisibility.waitUntilElementIsNotPresent(localTypeUpload); } async selectUploadSource(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); - await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`))); + await BrowserActions.click($(`button[id="attach-${name}"]`)); } - async clickUploadButton(fieldId): Promise { + async clickUploadButton(fieldId: string): Promise { await BrowserActions.closeMenuAndDialogs(); const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.element(this.alfrescoTypeUploadLocator); + const uploadButton = await widget.$(this.alfrescoTypeUploadLocator); await BrowserActions.click(uploadButton); } + + private async getFileAttachedNotAttachedLocator(fieldId: string, name: string) { + const widget = await this.formFields.getWidget(fieldId); + return widget.$(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + } } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts index 7e803b8bf6d..9c5cfd00977 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/attach-folder-widget.page.ts @@ -15,42 +15,45 @@ * limitations under the License. */ -import { Locator, by, element } from 'protractor'; +import { by, $ } from 'protractor'; import { FormFields } from '../form-fields'; import { BrowserActions, BrowserVisibility } from '../../../utils/public-api'; export class AttachFolderWidgetPage { formFields: FormFields = new FormFields(); - foldersListLocator: Locator = by.css('.adf-attach-folder-result'); + foldersListLocator = '.adf-attach-folder-result'; async clickWidget(fieldId: string): Promise { - const widget = await this.formFields.getWidget(fieldId).element(by.css(`button[id="folder-${fieldId}-button"]`)); + const widget = await this.formFields.getWidget(fieldId).$(`button[id="folder-${fieldId}-button"]`); await BrowserActions.click(widget); } - async checkFolderIsAttached(fieldId, name): Promise { - const widget = await this.formFields.getWidget(fieldId); - const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name)); + async checkFolderIsAttached(fieldId: string, name: string): Promise { + const folderAttached = await this.getFolderAttachedLocator(fieldId, name); await BrowserVisibility.waitUntilElementIsVisible(folderAttached); } - async checkFolderIsNotAttached(fieldId, name): Promise { - const widget = await this.formFields.getWidget(fieldId); - const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name)); + async checkFolderIsNotAttached(fieldId: string, name: string): Promise { + const folderAttached = await this.getFolderAttachedLocator(fieldId, name); await BrowserVisibility.waitUntilElementIsNotPresent(folderAttached); } async attachFileWidgetDisplayed(id: string): Promise { - const locator = element(by.css(id ? id : '#attachfolder')); + const locator = $(id ? id : '#attachfolder'); await BrowserVisibility.waitUntilElementIsVisible(locator); } async removeFolder(fieldId: string, name: string): Promise { await this.checkFolderIsAttached(fieldId, name); const widget = await this.formFields.getWidget(fieldId); - const folderToBeRemoved = widget.element(this.foldersListLocator).element(by.css(`[id="folder-${fieldId}-remove"]`)); + const folderToBeRemoved = widget.$(this.foldersListLocator).$(`[id="folder-${fieldId}-remove"]`); await BrowserActions.click(folderToBeRemoved); } + private async getFolderAttachedLocator(fieldId: string, name: string) { + const widget = await this.formFields.getWidget(fieldId); + return widget.$(this.foldersListLocator).element(by.cssContainingText('span', name)); + } + } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts index 1cb759eaf0c..4c216f6e7d2 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/checkbox-widget.page.ts @@ -17,20 +17,20 @@ import { FormFields } from '../form-fields'; import { BrowserActions } from '../../../utils/public-api'; -import { Locator, by, element } from 'protractor'; +import { $$, $ } from 'protractor'; export class CheckboxWidgetPage { formFields = new FormFields(); - checkboxLabel = element(by.css('span[class*="mat-checkbox-label"]')); - checkboxLocator: Locator = by.css('mat-checkbox'); + checkboxLabel = $('span[class*="mat-checkbox-label"]'); + checkboxLocator = ('mat-checkbox'); getCheckboxLabel(): Promise { return BrowserActions.getText(this.checkboxLabel); } async clickCheckboxInput(fieldId: string): Promise { - const checkboxInput = element.all(by.css(`mat-checkbox[id="${fieldId}"] div`)).first(); + const checkboxInput = $$(`mat-checkbox[id="${fieldId}"] div`).first(); await BrowserActions.click(checkboxInput); } @@ -43,7 +43,7 @@ export class CheckboxWidgetPage { } async isCheckboxChecked(fieldId: string): Promise { - const checkboxWidget = await (await this.formFields.getWidget(fieldId)).element(this.checkboxLocator); + const checkboxWidget = await (await this.formFields.getWidget(fieldId)).$(this.checkboxLocator); const attributeValue = await BrowserActions.getAttribute(checkboxWidget, 'class'); return attributeValue.includes('mat-checkbox-checked'); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts index a98eb623139..12ed2bb4fa6 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/container-widget.page.ts @@ -24,7 +24,7 @@ export class ContainerWidgetPage { fileLocator: Locator = by.css("div [class*='upload-widget__content-text']"); - getFieldText(fieldId): Promise { + getFieldText(fieldId: string): Promise { return this.formFields.getFieldText(fieldId, this.fileLocator); } } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts index 8ef46c9b10a..f6c60a575db 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/date-time-widget.page.ts @@ -16,20 +16,20 @@ */ import { FormFields } from '../form-fields'; -import { element, by } from 'protractor'; +import { element, by, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class DateTimeWidgetPage { formFields = new FormFields(); - outsideLayer = element(by.css('div[class*="cdk-overlay-container"]')); + outsideLayer = $('div[class*="cdk-overlay-container"]'); async checkWidgetIsVisible(fieldId: string): Promise { await this.formFields.checkWidgetIsVisible(fieldId); } async getDateTimeLabel(fieldId: string): Promise { - const label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)); + const label = $(`adf-form-field div[id="field-${fieldId}-container"] label`); return BrowserActions.getText(label); } @@ -47,7 +47,7 @@ export class DateTimeWidgetPage { } async getErrorMessage(fieldId: string): Promise { - const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`)); + const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); return BrowserActions.getText(errorMessage); } @@ -57,7 +57,7 @@ export class DateTimeWidgetPage { } async openDatepicker(fieldId: string): Promise { - await BrowserActions.click(element(by.id(fieldId))); + await BrowserActions.click($(`#${fieldId}`)); } async selectTime(time: string): Promise { @@ -78,13 +78,13 @@ export class DateTimeWidgetPage { } async removeFromDatetimeWidget(fieldId: string): Promise { + const amountWidgetInput = $(`#${fieldId}`); await BrowserVisibility.waitUntilElementIsVisible(await this.formFields.getWidget(fieldId)); - const amountWidgetInput = element(by.id(fieldId)); await BrowserActions.clearWithBackSpace(amountWidgetInput); } async clearDateTimeInput(fieldId: string): Promise { - const dateInput = element(by.id(fieldId)); + const dateInput = $(`#${fieldId}`); await BrowserVisibility.waitUntilElementIsVisible(dateInput); await dateInput.clear(); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts index 7c0eb145f6e..883f36570f3 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/date-widget.page.ts @@ -16,7 +16,7 @@ */ import { FormFields } from '../form-fields'; -import { element, by } from 'protractor'; +import { $$, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class DateWidgetPage { @@ -32,7 +32,7 @@ export class DateWidgetPage { } async getDateLabel(fieldId: string): Promise { - const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first(); + const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); return BrowserActions.getText(label); } @@ -46,7 +46,7 @@ export class DateWidgetPage { } async clearDateInput(fieldId: string): Promise { - const dateInput = element(by.id(fieldId)); + const dateInput = $(`#${fieldId}`); await BrowserActions.clearWithBackSpace(dateInput); } @@ -56,18 +56,18 @@ export class DateWidgetPage { } async checkErrorMessageIsNotDisplayed(fieldId: string): Promise { - const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`)); + const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); await BrowserVisibility.waitUntilElementIsNotVisible(errorMessage); } async getErrorMessage(fieldId: string): Promise { - const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`)); + const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); return BrowserActions.getText(errorMessage); } async removeFromDatetimeWidget(fieldId: string): Promise { const widget = await this.formFields.getWidget(fieldId); await BrowserVisibility.waitUntilElementIsVisible(widget); - await BrowserActions.clearSendKeys(element(by.id(fieldId)), ''); + await BrowserActions.clearSendKeys($(`#${fieldId}`), ''); } } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts index 12ddfdf357a..1395f53a5ec 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/display-value-widget.page.ts @@ -16,7 +16,7 @@ */ import { FormFields } from '../form-fields'; -import { by, element, Locator } from 'protractor'; +import { by, Locator, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; import { EditJsonDialog } from '../../../dialog/public-api'; @@ -45,7 +45,7 @@ export class DisplayValueWidgetPage { } async checkDisplayValueWidgetIsHidden(fieldId: string): Promise { - const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`)); + const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`); try { await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement); return true; @@ -55,7 +55,7 @@ export class DisplayValueWidgetPage { } async clickOnDisplayJsonValueWidget(fieldId: string) { - const jsonButton = element(by.css(`adf-form-field div[id='field-${fieldId}-container'] button`)); + const jsonButton = $(`adf-form-field div[id='field-${fieldId}-container'] button`); await BrowserActions.click(jsonButton); await this.editJsonDialog.checkDialogIsDisplayed(); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts index 49a54d19c61..1ae63e5ee89 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/dropdown-widget.page.ts @@ -16,7 +16,7 @@ */ import { FormFields } from '../form-fields'; -import { by, element } from 'protractor'; +import { by, element, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class DropdownWidgetPage { @@ -35,12 +35,12 @@ export class DropdownWidgetPage { async openDropdown(locator: string = '#dropdown'): Promise { await this.checkDropdownIsDisplayed(locator); - const dropdown = locator ? element(by.css(`${locator}`)) : element(by.css(`#dropdown`)); + const dropdown = locator ? $(`${locator}`) : $(`#dropdown`); await BrowserActions.click(dropdown); } async checkDropdownIsDisplayed(locator: string = '#dropdown'): Promise { - const dropdown = element(by.css(`${locator}`)); + const dropdown = $(`${locator}`); await BrowserVisibility.waitUntilElementIsVisible(dropdown); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts index d6153ea10dc..eb3c922b6bc 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/dynamic-table-widget.page.ts @@ -16,7 +16,7 @@ */ import { FormFields } from '../form-fields'; -import { Locator, by, element, protractor } from 'protractor'; +import { Locator, by, element, protractor, $, $$ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class DynamicTableWidgetPage { @@ -27,14 +27,16 @@ export class DynamicTableWidgetPage { columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th'); cancelButton = element(by.cssContainingText('button span', 'Cancel')); editButton = element(by.cssContainingText('button span', 'edit')); - columnDateTime = element(by.id('columnDateTime')); - columnDate = element(by.id('columnDate')); - calendarHeader = element(by.css('.mat-datetimepicker-calendar-header-date-time')); - calendarContent = element(by.css('.mat-datetimepicker-calendar-content')); + columnDateTime = $('#columnDateTime'); + columnDate = $('#columnDate'); + calendarHeader = $('.mat-datetimepicker-calendar-header-date-time'); + calendarContent = $('.mat-datetimepicker-calendar-content'); saveButton = element(by.cssContainingText('button span', 'Save')); - errorMessage = element(by.css('.adf-error-text')); - dateWidget = element.all(by.css('mat-datepicker-toggle button')).first(); - tableRow = element.all(by.css('tbody tr')); + errorMessage = $('.adf-error-text'); + dateWidget = $$('mat-datepicker-toggle button').first(); + tableRow = $$('tbody tr'); + + private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`); getFieldLabel(fieldId: string): Promise { return this.formFields.getFieldLabel(fieldId, this.labelLocator); @@ -45,12 +47,12 @@ export class DynamicTableWidgetPage { } async clickAddRow(id?: string): Promise { - const rowButton = element(by.id(`${id ? id : 'label'}-add-row`)); + const rowButton = $(`#${id ? id : 'label'}-add-row`); await BrowserActions.click(rowButton); } async clickTableRow(rowNumber): Promise { - const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber)); + const tableRowByIndex = this.getTableRowByIndex(rowNumber); await BrowserActions.click(tableRowByIndex); } @@ -63,18 +65,18 @@ export class DynamicTableWidgetPage { } async setDatatableInput(text, id = 'id'): Promise { - const dataTableInput = element(by.id(id)); + const dataTableInput = $(`#${id}`); await BrowserVisibility.waitUntilElementIsVisible(dataTableInput); await BrowserActions.clearSendKeys(dataTableInput, text); } async getTableRowText(rowNumber): Promise { - const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber)); + const tableRowByIndex = this.getTableRowByIndex(rowNumber); return BrowserActions.getText(tableRowByIndex); } async checkTableRowIsNotVisible(rowNumber): Promise { - const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber)); + const tableRowByIndex = this.getTableRowByIndex(rowNumber); await BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts index 23768daa2a2..49aa92854d1 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/group-widget.page.ts @@ -16,13 +16,13 @@ */ import { FormFields } from '../form-fields'; -import { Locator, by, element } from 'protractor'; +import { Locator, by, element, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class GroupWidgetPage { - groupField = element(by.css('input[data-automation-id="adf-group-search-input"]')); - firstResult = element(by.id('adf-group-widget-user-0')); + groupField = $('input[data-automation-id="adf-group-search-input"]'); + firstResult = $('#adf-group-widget-user-0'); formFields = new FormFields(); groupDropDownList: Locator = by.css('.mat-autocomplete-panel'); diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts index a7a26d3e023..eb25808a921 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/hyperlink-widget.page.ts @@ -16,7 +16,7 @@ */ import { FormFields } from '../form-fields'; -import { Locator, by, element } from 'protractor'; +import { Locator, by, $$ } from 'protractor'; import { BrowserActions } from '../../../utils/public-api'; export class HyperlinkWidgetPage { @@ -33,7 +33,7 @@ export class HyperlinkWidgetPage { } async getFieldLabel(fieldId: string): Promise { - const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first(); + const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); return BrowserActions.getText(label); } } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts index d4dc2f51cfe..18490011136 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/json-widget.page.ts @@ -17,16 +17,14 @@ import { FormFields } from '../form-fields'; import { BrowserActions } from '../../../utils/public-api'; -import { Locator, by } from 'protractor'; export class JsonWidgetPage { - formFields = new FormFields(); - jsonButtonLocator: Locator = by.css('button'); + jsonButtonLocator = 'button'; - async clickJsonButton(fieldId): Promise { + async clickJsonButton(fieldId: string): Promise { const widget = await this.formFields.getWidget(fieldId); - const uploadButton = await widget.element(this.jsonButtonLocator); + const uploadButton = await widget.$(this.jsonButtonLocator); await BrowserActions.click(uploadButton); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts index e013382fdd3..02b591cec9e 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/multiline-text-widget.page.ts @@ -38,7 +38,7 @@ export class MultilineTextWidgetPage { } setValue(fieldId, value): Promise { - return this.formFields.setFieldValue(by.id, fieldId, value); + return this.formFields.setFieldValue(fieldId, value); } getErrorMessage(fieldId): Promise { diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts index 152fd01c30a..a413612ed63 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/number-widget.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $$, $ } from 'protractor'; import { FormFields } from '../form-fields'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; @@ -24,7 +24,7 @@ export class NumberWidgetPage { formFields = new FormFields(); async getNumberFieldLabel(fieldId: string): Promise { - const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first(); + const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); return BrowserActions.getText(label); } @@ -37,7 +37,7 @@ export class NumberWidgetPage { } async clearFieldValue(fieldId: string): Promise { - const numberField = element(by.id(fieldId)); + const numberField = $(`#${fieldId}`); await BrowserVisibility.waitUntilElementIsVisible(numberField); await numberField.clear(); } @@ -47,7 +47,7 @@ export class NumberWidgetPage { } async getErrorMessage(fieldId: string): Promise { - const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`)); + const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`); return BrowserActions.getText(errorMessage); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts index f8ea411740f..d33dcb451f2 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/people-widget.page.ts @@ -16,17 +16,17 @@ */ import { FormFields } from '../form-fields'; -import { by, element, Locator } from 'protractor'; +import { by, element, Locator, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class PeopleWidgetPage { - peopleField = element(by.css('input[data-automation-id="adf-people-search-input"]')); - firstResult = element(by.id('adf-people-widget-user-0')); + peopleField = $('input[data-automation-id="adf-people-search-input"]'); + firstResult = $('#adf-people-widget-user-0'); formFields = new FormFields(); labelLocator: Locator = by.css('div[class*="display-text-widget"]'); inputLocator: Locator = by.id('involvepeople'); - peopleDropDownList: Locator = by.css('div[class*="adf-people-widget-list"]'); + peopleDropDownList = $('div[class*="adf-people-widget-list"]'); getFieldLabel(fieldId: string): Promise { return this.formFields.getFieldLabel(fieldId, this.labelLocator); @@ -45,7 +45,7 @@ export class PeopleWidgetPage { } async checkDropDownListIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(this.peopleDropDownList)); + await BrowserVisibility.waitUntilElementIsVisible(this.peopleDropDownList); } async checkUserIsListed(userName: string): Promise { @@ -60,7 +60,7 @@ export class PeopleWidgetPage { async getDropDownList(): Promise { await this.checkDropDownListIsDisplayed(); - const users: Locator = by.css('.adf-people-label-name'); + const users = by.css('.adf-people-label-name'); await BrowserVisibility.waitUntilElementIsVisible(element(users)); return element.all(users).map((elementFinder) => elementFinder.getText()); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts index a8c2a092137..ecc556305a5 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/radio-buttons-widget.page.ts @@ -16,7 +16,7 @@ */ import { FormFields } from '../form-fields'; -import { by, element, Locator } from 'protractor'; +import { $$, by, Locator } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class RadioButtonsWidgetPage { @@ -46,7 +46,7 @@ export class RadioButtonsWidgetPage { } async getRadioWidgetLabel(fieldId): Promise { - const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first(); + const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first(); return BrowserActions.getText(label); } diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts index 63f13ead503..3eae69fb317 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/tab.page.ts @@ -15,12 +15,12 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { by, element, $ } from 'protractor'; import { BrowserActions, BrowserVisibility } from '../../../utils/public-api'; export class TabPage { - changeTabAnimation = element(by.css('div[class="mat-ripple-element"]')); + changeTabAnimation = $('div[class="mat-ripple-element"]'); async clickTabByLabel(tabLabel): Promise { const user = element(by.cssContainingText('.mat-tab-label-content', tabLabel)); diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts index f6ad8520770..3881939e2a2 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/text-widget.page.ts @@ -33,7 +33,7 @@ export class TextWidgetPage { } async setValue(fieldId, value): Promise { - await this.formFields.setFieldValue(by.id, fieldId, value); + await this.formFields.setFieldValue(fieldId, value); } getFieldValue(fieldId): Promise { diff --git a/lib/testing/src/lib/protractor/core/pages/form/widgets/typeahead-widget.page.ts b/lib/testing/src/lib/protractor/core/pages/form/widgets/typeahead-widget.page.ts index f0090d44976..8d87b984d83 100644 --- a/lib/testing/src/lib/protractor/core/pages/form/widgets/typeahead-widget.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/form/widgets/typeahead-widget.page.ts @@ -16,15 +16,15 @@ */ import { FormFields } from '../form-fields'; -import { Locator, by, element } from 'protractor'; +import { by, element, $ } from 'protractor'; import { BrowserVisibility, BrowserActions } from '../../../utils/public-api'; export class TypeaheadWidgetPage { - field = element(by.css('input[data-automation-id="adf-typeahed-search-input"]')); - firstResult = element(by.id('adf-typeahed-widget-user-0')); + field = $('input[data-automation-id="adf-typeahed-search-input"]'); + firstResult = $('#adf-typeahed-widget-user-0'); + groupDropDownList = $('.mat-autocomplete-panel'); formFields = new FormFields(); - groupDropDownList: Locator = by.css('.mat-autocomplete-panel'); getFieldLabel(fieldId: string): Promise { return this.formFields.getFieldLabel(fieldId); @@ -43,7 +43,7 @@ export class TypeaheadWidgetPage { } async checkDropDownListIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(this.groupDropDownList)); + await BrowserVisibility.waitUntilElementIsVisible(this.groupDropDownList); } async checkOptionIsListed(option: string): Promise { @@ -51,9 +51,9 @@ export class TypeaheadWidgetPage { await BrowserVisibility.waitUntilElementIsVisible(optionElement); } - async getDropDownList(): Promise { - const option: Locator = by.css('[id="adf-typeahed-label-name"]'); - await BrowserVisibility.waitUntilElementIsVisible(element(option)); + async getDropDownList(): Promise { + const option = $('[id="adf-typeahed-label-name"]'); + await BrowserVisibility.waitUntilElementIsVisible(option); return element.all(option).map((elementFinder) => elementFinder.getText()); } diff --git a/lib/testing/src/lib/protractor/core/pages/header.page.ts b/lib/testing/src/lib/protractor/core/pages/header.page.ts index 9d3e4ec614e..b005cf0850f 100644 --- a/lib/testing/src/lib/protractor/core/pages/header.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/header.page.ts @@ -15,23 +15,23 @@ * limitations under the License. */ -import { element, by, protractor, browser } from 'protractor'; +import { element, by, protractor, browser, $, $$ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; export class HeaderPage { checkBox = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button')); - headerColor = element(by.css('option[value="primary"]')); - titleInput = element(by.css('input[name="title"]')); - iconInput = element(by.css('input[placeholder="URL path"]')); - hexColorInput = element(by.css('input[placeholder="hex color code"]')); - logoHyperlinkInput = element(by.css('input[placeholder="Redirect URL"]')); - logoTooltipInput = element(by.css('input[placeholder="Tooltip text"]')); - positionStart = element.all(by.css('mat-radio-button[value="start"]')).first(); - positionEnd = element.all(by.css('mat-radio-button[value="end"]')).first(); - sideBarPositionRight = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end')); - sideBarPositionLeft = element(by.css('mat-sidenav.mat-drawer.mat-sidenav')); + headerColor = $('option[value="primary"]'); + titleInput = $('input[name="title"]'); + iconInput = $('input[placeholder="URL path"]'); + hexColorInput = $('input[placeholder="hex color code"]'); + logoHyperlinkInput = $('input[placeholder="Redirect URL"]'); + logoTooltipInput = $('input[placeholder="Tooltip text"]'); + positionStart = $$('mat-radio-button[value="start"]').first(); + positionEnd = $$('mat-radio-button[value="end"]').first(); + sideBarPositionRight = $('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'); + sideBarPositionLeft = $('mat-sidenav.mat-drawer.mat-sidenav'); async checkShowMenuCheckBoxIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.checkBox); @@ -50,12 +50,12 @@ export class HeaderPage { } async clickShowMenuButton(): Promise { - const checkBox = element.all(by.css('mat-checkbox')).first(); + const checkBox = $$('mat-checkbox').first(); await BrowserActions.click(checkBox); } async changeHeaderColor(color: string): Promise { - const headerColor = element(by.css('option[value="' + color + '"]')); + const headerColor = $('option[value="' + color + '"]'); await BrowserActions.click(headerColor); } @@ -71,7 +71,7 @@ export class HeaderPage { } async checkIconIsDisplayed(url: string): Promise { - const icon = element(by.css('img[src="' + url + '"]')); + const icon = $('img[src="' + url + '"]'); await BrowserVisibility.waitUntilElementIsVisible(icon); } diff --git a/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts b/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts index 5b4409d1a64..ff4926e6aec 100644 --- a/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import { Locator, element, by, ElementFinder } from 'protractor'; +import { ElementFinder, $ } from 'protractor'; import { BrowserVisibility } from './../utils/browser-visibility'; import { TabsPage } from './material/tabs.page'; export class InfoDrawerPage { rootElement: ElementFinder; - infoDrawerHeader: Locator = by.css('adf-info-drawer-layout-header'); + infoDrawerHeader = ('adf-info-drawer-layout-header'); tabsPage: TabsPage = new TabsPage(); constructor(classLocator: string = 'adf-info-drawer') { - this.rootElement = element(by.css(`adf-info-drawer[class*='${classLocator}']`)); + this.rootElement = $(`adf-info-drawer[class*='${classLocator}']`); } async isInfoDrawerDisplayed(): Promise { @@ -49,7 +49,7 @@ export class InfoDrawerPage { async isInfoDrawerHeaderDisplayed(): Promise { try { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.infoDrawerHeader)); + await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.infoDrawerHeader)); return true; } catch (error) { return false; @@ -58,7 +58,7 @@ export class InfoDrawerPage { async isInfoDrawerHeaderNotDisplayed(): Promise { try { - await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(this.infoDrawerHeader)); + await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.$(this.infoDrawerHeader)); return true; } catch (error) { return false; diff --git a/lib/testing/src/lib/protractor/core/pages/login.page.ts b/lib/testing/src/lib/protractor/core/pages/login.page.ts index 5cff1769d5f..8db97e4471e 100644 --- a/lib/testing/src/lib/protractor/core/pages/login.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/login.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by, browser, protractor } from 'protractor'; +import { element, by, browser, protractor, $ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; import { LocalStorageUtil } from '../utils/local-storage.util'; @@ -25,17 +25,17 @@ export class LoginPage { loginUrl = `${browser.baseUrl}/login`; - ssoButton = element(by.css(`[data-automation-id="login-button-sso"]`)); - usernameField = element(by.id('username')); - passwordField = element(by.id('password')); - loginButton = element(by.css('input[type="submit"]')); + ssoButton = $(`[data-automation-id="login-button-sso"]`); + usernameField = $('#username'); + passwordField = $('#password'); + loginButton = $('input[type="submit"]'); header = element(by.tagName('adf-layout-header')); - loginError = element(by.css(`div[data-automation-id="login-error"]`)); - visibilityLabel = element(by.id('v')); + loginError = $(`div[data-automation-id="login-error"]`); + visibilityLabel = $('#v'); - txtUsernameBasicAuth = element(by.css('input[id="username"]')); - txtPasswordBasicAuth = element(by.css('input[id="password"]')); - signInButtonBasicAuth = element(by.id('login-button')); + txtUsernameBasicAuth = $('input[id="username"]'); + txtPasswordBasicAuth = $('input[id="password"]'); + signInButtonBasicAuth = $('#login-button'); async goToLoginPage(): Promise { let currentUrl; @@ -144,7 +144,7 @@ export class LoginPage { async displayPassword(): Promise { await BrowserActions.click(this.visibilityLabel); - const passwordInputTypeText = element(by.css(`input[name="password"][type="text"]`)); + const passwordInputTypeText = $(`input[name="password"][type="text"]`); await BrowserVisibility.waitUntilElementIsVisible(passwordInputTypeText); } diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts index e439835b388..b3a3447ffca 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/date-picker-calendar.page.ts @@ -15,26 +15,26 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { element, by, $ } from 'protractor'; import { DateUtil } from '../../utils/date-util'; import { BrowserVisibility } from '../../utils/browser-visibility'; import { BrowserActions } from '../../utils/browser-actions'; export class DatePickerCalendarPage { - datePicker = element(by.css('mat-calendar')); - nextMonthButton = element(by.css('button[class*="mat-calendar-next-button"]')); - previousMonthButton = element(by.css('button[class*="mat-calendar-previous-button"]')); - todayDate = element(by.css('.mat-calendar-body-today')); - periodButton = element(by.css('button[class*=mat-calendar-period-button]')); + datePicker = $('mat-calendar'); + nextMonthButton = $('button[class*="mat-calendar-next-button"]'); + previousMonthButton = $('button[class*="mat-calendar-previous-button"]'); + todayDate = $('.mat-calendar-body-today'); + periodButton = $('button[class*=mat-calendar-period-button]'); async getSelectedDate(): Promise { - return BrowserActions.getAttribute(element(by.css('td[class*="mat-calendar-body-active"]')), 'aria-label'); + return BrowserActions.getAttribute($('td[class*="mat-calendar-body-active"]'), 'aria-label'); } async checkDatesAfterDateAreDisabled(date): Promise { const afterDate = DateUtil.formatDate('DD-MM-YY', date, 1); - const afterCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`)); + const afterCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`); if (await afterCalendar.isPresent()) { const aria = await BrowserActions.getAttribute(afterCalendar, 'aria-disabled'); await expect(aria).toBe('true'); @@ -45,7 +45,7 @@ export class DatePickerCalendarPage { async checkDatesBeforeDateAreDisabled(date): Promise { const beforeDate = DateUtil.formatDate('DD-MM-YY', date, -1); - const beforeCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`)); + const beforeCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`); if (await beforeCalendar.isPresent()) { const aria = await BrowserActions.getAttribute(beforeCalendar, 'aria-disabled'); await expect(aria).toBe('true'); diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts index 772bcf903f7..1be822a11e3 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/date-picker.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by, ElementFinder } from 'protractor'; +import { $, ElementFinder } from 'protractor'; import { BrowserActions } from '../../utils/browser-actions'; import { DatePickerCalendarPage } from './date-picker-calendar.page'; @@ -25,8 +25,8 @@ export class DatePickerPage { dateTime = new DatePickerCalendarPage(); constructor(datePickerElement?: ElementFinder) { - const locator = by.css('.mat-datepicker-toggle'); - this.datePicker = datePickerElement ? datePickerElement : element(locator); + const locator = $('.mat-datepicker-toggle'); + this.datePicker = datePickerElement ? datePickerElement : locator; } async clickDatePicker() { diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts index 696052c1a91..f6314dd1f11 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts @@ -15,21 +15,21 @@ * limitations under the License. */ -import { Locator, element, by } from 'protractor'; +import { element, by, $, $$ } from 'protractor'; import { BrowserVisibility } from '../../utils/browser-visibility'; import { BrowserActions } from '../../utils/browser-actions'; export class DateTimePickerCalendarPage { - datePicker = element(by.css(`.mat-datetimepicker-calendar`)); - today = element(by.css(`.mat-datetimepicker-calendar-body-today`)); - timePicker = element(by.css('.mat-datetimepicker-clock')); - hourTime = element.all(by.css('.mat-datetimepicker-clock-hours .mat-datetimepicker-clock-cell')).first(); - minutesTime = element.all(by.css('.mat-datetimepicker-clock-minutes .mat-datetimepicker-clock-cell')).first(); - firstEnabledHourSelector: Locator = by.css('.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)'); - firstEnabledMinutesSelector: Locator = by.css('.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)'); - hoursPicker = element(by.css('.mat-datetimepicker-clock-hours')); - minutePicker = element(by.css('.mat-datetimepicker-clock-minutes')); + datePicker = $(`.mat-datetimepicker-calendar`); + today = $(`.mat-datetimepicker-calendar-body-today`); + timePicker = $('.mat-datetimepicker-clock'); + hourTime = $$('.mat-datetimepicker-clock-hours .mat-datetimepicker-clock-cell').first(); + minutesTime = $$('.mat-datetimepicker-clock-minutes .mat-datetimepicker-clock-cell').first(); + firstEnabledHourSelector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)'; + firstEnabledMinutesSelector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)'; + hoursPicker = $('.mat-datetimepicker-clock-hours'); + minutePicker = $('.mat-datetimepicker-clock-minutes'); async waitTillDateDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.datePicker); @@ -63,10 +63,10 @@ export class DateTimePickerCalendarPage { } async setDefaultEnabledHour(): Promise { - await BrowserActions.click(this.hoursPicker.all(this.firstEnabledHourSelector).first()); + await BrowserActions.click(this.hoursPicker.$$(this.firstEnabledHourSelector).first()); } async setDefaultEnabledMinutes() { - await BrowserActions.click(this.minutePicker.all(this.firstEnabledMinutesSelector).first()); + await BrowserActions.click(this.minutePicker.$$(this.firstEnabledMinutesSelector).first()); } } diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts index bdbbc72e68b..043dadf8d6f 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts @@ -15,20 +15,20 @@ * limitations under the License. */ -import { element, by, ElementFinder } from 'protractor'; +import { ElementFinder, $ } from 'protractor'; import { BrowserActions } from '../../utils/browser-actions'; import { DateTimePickerCalendarPage } from './date-time-picker-calendar.page'; export class DateTimePickerPage { rootElement: ElementFinder; - dateTimePicker = element(by.css('.mat-datetimepicker-toggle')); + dateTimePicker = $('.mat-datetimepicker-toggle'); dateTime = new DateTimePickerCalendarPage(); constructor(rootElement?: ElementFinder) { if (rootElement) { this.rootElement = rootElement; - this.dateTimePicker = this.rootElement.element(by.css('.mat-datetimepicker-toggle')); + this.dateTimePicker = this.rootElement.$('.mat-datetimepicker-toggle'); } } diff --git a/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts b/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts index 73a85966aab..7d1dcfe9fe8 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/dropdown.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by, ElementFinder, browser } from 'protractor'; +import { element, by, ElementFinder, browser, $$, $ } from 'protractor'; import { BrowserVisibility } from '../../utils/browser-visibility'; import { BrowserActions } from '../../utils/browser-actions'; import { Logger } from '../../utils/logger'; @@ -24,7 +24,7 @@ export class DropdownPage { dropDownElement: ElementFinder; - constructor(dropDownElement = element.all(by.css('div[class="mat-select-arrow-wrapper"]')).first()) { + constructor(dropDownElement = $$('div[class="mat-select-arrow-wrapper"]').first()) { this.dropDownElement = dropDownElement; } @@ -41,11 +41,11 @@ export class DropdownPage { } async getValue(): Promise { - return BrowserActions.getText(element(by.css('mat-form-field span'))); + return BrowserActions.getText($('mat-form-field span')); } async getNumberOfOptions(): Promise { - const dropdownOptions = element.all(by.css('.mat-select-panel mat-option')); + const dropdownOptions = $$('.mat-select-panel mat-option'); return dropdownOptions.count(); } @@ -68,11 +68,11 @@ export class DropdownPage { } async checkOptionsPanelIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('.mat-select-panel'))); + await BrowserVisibility.waitUntilElementIsVisible($('.mat-select-panel')); } async getSelectedOptionText(): Promise { - const selectedOption = this.dropDownElement.element(by.css('.mat-select-value-text span')); + const selectedOption = this.dropDownElement.$('.mat-select-value-text span'); return BrowserActions.getText(selectedOption); } diff --git a/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts b/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts index db1985efd04..2b304bb54fc 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/tabs.page.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { element, by, $$ } from 'protractor'; import { BrowserActions } from '../../utils/browser-actions'; import { BrowserVisibility } from '../../utils/browser-visibility'; export class TabsPage { - tabs = element.all(by.css("div[id*='mat-tab-label']")); + tabs = $$("div[id*='mat-tab-label']"); async clickTabByTitle(tabTitle): Promise { const tab = element(by.cssContainingText("div[id*='mat-tab-label']", tabTitle)); diff --git a/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts b/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts index 0cbb067cdaa..7b9278ce4bc 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/toggle.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, ElementFinder } from 'protractor'; +import { ElementFinder } from 'protractor'; import { BrowserActions } from '../../utils/browser-actions'; export class TogglePage { @@ -23,7 +23,7 @@ export class TogglePage { async enableToggle(toggle: ElementFinder): Promise { const check = await BrowserActions.getAttribute(toggle, 'class'); if (check.indexOf('mat-checked') < 0) { - const elem = toggle.all(by.css('input')).first(); + const elem = toggle.$$('input').first(); await BrowserActions.clickScript(elem); } } @@ -31,7 +31,7 @@ export class TogglePage { async disableToggle(toggle: ElementFinder): Promise { const check = await BrowserActions.getAttribute(toggle, 'class'); if (check.indexOf('mat-checked') >= 0) { - const elem = toggle.all(by.css('input')).first(); + const elem = toggle.$$('input').first(); await BrowserActions.clickScript(elem); } } diff --git a/lib/testing/src/lib/protractor/core/pages/notification-history.page.ts b/lib/testing/src/lib/protractor/core/pages/notification-history.page.ts index 9d23000f6d5..fd954a20546 100644 --- a/lib/testing/src/lib/protractor/core/pages/notification-history.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/notification-history.page.ts @@ -15,20 +15,20 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '../utils/browser-actions'; import { BrowserVisibility } from '../utils/browser-visibility'; export class NotificationHistoryPage { - notificationList = element(by.css('.adf-notification-history-list')); + notificationList = $('.adf-notification-history-list'); async clickNotificationButton(): Promise { await BrowserActions.clickExecuteScript('#adf-notification-history-open-button'); } async clickMarkAsRead(): Promise { - await BrowserActions.click(element(by.id('adf-notification-history-mark-as-read'))); + await BrowserActions.click($('#adf-notification-history-mark-as-read')); } async checkNotificationIsPresent(text: string): Promise { @@ -36,7 +36,7 @@ export class NotificationHistoryPage { } async checkNotificationCenterHasNewNotifications(): Promise { - const notificationListButton = element(by.css('#adf-notification-history-open-button [class*="mat-badge-active"]')); + const notificationListButton = $('#adf-notification-history-open-button [class*="mat-badge-active"]'); await BrowserVisibility.waitUntilElementIsVisible(notificationListButton); } diff --git a/lib/testing/src/lib/protractor/core/pages/pagination.page.ts b/lib/testing/src/lib/protractor/core/pages/pagination.page.ts index 0fa4f375970..1a8ad638174 100644 --- a/lib/testing/src/lib/protractor/core/pages/pagination.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/pagination.page.ts @@ -15,29 +15,29 @@ * limitations under the License. */ -import { Locator, by, element, browser } from 'protractor'; +import { by, element, browser, $, $$ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; import { Logger } from '../utils/logger'; export class PaginationPage { - pageSelectorDropDown = element(by.css('div[class*="adf-pagination__page-selector"]')); - pageSelectorArrow = element(by.css('button[data-automation-id="page-selector"]')); - itemsPerPage = element(by.css('.adf-pagination__max-items')); - itemsPerPageOpenDropdown = element(by.css('.adf-pagination__perpage-block button')); - itemsPerPageOptions: Locator = by.css('.adf-pagination__page-selector .mat-menu-item'); - currentPage = element(by.css('.adf-pagination__current-page')); - totalPages = element(by.css('.adf-pagination__total-pages')); - paginationRange = element(by.css('.adf-pagination__range')); - nextPageButton = element(by.css('button[class*="adf-pagination__next-button"]')); - nextButtonDisabled = element(by.css('button[class*="adf-pagination__next-button"][disabled]')); - previousButtonDisabled = element(by.css('button[class*="adf-pagination__previous-button"][disabled]')); - pageDropDown = element(by.css('div[class*="adf-pagination__actualinfo-block"] button')); - pageDropDownOptions: Locator = by.css('div[class*="mat-menu-content"] button'); - paginationSection = element(by.css('adf-pagination')); - paginationSectionEmpty = element(by.css('adf-pagination[class*="adf-pagination__empty"]')); - totalFiles = element(by.css('.adf-pagination__range')); + pageSelectorDropDown = $('div[class*="adf-pagination__page-selector"]'); + pageSelectorArrow = $('button[data-automation-id="page-selector"]'); + itemsPerPage = $('.adf-pagination__max-items'); + itemsPerPageOpenDropdown = $('.adf-pagination__perpage-block button'); + itemsPerPageOptions = $$('.adf-pagination__page-selector .mat-menu-item'); + currentPage = $('.adf-pagination__current-page'); + totalPages = $('.adf-pagination__total-pages'); + paginationRange = $('.adf-pagination__range'); + nextPageButton = $('button[class*="adf-pagination__next-button"]'); + nextButtonDisabled = $('button[class*="adf-pagination__next-button"][disabled]'); + previousButtonDisabled = $('button[class*="adf-pagination__previous-button"][disabled]'); + pageDropDown = $('div[class*="adf-pagination__actualinfo-block"] button'); + pageDropDownOptions = $$('div[class*="mat-menu-content"] button'); + paginationSection = $('adf-pagination'); + paginationSectionEmpty = $('adf-pagination[class*="adf-pagination__empty"]'); + totalFiles = $('.adf-pagination__range'); async selectItemsPerPage(numberOfItem: string): Promise { await BrowserActions.clickExecuteScript(`div[class*="adf-pagination__perpage-block"] button`); @@ -93,15 +93,15 @@ export class PaginationPage { } async clickOnPageDropdownOption(numberOfItemPerPage: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first()); + await BrowserVisibility.waitUntilElementIsVisible(this.pageDropDownOptions.first()); const option = element(by.cssContainingText('div[class*="mat-menu-content"] button', numberOfItemPerPage)); await BrowserActions.click(option); } async getPageDropdownOptions() { - await BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first()); + await BrowserVisibility.waitUntilElementIsVisible(this.pageDropDownOptions.first()); const initialList = []; - await element.all(this.pageDropDownOptions).each(async (currentOption) => { + await this.pageDropDownOptions.each(async (currentOption) => { const text = await BrowserActions.getText(currentOption); if (text !== '') { initialList.push(text); @@ -111,9 +111,9 @@ export class PaginationPage { } async getItemsPerPageDropdownOptions() { - await BrowserVisibility.waitUntilElementIsVisible(element.all(this.itemsPerPageOptions).first()); + await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageOptions.first()); const initialList = []; - await element.all(this.itemsPerPageOptions).each(async (currentOption) => { + await this.itemsPerPageOptions.each(async (currentOption) => { const text = await BrowserActions.getText(currentOption); if (text !== '') { initialList.push(text); diff --git a/lib/testing/src/lib/protractor/core/pages/settings.page.ts b/lib/testing/src/lib/protractor/core/pages/settings.page.ts index 753ee24cb3d..4489f3b754b 100644 --- a/lib/testing/src/lib/protractor/core/pages/settings.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/settings.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { browser, by, element } from 'protractor'; +import { $, browser, by, element } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; import { DropdownPage } from '../../core/pages/material/dropdown.page'; @@ -23,23 +23,23 @@ import { DropdownPage } from '../../core/pages/material/dropdown.page'; export class SettingsPage { settingsURL: string = browser.baseUrl + '/settings'; - ecmText = element(by.css('input[data-automation-id*="ecmHost"]')); - bpmText = element(by.css('input[data-automation-id*="bpmHost"]')); - clientIdText = element(by.css('input[id="clientId"]')); - authHostText = element(by.css('input[id="oauthHost"]')); - logoutUrlText = element(by.css('input[id="logout-url"]')); + ecmText = $('input[data-automation-id*="ecmHost"]'); + bpmText = $('input[data-automation-id*="bpmHost"]'); + clientIdText = $('input[id="clientId"]'); + authHostText = $('input[id="oauthHost"]'); + logoutUrlText = $('input[id="logout-url"]'); basicAuthRadioButton = element(by.cssContainingText('mat-radio-button[id*="mat-radio"]', 'Basic Authentication')); - identityHostText = element(by.css('input[id="identityHost"]')); + identityHostText = $('input[id="identityHost"]'); ssoRadioButton = element(by.cssContainingText('[id*="mat-radio"]', 'SSO')); - silentLoginToggleLabel = element(by.css('mat-slide-toggle[name="silentLogin"] label')); - silentLoginToggleElement = element(by.css('mat-slide-toggle[name="silentLogin"]')); - implicitFlowLabel = element(by.css('mat-slide-toggle[name="implicitFlow"] label')); - implicitFlowElement = element(by.css('mat-slide-toggle[name="implicitFlow"]')); - applyButton = element(by.css('button[data-automation-id*="host-button"]')); + silentLoginToggleLabel = $('mat-slide-toggle[name="silentLogin"] label'); + silentLoginToggleElement = $('mat-slide-toggle[name="silentLogin"]'); + implicitFlowLabel = $('mat-slide-toggle[name="implicitFlow"] label'); + implicitFlowElement = $('mat-slide-toggle[name="implicitFlow"]'); + applyButton = $('button[data-automation-id*="host-button"]'); backButton = element(by.cssContainingText('button .mat-button-wrapper', 'Back')); validationMessage = element(by.cssContainingText('mat-error', 'This field is required')); - providerDropdown = new DropdownPage(element(by.css('mat-select[id="adf-provider-selector"]'))); + providerDropdown = new DropdownPage($('mat-select[id="adf-provider-selector"]')); async goToSettingsPage(): Promise { let currentUrl; @@ -208,7 +208,7 @@ export class SettingsPage { } async checkApplyButtonIsDisabled() { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[data-automation-id*="host-button"]:disabled'))); + await BrowserVisibility.waitUntilElementIsVisible($('button[data-automation-id*="host-button"]:disabled')); } async checkProviderDropdownIsDisplayed() { diff --git a/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts b/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts index 5f06468c227..298f5fcc365 100644 --- a/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/snackbar.page.ts @@ -15,24 +15,24 @@ * limitations under the License. */ -import { Locator, element, by } from 'protractor'; +import { $, $$ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserActions } from '../utils/browser-actions'; export class SnackbarPage { - notificationSnackBar = element.all(by.css('simple-snack-bar span')).first(); - snackBarAction = element(by.css('simple-snack-bar button span')); - snackBarContainerCss: Locator = by.css('.mat-snack-bar-container'); + notificationSnackBar = $$('simple-snack-bar span').first(); + snackBarAction = $('simple-snack-bar button span'); + snackBarContainerCss = $$('.mat-snack-bar-container'); async waitForSnackBarToAppear(timeout = 5000) { - return BrowserVisibility.waitUntilElementIsVisible(element.all(this.snackBarContainerCss).first(), timeout, + return BrowserVisibility.waitUntilElementIsVisible(this.snackBarContainerCss.first(), timeout, 'snackbar did not appear' ); } async waitForSnackBarToClose(timeout = 5000) { - return BrowserVisibility.waitUntilElementIsNotVisible(element.all(this.snackBarContainerCss).first(), timeout); + return BrowserVisibility.waitUntilElementIsNotVisible(this.snackBarContainerCss.first(), timeout); } async getSnackBarMessage(): Promise { diff --git a/lib/testing/src/lib/protractor/core/pages/user-info.page.ts b/lib/testing/src/lib/protractor/core/pages/user-info.page.ts index 98910dcbe61..70910799917 100644 --- a/lib/testing/src/lib/protractor/core/pages/user-info.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/user-info.page.ts @@ -15,30 +15,30 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $, $$ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { TabsPage } from '../../core/pages/material/tabs.page'; import { BrowserActions } from '../utils/browser-actions'; export class UserInfoPage { - dialog = element.all(by.css('mat-card[class*="adf-userinfo-card"]')).first(); - userImage = element(by.css('div[id="user-initial-image"]')); - userInfoEcmHeaderTitle = element(by.css('div[id="ecm-username"]')); - userInfoEcmTitle = element(by.css('mat-card-content span[id="ecm-full-name"]')); - ecmEmail = element(by.css('span[id="ecm-email"]')); - ecmJobTitle = element(by.css('span[id="ecm-job-title"]')); - userInfoProcessHeaderTitle = element(by.css('div[id="bpm-username"]')); - userInfoProcessTitle = element(by.css('mat-card-content span[id="bpm-full-name"]')); - processEmail = element(by.css('span[id="bpm-email"]')); - processTenant = element(by.css('.detail-profile')); - apsImage = element(by.css('img[id="bpm-user-detail-image"]')); - acsImage = element(by.css('img[id="ecm-user-detail-image"]')); - initialImage = element.all(by.css('div[id="user-initials-image"]')).first(); - userInfoSsoHeaderTitle = this.dialog.element(by.css('div[id="identity-username"]')); - userInfoSsoTitle = element(by.css('.adf-userinfo__detail-title')); - ssoEmail = element(by.id('identity-email')); - userProfileButton = element(by.css('button[data-automation-id="adf-user-profile"]')); + dialog = $$('mat-card[class*="adf-userinfo-card"]').first(); + userImage = $('div[id="user-initial-image"]'); + userInfoEcmHeaderTitle = $('div[id="ecm-username"]'); + userInfoEcmTitle = $('mat-card-content span[id="ecm-full-name"]'); + ecmEmail = $('span[id="ecm-email"]'); + ecmJobTitle = $('span[id="ecm-job-title"]'); + userInfoProcessHeaderTitle = $('div[id="bpm-username"]'); + userInfoProcessTitle = $('mat-card-content span[id="bpm-full-name"]'); + processEmail = $('span[id="bpm-email"]'); + processTenant = $('.detail-profile'); + apsImage = $('img[id="bpm-user-detail-image"]'); + acsImage = $('img[id="ecm-user-detail-image"]'); + initialImage = $$('div[id="user-initials-image"]').first(); + userInfoSsoHeaderTitle = this.dialog.$('div[id="identity-username"]'); + userInfoSsoTitle = $('.adf-userinfo__detail-title'); + ssoEmail = $('#identity-email'); + userProfileButton = $('button[data-automation-id="adf-user-profile"]'); tabsPage = new TabsPage(); async dialogIsDisplayed(): Promise { diff --git a/lib/testing/src/lib/protractor/core/pages/viewer.page.ts b/lib/testing/src/lib/protractor/core/pages/viewer.page.ts index 885370ad2b6..7ae7b855246 100644 --- a/lib/testing/src/lib/protractor/core/pages/viewer.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/viewer.page.ts @@ -19,7 +19,7 @@ import { BrowserActions } from '../utils/browser-actions'; import { TabsPage } from './material/tabs.page'; import { TogglePage } from './material/toggle.page'; import { BrowserVisibility } from '../utils/browser-visibility'; -import { element, by, browser, protractor } from 'protractor'; +import { element, by, browser, protractor, $, $$ } from 'protractor'; import { Logger } from '../utils/logger'; export class ViewerPage { @@ -29,88 +29,88 @@ export class ViewerPage { tabsPage = new TabsPage(); togglePage = new TogglePage(); - closeButton = element(by.css('button[data-automation-id="adf-toolbar-back"]')); - fileName = element(by.id('adf-viewer-display-name')); - infoButton = element(by.css('button[data-automation-id="adf-toolbar-sidebar"]')); - leftSideBarButton = element(by.css('button[data-automation-id="adf-toolbar-left-sidebar"]')); - previousPageButton = element(by.id('viewer-previous-page-button')); - nextPageButton = element(by.id('viewer-next-page-button')); - zoomInButton = element(by.id('viewer-zoom-in-button')); - zoomOutButton = element(by.id('viewer-zoom-out-button')); - scalePageButton = element(by.id('viewer-scale-page-button')); - fullScreenButton = element(by.css('button[data-automation-id="adf-toolbar-fullscreen"]')); - rotateLeft = element(by.css('button[id="viewer-rotate-left-button"]')); - rotateRight = element(by.css('button[id="viewer-rotate-right-button"]')); - scaleImg = element(by.css('button[id="viewer-reset-button"]')); - fileThumbnail = element(by.css('img[data-automation-id="adf-file-thumbnail"]')); - pageSelectorInput = element(by.css('input[data-automation-id="adf-page-selector"]')); - imgContainer = element(by.css('div[data-automation-id="adf-image-container"]')); - mediaContainer = element(by.css('.adf-media-player')); - percentage = element(by.css('div[data-automation-id="adf-page-scale"')); - thumbnailsBtn = element(by.css('button[data-automation-id="adf-thumbnails-button"]')); - thumbnailsContent = element(by.css('div[data-automation-id="adf-thumbnails-content"]')); - thumbnailsClose = element(by.css('button[data-automation-id="adf-thumbnails-close"]')); - secondThumbnail = element(by.css('adf-pdf-thumb > img[title="Page 2"')); - lastThumbnailDisplayed = element.all(by.css('adf-pdf-thumb')).last(); - passwordDialog = element(by.css('adf-pdf-viewer-password-dialog')); - passwordSubmit = element(by.css('button[data-automation-id="adf-password-dialog-submit"]')); - passwordDialogClose = element(by.css('button[data-automation-id="adf-password-dialog-close"]')); - passwordSubmitDisabled = element(by.css('button[data-automation-id="adf-password-dialog-submit"][disabled]')); - passwordInput = element(by.css('input[data-automation-id="adf-password-dialog-input"]')); - passwordError = element(by.css('mat-error[data-automation-id="adf-password-dialog-error"]')); - infoSideBar = element(by.id('adf-right-sidebar')); - leftSideBar = element(by.id('adf-left-sidebar')); - viewer = element(by.css('adf-viewer')); - pdfViewer = element(by.css('adf-pdf-viewer')); - imgViewer = element(by.css('adf-img-viewer')); - activeTab = element(by.css('div[class*="mat-tab-label-active"]')); - toolbarSwitch = element(by.id('adf-switch-toolbar')); - toolbar = element(by.id('adf-viewer-toolbar')); - lastButton = element.all(by.css('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]')).last(); - goBackSwitch = element(by.id('adf-switch-goback')); - canvasLayer = element.all(by.css('.canvasWrapper > canvas')).first(); - - openWithSwitch = element(by.id('adf-switch-openwith')); - openWith = element(by.id('adf-viewer-openwith')); - - moreActionsMenuSwitch = element(by.id('adf-switch-moreactionsmenu')); - moreActionsMenu = element(by.css('button[data-automation-id="adf-toolbar-more-actions"]')); - - customNameSwitch = element(by.id('adf-switch-custoname')); - customToolbarToggle = element(by.id('adf-toggle-custom-toolbar')); - customToolbar = element(by.css('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]')); - - showRightSidebarSwitch = element(by.id('adf-switch-showrightsidebar')); - showLeftSidebarSwitch = element(by.id('adf-switch-showleftsidebar')); - - moreActionsSwitch = element(by.id('adf-switch-moreactions')); - pdfPageLoaded = element(by.css('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer')); - - downloadSwitch = element(by.id('adf-switch-download')); - downloadButton = element(by.id('adf-viewer-download')); - - printSwitch = element(by.id('adf-switch-print')); - printButton = element(by.id('adf-viewer-print')); - - allowSidebarSwitch = element(by.id('adf-switch-allowsidebar')); - allowLeftSidebarSwitch = element(by.id('adf-switch-allowLeftSidebar')); - - uploadButton = element(by.id('adf-viewer-upload')); - timeButton = element(by.id('adf-viewer-time')); - bugButton = element(by.id('adf-viewer-bug')); - - codeViewer = element(by.id('adf-monaco-file-editor')); - - showTabWithIconSwitch = element(by.id('adf-tab-with-icon')); - showTabWithIconAndLabelSwitch = element(by.id('adf-icon-and-label-tab')); - unknownFormat = element(by.css(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`)); + closeButton = $('button[data-automation-id="adf-toolbar-back"]'); + fileName = $('#adf-viewer-display-name'); + infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]'); + leftSideBarButton = $('button[data-automation-id="adf-toolbar-left-sidebar"]'); + previousPageButton = $('#viewer-previous-page-button'); + nextPageButton = $('#viewer-next-page-button'); + zoomInButton = $('#viewer-zoom-in-button'); + zoomOutButton = $('#viewer-zoom-out-button'); + scalePageButton = $('#viewer-scale-page-button'); + fullScreenButton = $('button[data-automation-id="adf-toolbar-fullscreen"]'); + rotateLeft = $('button[id="viewer-rotate-left-button"]'); + rotateRight = $('button[id="viewer-rotate-right-button"]'); + scaleImg = $('button[id="viewer-reset-button"]'); + fileThumbnail = $('img[data-automation-id="adf-file-thumbnail"]'); + pageSelectorInput = $('input[data-automation-id="adf-page-selector"]'); + imgContainer = $('div[data-automation-id="adf-image-container"]'); + mediaContainer = $('.adf-media-player'); + percentage = $('div[data-automation-id="adf-page-scale"'); + thumbnailsBtn = $('button[data-automation-id="adf-thumbnails-button"]'); + thumbnailsContent = $('div[data-automation-id="adf-thumbnails-content"]'); + thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]'); + secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"'); + lastThumbnailDisplayed = $$('adf-pdf-thumb').last(); + passwordDialog = $('adf-pdf-viewer-password-dialog'); + passwordSubmit = $('button[data-automation-id="adf-password-dialog-submit"]'); + passwordDialogClose = $('button[data-automation-id="adf-password-dialog-close"]'); + passwordSubmitDisabled = $('button[data-automation-id="adf-password-dialog-submit"][disabled]'); + passwordInput = $('input[data-automation-id="adf-password-dialog-input"]'); + passwordError = $('mat-error[data-automation-id="adf-password-dialog-error"]'); + infoSideBar = $('#adf-right-sidebar'); + leftSideBar = $('#adf-left-sidebar'); + viewer = $('adf-viewer'); + pdfViewer = $('adf-pdf-viewer'); + imgViewer = $('adf-img-viewer'); + activeTab = $('div[class*="mat-tab-label-active"]'); + toolbarSwitch = $('#adf-switch-toolbar'); + toolbar = $('#adf-viewer-toolbar'); + lastButton = $$('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]').last(); + goBackSwitch = $('#adf-switch-goback'); + canvasLayer = $$('.canvasWrapper > canvas').first(); + + openWithSwitch = $('#adf-switch-openwith'); + openWith = $('#adf-viewer-openwith'); + + moreActionsMenuSwitch = $('#adf-switch-moreactionsmenu'); + moreActionsMenu = $('button[data-automation-id="adf-toolbar-more-actions"]'); + + customNameSwitch = $('#adf-switch-custoname'); + customToolbarToggle = $('#adf-toggle-custom-toolbar'); + customToolbar = $('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]'); + + showRightSidebarSwitch = $('#adf-switch-showrightsidebar'); + showLeftSidebarSwitch = $('#adf-switch-showleftsidebar'); + + moreActionsSwitch = $('#adf-switch-moreactions'); + pdfPageLoaded = $('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer'); + + downloadSwitch = $('#adf-switch-download'); + downloadButton = $('#adf-viewer-download'); + + printSwitch = $('#adf-switch-print'); + printButton = $('#adf-viewer-print'); + + allowSidebarSwitch = $('#adf-switch-allowsidebar'); + allowLeftSidebarSwitch = $('#adf-switch-allowLeftSidebar'); + + uploadButton = $('#adf-viewer-upload'); + timeButton = $('#adf-viewer-time'); + bugButton = $('#adf-viewer-bug'); + + codeViewer = $('#adf-monaco-file-editor'); + + showTabWithIconSwitch = $('#adf-tab-with-icon'); + showTabWithIconAndLabelSwitch = $('#adf-icon-and-label-tab'); + unknownFormat = $(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`); async checkCodeViewerIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.codeViewer); } async viewFile(fileName: string): Promise { - const fileView = element.all(by.css(`#document-list-container div[data-automation-id="${fileName}"]`)).first(); + const fileView = $$(`#document-list-container div[data-automation-id="${fileName}"]`).first(); await BrowserActions.click(fileView); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); await this.waitTillContentLoaded(); @@ -208,7 +208,7 @@ export class ViewerPage { } async checkCurrentThumbnailIsSelected(): Promise { - const selectedThumbnail = element(by.css('adf-pdf-thumb.adf-pdf-thumbnails__thumb.adf-pdf-thumbnails__thumb--selected > img')); + const selectedThumbnail = $('adf-pdf-thumb.adf-pdf-thumbnails__thumb.adf-pdf-thumbnails__thumb--selected > img'); const pageNumber = await BrowserActions.getInputValue(this.pageSelectorInput); await expect('Page ' + pageNumber).toEqual(await BrowserActions.getAttribute(selectedThumbnail, 'title')); @@ -223,7 +223,7 @@ export class ViewerPage { } async checkThumbnailsBtnIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[data-automation-id="adf-thumbnails-button"]:disabled'))); + await BrowserVisibility.waitUntilElementIsVisible($('button[data-automation-id="adf-thumbnails-button"]:disabled')); } async checkThumbnailsContentIsDisplayed(): Promise { @@ -311,8 +311,8 @@ export class ViewerPage { async checkFileContent(pageNumber: string, text: string): Promise { const allPages = this.canvasLayer; - const pageLoaded = element.all(by.css('div[data-page-number="' + pageNumber + '"][data-loaded="true"]')).first(); - const textLayerLoaded = element.all(by.css('div[data-page-number="' + pageNumber + '"] .textLayer')).first(); + const pageLoaded = $$('div[data-page-number="' + pageNumber + '"][data-loaded="true"]').first(); + const textLayerLoaded = $$('div[data-page-number="' + pageNumber + '"] .textLayer').first(); const specificText = element.all(by.cssContainingText('div[data-page-number="' + pageNumber + '"] .textLayer', text)).first(); await BrowserVisibility.waitUntilElementIsVisible(allPages); @@ -375,7 +375,7 @@ export class ViewerPage { } async clickInfoButton(): Promise { - await BrowserActions.click(element(by.css('button[data-automation-id="adf-toolbar-sidebar"]'))); + await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]')); } async clickOnTab(tabName: string): Promise { @@ -630,39 +630,39 @@ export class ViewerPage { } async enterCustomName(text: string): Promise { - const textField = element(by.css('input[data-automation-id="adf-text-custom-name"]')); + const textField = $('input[data-automation-id="adf-text-custom-name"]'); await BrowserActions.clearSendKeys(textField, text); } async disableOverlay(): Promise { - await this.togglePage.disableToggle(element(by.id('adf-viewer-overlay'))); + await this.togglePage.disableToggle($('#adf-viewer-overlay')); } async checkOverlayViewerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('div[class*="adf-viewer-overlay-container"]'))); + await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-overlay-container"]')); } async checkInlineViewerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('div[class*="adf-viewer-inline-container"]'))); + await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-inline-container"]')); } async checkTabHasNoIcon(index: number): Promise { - const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`)); + const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`); await BrowserVisibility.waitUntilElementIsNotVisible(tab); } async checkTabHasNoLabel(index: number): Promise { - const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`)); + const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`); await BrowserVisibility.waitUntilElementIsNotVisible(tab); } async getTabLabelById(index: number): Promise { - const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`)); + const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`); return BrowserActions.getText(tab); } async getTabIconById(index: number): Promise { - const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`)); + const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`); return BrowserActions.getText(tab); } @@ -671,7 +671,7 @@ export class ViewerPage { } async getUnknownFormatMessage(): Promise { - const unknownFormatLabel = this.unknownFormat.element(by.css(`.adf-viewer__unknown-label`)); + const unknownFormatLabel = this.unknownFormat.$(`.adf-viewer__unknown-label`); return BrowserActions.getText(unknownFormatLabel); } diff --git a/lib/testing/src/lib/protractor/core/test-element.ts b/lib/testing/src/lib/protractor/core/test-element.ts index f420294be6e..af1b8cc78e4 100644 --- a/lib/testing/src/lib/protractor/core/test-element.ts +++ b/lib/testing/src/lib/protractor/core/test-element.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element, ElementFinder, protractor } from 'protractor'; +import { by, element, ElementFinder, protractor, $ } from 'protractor'; import { BrowserActions } from './utils/browser-actions'; import { BrowserVisibility } from './utils/browser-visibility'; @@ -39,7 +39,7 @@ export class TestElement { * @param selector The CSS class name to lookup */ static byCss(selector: string): TestElement { - return new TestElement(element(by.css(selector))); + return new TestElement($(selector)); } /** diff --git a/lib/testing/src/lib/protractor/core/utils/browser-actions.ts b/lib/testing/src/lib/protractor/core/utils/browser-actions.ts index 6d947127130..1cb63c150ec 100644 --- a/lib/testing/src/lib/protractor/core/utils/browser-actions.ts +++ b/lib/testing/src/lib/protractor/core/utils/browser-actions.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { browser, by, element, ElementArrayFinder, ElementFinder, protractor } from 'protractor'; +import { browser, by, element, ElementArrayFinder, ElementFinder, protractor, $ } from 'protractor'; import { BrowserVisibility } from '../utils/browser-visibility'; import { Logger } from './logger'; @@ -68,7 +68,7 @@ export class BrowserActions { static async clickExecuteScript(elementCssSelector: string): Promise { Logger.info(`Click execute script ${elementCssSelector}`); - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(elementCssSelector))); + await BrowserVisibility.waitUntilElementIsVisible($(elementCssSelector)); await browser.executeScript(`document.querySelector('${elementCssSelector}').click();`); } @@ -195,7 +195,7 @@ export class BrowserActions { static async closeMenuAndDialogs(): Promise { Logger.info(`Close Menu And Dialogs`); - const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing')); + const container = $('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'); await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await BrowserVisibility.waitUntilElementIsNotVisible(container, 1000); } diff --git a/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts b/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts index 14093de5ce6..d9cf395e087 100644 --- a/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts +++ b/lib/testing/src/lib/protractor/core/utils/browser-visibility.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { browser, by, element, ElementFinder, protractor, until } from 'protractor'; +import { browser, ElementFinder, protractor, until, $ } from 'protractor'; import { Logger } from './logger'; import { falseIfMissing } from 'protractor/built/util'; @@ -120,7 +120,7 @@ export class BrowserVisibility { static async waitUntilDialogIsClose(): Promise { Logger.info(`Wait Until dialog close`); - const dialog = element(by.css('mat-dialog-container')); + const dialog = $('mat-dialog-container'); await this.waitUntilElementIsNotPresent(dialog); } diff --git a/lib/testing/src/lib/protractor/core/utils/protractor.util.ts b/lib/testing/src/lib/protractor/core/utils/protractor.util.ts index 050465bf5d3..92b255baede 100644 --- a/lib/testing/src/lib/protractor/core/utils/protractor.util.ts +++ b/lib/testing/src/lib/protractor/core/utils/protractor.util.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ElementFinder, browser, by } from 'protractor'; +import { ElementFinder, browser } from 'protractor'; /** * Tagged template to convert a sting to an `ElementFinder`. @@ -28,5 +28,5 @@ export function byCss( ...placeholders: string[] ): ElementFinder { const selector = literals[0] || placeholders[0]; - return browser.element(by.css(selector)); + return browser.$(selector); } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts index 52f46cf0429..ff5d5f055e7 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/app/app-list-cloud.page.ts @@ -15,16 +15,18 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $$, $, ElementFinder } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; export class AppListCloudPage { - apsAppsContainer = element(by.css('adf-cloud-app-list')); - allApps = element.all(by.css('adf-cloud-app-details')); - nameOfAllApps = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1')); - firstApp = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1')).first(); + apsAppsContainer = $('adf-cloud-app-list'); + allApps = $$('adf-cloud-app-details'); + nameOfAllApps = $$('adf-cloud-app-details div[class*="item-card-title"] h1'); + firstApp = $$('adf-cloud-app-details div[class*="item-card-title"] h1').first(); + + getAppNameLocatorByAppName = (appName: string): ElementFinder => $(`mat-card[title="${appName}"]`); async checkApsContainer(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer); @@ -44,12 +46,12 @@ export class AppListCloudPage { } async checkAppIsNotDisplayed(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getAppNameLocatorByAppName(applicationName); await BrowserVisibility.waitUntilElementIsNotVisible(app); } async checkAppIsDisplayed(applicationName: string): Promise { - const app = element(by.css('mat-card[title="' + applicationName + '"]')); + const app = this.getAppNameLocatorByAppName(applicationName); await BrowserVisibility.waitUntilElementIsVisible(app); } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts index 203655fa153..e8da62a341e 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-process-filter-dialog.page.ts @@ -15,39 +15,39 @@ * limitations under the License. */ -import { Locator, browser, by, element } from 'protractor'; +import { browser, $ } from 'protractor'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { BrowserActions } from '../../../core/utils/browser-actions'; export class EditProcessFilterDialogPage { - componentElement = element(by.css('adf-cloud-process-filter-dialog-cloud')); - title = element(by.id('adf-process-filter-dialog-title')); - filterNameInput = element(by.id('adf-filter-name-id')); - saveButtonLocator: Locator = by.id('adf-save-button-id'); - cancelButtonLocator: Locator = by.id('adf-cancel-button-id'); + componentElement = $('adf-cloud-process-filter-dialog-cloud'); + title = $('#adf-process-filter-dialog-title'); + filterNameInput = $('#adf-filter-name-id'); + saveButtonLocator = '#adf-save-button-id'; + cancelButtonLocator = '#adf-cancel-button-id'; async clickOnSaveButton(): Promise { - const saveButton = this.componentElement.element(this.saveButtonLocator); + const saveButton = this.componentElement.$(this.saveButtonLocator); await BrowserActions.click(saveButton); await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); await browser.driver.sleep(1000); } async checkSaveButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator)); + await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.saveButtonLocator)); return this.componentElement.element(this.saveButtonLocator).isEnabled(); } async clickOnCancelButton(): Promise { - const cancelButton = this.componentElement.element(this.cancelButtonLocator); + const cancelButton = this.componentElement.$(this.cancelButtonLocator); await BrowserActions.click(cancelButton); await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); } async checkCancelButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator)); - return this.componentElement.element(this.cancelButtonLocator).isEnabled(); + await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.cancelButtonLocator)); + return this.componentElement.$(this.cancelButtonLocator).isEnabled(); } async getFilterName(): Promise { diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts index 755f5927625..dd8b7b1270c 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/dialog/edit-task-filter-dialog.page.ts @@ -15,39 +15,39 @@ * limitations under the License. */ -import { browser, by, element, Locator } from 'protractor'; +import { $, browser } from 'protractor'; import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { BrowserActions } from '../../../core/utils/browser-actions'; export class EditTaskFilterDialogPage { - componentElement = element(by.css('adf-cloud-task-filter-dialog')); - title = element(by.id('adf-task-filter-dialog-title')); - filterNameInput = element(by.id('adf-filter-name-id')); - saveButtonLocator: Locator = by.id('adf-save-button-id'); - cancelButtonLocator: Locator = by.id('adf-cancel-button-id'); + componentElement = $('adf-cloud-task-filter-dialog'); + title = $('#adf-task-filter-dialog-title'); + filterNameInput = $('#adf-filter-name-id'); + saveButtonLocator = '#adf-save-button-id'; + cancelButtonLocator = '#adf-cancel-button-id'; async clickOnSaveButton(): Promise { - const saveButton = this.componentElement.element(this.saveButtonLocator); + const saveButton = this.componentElement.$(this.saveButtonLocator); await BrowserActions.click(saveButton); await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); await browser.driver.sleep(1000); } async checkSaveButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator)); - return this.componentElement.element(this.saveButtonLocator).isEnabled(); + await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.saveButtonLocator)); + return this.componentElement.$(this.saveButtonLocator).isEnabled(); } async clickOnCancelButton(): Promise { - const cancelButton = this.componentElement.element(this.cancelButtonLocator); + const cancelButton = this.componentElement.$(this.cancelButtonLocator); await BrowserActions.click(cancelButton); await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement); } async checkCancelButtonIsEnabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator)); - return this.componentElement.element(this.cancelButtonLocator).isEnabled(); + await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.cancelButtonLocator)); + return this.componentElement.$(this.cancelButtonLocator).isEnabled(); } async getFilterName(): Promise { diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts index b00d25a2df5..7a8815bc2f8 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-process-filter-cloud-component.page.ts @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { browser, by, element } from 'protractor'; +import { browser, $$, $ } from 'protractor'; import { EditProcessFilterDialogPage } from './dialog/edit-process-filter-dialog.page'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; @@ -34,26 +34,25 @@ export interface FilterProps { export class EditProcessFilterCloudComponentPage { - rootElement = element.all(by.css('adf-cloud-edit-process-filter')).first(); - customiseFilter = element(by.id('adf-edit-process-filter-sub-title-id')); - saveButton = element(by.css('button[data-automation-id="adf-filter-action-save"]')); - saveAsButton = element(by.css('button[data-automation-id="adf-filter-action-saveAs"]')); - deleteButton = element(by.css('button[data-automation-id="adf-filter-action-delete"]')); - filter = element(by.css(`adf-cloud-edit-process-filter mat-expansion-panel-header`)); - - private locatorAppNameDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`)); - private locatorStatusDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`)); - private locatorSortDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`)); - private locatorOrderDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`)); - private locatorProcessDefinitionNameDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`)); - private locatorSuspendedDateRangeDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`)); - private locatorStartedDateRangeDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`)); - private locatorCompletedDateRangeDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`)); - - private locatorSuspendedDateRangeWithin = element(by.css(`mat-datepicker-toggle[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`)); - - private expansionPanelExtended = this.rootElement.element(by.css('mat-expansion-panel-header.mat-expanded')); - private content = this.rootElement.element(by.css('div.mat-expansion-panel-content[style*="visible"]')); + rootElement = $$('adf-cloud-edit-process-filter').first(); + customiseFilter = $('#adf-edit-process-filter-sub-title-id'); + saveButton = $('button[data-automation-id="adf-filter-action-save"]'); + saveAsButton = $('button[data-automation-id="adf-filter-action-saveAs"]'); + deleteButton = $('button[data-automation-id="adf-filter-action-delete"]'); + filter = $(`adf-cloud-edit-process-filter mat-expansion-panel-header`); + + private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`); + private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`); + private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`); + private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`); + private locatorProcessDefinitionNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`); + private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded'); + private locatorSuspendedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`); + private locatorStartedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`); + private locatorCompletedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`); + + private locatorSuspendedDateRangeWithin = $(`mat-datepicker-toggle[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`); + private content = this.rootElement.$('div.mat-expansion-panel-content[style*="visible"]'); appNameDropdown = new DropdownPage(this.locatorAppNameDropdown); statusDropdown = new DropdownPage(this.locatorStatusDropdown); @@ -104,7 +103,7 @@ export class EditProcessFilterCloudComponentPage { } getStateFilterDropDownValue(): Promise { - return BrowserActions.getText(element(by.css("mat-form-field[data-automation-id='status'] span"))); + return BrowserActions.getText($("mat-form-field[data-automation-id='status'] span")); } async setSortFilterDropDown(option) { @@ -112,7 +111,7 @@ export class EditProcessFilterCloudComponentPage { } async getSortFilterDropDownValue(): Promise { - const sortLocator = element.all(by.css("mat-form-field[data-automation-id='sort'] span")).first(); + const sortLocator = $$("mat-form-field[data-automation-id='sort'] span").first(); return BrowserActions.getText(sortLocator); } @@ -122,7 +121,7 @@ export class EditProcessFilterCloudComponentPage { } getOrderFilterDropDownValue(): Promise { - return BrowserActions.getText(element(by.css("mat-form-field[data-automation-id='order'] span"))); + return BrowserActions.getText($("mat-form-field[data-automation-id='order'] span")); } async setAppNameDropDown(option: string) { @@ -151,12 +150,12 @@ export class EditProcessFilterCloudComponentPage { } async getApplicationSelected(): Promise { - const applicationDropdown = element(by.css(`[data-automation-id='adf-cloud-edit-process-property-appName']`)); + const applicationDropdown = $(`[data-automation-id='adf-cloud-edit-process-property-appName']`); return applicationDropdown.getText(); } async checkAppNamesAreUnique(): Promise { - const appNameList = element.all(by.css('mat-option[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span')); + const appNameList = $$('mat-option[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span'); const appTextList: any = await appNameList.getText(); const uniqueArray = appTextList.filter((appName) => { const sameAppNameArray = appTextList.filter((eachApp) => eachApp === appName); @@ -171,7 +170,7 @@ export class EditProcessFilterCloudComponentPage { } isApplicationListLoaded(): Promise { - const emptyList = element(by.css(`[data-automation-id='adf-cloud-edit-process-property-appName'] .mat-select-placeholder`)); + const emptyList = $(`[data-automation-id='adf-cloud-edit-process-property-appName'] .mat-select-placeholder`); return BrowserVisibility.waitUntilElementIsNotVisible(emptyList); } @@ -196,12 +195,12 @@ export class EditProcessFilterCloudComponentPage { } async getProperty(property: string): Promise { - const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first(); + const locator = $$('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]').first(); return BrowserActions.getInputValue(locator); } - async setProperty(property: string, option: string) { - const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first(); + async setProperty(property: string, option: string): Promise { + const locator = $$('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]').first(); await BrowserVisibility.waitUntilElementIsVisible(locator); await BrowserActions.clearSendKeys(locator, option); } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts index 17758f04287..7d4442d8d01 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/edit-task-filter-cloud-component.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { browser, by, element, protractor, ElementFinder } from 'protractor'; +import { browser, protractor, ElementFinder, $$, $ } from 'protractor'; import { EditTaskFilterDialogPage } from './dialog/edit-task-filter-dialog.page'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; @@ -28,31 +28,31 @@ export type StatusType = 'All' | 'Created' | 'Assigned' | 'Cancelled' | 'Suspend export class EditTaskFilterCloudComponentPage { - rootElement = element.all(by.css('adf-cloud-edit-task-filter')).first(); - customiseFilter = element(by.id('adf-edit-task-filter-sub-title-id')); - assignee = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-assignee"]')); - priority = element(by.css('[data-automation-id="adf-cloud-edit-task-property-priority"]')); - taskName = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskName"]')); - id = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskId"]')); - processDefinitionId = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-processDefinitionId"]')); - processInstanceId = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]')); - lastModifiedFrom = element(by.css('input[data-placeholder="LastModifiedFrom"]')); - lastModifiedTo = element(by.css('input[data-placeholder="LastModifiedTo"]')); - parentTaskId = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-parentTaskId"]')); - owner = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-owner"]')); - saveButton = element(by.css('[data-automation-id="adf-filter-action-save"]')); - saveAsButton = element(by.css('[data-automation-id="adf-filter-action-saveAs"]')); - deleteButton = element(by.css('[data-automation-id="adf-filter-action-delete"]')); - filter = element(by.css(`adf-cloud-edit-task-filter mat-expansion-panel-header`)); - - private locatorAppNameDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`)); - private locatorStatusDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`)); - private locatorSortDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`)); - private locatorOrderDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`)); - private locatorCompletedDateDropdown = element(by.css(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`)); - private locatorAssignmentDropdown = element(by.css(`.adf-task-assignment-filter`)); - private expansionPanelExtended = this.rootElement.element(by.css('mat-expansion-panel-header.mat-expanded')); - private content = this.rootElement.element(by.css('div.mat-expansion-panel-content[style*="visible"]')); + rootElement = $$('adf-cloud-edit-task-filter').first(); + customiseFilter = $('#adf-edit-task-filter-sub-title-id'); + assignee = $('input[data-automation-id="adf-cloud-edit-task-property-assignee"]'); + priority = $('[data-automation-id="adf-cloud-edit-task-property-priority"]'); + taskName = $('input[data-automation-id="adf-cloud-edit-task-property-taskName"]'); + id = $('input[data-automation-id="adf-cloud-edit-task-property-taskId"]'); + processDefinitionId = $('input[data-automation-id="adf-cloud-edit-task-property-processDefinitionId"]'); + processInstanceId = $('input[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]'); + lastModifiedFrom = $('input[data-placeholder="LastModifiedFrom"]'); + lastModifiedTo = $('input[data-placeholder="LastModifiedTo"]'); + parentTaskId = $('input[data-automation-id="adf-cloud-edit-task-property-parentTaskId"]'); + owner = $('input[data-automation-id="adf-cloud-edit-task-property-owner"]'); + saveButton = $('[data-automation-id="adf-filter-action-save"]'); + saveAsButton = $('[data-automation-id="adf-filter-action-saveAs"]'); + deleteButton = $('[data-automation-id="adf-filter-action-delete"]'); + filter = $(`adf-cloud-edit-task-filter mat-expansion-panel-header`); + + private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`); + private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`); + private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`); + private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`); + private locatorCompletedDateDropdown = $(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`); + private locatorAssignmentDropdown = $(`.adf-task-assignment-filter`); + private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded'); + private content = this.rootElement.$('div.mat-expansion-panel-content[style*="visible"]'); appNameDropdown = new DropdownPage(this.locatorAppNameDropdown); statusDropdown = new DropdownPage(this.locatorStatusDropdown); @@ -66,7 +66,7 @@ export class EditTaskFilterCloudComponentPage { peopleCloudComponent = new PeopleCloudComponentPage(); groupCloudComponent = new GroupCloudComponentPage(); - dataTable = new DataTableComponentPage( element(by.css('adf-cloud-task-list'))); + dataTable = new DataTableComponentPage( $('adf-cloud-task-list')); editTaskFilterDialog(): EditTaskFilterDialogPage { return this.editTaskFilterDialogPage; @@ -275,7 +275,7 @@ export class EditTaskFilterCloudComponentPage { } async setProperty(property: string, option: string): Promise { - const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]')); + const locator = $('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]'); await BrowserVisibility.waitUntilElementIsVisible(locator); await locator.clear(); await locator.sendKeys(option); diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/form-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/form-cloud-component.page.ts index 7d5d37d2f9c..aa8be66a729 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/form-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/form-cloud-component.page.ts @@ -15,15 +15,15 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $$, $ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { ConfigEditorPage } from '../../core/pages/config-editor-page'; export class FormCloudComponentPage { - formCloudEditor = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1); - formCloudRender = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0); + formCloudEditor = $$('.mat-tab-list .mat-tab-label').get(1); + formCloudRender = $$('.mat-tab-list .mat-tab-label').get(0); configEditorPage = new ConfigEditorPage(); @@ -36,8 +36,8 @@ export class FormCloudComponentPage { } async setConfigToEditor(text): Promise { - const configEditor = element(by.id('adf-form-config-editor')); - const form = element(by.css('adf-cloud-form')); + const configEditor = $('#adf-form-config-editor'); + const form = $('adf-cloud-form'); await this.goToEditor(); await BrowserVisibility.waitUntilElementIsVisible(configEditor); await this.configEditorPage.enterBulkConfiguration(text); diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts index 62605a4b54a..c3f4c06bf24 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/form/widget/attach-file-widget-cloud.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Locator, element, by, ElementFinder, browser } from 'protractor'; +import { by, ElementFinder, browser, $ } from 'protractor'; import { BrowserActions } from '../../../../core/utils/browser-actions'; import { Logger } from '../../../../core/utils/logger'; import { BrowserVisibility } from '../../../../core/utils/browser-visibility'; @@ -23,33 +23,37 @@ import { BrowserVisibility } from '../../../../core/utils/browser-visibility'; export class AttachFileWidgetCloudPage { widget: ElementFinder; - filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]'); constructor(fieldId: string) { this.assignWidget(fieldId); } + getFileAttachedLocatorByContainingText = async(text: string): Promise => { + const filesListLocator = 'div[id="adf-attach-widget-readonly-list"]'; + return this.widget.$(filesListLocator).element(by.cssContainingText('mat-list-item span ', text)); + } + assignWidget(fieldId: string): void { - this.widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`)); + this.widget = $(`adf-form-field div[id='field-${fieldId}-container']`); } async clickAttachContentFile(fileId: string): Promise { - const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`)); + const uploadButton = this.widget.$(`button[id=${fileId}]`); await BrowserActions.click(uploadButton); } async checkUploadContentButtonIsDisplayed(fileId: string): Promise { - const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`)); + const uploadButton = this.widget.$(`button[id=${fileId}]`); await BrowserVisibility.waitUntilElementIsVisible(uploadButton); } async checkUploadContentButtonIsNotDisplayed(fileId: string): Promise { - const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`)); + const uploadButton = this.widget.$(`button[id=${fileId}]`); await BrowserVisibility.waitUntilElementIsNotVisible(uploadButton); } async checkFileIsAttached(name): Promise { - const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + const fileAttached = await this.getFileAttachedLocatorByContainingText(name); await BrowserVisibility.waitUntilElementIsVisible(fileAttached); } @@ -60,12 +64,12 @@ export class AttachFileWidgetCloudPage { } async checkFileIsNotAttached(name): Promise { - const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + const fileAttached = await this.getFileAttachedLocatorByContainingText(name); await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached); } async getFileId(name: string): Promise { - const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); + const fileAttached = await this.getFileAttachedLocatorByContainingText(name); return BrowserActions.getAttribute(fileAttached, 'id'); } @@ -74,11 +78,11 @@ export class AttachFileWidgetCloudPage { await BrowserActions.closeMenuAndDialogs(); const fileId = await this.getFileId(fileName); Logger.info(`FileId ${fileId}`); - const optionMenu = this.widget.element(by.css(`button[id='${fileId}-option-menu']`)); + const optionMenu = this.widget.$(`button[id='${fileId}-option-menu']`); await BrowserActions.click(optionMenu); await BrowserActions.waitUntilActionMenuIsVisible(); await browser.waitForAngular(); - const actionButton = element(by.css(`button#${fileId}-${actionName}`)); + const actionButton = $(`button#${fileId}-${actionName}`); await BrowserActions.click(actionButton); await BrowserVisibility.waitUntilElementIsNotVisible(actionButton); await browser.waitForAngular(); diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts index d1ada20c0eb..dd42c90f5b8 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/group-cloud-component.page.ts @@ -15,16 +15,19 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { by, element, $, ElementFinder, $$ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { FormFields } from '../../core/pages/form/form-fields'; export class GroupCloudComponentPage { - groupCloudSearch = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]')); + groupCloudSearch = $('input[data-automation-id="adf-cloud-group-search-input"]'); + groupField = $('group-cloud-widget .adf-readonly'); formFields = new FormFields(); + getGroupRowLocatorByName = async (name: string): Promise => $$(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`).first(); + async searchGroups(name: string): Promise { await BrowserActions.clearSendKeys(this.groupCloudSearch, name); } @@ -38,19 +41,19 @@ export class GroupCloudComponentPage { } async selectGroupFromList(name: string): Promise { - const groupRow = element.all(by.css(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`)).first(); + const groupRow = await this.getGroupRowLocatorByName(name); await BrowserActions.click(groupRow); await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); } async checkGroupIsDisplayed(name: string): Promise { - const groupRow = element.all(by.css(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`)).first(); + const groupRow = await this.getGroupRowLocatorByName(name); await BrowserVisibility.waitUntilElementIsVisible(groupRow); } async checkGroupIsNotDisplayed(name: string): Promise { - const groupRow = element.all(by.css(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`)).first(); + const groupRow = await this.getGroupRowLocatorByName(name); await BrowserVisibility.waitUntilElementIsNotVisible(groupRow); } @@ -63,7 +66,7 @@ export class GroupCloudComponentPage { } async removeSelectedGroup(group: string): Promise { - const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`)); + const locator = $(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`); await BrowserActions.click(locator); } @@ -77,9 +80,8 @@ export class GroupCloudComponentPage { } async checkGroupWidgetIsReadOnly (): Promise { - const readOnlyGroup = element(by.css('group-cloud-widget .adf-readonly')); try { - await BrowserVisibility.waitUntilElementIsVisible(readOnlyGroup); + await BrowserVisibility.waitUntilElementIsVisible(this.groupField); return true; } catch { return false; @@ -87,9 +89,8 @@ export class GroupCloudComponentPage { } async checkGroupActiveField(name: string): Promise { - const activeGroupField = element(by.css('group-cloud-widget .adf-readonly')); try { - await BrowserActions.clearSendKeys(activeGroupField, name); + await BrowserActions.clearSendKeys(this.groupField, name); return true; } catch { return false; @@ -97,7 +98,7 @@ export class GroupCloudComponentPage { } async checkNoResultsFoundError(): Promise { - const errorLocator = element(by.css('[data-automation-id="adf-cloud-group-no-results"]')); + const errorLocator = $('[data-automation-id="adf-cloud-group-no-results"]'); await BrowserVisibility.waitUntilElementIsVisible(errorLocator); } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts index 27ab3fa2d41..4e85a3129ed 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/people-cloud-component.page.ts @@ -15,21 +15,23 @@ * limitations under the License. */ -import { Locator, by, element, protractor } from 'protractor'; +import { Locator, by, element, protractor, $, $$, ElementFinder } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { FormFields } from '../../core/pages/form/form-fields'; export class PeopleCloudComponentPage { - peopleCloudSearch = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); - assigneeField = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); - selectionReady = element(by.css('div[data-automation-id="adf-people-cloud-row"]')); + peopleCloudSearch = $('input[data-automation-id="adf-people-cloud-search-input"]'); + assigneeField = $('input[data-automation-id="adf-people-cloud-search-input"]'); + selectionReady = $('div[data-automation-id="adf-people-cloud-row"]'); formFields = new FormFields(); labelLocator: Locator = by.css("label[class*='adf-label']"); inputLocator: Locator = by.css('input'); - assigneeChipList = element(by.css('mat-chip-list[data-automation-id="adf-cloud-people-chip-list"]')); - noOfUsersDisplayed = element.all(by.css('mat-option span.adf-people-label-name')); + assigneeChipList = $('mat-chip-list[data-automation-id="adf-cloud-people-chip-list"]'); + noOfUsersDisplayed = $$('mat-option span.adf-people-label-name'); + + getAssigneeRowLocatorByContainingName = async (name: string): Promise => element.all(by.cssContainingText('mat-option span.adf-people-label-name', name)).first(); async clearAssignee(): Promise { await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' '); @@ -37,7 +39,7 @@ export class PeopleCloudComponentPage { } async clearAssigneeFromChip(username: string): Promise { - const assigneeChipRemoveIcon = element(by.css(`[data-automation-id="adf-people-cloud-chip-remove-icon-${username}"]`)); + const assigneeChipRemoveIcon = $(`[data-automation-id="adf-people-cloud-chip-remove-icon-${username}"]`); await assigneeChipRemoveIcon.click(); } @@ -51,7 +53,7 @@ export class PeopleCloudComponentPage { } async selectAssigneeFromList(name: string): Promise { - const assigneeRow = element.all(by.cssContainingText('mat-option span.adf-people-label-name', name)).first(); + const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name); await BrowserActions.click(assigneeRow); await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow); } @@ -72,7 +74,7 @@ export class PeopleCloudComponentPage { async checkUserIsDisplayed(name: string): Promise { try { - const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); + const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name); await BrowserVisibility.waitUntilElementIsVisible(assigneeRow); return true; } catch { @@ -82,7 +84,7 @@ export class PeopleCloudComponentPage { async checkUserIsNotDisplayed(name: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.selectionReady); - const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name)); + const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name); await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow); } @@ -91,12 +93,12 @@ export class PeopleCloudComponentPage { } async checkOptionIsDisplayed(): Promise { - const optionList = element(by.css('.adf-people-cloud-list')); + const optionList = $('.adf-people-cloud-list'); await BrowserVisibility.waitUntilElementIsVisible(optionList); } async checkOptionIsNotDisplayed(): Promise { - const optionList = element(by.css('.adf-people-cloud-list')); + const optionList = $('.adf-people-cloud-list'); await BrowserVisibility.waitUntilElementIsNotVisible(optionList); } @@ -126,7 +128,7 @@ export class PeopleCloudComponentPage { } async checkPeopleWidgetIsHidden(fieldId: string): Promise { - const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`)); + const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`); try { await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement); return true; @@ -141,7 +143,7 @@ export class PeopleCloudComponentPage { } async checkPeopleWidgetIsReadOnly(): Promise { - const readOnlyAttribute = element(by.css('people-cloud-widget .adf-readonly')); + const readOnlyAttribute = $('people-cloud-widget .adf-readonly'); try { await BrowserVisibility.waitUntilElementIsVisible(readOnlyAttribute); return true; @@ -151,7 +153,7 @@ export class PeopleCloudComponentPage { } async checkPeopleActiveField(name: string): Promise { - const activePeopleField = element(by.css('people-cloud-widget .adf-readonly')); + const activePeopleField = $('people-cloud-widget .adf-readonly'); try { await BrowserActions.clearSendKeys(activePeopleField, name); return true; @@ -161,7 +163,7 @@ export class PeopleCloudComponentPage { } async checkNoResultsFoundError(): Promise { - const errorLocator = element(by.css('[data-automation-id="adf-people-cloud-no-results"]')); + const errorLocator = $('[data-automation-id="adf-people-cloud-no-results"]'); await BrowserVisibility.waitUntilElementIsVisible(errorLocator); } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts index 23f10d4cb24..25635cf442b 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-filters-cloud-component.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Locator, by, element, ElementFinder } from 'protractor'; +import { ElementFinder, $ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; @@ -27,12 +27,11 @@ const FILTERS = { export class ProcessFiltersCloudComponentPage { - filterIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]'); + processFilters = $("mat-expansion-panel[data-automation-id='Process Filters']"); + activeFilter = $('.adf-active [data-automation-id="adf-filter-label"]'); + processFiltersList = $('adf-cloud-process-filters'); - processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']")); - - activeFilter = element(by.css('.adf-active [data-automation-id="adf-filter-label"]')); - processFiltersList = element(by.css('adf-cloud-process-filters')); + getProcessFilterLocatorByFilterName = (filterName: string): ElementFinder => $(`button[data-automation-id="${filterName}_filter"]`); async checkProcessFilterIsDisplayed(filterName: string): Promise { const filter = this.getProcessFilterLocatorByFilterName(filterName); @@ -91,8 +90,4 @@ export class ProcessFiltersCloudComponentPage { async isProcessFiltersListVisible(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.processFiltersList); } - - getProcessFilterLocatorByFilterName(filterName: string): ElementFinder { - return element(by.css(`button[data-automation-id="${filterName}_filter"]`)); - } } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts index a41fa83a1bd..ba2a35ecce2 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-header-cloud-component.page.ts @@ -15,19 +15,19 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $, $$ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; export class ProcessHeaderCloudPage { - idField = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first(); - nameField = element.all(by.css('[data-automation-id="card-textitem-value-name"]')).first(); - statusField = element(by.css('[data-automation-id="card-textitem-value-status"]')); - initiatorField = element(by.css('[data-automation-id="card-textitem-value-initiator"]')); - startDateField = element.all(by.css('span[data-automation-id*="startDate"] span')).first(); - lastModifiedField = element.all(by.css('span[data-automation-id*="lastModified"] span')).first(); - parentIdField = element(by.css('[data-automation-id="card-textitem-value-parentId"]')); - businessKeyField = element(by.css('[data-automation-id="card-textitem-value-businessKey"]')); + idField = $$('[data-automation-id="card-textitem-value-id"]').first(); + nameField = $$('[data-automation-id="card-textitem-value-name"]').first(); + statusField = $('[data-automation-id="card-textitem-value-status"]'); + initiatorField = $('[data-automation-id="card-textitem-value-initiator"]'); + startDateField = $$('span[data-automation-id*="startDate"] span').first(); + lastModifiedField = $$('span[data-automation-id*="lastModified"] span').first(); + parentIdField = $('[data-automation-id="card-textitem-value-parentId"]'); + businessKeyField = $('[data-automation-id="card-textitem-value-businessKey"]'); async getId(): Promise { return BrowserActions.getInputValue(this.idField); diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts index 845939a3a05..d606e08a63b 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/process-list-cloud-component.page.ts @@ -17,7 +17,7 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { Locator, element, by, browser } from 'protractor'; +import { browser, $, $$ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; export class ProcessListCloudComponentPage { @@ -28,10 +28,10 @@ export class ProcessListCloudComponentPage { processDefinitionName: 'Process Definition Name' }; - processList = element(by.css('adf-cloud-process-list')); - noProcessFound = element.all(by.css('.adf-empty-content__title')).first(); - actionMenu = element(by.css('*[role="menu"]')); - optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]'); + processList = $('adf-cloud-process-list'); + noProcessFound = $$('.adf-empty-content__title').first(); + actionMenu = $('*[role="menu"]'); + optionButton = 'button[data-automation-id*="action_menu_"]'; dataTable = new DataTableComponentPage(this.processList); @@ -111,17 +111,17 @@ export class ProcessListCloudComponentPage { await BrowserActions.closeMenuAndDialogs(); const row = this.dataTable.getRow('Id', content); await browser.sleep(1000); - await BrowserActions.click(row.element(this.optionButton)); + await BrowserActions.click(row.$(this.optionButton)); await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu); } async clickOnCustomActionMenu(action: string): Promise { - const actionButton = element(by.css(`button[data-automation-id*="${action}"]`)); + const actionButton = $(`button[data-automation-id*="${action}"]`); await BrowserActions.click(actionButton); } async isCustomActionEnabled(action: string): Promise { - const actionButton = element(by.css(`button[data-automation-id*="${action}"]`)); + const actionButton = $(`button[data-automation-id*="${action}"]`); return actionButton.isEnabled(); } @@ -134,7 +134,7 @@ export class ProcessListCloudComponentPage { } async getNumberOfOptions(): Promise { - const options = await this.actionMenu.all(by.css(`button`)); + const options = await this.actionMenu.$$(`button`); return options.length; } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts index 5cf63871516..37cc9b26804 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/start-process-cloud-component.page.ts @@ -15,23 +15,25 @@ * limitations under the License. */ -import { by, element, Key, protractor, browser, ElementFinder } from 'protractor'; +import { by, element, Key, protractor, browser, ElementFinder, $, $$ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { FormFields } from '../../core/pages/form/form-fields'; export class StartProcessCloudPage { - defaultProcessName = element(by.css('input[id="processName"]')); - processNameInput = element(by.id('processName')); - selectProcessDropdownArrow = element(by.css('button[id="adf-select-process-dropdown"]')); - cancelProcessButton = element(by.id('cancel_process')); - formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]')); - startProcessButton = element(by.css('button[data-automation-id="btn-start"]')); - startProcessButtonDisabled = element(by.css('button[data-automation-id="btn-start"][disabled]')); - noProcess = element(by.id('no-process-message')); - processDefinition = element(by.css('input[id="processDefinitionName"]')); - processDefinitionOptionsPanel = element(by.css('div[class*="processDefinitionOptions"]')); + defaultProcessName = $('input[id="processName"]'); + processNameInput = $('#processName'); + selectProcessDropdownArrow = $('button[id="adf-select-process-dropdown"]'); + cancelProcessButton = $('#cancel_process'); + formStartProcessButton = $('button[data-automation-id="adf-form-start process"]'); + startProcessButton = $('button[data-automation-id="btn-start"]'); + startProcessButtonDisabled = $('button[data-automation-id="btn-start"][disabled]'); + noProcess = $('#no-process-message'); + processDefinition = $('input[id="processDefinitionName"]'); + processDefinitionOptionsPanel = $('div[class*="processDefinitionOptions"]'); + + getSelectProcessDropdownLocatorByName = (name: string): ElementFinder => element(by.cssContainingText('.mat-option-text', name)); async checkNoProcessMessage(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.noProcess); @@ -61,7 +63,7 @@ export class StartProcessCloudPage { async selectFirstOptionFromProcessDropdown(): Promise { await this.clickProcessDropdownArrow(); - const selectFirstProcessDropdown = element.all(by.css('.mat-option-text')).first(); + const selectFirstProcessDropdown = $$('.mat-option-text').first(); await BrowserActions.click(selectFirstProcessDropdown); } @@ -70,13 +72,13 @@ export class StartProcessCloudPage { } async checkOptionIsDisplayed(name: string): Promise { - const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name)); + const selectProcessDropdown = this.getSelectProcessDropdownLocatorByName(name); await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown); await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown); } async selectOption(name: string): Promise { - const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name)); + const selectProcessDropdown = this.getSelectProcessDropdownLocatorByName(name); await BrowserActions.click(selectProcessDropdown); } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts index 9fadfb3706c..0e65a661e24 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/start-tasks-cloud-component.page.ts @@ -15,23 +15,23 @@ * limitations under the License. */ -import { element, by, Key, ElementFinder } from 'protractor'; +import { element, by, Key, ElementFinder, $, $$ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { DropdownPage } from '../../core/pages/material/dropdown.page'; export class StartTasksCloudPage { - name = element(by.css('input[id="name_id"]')); - dueDate = element(by.css('input[id="date_id"]')); - description = element(by.css('textarea[id="description_id"]')); - priority = element(by.css('mat-select[formcontrolname="priority"]')); - startButton = element(by.css('button[id="button-start"]')); - startButtonEnabled = element(by.css('button[id="button-start"]:not(disabled)')); - cancelButton = element(by.css('button[id="button-cancel"]')); - form = element.all(by.css('adf-cloud-start-task form')).first(); - formDefinitionSelector = element(by.css('.adf-form-definition-selector')); - priorityStartTaskField = element(by.css('input[formControlName="priority"]')); + name = $('input[id="name_id"]'); + dueDate = $('input[id="date_id"]'); + description = $('textarea[id="description_id"]'); + priority = $('mat-select[formcontrolname="priority"]'); + startButton = $('button[id="button-start"]'); + startButtonEnabled = $('button[id="button-start"]:not(disabled)'); + cancelButton = $('button[id="button-cancel"]'); + form = $$('adf-cloud-start-task form').first(); + formDefinitionSelector = $('.adf-form-definition-selector'); + priorityStartTaskField = $('input[formControlName="priority"]'); async checkFormIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.form); @@ -65,7 +65,7 @@ export class StartTasksCloudPage { } async checkStartButtonIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled'))); + await BrowserVisibility.waitUntilElementIsVisible($('button[id="button-start"]:disabled')); } async clickCancelButton(): Promise { diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts index cb44bd6b0e6..fabed28ef2a 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-filters-cloud-component.page.ts @@ -15,29 +15,32 @@ * limitations under the License. */ -import { by, element, ElementFinder } from 'protractor'; +import { ElementFinder, $, $$ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; export class TaskFiltersCloudComponentPage { filter: ElementFinder; - taskFilters = element(by.css(`mat-expansion-panel[data-automation-id='Task Filters']`)); - activeFilter = element(by.css('.adf-active [data-automation-id="adf-filter-label"]')); + taskFilters = $(`mat-expansion-panel[data-automation-id='Task Filters']`); + activeFilter = $('.adf-active [data-automation-id="adf-filter-label"]'); + + getTaskFilterLocatorByFilterName = async (filterName: string): Promise => $$(`button[data-automation-id="${filterName}_filter"]`).first(); + getFilterCounterLocatorByFilterName = async (filterName: string): Promise => $$(`[data-automation-id="${filterName}_filter-counter"]`).first(); async checkTaskFilterIsDisplayed(filterName: string): Promise { - this.filter = this.getTaskFilterLocatorByFilterName(filterName); + this.filter = await this.getTaskFilterLocatorByFilterName(filterName); await BrowserVisibility.waitUntilElementIsVisible(this.filter); } async clickTaskFilter(filterName): Promise { - this.filter = this.getTaskFilterLocatorByFilterName(filterName); + this.filter = await this.getTaskFilterLocatorByFilterName(filterName); await BrowserVisibility.waitUntilElementIsClickable(this.filter); await BrowserActions.click(this.filter); } async checkTaskFilterNotDisplayed(filterName: string): Promise { - this.filter = this.getTaskFilterLocatorByFilterName(filterName); + this.filter = await this.getTaskFilterLocatorByFilterName(filterName); await BrowserVisibility.waitUntilElementIsNotVisible(this.filter); } @@ -50,22 +53,19 @@ export class TaskFiltersCloudComponentPage { } async getTaskFilterCounter(filterName: string): Promise { - const filterCounter = element.all(by.css(`[data-automation-id="${filterName}_filter-counter"]`)).first(); + const filterCounter = await this.getFilterCounterLocatorByFilterName(filterName); return BrowserActions.getText(filterCounter); } async checkTaskFilterCounter(filterName: string): Promise { - const filterCounter = element.all(by.css(`[data-automation-id="${filterName}_filter-counter"]`)).first(); + const filterCounter = await this.getFilterCounterLocatorByFilterName(filterName); await BrowserVisibility.waitUntilElementHasText(filterCounter, '0'); } async checkNotificationCounterValue(filterName: string, counterValue: string): Promise { - const filterCounter = element(by.css(`[data-automation-id="${filterName}_filter-counter"][class*="adf-active"]`)); + const filterCounter = $(`[data-automation-id="${filterName}_filter-counter"][class*="adf-active"]`); await BrowserVisibility.waitUntilElementIsVisible(filterCounter); await BrowserVisibility.waitUntilElementHasText(filterCounter, counterValue); } - getTaskFilterLocatorByFilterName(filterName: string): ElementFinder { - return element.all(by.css(`button[data-automation-id="${filterName}_filter"]`)).first(); - } } diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts index 2ee7e2be196..b76a9b7d852 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-form-cloud-component.page.ts @@ -15,24 +15,26 @@ * limitations under the License. */ -import { element, by, ElementFinder, browser } from 'protractor'; +import { ElementFinder, browser, $ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { FormFields } from '../../core/pages/form/form-fields'; export class TaskFormCloudComponent { - cancelButton = element(by.css('button[id="adf-cloud-cancel-task"]')); - completeButton = element(by.css('button[id="adf-form-complete"]')); - releaseButton = element(by.css('button[adf-cloud-unclaim-task]')); - saveButton = element(by.css('button[id="adf-form-save"]')); - claimButton = element(by.css('button[adf-cloud-claim-task]')); - form = element(by.css('adf-cloud-form')); - formTitle = element(by.css(`span.adf-form-title`)); - emptyContentIcon = element(by.css(`div.adf-empty-content adf-icon.adf-empty-content__icon`)); - emptyContentTitle = element(by.css(`div.adf-empty-content div.adf-empty-content__title`)); - emptyContentSubtitle = element(by.css(`div.adf-empty-content div.adf-empty-content__subtitle`)); - readOnlyForm = element(by.css('div[class="adf-readonly-form"]')); + cancelButton = $('button[id="adf-cloud-cancel-task"]'); + completeButton = $('button[id="adf-form-complete"]'); + releaseButton = $('button[adf-cloud-unclaim-task]'); + saveButton = $('button[id="adf-form-save"]'); + claimButton = $('button[adf-cloud-claim-task]'); + form = $('adf-cloud-form'); + formTitle = $(`span.adf-form-title`); + emptyContentIcon = $(`div.adf-empty-content adf-icon.adf-empty-content__icon`); + emptyContentTitle = $(`div.adf-empty-content div.adf-empty-content__title`); + emptyContentSubtitle = $(`div.adf-empty-content div.adf-empty-content__subtitle`); + readOnlyForm = $('div[class="adf-readonly-form"]'); + + getButtonLocatorByName = (name: string): ElementFinder => $(`button[id="adf-form-${name}"]`); async isCompleteButtonEnabled(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.completeButton); @@ -86,15 +88,15 @@ export class TaskFormCloudComponent { } async checkFormOutcomeButtonIsDisplayedByName(name: string): Promise { - await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`button[id="adf-form-${name}"]`))); + await BrowserVisibility.waitUntilElementIsVisible(this.getButtonLocatorByName(name)); } async checkFormOutcomeButtonIsNotDisplayedByName(name: string) { - await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`button[id="adf-form-${name}"]`))); + await BrowserVisibility.waitUntilElementIsNotVisible(this.getButtonLocatorByName(name)); } async clickFormOutcomeButtonByName(name: string): Promise { - await BrowserActions.click(element(by.css(`button[id="adf-form-${name}"]`))); + await BrowserActions.click(this.getButtonLocatorByName(name)); } async clickCancelButton(): Promise { diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts index 5b6c95879c5..6d539a6515a 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-header-cloud-component.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $$, $ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { CardTextItemPage } from '../../core/pages/card-view/card-view-text-item.page'; @@ -26,15 +26,15 @@ export class TaskHeaderCloudPage { assigneeCardTextItem = new CardTextItemPage('assignee'); statusCardTextItem = new CardTextItemPage('status'); priorityCardSelectItem = new CardSelectItemPage('priority'); - dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first(); + dueDateField = $$('span[data-automation-id*="dueDate"] span').first(); categoryCardTextItem = new CardTextItemPage('category'); - createdField = element(by.css('span[data-automation-id="card-dateitem-created"]')); + createdField = $('span[data-automation-id="card-dateitem-created"]'); parentNameCardTextItem = new CardTextItemPage('parentName'); parentTaskIdCardTextItem = new CardTextItemPage('parentTaskId'); - endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first(); + endDateField = $$('span[data-automation-id*="endDate"] span').first(); idCardTextItem = new CardTextItemPage('id'); descriptionCardTextItem = new CardTextItemPage('description'); - taskPropertyList = element(by.css('adf-cloud-task-header adf-card-view .adf-property-list')); + taskPropertyList = $('adf-cloud-task-header adf-card-view .adf-property-list'); async getAssignee(): Promise { return this.assigneeCardTextItem.getFieldValue(); diff --git a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts index 277a51bdedc..25a193cd0ea 100644 --- a/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts +++ b/lib/testing/src/lib/protractor/process-services-cloud/pages/task-list-cloud-component.page.ts @@ -17,7 +17,7 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { element, by, ElementFinder, Locator } from 'protractor'; +import { by, ElementFinder, $$, $ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; const column = { @@ -34,13 +34,14 @@ const column = { export class TaskListCloudComponentPage { - taskList = element(by.css('adf-cloud-task-list')); - noTasksFound = element.all(by.css('.adf-empty-content__title')).first(); - actionMenu = element(by.css('*[role="menu"]')); - optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]'); - + taskList = $('adf-cloud-task-list'); + noTasksFound = $$('.adf-empty-content__title').first(); + actionMenu = $('*[role="menu"]'); + optionButton = 'button[data-automation-id*="action_menu_"]'; dataTable = new DataTableComponentPage(this.taskList); + getButtonLocatorByAction = (action: string): ElementFinder => $(`button[data-automation-id*="${action}"]`); + getDataTable(): DataTableComponentPage { return this.dataTable; } @@ -174,17 +175,17 @@ export class TaskListCloudComponentPage { async clickOptionsButton(content: string) { await BrowserActions.closeMenuAndDialogs(); const row = this.dataTable.getRow('Id', content); - await BrowserActions.click(row.element(this.optionButton)); + await BrowserActions.click(row.$(this.optionButton)); await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu); } async clickOnCustomActionMenu(action: string): Promise { - const actionButton = element(by.css(`button[data-automation-id*="${action}"]`)); + const actionButton = this.getButtonLocatorByAction(action); await BrowserActions.click(actionButton); } async isCustomActionEnabled(action: string): Promise { - const actionButton = element(by.css(`button[data-automation-id*="${action}"]`)); + const actionButton = this.getButtonLocatorByAction(action); return actionButton.isEnabled(); } diff --git a/lib/testing/src/lib/protractor/process-services/pages/external-node-selector-dialog.page.ts b/lib/testing/src/lib/protractor/process-services/pages/external-node-selector-dialog.page.ts index f5ab23dae59..ed7028fc91a 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/external-node-selector-dialog.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/external-node-selector-dialog.page.ts @@ -15,27 +15,27 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { ContentNodeSelectorDialogPage } from '../../content-services/dialog/content-node-selector-dialog.page'; import { DocumentListPage } from '../../content-services/pages/document-list.page'; import { Logger } from '../../core/utils/logger'; export class ExternalNodeSelectorDialogPage extends ContentNodeSelectorDialogPage { - txtUsername = element(by.css('input[id="username"]')); - txtPassword = element(by.css('input[id="password"]')); - loginElement = element(by.css('[data-automation-id="attach-file-dialog-actions-login"]')); - title = element(by.css('[data-automation-id="content-node-selector-title"]')); + txtUsername = $('input[id="username"]'); + txtPassword = $('input[id="password"]'); + loginElement = $('[data-automation-id="attach-file-dialog-actions-login"]'); + title = $('[data-automation-id="content-node-selector-title"]'); constructor() { super(); - this.dialog = element(by.css(`adf-content-node-selector-panel`)); + this.dialog = $(`adf-content-node-selector-panel`); this.contentList = new DocumentListPage(this.dialog); this.dataTable = this.contentList.dataTablePage(); - this.header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`)); - this.searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`)); - this.selectedRow = this.dialog.element(by.css(`adf-datatable-row[class*="adf-is-selected"]`)); - this.moveCopyButton = element(by.css(`button[data-automation-id="attach-file-dialog-actions-choose"]`)); + this.header = this.dialog.$(`header[data-automation-id='content-node-selector-title']`); + this.searchInputElement = this.dialog.$(`input[data-automation-id='content-node-selector-search-input']`); + this.selectedRow = this.dialog.$(`adf-datatable-row[class*="adf-is-selected"]`); + this.moveCopyButton = $(`button[data-automation-id="attach-file-dialog-actions-choose"]`); } async getTitle(): Promise { diff --git a/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts b/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts index f4e7b554b48..cd7d4916b85 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/filters.page.ts @@ -17,13 +17,16 @@ import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; -import { Locator, by, element, ElementFinder } from 'protractor'; +import { ElementFinder, $ } from 'protractor'; export class FiltersPage { - accordionMenu = element(by.css('.app-processes-menu mat-accordion')); - buttonWindow = element(by.css('div > button[data-automation-id="btn-start-process"] > div')); - processIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]'); + accordionMenu = $('.app-processes-menu mat-accordion'); + buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div'); + processIcon = 'adf-icon[data-automation-id="adf-filter-icon"]'; + + getLocatorForFilterByName = (name: string): ElementFinder => $(`[data-automation-id='${name}_filter']`); + getLocatorForActiveFilterByName = (name: string): ElementFinder => $(`.adf-active [data-automation-id='${name}_filter']`); async clickFilterButton(filterElement: ElementFinder): Promise { await BrowserActions.click(filterElement); @@ -34,7 +37,7 @@ export class FiltersPage { } async isFilterHighlighted(filterName: string): Promise { - const filterNameHighlighted = element(by.css(`.adf-active [data-automation-id='${filterName}_filter']`)); + const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName); try { await BrowserVisibility.waitUntilElementIsVisible(filterNameHighlighted); return true; @@ -44,7 +47,7 @@ export class FiltersPage { } async isFilterNotHighlighted(filterName: string): Promise { - const filterNameHighlighted = element(by.css(`.adf-active [data-automation-id='${filterName}_filter']`)); + const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName); try { await BrowserVisibility.waitUntilElementIsNotVisible(filterNameHighlighted); return true; @@ -54,7 +57,7 @@ export class FiltersPage { } async isFilterDisplayed(name: string): Promise { - const filterName = element(by.css(`[data-automation-id='${name}_filter']`)); + const filterName = this.getLocatorForFilterByName(name); try { await BrowserVisibility.waitUntilElementIsVisible(filterName); return true; @@ -64,15 +67,15 @@ export class FiltersPage { } async checkFilterHasNoIcon(name: string): Promise { - const filterName = element(by.css(`[data-automation-id='${name}_filter']`)); + const filterName = this.getLocatorForFilterByName(name); await BrowserVisibility.waitUntilElementIsVisible(filterName); - await BrowserVisibility.waitUntilElementIsNotVisible(filterName.element(this.processIcon)); + await BrowserVisibility.waitUntilElementIsNotVisible(filterName.$(this.processIcon)); } async getFilterIcon(name: string): Promise { - const filterName = element(by.css(`[data-automation-id='${name}_filter']`)); + const filterName = this.getLocatorForFilterByName(name); await BrowserVisibility.waitUntilElementIsVisible(filterName); - const icon = filterName.element(this.processIcon); + const icon = filterName.$(this.processIcon); return BrowserActions.getText(icon); } } diff --git a/lib/testing/src/lib/protractor/process-services/pages/process-filters.page.ts b/lib/testing/src/lib/protractor/process-services/pages/process-filters.page.ts index 1e51a967fbf..fdde3f5e0db 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/process-filters.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/process-filters.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { FiltersPage } from './filters.page'; export class ProcessFiltersPage { @@ -27,10 +27,10 @@ export class ProcessFiltersPage { filtersPage = new FiltersPage(); - runningFilter = element(by.css('button[data-automation-id="Running_filter"]')); - completedFilter = element(by.css('button[data-automation-id="Completed_filter"]')); - allFilter = element(by.css('button[data-automation-id="All_filter"]')); - accordionMenu = element(by.css('.app-processes-menu mat-accordion')); + runningFilter = $('button[data-automation-id="Running_filter"]'); + completedFilter = $('button[data-automation-id="Completed_filter"]'); + allFilter = $('button[data-automation-id="All_filter"]'); + accordionMenu = $('.app-processes-menu mat-accordion'); async clickRunningFilterButton(): Promise { await this.filtersPage.clickFilterButton(this.runningFilter); diff --git a/lib/testing/src/lib/protractor/process-services/pages/process-instance-tasks.page.ts b/lib/testing/src/lib/protractor/process-services/pages/process-instance-tasks.page.ts index e55523dabd4..9060bc6ca3b 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/process-instance-tasks.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/process-instance-tasks.page.ts @@ -16,15 +16,15 @@ */ import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { by, element } from 'protractor'; +import { by, $ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; export class ProcessInstanceTasksPage { - startProcessDialog = element(by.id('adf-start-process-dialog')); - title = this.startProcessDialog.element(by.css('h4.mat-dialog-title')); + startProcessDialog = $('#adf-start-process-dialog'); + title = this.startProcessDialog.$('h4.mat-dialog-title'); closeButton = this.startProcessDialog.element(by.cssContainingText(`div.adf-start-process-dialog-actions button span`, 'Close')); - startForm = element(by.css('div[data-automation-id="start-form"]')); + startForm = $('div[data-automation-id="start-form"]'); async clickOnStartForm(): Promise { await BrowserActions.click(this.startForm); diff --git a/lib/testing/src/lib/protractor/process-services/pages/select-apps-dialog.page.ts b/lib/testing/src/lib/protractor/process-services/pages/select-apps-dialog.page.ts index fb05ca5245e..ce229559579 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/select-apps-dialog.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/select-apps-dialog.page.ts @@ -16,16 +16,16 @@ */ import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions } from '../../core/utils/browser-actions'; import { DropdownPage } from '../../core/pages/material/dropdown.page'; export class SelectAppsDialog { - selectAppsDialog = element(by.css('mat-dialog-container[aria-labelledby="adf-select-app-dialog-title"]')); - title = element(by.id('adf-select-app-dialog-title')); - appsDropdown = new DropdownPage(element(by.id('adf-select-app-dialog-dropdown'))); - continueButton = element(by.css('adf-select-apps-dialog .mat-button-wrapper')); + selectAppsDialog = $('mat-dialog-container[aria-labelledby="adf-select-app-dialog-title"]'); + title = $('#adf-select-app-dialog-title'); + appsDropdown = new DropdownPage($('#adf-select-app-dialog-dropdown')); + continueButton = $('adf-select-apps-dialog .mat-button-wrapper'); async checkSelectAppsDialogIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.selectAppsDialog); diff --git a/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts b/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts index c1062c69c58..dd1f2697f8c 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/start-process.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element, Key, protractor, browser } from 'protractor'; +import { by, element, Key, protractor, browser, $ } from 'protractor'; import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserActions } from '../../core/utils/browser-actions'; import { DropdownPage } from '../../core/pages/material/dropdown.page'; @@ -24,20 +24,20 @@ import { Logger } from '../../core/utils/logger'; export class StartProcessPage { - defaultProcessName = element(by.css('input[id="processName"]')); - processNameInput = element(by.id('processName')); - disabledSelectProcessDropdown = element(by.css('input[id="processDefinitionName"][disabled]')); - selectProcessDropdownArrow = element(by.css('button[id="adf-select-process-dropdown"]')); - cancelProcessButton = element(by.id('cancel_process')); - formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]')); - startProcessButton = element(by.css('button[data-automation-id="btn-start"]')); - startProcessButtonDisabled = element(by.css('button[data-automation-id="btn-start"][disabled]')); - noProcess = element(by.css('.adf-empty-content__title')); - processDefinition = element(by.css('input[id="processDefinitionName"]')); - processDefinitionOptionsPanel = element(by.css('div[class*="mat-autocomplete-panel"]')); - - processDefinitionDropdown = new DropdownPage(element(by.id('adf-select-process-dropdown'))); - applicationDropdown = new DropdownPage(element(by.css('[data-automation-id*="start-process-app"] .mat-select-arrow'))); + defaultProcessName = $('input[id="processName"]'); + processNameInput = $('#processName'); + disabledSelectProcessDropdown = $('input[id="processDefinitionName"][disabled]'); + selectProcessDropdownArrow = $('button[id="adf-select-process-dropdown"]'); + cancelProcessButton = $('#cancel_process'); + formStartProcessButton = $('button[data-automation-id="adf-form-start process"]'); + startProcessButton = $('button[data-automation-id="btn-start"]'); + startProcessButtonDisabled = $('button[data-automation-id="btn-start"][disabled]'); + noProcess = $('.adf-empty-content__title'); + processDefinition = $('input[id="processDefinitionName"]'); + processDefinitionOptionsPanel = $('div[class*="mat-autocomplete-panel"]'); + + processDefinitionDropdown = new DropdownPage($('#adf-select-process-dropdown')); + applicationDropdown = new DropdownPage($('[data-automation-id*="start-process-app"] .mat-select-arrow')); async checkNoProcessMessage(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.noProcess); diff --git a/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts b/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts index 6f7b9db2227..39d6f0d13ce 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/task-filters.page.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { by, element } from 'protractor'; +import { $ } from 'protractor'; import { FiltersPage } from './filters.page'; export class TaskFiltersPage { @@ -28,11 +28,11 @@ export class TaskFiltersPage { filtersPage = new FiltersPage(); - myTasks = element(by.css('[data-automation-id="My Tasks_filter"]')); - queuedTask = element(by.css('[data-automation-id="Queued Tasks_filter"]')); - completedTask = element(by.css('[data-automation-id="Completed Tasks_filter"]')); - involvedTask = element(by.css('[data-automation-id="Involved Tasks_filter"]')); - accordionMenu = element(by.css('.app-processes-menu mat-accordion')); + myTasks = $('[data-automation-id="My Tasks_filter"]'); + queuedTask = $('[data-automation-id="Queued Tasks_filter"]'); + completedTask = $('[data-automation-id="Completed Tasks_filter"]'); + involvedTask = $('[data-automation-id="Involved Tasks_filter"]'); + accordionMenu = $('.app-processes-menu mat-accordion'); async clickMyTasksFilterButton(): Promise { await this.filtersPage.clickFilterButton(this.myTasks); @@ -51,7 +51,7 @@ export class TaskFiltersPage { } async clickCustomFilterButton(customFilterName): Promise { - await this.filtersPage.clickFilterButton(element(by.css(`[data-automation-id="${customFilterName}_filter"]`))); + await this.filtersPage.clickFilterButton($(`[data-automation-id="${customFilterName}_filter"]`)); } async isMyTasksFilterHighlighted(): Promise { diff --git a/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts b/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts index 9ec9f9890b0..7c6a517ac98 100644 --- a/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts +++ b/lib/testing/src/lib/protractor/process-services/pages/task-form.page.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -import { element, by } from 'protractor'; +import { $ } from 'protractor'; import { BrowserActions, BrowserVisibility } from '../../core/utils/public-api'; export class TaskFormPage { - saveButton = element(by.id('adf-form-save')); - claimButton = element(by.css('button[data-automation-id="adf-task-form-claim-button"]')); - releaseButton = element(by.css('button[data-automation-id="adf-task-form-unclaim-button"]')); + saveButton = $('#adf-form-save'); + claimButton = $('button[data-automation-id="adf-task-form-claim-button"]'); + releaseButton = $('button[data-automation-id="adf-task-form-unclaim-button"]'); async clickOnClaimButton(): Promise { await BrowserActions.click(this.claimButton); diff --git a/lib/testing/src/lib/shared/api/api.service.ts b/lib/testing/src/lib/shared/api/api.service.ts index 11733bffc37..38341b1a68b 100644 --- a/lib/testing/src/lib/shared/api/api.service.ts +++ b/lib/testing/src/lib/shared/api/api.service.ts @@ -54,6 +54,7 @@ export class ApiService { this.logger.log(`try to login with ${profile.username} on HOST: ${this.apiService.config.hostEcm} AUTHTYPE: ${this.apiService.config.authType} PROVIDER: ${this.apiService.config.provider}`); try { await this.apiService.login(profile.username, profile.password); + this.logger.log(`Successfuly logged in as ${profile.username}`); } catch (error) { this.logger.error(`Failed to login with ${profile.username}`, error?.message); throw new Error(`Login failed with ${profile.username}`);