Disable control flow e2e ADF (#4954)

* update project script possible different JS-API

* first commit no controll flow

* second commit no controll flow

* third commit no controll flow

* 4 commit no controll flow

* 5 commit no controll flow

* 6 commit no controll flow

* 7 commit no controll flow

* 8 commit no controll flow

* 9 commit no controll flow

* 10 commit no controll flow

* 11 commit no controll flow

* 12 commit no controll flow

* 13 commit no controll flow

* 14 commit no controll flow

* 15 commit no controll flow

* 16 commit no controll flow

* 17 commit no controll flow

* 18 commit no controll flow

* 19 commit no controll flow

* 20 commit no controll flow

* remove wdpromise, protractor promise and deferred promises

* - fixed some incorrect “expect” calls
- fixed some matchers
- removed “return this;” when not needed
- added a few more await-s

* forgot a file

* fix some failing tests

* replaced driver calls with browser calls and enabled back waitForAngular

* fix rightClick methods and hopefully some tests

* fix settings-component

* some more fixes for core and content tests

* try to fix some more issues

* linting

* revert some changes, allowing download on headless chrome won’t work with multiple browser instances

* fixes for Search tests

* try to remove some wait calls

* fix build

* increase allScriptsTimeout and try another protractor and web driver version

* improve navigation methods

* some fixes for notification history and login sso

* forgot a space

* fix packages and enable some screenshots

* navigation bar fixes

* fix some test

* some fixes for notification history and navigation bar
use correct visibility method in attachFileWidget test

* fix searching and another fix for navigation

* try solve sso login

* some more fixes

* refactor async forEach into for..of

* try fix for search tests

* resolve rebabse problems

* remove install

* fix lint

* fix core e2e

* fix core e2e

* fix core e2e

* fix ps tests

* fix some tests

* fix core e2e

* fix core e2e

* fix core

* fix some issues PS

* fix core

* fix core

* fix some ps test

* fix rebase issues

* remove save

* fix url regressed after rebase

* fix url regressed after rebase

* fix ps and core

* fix lint

* more parallel e2e ps

* fix some ps cloud test

* some cloud fix

* fix lint

* fix some test

* remove files to be ignored

* out-tsc

* improve one cs test

* fix candidate base app

* fix ps test

* remove click function

* clean methods alrady present in browser action

* try ugly wait

* move wait

* remove duplicate call

* remove underscore

* fix after review

* fix imports

* minor cosmetic fixes

* fix comments test
This commit is contained in:
Eugenio Romano
2019-08-17 14:32:02 +02:00
committed by GitHub
parent 4f3cf669f2
commit 83412bb9b6
328 changed files with 17653 additions and 18793 deletions

View File

@@ -1,20 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class ExampleAction {
}

View File

@@ -15,5 +15,4 @@
* limitations under the License.
*/
export * from './example.action';
export * from './upload.actions';

View File

@@ -19,32 +19,33 @@ import { browser } from 'protractor';
import * as path from 'path';
import * as fs from 'fs';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { NodeEntry } from '@alfresco/js-api/src/api/content-rest-api/model/nodeEntry';
export class UploadActions {
alfrescoJsApi: any = null;
alfrescoJsApi: AlfrescoApi = null;
constructor(alfrescoJsApi: AlfrescoApi) {
this.alfrescoJsApi = alfrescoJsApi;
}
async uploadFile(fileLocation, fileName, parentFolderId) {
async uploadFile(fileLocation, fileName, parentFolderId): Promise<any> {
const pathFile = path.join(browser.params.rootPath + '/e2e' + fileLocation);
const file = fs.createReadStream(pathFile);
return await this.alfrescoJsApi.upload.uploadFile(
return this.alfrescoJsApi.upload.uploadFile(
file,
'',
parentFolderId,
null,
{
'name': fileName,
'nodeType': 'cm:content',
'renditions': 'doclib'
name: fileName,
nodeType: 'cm:content',
renditions: 'doclib'
}
);
}
async createEmptyFiles(emptyFileNames: string[], parentFolderId) {
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
const filesRequest = [];
for (let i = 0; i < emptyFileNames.length; i++) {
@@ -54,16 +55,14 @@ export class UploadActions {
filesRequest.push(jsonItem);
}
return this.alfrescoJsApi.nodes.addNode(parentFolderId, filesRequest, {}, {
filedata: ''
});
return this.alfrescoJsApi.nodes.addNode(parentFolderId, <any> filesRequest, {});
}
async createFolder(folderName, parentFolderId) {
async createFolder(folderName, parentFolderId): Promise<NodeEntry> {
return this.alfrescoJsApi.node.addNode(parentFolderId, {
'name': folderName,
'nodeType': 'cm:folder'
}, {}, {});
name: folderName,
nodeType: 'cm:folder'
}, {});
}
async deleteFileOrFolder(nodeId) {

View File

@@ -15,90 +15,87 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { DocumentListPage } from '../pages/document-list.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
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.searchInputElement.element(by.xpath("ancestor::div[@class='mat-form-field-infix']/span/label"));
siteListDropdown = this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`));
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']`));
contentList = new DocumentListPage(this.dialog);
dialog: ElementFinder = element(by.css(`adf-content-node-selector`));
header: ElementFinder = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`));
searchInputElement: ElementFinder = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`));
searchLabel: ElementFinder = this.searchInputElement.element(by.xpath("ancestor::div[@class='mat-form-field-infix']/span/label"));
siteListDropdown: ElementFinder = this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`));
cancelButton: ElementFinder = element(by.css(`button[data-automation-id='content-node-selector-actions-cancel']`));
moveCopyButton: ElementFinder = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`));
contentList: DocumentListPage = new DocumentListPage(this.dialog);
checkDialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.dialog);
return this;
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
}
checkDialogIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.dialog);
return this;
async checkDialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
getDialogHeaderText() {
return BrowserActions.getText(this.header);
async getDialogHeaderText(): Promise<string> {
return await BrowserActions.getText(this.header);
}
checkSearchInputIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement);
return this;
async checkSearchInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement);
}
getSearchLabel() {
return BrowserActions.getText(this.searchLabel);
async getSearchLabel(): Promise<string> {
return await BrowserActions.getText(this.searchLabel);
}
checkSelectedSiteIsDisplayed(siteName) {
BrowserVisibility.waitUntilElementIsVisible(this.siteListDropdown.element(by.cssContainingText('.mat-select-value-text span', siteName)));
async checkSelectedSiteIsDisplayed(siteName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.siteListDropdown.element(by.cssContainingText('.mat-select-value-text span', siteName)));
}
checkCancelButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
clickCancelButton() {
return BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
checkCancelButtonIsEnabled() {
return this.cancelButton.isEnabled();
async checkCancelButtonIsEnabled(): Promise<boolean> {
return await this.cancelButton.isEnabled();
}
checkCopyMoveButtonIsEnabled() {
return this.moveCopyButton.isEnabled();
async checkCopyMoveButtonIsEnabled(): Promise<boolean> {
return await this.moveCopyButton.isEnabled();
}
checkMoveCopyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton);
async checkMoveCopyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton);
}
getMoveCopyButtonText() {
return BrowserActions.getText(this.moveCopyButton);
async getMoveCopyButtonText(): Promise<string> {
return await BrowserActions.getText(this.moveCopyButton);
}
clickMoveCopyButton() {
return BrowserActions.click(this.moveCopyButton);
async clickMoveCopyButton(): Promise<void> {
await BrowserActions.click(this.moveCopyButton);
}
numberOfResultsDisplayed() {
return this.contentList.dataTablePage().numberOfRows();
async numberOfResultsDisplayed(): Promise<number> {
return await this.contentList.dataTablePage().numberOfRows();
}
typeIntoNodeSelectorSearchField(text) {
BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement);
this.searchInputElement.sendKeys(text);
async typeIntoNodeSelectorSearchField(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement);
await BrowserActions.clearSendKeys(this.searchInputElement, text);
}
clickContentNodeSelectorResult(name) {
this.contentList.dataTablePage().clickRowByContent(name);
async clickContentNodeSelectorResult(name): Promise<void> {
await this.contentList.dataTablePage().clickRowByContent(name);
}
contentListPage() {
contentListPage(): DocumentListPage {
return this.contentList;
}
}

View File

@@ -17,12 +17,13 @@
import { by, element } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { ElementFinder } from 'protractor';
export class DownloadDialogPage {
cancelButton = element(by.id(`cancel-button`));
cancelButton: ElementFinder = element(by.id(`cancel-button`));
clickCancelButton() {
return BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element, ElementFinder, browser } from 'protractor';
import { by, element, ElementFinder, browser, Locator } 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';
@@ -23,8 +23,8 @@ import { BrowserActions } from '../../core/utils/browser-actions';
export class DocumentListPage {
rootElement: ElementFinder;
actionMenu = element(by.css('div[role="menu"]'));
optionButton = by.css('button[data-automation-id*="action_menu_"]');
actionMenu: ElementFinder = element(by.css('div[role="menu"]'));
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
tableBody: ElementFinder;
dataTable: DataTableComponentPage;
@@ -34,60 +34,55 @@ export class DocumentListPage {
this.tableBody = rootElement.all(by.css('div[class="adf-datatable-body"]')).first();
}
checkLockedIcon(content) {
async checkLockedIcon(content): Promise<void> {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock'));
BrowserVisibility.waitUntilElementIsVisible(lockIcon);
return this;
await BrowserVisibility.waitUntilElementIsVisible(lockIcon);
}
checkUnlockedIcon(content) {
async checkUnlockedIcon(content): Promise<void> {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock_open'));
BrowserVisibility.waitUntilElementIsVisible(lockIcon);
return this;
await BrowserVisibility.waitUntilElementIsVisible(lockIcon);
}
waitForTableBody() {
return BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
getTooltip(nodeName) {
return this.dataTable.getTooltip('Display name', nodeName);
async getTooltip(nodeName): Promise<string> {
return await this.dataTable.getTooltip('Display name', nodeName);
}
selectRow(nodeName) {
return this.dataTable.selectRow('Display name', nodeName);
async selectRow(nodeName): Promise<void> {
await this.dataTable.selectRow('Display name', nodeName);
}
rightClickOnRow(nodeName) {
return this.dataTable.rightClickOnRow('Display name', nodeName);
async rightClickOnRow(nodeName): Promise<void> {
await this.dataTable.rightClickOnRow('Display name', nodeName);
}
clickOnActionMenu(content) {
BrowserActions.closeMenuAndDialogs();
const row = this.dataTable.getRow('Display name', content);
BrowserActions.click(row.element(this.optionButton));
BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
browser.sleep(500);
return this;
async clickOnActionMenu(content): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const row: ElementFinder = this.dataTable.getRow('Display name', content);
await BrowserActions.click(row.element(this.optionButton));
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
await browser.sleep(500);
}
checkActionMenuIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.actionMenu);
return this;
async checkActionMenuIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.actionMenu);
}
dataTablePage() {
dataTablePage(): DataTableComponentPage {
return new DataTableComponentPage(this.rootElement);
}
getAllRowsColumnValues(column) {
return this.dataTable.getAllRowsColumnValues(column);
async getAllRowsColumnValues(column) {
return await this.dataTable.getAllRowsColumnValues(column);
}
doubleClickRow(nodeName) {
this.dataTable.doubleClickRow('Display name', nodeName);
return this;
async doubleClickRow(nodeName): Promise<void> {
await this.dataTable.doubleClickRow('Display name', nodeName);
}
}

View File

@@ -24,27 +24,27 @@ export class LikePage {
likeButton = element(by.css(`span[class="adf-like-grey"]`));
unlikeButton = element(by.css(`span[class="adf-like-select"]`));
getLikeCounter() {
async getLikeCounter(): Promise<string> {
return BrowserActions.getText(this.likeCounter);
}
clickLike() {
return BrowserActions.click(this.likeButton);
async clickLike(): Promise<void> {
await BrowserActions.click(this.likeButton);
}
clickUnlike() {
return BrowserActions.click(this.unlikeButton);
async clickUnlike(): Promise<void> {
await BrowserActions.click(this.unlikeButton);
}
removeHoverFromLikeButton() {
browser.actions().mouseMove({x: 200, y: 200}).click().perform();
async removeHoverFromLikeButton(): Promise<void> {
await browser.actions().mouseMove({ x: 200, y: 200 }).click().perform();
}
getLikedIconColor() {
async getLikedIconColor(): Promise<string> {
return BrowserActions.getColor(this.unlikeButton);
}
getUnLikedIconColor() {
async getUnLikedIconColor(): Promise<string> {
return BrowserActions.getColor(this.likeButton);
}
}

View File

@@ -21,42 +21,42 @@ import { BrowserActions } from '../../core/utils/browser-actions';
export class RatePage {
rateComponent(rateValue: number) {
async rateComponent(rateValue: number) {
const unratedStar = element(by.css(`span[id="adf-rate-${rateValue}"]`));
return BrowserActions.click(unratedStar);
await BrowserActions.click(unratedStar);
}
removeRating(rateValue: number) {
async removeRating(rateValue: number): Promise<void> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
return BrowserActions.click(ratedStar);
await BrowserActions.click(ratedStar);
}
getRatingCounter() {
async getRatingCounter(): Promise<string> {
const ratingsCounter = element(by.css(`div[id="adf-rating-counter"]`));
return BrowserActions.getText(ratingsCounter);
}
isStarRated(rateValue: number) {
async isStarRated(rateValue: number): Promise<void> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
return BrowserVisibility.waitUntilElementIsVisible(ratedStar);
await BrowserVisibility.waitUntilElementIsVisible(ratedStar);
}
isNotStarRated(rateValue: number) {
async isNotStarRated(rateValue: number): Promise<void> {
const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`));
return BrowserVisibility.waitUntilElementIsVisible(unratedStar);
await BrowserVisibility.waitUntilElementIsVisible(unratedStar);
}
getRatedStarColor(rateValue: number) {
async getRatedStarColor(rateValue: number): Promise<string> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
return BrowserActions.getColor(ratedStar);
}
getUnratedStarColor(rateValue: number) {
async getUnratedStarColor(rateValue: number): Promise<string> {
const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`));
return BrowserActions.getColor(unratedStar);
}
getAverageStarColor(rateValue: number) {
async getAverageStarColor(rateValue: number): Promise<string> {
const coloredStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
return BrowserActions.getColor(coloredStar);
}

View File

@@ -15,148 +15,129 @@
* limitations under the License.
*/
import { by, browser, protractor } from 'protractor';
import { by, protractor, ElementFinder, Locator, element } from 'protractor';
import { DatePickerPage } from '../../../material/pages/date-picker.page';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class DateRangeFilterPage {
fromField = by.css('input[data-automation-id="date-range-from-input"]');
fromDateToggle = by.css('mat-datepicker-toggle[data-automation-id="date-range-from-date-toggle"]');
toField = by.css('input[data-automation-id="date-range-to-input"]');
toDateToggle = by.css('mat-datepicker-toggle[data-automation-id="date-range-to-date-toggle"]');
applyButton = by.css('button[data-automation-id="date-range-apply-btn"]');
clearButton = by.css('button[data-automation-id="date-range-clear-btn"]');
fromErrorMessage = by.css('mat-error[data-automation-id="date-range-from-error"]');
toErrorMessage = by.css('mat-error[data-automation-id="date-range-to-error"]');
filter;
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"]');
filter: ElementFinder;
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
getFromDate() {
return this.filter.element(this.fromField).getAttribute('value');
async getFromDate(): Promise<string> {
return await this.filter.element(this.fromField).getAttribute('value');
}
putFromDate(date) {
this.checkFromFieldIsDisplayed();
this.filter.element(this.fromField).clear();
this.filter.element(this.fromField).sendKeys(date);
this.filter.element(this.fromField).sendKeys(protractor.Key.ENTER);
return this;
async putFromDate(date): Promise<void> {
await this.checkFromFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.element(this.fromField), date);
await this.filter.element(this.fromField).sendKeys(protractor.Key.ENTER);
}
getFromCalendarSelectedDate() {
const selectedDate = this.openFromDatePicker().getSelectedDate();
new DatePickerPage().closeDatePicker();
async getFromCalendarSelectedDate(): Promise<string> {
const datePicker = await this.openFromDatePicker();
const selectedDate = await datePicker.getSelectedDate();
await datePicker.closeDatePicker();
return selectedDate;
}
openFromDatePicker() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromDateToggle));
this.filter.element(this.fromDateToggle).click();
return new DatePickerPage().checkDatePickerIsDisplayed();
async openFromDatePicker(): Promise<DatePickerPage> {
await BrowserActions.click(this.filter.element(this.fromDateToggle));
const datePicker = new DatePickerPage();
await datePicker.checkDatePickerIsDisplayed();
return datePicker;
}
openToDatePicker() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toDateToggle));
this.filter.element(this.toDateToggle).click();
return new DatePickerPage().checkDatePickerIsDisplayed();
async openToDatePicker(): Promise<DatePickerPage> {
await BrowserActions.click(this.filter.element(this.toDateToggle));
const datePicker = new DatePickerPage();
await datePicker.checkDatePickerIsDisplayed();
return datePicker;
}
clickFromField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromField));
this.filter.element(this.fromField).click();
return this;
async clickFromField(): Promise<void> {
await BrowserActions.click(this.filter.element(this.fromField));
}
checkFromErrorMessageIsDisplayed(msg: string) {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorMessage));
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.fromErrorMessage).getText()).toEqual(msg);
});
return this;
async checkFromErrorMessageIsDisplayed(msg: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorMessage));
const text = await BrowserActions.getText(this.filter.element(this.fromErrorMessage));
await expect(text).toEqual(msg);
}
checkFromErrorMessageIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorMessage));
return this;
async checkFromErrorMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorMessage));
}
checkFromFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromField));
return this;
async checkFromFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromField));
}
checkFromDateToggleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromDateToggle));
return this;
async checkFromDateToggleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromDateToggle));
}
getToDate() {
return this.filter.element(this.toField).getAttribute('value');
async getToDate(): Promise<string> {
return await this.filter.element(this.toField).getAttribute('value');
}
putToDate(date) {
this.checkToFieldIsDisplayed();
this.filter.element(this.toField).clear();
this.filter.element(this.toField).sendKeys(date);
this.filter.element(this.toField).sendKeys(protractor.Key.ENTER);
return this;
async putToDate(date): Promise<void> {
await this.checkToFieldIsDisplayed();
await BrowserActions.clearSendKeys(element(this.toField), date);
await this.filter.element(this.toField).sendKeys(protractor.Key.ENTER);
}
clickToField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toField));
this.filter.element(this.toField).click();
return this;
async clickToField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toField));
await BrowserActions.click(this.filter.element(this.toField));
}
checkToErrorMessageIsDisplayed(msg) {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorMessage));
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.toErrorMessage).getText()).toEqual(msg);
});
return this;
async checkToErrorMessageIsDisplayed(msg): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorMessage));
const text = await BrowserActions.getText(this.filter.element(this.toErrorMessage));
await expect(text).toEqual(msg);
}
checkToFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toField));
return this;
async checkToFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toField));
}
checkToDateToggleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toDateToggle));
return this;
async checkToDateToggleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toDateToggle));
}
clickApplyButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.applyButton));
this.filter.element(this.applyButton).click();
return this;
async clickApplyButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.applyButton));
}
checkApplyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
return this;
async checkApplyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
}
checkApplyButtonIsEnabled() {
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.applyButton).isEnabled()).toBe(true);
});
return this;
async checkApplyButtonIsEnabled(): Promise<void> {
const isEnabled = await this.filter.element(this.applyButton).isEnabled();
await expect(isEnabled).toBe(true);
}
checkApplyButtonIsDisabled() {
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.applyButton).isEnabled()).toBe(false);
});
return this;
async checkApplyButtonIsDisabled(): Promise<void> {
const isEnabled = await this.filter.element(this.applyButton).isEnabled();
await expect(isEnabled).toBe(false);
}
checkClearButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
return this;
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
}
}

View File

@@ -14,152 +14,120 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, protractor } from 'protractor';
import { by, ElementFinder, Locator, protractor } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class NumberRangeFilterPage {
fromInput = by.css('input[data-automation-id="number-range-from-input"]');
toInput = by.css('input[data-automation-id="number-range-to-input"]');
applyButton = by.css('button[data-automation-id="number-range-btn-apply"]');
clearButton = by.css('button[data-automation-id="number-range-btn-clear"]');
fromErrorInvalid = by.css('mat-error[data-automation-id="number-range-from-error-invalid"]');
fromErrorRequired = by.css('mat-error[data-automation-id="number-range-from-error-required"]');
toErrorInvalid = by.css('mat-error[data-automation-id="number-range-to-error-invalid"]');
toErrorRequired = by.css('mat-error[data-automation-id="number-range-to-error-required"]');
filter;
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"]');
filter: ElementFinder;
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
clearFromField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromInput));
this.filter.element(this.fromInput).getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filter.element(this.fromInput).sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
async clearFromField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromInput));
await BrowserActions.clearWithBackSpace(this.filter.element(this.fromInput));
}
getFromNumber() {
return this.filter.element(this.fromInput).getAttribute('value');
async getFromNumber(): Promise<string> {
return await this.filter.element(this.fromInput).getAttribute('value');
}
putFromNumber(value) {
this.checkFromFieldIsDisplayed();
this.filter.element(this.fromInput).clear();
this.filter.element(this.fromInput).sendKeys(value);
this.filter.element(this.fromInput).sendKeys(protractor.Key.ENTER);
return this;
async putFromNumber(value): Promise<void> {
await this.checkFromFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.element(this.fromInput), value);
await this.filter.element(this.fromInput).sendKeys(protractor.Key.ENTER);
}
getFromErrorRequired() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired));
return BrowserActions.getText(this.filter.element(this.fromErrorRequired));
async getFromErrorRequired(): Promise<string> {
return await BrowserActions.getText(this.filter.element(this.fromErrorRequired));
}
checkFromErrorRequiredIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired));
return this;
async checkFromErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired));
}
getFromErrorInvalid() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid));
return BrowserActions.getText(this.filter.element(this.fromErrorInvalid));
async getFromErrorInvalid(): Promise<string> {
return await BrowserActions.getText(this.filter.element(this.fromErrorInvalid));
}
checkFromErrorInvalidIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid));
return this;
async checkFromErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid));
}
checkFromFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromInput));
return this;
async checkFromFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromInput));
}
clearToField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toInput));
this.filter.element(this.toInput).getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filter.element(this.toInput).sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
async clearToField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toInput));
await BrowserActions.clearWithBackSpace(this.filter.element(this.toInput));
}
getToNumber() {
return this.filter.element(this.toInput).getAttribute('value');
async getToNumber(): Promise<string> {
return await this.filter.element(this.toInput).getAttribute('value');
}
putToNumber(value) {
this.checkToFieldIsDisplayed();
this.filter.element(this.toInput).clear();
this.filter.element(this.toInput).sendKeys(value);
this.filter.element(this.toInput).sendKeys(protractor.Key.ENTER);
return this;
async putToNumber(value): Promise<void> {
await this.checkToFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.element(this.toInput), value);
await this.filter.element(this.toInput).sendKeys(protractor.Key.ENTER);
}
getToErrorRequired() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired));
return BrowserActions.getText(this.filter.element(this.toErrorRequired));
async getToErrorRequired(): Promise<string> {
return await BrowserActions.getText(this.filter.element(this.toErrorRequired));
}
checkToErrorRequiredIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired));
return this;
async checkToErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired));
}
getToErrorInvalid() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid));
return BrowserActions.getText(this.filter.element(this.toErrorInvalid));
async getToErrorInvalid(): Promise<string> {
return await BrowserActions.getText(this.filter.element(this.toErrorInvalid));
}
checkToErrorInvalidIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid));
return this;
async checkToErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid));
}
checkToFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toInput));
return this;
async checkToFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toInput));
}
clickApplyButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.applyButton));
this.filter.element(this.applyButton).click();
return this;
async clickApplyButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.applyButton));
}
checkApplyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
return this;
async checkApplyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
}
checkApplyButtonIsEnabled() {
return this.filter.element(this.applyButton).isEnabled();
async checkApplyButtonIsEnabled(): Promise<boolean> {
return await this.filter.element(this.applyButton).isEnabled();
}
clickClearButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.clearButton));
this.filter.element(this.clearButton).click();
return this;
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.clearButton));
}
checkClearButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
return this;
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
}
checkNoErrorMessageIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorInvalid));
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorRequired));
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorInvalid));
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorRequired));
return this;
async checkNoErrorMessageIsDisplayed(): Promise<void> {
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));
}
}

View File

@@ -27,60 +27,51 @@ import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCategoriesPage {
checkListFiltersPage(filter: ElementFinder) {
static checkListFiltersPage(filter: ElementFinder): SearchCheckListPage {
return new SearchCheckListPage(filter);
}
textFiltersPage(filter: ElementFinder) {
static textFiltersPage(filter: ElementFinder): SearchTextPage {
return new SearchTextPage(filter);
}
radioFiltersPage(filter: ElementFinder) {
static radioFiltersPage(filter: ElementFinder): SearchRadioPage {
return new SearchRadioPage(filter);
}
dateRangeFilter(filter: ElementFinder) {
static dateRangeFilter(filter: ElementFinder): DateRangeFilterPage {
return new DateRangeFilterPage(filter);
}
numberRangeFilter(filter: ElementFinder) {
static numberRangeFilter(filter: ElementFinder): NumberRangeFilterPage {
return new NumberRangeFilterPage(filter);
}
sliderFilter(filter: ElementFinder) {
static sliderFilter(filter: ElementFinder): SearchSliderPage {
return new SearchSliderPage(filter);
}
checkFilterIsDisplayed(filter: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(filter);
return this;
async checkFilterIsDisplayed(filter: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(filter);
}
clickFilter(filter: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(filter);
filter.element(by.css('mat-expansion-panel-header')).click();
return this;
async clickFilter(filter: ElementFinder): Promise<void> {
await BrowserActions.click(filter.element(by.css('mat-expansion-panel-header')));
}
clickFilterHeader(filter: ElementFinder) {
async clickFilterHeader(filter: ElementFinder): Promise<void> {
const fileSizeFilterHeader = filter.element(by.css('mat-expansion-panel-header'));
BrowserVisibility.waitUntilElementIsClickable(fileSizeFilterHeader);
BrowserActions.click(fileSizeFilterHeader);
return this;
await BrowserActions.click(fileSizeFilterHeader);
}
checkFilterIsCollapsed(filter: ElementFinder) {
filter.getAttribute('class').then((elementClass) => {
expect(elementClass).not.toContain('mat-expanded');
});
return this;
async checkFilterIsCollapsed(filter: ElementFinder): Promise<void> {
const elementClass = await filter.getAttribute('class');
await expect(elementClass).not.toContain('mat-expanded');
}
checkFilterIsExpanded(filter: ElementFinder) {
filter.getAttribute('class').then((elementClass) => {
expect(elementClass).toContain('mat-expanded');
});
return this;
async checkFilterIsExpanded(filter: ElementFinder): Promise<void> {
const elementClass = await filter.getAttribute('class');
await expect(elementClass).toContain('mat-expanded');
}
}

View File

@@ -15,168 +15,143 @@
* limitations under the License.
*/
import { element, by, ElementFinder } from 'protractor';
import { element, by, ElementFinder, Locator, browser } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCheckListPage {
filter: ElementFinder;
inputBy = by.css('div[class*="mat-expansion-panel-content"] input');
showMoreBy = by.css('button[title="Show more"]');
showLessBy = by.css('button[title="Show less"]');
clearAllButton = by.css('button');
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');
constructor(filter: ElementFinder) {
this.filter = filter;
}
clickCheckListOption(option: string) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async clickCheckListOption(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.all(by.css(`mat-checkbox[data-automation-id*='${option}'] .mat-checkbox-inner-container`)).first();
BrowserActions.click(result);
await BrowserActions.click(result);
}
checkChipIsDisplayed(option: string) {
BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
return this;
async checkChipIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
}
checkChipIsNotDisplayed(option: string) {
BrowserVisibility.waitUntilElementIsNotOnPage(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
return this;
async checkChipIsNotDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
}
removeFilterOption(option: string) {
async removeFilterOption(option: string): Promise<void> {
const cancelChipButton = element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon'));
BrowserActions.click(cancelChipButton);
await BrowserActions.click(cancelChipButton);
}
async filterBy(option: string): Promise<SearchCheckListPage> {
await this.checkSearchFilterInputIsDisplayed();
await this.searchInFilter(option);
await this.clickCheckListOption(option);
return this;
}
filterBy(option: string) {
this.checkSearchFilterInputIsDisplayed();
this.searchInFilter(option);
this.clickCheckListOption(option);
return this;
async checkSearchFilterInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.all(this.inputBy).first());
}
checkSearchFilterInputIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.all(this.inputBy).first());
return this;
}
searchInFilter(option: string) {
BrowserVisibility.waitUntilElementIsClickable(this.filter);
async searchInFilter(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.all(this.inputBy).first();
BrowserVisibility.waitUntilElementIsClickable(inputElement);
inputElement.clear();
this.filter.all(this.inputBy).first().sendKeys(option);
return this;
await BrowserVisibility.waitUntilElementIsClickable(inputElement);
await BrowserActions.clearSendKeys(inputElement, option);
}
checkShowLessButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showLessBy));
return this;
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showLessBy));
}
checkShowLessButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
return this;
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
}
checkShowMoreButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
return this;
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
}
checkShowMoreButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showMoreBy));
return this;
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showMoreBy));
}
clickShowMoreButtonUntilIsNotDisplayed() {
this.filter.element(this.showMoreBy).isDisplayed().then(async (visible) => {
if (visible) {
this.filter.element(this.showMoreBy).click();
this.clickShowMoreButtonUntilIsNotDisplayed();
}
}, () => {
});
return this;
async clickShowMoreButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.element(this.showMoreBy));
if (visible) {
await BrowserActions.click(this.filter.element(this.showMoreBy));
await this.clickShowMoreButtonUntilIsNotDisplayed();
}
}
clickShowLessButtonUntilIsNotDisplayed() {
this.filter.element(this.showLessBy).isDisplayed().then(async (visible) => {
if (visible) {
this.filter.element(this.showLessBy).click();
this.clickShowLessButtonUntilIsNotDisplayed();
}
}, () => {
});
return this;
async clickShowLessButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.element(this.showLessBy));
if (visible) {
await BrowserActions.click(this.filter.element(this.showLessBy));
await this.clickShowLessButtonUntilIsNotDisplayed();
}
}
getBucketNumberOfFilterType(option: string) {
async getBucketNumberOfFilterType(option: string): Promise<any> {
const fileTypeFilter = this.filter.all(by.css('mat-checkbox[data-automation-id*=".' + option + '"] span')).first();
BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter);
const bucketNumber = fileTypeFilter.getText().then((valueOfBucket) => {
const numberOfBucket = valueOfBucket.split('(')[1];
const totalNumberOfBucket = numberOfBucket.split(')')[0];
return totalNumberOfBucket.trim();
});
return bucketNumber;
await BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter);
const valueOfBucket = await BrowserActions.getText(fileTypeFilter);
const numberOfBucket = valueOfBucket.split('(')[1];
const totalNumberOfBucket = numberOfBucket.split(')')[0];
return totalNumberOfBucket.trim();
}
checkCheckListOptionIsDisplayed(option: string) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async checkCheckListOptionIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}']`));
return BrowserVisibility.waitUntilElementIsVisible(result);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
checkCheckListOptionIsNotSelected(option: string) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async checkCheckListOptionIsNotSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`));
return BrowserVisibility.waitUntilElementIsNotVisible(result);
await BrowserVisibility.waitUntilElementIsNotVisible(result);
}
checkCheckListOptionIsSelected(option: string) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async checkCheckListOptionIsSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`));
return BrowserVisibility.waitUntilElementIsVisible(result);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
checkClearAllButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async checkClearAllButtonIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(this.clearAllButton);
return BrowserVisibility.waitUntilElementIsVisible(result);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
clickClearAllButton() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async clickClearAllButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(this.clearAllButton);
BrowserVisibility.waitUntilElementIsVisible(result);
return BrowserActions.click(result);
await BrowserActions.click(result);
}
getCheckListOptionsNumberOnPage() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async getCheckListOptionsNumberOnPage(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const checkListOptions = this.filter.all(by.css('div[class="checklist"] mat-checkbox'));
return checkListOptions.count();
}
clickShowMoreButton() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
return this.filter.element(this.showMoreBy).click();
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.showMoreBy));
}
clickShowLessButton() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
return this.filter.element(this.showLessBy).click();
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.showLessBy));
}
}

View File

@@ -18,58 +18,59 @@
import { element, by, browser } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { ElementFinder } from 'protractor';
export class SearchRadioPage {
filter;
showMoreButton = element(by.css('adf-search-radio button[title="Show more"]'));
showLessButton = element(by.css('adf-search-radio button[title="Show less"]'));
filter: ElementFinder;
showMoreButton: ElementFinder = element(by.css('adf-search-radio button[title="Show more"]'));
showLessButton: ElementFinder = element(by.css('adf-search-radio button[title="Show less"]'));
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
checkFilterRadioButtonIsDisplayed(filterName: string) {
async checkFilterRadioButtonIsDisplayed(filterName: string): Promise<void> {
const filterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"]'));
return BrowserVisibility.waitUntilElementIsVisible(filterType);
await BrowserVisibility.waitUntilElementIsVisible(filterType);
}
checkFilterRadioButtonIsChecked(filterName: string) {
async checkFilterRadioButtonIsChecked(filterName: string): Promise<void> {
const selectedFilterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"][class*="checked"]'));
return BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
await BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
}
clickFilterRadioButton(filterName: string) {
browser.executeScript(`document.querySelector('[data-automation-id="search-radio-${filterName}"] input').click();`);
async clickFilterRadioButton(filterName: string): Promise<void> {
await browser.executeScript(`document.querySelector('[data-automation-id="search-radio-${filterName}"] input').click();`);
}
getRadioButtonsNumberOnPage() {
async getRadioButtonsNumberOnPage(): Promise<number> {
const radioButtons = element.all(by.css('mat-radio-button'));
return radioButtons.count();
}
checkShowMoreButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
}
checkShowLessButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
}
checkShowMoreButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.showMoreButton);
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showMoreButton);
}
checkShowLessButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
}
clickShowMoreButton() {
return BrowserActions.click(this.showMoreButton);
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.showMoreButton);
}
clickShowLessButton() {
return BrowserActions.click(this.showLessButton);
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.showLessButton);
}
}

View File

@@ -15,62 +15,64 @@
* limitations under the License.
*/
import { browser, by } from 'protractor';
import { browser, by, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchSliderPage {
filter;
slider = by.css('mat-slider[data-automation-id="slider-range"]');
clearButton = by.css('button[data-automation-id="slider-btn-clear"]');
sliderWithThumbLabel = by.css('mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]');
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"]');
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
getMaxValue() {
return this.filter.element(this.slider).getAttribute('aria-valuemax');
async getMaxValue() {
return await this.filter.element(this.slider).getAttribute('aria-valuemax');
}
getMinValue() {
return this.filter.element(this.slider).getAttribute('aria-valuemin');
async getMinValue() {
return await this.filter.element(this.slider).getAttribute('aria-valuemin');
}
getValue() {
return this.filter.element(this.slider).getAttribute('aria-valuenow');
async getValue() {
return await this.filter.element(this.slider).getAttribute('aria-valuenow');
}
setValue(value: number) {
browser.actions().dragAndDrop(
this.filter.element(this.slider).element(by.css('div[class="mat-slider-thumb"]')),
{ x: value * 10, y: 0 }
).perform();
return this;
async setValue(value: number): Promise<void> {
const elem = this.filter.element(this.slider).element(by.css('div[class="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();
}
checkSliderIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.slider));
return this;
async checkSliderIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.slider));
}
checkSliderWithThumbLabelIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.sliderWithThumbLabel));
return this;
async checkSliderIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.slider));
}
clickClearButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.clearButton));
this.filter.element(this.clearButton).click();
return this;
async checkSliderWithThumbLabelIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.sliderWithThumbLabel));
}
checkClearButtonIsEnabled() {
return this.filter.element(this.clearButton).isEnabled();
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.clearButton));
}
checkClearButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
return this;
async checkClearButtonIsEnabled() {
return await this.filter.element(this.clearButton).isEnabled();
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
}
async checkClearButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.clearButton));
}
}

View File

@@ -15,22 +15,21 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchSortingPickerPage {
sortingSelector = element(by.css('adf-sorting-picker div[class="mat-select-arrow"]'));
orderArrow = element(by.css('adf-sorting-picker button mat-icon'));
optionsDropdown = element(by.css('div[class*="mat-select-panel"]'));
sortingSelector: ElementFinder = element(by.css('adf-sorting-picker div[class="mat-select-arrow"]'));
orderArrow: ElementFinder = element(by.css('adf-sorting-picker button mat-icon'));
optionsDropdown: ElementFinder = element(by.css('div .mat-select-panel'));
sortBy(sortOrder: string, sortType: string | RegExp) {
BrowserActions.click(this.sortingSelector);
async sortBy(sortOrder: string, sortType: string | RegExp): Promise<void> {
await BrowserActions.click(this.sortingSelector);
const selectedSortingOption = element(by.cssContainingText('span[class="mat-option-text"]', sortType));
BrowserActions.click(selectedSortingOption);
this.sortByOrder(sortOrder);
await BrowserActions.click(selectedSortingOption);
await this.sortByOrder(sortOrder);
}
/**
@@ -38,66 +37,57 @@ export class SearchSortingPickerPage {
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
sortByOrder(sortOrder: string) {
BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
this.orderArrow.getText().then((result) => {
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (result !== 'arrow_upward') {
browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
} else {
if (result === 'arrow_upward') {
browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
async sortByOrder(sortOrder: string): Promise<any> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
const result = await BrowserActions.getText(this.orderArrow);
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (result !== 'arrow_upward') {
await browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
});
} else {
if (result === 'arrow_upward') {
await browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
}
}
clickSortingOption(option) {
async clickSortingOption(option): Promise<void> {
const selectedSortingOption = element(by.cssContainingText('span[class="mat-option-text"]', option));
BrowserActions.click(selectedSortingOption);
return this;
await BrowserActions.click(selectedSortingOption);
}
clickSortingSelector() {
BrowserActions.click(this.sortingSelector);
return this;
async clickSortingSelector(): Promise<void> {
await BrowserActions.click(this.sortingSelector);
}
checkOptionIsDisplayed(option) {
async checkOptionIsDisplayed(option): Promise<void> {
const optionSelector = this.optionsDropdown.element(by.cssContainingText('span[class="mat-option-text"]', option));
BrowserVisibility.waitUntilElementIsVisible(optionSelector);
return this;
await BrowserVisibility.waitUntilElementIsVisible(optionSelector);
}
checkOptionIsNotDisplayed(option) {
async checkOptionIsNotDisplayed(option): Promise<void> {
const optionSelector = this.optionsDropdown.element(by.cssContainingText('span[class="mat-option-text"]', option));
BrowserVisibility.waitUntilElementIsNotVisible(optionSelector);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(optionSelector);
}
checkOptionsDropdownIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.optionsDropdown);
return this;
async checkOptionsDropdownIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.optionsDropdown);
}
checkSortingSelectorIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.sortingSelector);
return this;
async checkSortingSelectorIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sortingSelector);
}
checkOrderArrowIsDownward() {
const deferred = protractor.promise.defer();
BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
this.orderArrow.getText().then((result) => {
deferred.fulfill(result !== 'arrow_upward');
});
return deferred.promise;
async checkOrderArrowIsDownward(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
const result = await BrowserActions.getText(this.orderArrow);
return result !== 'arrow_upward';
}
checkOrderArrowIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
return this;
async checkOrderArrowIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
}
}

View File

@@ -15,27 +15,28 @@
* limitations under the License.
*/
import { protractor, by } from 'protractor';
import { protractor, by, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchTextPage {
filter;
inputBy = by.css('input');
filter: ElementFinder;
inputBy: Locator = by.css('input');
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
getNamePlaceholder() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async getNamePlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this.filter.element(this.inputBy).getAttribute('placeholder');
}
searchByName(name: string) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
this.filter.element(this.inputBy).clear();
this.filter.element(this.inputBy).sendKeys(name).sendKeys(protractor.Key.ENTER);
async searchByName(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserActions.clearSendKeys(this.filter.element(this.inputBy), name);
await this.filter.element(this.inputBy).sendKeys(protractor.Key.ENTER);
}
}

View File

@@ -26,13 +26,13 @@ export class ApiService {
constructor(clientId: string, host: string, hostSso: string, provider: string) {
this.config = {
provider: provider,
provider,
hostBpm: host,
hostEcm: host,
authType: 'OAUTH',
oauth2: {
host: hostSso,
clientId: clientId,
clientId,
scope: 'openid',
secret: '',
implicitFlow: false,
@@ -46,18 +46,18 @@ export class ApiService {
this.apiService = new AlfrescoApi(this.config);
}
async login(username: string, password: string) {
async login(username: string, password: string): Promise<void> {
await this.apiService.login(username, password);
}
async performBpmOperation(path: string, method: string, queryParams: any, postBody: any) {
async performBpmOperation(path: string, method: string, queryParams: any, postBody: any): Promise<any> {
const uri = this.config.hostBpm + path;
const pathParams = {}, formParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
const headerParams = {
'Authorization': 'bearer ' + this.apiService.oauth2Auth.token
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
@@ -67,14 +67,14 @@ export class ApiService {
});
}
async performIdentityOperation(path: string, method: string, queryParams: any, postBody: any) {
async performIdentityOperation(path: string, method: string, queryParams: any, postBody: any): Promise<any> {
const uri = this.config.oauth2.host.replace('/realms', '/admin/realms') + path;
const pathParams = {}, formParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
const headerParams = {
'Authorization': 'bearer ' + this.apiService.oauth2Auth.token
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,

View File

@@ -25,14 +25,14 @@ export class ApplicationsService {
this.api = api;
}
async getApplicationsByStatus(status) {
async getApplicationsByStatus(status): Promise<any> {
try {
const path = '/deployment-service/v1/applications';
const method = 'GET';
const queryParams = {'status': status}, postBody = {};
const queryParams = { status: status }, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Get Applications - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);

View File

@@ -17,9 +17,6 @@
import { ApiService } from '../api.service';
import { StringUtil } from '../../utils/string.util';
import { browser } from 'protractor';
const GROUP_SUFFIX = browser.params.testConfig ? browser.params.testConfig.projectName : 'TestGroup';
export class GroupIdentityService {
@@ -29,27 +26,27 @@ export class GroupIdentityService {
this.api = api;
}
async createIdentityGroup(groupName = StringUtil.generateRandomString(5)) {
async createIdentityGroup(groupName = StringUtil.generateRandomString(5)): Promise<any> {
await this.createGroup(groupName);
const group = await this.getGroupInfoByGroupName(groupName);
return group;
}
async deleteIdentityGroup(groupId) {
async deleteIdentityGroup(groupId): Promise<void> {
await this.deleteGroup(groupId);
}
async createGroup(groupName) {
async createGroup(groupName): Promise<any> {
const path = '/groups';
const method = 'POST';
const queryParams = {}, postBody = {
'name': groupName + GROUP_SUFFIX
name: groupName + 'TestGroup'
};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
async deleteGroup(groupId) {
async deleteGroup(groupId): Promise<any> {
const path = `/groups/${groupId}`;
const method = 'DELETE';
const queryParams = {}, postBody = {};
@@ -57,20 +54,20 @@ export class GroupIdentityService {
return data;
}
async getGroupInfoByGroupName(groupName) {
async getGroupInfoByGroupName(groupName): Promise<any> {
const path = `/groups`;
const method = 'GET';
const queryParams = { 'search': groupName }, postBody = {};
const queryParams = { search: groupName }, postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data[0];
}
async assignRole(groupId, roleId, roleName) {
async assignRole(groupId, roleId, roleName): Promise<any> {
const path = `/groups/${groupId}/role-mappings/realm`;
const method = 'POST';
const queryParams = {},
postBody = [{ 'id': roleId, 'name': roleName }];
postBody = [{ id: roleId, name: roleName }];
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
@@ -83,15 +80,15 @@ export class GroupIdentityService {
* @param roleId ID of the clientRole
* @param roleName of the clientRole
*/
async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string) {
async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise<any> {
const path = `/groups/${groupId}/role-mappings/clients/${clientId}`;
const method = 'POST', queryParams = {},
postBody = [{
'id': roleId,
'name': roleName,
'composite': false,
'clientRole': true,
'containerId': clientId
id: roleId,
name: roleName,
composite: false,
clientRole: true,
containerId: clientId
}];
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
@@ -102,7 +99,7 @@ export class GroupIdentityService {
* @param applicationName Name of the app
* @returns client ID string
*/
async getClientIdByApplicationName(applicationName: string) {
async getClientIdByApplicationName(applicationName: string): Promise<any> {
const path = `/clients`;
const method = 'GET', queryParams = { clientId: applicationName }, postBody = {};

View File

@@ -36,7 +36,7 @@ export class IdentityService {
APS_DEVOPS_USER: 'APS_DEVOPS'
};
async createIdentityUserWithRole(apiService: ApiService, roles: string[]) {
async createIdentityUserWithRole(apiService: ApiService, roles: string[]): Promise<any> {
const rolesService = new RolesService(apiService);
const user = await this.createIdentityUser();
for (let i = 0; i < roles.length; i++) {
@@ -46,7 +46,7 @@ export class IdentityService {
return user;
}
async createIdentityUser(user: UserModel = new UserModel()) {
async createIdentityUser(user: UserModel = new UserModel()): Promise<any> {
await this.createUser(user);
const userIdentity = await this.getUserInfoByUsername(user.username);
@@ -55,15 +55,15 @@ export class IdentityService {
return user;
}
async createIdentityUserAndSyncECMBPM(user: UserModel) {
async createIdentityUserAndSyncECMBPM(user: UserModel): Promise<void> {
if (this.api.config.provider === 'ECM' || this.api.config.provider === 'ALL') {
const createUser: PersonBodyCreate = <PersonBodyCreate> {
const createUser: PersonBodyCreate = {
firstName: user.firstName,
lastName: user.lastName,
password: user.password,
email: user.email,
id: user.email
};
} as PersonBodyCreate;
await this.api.apiService.core.peopleApi.addPerson(createUser);
}
@@ -82,89 +82,89 @@ export class IdentityService {
await this.createIdentityUser(user);
}
async deleteIdentityUser(userId) {
async deleteIdentityUser(userId): Promise<void> {
await this.deleteUser(userId);
}
async createUser(user: UserModel) {
async createUser(user: UserModel): Promise<any> {
try {
const path = '/users';
const method = 'POST';
const queryParams = {}, postBody = {
'username': user.username,
'firstName': user.firstName,
'lastName': user.lastName,
'enabled': true,
'email': user.email
username: user.username,
firstName: user.firstName,
lastName: user.lastName,
enabled: true,
email: user.email
};
return await this.api.performIdentityOperation(path, method, queryParams, postBody);
return this.api.performIdentityOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Create User - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async deleteUser(userId) {
async deleteUser(userId): Promise<any> {
const path = `/users/${userId}`;
const method = 'DELETE';
const queryParams = {}, postBody = {};
return await this.api.performIdentityOperation(path, method, queryParams, postBody);
return this.api.performIdentityOperation(path, method, queryParams, postBody);
}
async getUserInfoByUsername(username) {
async getUserInfoByUsername(username): Promise<any> {
const path = `/users`;
const method = 'GET';
const queryParams = {'username': username}, postBody = {};
const queryParams = { username: username }, postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data[0];
}
async resetPassword(id, password) {
async resetPassword(id, password): Promise<any> {
const path = `/users/${id}/reset-password`;
const method = 'PUT';
const queryParams = {},
postBody = {'type': 'password', 'value': password, 'temporary': false};
postBody = { type: 'password', value: password, temporary: false };
return await this.api.performIdentityOperation(path, method, queryParams, postBody);
return this.api.performIdentityOperation(path, method, queryParams, postBody);
}
async addUserToGroup(userId, groupId) {
async addUserToGroup(userId, groupId): Promise<any> {
try {
const path = `/users/${userId}/groups/${groupId}`;
const method = 'PUT';
const queryParams = {},
postBody = {'realm': 'alfresco', 'userId': userId, 'groupId': groupId};
postBody = { realm: 'alfresco', userId: userId, groupId: groupId };
return await this.api.performIdentityOperation(path, method, queryParams, postBody);
return this.api.performIdentityOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Add User To Group - Service error, Response: ', JSON.parse(JSON.stringify(error)));
}
}
async assignRole(userId, roleId, roleName) {
async assignRole(userId, roleId, roleName): Promise<any> {
const path = `/users/${userId}/role-mappings/realm`;
const method = 'POST';
const queryParams = {},
postBody = [{'id': roleId, 'name': roleName}];
postBody = [{ id: roleId, name: roleName }];
return await this.api.performIdentityOperation(path, method, queryParams, postBody);
return this.api.performIdentityOperation(path, method, queryParams, postBody);
}
async deleteClientRole(userId: string, clientId: string, roleId: string, roleName: string) {
async deleteClientRole(userId: string, clientId: string, roleId: string, roleName: string): Promise<any> {
const path = `/users/${userId}/role-mappings/clients/${clientId}`;
const method = 'DELETE', queryParams = {},
postBody = [{
'id': roleId,
'name': roleName,
'composite': false,
'clientRole': true,
'containerId': clientId
id: roleId,
name: roleName,
composite: false,
clientRole: true,
containerId: clientId
}];
return await this.api.performIdentityOperation(path, method, queryParams, postBody);
return this.api.performIdentityOperation(path, method, queryParams, postBody);
}
}

View File

@@ -25,30 +25,28 @@ export class QueryService {
this.api = api;
}
async getProcessInstanceTasks(processInstanceId, appName) {
async getProcessInstanceTasks(processInstanceId, appName): Promise<any> {
try {
const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/tasks';
const method = 'GET';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('get process-instances Service error');
}
}
async getProcessInstanceSubProcesses(processInstanceId, appName) {
async getProcessInstanceSubProcesses(processInstanceId, appName): Promise<any> {
try {
const path = '/' + appName + '/query/v1/process-instances/' + processInstanceId + '/subprocesses';
const method = 'GET';
const queryParams = {};
const data = await this.api.performBpmOperation(path, method, queryParams, {});
return data;
return this.api.performBpmOperation(path, method, queryParams, {});
} catch (error) {
// tslint:disable-next-line:no-console
console.log('get subprocesses process-instances Service error');

View File

@@ -25,7 +25,7 @@ export class RolesService {
this.api = api;
}
async getRoleIdByRoleName(roleName) {
async getRoleIdByRoleName(roleName): Promise<any> {
const path = `/roles`;
const method = 'GET';
let roleId;
@@ -40,7 +40,7 @@ export class RolesService {
return roleId;
}
async getClientRoleIdByRoleName(groupId, clientId, clientRoleName) {
async getClientRoleIdByRoleName(groupId, clientId, clientRoleName): Promise<any> {
const path = `/groups/${groupId}/role-mappings/clients/${clientId}/available`;
const method = 'GET';
let clientRoleId;

View File

@@ -25,51 +25,51 @@ export class TasksService {
this.api = api;
}
async createStandaloneTask(taskName, appName, options?) {
async createStandaloneTask(taskName, appName, options?): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST';
const queryParams = {}, postBody = {
'name': taskName,
'payloadType': 'CreateTaskPayload',
name: taskName,
payloadType: 'CreateTaskPayload',
...options
};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
}
}
async createStandaloneTaskWithForm(taskName, appName, formKey, options?) {
async createStandaloneTaskWithForm(taskName, appName, formKey, options?): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST';
const queryParams = {}, postBody = {
'name': taskName,
'payloadType': 'CreateTaskPayload',
'formKey': formKey,
name: taskName,
payloadType: 'CreateTaskPayload',
formKey: formKey,
...options
};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Create FormTask - Service error, Response: ', JSON.parse(JSON.stringify(error)));
}
}
async completeTask(taskId, appName) {
async completeTask(taskId, appName): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId + '/complete';
const method = 'POST';
const queryParams = {}, postBody = { 'payloadType': 'CompleteTaskPayload' };
const queryParams = {}, postBody = { payloadType: 'CompleteTaskPayload' };
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Complete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
@@ -77,56 +77,56 @@ export class TasksService {
}
async claimTask(taskId, appName) {
async claimTask(taskId, appName): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId + `/claim`;
const method = 'POST';
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Claim Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async deleteTask(taskId, appName) {
async deleteTask(taskId, appName): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId;
const method = 'DELETE';
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Delete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async createAndCompleteTask(taskName, appName) {
async createAndCompleteTask(taskName, appName): Promise<any> {
const task = await this.createStandaloneTask(taskName, appName);
await this.claimTask(task.entry.id, appName);
await this.completeTask(task.entry.id, appName);
return task;
}
async getTask(taskId, appName) {
async getTask(taskId, appName): Promise<any> {
try {
const path = '/' + appName + '/query/v1/tasks/' + taskId;
const method = 'GET';
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Get Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async getTaskId(taskName, appName) {
async getTaskId(taskName, appName): Promise<any> {
try {
const path = '/' + appName + '/query/v1/tasks';
const method = 'GET';
@@ -141,15 +141,15 @@ export class TasksService {
}
}
async createStandaloneSubtask(parentTaskId, appName, name) {
async createStandaloneSubtask(parentTaskId, appName, name): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST';
const queryParams = {},
postBody = { 'name': name, 'parentTaskId': parentTaskId, 'payloadType': 'CreateTaskPayload' };
postBody = { name: name, parentTaskId: parentTaskId, payloadType: 'CreateTaskPayload' };
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
console.log('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);

View File

@@ -15,8 +15,7 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { ElementFinder, ElementArrayFinder } from 'protractor/built/element';
import { browser, by, element, Locator, protractor, ElementFinder, ElementArrayFinder } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
@@ -24,22 +23,20 @@ export class DataTableComponentPage {
rootElement: ElementFinder;
list: ElementArrayFinder;
contents;
tableBody;
spinner;
rows = by.css(`adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row']`);
allColumns;
selectedRowNumber;
allSelectedRows;
selectAll;
copyColumnTooltip;
contents: ElementArrayFinder;
tableBody: ElementFinder;
rows: Locator = by.css(`adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row']`);
allColumns: ElementArrayFinder;
selectedRowNumber: ElementFinder;
allSelectedRows: ElementArrayFinder;
selectAll: ElementFinder;
copyColumnTooltip: ElementFinder;
constructor(rootElement: ElementFinder = element.all(by.css('adf-datatable')).first()) {
this.rootElement = rootElement;
this.list = this.rootElement.all(by.css(`div[class*='adf-datatable-body'] div[class*='adf-datatable-row']`));
this.contents = this.rootElement.all(by.css('div[class="adf-datatable-body"] span'));
this.tableBody = this.rootElement.all(by.css(`div[class='adf-datatable-body']`)).first();
this.spinner = this.rootElement.element(by.css('mat-progress-spinner'));
this.allColumns = this.rootElement.all(by.css('div[data-automation-id*="auto_id_entry."]'));
this.selectedRowNumber = this.rootElement.element(by.css(`div[class*='is-selected'] div[data-automation-id*='text_']`));
this.allSelectedRows = this.rootElement.all(by.css(`div[class*='is-selected']`));
@@ -47,183 +44,155 @@ export class DataTableComponentPage {
this.copyColumnTooltip = this.rootElement.element(by.css(`adf-copy-content-tooltip span`));
}
checkAllRowsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
return this;
async checkAllRowsButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
}
checkAllRows() {
BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
BrowserVisibility.waitUntilElementIsClickable(this.selectAll).then(() => {
this.selectAll.click();
BrowserVisibility.waitUntilElementIsVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
});
return this;
async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
}
uncheckAllRows() {
BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
BrowserVisibility.waitUntilElementIsClickable(this.selectAll).then(() => {
this.selectAll.click();
BrowserVisibility.waitUntilElementIsNotOnPage(this.selectAll.element(by.css('input[aria-checked="true"]')));
});
return this;
async uncheckAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
}
clickCheckbox(columnName, columnValue) {
async clickCheckbox(columnName, columnValue): Promise<void> {
const checkbox = this.getRowCheckbox(columnName, columnValue);
BrowserActions.click(checkbox);
return this;
await BrowserActions.click(checkbox);
}
checkRowIsNotChecked(columnName, columnValue) {
BrowserVisibility.waitUntilElementIsNotOnPage(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
async checkRowIsNotChecked(columnName, columnValue): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
}
checkRowIsChecked(columnName, columnValue) {
async checkRowIsChecked(columnName, columnValue): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]')));
}
getRowCheckbox(columnName, columnValue) {
return this.getRow(columnName, columnValue)
.element(by.css('mat-checkbox'));
getRowCheckbox(columnName, columnValue): ElementFinder {
return this.getRow(columnName, columnValue).element(by.css('mat-checkbox'));
}
checkNoRowIsSelected() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.selectedRowNumber);
async checkNoRowIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
}
getNumberOfSelectedRows() {
return this.allSelectedRows.count();
async getNumberOfSelectedRows(): Promise<number> {
return await this.allSelectedRows.count();
}
selectRowWithKeyboard(columnName, columnValue) {
async selectRow(columnName, columnValue): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const row = this.getRow(columnName, columnValue);
browser.actions().sendKeys(protractor.Key.COMMAND).click(row).perform();
await BrowserActions.click(row);
}
selectRow(columnName, columnValue) {
BrowserActions.closeMenuAndDialogs();
const row = this.getRow(columnName, columnValue);
BrowserActions.click(row);
return this;
async selectRowWithKeyboard(columnName, columnValue): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(columnName, columnValue);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
checkRowIsSelected(columnName, columnValue) {
async checkRowIsSelected(columnName, columnValue): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsVisible(selectedRow);
return this;
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
}
checkRowIsNotSelected(columnName, columnValue) {
async checkRowIsNotSelected(columnName, columnValue): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsNotOnPage(selectedRow);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow);
}
getColumnValueForRow(identifyingColumn, identifyingValue, columnName) {
async getColumnValueForRow(identifyingColumn, identifyingValue, columnName): Promise<string> {
const row = this.getRow(identifyingColumn, identifyingValue);
BrowserVisibility.waitUntilElementIsVisible(row);
await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
return BrowserActions.getText(rowColumn);
return await BrowserActions.getText(rowColumn);
}
/**
* Check the list is sorted.
*
* @param sortOrder: 'ASC' if the list is expected to be sorted ascending and 'DESC' for descending
* @param sortOrder: 'ASC' if the list is await expected to be sorted ascending and 'DESC' for descending
* @param columnTitle: titleColumn column
* @return 'true' if the list is sorted as expected and 'false' if it isn't
* @return 'true' if the list is sorted as await expected and 'false' if it isn't
*/
checkListIsSorted(sortOrder: string, columnTitle: string) {
const deferred = protractor.promise.defer();
async checkListIsSorted(sortOrder: string, columnTitle: string): Promise<any> {
const column = element.all(by.css(`div.adf-datatable-cell[title='${columnTitle}'] span`));
BrowserVisibility.waitUntilElementIsVisible(column.first());
// await BrowserVisibility.waitUntilElementIsVisible(column.first());
const initialList = [];
column.each(function (currentElement) {
currentElement.getText().then(function (text) {
if (text.length !== 0) {
initialList.push(text.toLowerCase());
}
});
}).then(function () {
let sortedList = [...initialList];
sortedList = sortedList.sort();
if (sortOrder.toLocaleLowerCase() === 'desc') {
sortedList = sortedList.reverse();
await column.each(async (currentElement) => {
const text = await BrowserActions.getText(currentElement);
if (text.length !== 0) {
initialList.push(text.toLowerCase());
}
if (initialList.toString() !== sortedList.toString()) {
// tslint:disable-next-line:no-console
console.log('Wrong order');
// tslint:disable-next-line:no-console
console.log('List' + initialList.toString());
// tslint:disable-next-line:no-console
console.log('sortedList sortedList' + sortedList.toString());
}
deferred.fulfill(initialList.toString() === sortedList.toString());
});
return deferred.promise;
let sortedList = initialList;
sortedList = sortedList.sort();
if (sortOrder.toLocaleLowerCase() === 'desc') {
sortedList = sortedList.reverse();
}
return initialList.toString() === sortedList.toString();
}
rightClickOnRow(columnName, columnValue) {
BrowserActions.closeMenuAndDialogs();
async rightClickOnRow(columnName, columnValue): Promise<void> {
const row = this.getRow(columnName, columnValue);
browser.actions().click(row, protractor.Button.RIGHT).perform();
BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
await browser.actions().mouseMove(row).perform();
await browser.actions().click(row, protractor.Button.RIGHT).perform();
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}
rightClickOnRowByIndex(index: number) {
async getTooltip(columnName, columnValue): Promise<string> {
return await this.getCellElementByValue(columnName, columnValue).getAttribute('title');
}
async rightClickOnRowByIndex(index: number): Promise<void> {
const row = this.getRowByIndex(index);
BrowserActions.rightClick(row);
BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
await BrowserActions.rightClick(row);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}
getTooltip(columnName, columnValue) {
return this.getCellElementByValue(columnName, columnValue).getAttribute('title');
}
getFileHyperlink(filename) {
getFileHyperlink(filename): ElementFinder {
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));
}
numberOfRows() {
return this.rootElement.all(this.rows).count();
async numberOfRows(): Promise<number> {
return await this.rootElement.all(this.rows).count();
}
async getAllRowsColumnValues(column) {
const columnLocator = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='" + column + "'] span");
BrowserVisibility.waitUntilElementIsVisible(element.all(columnLocator).first());
const initialList: any = await element.all(columnLocator).getText();
return initialList.filter((el) => el);
await BrowserVisibility.waitUntilElementIsPresent(element.all(columnLocator).first());
return await element.all(columnLocator)
.filter(async (el) => await el.isPresent())
.map(async (el) => await el.getText());
}
async getRowsWithSameColumnValues(columnName, columnValue) {
const columnLocator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`);
BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
return this.rootElement.all(columnLocator).getText();
}
doubleClickRow(columnName: string, columnValue: string) {
BrowserActions.closeMenuAndDialogs();
async doubleClickRow(columnName: string, columnValue: string): Promise<void> {
const row = this.getRow(columnName, columnValue);
BrowserActions.click(row);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
await BrowserActions.click(row);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
waitForTableBody() {
BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
getFirstElementDetail(detail) {
async getFirstElementDetail(detail): Promise<string> {
const firstNode = element.all(by.css(`adf-datatable div[title="${detail}"] span`)).first();
return firstNode.getText();
return await BrowserActions.getText(firstNode);
}
geCellElementDetail(detail) {
geCellElementDetail(detail): ElementArrayFinder {
return element.all(by.css(`adf-datatable div[title="${detail}"] span`));
}
@@ -232,188 +201,157 @@ export class DataTableComponentPage {
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
sortByColumn(sortOrder: string, titleColumn: string) {
async sortByColumn(sortOrder: string, titleColumn: string): Promise<void> {
const locator = by.css(`div[data-automation-id="auto_id_${titleColumn}"]`);
BrowserVisibility.waitUntilElementIsVisible(element(locator));
return element(locator).getAttribute('class').then(function (result) {
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
element(locator).click();
}
}
} else {
if (result.includes('sorted-asc')) {
element(locator).click();
} else if (result.includes('sortable')) {
element(locator).click();
element(locator).click();
await BrowserVisibility.waitUntilElementIsVisible(element(locator));
const result = await element(locator).getAttribute('class');
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
await BrowserActions.click(element(locator));
}
}
return Promise.resolve();
});
} else {
if (result.includes('sorted-asc')) {
await BrowserActions.click(element(locator));
} else if (result.includes('sortable')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(element(locator));
}
}
}
checkContentIsDisplayed(columnName, columnValue) {
async checkContentIsDisplayed(columnName, columnValue): Promise<void> {
const row = this.getCellElementByValue(columnName, columnValue);
BrowserVisibility.waitUntilElementIsVisible(row);
return this;
await BrowserVisibility.waitUntilElementIsVisible(row);
}
checkContentIsNotDisplayed(columnName, columnValue) {
async checkContentIsNotDisplayed(columnName, columnValue): Promise<void> {
const row = this.getCellElementByValue(columnName, columnValue);
BrowserVisibility.waitUntilElementIsNotOnPage(row);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(row);
}
getRow(columnName, columnValue) {
const row = this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"]`)).first()
getRow(columnName, columnValue): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"]`)).first()
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row')]`));
return row;
}
getRowByIndex(index: number) {
const row = this.rootElement.element(by.xpath(`//div[contains(@class,'adf-datatable-body')]//div[contains(@class,'adf-datatable-row')][${index}]`));
return row;
getRowByIndex(index: number): ElementFinder {
return this.rootElement.element(by.xpath(`//div[contains(@class,'adf-datatable-body')]//div[contains(@class,'adf-datatable-row')][${index}]`));
}
contentInPosition(position) {
BrowserVisibility.waitUntilElementIsVisible(this.contents);
return this.contents.get(position - 1).getText();
async contentInPosition(position): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
return await BrowserActions.getText(this.contents.get(position - 1));
}
getCellElementByValue(columnName, columnValue) {
getCellElementByValue(columnName, columnValue): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`)).first();
}
checkSpinnerIsDisplayed() {
BrowserVisibility.waitUntilElementIsPresent(this.spinner);
return this;
async tableIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
}
checkSpinnerIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.spinner);
return this;
async waitTillContentLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
}
tableIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
return this;
async checkColumnIsDisplayed(column): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`)));
}
waitTillContentLoaded() {
return BrowserVisibility.waitUntilElementIsVisible(this.contents);
async getNumberOfColumns(): Promise<number> {
return await this.allColumns.count();
}
checkColumnIsDisplayed(column) {
BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`)));
return this;
async getNumberOfRows(): Promise<number> {
return await this.list.count();
}
getNumberOfColumns() {
return this.allColumns.count();
}
getNumberOfRows() {
return this.list.count();
}
getCellByRowNumberAndColumnName(rowNumber, columnName) {
getCellByRowNumberAndColumnName(rowNumber, columnName): ElementFinder {
return this.list.get(rowNumber).all(by.css(`div[title="${columnName}"] span`)).first();
}
getCellByRowContentAndColumn(rowColumn, rowContent, columnName) {
getCellByRowContentAndColumn(rowColumn, rowContent, columnName): ElementFinder {
return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`));
}
selectRowByContent(content) {
async selectRowByContent(content): Promise<void> {
const row = this.getCellByContent(content);
return row.click();
await BrowserActions.click(row);
}
checkRowByContentIsSelected(folderName) {
async checkRowByContentIsSelected(folderName): Promise<void> {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsVisible(selectedRow);
return this;
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
}
checkRowByContentIsNotSelected(folderName) {
async checkRowByContentIsNotSelected(folderName): Promise<void> {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsNotVisible(selectedRow);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow);
}
getCellByContent(content) {
const cell = this.rootElement.all(by.cssContainingText(`div[class*='adf-datatable-row'] div[class*='adf-datatable-cell']`, content)).first();
BrowserVisibility.waitUntilElementIsVisible(cell);
return cell;
return this.rootElement.all(by.cssContainingText(`div[class*='adf-datatable-row'] div[class*='adf-datatable-cell']`, content)).first();
}
checkCellByHighlightContent(content) {
async checkCellByHighlightContent(content) {
const cell = this.rootElement.element(by.cssContainingText(`div[class*='adf-datatable-row'] div[class*='adf-name-location-cell-name'] span.adf-highlight`, content));
BrowserVisibility.waitUntilElementIsVisible(cell);
return cell;
await BrowserVisibility.waitUntilElementIsVisible(cell);
}
clickRowByContent(name) {
async clickRowByContent(name): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
BrowserActions.click(resultElement);
await BrowserActions.click(resultElement);
}
clickRowByContentCheckbox(name) {
async clickRowByContentCheckbox(name): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first().element(by.xpath(`ancestor::div/div/mat-checkbox`));
BrowserActions.click(resultElement);
await browser.actions().mouseMove(resultElement);
await BrowserActions.click(resultElement);
}
checkRowContentIsDisplayed(content) {
async checkRowContentIsDisplayed(content): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
BrowserVisibility.waitUntilElementIsVisible(resultElement);
return this;
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
checkRowContentIsNotDisplayed(content) {
async checkRowContentIsNotDisplayed(content): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
BrowserVisibility.waitUntilElementIsNotVisible(resultElement);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(resultElement);
}
checkRowContentIsDisabled(content) {
async checkRowContentIsDisabled(content): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='disable']`)).first();
BrowserVisibility.waitUntilElementIsVisible(resultElement);
return this;
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
doubleClickRowByContent(name) {
async doubleClickRowByContent(name): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
BrowserActions.click(resultElement);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
await BrowserActions.click(resultElement);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
getCopyContentTooltip() {
return BrowserActions.getText(this.copyColumnTooltip);
async getCopyContentTooltip(): Promise<string> {
return await BrowserActions.getText(this.copyColumnTooltip);
}
copyContentTooltipIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotPresent(this.copyColumnTooltip);
return this;
async copyContentTooltipIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(this.copyColumnTooltip);
}
mouseOverColumn(columnName, columnValue) {
async mouseOverColumn(columnName, columnValue): Promise<void> {
const column = this.getCellElementByValue(columnName, columnValue);
this.mouseOverElement(column);
return this;
await this.mouseOverElement(column);
}
mouseOverElement(elem) {
BrowserVisibility.waitUntilElementIsVisible(elem);
browser.actions().mouseMove(elem).perform();
return this;
async mouseOverElement(elem): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(elem);
await browser.actions().mouseMove(elem).perform();
}
clickColumn(columnName, columnValue) {
BrowserActions.clickExecuteScript(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`);
return this;
async clickColumn(columnName, columnValue): Promise<void> {
await BrowserActions.clickExecuteScript(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`);
}
}

View File

@@ -18,36 +18,37 @@
import { BrowserVisibility } from '../utils/browser-visibility';
import { element, by } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
import { ElementFinder } from 'protractor';
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'));
backButton = element(by.id('adf-return-button'));
secondButton = element(by.id('adf-secondary-button'));
errorPageCode: ElementFinder = element(by.css('adf-error-content .adf-error-content-code'));
errorPageTitle: ElementFinder = element(by.css('adf-error-content .adf-error-content-title'));
errorPageDescription: ElementFinder = element(by.css('adf-error-content .adf-error-content-description'));
backButton: ElementFinder = element(by.id('adf-return-button'));
secondButton: ElementFinder = element(by.id('adf-secondary-button'));
clickBackButton() {
BrowserActions.click(this.backButton);
async clickBackButton(): Promise<void> {
await BrowserActions.click(this.backButton);
}
clickSecondButton() {
BrowserActions.click(this.secondButton);
async clickSecondButton(): Promise<void> {
await BrowserActions.click(this.secondButton);
}
checkErrorCode() {
BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode);
async checkErrorCode(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode);
}
getErrorCode() {
async getErrorCode(): Promise<string> {
return BrowserActions.getText(this.errorPageCode);
}
getErrorTitle() {
async getErrorTitle(): Promise<string> {
return BrowserActions.getText(this.errorPageTitle);
}
getErrorDescription() {
async getErrorDescription(): Promise<string> {
return BrowserActions.getText(this.errorPageDescription);
}
}

View File

@@ -15,28 +15,27 @@
* limitations under the License.
*/
import { by } from 'protractor';
import { by, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
export class FormControllersPage {
enableToggle(toggle) {
BrowserVisibility.waitUntilElementIsVisible(toggle);
toggle.getAttribute('class').then((check) => {
if (check.indexOf('mat-checked') < 0) {
BrowserVisibility.waitUntilElementIsClickable(toggle.all(by.css('div')).first());
toggle.all(by.css('div')).first().click();
}
});
async enableToggle(toggle: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(toggle);
const check = await toggle.getAttribute('class');
if (check.indexOf('mat-checked') < 0) {
const elem = toggle.all(by.css('div')).first();
await BrowserActions.click(elem);
}
}
disableToggle(toggle) {
BrowserVisibility.waitUntilElementIsVisible(toggle);
toggle.getAttribute('class').then((check) => {
if (check.indexOf('mat-checked') >= 0) {
BrowserVisibility.waitUntilElementIsClickable(toggle.all(by.css('div')).first());
toggle.all(by.css('div')).first().click();
}
});
async disableToggle(toggle: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(toggle);
const check = await toggle.getAttribute('class');
if (check.indexOf('mat-checked') >= 0) {
const elem = toggle.all(by.css('div')).first();
await BrowserActions.click(elem);
}
}
}

View File

@@ -15,149 +15,140 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../utils/public-api';
import { ElementFinder } from 'protractor/built/element';
import { ElementFinder } from 'protractor';
export class FormFields {
formContent = element(by.css('adf-form-renderer'));
refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon'));
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
valueLocator = by.css('input');
labelLocator = by.css('label');
noFormMessage = element(by.css('span[id*="no-form-message"]'));
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
selectFormDropDownArrow = element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first();
selectFormContent = element(by.css('div[class*="mat-select-panel"]'));
completeButton = element(by.id('adf-form-complete'));
errorMessage = by.css('.adf-error-text-container .adf-error-text');
formContent: ElementFinder = element(by.css('adf-form-renderer'));
refreshButton: ElementFinder = element(by.css('div[class*="form-reload-button"] mat-icon'));
saveButton: ElementFinder = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
valueLocator: Locator = by.css('input');
labelLocator: Locator = by.css('label');
noFormMessage: ElementFinder = element(by.css('span[id*="no-form-message"]'));
completedTaskNoFormMessage: ElementFinder = element(by.css('div[id*="completed-form-message"] p'));
attachFormButton: ElementFinder = element(by.id('adf-no-form-attach-form-button'));
selectFormDropDownArrow: ElementFinder = element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first();
selectFormContent: ElementFinder = element(by.css('div[class*="mat-select-panel"]'));
completeButton: ElementFinder = element(by.id('adf-form-complete'));
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
setFieldValue(locator, field, value) {
async setFieldValue(locator, field, value): Promise<void> {
const fieldElement = element(locator(field));
BrowserActions.clearSendKeys(fieldElement, value);
return this;
await BrowserActions.clearSendKeys(fieldElement, value);
}
checkWidgetIsVisible(fieldId) {
async checkWidgetIsVisible(fieldId): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
return BrowserVisibility.waitUntilElementIsOnPage(fieldElement);
await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
}
checkWidgetIsHidden(fieldId) {
async checkWidgetIsHidden(fieldId): Promise<void> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
return BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement);
}
checkWidgetIsNotHidden(fieldId) {
this.checkWidgetIsVisible(fieldId);
async checkWidgetIsNotHidden(fieldId): Promise<void> {
await this.checkWidgetIsVisible(fieldId);
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
return BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
}
getWidget(fieldId) {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
BrowserVisibility.waitUntilElementIsVisible(widget);
return widget;
getWidget(fieldId): ElementFinder {
return element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
}
getFieldValue(fieldId, valueLocatorParam?: any) {
const value = this.getWidget(fieldId).element(valueLocatorParam || this.valueLocator);
BrowserVisibility.waitUntilElementIsVisible(value);
return value.getAttribute('value');
async getFieldValue(fieldId, valueLocatorParam?: any): Promise<string> {
const valueWidget: ElementFinder = await (await this.getWidget(fieldId)).element(valueLocatorParam || this.valueLocator);
await BrowserVisibility.waitUntilElementIsVisible(valueWidget);
return valueWidget.getAttribute('value');
}
getFieldLabel(fieldId, labelLocatorParam?: any) {
const label = this.getWidget(fieldId).all(labelLocatorParam || this.labelLocator).first();
async getFieldLabel(fieldId, labelLocatorParam?: any) {
const label = await (await this.getWidget(fieldId)).all(labelLocatorParam || this.labelLocator).first();
return BrowserActions.getText(label);
}
getFieldErrorMessage(fieldId) {
const error = this.getWidget(fieldId).element(this.errorMessage);
async getFieldErrorMessage(fieldId): Promise<string> {
const error = await this.getWidget(fieldId);
error.element(this.errorMessage);
return BrowserActions.getText(error);
}
getFieldText(fieldId, labelLocatorParam?: any) {
const label = this.getWidget(fieldId).element(labelLocatorParam || this.labelLocator);
async getFieldText(fieldId, labelLocatorParam?: any) {
const label = await (await this.getWidget(fieldId)).element(labelLocatorParam || this.labelLocator);
return BrowserActions.getText(label);
}
getFieldPlaceHolder(fieldId, locator = 'input') {
async getFieldPlaceHolder(fieldId, locator = 'input'): Promise<string> {
const placeHolderLocator: ElementFinder = element(by.css(`${locator}#${fieldId}`));
BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
return placeHolderLocator.getAttribute('placeholder');
}
checkFieldValue(locator, field, val) {
BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
return this;
async checkFieldValue(locator, field, val): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
}
refreshForm() {
BrowserActions.click(this.refreshButton);
return this;
async refreshForm(): Promise<void> {
await BrowserActions.click(this.refreshButton);
}
saveForm() {
BrowserActions.click(this.saveButton);
return this;
async saveForm(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
noFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.formContent);
return this;
async noFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.formContent);
}
checkFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.formContent);
return this;
async checkFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.formContent);
}
getNoFormMessage() {
async getNoFormMessage(): Promise<string> {
return BrowserActions.getText(this.noFormMessage);
}
getCompletedTaskNoFormMessage() {
async getCompletedTaskNoFormMessage(): Promise<string> {
return BrowserActions.getText(this.completedTaskNoFormMessage);
}
clickOnAttachFormButton() {
BrowserActions.click(this.attachFormButton);
return this;
async clickOnAttachFormButton(): Promise<void> {
await BrowserActions.click(this.attachFormButton);
}
selectForm(formName) {
BrowserActions.click(this.selectFormDropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
this.selectFormFromDropDown(formName);
return this;
async selectForm(formName): Promise<void> {
await BrowserActions.click(this.selectFormDropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
await this.selectFormFromDropDown(formName);
}
selectFormFromDropDown(formName) {
async selectFormFromDropDown(formName): Promise<void> {
const formNameElement = element(by.cssContainingText('span', formName));
BrowserActions.click(formNameElement);
await BrowserActions.click(formNameElement);
}
checkWidgetIsReadOnlyMode(fieldId) {
async checkWidgetIsReadOnlyMode(fieldId): Promise<ElementFinder> {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
const widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]'));
BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
await BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
return widgetReadOnly;
}
completeForm() {
BrowserActions.click(this.completeButton);
async completeForm(): Promise<void> {
await BrowserActions.click(this.completeButton);
}
setValueInInputById(fieldId, value) {
async setValueInInputById(fieldId, value): Promise<void> {
const input = element(by.id(fieldId));
BrowserActions.clearSendKeys(input, value);
return this;
await BrowserActions.clearSendKeys(input, value);
}
isCompleteFormButtonDisabled() {
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
async isCompleteFormButtonDisabled(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
return this.completeButton.getAttribute('disabled');
}
}

View File

@@ -15,36 +15,35 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../utils/browser-visibility';
import { BrowserActions } from '../../utils/public-api';
export class FormPage {
errorLog = element(by.css('div[class*="console"]'));
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
errorLog: ElementFinder = element(by.css('div[class*="console"]'));
saveButton: ElementFinder = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
checkErrorMessageForWidgetIsDisplayed(errorMessage) {
return BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
async checkErrorMessageForWidgetIsDisplayed(errorMessage): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
}
checkErrorMessageForWidgetIsNotDisplayed(errorMessage) {
return BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
async checkErrorMessageForWidgetIsNotDisplayed(errorMessage): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
}
checkErrorLogMessage(errorMessage) {
BrowserVisibility.waitUntilElementIsVisible(this.errorLog);
return BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
async checkErrorLogMessage(errorMessage): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.errorLog);
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
}
checkErrorMessageIsNotDisplayed(errorMessage) {
BrowserVisibility.waitUntilElementIsVisible(this.errorLog);
return BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
async checkErrorMessageIsNotDisplayed(errorMessage): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.errorLog);
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
}
saveForm() {
BrowserActions.click(this.saveButton);
return this;
async saveForm() {
await BrowserActions.click(this.saveButton);
}
}

View File

@@ -15,55 +15,50 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { FormFields } from '../formFields';
export class AmountWidget {
currency = by.css('span[class="adf-amount-widget__prefix-spacing"]');
formFields = new FormFields();
currency: Locator = by.css('span[class="adf-amount-widget__prefix-spacing"]');
formFields: FormFields = new FormFields();
getAmountFieldLabel(fieldId) {
async getAmountFieldLabel(fieldId): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
return BrowserActions.getText(label);
}
getAmountFieldCurrency(fieldId) {
return BrowserActions.getText(this.formFields.getWidget(fieldId).element(this.currency));
async getAmountFieldCurrency(fieldId): Promise<string> {
const widget = await this.formFields.getWidget(fieldId);
return await BrowserActions.getText(widget.element(this.currency));
}
setFieldValue(fieldId, value) {
return this.formFields.setValueInInputById(fieldId, value);
async setFieldValue(fieldId, value): Promise<void> {
await this.formFields.setValueInInputById(fieldId, value);
}
removeFromAmountWidget(fieldId) {
BrowserVisibility.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
async removeFromAmountWidget(fieldId) {
const amountWidgetInput = element(by.id(fieldId));
amountWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
await BrowserActions.clearWithBackSpace(amountWidgetInput);
}
clearFieldValue(fieldId) {
async clearFieldValue(fieldId): Promise<void> {
const numberField = element(by.id(fieldId));
BrowserVisibility.waitUntilElementIsVisible(numberField);
return numberField.clear();
await BrowserVisibility.waitUntilElementIsVisible(numberField);
await numberField.clear();
}
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
async checkWidgetIsVisible(fieldId): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
getErrorMessage(fieldId) {
async getErrorMessage(fieldId): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
return BrowserActions.getText(errorMessage);
}
getPlaceholder(fieldId) {
async getPlaceholder(fieldId): Promise<string> {
return this.formFields.getFieldPlaceHolder(fieldId);
}
}

View File

@@ -19,35 +19,33 @@ import { FormFields } from '../formFields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import * as remote from 'selenium-webdriver/remote';
import { element, by, browser } from 'protractor';
import { ElementFinder } from 'protractor';
export class AttachFileWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
uploadLocator = by.css('button[id="attachfile"]');
localStorageButton = element(by.css('input[id="attachfile"]'));
localStorageButton: ElementFinder = element(by.css('input[id="attachfile"]'));
filesListLocator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachFile(fieldId, fileLocation) {
async attachFile(fieldId, fileLocation): Promise<void> {
browser.setFileDetector(new remote.FileDetector());
const widget = this.formFields.getWidget(fieldId);
const uploadButton = widget.element(this.uploadLocator);
BrowserActions.click(uploadButton);
BrowserVisibility.waitUntilElementIsVisible(this.localStorageButton);
this.localStorageButton.sendKeys(fileLocation);
return this;
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.uploadLocator);
await BrowserActions.click(uploadButton);
await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton);
await this.localStorageButton.sendKeys(fileLocation);
}
checkFileIsAttached(fieldId, name) {
const widget = this.formFields.getWidget(fieldId);
async checkFileIsAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
return this;
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
viewFile(name) {
async viewFile(name): Promise<void> {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserActions.click(fileView);
browser.actions().doubleClick(fileView).perform();
return this;
await BrowserActions.click(fileView);
await browser.actions().doubleClick(fileView).perform();
}
}

View File

@@ -23,72 +23,66 @@ import { element, by, browser, ElementFinder } from 'protractor';
export class AttachFileWidgetCloud {
widget: ElementFinder;
formFields: FormFields = new FormFields();
filesListLocator = by.css('div[id="adf-attach-widget-readonly-list"]');
constructor(fieldId: string) {
this.assignWidget(fieldId);
}
assignWidget(fieldId: string): void {
this.widget = this.formFields.getWidget(fieldId);
}
formFields = new FormFields();
contentButton = element(by.css('button[id="attach-Alfresco Content"]'));
filesListLocator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachLocalFile(fileLocation: string) {
browser.setFileDetector(new remote.FileDetector());
async attachLocalFile(fileLocation: string): Promise<void> {
await browser.setFileDetector(new remote.FileDetector());
const uploadButton = this.widget.element(by.css(`a input`));
BrowserVisibility.waitUntilElementIsVisible(uploadButton);
uploadButton.sendKeys(browser.params.rootPath + '/e2e' + fileLocation);
BrowserVisibility.waitUntilElementIsVisible(uploadButton);
return this;
await BrowserVisibility.waitUntilElementIsPresent(uploadButton);
await uploadButton.sendKeys(browser.params.rootPath + '/e2e' + fileLocation);
await BrowserVisibility.waitUntilElementIsPresent(uploadButton);
}
clickAttachContentFile(fileId: string) {
async clickAttachContentFile(fileId: string): Promise<void> {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
BrowserActions.click(uploadButton);
BrowserActions.click(this.contentButton);
await BrowserActions.click(uploadButton);
await BrowserActions.clickExecuteScript('button[id="attach-Alfresco Content"]');
}
checkUploadContentButtonIsDisplayed(fileId: string) {
async checkUploadContentButtonIsDisplayed(fileId: string): Promise<void> {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
BrowserVisibility.waitUntilElementIsVisible(uploadButton);
return this;
await BrowserVisibility.waitUntilElementIsVisible(uploadButton);
}
checkUploadContentButtonIsNotDisplayed(fileId: string) {
async checkUploadContentButtonIsNotDisplayed(fileId: string): Promise<void> {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
BrowserVisibility.waitUntilElementIsNotVisible(uploadButton);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(uploadButton);
}
checkFileIsAttached(name) {
async checkFileIsAttached(name): Promise<void> {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
return this;
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
checkFileIsNotAttached(name) {
async checkFileIsNotAttached(name): Promise<void> {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
}
async getFileId(name: string) {
async getFileId(name: string): Promise<string> {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
const fileId = await fileAttached.getAttribute('id');
return fileId;
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
return fileAttached.getAttribute('id');
}
async removeFile(fileName: string) {
async removeFile(fileName: string): Promise<void> {
const fileId = await this.getFileId(fileName);
const deleteButton = this.widget.element(by.css(`button[id='${fileId}-remove']`));
BrowserActions.click(deleteButton);
return this;
await BrowserActions.click(deleteButton);
}
viewFile(name) {
async viewFile(name): Promise<void> {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
BrowserActions.click(fileView);
browser.actions().doubleClick(fileView).perform();
return this;
await BrowserActions.click(fileView);
await browser.actions().doubleClick(fileView).perform();
}
}

View File

@@ -18,26 +18,27 @@
import { FormFields } from '../formFields';
import { BrowserActions } from '../../../utils/public-api';
import { by, element } from 'protractor';
import { ElementFinder } from 'protractor';
export class CheckboxWidget {
formFields = new FormFields();
checkboxLabel = element(by.css('span[class*="mat-checkbox-label"]'));
formFields: FormFields = new FormFields();
checkboxLabel: ElementFinder = element(by.css('span[class*="mat-checkbox-label"]'));
getCheckboxLabel() {
getCheckboxLabel(): Promise<string> {
return BrowserActions.getText(this.checkboxLabel);
}
clickCheckboxInput(fieldId) {
async clickCheckboxInput(fieldId): Promise<void> {
const checkboxInput = element.all(by.css(`mat-checkbox[id="${fieldId}"] div`)).first();
BrowserActions.click(checkboxInput);
await BrowserActions.click(checkboxInput);
}
isCheckboxDisplayed(fieldId) {
return this.formFields.checkWidgetIsNotHidden(fieldId);
async isCheckboxDisplayed(fieldId): Promise<void> {
await this.formFields.checkWidgetIsNotHidden(fieldId);
}
isCheckboxHidden(fieldId) {
return this.formFields.checkWidgetIsHidden(fieldId);
async isCheckboxHidden(fieldId): Promise<void> {
await this.formFields.checkWidgetIsHidden(fieldId);
}
}

View File

@@ -16,15 +16,15 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class ContainerWidget {
formFields = new FormFields();
fileLocator = by.css("div [class*='upload-widget__content-text']");
fileLocator: Locator = by.css("div [class*='upload-widget__content-text']");
getFieldText(fieldId) {
getFieldText(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
}

View File

@@ -16,81 +16,77 @@
*/
import { FormFields } from '../formFields';
import { element, by, protractor } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DateTimeWidget {
formFields = new FormFields();
outsideLayer = element(by.css('div[class*="cdk-overlay-container"]'));
formFields: FormFields = new FormFields();
outsideLayer: ElementFinder = element(by.css('div[class*="cdk-overlay-container"]'));
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
async checkWidgetIsVisible(fieldId): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
getDateTimeLabel(fieldId) {
async getDateTimeLabel(fieldId): Promise<string> {
const label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
return BrowserActions.getText(label);
}
setDateTimeInput(fieldId, value) {
return this.formFields.setValueInInputById(fieldId, value);
async setDateTimeInput(fieldId, value): Promise<void> {
await this.formFields.setValueInInputById(fieldId, value);
}
clearDateTimeInput(fieldId) {
const dateInput = element(by.id(fieldId));
BrowserVisibility.waitUntilElementIsVisible(dateInput);
return dateInput.clear();
async clickOutsideWidget(fieldId): Promise<void> {
const form = await this.formFields.getWidget(fieldId);
await BrowserActions.click(form);
}
clickOutsideWidget(fieldId) {
const form = this.formFields.getWidget(fieldId);
BrowserActions.click(form);
async closeDataTimeWidget(): Promise<void> {
await BrowserActions.click(this.outsideLayer);
}
closeDataTimeWidget() {
BrowserActions.click(this.outsideLayer);
}
getErrorMessage(fieldId) {
async getErrorMessage(fieldId): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
return BrowserActions.getText(errorMessage);
}
selectDay(day) {
async selectDay(day): Promise<void> {
const selectedDay = element(by.cssContainingText('div[class*="mat-datetimepicker-calendar-body-cell-content"]', day));
BrowserActions.click(selectedDay);
await BrowserActions.click(selectedDay);
}
openDatepicker(fieldId) {
return element(by.id(fieldId)).click();
async openDatepicker(fieldId): Promise<void> {
await BrowserActions.click(element(by.id(fieldId)));
}
private selectTime(time) {
async selectTime(time): Promise<void> {
const selectedTime = element(by.cssContainingText('div[class*="mat-datetimepicker-clock-cell"]', time));
BrowserActions.click(selectedTime);
await BrowserActions.click(selectedTime);
}
selectHour(hour) {
async selectHour(hour): Promise<void> {
return this.selectTime(hour);
}
selectMinute(minute) {
async selectMinute(minute): Promise<void> {
return this.selectTime(minute);
}
getPlaceholder(fieldId) {
async getPlaceholder(fieldId): Promise<string> {
return this.formFields.getFieldPlaceHolder(fieldId);
}
removeFromDatetimeWidget(fieldId) {
BrowserVisibility.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
async removeFromDatetimeWidget(fieldId): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(await this.formFields.getWidget(fieldId));
const amountWidgetInput = element(by.id(fieldId));
amountWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
await BrowserActions.clearWithBackSpace(amountWidgetInput);
}
async clearDateTimeInput(fieldId): Promise<void> {
const dateInput = element(by.id(fieldId));
await BrowserVisibility.waitUntilElementIsVisible(dateInput);
await dateInput.clear();
}
}

View File

@@ -16,54 +16,53 @@
*/
import { FormFields } from '../formFields';
import { element, by, protractor } from 'protractor';
import { element, by } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DateWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
checkWidgetIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
async checkWidgetIsVisible(fieldId): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
checkLabelIsVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
async checkLabelIsVisible(fieldId): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
getDateLabel(fieldId) {
async getDateLabel(fieldId): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
return BrowserActions.getText(label);
}
setDateInput(fieldId, value) {
this.removeFromDatetimeWidget(fieldId);
return this.formFields.setValueInInputById(fieldId, value);
async setDateInput(fieldId, value): Promise<void> {
await this.removeFromDatetimeWidget(fieldId);
await this.formFields.setValueInInputById(fieldId, value);
}
getDateInput(fieldId) {
async getDateInput(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId);
}
clearDateInput(fieldId) {
async clearDateInput(fieldId): Promise<void> {
const dateInput = element(by.id(fieldId));
BrowserVisibility.waitUntilElementIsVisible(dateInput);
return dateInput.clear();
await BrowserActions.clearWithBackSpace(dateInput);
}
getErrorMessage(fieldId) {
async clickOutsideWidget(fieldId): Promise<void> {
const form = await this.formFields.getWidget(fieldId);
await BrowserActions.click(form);
}
async getErrorMessage(fieldId): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
return BrowserActions.getText(errorMessage);
}
removeFromDatetimeWidget(fieldId) {
BrowserVisibility.waitUntilElementIsVisible(this.formFields.getWidget(fieldId));
const dateWidgetInput = element(by.id(fieldId));
dateWidgetInput.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
dateWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
async removeFromDatetimeWidget(fieldId): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
await BrowserVisibility.waitUntilElementIsVisible(widget);
await BrowserActions.clearSendKeys(element(by.id(fieldId)), '');
}
}

View File

@@ -16,23 +16,23 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class DisplayTextWidget {
formFields = new FormFields();
labelLocator = by.css('div[class*="adf-display-text-widget"]');
inputLocator = by.css('input');
formFields: FormFields = new FormFields();
labelLocator: Locator = by.css('div[class*="adf-display-text-widget"]');
inputLocator: Locator = by.css('input');
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldValue(fieldId) {
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId, this.inputLocator);
}
getFieldText(fieldId) {
getFieldText(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.labelLocator);
}

View File

@@ -16,19 +16,19 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class DisplayValueWidget {
formFields = new FormFields();
labelLocator = by.css("label[class*='adf-label']");
inputLocator = by.css('input');
formFields: FormFields = new FormFields();
labelLocator: Locator = by.css("label[class*='adf-label']");
inputLocator: Locator = by.css('input');
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldValue(fieldId) {
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId, this.inputLocator);
}

View File

@@ -16,18 +16,18 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class DocumentWidget {
formFields = new FormFields();
fileLocator = by.css("div [class*='upload-widget__content-text']");
formFields: FormFields = new FormFields();
fileLocator: Locator = by.css("div [class*='upload-widget__content-text']");
getFieldText(fieldId) {
getFieldText(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
getFileName(fieldId) {
getFileName(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
}

View File

@@ -21,28 +21,27 @@ import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DropdownWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
getSelectedOptionText(fieldId: string = 'dropdown') {
getSelectedOptionText(fieldId: string = 'dropdown'): Promise<string> {
return this.formFields.getFieldText(fieldId, by.css(`mat-select[id="${fieldId}"] span span`));
}
selectOption(option: string, locator: string = '#dropdown') {
this.openDropdown(locator);
async selectOption(option: string, locator: string = '#dropdown'): Promise<void> {
await this.openDropdown(locator);
const row = element(by.cssContainingText('mat-option span', option));
BrowserActions.click(row);
await BrowserActions.click(row);
}
openDropdown(locator: string = '#dropdown') {
this.checkDropdownIsDisplayed(locator);
async openDropdown(locator: string = '#dropdown'): Promise<void> {
await this.checkDropdownIsDisplayed(locator);
const dropdown = locator ? element(by.css(`${locator}`)) : element(by.css(`#dropdown`));
BrowserVisibility.waitUntilElementIsClickable(dropdown);
return BrowserActions.click(dropdown);
await BrowserVisibility.waitUntilElementIsClickable(dropdown);
await BrowserActions.click(dropdown);
}
checkDropdownIsDisplayed(locator: string = '#dropdown') {
async checkDropdownIsDisplayed(locator: string = '#dropdown'): Promise<void> {
const dropdown = element(by.css(`${locator}`));
BrowserVisibility.waitUntilElementIsVisible(dropdown);
return dropdown;
await BrowserVisibility.waitUntilElementIsVisible(dropdown);
}
}

View File

@@ -16,117 +16,117 @@
*/
import { FormFields } from '../formFields';
import { by, element, protractor } from 'protractor';
import { by, element, ElementArrayFinder, ElementFinder, Locator, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DynamicTableWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
labelLocator = by.css('dynamic-table-widget div div');
columnNameLocator = by.css('table[id*="dynamic-table"] th');
addButton = element(by.id('label-add-row'));
cancelButton = element(by.cssContainingText('button span', 'Cancel'));
editButton = element(by.cssContainingText('button span', 'edit'));
addRow = element(by.id('dynamictable-add-row'));
columnDateTime = element(by.id('columnDateTime'));
columnDate = element(by.id('columnDate'));
calendarHeader = element(by.css('div[class="mat-datetimepicker-calendar-header-date-time"]'));
calendarContent = element(by.css('div[class="mat-datetimepicker-calendar-content"]'));
saveButton = element(by.cssContainingText('button span', 'Save'));
errorMessage = element(by.css('div[class="adf-error-text"]'));
dateWidget = element.all(by.css('mat-datepicker-toggle button')).first();
tableRow = element.all(by.css('tbody tr'));
dataTableInput = element(by.id('id'));
labelLocator: Locator = by.css('dynamic-table-widget div div');
columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th');
addButton: ElementFinder = element(by.id('label-add-row'));
cancelButton: ElementFinder = element(by.cssContainingText('button span', 'Cancel'));
editButton: ElementFinder = element(by.cssContainingText('button span', 'edit'));
addRow: ElementFinder = element(by.id('dynamictable-add-row'));
columnDateTime: ElementFinder = element(by.id('columnDateTime'));
columnDate: ElementFinder = element(by.id('columnDate'));
calendarHeader: ElementFinder = element(by.css('div[class="mat-datetimepicker-calendar-header-date-time"]'));
calendarContent: ElementFinder = element(by.css('div[class="mat-datetimepicker-calendar-content"]'));
saveButton: ElementFinder = element(by.cssContainingText('button span', 'Save'));
errorMessage: ElementFinder = element(by.css('div[class="adf-error-text"]'));
dateWidget: ElementFinder = element.all(by.css('mat-datepicker-toggle button')).first();
tableRow: ElementArrayFinder = element.all(by.css('tbody tr'));
dataTableInput: ElementFinder = element(by.id('id'));
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getColumnName(fieldId) {
getColumnName(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.columnNameLocator);
}
clickAddButton() {
BrowserActions.click(this.addButton);
async clickAddButton(): Promise<void> {
await BrowserActions.click(this.addButton);
}
clickAddRow() {
BrowserActions.click(this.addRow);
async clickAddRow(): Promise<void> {
await BrowserActions.click(this.addRow);
}
clickTableRow(rowNumber) {
async clickTableRow(rowNumber): Promise<void> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
BrowserActions.click(tableRowByIndex);
await BrowserActions.click(tableRowByIndex);
}
clickEditButton() {
BrowserActions.click(this.editButton);
async clickEditButton(): Promise<void> {
await BrowserActions.click(this.editButton);
}
clickCancelButton() {
BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
setDatatableInput(text) {
BrowserVisibility.waitUntilElementIsVisible(this.dataTableInput);
this.dataTableInput.clear();
return this.dataTableInput.sendKeys(text);
async setDatatableInput(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dataTableInput);
await this.dataTableInput.clear();
await this.dataTableInput.sendKeys(text);
}
getTableRowText(rowNumber) {
async getTableRowText(rowNumber): Promise<string> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
return BrowserActions.getText(tableRowByIndex);
}
checkTableRowIsNotVisible(rowNumber) {
async checkTableRowIsNotVisible(rowNumber): Promise<void> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
return BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex);
await BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex);
}
clickColumnDateTime() {
BrowserActions.click(this.columnDateTime);
BrowserVisibility.waitUntilElementIsVisible(this.calendarHeader);
BrowserVisibility.waitUntilElementIsVisible(this.calendarContent);
BrowserActions.closeMenuAndDialogs();
async clickColumnDateTime(): Promise<void> {
await BrowserActions.click(this.columnDateTime);
await BrowserVisibility.waitUntilElementIsVisible(this.calendarHeader);
await BrowserVisibility.waitUntilElementIsVisible(this.calendarContent);
await BrowserActions.closeMenuAndDialogs();
}
addRandomStringOnDateTime(randomText) {
BrowserActions.click(this.columnDateTime);
BrowserActions.closeMenuAndDialogs();
this.columnDateTime.sendKeys(randomText);
this.columnDateTime.sendKeys(protractor.Key.ENTER);
async addRandomStringOnDateTime(randomText): Promise<string> {
await BrowserActions.click(this.columnDateTime);
await BrowserActions.closeMenuAndDialogs();
await this.columnDateTime.sendKeys(randomText);
await this.columnDateTime.sendKeys(protractor.Key.ENTER);
return this.columnDateTime.getAttribute('value');
}
addRandomStringOnDate(randomText) {
BrowserActions.click(this.columnDate);
return this.columnDate.sendKeys(randomText);
async addRandomStringOnDate(randomText): Promise<void> {
await BrowserActions.click(this.columnDate);
await this.columnDate.sendKeys(randomText);
}
clickSaveButton() {
BrowserActions.click(this.saveButton);
async clickSaveButton(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
checkErrorMessage() {
async checkErrorMessage(): Promise<string> {
return BrowserActions.getText(this.errorMessage);
}
clickDateWidget() {
BrowserActions.click(this.dateWidget);
async clickDateWidget(): Promise<void> {
await BrowserActions.click(this.dateWidget);
}
getTableRow(rowNumber) {
return BrowserVisibility.waitUntilElementIsVisible(this.tableRow.get(rowNumber));
async getTableRow(rowNumber): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableRow.get(rowNumber));
}
getTableCellText(rowNumber: number, columnNumber: number) {
async getTableCellText(rowNumber: number, columnNumber: number): Promise<string> {
return BrowserActions.getText(this.tableRow.get(rowNumber).element(by.xpath(`td[${columnNumber}]`)));
}
checkItemIsPresent(item) {
async checkItemIsPresent(item): Promise<void> {
const row = element(by.cssContainingText('table tbody tr td span', item));
const present = BrowserVisibility.waitUntilElementIsVisible(row);
expect(present).toBe(true);
const present = await BrowserVisibility.waitUntilElementIsVisible(row);
await expect(present).toBe(true);
}
}

View File

@@ -16,15 +16,15 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class HeaderWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
labelLocator = by.css('span[id="container-header-label"]');
labelLocator: Locator = by.css('span[id="container-header-label"]');
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}

View File

@@ -16,20 +16,20 @@
*/
import { FormFields } from '../formFields';
import { by, element } from 'protractor';
import { by, element, Locator } from 'protractor';
import { BrowserActions } from '../../../utils/public-api';
export class HyperlinkWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
fieldLocator = by.css('div[class="adf-hyperlink-widget "] a');
fieldLocator: Locator = by.css('div[class="adf-hyperlink-widget "] a');
getFieldText(fieldId) {
async getFieldText(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.fieldLocator);
}
getFieldLabel(fieldId) {
async getFieldLabel(fieldId): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
return BrowserActions.getText(label);
}

View File

@@ -16,32 +16,32 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class MultilineTextWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
valueLocator = by.css('textarea');
labelLocator = by.css("label[class*='adf-label']");
valueLocator: Locator = by.css('textarea');
labelLocator: Locator = by.css("label[class*='adf-label']");
getFieldValue(fieldId) {
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId, this.valueLocator);
}
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldPlaceHolder(fieldId) {
getFieldPlaceHolder(fieldId): Promise<string> {
return this.formFields.getFieldPlaceHolder(fieldId, 'textarea');
}
setValue(fieldId, value) {
setValue(fieldId, value): Promise<void> {
return this.formFields.setFieldValue(by.id, fieldId, value);
}
getErrorMessage(fieldId) {
getErrorMessage(fieldId): Promise<string> {
return this.formFields.getFieldErrorMessage(fieldId);
}

View File

@@ -21,37 +21,37 @@ import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class NumberWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
getNumberFieldLabel(fieldId) {
async getNumberFieldLabel(fieldId): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
return BrowserActions.getText(label);
}
getFieldValue(fieldId) {
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId);
}
setFieldValue(fieldId, value) {
setFieldValue(fieldId, value): Promise<void> {
return this.formFields.setValueInInputById(fieldId, value);
}
clearFieldValue(fieldId) {
async clearFieldValue(fieldId): Promise<void> {
const numberField = element(by.id(fieldId));
BrowserVisibility.waitUntilElementIsVisible(numberField);
return numberField.clear();
await BrowserVisibility.waitUntilElementIsVisible(numberField);
await numberField.clear();
}
checkWidgetIsVisible(fieldId) {
checkWidgetIsVisible(fieldId): Promise<void> {
return this.formFields.checkWidgetIsVisible(fieldId);
}
getErrorMessage(fieldId) {
async getErrorMessage(fieldId): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] div[class="adf-error-text"]`));
return BrowserActions.getText(errorMessage);
}
getPlaceholder(fieldId) {
getPlaceholder(fieldId): Promise<string> {
return this.formFields.getFieldPlaceHolder(fieldId);
}
}

View File

@@ -16,61 +16,59 @@
*/
import { FormFields } from '../formFields';
import { by, element } from 'protractor';
import { by, element, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class PeopleWidget {
peopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
firstResult = element(by.id('adf-people-widget-user-0'));
peopleField: ElementFinder = element(by.css('input[data-automation-id="adf-people-search-input"]'));
firstResult: ElementFinder = element(by.id('adf-people-widget-user-0'));
formFields: 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"]');
formFields = new FormFields();
labelLocator = by.css('div[class*="display-text-widget"]');
inputLocator = by.id('involvepeople');
peopleDropDownList = by.css('div[class*="adf-people-widget-list"]');
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldValue(fieldId) {
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId, this.inputLocator);
}
getFieldText(fieldId) {
getFieldText(fieldId): Promise<string> {
return this.formFields.getFieldText(fieldId, this.labelLocator);
}
insertUser(fieldId, value) {
insertUser(fieldId, value): Promise<void> {
return this.formFields.setValueInInputById(fieldId, value);
}
checkDropDownListIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(element(this.peopleDropDownList));
async checkDropDownListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(this.peopleDropDownList));
}
checkUserIsListed(userName) {
async checkUserIsListed(userName): Promise<void> {
const user = element(by.cssContainingText('.adf-people-label-name', userName));
return BrowserVisibility.waitUntilElementIsVisible(user);
await BrowserVisibility.waitUntilElementIsVisible(user);
}
selectUserFromDropDown(userName) {
async selectUserFromDropDown(userName): Promise<void> {
const user = element(by.cssContainingText('.adf-people-label-name', userName));
BrowserActions.click(user);
return this;
await BrowserActions.click(user);
}
checkPeopleFieldIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.peopleField);
async checkPeopleFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleField);
}
fillPeopleField(value) {
BrowserVisibility.waitUntilElementIsClickable(this.peopleField);
return this.peopleField.sendKeys(value);
async fillPeopleField(value): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.peopleField);
await this.peopleField.sendKeys(value);
}
selectUserFromDropdown() {
BrowserVisibility.waitUntilElementIsVisible(this.firstResult);
return this.firstResult.click();
async selectUserFromDropdown(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.firstResult);
await BrowserActions.click(this.firstResult);
}
}

View File

@@ -16,36 +16,36 @@
*/
import { FormFields } from '../formFields';
import { by, element } from 'protractor';
import { by, element, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class RadioButtonsWidget {
selectedOption = by.css('mat-radio-button[ng-pristine]');
selectedOption: Locator = by.css('mat-radio-button[ng-pristine]');
formFields = new FormFields();
formFields: FormFields = new FormFields();
getSpecificOptionLabel(fieldId, optionNumber) {
async getSpecificOptionLabel(fieldId, optionNumber): Promise<string> {
const optionLocator = by.css('label[for*="radiobuttons-option_' + optionNumber + '"]');
const option = this.formFields.getWidget(fieldId).element(optionLocator);
const widget = await this.formFields.getWidget(fieldId);
const option = widget.element(optionLocator);
return BrowserActions.getText(option);
}
selectOption(fieldId, optionNumber) {
async selectOption(fieldId, optionNumber): Promise<void> {
const optionLocator = by.css(`label[for*="${fieldId}-option_${optionNumber}"]`);
const option = this.formFields.getWidget(fieldId).element(optionLocator);
return BrowserActions.click(option);
const widget = await this.formFields.getWidget(fieldId);
const option = widget.element(optionLocator);
await BrowserActions.click(option);
}
isSelectionClean(fieldId) {
const option = this.formFields.getWidget(fieldId).element(this.selectedOption);
return BrowserVisibility.waitUntilElementIsNotVisible(option);
async isSelectionClean(fieldId): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const option = widget.element(this.selectedOption);
await BrowserVisibility.waitUntilElementIsNotVisible(option);
}
getRadioWidgetLabel(fieldId) {
async getRadioWidgetLabel(fieldId): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
return BrowserActions.getText(label);
}

View File

@@ -16,39 +16,39 @@
*/
import { FormFields } from '../formFields';
import { by } from 'protractor';
import { by, Locator } from 'protractor';
export class TextWidget {
formFields = new FormFields();
formFields: FormFields = new FormFields();
labelLocator = by.css("label[class*='adf-label']");
labelLocator: Locator = by.css("label[class*='adf-label']");
getFieldLabel(fieldId) {
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldPlaceHolder(fieldId) {
getFieldPlaceHolder(fieldId): Promise<string> {
return this.formFields.getFieldPlaceHolder(fieldId);
}
setValue(fieldId, value) {
return this.formFields.setFieldValue(by.id, fieldId, value);
async setValue(fieldId, value): Promise<void> {
await this.formFields.setFieldValue(by.id, fieldId, value);
}
getFieldValue(fieldId) {
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId);
}
getErrorMessage(fieldId) {
getErrorMessage(fieldId): Promise<string> {
return this.formFields.getFieldErrorMessage(fieldId);
}
isWidgetVisible(fieldId) {
return this.formFields.checkWidgetIsVisible(fieldId);
async isWidgetVisible(fieldId): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
isWidgetNotVisible(fieldId) {
return this.formFields.checkWidgetIsHidden(fieldId);
async isWidgetNotVisible(fieldId): Promise<void> {
await this.formFields.checkWidgetIsHidden(fieldId);
}
}

View File

@@ -37,79 +37,79 @@ import { AttachFileWidgetCloud } from './attachFileWidgetCloud';
export class Widget {
multilineTextWidget() {
multilineTextWidget(): MultilineTextWidget {
return new MultilineTextWidget();
}
headerWidget() {
headerWidget(): HeaderWidget {
return new HeaderWidget();
}
displayTextWidget() {
displayTextWidget(): DisplayTextWidget {
return new DisplayTextWidget();
}
attachFileWidget() {
attachFileWidget(): AttachFileWidget {
return new AttachFileWidget();
}
attachFileWidgetCloud(fieldId: string) {
attachFileWidgetCloud(fieldId: string): AttachFileWidgetCloud {
return new AttachFileWidgetCloud(fieldId);
}
displayValueWidget() {
displayValueWidget(): DisplayValueWidget {
return new DisplayValueWidget();
}
radioWidget() {
radioWidget(): RadioButtonsWidget {
return new RadioButtonsWidget();
}
hyperlink() {
hyperlink(): HyperlinkWidget {
return new HyperlinkWidget();
}
dropdown() {
dropdown(): DropdownWidget {
return new DropdownWidget();
}
dynamicTable() {
dynamicTable(): DynamicTableWidget {
return new DynamicTableWidget();
}
textWidget() {
textWidget(): TextWidget {
return new TextWidget();
}
documentWidget() {
documentWidget(): DocumentWidget {
return new DocumentWidget();
}
checkboxWidget() {
checkboxWidget(): CheckboxWidget {
return new CheckboxWidget();
}
dateWidget() {
dateWidget(): DateWidget {
return new DateWidget();
}
dateTimeWidget() {
dateTimeWidget(): DateTimeWidget {
return new DateTimeWidget();
}
numberWidget() {
numberWidget(): NumberWidget {
return new NumberWidget();
}
amountWidget() {
amountWidget(): AmountWidget {
return new AmountWidget();
}
containerWidget() {
containerWidget(): ContainerWidget {
return new ContainerWidget();
}
peopleWidget() {
peopleWidget(): PeopleWidget {
return new PeopleWidget();
}
}

View File

@@ -18,115 +18,115 @@
import { element, by, protractor, browser } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { ElementFinder } from 'protractor';
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'));
checkBox: ElementFinder = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button'));
headerColor: ElementFinder = element(by.css('option[value="primary"]'));
titleInput: ElementFinder = element(by.css('input[name="title"]'));
iconInput: ElementFinder = element(by.css('input[placeholder="URL path"]'));
hexColorInput: ElementFinder = element(by.css('input[placeholder="hex color code"]'));
logoHyperlinkInput: ElementFinder = element(by.css('input[placeholder="Redirect URL"]'));
logoTooltipInput: ElementFinder = element(by.css('input[placeholder="Tooltip text"]'));
positionStart: ElementFinder = element.all(by.css('mat-radio-button[value="start"]')).first();
positionEnd: ElementFinder = element.all(by.css('mat-radio-button[value="end"]')).first();
sideBarPositionRight: ElementFinder = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'));
sideBarPositionLeft: ElementFinder = element(by.css('mat-sidenav.mat-drawer.mat-sidenav'));
checkShowMenuCheckBoxIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
async checkShowMenuCheckBoxIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
}
checkChooseHeaderColourIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.headerColor);
async checkChooseHeaderColourIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.headerColor);
}
checkChangeTitleIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
async checkChangeTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
}
checkChangeUrlPathIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
async checkChangeUrlPathIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
}
clickShowMenuButton() {
const checkBox = element.all(by.css('mat-checkbox'));
BrowserVisibility.waitUntilElementIsVisible(checkBox.first());
return checkBox.get(0).click();
async clickShowMenuButton(): Promise<void> {
const checkBox = element.all(by.css('mat-checkbox')).first();
await BrowserActions.click(checkBox);
}
changeHeaderColor(color) {
async changeHeaderColor(color): Promise<void> {
const headerColor = element(by.css('option[value="' + color + '"]'));
return BrowserActions.click(headerColor);
await BrowserActions.click(headerColor);
}
checkAppTitle(name) {
async checkAppTitle(name): Promise<void> {
const title = element(by.cssContainingText('.adf-app-title', name));
return BrowserVisibility.waitUntilElementIsVisible(title);
await BrowserVisibility.waitUntilElementIsVisible(title);
}
addTitle(title) {
BrowserActions.click(this.titleInput);
this.titleInput.sendKeys(title);
this.titleInput.sendKeys(protractor.Key.ENTER);
async addTitle(title): Promise<void> {
await BrowserActions.click(this.titleInput);
await BrowserActions.clearSendKeys(this.titleInput, title);
await this.titleInput.sendKeys(protractor.Key.ENTER);
}
checkIconIsDisplayed(url) {
async checkIconIsDisplayed(url): Promise<void> {
const icon = element(by.css('img[src="' + url + '"]'));
BrowserVisibility.waitUntilElementIsVisible(icon);
await BrowserVisibility.waitUntilElementIsVisible(icon);
}
addIcon(url) {
BrowserActions.click(this.iconInput);
this.iconInput.sendKeys(url);
this.iconInput.sendKeys(protractor.Key.ENTER);
async addIcon(url): Promise<void> {
await BrowserActions.click(this.iconInput);
await BrowserActions.clearSendKeys(this.iconInput, url);
await this.iconInput.sendKeys(protractor.Key.ENTER);
}
checkHexColorInputIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
async checkHexColorInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
}
checkLogoHyperlinkInputIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
async checkLogoHyperlinkInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
}
checkLogoTooltipInputIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
async checkLogoTooltipInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
}
addHexCodeColor(hexCode) {
BrowserActions.click(this.hexColorInput);
this.hexColorInput.sendKeys(hexCode);
return this.hexColorInput.sendKeys(protractor.Key.ENTER);
async addHexCodeColor(hexCode): Promise<void> {
await BrowserActions.click(this.hexColorInput);
await BrowserActions.clearSendKeys(this.hexColorInput, hexCode);
await this.hexColorInput.sendKeys(protractor.Key.ENTER);
}
addLogoHyperlink(hyperlink) {
BrowserActions.click(this.logoHyperlinkInput);
this.logoHyperlinkInput.sendKeys(hyperlink);
return this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER);
async addLogoHyperlink(hyperlink): Promise<void> {
await BrowserActions.click(this.logoHyperlinkInput);
await BrowserActions.clearSendKeys(this.logoHyperlinkInput, hyperlink);
await this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER);
}
addLogoTooltip(tooltip) {
BrowserActions.click(this.logoTooltipInput);
this.logoTooltipInput.sendKeys(tooltip);
return this.logoTooltipInput.sendKeys(protractor.Key.ENTER);
async addLogoTooltip(tooltip): Promise<void> {
await BrowserActions.click(this.logoTooltipInput);
await BrowserActions.clearSendKeys(this.logoTooltipInput, tooltip);
await this.logoTooltipInput.sendKeys(protractor.Key.ENTER);
}
sideBarPositionStart() {
return BrowserActions.click(this.positionStart);
async sideBarPositionStart(): Promise<void> {
await BrowserActions.click(this.positionStart);
}
sideBarPositionEnd() {
browser.executeScript('arguments[0].scrollIntoView()', this.positionEnd);
return BrowserActions.click(this.positionEnd);
async sideBarPositionEnd(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.positionEnd);
await BrowserActions.click(this.positionEnd);
}
checkSidebarPositionStart() {
return BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft);
async checkSidebarPositionStart(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft);
}
checkSidebarPositionEnd() {
return BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight);
async checkSidebarPositionEnd(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight);
}
}

View File

@@ -36,7 +36,7 @@ export class LoginSSOPage {
await this.clickLoginButton();
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await BrowserVisibility.waitUntilElementIsVisible(this.header);
await browser.waitForAngular('');
await browser.waitForAngular();
}
async clickOnSSOButton() {

View File

@@ -16,264 +16,232 @@
*/
import { FormControllersPage } from './form-controller.page';
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { LocalStorageUtil } from '../utils/local-storage.util';
import { BrowserActions } from '../utils/browser-actions';
import { ElementFinder } from 'protractor';
export class LoginPage {
loginURL = browser.baseUrl + '/login';
formControllersPage = new FormControllersPage();
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"]'));
usernameTooltip = element(
by.css('span[data-automation-id="username-error"]')
);
passwordTooltip = element(
by.css('span[data-automation-id="password-required"]')
);
loginTooltip = element(by.css('span[class="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('img[class="adf-img-logo ng-star-inserted"]'));
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.css('div[id="adf-login-action-left"]'));
register = element(by.css('div[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'));
settingsIcon = element(
by.cssContainingText(
'a[data-automation-id="settings"] mat-icon',
'settings'
)
);
loginURL: string = browser.baseUrl + '/login';
formControllersPage: FormControllersPage = new FormControllersPage();
txtUsername: ElementFinder = element(by.css('input[id="username"]'));
txtPassword: ElementFinder = element(by.css('input[id="password"]'));
logoImg: ElementFinder = element(by.css('img[id="adf-login-img-logo"]'));
successRouteTxt: ElementFinder = element(by.css('input[data-automation-id="adf-success-route"]'));
logoTxt: ElementFinder = element(by.css('input[data-automation-id="adf-url-logo"]'));
usernameTooltip: ElementFinder = element(by.css('span[data-automation-id="username-error"]'));
passwordTooltip: ElementFinder = element(by.css('span[data-automation-id="password-required"]'));
loginTooltip: ElementFinder = element(by.css('span[class="adf-login-error-message"]'));
usernameInactive: ElementFinder = element(by.css('input[id="username"][aria-invalid="false"]'));
passwordInactive: ElementFinder = element(by.css('input[id="password"][aria-invalid="false"]'));
adfLogo: ElementFinder = element(by.css('img[class="adf-img-logo ng-star-inserted"]'));
usernameHighlighted: ElementFinder = element(by.css('input[id="username"][aria-invalid="true"]'));
passwordHighlighted: ElementFinder = element(by.css('input[id="password"][aria-invalid="true"]'));
signInButton: ElementFinder = element(by.id('login-button'));
showPasswordElement: ElementFinder = element(by.css('button[data-automation-id="show_password"]'));
hidePasswordElement: ElementFinder = element(by.css('button[data-automation-id="hide_password"]'));
rememberMe: ElementFinder = element(by.css('mat-checkbox[id="adf-login-remember"]'));
needHelp: ElementFinder = element(by.css('div[id="adf-login-action-left"]'));
register: ElementFinder = element(by.css('div[id="adf-login-action-right"]'));
footerSwitch: ElementFinder = element(by.id('switch4'));
rememberMeSwitch: ElementFinder = element(by.id('adf-toggle-show-rememberme'));
successRouteSwitch: ElementFinder = element(by.id('adf-toggle-show-successRoute'));
logoSwitch: ElementFinder = element(by.id('adf-toggle-logo'));
header: ElementFinder = element(by.id('adf-header'));
settingsIcon: ElementFinder = element(by.cssContainingText('a[data-automation-id="settings"] mat-icon', 'settings'));
sidenavLayout = element(by.css(`[data-automation-id="sidenav-layout"]`));
goToLoginPage() {
browser.waitForAngularEnabled(true);
browser.driver.get(this.loginURL);
return this.waitForElements();
async goToLoginPage(): Promise<void> {
await browser.get(this.loginURL);
await this.waitForElements();
}
waitForElements() {
BrowserVisibility.waitUntilElementIsVisible(this.txtUsername);
return BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
async waitForElements(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtUsername);
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
}
enterUsername(username) {
return BrowserActions.clearSendKeys(this.txtUsername, username);
async enterUsername(username): Promise<void> {
await BrowserActions.clearSendKeys(this.txtUsername, username);
}
enterPassword(password) {
return BrowserActions.clearSendKeys(this.txtPassword, password);
async enterPassword(password): Promise<void> {
await BrowserActions.clearSendKeys(this.txtPassword, password);
}
async clearUsername() {
BrowserVisibility.waitUntilElementIsVisible(this.txtUsername);
this.txtUsername.click();
this.txtUsername.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.txtUsername.sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
async clearUsername(): Promise<void> {
await BrowserActions.click(this.txtUsername);
await BrowserActions.clearWithBackSpace(this.txtUsername);
}
async clearPassword() {
BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
this.txtPassword.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.txtPassword.sendKeys(protractor.Key.BACK_SPACE);
}
});
async clearPassword(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
await BrowserActions.clearWithBackSpace(this.txtPassword);
}
getUsernameTooltip() {
async getUsernameTooltip(): Promise<string> {
return BrowserActions.getText(this.usernameTooltip);
}
getPasswordTooltip() {
async getPasswordTooltip(): Promise<string> {
return BrowserActions.getText(this.passwordTooltip);
}
getLoginError() {
async getLoginError(): Promise<string> {
return BrowserActions.getText(this.loginTooltip);
}
checkLoginImgURL() {
BrowserVisibility.waitUntilElementIsVisible(this.logoImg);
async checkLoginImgURL(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoImg);
return this.logoImg.getAttribute('src');
}
checkUsernameInactive() {
BrowserVisibility.waitUntilElementIsVisible(this.usernameInactive);
async checkUsernameInactive(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.usernameInactive);
}
checkPasswordInactive() {
BrowserVisibility.waitUntilElementIsVisible(this.passwordInactive);
async checkPasswordInactive(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.passwordInactive);
}
checkUsernameHighlighted() {
this.adfLogo.click();
BrowserVisibility.waitUntilElementIsVisible(this.usernameHighlighted);
async checkUsernameHighlighted(): Promise<void> {
await BrowserActions.click(this.adfLogo);
await BrowserVisibility.waitUntilElementIsVisible(this.usernameHighlighted);
}
checkPasswordHighlighted() {
this.adfLogo.click();
BrowserVisibility.waitUntilElementIsVisible(this.passwordHighlighted);
async checkPasswordHighlighted(): Promise<void> {
await BrowserActions.click(this.adfLogo);
await BrowserVisibility.waitUntilElementIsVisible(this.passwordHighlighted);
}
checkUsernameTooltipIsNotVisible() {
BrowserVisibility.waitUntilElementIsNotVisible(this.usernameTooltip);
async checkUsernameTooltipIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.usernameTooltip);
}
checkPasswordTooltipIsNotVisible() {
BrowserVisibility.waitUntilElementIsNotVisible(this.passwordTooltip);
async checkPasswordTooltipIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.passwordTooltip);
}
getSignInButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.signInButton);
return this.signInButton.isEnabled();
async getSignInButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.signInButton);
return await this.signInButton.isEnabled();
}
async loginToAllUsingUserModel(userModel) {
async loginToAllUsingUserModel(userModel): Promise<void> {
await this.goToLoginPage();
await LocalStorageUtil.clearStorage();
await LocalStorageUtil.setStorageItem('providers', 'ALL');
await LocalStorageUtil.apiReset();
return this.login(userModel.email, userModel.password);
await this.login(userModel.email, userModel.password);
}
async loginToProcessServicesUsingUserModel(userModel) {
async loginToProcessServicesUsingUserModel(userModel): Promise<void> {
await this.goToLoginPage();
await LocalStorageUtil.clearStorage();
await LocalStorageUtil.setStorageItem('providers', 'BPM');
await LocalStorageUtil.apiReset();
return this.login(userModel.email, userModel.password);
await this.login(userModel.email, userModel.password);
}
async loginToContentServicesUsingUserModel(userModel) {
this.goToLoginPage();
async loginToContentServicesUsingUserModel(userModel): Promise<void> {
await this.goToLoginPage();
await LocalStorageUtil.clearStorage();
await LocalStorageUtil.setStorageItem('providers', 'ECM');
await LocalStorageUtil.apiReset();
return this.login(userModel.getId(), userModel.getPassword());
await this.login(userModel.getId(), userModel.getPassword());
}
async loginToContentServices(username, password) {
this.goToLoginPage();
async loginToContentServices(username, password): Promise<void> {
await this.goToLoginPage();
await LocalStorageUtil.clearStorage();
await LocalStorageUtil.setStorageItem('providers', 'ECM');
await LocalStorageUtil.apiReset();
return this.login(username, password);
await this.login(username, password);
}
clickSignInButton() {
BrowserActions.click(this.signInButton);
async clickSignInButton(): Promise<void> {
await BrowserActions.click(this.signInButton);
}
clickSettingsIcon() {
BrowserActions.click(this.settingsIcon);
async clickSettingsIcon(): Promise<void> {
await BrowserActions.click(this.settingsIcon);
}
showPassword() {
BrowserActions.click(this.showPasswordElement);
async showPassword(): Promise<void> {
await BrowserActions.click(this.showPasswordElement);
}
hidePassword() {
BrowserActions.click(this.hidePasswordElement);
async hidePassword(): Promise<void> {
await BrowserActions.click(this.hidePasswordElement);
}
getShownPassword() {
async getShownPassword(): Promise<string> {
return this.txtPassword.getAttribute('value');
}
checkPasswordIsHidden() {
BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
async checkPasswordIsHidden(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
}
checkRememberIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.rememberMe);
async checkRememberIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rememberMe);
}
checkRememberIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.rememberMe);
async checkRememberIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.rememberMe);
}
checkNeedHelpIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.needHelp);
async checkNeedHelpIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.needHelp);
}
checkNeedHelpIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.needHelp);
async checkNeedHelpIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.needHelp);
}
checkRegisterDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.register);
async checkRegisterDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.register);
}
checkRegisterIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.register);
async checkRegisterIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.register);
}
enableFooter() {
this.formControllersPage.enableToggle(this.footerSwitch);
async enableFooter(): Promise<void> {
await this.formControllersPage.enableToggle(this.footerSwitch);
}
disableFooter() {
this.formControllersPage.disableToggle(this.footerSwitch);
async disableFooter(): Promise<void> {
await this.formControllersPage.disableToggle(this.footerSwitch);
}
disableRememberMe() {
this.formControllersPage.disableToggle(this.rememberMeSwitch);
async disableRememberMe(): Promise<void> {
await this.formControllersPage.disableToggle(this.rememberMeSwitch);
}
enableSuccessRouteSwitch() {
this.formControllersPage.enableToggle(this.successRouteSwitch);
async enableSuccessRouteSwitch(): Promise<void> {
await this.formControllersPage.enableToggle(this.successRouteSwitch);
}
enableLogoSwitch() {
this.formControllersPage.enableToggle(this.logoSwitch);
async enableLogoSwitch(): Promise<void> {
await this.formControllersPage.enableToggle(this.logoSwitch);
}
enterSuccessRoute(route) {
return BrowserActions.clearSendKeys(this.successRouteTxt, route);
async enterSuccessRoute(route): Promise<void> {
await BrowserActions.clearSendKeys(this.successRouteTxt, route);
}
enterLogo(logo) {
BrowserActions.clearSendKeys(this.logoTxt, logo);
async enterLogo(logo): Promise<void> {
await BrowserActions.clearSendKeys(this.logoTxt, logo);
}
login(username, password) {
this.enterUsername(username);
this.enterPassword(password);
this.clickSignInButton();
return BrowserVisibility.waitUntilElementIsVisible(this.sidenavLayout);
async login(username, password): Promise<void> {
await this.enterUsername(username);
await this.enterPassword(password);
await this.clickSignInButton();
await BrowserVisibility.waitUntilElementIsVisible(this.sidenavLayout);
}
}

View File

@@ -17,36 +17,39 @@
import { by, element } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
import { ElementFinder } from 'protractor';
export class NotificationHistoryPage {
notificationList = element(by.css('#adf-notification-history-list'));
notificationList: ElementFinder = element(by.css('#adf-notification-history-list'));
clickNotificationButton() {
BrowserActions.clickExecuteScript('#adf-notification-history-open-button');
async clickNotificationButton(): Promise<void> {
await BrowserActions.clickExecuteScript('#adf-notification-history-open-button');
}
clickMarkAsRead() {
BrowserActions.click(element(by.css('#adf-notification-history-mark-as-read')));
async clickMarkAsRead(): Promise<void> {
await BrowserActions.click(element(by.css('#adf-notification-history-mark-as-read')));
}
checkNotificationIsPresent(text: string) {
expect(BrowserActions.getText(this.notificationList)).toContain(text);
async checkNotificationIsPresent(text: string): Promise<void> {
const notificationLisText = await BrowserActions.getText(this.notificationList);
await expect(notificationLisText).toContain(text);
}
checkNotificationIsNotPresent(text: string) {
expect(BrowserActions.getText(this.notificationList)).not.toContain(text);
async checkNotificationIsNotPresent(text: string): Promise<void> {
const notificationLisText = await BrowserActions.getText(this.notificationList);
await expect(notificationLisText).not.toContain(text);
}
checkNotifyContains(text: string) {
this.clickNotificationButton();
this.checkNotificationIsPresent(text);
this.clickMarkAsRead();
async checkNotifyContains(text: string): Promise<void> {
await this.clickNotificationButton();
await this.checkNotificationIsPresent(text);
await this.clickMarkAsRead();
}
checkNotifyNotContains(text: string) {
this.clickNotificationButton();
this.checkNotificationIsNotPresent(text);
BrowserActions.closeMenuAndDialogs();
async checkNotifyNotContains(text: string): Promise<void> {
await this.clickNotificationButton();
await this.checkNotificationIsNotPresent(text);
await BrowserActions.closeMenuAndDialogs();
}
}

View File

@@ -15,118 +15,109 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, Locator } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { ElementFinder } from 'protractor';
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('span[class="adf-pagination__max-items"]'));
currentPage = element(by.css('span[class="adf-pagination__current-page"]'));
totalPages = element(by.css('span[class="adf-pagination__total-pages"]'));
paginationRange = element(by.css('span[class="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 = 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('span[class="adf-pagination__range"]'));
pageSelectorDropDown: ElementFinder = element(by.css('div[class*="adf-pagination__page-selector"]'));
pageSelectorArrow: ElementFinder = element(by.css('button[data-automation-id="page-selector"]'));
itemsPerPage: ElementFinder = element(by.css('span[class="adf-pagination__max-items"]'));
currentPage: ElementFinder = element(by.css('span[class="adf-pagination__current-page"]'));
totalPages: ElementFinder = element(by.css('span[class="adf-pagination__total-pages"]'));
paginationRange: ElementFinder = element(by.css('span[class="adf-pagination__range"]'));
nextPageButton: ElementFinder = element(by.css('button[class*="adf-pagination__next-button"]'));
nextButtonDisabled: ElementFinder = element(by.css('button[class*="adf-pagination__next-button"][disabled]'));
previousButtonDisabled: ElementFinder = element(by.css('button[class*="adf-pagination__previous-button"][disabled]'));
pageDropDown: ElementFinder = element(by.css('div[class*="adf-pagination__actualinfo-block"] button'));
pageDropDownOptions: Locator = by.css('div[class*="mat-menu-content"] button');
paginationSection: ElementFinder = element(by.css('adf-pagination'));
paginationSectionEmpty: ElementFinder = element(by.css('adf-pagination[class*="adf-pagination__empty"]'));
totalFiles: ElementFinder = element(by.css('span[class="adf-pagination__range"]'));
selectItemsPerPage(numberOfItem: string) {
browser.executeScript(`document.querySelector('div[class*="adf-pagination__perpage-block"] button').click();`);
BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorDropDown);
async selectItemsPerPage(numberOfItem: string): Promise<void> {
await browser.executeScript(`document.querySelector('div[class*="adf-pagination__perpage-block"] button').click();`);
await BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorDropDown);
const itemsPerPage = element.all(by.cssContainingText('.mat-menu-item', numberOfItem)).first();
BrowserActions.click(itemsPerPage);
return this;
await BrowserActions.click(itemsPerPage);
await BrowserVisibility.waitUntilElementIsNotVisible(this.pageSelectorDropDown);
}
checkPageSelectorIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.pageSelectorArrow);
async checkPageSelectorIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.pageSelectorArrow);
}
checkPageSelectorIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorArrow);
async checkPageSelectorIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorArrow);
}
checkPaginationIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsOnPage(this.paginationSectionEmpty);
return this;
async checkPaginationIsNotDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.paginationSectionEmpty);
}
getCurrentItemsPerPage() {
async getCurrentItemsPerPage(): Promise<string> {
return BrowserActions.getText(this.itemsPerPage);
}
getCurrentPage() {
async getCurrentPage(): Promise<string> {
return BrowserActions.getText(this.currentPage);
}
getTotalPages() {
async getTotalPages(): Promise<string> {
return BrowserActions.getText(this.totalPages);
}
getPaginationRange() {
async getPaginationRange(): Promise<string> {
return BrowserActions.getText(this.paginationRange);
}
clickOnNextPage() {
browser.executeScript(`document.querySelector('button[class*="adf-pagination__next-button"]').click();`);
async clickOnNextPage(): Promise<void> {
await browser.executeScript(`document.querySelector('button[class*="adf-pagination__next-button"]').click();`);
}
clickOnPageDropdown() {
return BrowserActions.click(this.pageDropDown);
async clickOnPageDropdown(): Promise<void> {
await BrowserActions.click(this.pageDropDown);
}
clickOnPageDropdownOption(numberOfItemPerPage: string) {
BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first());
async clickOnPageDropdownOption(numberOfItemPerPage: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first());
const option = element(by.cssContainingText('div[class*="mat-menu-content"] button', numberOfItemPerPage));
BrowserActions.click(option);
return this;
await BrowserActions.click(option);
}
getPageDropdownOptions() {
const deferred = protractor.promise.defer();
BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first());
async getPageDropdownOptions() {
await BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first());
const initialList = [];
element.all(this.pageDropDownOptions).each(function (currentOption) {
currentOption.getText().then(function (text) {
if (text !== '') {
initialList.push(text);
}
});
}).then(function () {
deferred.fulfill(initialList);
await element.all(this.pageDropDownOptions).each(async (currentOption) => {
const text = await BrowserActions.getText(currentOption);
if (text !== '') {
initialList.push(text);
}
});
return deferred.promise;
return initialList;
}
checkNextPageButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(this.nextButtonDisabled);
async checkNextPageButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.nextButtonDisabled);
}
checkPreviousPageButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(this.previousButtonDisabled);
async checkPreviousPageButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.previousButtonDisabled);
}
checkNextPageButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.nextButtonDisabled);
async checkNextPageButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.nextButtonDisabled);
}
checkPreviousPageButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.previousButtonDisabled);
async checkPreviousPageButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.previousButtonDisabled);
}
getTotalNumberOfFiles() {
BrowserVisibility.waitUntilElementIsVisible(this.totalFiles);
const numberOfFiles = this.totalFiles.getText().then(function (totalNumber) {
const totalNumberOfFiles = totalNumber.split('of ')[1];
return totalNumberOfFiles;
});
return numberOfFiles;
async getTotalNumberOfFiles() {
await BrowserVisibility.waitUntilElementIsVisible(this.totalFiles);
const totalNumberOfFiles = await BrowserActions.getText(this.totalFiles);
return totalNumberOfFiles.split('of ')[1];
}
}

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
export class SettingsPage {
settingsURL = browser.baseUrl + '/settings';
settingsURL: string = browser.baseUrl + '/settings';
providerDropdown = element(by.css('mat-select[id="adf-provider-selector"] div[class="mat-select-arrow-wrapper"]'));
ecmAndBpm = {
option: element(by.xpath('//SPAN[@class="mat-option-text"][contains(text(),"ALL")]')),
@@ -39,47 +39,45 @@ export class SettingsPage {
option: element(by.xpath('//SPAN[@class="mat-option-text"][contains(text(),"OAUTH")]')),
text: 'OAUTH'
};
selectedOption = element(by.css('span[class*="mat-select-value-text"]'));
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"]'));
basicAuthRadioButton = element(by.cssContainingText('mat-radio-button[id*="mat-radio"]', 'Basic Authentication'));
identityHostText = element(by.css('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"]'));
backButton = element(by.cssContainingText('button span[class="mat-button-wrapper"]', 'Back'));
validationMessage = element(by.cssContainingText('mat-error', 'This field is required'));
selectedOption: ElementFinder = element(by.css('span[class*="mat-select-value-text"]'));
ecmText: ElementFinder = element(by.css('input[data-automation-id*="ecmHost"]'));
bpmText: ElementFinder = element(by.css('input[data-automation-id*="bpmHost"]'));
clientIdText: ElementFinder = element(by.css('input[id="clientId"]'));
authHostText: ElementFinder = element(by.css('input[id="oauthHost"]'));
logoutUrlText: ElementFinder = element(by.css('input[id="logout-url"]'));
basicAuthRadioButton: ElementFinder = element(by.cssContainingText('mat-radio-button[id*="mat-radio"]', 'Basic Authentication'));
identityHostText: ElementFinder = element(by.css('input[id="identityHost"]'));
ssoRadioButton: ElementFinder = element(by.cssContainingText('[id*="mat-radio"]', 'SSO'));
silentLoginToggleLabel: ElementFinder = element(by.css('mat-slide-toggle[name="silentLogin"] label'));
silentLoginToggleElement: ElementFinder = element(by.css('mat-slide-toggle[name="silentLogin"]'));
implicitFlowLabel: ElementFinder = element(by.css('mat-slide-toggle[name="implicitFlow"] label'));
implicitFlowElement: ElementFinder = element(by.css('mat-slide-toggle[name="implicitFlow"]'));
applyButton: ElementFinder = element(by.css('button[data-automation-id*="host-button"]'));
backButton: ElementFinder = element(by.cssContainingText('button span[class="mat-button-wrapper"]', 'Back'));
validationMessage: ElementFinder = element(by.cssContainingText('mat-error', 'This field is required'));
goToSettingsPage() {
browser.waitForAngularEnabled(true);
browser.driver.get(this.settingsURL);
return BrowserVisibility.waitUntilElementIsVisible(this.providerDropdown);
async goToSettingsPage(): Promise<void> {
await browser.get(this.settingsURL);
await BrowserVisibility.waitUntilElementIsVisible(this.providerDropdown);
}
setProvider(option, selected) {
BrowserVisibility.waitUntilElementIsVisible(this.providerDropdown);
this.providerDropdown.click();
BrowserVisibility.waitUntilElementIsVisible(option);
option.click();
return expect(this.selectedOption.getText()).toEqual(selected);
async setProvider(option, selected): Promise<void> {
await BrowserActions.click(this.providerDropdown);
await BrowserActions.click(option);
const selectedOptionText = await BrowserActions.getText(this.selectedOption);
await expect(selectedOptionText).toEqual(selected);
}
getSelectedOptionText() {
async getSelectedOptionText(): Promise<string> {
return BrowserActions.getText(this.selectedOption);
}
getBpmHostUrl() {
return this.bpmText.getAttribute('value');
async getBpmHostUrl() {
return await this.bpmText.getAttribute('value');
}
getEcmHostUrl() {
return this.ecmText.getAttribute('value');
async getEcmHostUrl() {
return await this.ecmText.getAttribute('value');
}
getBpmOption() {
@@ -94,221 +92,185 @@ export class SettingsPage {
return this.ecmAndBpm.option;
}
setProviderEcmBpm() {
this.setProvider(this.ecmAndBpm.option, this.ecmAndBpm.text);
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
this.clickApply();
return this;
async setProviderEcmBpm() {
await this.setProvider(this.ecmAndBpm.option, this.ecmAndBpm.text);
await this.clickApply();
}
setProviderBpm() {
this.setProvider(this.bpm.option, this.bpm.text);
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
this.clickApply();
return this;
async setProviderBpm() {
await this.setProvider(this.bpm.option, this.bpm.text);
await this.clickApply();
}
setProviderEcm() {
this.setProvider(this.ecm.option, this.ecm.text);
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
expect(this.bpmText.isPresent()).toBeFalsy();
this.clickApply();
return this;
async setProviderEcm() {
await this.setProvider(this.ecm.option, this.ecm.text);
await this.clickApply();
}
setProviderOauth() {
this.goToSettingsPage();
this.setProvider(this.oauth.option, this.oauth.text);
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
expect(this.authHostText.isPresent()).toBeTruthy();
this.clickApply();
return this;
async setProviderOauth() {
await this.goToSettingsPage();
await this.setProvider(this.oauth.option, this.oauth.text);
await this.clickApply();
}
async clickBackButton() {
BrowserVisibility.waitUntilElementIsVisible(this.backButton);
await this.backButton.click();
await BrowserActions.click(this.backButton);
}
async clickSsoRadioButton() {
BrowserVisibility.waitUntilElementIsVisible(this.ssoRadioButton);
await this.ssoRadioButton.click();
await BrowserActions.click(this.ssoRadioButton);
}
async setProviderEcmSso(contentServiceURL, authHost, identityHost, silentLogin = true, implicitFlow = true, clientId?: string, logoutUr: string = '/logout') {
async setProviderEcmSso(contentServiceURL, authHost, identityHost, silentLogin = true, implicitFlow = true, clientId?: string, logoutUrl: string = '/logout') {
await this.goToSettingsPage();
this.setProvider(this.ecm.option, this.ecm.text);
BrowserVisibility.waitUntilElementIsNotOnPage(this.bpmText);
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
this.clickSsoRadioButton();
this.setContentServicesURL(contentServiceURL);
this.setAuthHost(authHost);
this.setIdentityHost(identityHost);
this.setSilentLogin(silentLogin);
this.setImplicitFlow(implicitFlow);
this.setLogoutUrl(logoutUr);
await this.setProvider(this.ecm.option, this.ecm.text);
await this.clickSsoRadioButton();
await this.setContentServicesURL(contentServiceURL);
await this.setAuthHost(authHost);
await this.setIdentityHost(identityHost);
await this.setSilentLogin(silentLogin);
await this.setImplicitFlow(implicitFlow);
await this.setLogoutUrl(logoutUrl);
await this.clickApply();
await browser.sleep(1000);
}
async setProviderBpmSso(processServiceURL, authHost, identityHost, silentLogin = true, implicitFlow = true) {
await this.goToSettingsPage();
this.setProvider(this.bpm.option, this.bpm.text);
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
BrowserVisibility.waitUntilElementIsNotOnPage(this.ecmText);
this.clickSsoRadioButton();
this.setClientId();
this.setProcessServicesURL(processServiceURL);
this.setAuthHost(authHost);
this.setIdentityHost(identityHost);
this.setSilentLogin(silentLogin);
this.setImplicitFlow(implicitFlow);
await this.setProvider(this.bpm.option, this.bpm.text);
await BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
await BrowserVisibility.waitUntilElementIsNotVisible(this.ecmText);
await this.clickSsoRadioButton();
await this.setClientId();
await this.setProcessServicesURL(processServiceURL);
await this.setAuthHost(authHost);
await this.setIdentityHost(identityHost);
await this.setSilentLogin(silentLogin);
await this.setImplicitFlow(implicitFlow);
await this.clickApply();
await browser.sleep(1000);
}
async setProviderEcmBpmSso(contentServicesURL: string, processServiceURL, authHost, identityHost, clientId: string, silentLogin = true, implicitFlow = true) {
await this.goToSettingsPage();
this.setProvider(this.ecmAndBpm.option, this.ecmAndBpm.text);
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
this.clickSsoRadioButton();
this.setClientId(clientId);
this.setContentServicesURL(contentServicesURL);
this.setProcessServicesURL(processServiceURL);
this.setAuthHost(authHost);
this.setIdentityHost(identityHost);
this.setSilentLogin(silentLogin);
this.setImplicitFlow(implicitFlow);
await this.setProvider(this.ecmAndBpm.option, this.ecmAndBpm.text);
await BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
await BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
await this.clickSsoRadioButton();
await this.setClientId(clientId);
await this.setContentServicesURL(contentServicesURL);
await this.setProcessServicesURL(processServiceURL);
await this.setAuthHost(authHost);
await this.setIdentityHost(identityHost);
await this.setSilentLogin(silentLogin);
await this.setImplicitFlow(implicitFlow);
await this.clickApply();
await browser.sleep(1000);
}
async setLogoutUrl(logoutUrl) {
BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText);
this.logoutUrlText.clear();
this.logoutUrlText.sendKeys(logoutUrl);
await BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText);
await BrowserActions.clearSendKeys(this.logoutUrlText, logoutUrl);
}
async setProcessServicesURL(processServiceURL) {
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
BrowserActions.clearSendKeys(this.bpmText, processServiceURL);
await BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
await BrowserActions.clearSendKeys(this.bpmText, processServiceURL);
}
async setClientId(clientId: string = browser.params.config.oauth2.clientId) {
BrowserVisibility.waitUntilElementIsVisible(this.clientIdText);
this.clientIdText.clear();
this.clientIdText.sendKeys(clientId);
await BrowserActions.clearSendKeys(this.clientIdText, clientId);
}
async setContentServicesURL(contentServiceURL) {
BrowserVisibility.waitUntilElementIsClickable(this.ecmText);
BrowserActions.clearSendKeys(this.ecmText, contentServiceURL);
await BrowserActions.clearSendKeys(this.ecmText, contentServiceURL);
}
clearContentServicesURL() {
BrowserVisibility.waitUntilElementIsVisible(this.ecmText);
this.ecmText.clear();
this.ecmText.sendKeys('a');
this.ecmText.sendKeys(protractor.Key.BACK_SPACE);
async clearContentServicesURL() {
await BrowserActions.clearWithBackSpace(this.ecmText);
}
clearProcessServicesURL() {
BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
this.bpmText.clear();
this.bpmText.sendKeys('a');
this.bpmText.sendKeys(protractor.Key.BACK_SPACE);
async clearProcessServicesURL() {
await BrowserVisibility.waitUntilElementIsVisible(this.bpmText);
await BrowserActions.clearWithBackSpace(this.bpmText);
}
async setAuthHost(authHostURL) {
BrowserVisibility.waitUntilElementIsVisible(this.authHostText);
await this.authHostText.clear();
await this.authHostText.sendKeys(authHostURL);
await BrowserVisibility.waitUntilElementIsVisible(this.authHostText);
await BrowserActions.clearSendKeys(this.authHostText, authHostURL);
}
async setIdentityHost(identityHost) {
BrowserVisibility.waitUntilElementIsVisible(this.identityHostText);
await this.identityHostText.clear();
await this.identityHostText.sendKeys(identityHost);
await BrowserVisibility.waitUntilElementIsVisible(this.identityHostText);
await BrowserActions.clearSendKeys(this.identityHostText, identityHost);
}
async clickApply() {
BrowserVisibility.waitUntilElementIsVisible(this.applyButton);
await this.applyButton.click();
await BrowserActions.click(this.applyButton);
}
async setSilentLogin(enableToggle) {
BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleElement);
await BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleElement);
const isChecked = (await this.silentLoginToggleElement.getAttribute('class')).includes('mat-checked');
if (isChecked && !enableToggle || !isChecked && enableToggle) {
return this.silentLoginToggleLabel.click();
await BrowserActions.click(this.silentLoginToggleLabel);
}
return Promise.resolve();
}
async setImplicitFlow(enableToggle) {
BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowElement);
await BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowElement);
const isChecked = (await this.implicitFlowElement.getAttribute('class')).includes('mat-checked');
if (isChecked && !enableToggle || !isChecked && enableToggle) {
return this.implicitFlowLabel.click();
await BrowserActions.click(this.implicitFlowLabel);
}
return Promise.resolve();
}
checkApplyButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[data-automation-id*="host-button"]:disabled')));
return this;
async checkApplyButtonIsDisabled() {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[data-automation-id*="host-button"]:disabled')));
}
checkProviderDropdownIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.providerDropdown);
async checkProviderDropdownIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.providerDropdown);
}
checkValidationMessageIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.validationMessage);
async checkValidationMessageIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.validationMessage);
}
checkProviderOptions() {
BrowserVisibility.waitUntilElementIsVisible(this.providerDropdown);
this.providerDropdown.click();
BrowserVisibility.waitUntilElementIsVisible(this.ecmAndBpm.option);
BrowserVisibility.waitUntilElementIsVisible(this.ecm.option);
BrowserVisibility.waitUntilElementIsVisible(this.bpm.option);
async checkProviderOptions() {
await BrowserActions.click(this.providerDropdown);
await BrowserVisibility.waitUntilElementIsVisible(this.ecmAndBpm.option);
await BrowserVisibility.waitUntilElementIsVisible(this.ecm.option);
await BrowserVisibility.waitUntilElementIsVisible(this.bpm.option);
}
getBasicAuthRadioButton() {
BrowserVisibility.waitUntilElementIsVisible(this.basicAuthRadioButton);
return this.basicAuthRadioButton;
}
getSsoRadioButton() {
BrowserVisibility.waitUntilElementIsVisible(this.ssoRadioButton);
return this.ssoRadioButton;
}
getBackButton() {
BrowserVisibility.waitUntilElementIsVisible(this.backButton);
return this.backButton;
}
getApplyButton() {
BrowserVisibility.waitUntilElementIsVisible(this.applyButton);
return this.applyButton;
}
checkBasicAuthRadioIsSelected() {
expect(this.getBasicAuthRadioButton().getAttribute('class')).toContain('mat-radio-checked');
async checkBasicAuthRadioIsSelected() {
const radioButton = this.getBasicAuthRadioButton();
await expect(await radioButton.getAttribute('class')).toContain('mat-radio-checked');
}
checkSsoRadioIsNotSelected() {
expect(this.getSsoRadioButton().getAttribute('class')).not.toContain('mat-radio-checked');
async checkSsoRadioIsNotSelected() {
const radioButton = this.getSsoRadioButton();
await expect(await radioButton.getAttribute('class')).not.toContain('mat-radio-checked');
}
}

View File

@@ -19,136 +19,131 @@ import { element, by } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { TabsPage } from '../../material/pages/tabs.page';
import { BrowserActions } from '../utils/browser-actions';
import { ElementFinder } from 'protractor';
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('span[class="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: ElementFinder = element.all(by.css('mat-card[class*="adf-userinfo-card"]')).first();
userImage: ElementFinder = element(by.css('div[id="user-initial-image"]'));
userInfoEcmHeaderTitle: ElementFinder = element(by.css('div[id="ecm-username"]'));
userInfoEcmTitle: ElementFinder = element(by.css('mat-card-content span[id="ecm-full-name"]'));
ecmEmail: ElementFinder = element(by.css('span[id="ecm-email"]'));
ecmJobTitle: ElementFinder = element(by.css('span[id="ecm-job-title"]'));
userInfoProcessHeaderTitle: ElementFinder = element(by.css('div[id="bpm-username"]'));
userInfoProcessTitle: ElementFinder = element(by.css('mat-card-content span[id="bpm-full-name"]'));
processEmail: ElementFinder = element(by.css('span[id="bpm-email"]'));
processTenant: ElementFinder = element(by.css('span[class="detail-profile"]'));
apsImage: ElementFinder = element(by.css('img[id="bpm-user-detail-image"]'));
acsImage: ElementFinder = element(by.css('img[id="ecm-user-detail-image"]'));
initialImage: ElementFinder = element.all(by.css('div[id="user-initials-image"]')).first();
userInfoSsoHeaderTitle: ElementFinder = this.dialog.element(by.css('div[id="identity-username"]'));
userInfoSsoTitle: ElementFinder = element(by.css('.adf-userinfo__detail-title'));
ssoEmail: ElementFinder = element(by.id('identity-email'));
userProfileButton: ElementFinder = element(by.css('button[data-automation-id="adf-user-profile"]'));
dialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.dialog);
return this;
async dialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
}
dialogIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.dialog);
return this;
async dialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
clickUserProfile() {
BrowserActions.click(this.userProfileButton);
async clickUserProfile(): Promise<void> {
await BrowserActions.click(this.userProfileButton);
}
clickOnContentServicesTab() {
async clickOnContentServicesTab(): Promise<void> {
const tabsPage = new TabsPage();
tabsPage.clickTabByTitle('Content Services');
return this;
await tabsPage.clickTabByTitle('Content Services');
}
checkProcessServicesTabIsSelected() {
async checkProcessServicesTabIsSelected(): Promise<void> {
const tabsPage = new TabsPage;
tabsPage.checkTabIsSelectedByTitle('Process Services');
return this;
await tabsPage.checkTabIsSelectedByTitle('Process Services');
}
clickOnProcessServicesTab() {
async clickOnProcessServicesTab(): Promise<void> {
const tabsPage = new TabsPage;
tabsPage.clickTabByTitle('Process Services');
return this;
await tabsPage.clickTabByTitle('Process Services');
}
userImageIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.userImage);
return this;
async userImageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.userImage);
}
getContentHeaderTitle() {
BrowserVisibility.waitUntilElementIsVisible(this.dialog);
async getContentHeaderTitle(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
return BrowserActions.getText(this.userInfoEcmHeaderTitle);
}
getContentTitle() {
async getContentTitle(): Promise<string> {
return BrowserActions.getText(this.userInfoEcmTitle);
}
getContentEmail() {
async getContentEmail(): Promise<string> {
return BrowserActions.getText(this.ecmEmail);
}
getContentJobTitle() {
async getContentJobTitle(): Promise<string> {
return BrowserActions.getText(this.ecmJobTitle);
}
getProcessHeaderTitle() {
async getProcessHeaderTitle(): Promise<string> {
return BrowserActions.getText(this.userInfoProcessHeaderTitle);
}
getProcessTitle() {
async getProcessTitle(): Promise<string> {
return BrowserActions.getText(this.userInfoProcessTitle);
}
getProcessEmail() {
async getProcessEmail(): Promise<string> {
return BrowserActions.getText(this.processEmail);
}
getProcessTenant() {
async getProcessTenant(): Promise<string> {
return BrowserActions.getText(this.processTenant);
}
getSsoHeaderTitle() {
async getSsoHeaderTitle(): Promise<string> {
return BrowserActions.getText(this.userInfoSsoHeaderTitle);
}
getSsoTitle() {
async getSsoTitle(): Promise<string> {
return BrowserActions.getText(this.userInfoSsoTitle);
}
getSsoEmail() {
async getSsoEmail(): Promise<string> {
return BrowserActions.getText(this.ssoEmail);
}
closeUserProfile() {
BrowserVisibility.waitUntilElementIsVisible(this.dialog);
BrowserActions.closeMenuAndDialogs();
async closeUserProfile(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
await BrowserActions.closeMenuAndDialogs();
}
checkACSProfileImage() {
BrowserVisibility.waitUntilElementIsVisible(this.acsImage);
async checkACSProfileImage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.acsImage);
}
checkAPSProfileImage() {
BrowserVisibility.waitUntilElementIsVisible(this.apsImage);
async checkAPSProfileImage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.apsImage);
}
checkInitialImage() {
BrowserVisibility.waitUntilElementIsVisible(this.initialImage);
async checkInitialImage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.initialImage);
}
initialImageNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.initialImage);
async initialImageNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.initialImage);
}
ACSProfileImageNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.acsImage);
async ACSProfileImageNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.acsImage);
}
APSProfileImageNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.apsImage);
async APSProfileImageNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.apsImage);
}
}

View File

@@ -15,77 +15,94 @@
* limitations under the License.
*/
import { BrowserVisibility } from './browser-visibility';
import { browser, by, element, ElementFinder, protractor } from 'protractor';
import { browser, by, element, ElementArrayFinder, ElementFinder, protractor } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
export class BrowserActions {
static async click(elementFinder: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(elementFinder);
BrowserVisibility.waitUntilElementIsClickable(elementFinder);
return elementFinder.click();
static async click(elementFinder: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
await BrowserVisibility.waitUntilElementIsClickable(elementFinder);
await elementFinder.click();
}
static async getUrl(url: string) {
static async getUrl(url: string): Promise<any> {
return browser.get(url);
}
static async clickExecuteScript(elementCssSelector: string) {
BrowserVisibility.waitUntilElementIsVisible(element(by.css(elementCssSelector)));
browser.executeScript(`document.querySelector('${elementCssSelector}').click();`);
static async clickExecuteScript(elementCssSelector: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(element(by.css(elementCssSelector)));
await browser.executeScript(`document.querySelector('${elementCssSelector}').click();`);
}
static async getText(elementFinder: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(elementFinder);
return elementFinder.getText();
static async getText(elementFinder: ElementFinder): Promise<string> {
const present = await BrowserVisibility.waitUntilElementIsPresent(elementFinder);
if (present) {
return elementFinder.getText();
} else {
return '';
}
}
static async getColor(elementFinder: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(elementFinder);
return elementFinder.getWebElement().getCssValue('color');
static async getArrayText(elementFinders: ElementArrayFinder): Promise<string> {
return elementFinders.getText();
}
static async clearSendKeys(elementFinder: ElementFinder, text: string) {
BrowserVisibility.waitUntilElementIsVisible(elementFinder);
elementFinder.click();
elementFinder.sendKeys('');
elementFinder.clear();
elementFinder.sendKeys(text);
static async getColor(elementFinder: ElementFinder): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
const webElem = await elementFinder.getWebElement();
return await webElem.getCssValue('color');
}
static async checkIsDisabled(elementFinder: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(elementFinder);
expect(elementFinder.getAttribute('disabled')).toEqual('true');
return this;
static async clearWithBackSpace(elementFinder: ElementFinder) {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
await elementFinder.click();
const value = await elementFinder.getAttribute('value');
for (let i = value.length; i >= 0; i--) {
await elementFinder.sendKeys(protractor.Key.BACK_SPACE);
}
}
static async rightClick(elementFinder: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(elementFinder);
return browser.actions().click(elementFinder, protractor.Button.RIGHT).perform();
static async clearSendKeys(elementFinder: ElementFinder, text: string): Promise<void> {
await this.click(elementFinder);
await elementFinder.sendKeys('');
await elementFinder.clear();
await elementFinder.sendKeys(text);
}
static async closeMenuAndDialogs() {
return browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
static async checkIsDisabled(elementFinder: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
const valueCheck = await elementFinder.getAttribute('disabled');
await expect(valueCheck).toEqual('true');
}
static async closeDisabledMenu() {
static async rightClick(elementFinder: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
await browser.actions().mouseMove(elementFinder).perform();
await browser.actions().click(elementFinder, protractor.Button.RIGHT).perform();
}
static async closeMenuAndDialogs(): Promise<void> {
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await BrowserVisibility.waitUntilElementIsNotVisible(container);
}
static async closeDisabledMenu(): Promise<void> {
// if the opened menu has only disabled items, pressing escape to close it won't work
return browser.actions().sendKeys(protractor.Key.ENTER).perform();
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
static clickOnDropdownOption(option: string, dropDownElement: ElementFinder) {
this.click(dropDownElement);
BrowserVisibility.waitUntilElementIsVisible(element('div[class*="mat-menu-content"] button'));
static async clickOnDropdownOption(option: string, dropDownElement: ElementFinder): Promise<void> {
await this.click(dropDownElement);
await BrowserVisibility.waitUntilElementIsVisible(element('div[class*="mat-menu-content"] button'));
const optionElement = element(by.cssContainingText('div[class*="mat-menu-content"] button', option));
BrowserActions.click(optionElement);
return this;
await this.click(optionElement);
}
static clickOnSelectDropdownOption(option: string, dropDownElement: ElementFinder) {
this.click(dropDownElement);
static async clickOnSelectDropdownOption(option: string, dropDownElement: ElementFinder): Promise<void> {
await this.click(dropDownElement);
const optionElement = element(by.cssContainingText('mat-option span.mat-option-text', option));
BrowserActions.click(optionElement);
return this;
await this.click(optionElement);
}
}

View File

@@ -15,98 +15,58 @@
* limitations under the License.
*/
import { browser, by, element, ExpectedConditions as EC, ElementFinder, protractor } from 'protractor';
import { browser, by, element, ElementFinder, protractor } from 'protractor';
const until = protractor.ExpectedConditions;
const DEFAULT_TIMEOUT = global['TestConfig'] ? global['TestConfig'].main.timeout : 40000;
export class BrowserVisibility {
static async waitUntilElementIsPresent(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
return browser.wait(until.presenceOf(elementToCheck), waitTimeout, 'Element is not present ' + elementToCheck.locator());
}
/*
* Wait for element is visible
*/
static waitUntilElementIsVisible(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT, message: string = '') {
let isDisplayed = false;
return browser.wait(() => {
browser.waitForAngularEnabled();
elementToCheck.isDisplayed().then(
() => {
isDisplayed = true;
},
() => {
isDisplayed = false;
}
);
return isDisplayed;
}, waitTimeout, 'Element is not visible ' + elementToCheck.locator() + ' ' + message);
static async waitUntilElementIsVisible(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT, message: string = 'Element is not visible'): Promise<any> {
return browser.wait(until.visibilityOf(elementToCheck), waitTimeout, message + elementToCheck.locator());
}
/*
* Wait for element to be clickable
*/
static waitUntilElementIsClickable(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
return browser.wait(EC.elementToBeClickable(elementToCheck),
waitTimeout, 'Element is not Clickable ' + elementToCheck.locator());
static async waitUntilElementIsClickable(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
return browser.wait(until.elementToBeClickable(elementToCheck), waitTimeout, 'Element is not Clickable ' + elementToCheck.locator());
}
/*
* Wait for element to not be present on the page
*/
static waitUntilElementIsStale(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
static async waitUntilElementIsStale(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
return browser.wait(until.stalenessOf(elementToCheck), waitTimeout, 'Element is not in stale ' + elementToCheck.locator());
}
/*
* Wait for element to not be visible
*/
static waitUntilElementIsNotVisible(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
let isPresent = false;
return browser.wait(() => {
browser.waitForAngularEnabled();
elementToCheck.isPresent().then(
(present) => {
isPresent = !present;
}
);
return isPresent;
}, waitTimeout, 'Element is Visible and it should not' + elementToCheck.locator());
static async waitUntilElementIsNotVisible(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
return browser.wait(until.invisibilityOf(elementToCheck), waitTimeout, 'Element is Visible and it should not' + elementToCheck.locator());
}
/*
* Wait for element to have value
*/
static waitUntilElementHasValue(elementToCheck: ElementFinder, elementValue, waitTimeout: number = DEFAULT_TIMEOUT) {
browser.waitForAngularEnabled();
browser.wait(until.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, 'Element doesn\'t have a value ' + elementToCheck.locator());
static async waitUntilElementHasValue(elementToCheck: ElementFinder, elementValue, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
return browser.wait(until.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, 'Element doesn\'t have a value ' + elementToCheck.locator());
}
static waitUntilElementIsOnPage(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
return browser.wait(browser.wait(until.visibilityOf(elementToCheck)), waitTimeout);
}
/*
* Wait for element to not be visible
*/
static waitUntilElementIsNotOnPage(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
return browser.wait(until.invisibilityOf(elementToCheck), waitTimeout, 'Element is visible on the page ' + elementToCheck.locator());
}
static waitUntilElementIsPresent(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
browser.waitForAngularEnabled();
return browser.wait(until.presenceOf(elementToCheck), waitTimeout, 'Element is not present ' + elementToCheck.locator());
}
static waitUntilElementIsNotPresent(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT) {
static async waitUntilElementIsNotPresent(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
return browser.wait(until.stalenessOf(elementToCheck), waitTimeout, 'Element is present ' + elementToCheck.locator());
}
static waitUntilDialogIsClose() {
static async waitUntilDialogIsClose(): Promise<any> {
const dialog = element(by.css('mat-dialog-container'));
return this.waitUntilElementIsNotPresent(dialog);
await this.waitUntilElementIsNotPresent(dialog);
}
}

View File

@@ -23,14 +23,15 @@ const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.
export class FileBrowserUtil {
static async isFileDownloaded(fileName: string) {
browser.driver.wait(() => {
static async isFileDownloaded(fileName: string): Promise<boolean> {
const file = await browser.driver.wait(() => {
return fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName));
}, 30000).then((file) => {
expect(file).toBe(true);
}, (error) => {
throw error;
});
}, 30000);
await expect(file).toBe(true);
return !!file;
}
}

View File

@@ -19,13 +19,13 @@ import { browser } from 'protractor';
export class FormUtil {
static async setForm(value: string) {
static async setForm(value: string): Promise<void> {
await browser.executeScript(
'window.adf.setFormInEditor(`' + value + '`);'
);
}
static async setCloudForm(value: string) {
static async setCloudForm(value: string): Promise<void> {
await browser.executeScript(
'window.adf.setCloudFormInEditor(`' + value + '`);'
);

View File

@@ -19,37 +19,37 @@ import { browser } from 'protractor';
export class LocalStorageUtil {
static async setConfigField(field: string, value: string) {
static async setConfigField(field: string, value: string): Promise<void> {
await browser.executeScript(
'window.adf.setConfigField(`' + field + '`, `' + value + '`);'
);
}
static async setStorageItem(field: string, value: string) {
static async setStorageItem(field: string, value: string): Promise<void> {
await browser.executeScript(
'window.adf.setStorageItem(`' + field + '`, `' + value + '`);'
);
}
static async removeStorageItem(field: string) {
static async removeStorageItem(field: string): Promise<void> {
await browser.executeScript(
'window.adf.removeStorageItem(`' + field + '`);'
);
}
static async setUserPreference(field: string, value: any) {
static async setUserPreference(field: string, value: any): Promise<void> {
await browser.executeScript(
'window.adf.setUserPreference(`' + field + '`, `' + value + '`);'
);
}
static async clearStorage() {
static async clearStorage(): Promise<void> {
await browser.executeScript(
'window.adf.clearStorage();'
);
}
static async apiReset() {
static async apiReset(): Promise<void> {
await browser.executeScript(
`window.adf.apiReset();`
);

View File

@@ -15,64 +15,59 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { DateUtil } from '../../core/utils/date-util';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class DatePickerPage {
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"]'));
datePicker: ElementFinder = element(by.css('mat-calendar'));
nextMonthButton: ElementFinder = element(by.css('button[class*="mat-calendar-next-button"]'));
previousMonthButton: ElementFinder = element(by.css('button[class*="mat-calendar-previous-button"]'));
getSelectedDate() {
return element(by.css('td[class*="mat-calendar-body-active"]')).getAttribute('aria-label');
async getSelectedDate(): Promise<string> {
return await element(by.css('td[class*="mat-calendar-body-active"]')).getAttribute('aria-label');
}
checkDatesAfterDateAreDisabled(date) {
async checkDatesAfterDateAreDisabled(date): Promise<void> {
const afterDate = DateUtil.formatDate('DD-MM-YY', date, 1);
const afterCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`));
browser.controlFlow().execute(async () => {
if (await afterCalendar.isPresent()) {
await expect(afterCalendar.getAttribute('aria-disabled')).toBe('true');
}
await expect(this.nextMonthButton.isEnabled()).toBe(false);
});
return this;
if (await afterCalendar.isPresent()) {
const aria = await afterCalendar.getAttribute('aria-disabled');
await expect(aria).toBe('true');
}
const isEnabled = await this.nextMonthButton.isEnabled();
await expect(isEnabled).toBe(false);
}
checkDatesBeforeDateAreDisabled(date) {
async checkDatesBeforeDateAreDisabled(date): Promise<void> {
const beforeDate = DateUtil.formatDate('DD-MM-YY', date, -1);
const beforeCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`));
browser.controlFlow().execute(async () => {
if (await beforeCalendar.isPresent()) {
await expect(beforeCalendar.getAttribute('aria-disabled')).toBe('true');
}
await expect(this.previousMonthButton.isEnabled()).toBe(false);
});
return this;
if (await beforeCalendar.isPresent()) {
const aria = await beforeCalendar.getAttribute('aria-disabled');
await expect(aria).toBe('true');
}
const isEnabled = await this.previousMonthButton.isEnabled();
await expect(isEnabled).toBe(false);
}
selectTodayDate() {
this.checkDatePickerIsDisplayed();
async selectTodayDate(): Promise<void> {
await this.checkDatePickerIsDisplayed();
const todayDate = element(by.css('.mat-calendar-body-today'));
BrowserActions.click(todayDate);
return this;
await BrowserActions.click(todayDate);
}
closeDatePicker() {
BrowserActions.closeMenuAndDialogs();
this.checkDatePickerIsNotDisplayed();
async closeDatePicker(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await this.checkDatePickerIsNotDisplayed();
}
checkDatePickerIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.datePicker);
return this;
async checkDatePickerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.datePicker);
}
checkDatePickerIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.datePicker);
return this;
async checkDatePickerIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.datePicker);
}
}

View File

@@ -16,20 +16,18 @@
*/
import { element, by } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class TabsPage {
clickTabByTitle(tabTitle) {
async clickTabByTitle(tabTitle): Promise<void> {
const tab = element(by.cssContainingText("div[id*='mat-tab-label']", tabTitle));
BrowserVisibility.waitUntilElementIsVisible(tab);
tab.click();
await BrowserActions.click(tab);
}
checkTabIsSelectedByTitle(tabTitle) {
async checkTabIsSelectedByTitle(tabTitle): Promise<void> {
const tab = element(by.cssContainingText("div[id*='mat-tab-label']", tabTitle));
tab.getAttribute('aria-selected').then((result) => {
expect(result).toBe('true');
});
const result = await tab.getAttribute('aria-selected');
await expect(result).toBe('true');
}
}

View File

@@ -25,15 +25,14 @@ export class ProcessDefinitionsService {
this.api = api;
}
async getProcessDefinitions(appName) {
async getProcessDefinitions(appName): Promise<any> {
const path = '/' + appName + '/rb/v1/process-definitions';
const method = 'GET';
const queryParams = {};
try {
const data = await this.api.performBpmOperation(path, method, queryParams, {});
return data;
return this.api.performBpmOperation(path, method, queryParams, {});
} catch (error) {
if (error.status === 404) {
// tslint:disable-next-line:no-console
@@ -50,6 +49,7 @@ export class ProcessDefinitionsService {
return processDefinitions.list.entries.find((el) => {
if (el.entry.name === processDefinitionName) {
return el;
}});
}
});
}
}

View File

@@ -31,12 +31,12 @@ export class ProcessInstancesService {
const method = 'POST';
const queryParams = {}, postBody = {
'processDefinitionKey': processDefKey,
'payloadType': 'StartProcessPayload',
processDefinitionKey: processDefKey,
payloadType: 'StartProcessPayload',
...options
};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
@@ -52,7 +52,7 @@ export class ProcessInstancesService {
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
@@ -67,7 +67,7 @@ export class ProcessInstancesService {
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console
@@ -83,7 +83,7 @@ export class ProcessInstancesService {
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
// tslint:disable-next-line:no-console

View File

@@ -18,39 +18,40 @@
import { element, by } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { ElementArrayFinder, ElementFinder } from 'protractor';
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: ElementFinder = element(by.css('adf-cloud-app-list'));
allApps: ElementArrayFinder = element.all(by.css('adf-cloud-app-details'));
nameOfAllApps: ElementArrayFinder = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1'));
firstApp: ElementFinder = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1')).first();
checkApsContainer() {
BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
BrowserVisibility.waitUntilElementIsVisible(this.firstApp);
async checkApsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
await BrowserVisibility.waitUntilElementIsVisible(this.firstApp);
}
goToApp(applicationName) {
BrowserActions.clickExecuteScript('mat-card[title="' + applicationName + '"]');
async goToApp(applicationName): Promise<void> {
await BrowserActions.clickExecuteScript('mat-card[title="' + applicationName + '"]');
}
countAllApps() {
async countAllApps(): Promise<number> {
return this.allApps.count();
}
getNameOfTheApplications() {
return this.nameOfAllApps.getText();
async getNameOfTheApplications(): Promise<string> {
return await BrowserActions.getArrayText(this.nameOfAllApps);
}
checkAppIsNotDisplayed(applicationName) {
async checkAppIsNotDisplayed(applicationName): Promise<void> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
return BrowserVisibility.waitUntilElementIsNotOnPage(app);
await BrowserVisibility.waitUntilElementIsNotVisible(app);
}
checkAppIsDisplayed(applicationName) {
async checkAppIsDisplayed(applicationName): Promise<void> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
return BrowserVisibility.waitUntilElementIsVisible(app);
await BrowserVisibility.waitUntilElementIsVisible(app);
}
}

View File

@@ -15,66 +15,58 @@
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { browser, by, element } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { ElementFinder } from 'protractor';
import { Locator } from 'protractor/built/locators';
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 = by.id('adf-save-button-id');
cancelButtonLocator = by.id('adf-cancel-button-id');
componentElement: ElementFinder = element(by.css('adf-cloud-process-filter-dialog-cloud'));
title: ElementFinder = element(by.id('adf-process-filter-dialog-title'));
filterNameInput: ElementFinder = element(by.id('adf-filter-name-id'));
saveButtonLocator: Locator = by.id('adf-save-button-id');
cancelButtonLocator: Locator = by.id('adf-cancel-button-id');
clickOnSaveButton() {
async clickOnSaveButton(): Promise<void> {
const saveButton = this.componentElement.element(this.saveButtonLocator);
BrowserVisibility.waitUntilElementIsVisible(saveButton);
saveButton.click();
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
await BrowserActions.click(saveButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
await browser.driver.sleep(1000);
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
async checkSaveButtonIsEnabled() {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled();
}
clickOnCancelButton() {
async clickOnCancelButton(): Promise<void> {
const cancelButton = this.componentElement.element(this.cancelButtonLocator);
BrowserActions.click(cancelButton);
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
await BrowserActions.click(cancelButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
}
checkCancelButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
async checkCancelButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
return this.componentElement.element(this.cancelButtonLocator).isEnabled();
}
getFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
async getFilterName(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
return this.filterNameInput.getAttribute('value');
}
setFilterName(filterName) {
this.clearFilterName();
this.filterNameInput.sendKeys(filterName);
return this;
async setFilterName(filterName): Promise<void> {
await BrowserActions.clearSendKeys(this.filterNameInput, filterName);
}
clearFilterName() {
BrowserActions.click(this.filterNameInput);
this.filterNameInput.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filterNameInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
}
getTitle() {
async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
}
async clearFilterName() {
await BrowserActions.clearWithBackSpace(this.filterNameInput);
}
}

View File

@@ -15,64 +15,56 @@
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { browser, by, element, Locator } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { ElementFinder } from 'protractor';
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 = by.id('adf-save-button-id');
cancelButtonLocator = by.id('adf-cancel-button-id');
componentElement: ElementFinder = element(by.css('adf-cloud-task-filter-dialog'));
title: ElementFinder = element(by.id('adf-task-filter-dialog-title'));
filterNameInput: ElementFinder = element(by.id('adf-filter-name-id'));
saveButtonLocator: Locator = by.id('adf-save-button-id');
cancelButtonLocator: Locator = by.id('adf-cancel-button-id');
clickOnSaveButton() {
async clickOnSaveButton(): Promise<void> {
const saveButton = this.componentElement.element(this.saveButtonLocator);
BrowserActions.click(saveButton);
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
await BrowserActions.click(saveButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
await browser.driver.sleep(1000);
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
async checkSaveButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled();
}
clickOnCancelButton() {
async clickOnCancelButton(): Promise<void> {
const cancelButton = this.componentElement.element(this.cancelButtonLocator);
BrowserActions.click(cancelButton);
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
await BrowserActions.click(cancelButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
}
checkCancelButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
async checkCancelButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
return this.componentElement.element(this.cancelButtonLocator).isEnabled();
}
getFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
async getFilterName(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
return this.filterNameInput.getAttribute('value');
}
setFilterName(filterName) {
this.clearFilterName();
this.filterNameInput.sendKeys(filterName);
return this;
async setFilterName(filterName): Promise<void> {
await BrowserActions.clearSendKeys(this.filterNameInput, filterName);
}
clearFilterName() {
BrowserActions.click(this.filterNameInput);
this.filterNameInput.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filterNameInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
async clearFilterName() {
await BrowserActions.clearWithBackSpace(this.filterNameInput);
}
getTitle() {
getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
}

View File

@@ -18,90 +18,82 @@ import { browser, by, element, protractor } 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';
import { ElementFinder } from 'protractor';
export class EditProcessFilterCloudComponentPage {
customiseFilter = element(by.id('adf-edit-process-filter-title-id'));
selectedOption = element.all(by.css('mat-option[class*="mat-selected"]')).first();
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"]'));
customiseFilter: ElementFinder = element(by.id('adf-edit-process-filter-title-id'));
selectedOption: ElementFinder = element.all(by.css('mat-option[class*="mat-selected"]')).first();
saveButton: ElementFinder = element(by.css('button[data-automation-id="adf-filter-action-save"]'));
saveAsButton: ElementFinder = element(by.css('button[data-automation-id="adf-filter-action-saveAs"]'));
deleteButton: ElementFinder = element(by.css('button[data-automation-id="adf-filter-action-delete"]'));
editProcessFilterDialogPage = new EditProcessFilterDialogPage();
editProcessFilterDialog() {
editProcessFilterDialog(): EditProcessFilterDialogPage {
return this.editProcessFilterDialogPage;
}
clickCustomiseFilterHeader() {
BrowserActions.click(this.customiseFilter);
return this;
async clickCustomiseFilterHeader(): Promise<void> {
await BrowserActions.click(this.customiseFilter);
await browser.driver.sleep(1000);
}
checkCustomiseFilterHeaderIsExpanded() {
async checkCustomiseFilterHeaderIsExpanded(): Promise<void> {
const expansionPanelExtended = element.all(by.css('mat-expansion-panel-header[class*="mat-expanded"]')).first();
BrowserVisibility.waitUntilElementIsVisible(expansionPanelExtended);
await BrowserVisibility.waitUntilElementIsVisible(expansionPanelExtended);
const content = element.all(by.css('div[class*="mat-expansion-panel-content "][style*="visible"]')).first();
BrowserVisibility.waitUntilElementIsVisible(content);
return this;
await BrowserVisibility.waitUntilElementIsVisible(content);
}
setStatusFilterDropDown(option) {
this.clickOnDropDownArrow('status');
async setStatusFilterDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('status');
const statusElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(statusElement);
return this;
await BrowserActions.click(statusElement);
}
getStateFilterDropDownValue() {
async getStateFilterDropDownValue(): Promise<string> {
return BrowserActions.getText(element(by.css("mat-form-field[data-automation-id='status'] span")));
}
setSortFilterDropDown(option) {
this.clickOnDropDownArrow('sort');
async setSortFilterDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('sort');
const sortElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(sortElement);
return this;
await BrowserActions.click(sortElement);
}
getSortFilterDropDownValue() {
async getSortFilterDropDownValue(): Promise<string> {
const sortLocator = element.all(by.css("mat-form-field[data-automation-id='sort'] span")).first();
return BrowserActions.getText(sortLocator);
return await BrowserActions.getText(sortLocator);
}
setOrderFilterDropDown(option) {
this.clickOnDropDownArrow('order');
async setOrderFilterDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('order');
const orderElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(orderElement);
browser.sleep(1000);
return this;
await BrowserActions.click(orderElement);
await browser.sleep(1000);
}
getOrderFilterDropDownValue() {
async getOrderFilterDropDownValue(): Promise<string> {
return BrowserActions.getText(element(by.css("mat-form-field[data-automation-id='order'] span")));
}
clickOnDropDownArrow(option) {
async clickOnDropDownArrow(option): Promise<void> {
const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class='mat-select-arrow-wrapper']")).first();
BrowserVisibility.waitUntilElementIsVisible(dropDownArrow);
BrowserActions.click(dropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.selectedOption);
await BrowserActions.click(dropDownArrow);
}
setAppNameDropDown(option) {
this.clickOnDropDownArrow('appName');
async setAppNameDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('appName');
const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(appNameElement);
BrowserVisibility.waitUntilElementIsVisible(appNameElement);
appNameElement.click();
return this;
await BrowserActions.click(appNameElement);
}
async checkAppNamesAreUnique() {
async checkAppNamesAreUnique(): Promise<boolean> {
const appNameList = element.all(by.css('mat-option[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span'));
const appTextList: any = await appNameList.getText();
const uniqueArray = appTextList.filter((appName) => {
@@ -111,91 +103,80 @@ export class EditProcessFilterCloudComponentPage {
return uniqueArray.length === appTextList.length;
}
getNumberOfAppNameOptions() {
this.clickOnDropDownArrow('appName');
async getNumberOfAppNameOptions(): Promise<number> {
await this.clickOnDropDownArrow('appName');
const dropdownOptions = element.all(by.css('.mat-select-panel mat-option'));
return dropdownOptions.count();
}
setProcessInstanceId(option) {
return this.setProperty('processInstanceId', option);
async setProcessInstanceId(option): Promise<void> {
await this.setProperty('processInstanceId', option);
}
getProcessInstanceId() {
async getProcessInstanceId(): Promise<string> {
return this.getProperty('processInstanceId');
}
getProperty(property) {
async getProperty(property): Promise<string> {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserVisibility.waitUntilElementIsVisible(locator);
return locator.getAttribute('value');
}
setProperty(property, option) {
async setProperty(property, option): Promise<void> {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.clear();
locator.sendKeys(option);
locator.sendKeys(protractor.Key.ENTER);
return this;
await BrowserVisibility.waitUntilElementIsVisible(locator);
await locator.clear();
await locator.sendKeys(option);
await locator.sendKeys(protractor.Key.ENTER);
}
checkSaveButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this;
async checkSaveButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
}
checkSaveAsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
return this;
async checkSaveAsButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
}
checkDeleteButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
return this;
async checkDeleteButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
}
checkDeleteButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.deleteButton);
return this;
async checkDeleteButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.deleteButton);
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
async checkSaveButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.saveButton.isEnabled();
}
checkSaveAsButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
async checkSaveAsButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
return this.saveAsButton.isEnabled();
}
checkDeleteButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
async checkDeleteButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
return this.deleteButton.isEnabled();
}
clickSaveAsButton() {
async clickSaveAsButton(): Promise<void> {
const disabledButton = element(by.css(("button[data-automation-id='adf-filter-action-saveAs'][disabled]")));
BrowserVisibility.waitUntilElementIsClickable(this.saveAsButton);
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
this.saveAsButton.click();
return this.editProcessFilterDialogPage;
await BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
await BrowserActions.click(this.saveAsButton);
await browser.driver.sleep(1000);
}
clickDeleteButton() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
this.deleteButton.click();
return this;
async clickDeleteButton(): Promise<void> {
await BrowserActions.click(this.deleteButton);
}
clickSaveButton() {
async clickSaveButton(): Promise<void> {
const disabledButton = element(by.css(("button[id='adf-save-as-id'][disabled]")));
BrowserVisibility.waitUntilElementIsClickable(this.saveButton);
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
this.saveButton.click();
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
await BrowserActions.click(this.saveButton);
}
}

View File

@@ -19,236 +19,230 @@ import { browser, by, element, protractor } 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';
import { ElementFinder } from 'protractor';
export class EditTaskFilterCloudComponentPage {
customiseFilter = element(by.id('adf-edit-task-filter-title-id'));
selectedOption = element.all(by.css('mat-option[class*="mat-selected"]')).first();
assignee = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-assignee"]'));
priority = element(by.css('input[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[placeholder="LastModifiedFrom"]'));
lastModifiedTo = element(by.css('input[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"]'));
customiseFilter: ElementFinder = element(by.id('adf-edit-task-filter-title-id'));
selectedOption: ElementFinder = element.all(by.css('mat-option[class*="mat-selected"]')).first();
assignee: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-assignee"]'));
priority: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-priority"]'));
taskName: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskName"]'));
id: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskId"]'));
processDefinitionId: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-processDefinitionId"]'));
processInstanceId: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]'));
lastModifiedFrom: ElementFinder = element(by.css('input[placeholder="LastModifiedFrom"]'));
lastModifiedTo: ElementFinder = element(by.css('input[placeholder="LastModifiedTo"]'));
parentTaskId: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-parentTaskId"]'));
owner: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-owner"]'));
saveButton: ElementFinder = element(by.css('[data-automation-id="adf-filter-action-save"]'));
saveAsButton: ElementFinder = element(by.css('[data-automation-id="adf-filter-action-saveAs"]'));
deleteButton: ElementFinder = element(by.css('[data-automation-id="adf-filter-action-delete"]'));
editTaskFilterDialogPage = new EditTaskFilterDialogPage();
editTaskFilterDialog() {
editTaskFilterDialog(): EditTaskFilterDialogPage {
return this.editTaskFilterDialogPage;
}
clickCustomiseFilterHeader() {
BrowserActions.click(this.customiseFilter);
return this;
async clickCustomiseFilterHeader(): Promise<void> {
await BrowserActions.click(this.customiseFilter);
await browser.driver.sleep(1000);
}
setStatusFilterDropDown(option) {
this.clickOnDropDownArrow('status');
async setStatusFilterDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('status');
const statusElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(statusElement);
return this;
await BrowserActions.click(statusElement);
}
getStatusFilterDropDownValue() {
return BrowserActions.getText(element(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-status'] span span")));
async getStatusFilterDropDownValue(): Promise<string> {
return BrowserActions.getText(element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-status'] span")).first());
}
setSortFilterDropDown(option) {
this.clickOnDropDownArrow('sort');
async setSortFilterDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('sort');
const sortElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(sortElement);
return this;
await BrowserActions.click(sortElement);
}
getSortFilterDropDownValue() {
return BrowserActions.getText(element(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-sort'] span span")));
async getSortFilterDropDownValue(): Promise<string> {
const elementSort = element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-sort'] span")).first();
return BrowserActions.getText(elementSort);
}
setOrderFilterDropDown(option) {
this.clickOnDropDownArrow('order');
async setOrderFilterDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('order');
const orderElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(orderElement);
browser.sleep(1000);
return this;
await BrowserActions.click(orderElement);
await browser.sleep(1000);
}
getOrderFilterDropDownValue() {
return BrowserActions.getText(element(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-order'] span span")));
getOrderFilterDropDownValue(): Promise<string> {
return BrowserActions.getText(element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-order'] span")).first());
}
clickOnDropDownArrow(option) {
async clickOnDropDownArrow(option): Promise<void> {
const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class*='arrow']")).first();
BrowserActions.click(dropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.selectedOption);
await BrowserActions.click(dropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.selectedOption);
}
setAssignee(option) {
return this.setProperty('assignee', option);
async setAssignee(option): Promise<void> {
await this.setProperty('assignee', option);
}
getAssignee() {
async getAssignee(): Promise<string> {
return BrowserActions.getText(this.assignee);
}
setPriority(option) {
return this.setProperty('priority', option);
async setPriority(option): Promise<void> {
await this.setProperty('priority', option);
}
getPriority() {
async getPriority(): Promise<string> {
return BrowserActions.getText(this.priority);
}
setParentTaskId(option) {
return this.setProperty('parentTaskId', option);
async setParentTaskId(option): Promise<void> {
await this.setProperty('parentTaskId', option);
}
getParentTaskId() {
async getParentTaskId(): Promise<string> {
return BrowserActions.getText(this.parentTaskId);
}
setOwner(option) {
return this.setProperty('owner', option);
async setOwner(option): Promise<void> {
await this.setProperty('owner', option);
}
getOwner() {
async getOwner(): Promise<string> {
return BrowserActions.getText(this.owner);
}
setLastModifiedFrom(lastModifiedFromDate) {
this.clearField(this.lastModifiedFrom);
BrowserActions.clearSendKeys(this.lastModifiedFrom, lastModifiedFromDate);
async setLastModifiedFrom(lastModifiedFromDate) {
await this.clearField(this.lastModifiedFrom);
await BrowserActions.clearSendKeys(this.lastModifiedFrom, lastModifiedFromDate);
}
getLastModifiedFrom() {
async getLastModifiedFrom(): Promise<string> {
return BrowserActions.getText(this.lastModifiedFrom);
}
setLastModifiedTo(lastModifiedToDate) {
this.clearField(this.lastModifiedTo);
BrowserActions.clearSendKeys(this.lastModifiedTo, lastModifiedToDate);
async setLastModifiedTo(lastModifiedToDate): Promise<void> {
await this.clearField(this.lastModifiedTo);
await BrowserActions.clearSendKeys(this.lastModifiedTo, lastModifiedToDate);
}
getLastModifiedTo() {
async getLastModifiedTo(): Promise<string> {
return BrowserActions.getText(this.lastModifiedTo);
}
checkSaveButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this;
async checkSaveButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
}
checkSaveAsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
return this;
async checkSaveAsButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
}
checkDeleteButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
return this;
async checkDeleteButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
async checkSaveButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.saveButton.isEnabled();
}
checkSaveAsButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
async checkSaveAsButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.saveAsButton.isEnabled();
}
checkDeleteButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
async checkDeleteButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.deleteButton.isEnabled();
}
clickSaveAsButton() {
async clickSaveAsButton(): Promise<void> {
const disabledButton = element(by.css(("button[data-automation-id='adf-filter-action-saveAs'][disabled]")));
BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
BrowserActions.click(this.saveAsButton);
return this.editTaskFilterDialogPage;
await BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
await BrowserActions.click(this.saveAsButton);
await browser.driver.sleep(1000);
}
clickDeleteButton() {
BrowserActions.click(this.deleteButton);
return this;
async clickDeleteButton(): Promise<void> {
await BrowserActions.click(this.deleteButton);
await browser.driver.sleep(1000);
}
clickSaveButton() {
BrowserActions.click(this.saveButton);
return this;
async clickSaveButton(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
clearAssignee() {
this.clearField(this.assignee);
return this;
async clearAssignee(): Promise<void> {
await BrowserActions.clearWithBackSpace(this.assignee);
await browser.driver.sleep(1000);
}
clearField(locator) {
BrowserActions.clearSendKeys(locator, ' ');
locator.sendKeys(protractor.Key.BACK_SPACE);
async clearField(locator): Promise<void> {
await BrowserActions.clearSendKeys(locator, ' ');
await locator.sendKeys(protractor.Key.BACK_SPACE);
}
setAppNameDropDown(option) {
this.clickOnDropDownArrow('appName');
async setAppNameDropDown(option): Promise<void> {
await this.clickOnDropDownArrow('appName');
const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserActions.click(appNameElement);
return this;
await BrowserActions.click(appNameElement);
}
getAppNameDropDownValue() {
return BrowserActions.getText(element(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-appName'] span span")));
async getAppNameDropDownValue(): Promise<string> {
const locator = element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-appName'] span")).first();
return BrowserActions.getText(locator);
}
setId(option) {
return this.setProperty('taskId', option);
async setId(option): Promise<void> {
await this.setProperty('taskId', option);
}
getId() {
async getId(): Promise<string> {
return this.id.getAttribute('value');
}
setTaskName(option) {
return this.setProperty('taskName', option);
async setTaskName(option): Promise<void> {
await this.setProperty('taskName', option);
}
getTaskName() {
async getTaskName(): Promise<string> {
return this.taskName.getAttribute('value');
}
setProcessDefinitionId(option) {
return this.setProperty('processDefinitionId', option);
async setProcessDefinitionId(option): Promise<void> {
await this.setProperty('processDefinitionId', option);
}
getProcessDefinitionId() {
async getProcessDefinitionId(): Promise<string> {
return this.processDefinitionId.getAttribute('value');
}
setProcessInstanceId(option) {
return this.setProperty('processInstanceId', option);
async setProcessInstanceId(option): Promise<void> {
await this.setProperty('processInstanceId', option);
}
setProperty(property, option) {
async setProperty(property, option): Promise<void> {
const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]'));
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.clear();
locator.sendKeys(option);
locator.sendKeys(protractor.Key.ENTER);
return this;
await BrowserVisibility.waitUntilElementIsVisible(locator);
await locator.clear();
await locator.sendKeys(option);
await locator.sendKeys(protractor.Key.ENTER);
}
getProcessInstanceId() {
async getProcessInstanceId(): Promise<string> {
return this.processInstanceId.getAttribute('value');
}

View File

@@ -15,76 +15,59 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class GroupCloudComponentPage {
groupCloudSearch = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]'));
groupCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]'));
searchGroups(name) {
BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
browser.sleep(1000);
this.groupCloudSearch.clear().then(() => {
for (let i = 0; i < name.length; i++) {
this.groupCloudSearch.sendKeys(name[i]);
}
this.groupCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
this.groupCloudSearch.sendKeys(name[name.length - 1]);
});
return this;
async searchGroups(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
await browser.sleep(1000);
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
}
searchGroupsToExisting(name) {
BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
for (let i = 0; i < name.length; i++) {
this.groupCloudSearch.sendKeys(name[i]);
}
this.groupCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
this.groupCloudSearch.sendKeys(name[name.length - 1]);
return this;
async searchGroupsToExisting(name) {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
}
getGroupsFieldContent() {
BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
async getGroupsFieldContent(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
return this.groupCloudSearch.getAttribute('value');
}
selectGroupFromList(name) {
async selectGroupFromList(name): Promise<void> {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
browser.sleep(1000);
BrowserActions.click(groupRow);
BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
return this;
await browser.sleep(1000);
await BrowserActions.click(groupRow);
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
}
checkGroupIsDisplayed(name) {
async checkGroupIsDisplayed(name): Promise<void> {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
BrowserVisibility.waitUntilElementIsVisible(groupRow);
return this;
await BrowserVisibility.waitUntilElementIsVisible(groupRow);
}
checkGroupIsNotDisplayed(name) {
async checkGroupIsNotDisplayed(name): Promise<void> {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
}
checkSelectedGroup(group) {
BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
return this;
async checkSelectedGroup(group): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
}
checkGroupNotSelected(group) {
BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
return this;
async checkGroupNotSelected(group): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
}
removeSelectedGroup(group) {
async removeSelectedGroup(group): Promise<void> {
const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`));
BrowserActions.click(locator);
await BrowserActions.click(locator);
}
}

View File

@@ -15,80 +15,67 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, ElementFinder, protractor } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
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"]'));
peopleCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
assigneeField: ElementFinder = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
clearAssignee() {
BrowserActions.clearSendKeys(this.peopleCloudSearch, ' ');
this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
return this;
async clearAssignee(): Promise<void> {
await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' ');
await this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
}
searchAssigneeAndSelect(name) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
this.selectAssigneeFromList(name);
return this;
async searchAssigneeAndSelect(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
await this.selectAssigneeFromList(name);
}
searchAssignee(name) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch);
browser.sleep(1000);
BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
return this;
async searchAssignee(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
await BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch);
await browser.sleep(1000);
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
}
searchAssigneeToExisting(name) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
for (let i = 0; i < name.length; i++) {
this.peopleCloudSearch.sendKeys(name[i]);
}
this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
this.peopleCloudSearch.sendKeys(name[name.length - 1]);
return this;
async searchAssigneeToExisting(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
await BrowserActions.clearSendKeys(this.peopleCloudSearch, name);
}
selectAssigneeFromList(name) {
async selectAssigneeFromList(name): Promise<void> {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
browser.sleep(2000);
assigneeRow.click();
BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
return this;
await browser.sleep(2000);
await BrowserActions.click(assigneeRow);
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
}
getAssignee() {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
async getAssignee(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
return this.peopleCloudSearch.getAttribute('value');
}
checkUserIsDisplayed(name) {
async checkUserIsDisplayed(name): Promise<void> {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
return this;
await BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
}
checkUserIsNotDisplayed(name) {
async checkUserIsNotDisplayed(name): Promise<void> {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
}
checkSelectedPeople(person) {
BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
return this;
async checkSelectedPeople(person): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
}
getAssigneeFieldContent() {
BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
browser.sleep(1000);
async getAssigneeFieldContent(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
await browser.sleep(1000);
return this.assigneeField.getAttribute('value');
}

View File

@@ -15,44 +15,41 @@
* limitations under the License.
*/
import { by } from 'protractor';
import { by, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class ProcessFiltersCloudComponentPage {
filter;
filterIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
filter: ElementFinder;
filterIcon: Locator = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
checkProcessFilterIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this;
async checkProcessFilterIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
}
getProcessFilterIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async getProcessFilterIcon(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.filterIcon);
BrowserVisibility.waitUntilElementIsVisible(icon);
return icon.getText();
await BrowserVisibility.waitUntilElementIsVisible(icon);
return BrowserActions.getText(icon);
}
checkProcessFilterHasNoIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
BrowserVisibility.waitUntilElementIsNotOnPage(this.filter.element(this.filterIcon));
async checkProcessFilterHasNoIcon(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.filterIcon));
}
clickProcessFilter() {
return BrowserActions.click(this.filter);
async clickProcessFilter(): Promise<void> {
await BrowserActions.click(this.filter);
}
checkProcessFilterNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
return this.filter;
async checkProcessFilterNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
}
}

View File

@@ -17,47 +17,48 @@
import { element, by } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { ElementFinder } from 'protractor';
export class ProcessHeaderCloudPage {
idField = element.all(by.css('span[data-automation-id*="id"] span')).first();
nameField = element.all(by.css('span[data-automation-id*="name"] span')).first();
statusField = element(by.css('span[data-automation-id*="status"] span'));
initiatorField = element(by.css('span[data-automation-id*="initiator"] span'));
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('span[data-automation-id*="parentId"] span'));
businessKeyField = element.all(by.css('span[data-automation-id*="businessKey"] span')).first();
idField: ElementFinder = element.all(by.css('span[data-automation-id*="id"] span')).first();
nameField: ElementFinder = element.all(by.css('span[data-automation-id*="name"] span')).first();
statusField: ElementFinder = element(by.css('span[data-automation-id*="status"] span'));
initiatorField: ElementFinder = element(by.css('span[data-automation-id*="initiator"] span'));
startDateField: ElementFinder = element.all(by.css('span[data-automation-id*="startDate"] span')).first();
lastModifiedField: ElementFinder = element.all(by.css('span[data-automation-id*="lastModified"] span')).first();
parentIdField: ElementFinder = element(by.css('span[data-automation-id*="parentId"] span'));
businessKeyField: ElementFinder = element.all(by.css('span[data-automation-id*="businessKey"] span')).first();
getId() {
async getId(): Promise<string> {
return BrowserActions.getText(this.idField);
}
getName() {
async getName(): Promise<string> {
return BrowserActions.getText(this.nameField);
}
getStatus() {
async getStatus(): Promise<string> {
return BrowserActions.getText(this.statusField);
}
getInitiator() {
async getInitiator(): Promise<string> {
return BrowserActions.getText(this.initiatorField);
}
getStartDate() {
async getStartDate(): Promise<string> {
return BrowserActions.getText(this.startDateField);
}
getLastModified() {
async getLastModified(): Promise<string> {
return BrowserActions.getText(this.lastModifiedField);
}
getParentId() {
async getParentId(): Promise<string> {
return BrowserActions.getText(this.parentIdField);
}
getBusinessKey() {
async getBusinessKey(): Promise<string> {
return BrowserActions.getText(this.businessKeyField);
}

View File

@@ -17,7 +17,7 @@
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class ProcessListCloudComponentPage {
@@ -27,77 +27,76 @@ export class ProcessListCloudComponentPage {
name: 'Name'
};
processList = element(by.css('adf-cloud-process-list'));
noProcessFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
processList: ElementFinder = element(by.css('adf-cloud-process-list'));
noProcessFound: ElementFinder = element.all(by.css("div[class='adf-empty-content__title']")).first();
dataTable = new DataTableComponentPage(this.processList);
dataTable: DataTableComponentPage = new DataTableComponentPage(this.processList);
getDataTable() {
getDataTable(): DataTableComponentPage {
return this.dataTable;
}
selectRow(processName) {
selectRow(processName): Promise<void> {
return this.dataTable.selectRow(this.columns.name, processName);
}
selectRowById(processId) {
selectRowById(processId): Promise<void> {
return this.dataTable.selectRow(this.columns.id, processId);
}
checkRowIsSelectedById(processId) {
checkRowIsSelectedById(processId): Promise<void> {
return this.dataTable.checkRowIsSelected(this.columns.id, processId);
}
checkRowIsNotSelectedById(processId) {
checkRowIsNotSelectedById(processId): Promise<void> {
return this.dataTable.checkRowIsNotSelected(this.columns.id, processId);
}
checkRowIsCheckedById(processId) {
checkRowIsCheckedById(processId): Promise<void> {
return this.dataTable.checkRowIsChecked(this.columns.id, processId);
}
checkRowIsNotCheckedById(processId) {
checkRowIsNotCheckedById(processId): Promise<void> {
return this.dataTable.checkRowIsNotChecked(this.columns.id, processId);
}
checkCheckboxById(processId) {
checkCheckboxById(processId): Promise<void> {
return this.dataTable.clickCheckbox(this.columns.id, processId);
}
checkContentIsDisplayedByName(processName) {
checkContentIsDisplayedByName(processName): Promise<void> {
return this.dataTable.checkContentIsDisplayed(this.columns.name, processName);
}
checkContentIsNotDisplayedByName(processName) {
checkContentIsNotDisplayedByName(processName): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(this.columns.name, processName);
}
checkContentIsDisplayedById(processId) {
checkContentIsDisplayedById(processId): Promise<void> {
return this.dataTable.checkContentIsDisplayed(this.columns.id, processId);
}
checkContentIsNotDisplayedById(processId) {
checkContentIsNotDisplayedById(processId): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(this.columns.id, processId);
}
selectRowWithKeyboard(processId) {
selectRowWithKeyboard(processId): Promise<void> {
return this.dataTable.selectRowWithKeyboard(this.columns.id, processId);
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues(this.columns.name);
async getAllRowsNameColumn() {
return await this.dataTable.getAllRowsColumnValues(this.columns.name);
}
checkProcessListIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.processList);
return this;
async checkProcessListIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processList);
}
getNoProcessFoundMessage() {
async getNoProcessFoundMessage(): Promise<string> {
return BrowserActions.getText(this.noProcessFound);
}
getAllRowsByColumn(column) {
getAllRowsByColumn(column): Promise<any> {
return this.dataTable.getAllRowsColumnValues(column);
}

View File

@@ -32,86 +32,73 @@ export class StartProcessCloudPage {
processDefinition = element(by.css('input[id="processDefinitionName"]'));
processDefinitionOptionsPanel = element(by.css('div[class*="processDefinitionOptions"]'));
checkNoProcessMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
async checkNoProcessMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
}
pressDownArrowAndEnter() {
this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN);
return browser.actions().sendKeys(protractor.Key.ENTER).perform();
async pressDownArrowAndEnter(): Promise<void> {
await this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
checkNoProcessDefinitionOptionIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.processDefinitionOptionsPanel);
async checkNoProcessDefinitionOptionIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel);
}
enterProcessName(name) {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.clearProcessName();
this.processNameInput.sendKeys(name);
async enterProcessName(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
await BrowserActions.clearSendKeys(this.processNameInput, name);
}
clearProcessName() {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.processNameInput.clear();
async selectFromProcessDropdown(name): Promise<void> {
await this.clickProcessDropdownArrow();
await this.selectOption(name);
}
selectFromProcessDropdown(name) {
this.clickProcessDropdownArrow();
return this.selectOption(name);
async clickProcessDropdownArrow(): Promise<void> {
await BrowserActions.click(this.selectProcessDropdownArrow);
}
clickProcessDropdownArrow() {
BrowserActions.click(this.selectProcessDropdownArrow);
}
checkOptionIsDisplayed(name) {
async checkOptionIsDisplayed(name): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
return this;
await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
}
selectOption(name) {
async selectOption(name): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserActions.click(selectProcessDropdown);
return this;
await BrowserActions.click(selectProcessDropdown);
}
clickCancelProcessButton() {
BrowserActions.click(this.cancelProcessButton);
async clickCancelProcessButton(): Promise<void> {
await BrowserActions.click(this.cancelProcessButton);
}
checkStartProcessButtonIsEnabled() {
async checkStartProcessButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsPresent(this.startProcessButton);
return this.startProcessButton.isEnabled();
}
clickStartProcessButton() {
return BrowserActions.click(this.startProcessButton);
async clickStartProcessButton(): Promise<void> {
await BrowserActions.click(this.startProcessButton);
}
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> {
const errorElement = element(by.cssContainingText(elementRef, error));
BrowserVisibility.waitUntilElementIsVisible(errorElement);
return this;
await BrowserVisibility.waitUntilElementIsVisible(errorElement);
}
blur(locator) {
locator.click();
locator.sendKeys(Key.TAB);
return this;
async blur(locator): Promise<void> {
await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB);
}
clearField(locator) {
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
locator.sendKeys(protractor.Key.BACK_SPACE);
}
});
async clearField(locator) {
await BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserActions.clearWithBackSpace(locator);
}
formFields() {
formFields(): FormFields {
return new FormFields();
}
}

View File

@@ -18,111 +18,94 @@
import { element, by, Key } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { ElementFinder } from 'protractor';
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('input[formcontrolname="priority"]'));
startButton = element(by.css('button[id="button-start"]'));
name: ElementFinder = element(by.css('input[id="name_id"]'));
dueDate: ElementFinder = element(by.css('input[id="date_id"]'));
description: ElementFinder = element(by.css('textarea[id="description_id"]'));
priority: ElementFinder = element(by.css('input[formcontrolname="priority"]'));
startButton: ElementFinder = 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'));
cancelButton: ElementFinder = element(by.css('button[id="button-cancel"]'));
form: ElementFinder = element.all(by.css('adf-cloud-start-task form')).first();
formDefinitionSelector: ElementFinder = element(by.css('.adf-form-definition-selector'));
checkFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.form);
return this;
async checkFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.form);
}
addName(userName) {
BrowserActions.clearSendKeys(this.name, userName);
return this;
async addName(userName): Promise<void> {
await BrowserActions.clearSendKeys(this.name, userName);
}
addDescription(userDescription) {
BrowserActions.clearSendKeys(this.description, userDescription);
return this;
async addDescription(userDescription): Promise<void> {
await BrowserActions.clearSendKeys(this.description, userDescription);
}
addPriority(userPriority) {
BrowserActions.clearSendKeys(this.priority, userPriority);
return this;
async addPriority(userPriority): Promise<void> {
await BrowserActions.clearSendKeys(this.priority, userPriority);
}
addDueDate(date) {
BrowserVisibility.waitUntilElementIsVisible(this.dueDate);
this.clearField(this.dueDate);
this.dueDate.sendKeys(date);
return this;
async addDueDate(date): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dueDate);
await BrowserActions.clearSendKeys(this.dueDate, date);
}
clickStartButton() {
return BrowserActions.click(this.startButton);
async clickStartButton(): Promise<void> {
await BrowserActions.click(this.startButton);
}
checkStartButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.startButtonEnabled);
return this;
async checkStartButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.startButtonEnabled);
}
checkStartButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled')));
return this;
async checkStartButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled')));
}
clickCancelButton() {
return BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
blur(locator) {
BrowserVisibility.waitUntilElementIsVisible(locator);
BrowserVisibility.waitUntilElementIsClickable(locator);
locator.click();
locator.sendKeys(Key.TAB);
return this;
async blur(locator): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserVisibility.waitUntilElementIsClickable(locator);
await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB);
}
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> {
const errorElement = element(by.cssContainingText(elementRef, error));
BrowserVisibility.waitUntilElementIsVisible(errorElement);
return this;
await BrowserVisibility.waitUntilElementIsVisible(errorElement);
}
validateAssignee(error) {
this.checkValidationErrorIsDisplayed(error, '.adf-start-task-cloud-error');
return this;
async validateAssignee(error): Promise<void> {
await this.checkValidationErrorIsDisplayed(error, '.adf-start-task-cloud-error');
}
validateDate(error) {
this.checkValidationErrorIsDisplayed(error, '.adf-error-text');
return this;
async validateDate(error): Promise<void> {
await this.checkValidationErrorIsDisplayed(error, '.adf-error-text');
}
clearField(locator) {
BrowserActions.clearSendKeys(locator, '');
}
selectFormDefinition(option: string) {
BrowserActions.click(this.formDefinitionSelector);
async selectFormDefinition(option: string): Promise<void> {
await BrowserActions.click(this.formDefinitionSelector);
const row = element(by.cssContainingText('mat-option span', option));
BrowserActions.click(row);
await BrowserActions.click(row);
}
checkFormDefinitionIsDisplayed(option: string) {
BrowserActions.click(this.formDefinitionSelector);
async checkFormDefinitionIsDisplayed(option: string): Promise<void> {
await BrowserActions.click(this.formDefinitionSelector);
const row = element(by.cssContainingText('mat-option span', option));
BrowserVisibility.waitUntilElementIsVisible(row);
BrowserActions.closeMenuAndDialogs();
return this;
await BrowserVisibility.waitUntilElementIsVisible(row);
await BrowserActions.closeMenuAndDialogs();
}
checkFormDefinitionIsNotDisplayed(option: string) {
BrowserActions.click(this.formDefinitionSelector);
async checkFormDefinitionIsNotDisplayed(option: string): Promise<void> {
await BrowserActions.click(this.formDefinitionSelector);
const row = element(by.cssContainingText('mat-option span', option));
BrowserVisibility.waitUntilElementIsNotVisible(row);
BrowserActions.closeMenuAndDialogs();
return this;
await BrowserVisibility.waitUntilElementIsNotVisible(row);
await BrowserActions.closeMenuAndDialogs();
}
}

View File

@@ -15,42 +15,41 @@
* limitations under the License.
*/
import { by } from 'protractor';
import { browser, by, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class TaskFiltersCloudComponentPage {
filter;
taskIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
filter: ElementFinder;
taskIcon: Locator = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
checkTaskFilterIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this;
async checkTaskFilterIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
}
getTaskFilterIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async getTaskFilterIcon(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.taskIcon);
return BrowserActions.getText(icon);
}
checkTaskFilterHasNoIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
BrowserVisibility.waitUntilElementIsNotOnPage(this.filter.element(this.taskIcon));
async checkTaskFilterHasNoIcon(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.taskIcon));
}
clickTaskFilter() {
return BrowserActions.click(this.filter);
async clickTaskFilter(): Promise<void> {
await BrowserActions.click(this.filter);
await browser.driver.sleep(1000);
}
checkTaskFilterNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
return this.filter;
async checkTaskFilterNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
}
}

View File

@@ -19,99 +19,88 @@ import { element, by } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/formFields';
import { ElementFinder } from 'protractor';
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 mat-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`));
cancelButton: ElementFinder = element(by.css('button[id="adf-cloud-cancel-task"]'));
completeButton: ElementFinder = element(by.css('button[id="adf-form-complete"]'));
releaseButton: ElementFinder = element(by.css('button[adf-cloud-unclaim-task]'));
saveButton: ElementFinder = element(by.css('button[id="adf-form-save"]'));
claimButton: ElementFinder = element(by.css('button[adf-cloud-claim-task]'));
form: ElementFinder = element(by.css('adf-cloud-form'));
formTitle: ElementFinder = element(by.css(`span.adf-form-title`));
emptyContentIcon: ElementFinder = element(by.css(`div.adf-empty-content mat-icon.adf-empty-content__icon`));
emptyContentTitle: ElementFinder = element(by.css(`div.adf-empty-content div.adf-empty-content__title`));
emptyContentSubtitle: ElementFinder = element(by.css(`div.adf-empty-content div.adf-empty-content__subtitle`));
checkCompleteButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
return this;
async checkCompleteButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
}
checkCompleteButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.completeButton);
return this;
async checkCompleteButtonIsNotDisplayed() {
await BrowserVisibility.waitUntilElementIsNotVisible(this.completeButton);
}
clickCompleteButton() {
BrowserActions.click(this.completeButton);
return this;
async clickCompleteButton(): Promise<void> {
await BrowserActions.click(this.completeButton);
}
clickCancelButton() {
BrowserActions.click(this.cancelButton);
return this;
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
clickClaimButton() {
BrowserActions.click(this.claimButton);
return this;
async clickClaimButton(): Promise<void> {
await BrowserActions.click(this.claimButton);
}
clickReleaseButton() {
BrowserActions.click(this.releaseButton);
return this;
async clickReleaseButton(): Promise<void> {
await BrowserActions.click(this.releaseButton);
}
formFields() {
formFields(): FormFields {
return new FormFields();
}
checkFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.form);
return this;
async checkFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.form);
}
getFormTitle() {
BrowserVisibility.waitUntilElementIsVisible(this.formTitle);
return this.formTitle.getText();
async getFormTitle(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.formTitle);
return BrowserActions.getText(this.formTitle);
}
checkFormIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.form);
return this;
async checkFormIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.form);
}
getReleaseButtonText() {
async getReleaseButtonText(): Promise<string> {
return BrowserActions.getText(this.releaseButton);
}
checkSaveButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this;
async checkSaveButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
}
clickSaveButton() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
this.saveButton.click();
return this;
async clickSaveButton(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
checkFormContentIsEmpty() {
BrowserVisibility.waitUntilElementIsVisible(this.emptyContentIcon);
return this;
async checkFormContentIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyContentIcon);
}
getEmptyFormContentTitle() {
async getEmptyFormContentTitle(): Promise<string> {
return BrowserActions.getText(this.emptyContentTitle);
}
getEmptyFormContentSubtitle() {
async getEmptyFormContentSubtitle(): Promise<string> {
return BrowserActions.getText(this.emptyContentSubtitle);
}
getCompleteButton() {
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
async getCompleteButton(): Promise<ElementFinder> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
return this.completeButton;
}

View File

@@ -18,68 +18,69 @@
import { element, by } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { ElementFinder } from 'protractor';
export class TaskHeaderCloudPage {
assigneeField = element(by.css('span[data-automation-id*="assignee"] span'));
statusField = element(by.css('span[data-automation-id*="status"] span'));
priorityField = element(by.css('span[data-automation-id*="priority"] span'));
dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
categoryField = element(by.css('span[data-automation-id*="category"] span'));
createdField = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
parentNameField = element(by.css('span[data-automation-id*="parentName"] span'));
parentTaskIdField = element(by.css('span[data-automation-id*="parentTaskId"] span'));
endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
idField = element.all(by.css('span[data-automation-id*="id"] span')).first();
descriptionField = element(by.css('span[data-automation-id*="description"] span'));
taskPropertyList = element(by.css('adf-cloud-task-header adf-card-view div[class="adf-property-list"]'));
assigneeField: ElementFinder = element(by.css('span[data-automation-id*="assignee"] span'));
statusField: ElementFinder = element(by.css('span[data-automation-id*="status"] span'));
priorityField: ElementFinder = element(by.css('span[data-automation-id*="priority"] span'));
dueDateField: ElementFinder = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
categoryField: ElementFinder = element(by.css('span[data-automation-id*="category"] span'));
createdField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
parentNameField: ElementFinder = element(by.css('span[data-automation-id*="parentName"] span'));
parentTaskIdField: ElementFinder = element(by.css('span[data-automation-id*="parentTaskId"] span'));
endDateField: ElementFinder = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
idField: ElementFinder = element.all(by.css('span[data-automation-id*="id"] span')).first();
descriptionField: ElementFinder = element(by.css('span[data-automation-id*="description"] span'));
taskPropertyList: ElementFinder = element(by.css('adf-cloud-task-header adf-card-view div[class="adf-property-list"]'));
getAssignee() {
async getAssignee(): Promise<string> {
return BrowserActions.getText(this.assigneeField);
}
getStatus() {
async getStatus(): Promise<string> {
return BrowserActions.getText(this.statusField);
}
getPriority() {
async getPriority(): Promise<string> {
return BrowserActions.getText(this.priorityField);
}
getCategory() {
async getCategory(): Promise<string> {
return BrowserActions.getText(this.categoryField);
}
getParentName() {
async getParentName(): Promise<string> {
return BrowserActions.getText(this.parentNameField);
}
getParentTaskId() {
async getParentTaskId(): Promise<string> {
return BrowserActions.getText(this.parentTaskIdField);
}
getEndDate() {
async getEndDate(): Promise<string> {
return BrowserActions.getText(this.endDateField);
}
getCreated() {
async getCreated(): Promise<string> {
return BrowserActions.getText(this.createdField);
}
getId() {
async getId(): Promise<string> {
return BrowserActions.getText(this.idField);
}
getDescription() {
async getDescription(): Promise<string> {
return BrowserActions.getText(this.descriptionField);
}
getDueDate() {
async getDueDate(): Promise<string> {
return BrowserActions.getText(this.dueDateField);
}
checkTaskPropertyListIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.taskPropertyList);
async checkTaskPropertyListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskPropertyList);
}
}

View File

@@ -17,7 +17,7 @@
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
const column = {
@@ -39,120 +39,119 @@ export class TaskListCloudComponentPage {
dataTable = new DataTableComponentPage(this.taskList);
getDataTable() {
getDataTable(): DataTableComponentPage {
return this.dataTable;
}
clickCheckbox(taskName) {
clickCheckbox(taskName): Promise<void> {
return this.dataTable.clickCheckbox(column.name, taskName);
}
checkRowIsNotChecked(taskName) {
checkRowIsNotChecked(taskName): Promise<void> {
return this.dataTable.checkRowIsNotChecked(column.name, taskName);
}
checkRowIsChecked(taskName) {
checkRowIsChecked(taskName): Promise<void> {
return this.dataTable.checkRowIsChecked(column.name, taskName);
}
getRowsWithSameName(taskName) {
getRowsWithSameName(taskName): Promise<string> {
return this.dataTable.getRowsWithSameColumnValues(column.name, taskName);
}
getRowsWithSameId(taskId) {
getRowsWithSameId(taskId): Promise<string> {
return this.dataTable.getRowsWithSameColumnValues('Id', taskId);
}
checkRowIsSelected(taskName) {
checkRowIsSelected(taskName): Promise<void> {
return this.dataTable.checkRowIsSelected(column.name, taskName);
}
checkRowIsNotSelected(taskName) {
checkRowIsNotSelected(taskName): Promise<void> {
return this.dataTable.checkRowIsNotSelected(column.name, taskName);
}
selectRowWithKeyboard(taskName) {
selectRowWithKeyboard(taskName): Promise<void> {
return this.dataTable.selectRowWithKeyboard(column.name, taskName);
}
selectRow(taskName) {
selectRow(taskName): Promise<void> {
return this.dataTable.selectRow(column.name, taskName);
}
selectRowByTaskId(taskId: string) {
selectRowByTaskId(taskId: string): Promise<void> {
return this.dataTable.selectRow(column.id, taskId);
}
getRow(taskName) {
getRow(taskName): ElementFinder {
return this.dataTable.getCellElementByValue(column.name, taskName);
}
checkContentIsDisplayedById(taskId) {
checkContentIsDisplayedById(taskId): Promise<void> {
return this.dataTable.checkContentIsDisplayed(column.id, taskId);
}
checkContentIsNotDisplayedById(taskId) {
async checkContentIsNotDisplayedById(taskId): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(column.id, taskId);
}
checkContentIsDisplayedByProcessInstanceId(taskName) {
async checkContentIsDisplayedByProcessInstanceId(taskName): Promise<void> {
return this.dataTable.checkContentIsDisplayed(column.processInstanceId, taskName);
}
checkContentIsDisplayedByName(taskName) {
async checkContentIsDisplayedByName(taskName): Promise<void> {
return this.dataTable.checkContentIsDisplayed(column.name, taskName);
}
checkContentIsNotDisplayedByName(taskName) {
async checkContentIsNotDisplayedByName(taskName): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed(column.name, taskName);
}
checkTaskListIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.taskList);
return this;
async checkTaskListIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskList);
}
getNoTasksFoundMessage() {
async getNoTasksFoundMessage(): Promise<string> {
return BrowserActions.getText(this.noTasksFound);
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues(column.name);
async getAllRowsNameColumn() {
return await this.dataTable.getAllRowsColumnValues(column.name);
}
getAllRowsByIdColumn() {
return this.dataTable.getAllRowsColumnValues(column.id);
async getAllRowsByIdColumn() {
return await this.dataTable.getAllRowsColumnValues(column.id);
}
getAllRowsByProcessDefIdColumn() {
return this.dataTable.getAllRowsColumnValues(column.processDefinitionId);
async getAllRowsByProcessDefIdColumn() {
return await this.dataTable.getAllRowsColumnValues(column.processDefinitionId);
}
getAllRowsByProcessInstanceIdColumn() {
return this.dataTable.getAllRowsColumnValues(column.processInstanceId);
async getAllRowsByProcessInstanceIdColumn() {
return await this.dataTable.getAllRowsColumnValues(column.processInstanceId);
}
getAllRowsByAssigneeColumn() {
return this.dataTable.getAllRowsColumnValues(column.assignee);
async getAllRowsByAssigneeColumn() {
return await this.dataTable.getAllRowsColumnValues(column.assignee);
}
getAllRowsByParentTaskIdColumn() {
return this.dataTable.getAllRowsColumnValues(column.parentTaskId);
async getAllRowsByParentTaskIdColumn() {
return await this.dataTable.getAllRowsColumnValues(column.parentTaskId);
}
getAllRowsByPriorityColumn() {
return this.dataTable.getAllRowsColumnValues(column.priority);
async getAllRowsByPriorityColumn() {
return await this.dataTable.getAllRowsColumnValues(column.priority);
}
getAllRowsByStandAloneColumn() {
return this.dataTable.getAllRowsColumnValues(column.standAlone);
async getAllRowsByStandAloneColumn() {
return await this.dataTable.getAllRowsColumnValues(column.standAlone);
}
getAllRowsByOwnerColumn() {
return this.dataTable.getAllRowsColumnValues(column.owner);
async getAllRowsByOwnerColumn() {
return await this.dataTable.getAllRowsColumnValues(column.owner);
}
getIdCellValue(rowName) {
async getIdCellValue(rowName): Promise<string> {
const locator = new DataTableComponentPage().getCellByRowContentAndColumn(column.name, rowName, column.id);
return BrowserActions.getText(locator);
}

View File

@@ -16,144 +16,138 @@
*/
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { by, element } from 'protractor';
import { by, element, ElementFinder, Locator } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class FormFieldsPage {
formContent = element(by.css('adf-form'));
refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon'));
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
valueLocator = by.css('input');
labelLocator = by.css('label');
noFormMessage = element(by.css('span[id*="no-form-message"]'));
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
selectFormDropDownArrow = element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first();
selectFormContent = element(by.css('div[class*="mat-select-panel"]'));
completeButton = element(by.id('adf-form-complete'));
errorMessage = by.css('.adf-error-text-container .adf-error-text');
formContent: ElementFinder = element(by.css('adf-form'));
refreshButton: ElementFinder = element(by.css('div[class*="form-reload-button"] mat-icon'));
saveButton: ElementFinder = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
valueLocator: Locator = by.css('input');
labelLocator: Locator = by.css('label');
noFormMessage: ElementFinder = element(by.css('span[id*="no-form-message"]'));
completedTaskNoFormMessage: ElementFinder = element(by.css('div[id*="completed-form-message"] p'));
attachFormButton: ElementFinder = element(by.id('adf-no-form-attach-form-button'));
selectFormDropDownArrow: ElementFinder = element.all(by.css('adf-attach-form div[class*="mat-select-arrow"]')).first();
selectFormContent: ElementFinder = element(by.css('div[class*="mat-select-panel"]'));
completeButton: ElementFinder = element(by.id('adf-form-complete'));
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
setFieldValue(locator, field, value) {
async setFieldValue(locator, field, value): Promise<void> {
const fieldElement: any = element(locator(field));
BrowserVisibility.waitUntilElementIsVisible(fieldElement);
fieldElement.clear().sendKeys(value);
return this;
await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
await BrowserActions.clearSendKeys(fieldElement, value);
}
checkWidgetIsVisible(fieldId) {
async checkWidgetIsVisible(fieldId): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
BrowserVisibility.waitUntilElementIsVisible(fieldElement);
await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
}
checkWidgetIsHidden(fieldId) {
async checkWidgetIsHidden(fieldId): Promise<void> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
await BrowserVisibility.waitUntilElementIsVisible(hiddenElement);
}
getWidget(fieldId) {
async getWidget(fieldId): Promise<ElementFinder> {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
BrowserVisibility.waitUntilElementIsVisible(widget);
await BrowserVisibility.waitUntilElementIsVisible(widget);
return widget;
}
getFieldValue(fieldId, valueLocatorParam) {
const value = this.getWidget(fieldId).element(valueLocatorParam || this.valueLocator);
BrowserVisibility.waitUntilElementIsVisible(value);
return value.getAttribute('value');
async getFieldValue(fieldId, valueLocatorParam): Promise<string> {
const widget: ElementFinder = await this.getWidget(fieldId);
const value = widget.element(valueLocatorParam || this.valueLocator);
await BrowserVisibility.waitUntilElementIsVisible(value);
return await value.getAttribute('value');
}
getFieldLabel(fieldId, labelLocatorParam) {
const label = this.getWidget(fieldId).all(labelLocatorParam || this.labelLocator).first();
return BrowserActions.getText(label);
async getFieldLabel(fieldId, labelLocatorParam): Promise<string> {
const widget = await this.getWidget(fieldId);
const label = widget.all(labelLocatorParam || this.labelLocator).first();
return await BrowserActions.getText(label);
}
getFieldErrorMessage(fieldId) {
const error = this.getWidget(fieldId).element(this.errorMessage);
async getFieldErrorMessage(fieldId): Promise<string> {
const widget = await this.getWidget(fieldId);
const error = widget.element(this.errorMessage);
return BrowserActions.getText(error);
}
getFieldText(fieldId, labelLocatorParam) {
const label = this.getWidget(fieldId).element(labelLocatorParam || this.labelLocator);
async getFieldText(fieldId, labelLocatorParam): Promise<string> {
const widget = await this.getWidget(fieldId);
const label = widget.element(labelLocatorParam || this.labelLocator);
return BrowserActions.getText(label);
}
getFieldPlaceHolder(fieldId, locator = 'input') {
async getFieldPlaceHolder(fieldId, locator = 'input'): Promise<string> {
const placeHolderLocator = element(by.css(`${locator}#${fieldId}`));
BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
return placeHolderLocator.getAttribute('placeholder');
}
checkFieldValue(locator, field, val) {
BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
return this;
async checkFieldValue(locator, field, val): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
}
refreshForm() {
BrowserActions.click(this.refreshButton);
return this;
async refreshForm(): Promise<void> {
await BrowserActions.click(this.refreshButton);
}
saveForm() {
BrowserActions.click(this.saveButton);
return this;
async saveForm(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
noFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.formContent);
return this;
async noFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.formContent);
}
checkFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.formContent);
return this;
async checkFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.formContent);
}
getNoFormMessage() {
async getNoFormMessage(): Promise<string> {
return BrowserActions.getText(this.noFormMessage);
}
getCompletedTaskNoFormMessage() {
async getCompletedTaskNoFormMessage(): Promise<string> {
return BrowserActions.getText(this.completedTaskNoFormMessage);
}
clickOnAttachFormButton() {
BrowserActions.click(this.attachFormButton);
return this;
async clickOnAttachFormButton(): Promise<void> {
await BrowserActions.click(this.attachFormButton);
}
selectForm(formName) {
BrowserActions.click(this.selectFormDropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
this.selectFormFromDropDown(formName);
return this;
async selectForm(formName): Promise<void> {
await BrowserActions.click(this.selectFormDropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.selectFormContent);
await this.selectFormFromDropDown(formName);
}
selectFormFromDropDown(formName) {
async selectFormFromDropDown(formName): Promise<void> {
const formNameElement = element(by.cssContainingText('span', formName));
BrowserActions.click(formNameElement);
await BrowserActions.click(formNameElement);
}
checkWidgetIsReadOnlyMode(fieldId) {
async checkWidgetIsReadOnlyMode(fieldId): Promise<void> {
const widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
const widgetReadOnly = widget.element(by.css('div[class*="adf-readonly"]'));
BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
return widgetReadOnly;
await BrowserVisibility.waitUntilElementIsVisible(widgetReadOnly);
}
completeForm() {
return BrowserActions.click(this.completeButton);
async completeForm(): Promise<void> {
await BrowserActions.click(this.completeButton);
}
setValueInInputById(fieldId, value) {
async setValueInInputById(fieldId, value): Promise<void> {
const input: any = element(by.id(fieldId));
BrowserVisibility.waitUntilElementIsVisible(input);
input.clear().sendKeys(value);
return this;
await BrowserVisibility.waitUntilElementIsVisible(input);
await BrowserActions.clearSendKeys(input, value);
}
isCompleteFormButtonDisabled() {
BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
async isCompleteFormButtonDisabled(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
return this.completeButton.getAttribute('disabled');
}
}

View File

@@ -16,28 +16,28 @@
*/
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class StartProcessDialog {
startProcessDialog = element(by.id('adf-start-process-dialog'));
title = this.startProcessDialog.element(by.css('h4.mat-dialog-title'));
closeButton = this.startProcessDialog.element(by.cssContainingText(`div.adf-start-process-dialog-actions button span`, 'Close'));
startProcessDialog: ElementFinder = element(by.id('adf-start-process-dialog'));
title: ElementFinder = this.startProcessDialog.element(by.css('h4.mat-dialog-title'));
closeButton: ElementFinder = this.startProcessDialog.element(by.cssContainingText(`div.adf-start-process-dialog-actions button span`, 'Close'));
checkStartProcessDialogIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.startProcessDialog);
async checkStartProcessDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.startProcessDialog);
}
getTitle() {
async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
}
clickCloseButton() {
return BrowserActions.click(this.closeButton);
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
checkStartProcessDialogIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.startProcessDialog);
async checkStartProcessDialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.startProcessDialog);
}
}

View File

@@ -1,29 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestBed } from '@angular/core/testing';
import { TestingService } from './testing.service';
describe('TestingService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: TestingService = TestBed.get(TestingService);
expect(service).toBeTruthy();
});
});

View File

@@ -1,27 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class TestingService {
constructor() { }
}

View File

@@ -22,6 +22,5 @@ export * from './lib/material/public-api';
export * from './lib/process-services/public-api';
export * from './lib/process-services-cloud/public-api';
export * from './lib/testing.module';
export * from './lib/testing.service';
export * from './lib/test.configuration';

View File

@@ -1,5 +1,5 @@
{
"extends": "../../tslint.json",
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,