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

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

* Fix one which I missed

* Remove console.logs

* Remove console.logs

* Reverse the timeouts

* Fixed things TSLint

* Remove unused import

* Fixed broken tests

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, by, element, $$ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
@@ -29,13 +29,17 @@ const column = {
export class AddPermissionsDialogPage {
dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage();
userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage(element(by.css('[data-automation-id="adf-user-role-selection-table"]')));
userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage($('[data-automation-id="adf-user-role-selection-table"]'));
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
searchUserInput = element(by.id('searchInput'));
searchResults = element(by.css('#adf-add-permission-authority-results #adf-search-results-content'));
addButton = element(by.css('[data-automation-id="add-permission-dialog-confirm-button"]'));
closeButton = element(by.id('add-permission-dialog-close-button'));
addPermissionDialog = $('adf-add-permission-dialog');
searchUserInput = $('#searchInput');
searchResults = $('#adf-add-permission-authority-results #adf-search-results-content');
addButton = $('[data-automation-id="add-permission-dialog-confirm-button"]');
closeButton = $('#add-permission-dialog-close-button');
getRoleDropdownOptions() {
return $$('.mat-option-text');
}
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
@@ -69,7 +73,7 @@ export class AddPermissionsDialogPage {
}
async checkPermissionsDatatableIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('[class*="adf-datatable-permission"]')));
await BrowserVisibility.waitUntilElementIsVisible($('[class*="adf-datatable-permission"]'));
}
async getRoleCellValue(rowName: string): Promise<string> {
@@ -79,11 +83,7 @@ export class AddPermissionsDialogPage {
async clickRoleDropdownByUserOrGroupName(name: string): Promise<void> {
const row = this.dataTableComponentPage.getRow('Users and Groups', name);
await BrowserActions.click(row.element(by.id('adf-select-role-permission')));
}
getRoleDropdownOptions() {
return element.all(by.css('.mat-option-text'));
await BrowserActions.click(row.$('adf-select-role-permission'));
}
async selectOption(name: string): Promise<void> {
@@ -105,7 +105,7 @@ export class AddPermissionsDialogPage {
async selectRole(name: string, role: string) {
const row = this.userRoleDataTableComponentPage.getRow('Users and Groups', name);
await BrowserActions.click(row.element(by.css('[id="adf-select-role-permission"] .mat-select-trigger')));
await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger'));
await TestElement.byCss('.mat-select-panel').waitVisible();
await this.selectOption(role);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, $$, by } from 'protractor';
import { DocumentListPage } from '../pages/document-list.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -27,22 +27,22 @@ import { UploadButtonPage } from '../pages/upload-button.page';
import { FileModel } from '../../core/models/file.model';
export class ContentNodeSelectorDialogPage {
dialog = element(by.css(`adf-content-node-selector`));
header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`));
searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`));
searchLabel = this.dialog.element(by.css('.adf-content-node-selector-content-input .mat-form-field-label'));
selectedRow = this.dialog.element(by.css(`adf-datatable-row[class*="adf-is-selected"]`));
cancelButton = element(by.css(`button[data-automation-id='content-node-selector-actions-cancel']`));
moveCopyButton = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`));
dialog = $(`adf-content-node-selector`);
header = this.dialog.$(`header[data-automation-id='content-node-selector-title']`);
searchInputElement = this.dialog.$(`input[data-automation-id='content-node-selector-search-input']`);
searchLabel = this.dialog.$('.adf-content-node-selector-content-input .mat-form-field-label');
selectedRow = this.dialog.$(`adf-datatable-row[class*="adf-is-selected"]`);
cancelButton = $(`button[data-automation-id='content-node-selector-actions-cancel']`);
moveCopyButton = $(`button[data-automation-id='content-node-selector-actions-choose']`);
contentList = new DocumentListPage(this.dialog);
dataTable = this.contentList.dataTablePage();
siteListDropdown = new DropdownPage(this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`)));
siteListDropdown = new DropdownPage(this.dialog.$(`mat-select[data-automation-id='site-my-files-option']`));
breadcrumbDropdown = new BreadcrumbDropdownPage();
tabPage: TabPage = new TabPage();
uploadButtonComponent = new UploadButtonPage();
uploadFromLocalTab = element.all(by.css('*[role="tab"]')).get(1);
uploadFromLocalTab = $$('*[role="tab"]').get(1);
uploadFromLocalTabName = 'Upload from your device';
repositoryTabName = 'Repository';

View File

@@ -15,11 +15,11 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class DownloadDialogPage {
cancelButton = element(by.id(`cancel-button`));
cancelButton = $(`#cancel-button`);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $, $$ } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { DropdownPage } from '../../../core/pages/material/dropdown.page';
export class BreadcrumbDropdownPage {
breadCrumb = element(by.css(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`));
parentFolder = this.breadCrumb.element(by.css(`button[data-automation-id='dropdown-breadcrumb-trigger']`));
currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`));
breadCrumb = $(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`);
parentFolder = this.breadCrumb.$(`button[data-automation-id='dropdown-breadcrumb-trigger']`);
currentFolder = this.breadCrumb.$(`div span[data-automation-id="current-folder"]`);
breadCrumbDropdown = new DropdownPage(element.all(by.css(`div[class*='mat-select-panel']`)).first());
breadCrumbDropdown = new DropdownPage($$(`div[class*='mat-select-panel']`).first());
async choosePath(pathName: string): Promise<void> {
await this.breadCrumbDropdown.selectOption(pathName);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, by, element, ElementFinder, browser } from 'protractor';
import { by, ElementFinder, browser, $$ } from 'protractor';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -24,14 +24,14 @@ import { Logger } from '../../core/utils/logger';
export class DocumentListPage {
rootElement: ElementFinder;
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
optionButton = 'button[data-automation-id*="action_menu_"]';
tableBody: ElementFinder;
dataTable: DataTableComponentPage;
constructor(rootElement = element.all(by.css('adf-document-list')).first()) {
constructor(rootElement = $$('adf-document-list').first()) {
this.rootElement = rootElement;
this.dataTable = new DataTableComponentPage(this.rootElement);
this.tableBody = rootElement.all(by.css('.adf-datatable-body')).first();
this.tableBody = rootElement.$$('.adf-datatable-body').first();
}
async checkLockedIcon(content: string): Promise<void> {
@@ -70,7 +70,7 @@ export class DocumentListPage {
Logger.log(`Click action menu ${content}`);
await BrowserActions.closeMenuAndDialogs();
const row = this.dataTable.getRow('Display name', content);
await BrowserActions.click(row.element(this.optionButton));
await BrowserActions.click(row.$(this.optionButton));
await BrowserActions.waitUntilActionMenuIsVisible();
await browser.sleep(500);
}
@@ -96,7 +96,7 @@ export class DocumentListPage {
}
async getLibraryRole(name: string): Promise<string> {
return this.dataTable.getRow('Display name', name).element(by.css('adf-library-role-column')).getText();
return this.dataTable.getRow('Display name', name).$('adf-library-role-column').getText();
}
}

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
export class LikePage {
likeCounter = element(by.css(`div[id="adf-like-counter"]`));
likeButton = element(by.css(`.adf-like-grey`));
unlikeButton = element(by.css(`.adf-like-select`));
likeCounter = $(`div[id="adf-like-counter"]`);
likeButton = $(`.adf-like-grey`);
unlikeButton = $(`.adf-like-select`);
async checkLikeCounter(counter: number): Promise<void> {
await BrowserVisibility.waitUntilElementHasText(this.likeCounter, counter);

View File

@@ -15,49 +15,52 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class RatePage {
private ratingsCounter = $(`div[id="adf-rating-counter"]`);
private coloredStar = async (rateValue: number) => $(`span[id="adf-rate-${rateValue}"] mat-icon`);
private greyStar = async (rateValue: number) => $(`mat-icon[id="adf-grey-star-${rateValue}"]`);
async rateComponent(rateValue: number) {
const unratedStar = element(by.css(`span[id="adf-rate-${rateValue}"]`));
const unratedStar = await this.coloredStar(rateValue);
await BrowserActions.click(unratedStar);
}
async removeRating(rateValue: number): Promise<void> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const ratedStar = await this.coloredStar(rateValue);
await BrowserActions.click(ratedStar);
}
async checkRatingCounter(rating: number): Promise<void> {
const ratingsCounter = element(by.css(`div[id="adf-rating-counter"]`));
await BrowserVisibility.waitUntilElementHasText(ratingsCounter, rating);
await BrowserVisibility.waitUntilElementHasText(this.ratingsCounter, rating);
}
async isStarRated(rateValue: number): Promise<void> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const ratedStar = await this.coloredStar(rateValue);
await BrowserVisibility.waitUntilElementIsVisible(ratedStar);
}
async isNotStarRated(rateValue: number): Promise<void> {
const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`));
const unratedStar = await this.greyStar(rateValue);
await BrowserVisibility.waitUntilElementIsVisible(unratedStar);
}
async getRatedStarColor(rateValue: number): Promise<string> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const ratedStar = await this.coloredStar(rateValue);
return BrowserActions.getColor(ratedStar);
}
async getUnratedStarColor(rateValue: number): Promise<string> {
const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`));
const unratedStar = await this.greyStar(rateValue);
return BrowserActions.getColor(unratedStar);
}
async getAverageStarColor(rateValue: number): Promise<string> {
const coloredStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const coloredStar = await this.coloredStar(rateValue);
return BrowserActions.getColor(coloredStar);
}

View File

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

View File

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, ElementFinder } from 'protractor';
import { ElementFinder } from 'protractor';
import { SearchTextPage } from './search-text.page';
import { SearchCheckListPage } from './search-check-list.page';
import { SearchRadioPage } from './search-radio.page';
@@ -56,11 +56,11 @@ export class SearchCategoriesPage {
}
async clickFilter(filter: ElementFinder): Promise<void> {
await BrowserActions.click(filter.element(by.css('mat-expansion-panel-header')));
await BrowserActions.click(filter.$('mat-expansion-panel-header'));
}
async clickFilterHeader(filter: ElementFinder): Promise<void> {
const fileSizeFilterHeader = filter.element(by.css('mat-expansion-panel-header'));
const fileSizeFilterHeader = filter.$('mat-expansion-panel-header');
await BrowserActions.click(fileSizeFilterHeader);
}

View File

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

View File

@@ -15,27 +15,27 @@
* limitations under the License.
*/
import { element, by, browser, ElementFinder } from 'protractor';
import { browser, ElementFinder, $, $$ } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchRadioPage {
filter: ElementFinder;
showMoreButton = element(by.css('adf-search-radio button[title="Show more"]'));
showLessButton = element(by.css('adf-search-radio button[title="Show less"]'));
showMoreButton = $('adf-search-radio button[title="Show more"]');
showLessButton = $('adf-search-radio button[title="Show less"]');
constructor(filter: ElementFinder) {
this.filter = filter;
}
async checkFilterRadioButtonIsDisplayed(filterName: string): Promise<void> {
const filterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"]'));
const filterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(filterType);
}
async checkFilterRadioButtonIsChecked(filterName: string): Promise<void> {
const selectedFilterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"][class*="checked"]'));
const selectedFilterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"][class*="checked"]`);
await BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
}
@@ -44,7 +44,7 @@ export class SearchRadioPage {
}
async getRadioButtonsNumberOnPage(): Promise<number> {
const radioButtons = element.all(by.css('mat-radio-button'));
const radioButtons = $$('mat-radio-button');
return radioButtons.count();
}

View File

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

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser, by, element } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { DropdownPage } from '../../../core/pages/material/dropdown.page';
export class SearchSortingPickerPage {
sortingDropdown = new DropdownPage(element(by.css('.adf-sorting-picker .mat-select-arrow')));
orderArrow = element(by.css('adf-sorting-picker button mat-icon'));
sortingDropdown = new DropdownPage($('.adf-sorting-picker .mat-select-arrow'));
orderArrow = $('adf-sorting-picker button mat-icon');
async sortBy(sortOrder: string, sortType: string | RegExp): Promise<void> {
await this.sortingDropdown.clickDropdown();

View File

@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { protractor, by, ElementFinder, Locator } from 'protractor';
import { protractor, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchTextPage {
filter: ElementFinder;
inputBy: Locator = by.css('input');
inputBy = 'input';
constructor(filter: ElementFinder) {
this.filter = filter;
@@ -30,7 +30,7 @@ export class SearchTextPage {
async searchByName(name: string): Promise<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);
await BrowserActions.clearSendKeys(this.filter.$(this.inputBy), name);
await this.filter.$(this.inputBy).sendKeys(protractor.Key.ENTER);
}
}

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { FileModel } from '../../core/models/file.model';
export class UploadButtonPage {
uploadButton = element(by.css('adf-upload-button input'));
uploadButton = $('adf-upload-button input');
async attachFiles(files: FileModel[]): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadButton);
@@ -31,11 +31,13 @@ export class UploadButtonPage {
}
async isButtonNotDisplayed(): Promise<boolean> {
let result = false;
try {
await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadButton);
return true;
} catch (e) {
return false;
}
result = true;
} catch (e) { /* do nothing */ }
return result;
}
}

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, by, element } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
export class EditJsonDialog {
dialog = element(by.css(`.adf-edit-json-dialog`));
dialog = $(`.adf-edit-json-dialog`);
closeButton = element(by.cssContainingText(`button span`, 'Close'));
dialogContent = this.dialog.element(by.css(`mat-dialog-content textarea`));
dialogContent = this.dialog.$(`mat-dialog-content textarea`);
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { DataTableComponentPage } from './data-table-component.page';
@@ -47,21 +47,21 @@ export class AboutPage {
version: 'version'
};
appTitle = element(by.css('[data-automation-id="adf-github-app-title"]'));
sourceCodeTitle = element(by.css('[data-automation-id="adf-github-source-code-title"]'));
githubUrl = element(by.css('[data-automation-id="adf-github-url"]'));
githubVersion = element(by.css('[data-automation-id="adf-github-version"]'));
bpmHost = element(by.css('[data-automation-id="adf-process-service-host"]'));
ecmHost = element(by.css('[data-automation-id="adf-content-service-host"]'));
productVersionTitle = element(by.css('[data-automation-id="adf-about-product-version-title"]'));
bpmEdition = element(by.css('[data-automation-id="adf-about-bpm-edition"]'));
ecmEdition = element(by.css('[data-automation-id="adf-about-ecm-edition"]'));
bpmVersion = element(by.css('[data-automation-id="adf-about-bpm-version"]'));
ecmVersion = element(by.css('[data-automation-id="adf-about-ecm-version"]'));
ecmStatusTitle = element(by.css('[data-automation-id="adf-about-ecm-status-title"]'));
ecmLicenseTitle = element(by.css('[data-automation-id="adf-about-ecm-license-title"]'));
ecmModulesTitle = element(by.css('[data-automation-id="adf-about-ecm-modules-title"]'));
aboutModulesTitle = element(by.css('[data-automation-id="adf-about-modules-title"]'));
appTitle = $('[data-automation-id="adf-github-app-title"]');
sourceCodeTitle = $('[data-automation-id="adf-github-source-code-title"]');
githubUrl = $('[data-automation-id="adf-github-url"]');
githubVersion = $('[data-automation-id="adf-github-version"]');
bpmHost = $('[data-automation-id="adf-process-service-host"]');
ecmHost = $('[data-automation-id="adf-content-service-host"]');
productVersionTitle = $('[data-automation-id="adf-about-product-version-title"]');
bpmEdition = $('[data-automation-id="adf-about-bpm-edition"]');
ecmEdition = $('[data-automation-id="adf-about-ecm-edition"]');
bpmVersion = $('[data-automation-id="adf-about-bpm-version"]');
ecmVersion = $('[data-automation-id="adf-about-ecm-version"]');
ecmStatusTitle = $('[data-automation-id="adf-about-ecm-status-title"]');
ecmLicenseTitle = $('[data-automation-id="adf-about-ecm-license-title"]');
ecmModulesTitle = $('[data-automation-id="adf-about-ecm-modules-title"]');
aboutModulesTitle = $('[data-automation-id="adf-about-modules-title"]');
dataTable = new DataTableComponentPage();
@@ -158,7 +158,7 @@ export class AboutPage {
}
async checkColumnIsDisplayed(column: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_${column}"]`)));
await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_${column}"]`));
}
}

View File

@@ -15,16 +15,16 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
export class BreadcrumbPage {
breadcrumb = element(by.css(`adf-breadcrumb nav[data-automation-id='breadcrumb']`));
currentItem = element(by.css('.adf-breadcrumb-item-current'));
breadcrumb = $(`adf-breadcrumb nav[data-automation-id='breadcrumb']`);
currentItem = $('.adf-breadcrumb-item-current');
async chooseBreadCrumb(breadCrumbItem: string): Promise<void> {
const path = this.breadcrumb.element(by.css(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`));
const path = this.breadcrumb.$(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`);
await BrowserActions.click(path);
}

View File

@@ -15,25 +15,25 @@
* limitations under the License.
*/
import { element, by, ElementFinder, Locator } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
export class CardBooleanItemPage {
rootElement: ElementFinder;
labelLocator: Locator = by.css('div[data-automation-id*="card-boolean-label"]');
checkbox: Locator = by.css('mat-checkbox[data-automation-id*="card-boolean"]');
labelLocator = 'div[data-automation-id*="card-boolean-label"]';
checkbox = 'mat-checkbox[data-automation-id*="card-boolean"]';
constructor(label: string = 'required') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-boolitem`));
}
async checkboxClick(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.checkbox));
await BrowserActions.click(this.rootElement.$(this.checkbox));
}
async checkLabelIsPresent(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder } from 'protractor';
import { element, by, ElementFinder, $$ } from 'protractor';
import { DateTimePickerPage } from '../material/date-time-picker.page';
import { DatePickerPage } from '../material/date-picker.page';
import { BrowserVisibility } from '../../utils/browser-visibility';
@@ -26,10 +26,10 @@ export class CardDateItemPage {
dateTimePickerPage: DateTimePickerPage;
datePickerPage = new DatePickerPage();
labelLocator: Locator = by.css('div[data-automation-id*="card-dateitem-label"]');
valueLocator: Locator = by.css('span[data-automation-id*="card-date"]');
dateTimePicker = element.all(by.css('.mat-datetimepicker-toggle')).first();
saveButton: Locator = by.css('button[data-automation-id*="card-dateitem-update"]');
labelLocator = 'div[data-automation-id*="card-dateitem-label"]';
valueLocator = 'span[data-automation-id*="card-date"]';
dateTimePicker = $$('.mat-datetimepicker-toggle').first();
saveButton = 'button[data-automation-id*="card-dateitem-update"]';
constructor(label: string = 'minDate') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-dateitem`));
@@ -45,11 +45,11 @@ export class CardDateItemPage {
}
async getDateValue(): Promise<string> {
return this.rootElement.element(this.valueLocator).getText();
return this.rootElement.$(this.valueLocator).getText();
}
async checkLabelIsVisible(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsVisible(labelElement);
}
}

View File

@@ -15,24 +15,24 @@
* limitations under the License.
*/
import { element, by, ElementFinder, Locator } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
import { DropdownPage } from '../material/dropdown.page';
export class CardSelectItemPage {
rootElement: ElementFinder;
labelLocator: Locator = by.css('div[data-automation-id*="card-select-label"]');
readOnlyField: Locator = by.css('[data-automation-class="read-only-value"]');
labelLocator = 'div[data-automation-id*="card-select-label"]';
readOnlyField = '[data-automation-class="read-only-value"]';
dropdown: DropdownPage;
constructor(label: string = 'fileSource') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-selectitem`));
this.dropdown = new DropdownPage(this.rootElement.element(by.css('mat-select')));
this.dropdown = new DropdownPage(this.rootElement.$('mat-select'));
}
async checkLabelIsPresent(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
}
@@ -41,8 +41,8 @@ export class CardSelectItemPage {
}
async getReadonlyValue(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
return BrowserActions.getText(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField));
return BrowserActions.getText(this.rootElement.$(this.readOnlyField));
}
async selectDropdownOption(option: string): Promise<void> {
@@ -50,6 +50,6 @@ export class CardSelectItemPage {
}
async checkElementIsReadonly(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField));
}
}

View File

@@ -15,63 +15,63 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder, Key } from 'protractor';
import { element, by, ElementFinder, Key } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
export class CardTextItemPage {
rootElement: ElementFinder;
textField: Locator = by.css('[data-automation-id*="card-textitem-value"]');
saveButton: Locator = by.css('button[data-automation-id*="card-textitem-update"]');
clearButton: Locator = by.css('button[data-automation-id*="card-textitem-reset"]');
field: Locator = by.css('[data-automation-id*="card-textitem-value"]');
labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]');
errorMessage: Locator = by.css('.adf-textitem-editable-error');
clickableElement: Locator = by.css('.adf-textitem-clickable');
readOnlyField: Locator = by.css('.adf-property-read-only');
textField = '[data-automation-id*="card-textitem-value"]';
saveButton = 'button[data-automation-id*="card-textitem-update"]';
clearButton = 'button[data-automation-id*="card-textitem-reset"]';
field = '[data-automation-id*="card-textitem-value"]';
labelLocator = 'div[data-automation-id*="card-textitem-label"]';
errorMessage = '.adf-textitem-editable-error';
clickableElement = '.adf-textitem-clickable';
readOnlyField = '.adf-property-read-only';
constructor(label: string = 'assignee') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "card-textitem-label-${label}")]//ancestor::adf-card-view-textitem`));
}
async getFieldValue(): Promise<string> {
const fieldElement = this.rootElement.element(this.field);
const fieldElement = this.rootElement.$(this.field);
return BrowserActions.getInputValue(fieldElement);
}
async checkLabelIsPresent(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
}
async checkLabelIsVisible(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsVisible(labelElement);
}
async enterTextField(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField));
await BrowserActions.clearSendKeys(this.rootElement.element(this.textField), text, 500);
await this.rootElement.element(this.textField).sendKeys(Key.TAB);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.textField));
await BrowserActions.clearSendKeys(this.rootElement.$(this.textField), text, 500);
await this.rootElement.$(this.textField).sendKeys(Key.TAB);
}
async clickOnSaveButton(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.saveButton));
await BrowserActions.click(this.rootElement.$(this.saveButton));
}
async clickOnClearButton(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.clearButton));
await BrowserActions.click(this.rootElement.$(this.clearButton));
}
async getErrorMessage(): Promise<string> {
const errorField = this.rootElement.element(this.errorMessage);
const errorField = this.rootElement.$(this.errorMessage);
return BrowserActions.getText(errorField);
}
async checkElementIsReadonly(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField));
}
async clickField(): Promise<void> {
await BrowserActions.click(this.rootElement.element(by.css(`button[data-automation-id*='clickable-icon']`)));
await BrowserActions.click(this.rootElement.$(`button[data-automation-id*='clickable-icon']`));
}
}

View File

@@ -15,26 +15,26 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { browser, $ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
export class ConfigEditorPage {
textField = element(by.css('#adf-form-config-editor div.overflow-guard > textarea'));
textField = $('#adf-form-config-editor div.overflow-guard > textarea');
async enterConfiguration(text: string): Promise<void> {
await BrowserActions.clearSendKeys(this.textField, text);
}
async clickSaveButton(): Promise<void> {
const saveButton = element(by.id('app-form-config-save'));
const saveButton = $('#app-form-config-save');
await BrowserActions.click(saveButton);
}
async clickClearButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
const clearButton = element(by.id('app-form-config-clear'));
const clearButton = $('#app-form-config-clear');
await BrowserActions.click(clearButton);
}

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
import { element, by } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
export class ContextMenuPage {
contextMenu = element(by.id('adf-context-menu-content'));
contextMenu = $('#adf-context-menu-content');
async isContextMenuDisplayed(): Promise<boolean> {
try {
@@ -32,6 +32,6 @@ export class ContextMenuPage {
}
async clickContextMenuActionNamed(actionName: string): Promise<void> {
await BrowserActions.click(element(by.css(`button[data-automation-id="context-${actionName}"]`)));
await BrowserActions.click($(`button[data-automation-id="context-${actionName}"]`));
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, browser, by, element, protractor, ElementFinder, ElementArrayFinder } from 'protractor';
import { browser, by, element, protractor, ElementFinder, ElementArrayFinder, $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { Logger } from '../utils/logger';
@@ -26,7 +26,6 @@ export class DataTableComponentPage {
list: ElementArrayFinder;
contents: ElementArrayFinder;
tableBody: ElementFinder;
rows: Locator = by.css(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
allColumns: ElementArrayFinder;
selectedRowNumber: ElementFinder;
allSelectedRows: ElementArrayFinder;
@@ -36,21 +35,27 @@ export class DataTableComponentPage {
emptyListTitle: ElementFinder;
emptyListSubtitle: ElementFinder;
rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
MAX_LOADING_TIME = 120000;
constructor(rootElement = element.all(by.css('adf-datatable')).first()) {
constructor(rootElement = $$('adf-datatable').first()) {
this.rootElement = rootElement;
this.list = this.rootElement.all(by.css(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`));
this.contents = this.rootElement.all(by.css('.adf-datatable-body span'));
this.tableBody = this.rootElement.all(by.css(`.adf-datatable-body`)).first();
this.allColumns = this.rootElement.all(by.css('div[data-automation-id*="auto_id_entry."]'));
this.selectedRowNumber = this.rootElement.element(by.css(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`));
this.allSelectedRows = this.rootElement.all(by.css(`adf-datatable-row[class*='is-selected']`));
this.selectAll = this.rootElement.element(by.css(`div[class*='adf-datatable-header'] mat-checkbox`));
this.copyColumnTooltip = this.rootElement.element(by.css(`adf-copy-content-tooltip span`));
this.emptyList = this.rootElement.element(by.css(`adf-empty-content`));
this.emptyListTitle = this.rootElement.element(by.css(`.adf-empty-content__title`));
this.emptyListSubtitle = this.rootElement.element(by.css(`.adf-empty-content__subtitle`));
this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
this.contents = this.rootElement.$$('.adf-datatable-body span');
this.tableBody = this.rootElement.$$(`.adf-datatable-body`).first();
this.allColumns = this.rootElement.$$('div[data-automation-id*="auto_id_entry."]');
this.selectedRowNumber = this.rootElement.$(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`);
this.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`);
this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox`);
this.copyColumnTooltip = this.rootElement.$(`adf-copy-content-tooltip span`);
this.emptyList = this.rootElement.$(`adf-empty-content`);
this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`);
this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`);
}
geCellElementDetail(detail: string): ElementArrayFinder {
return $$(`adf-datatable div[title="${detail}"] span`);
}
async checkAllRowsButtonIsDisplayed(): Promise<void> {
@@ -59,12 +64,12 @@ export class DataTableComponentPage {
async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]'));
}
async uncheckAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.$('input[aria-checked="true"]'));
}
async clickCheckbox(columnName: string, columnValue: string): Promise<void> {
@@ -73,16 +78,16 @@ export class DataTableComponentPage {
}
async checkRowIsNotChecked(columnName: string, columnValue: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).$('input[aria-checked="true"]'));
}
async checkRowIsChecked(columnName: string, columnValue: string): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.$('input[aria-checked="true"]'));
}
getRowCheckbox(columnName: string, columnValue: string): ElementFinder {
return this.getRow(columnName, columnValue).element(by.css('mat-checkbox'));
return this.getRow(columnName, columnValue).$('mat-checkbox');
}
async checkNoRowIsSelected(): Promise<void> {
@@ -140,7 +145,7 @@ export class DataTableComponentPage {
async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise<string> {
const row = this.getRow(identifyingColumn, identifyingValue);
await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
const rowColumn = row.$(`div[title="${columnName}"] span`);
return BrowserActions.getText(rowColumn);
}
@@ -153,7 +158,7 @@ export class DataTableComponentPage {
* @return 'true' if the list is sorted as await expected and 'false' if it isn't
*/
async checkListIsSorted(sortOrder: string, columnTitle: string, listType: string = 'STRING'): Promise<any> {
const column = element.all(by.css(`div.adf-datatable-cell[title='${columnTitle}'] span`));
const column = $$(`div.adf-datatable-cell[title='${columnTitle}'] span`);
await BrowserVisibility.waitUntilElementIsVisible(column.first());
const initialList = [];
@@ -212,7 +217,7 @@ export class DataTableComponentPage {
async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
await this.rightClickOnItem(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content'));
}
async getTooltip(columnName: string, columnValue: string): Promise<string> {
@@ -222,7 +227,7 @@ export class DataTableComponentPage {
async rightClickOnRowByIndex(index: number): Promise<void> {
const row = this.getRowByIndex(index);
await BrowserActions.rightClick(row);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content'));
}
async rightClickOnItem(columnName: string, columnValue: string): Promise<void> {
@@ -237,35 +242,37 @@ export class DataTableComponentPage {
async numberOfRows(): Promise<number> {
try {
await this.waitForFirstRow();
return this.rootElement.all(this.rows).count();
return this.rootElement.$$(this.rows).count();
} catch (e) {
return 0;
}
}
async waitForFirstRow(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(this.rows).first());
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first());
}
async getAllRowsColumnValues(column: string): Promise<string[]> {
let columnValues: string[] = [];
const columnLocator: Locator = by.css("adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title='" + column + "'] span");
const columnLocator = $$(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title="${column}"] span`);
await BrowserVisibility.waitUntilElementIsPresent(await columnLocator.first(), 1000);
try {
await BrowserVisibility.waitUntilElementIsPresent(element.all(columnLocator).first(), 1000);
columnValues = <string[]> await element.all(columnLocator)
await BrowserVisibility.waitUntilElementIsPresent(columnLocator.first(), 1000);
columnValues = await columnLocator
.filter(async (el) => el.isPresent())
.map(async (el) => el.getText());
} catch (error) {
Logger.log(error);
}
return columnValues;
}
async getRowsWithSameColumnValues(columnName: string, columnValue: string) {
const columnLocator: Locator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
return this.rootElement.all(columnLocator).getText();
const columnLocator = `div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`;
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(columnLocator).first());
return this.rootElement.$$(columnLocator).getText();
}
async doubleClickRow(columnName: string, columnValue: string): Promise<void> {
@@ -279,36 +286,32 @@ export class DataTableComponentPage {
}
async getFirstElementDetail(detail: string): Promise<string> {
const firstNode = element.all(by.css(`adf-datatable div[title="${detail}"] span`)).first();
const firstNode = $$(`adf-datatable div[title="${detail}"] span`).first();
return BrowserActions.getText(firstNode);
}
geCellElementDetail(detail: string): ElementArrayFinder {
return element.all(by.css(`adf-datatable div[title="${detail}"] span`));
}
/**
* Sort the list by name column.
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
async sortByColumn(sortOrder: string, titleColumn: string): Promise<void> {
const locator: Locator = by.css(`div[data-automation-id="auto_id_${titleColumn}"]`);
await BrowserVisibility.waitUntilElementIsVisible(element(locator));
const result = await BrowserActions.getAttribute(element(locator), 'class');
const locator = $(`div[data-automation-id="auto_id_${titleColumn}"]`);
await BrowserVisibility.waitUntilElementIsVisible(locator);
const result = await BrowserActions.getAttribute(locator, 'class');
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(locator);
}
}
} else {
if (result.includes('sorted-asc')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(locator);
} else if (result.includes('sortable')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(element(locator));
await BrowserActions.click(locator);
await BrowserActions.click(locator);
}
}
}
@@ -359,7 +362,7 @@ export class DataTableComponentPage {
}
getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`)).first();
return this.rootElement.$$(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`).first();
}
async tableIsLoaded(): Promise<void> {
@@ -456,7 +459,7 @@ export class DataTableComponentPage {
}
async checkColumnIsDisplayed(column: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`)));
await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_entry.${column}"]`));
}
async getNumberOfColumns(): Promise<number> {
@@ -468,11 +471,11 @@ export class DataTableComponentPage {
}
getCellByRowNumberAndColumnName(rowNumber: number, columnName: string): ElementFinder {
return this.list.get(rowNumber).all(by.css(`div[title="${columnName}"] span`)).first();
return this.list.get(rowNumber).$$(`div[title="${columnName}"] span`).first();
}
getCellByRowContentAndColumn(rowColumn: string, rowContent: string, columnName: string): ElementFinder {
return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`));
return this.getRow(rowColumn, rowContent).$(`div[title='${columnName}']`);
}
async selectRowByContent(content: string): Promise<void> {
@@ -500,33 +503,33 @@ export class DataTableComponentPage {
}
async clickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first();
await BrowserActions.click(resultElement);
}
async clickRowByContentCheckbox(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`));
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`));
await browser.actions().mouseMove(resultElement);
await BrowserActions.click(resultElement);
}
async checkRowContentIsDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async checkRowContentIsNotDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first();
await BrowserVisibility.waitUntilElementIsNotVisible(resultElement);
}
async checkRowContentIsDisabled(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async doubleClickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first();
await BrowserActions.click(resultElement);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
@@ -566,7 +569,7 @@ export class DataTableComponentPage {
async getEmptyListText(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.rootElement.by.css('adf-custom-empty-content-template').getText();
return this.rootElement.$('adf-custom-empty-content-template').getText();
}
return '';
}

View File

@@ -16,16 +16,16 @@
*/
import { Column } from './column';
import { by, element, ElementFinder, Locator, protractor, browser } from 'protractor';
import { by, element, ElementFinder, protractor, browser, $$ } from 'protractor';
import { BrowserActions } from '../../utils/browser-actions';
import { BrowserVisibility } from '../../utils/browser-visibility';
export class DataTableItem {
columns = new Array<Column>();
rootElement: ElementFinder;
rows: Locator = by.css(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
rows = `div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
constructor(rootElement = element.all(by.css('adf-datatable')).first()) {
constructor(rootElement = $$('adf-datatable').first()) {
this.rootElement = rootElement;
}
@@ -58,7 +58,7 @@ export class DataTableItem {
}
async waitForFirstRow(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(this.rows).first());
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first());
}
async clickAndEnterOnRow(columnName: string, columnValue: string): Promise<void> {
@@ -70,7 +70,7 @@ export class DataTableItem {
async getColumnValueForRow(identifyingColumnName: string, identifyingColumnValue: string, columnName: string): Promise<string> {
const row = await this.getRow(identifyingColumnName, identifyingColumnValue);
await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
const rowColumn = row.$(`div[title="${columnName}"] span`);
return BrowserActions.getText(rowColumn);
}

View File

@@ -16,14 +16,14 @@
*/
import { BrowserVisibility } from '../utils/browser-visibility';
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
export class ErrorPage {
errorPageCode = element(by.css('adf-error-content .adf-error-content-code'));
errorPageTitle = element(by.css('adf-error-content .adf-error-content-title'));
errorPageDescription = element(by.css('adf-error-content .adf-error-content-description'));
errorPageCode = $('adf-error-content .adf-error-content-code');
errorPageTitle = $('adf-error-content .adf-error-content-title');
errorPageDescription = $('adf-error-content .adf-error-content-description');
async checkErrorCode(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode);

View File

@@ -15,37 +15,43 @@
* limitations under the License.
*/
import { browser, Locator, by, element, ElementFinder } from 'protractor';
import { browser, Locator, by, element, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../utils/public-api';
import { DropdownPage } from '../material/dropdown.page';
export class FormFields {
formContent = element(by.css('adf-form-renderer'));
refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon'));
selectFormDropdown = new DropdownPage($$('.adf-attach-form .mat-select-arrow').first());
formContent = $('adf-form-renderer');
refreshButton = $('div[class*="form-reload-button"] mat-icon');
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
valueLocator: Locator = by.css('input');
labelLocator: Locator = by.css('label');
noFormMessage = element(by.css('.adf-empty-content__title'));
noFormMessageStandaloneTask = element(by.css('adf-task-standalone #adf-no-form-message'));
noFormTemplate = element(by.css('adf-empty-content'));
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
completedStandaloneTaskNoFormMessage = element(by.css('adf-task-standalone #adf-completed-form-message'));
attachFormButton = element(by.id('adf-attach-form-attach-button'));
completeButton = element(by.id('adf-form-complete'));
completeNoFormButton = element(by.id('adf-no-form-complete-button'));
cancelButton = element(by.id('adf-no-form-cancel-button'));
noFormMessage = $('.adf-empty-content__title');
noFormMessageStandaloneTask = $('adf-task-standalone #adf-no-form-message');
noFormTemplate = $('adf-empty-content');
completedTaskNoFormMessage = $('div[id*="completed-form-message"] p');
completedStandaloneTaskNoFormMessage = $('adf-task-standalone #adf-completed-form-message');
attachFormButton = $('#adf-attach-form-attach-button');
completeButton = $('#adf-form-complete');
completeNoFormButton = $('#adf-no-form-complete-button');
cancelButton = $('#adf-no-form-cancel-button');
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
selectFormDropdown = new DropdownPage(element.all(by.css('.adf-attach-form .mat-select-arrow')).first());
getWidget = (fieldId: string): ElementFinder => $(`adf-form-field div[id='field-${fieldId}-container']`);
async setFieldValue(locator, field, value: string): Promise<void> {
const fieldElement = element(locator(field));
async setFieldValue(field: string, value: string): Promise<void> {
const fieldElement = $(`#${field}`);
await BrowserActions.clearSendKeys(fieldElement, value);
}
async checkFieldValue(field: string, value: string): Promise<void> {
const fieldElement = $(`#${field}`);
await BrowserVisibility.waitUntilElementHasValue(fieldElement, value);
}
async checkWidgetIsVisible(fieldId: string): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
const fieldElement = $$(`adf-form-field div[id='field-${fieldId}-container']`).first();
await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
}
@@ -56,19 +62,15 @@ export class FormFields {
}
async checkWidgetIsClickable(fieldId: string): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
const fieldElement = $$(`adf-form-field div[id='field-${fieldId}-container']`).first();
await BrowserVisibility.waitUntilElementIsClickable(fieldElement);
}
async checkWidgetIsHidden(fieldId: string): Promise<void> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container']`);
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
}
getWidget(fieldId: string): ElementFinder {
return element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
}
async getFieldValue(fieldId: string, valueLocatorParam?: any): Promise<string> {
const valueWidget = await (await this.getWidget(fieldId)).element(valueLocatorParam || this.valueLocator);
await BrowserVisibility.waitUntilElementIsVisible(valueWidget);
@@ -92,15 +94,11 @@ export class FormFields {
}
async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise<string> {
const placeHolderLocator = element(by.css(`${locator}#${fieldId}`));
const placeHolderLocator = $(`${locator}#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
return BrowserActions.getAttribute(placeHolderLocator, 'data-placeholder');
}
async checkFieldValue(locator, field, val): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
}
async refreshForm(): Promise<void> {
await BrowserActions.click(this.refreshButton);
await browser.sleep(500);
@@ -177,13 +175,13 @@ export class FormFields {
}
async checkWidgetIsReadOnlyMode(fieldId: string): Promise<ElementFinder> {
const widget = element(by.css(`adf-form-field #field-${fieldId}-container .adf-readonly`));
const widget = $(`adf-form-field #field-${fieldId}-container .adf-readonly`);
await BrowserVisibility.waitUntilElementIsVisible(widget);
return widget;
}
async isFormFieldEnabled(formFieldId: string): Promise<boolean> {
return element(by.id(`${formFieldId}`)).isEnabled();
return $(`#${formFieldId}`).isEnabled();
}
async completeForm(): Promise<void> {
@@ -199,7 +197,7 @@ export class FormFields {
}
async setValueInInputById(fieldId: string, value: string): Promise<void> {
const input = element(by.id(fieldId));
const input = $(`#${fieldId}`);
await BrowserActions.clearSendKeys(input, value);
}

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, $ } from 'protractor';
import { BrowserVisibility } from '../../utils/browser-visibility';
import { BrowserActions } from '../../utils/public-api';
export class FormPage {
errorLog = element(by.css('div[class*="console"]'));
errorLog = $('div[class*="console"]');
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
async checkErrorMessageForWidgetIsDisplayed(errorMessage: string): Promise<void> {
@@ -47,7 +47,7 @@ export class FormPage {
}
async isSaveButtonDisabled(): Promise<boolean> {
const saveButtonDisabled = element(by.css('.adf-form-mat-card-actions [disabled]'));
const saveButtonDisabled = $('.adf-form-mat-card-actions [disabled]');
try {
await saveButtonDisabled.isDisplayed();
return true;
@@ -57,7 +57,7 @@ export class FormPage {
}
async isValidationIconBlue(): Promise<boolean> {
const validationIcon = element(by.css('#adf-valid-form-icon'));
const validationIcon = $('#adf-valid-form-icon');
try {
await validationIcon.isDisplayed();
return true;
@@ -67,7 +67,7 @@ export class FormPage {
}
async isValidationIconRed(): Promise<boolean> {
const validationIcon = element(by.css('#adf-invalid-form-icon'));
const validationIcon = $('#adf-invalid-form-icon');
try {
await validationIcon.isDisplayed();
return true;

View File

@@ -15,23 +15,23 @@
* limitations under the License.
*/
import { element, by, Locator } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { FormFields } from '../form-fields';
export class AmountWidgetPage {
currency: Locator = by.css('.adf-amount-widget__prefix-spacing');
currency = '.adf-amount-widget__prefix-spacing';
formFields: FormFields = new FormFields();
async getAmountFieldLabel(fieldId: string): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}
async getAmountFieldCurrency(fieldId: string): Promise<string> {
const widget = await this.formFields.getWidget(fieldId);
return BrowserActions.getText(widget.element(this.currency));
return BrowserActions.getText(widget.$(this.currency));
}
async setFieldValue(fieldId: string, value: any): Promise<void> {
@@ -39,12 +39,12 @@ export class AmountWidgetPage {
}
async removeFromAmountWidget(fieldId: string) {
const amountWidgetInput = element(by.id(fieldId));
const amountWidgetInput = $(`#${fieldId}`);
await BrowserActions.clearWithBackSpace(amountWidgetInput);
}
async clearFieldValue(fieldId: string): Promise<void> {
const numberField = element(by.id(fieldId));
const numberField = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(numberField);
await numberField.clear();
}
@@ -54,7 +54,7 @@ export class AmountWidgetPage {
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}

View File

@@ -17,33 +17,33 @@
import { FormFields } from '../form-fields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { Locator, element, by, browser } from 'protractor';
import { by, browser, $ } from 'protractor';
import { TestElement } from '../../../test-element';
export class AttachFileWidgetPage {
formFields = new FormFields();
alfrescoTypeUploadLocator: Locator = by.css('button[id="attachfile"]');
localStorageButton = element(by.css('input[id="attachfile"]'));
filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachFileWidget = element(by.css('#attachfile'));
attachedFileMenu = element(by.css('mat-list-item button'));
attachedFileOptions = element(by.css('.mat-menu-panel .mat-menu-content'));
viewFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`));
downloadFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`));
alfrescoTypeUploadLocator = 'button[id="attachfile"]';
localStorageButton = $('input[id="attachfile"]');
filesListLocator = 'div[id="adf-attach-widget-readonly-list"]';
attachFileWidget = $('#attachfile');
attachedFileMenu = $('mat-list-item button');
attachedFileOptions = $('.mat-menu-panel .mat-menu-content');
viewFileOptionButton = $(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`);
downloadFileOptionButton = $(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`);
removeFileOptionButton = TestElement.byCss(`.mat-menu-panel .mat-menu-content button[id$="remove"]`);
async attachFile(fieldId, fileLocation): Promise<void> {
async attachFile(fieldId: string, fileLocation: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.alfrescoTypeUploadLocator);
const uploadButton = await widget.$(this.alfrescoTypeUploadLocator);
await BrowserActions.click(uploadButton);
await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton);
await this.localStorageButton.sendKeys(fileLocation);
}
async checkNoFileIsAttached(fieldId): Promise<void> {
async checkNoFileIsAttached(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileItem = widget.element(this.filesListLocator).element(by.css('mat-list-item'));
const fileItem = widget.$(this.filesListLocator).$('mat-list-item');
await BrowserVisibility.waitUntilElementIsNotVisible(fileItem);
}
@@ -54,8 +54,7 @@ export class AttachFileWidgetPage {
}
async checkFileIsAttached(fieldId: string, name: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
@@ -65,14 +64,13 @@ export class AttachFileWidgetPage {
}
}
async checkFileIsNotAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileNotAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
async checkFileIsNotAttached(fieldId: string, name: string): Promise<void> {
const fileNotAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsNotVisible(fileNotAttached);
}
async viewFile(name: string): Promise<void> {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileView = $(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserActions.click(fileView);
await browser.actions().doubleClick(fileView).perform();
}
@@ -84,10 +82,10 @@ export class AttachFileWidgetPage {
async toggleAttachedFileMenu(fieldId: string, fileName: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = await widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', fileName));
const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, fileName);
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
const id = await BrowserActions.getAttribute(fileAttached, 'id');
const optionMenu = widget.element(by.css(`button[id='${id}-option-menu']`));
const optionMenu = widget.$(`button[id='${id}-option-menu']`);
await BrowserActions.click(optionMenu);
}
@@ -129,39 +127,44 @@ export class AttachFileWidgetPage {
return this.removeFileOptionButton.isEnabled();
}
async checkUploadIsNotVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
async checkUploadIsNotVisible(fieldId: string): Promise<void> {
const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`;
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(alfrescoTypeUploadLocator);
const uploadButton = await widget.$(alfrescoTypeUploadLocator);
await BrowserVisibility.waitUntilElementIsNotPresent(uploadButton);
}
async checkUploadIsVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
async checkUploadIsVisible(fieldId: string): Promise<void> {
const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`;
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(alfrescoTypeUploadLocator);
const uploadButton = await widget.$(alfrescoTypeUploadLocator);
await BrowserVisibility.waitUntilElementIsPresent(uploadButton);
}
async checkLocalTypeUploadIsPresent(fieldId): Promise<void> {
const localTypeUpload = element(by.css(`input[id="${fieldId}"]`));
async checkLocalTypeUploadIsPresent(fieldId: string): Promise<void> {
const localTypeUpload = $(`input[id="${fieldId}"]`);
await BrowserVisibility.waitUntilElementIsPresent(localTypeUpload);
}
async checkLocalTypeUploadIsNotPresent(fieldId): Promise<void> {
const localTypeUpload = element(by.css(`input[id="${fieldId}"]`));
async checkLocalTypeUploadIsNotPresent(fieldId: string): Promise<void> {
const localTypeUpload = $(`input[id="${fieldId}"]`);
await BrowserVisibility.waitUntilElementIsNotPresent(localTypeUpload);
}
async selectUploadSource(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`)));
await BrowserActions.click($(`button[id="attach-${name}"]`));
}
async clickUploadButton(fieldId): Promise<void> {
async clickUploadButton(fieldId: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.alfrescoTypeUploadLocator);
const uploadButton = await widget.$(this.alfrescoTypeUploadLocator);
await BrowserActions.click(uploadButton);
}
private async getFileAttachedNotAttachedLocator(fieldId: string, name: string) {
const widget = await this.formFields.getWidget(fieldId);
return widget.$(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
}
}

View File

@@ -15,42 +15,45 @@
* limitations under the License.
*/
import { Locator, by, element } from 'protractor';
import { by, $ } from 'protractor';
import { FormFields } from '../form-fields';
import { BrowserActions, BrowserVisibility } from '../../../utils/public-api';
export class AttachFolderWidgetPage {
formFields: FormFields = new FormFields();
foldersListLocator: Locator = by.css('.adf-attach-folder-result');
foldersListLocator = '.adf-attach-folder-result';
async clickWidget(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId).element(by.css(`button[id="folder-${fieldId}-button"]`));
const widget = await this.formFields.getWidget(fieldId).$(`button[id="folder-${fieldId}-button"]`);
await BrowserActions.click(widget);
}
async checkFolderIsAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name));
async checkFolderIsAttached(fieldId: string, name: string): Promise<void> {
const folderAttached = await this.getFolderAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsVisible(folderAttached);
}
async checkFolderIsNotAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name));
async checkFolderIsNotAttached(fieldId: string, name: string): Promise<void> {
const folderAttached = await this.getFolderAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsNotPresent(folderAttached);
}
async attachFileWidgetDisplayed(id: string): Promise<void> {
const locator = element(by.css(id ? id : '#attachfolder'));
const locator = $(id ? id : '#attachfolder');
await BrowserVisibility.waitUntilElementIsVisible(locator);
}
async removeFolder(fieldId: string, name: string): Promise<void> {
await this.checkFolderIsAttached(fieldId, name);
const widget = await this.formFields.getWidget(fieldId);
const folderToBeRemoved = widget.element(this.foldersListLocator).element(by.css(`[id="folder-${fieldId}-remove"]`));
const folderToBeRemoved = widget.$(this.foldersListLocator).$(`[id="folder-${fieldId}-remove"]`);
await BrowserActions.click(folderToBeRemoved);
}
private async getFolderAttachedLocator(fieldId: string, name: string) {
const widget = await this.formFields.getWidget(fieldId);
return widget.$(this.foldersListLocator).element(by.cssContainingText('span', name));
}
}

View File

@@ -17,20 +17,20 @@
import { FormFields } from '../form-fields';
import { BrowserActions } from '../../../utils/public-api';
import { Locator, by, element } from 'protractor';
import { $$, $ } from 'protractor';
export class CheckboxWidgetPage {
formFields = new FormFields();
checkboxLabel = element(by.css('span[class*="mat-checkbox-label"]'));
checkboxLocator: Locator = by.css('mat-checkbox');
checkboxLabel = $('span[class*="mat-checkbox-label"]');
checkboxLocator = ('mat-checkbox');
getCheckboxLabel(): Promise<string> {
return BrowserActions.getText(this.checkboxLabel);
}
async clickCheckboxInput(fieldId: string): Promise<void> {
const checkboxInput = element.all(by.css(`mat-checkbox[id="${fieldId}"] div`)).first();
const checkboxInput = $$(`mat-checkbox[id="${fieldId}"] div`).first();
await BrowserActions.click(checkboxInput);
}
@@ -43,7 +43,7 @@ export class CheckboxWidgetPage {
}
async isCheckboxChecked(fieldId: string): Promise<boolean> {
const checkboxWidget = await (await this.formFields.getWidget(fieldId)).element(this.checkboxLocator);
const checkboxWidget = await (await this.formFields.getWidget(fieldId)).$(this.checkboxLocator);
const attributeValue = await BrowserActions.getAttribute(checkboxWidget, 'class');
return attributeValue.includes('mat-checkbox-checked');
}

View File

@@ -24,7 +24,7 @@ export class ContainerWidgetPage {
fileLocator: Locator = by.css("div [class*='upload-widget__content-text']");
getFieldText(fieldId): Promise<string> {
getFieldText(fieldId: string): Promise<string> {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
}

View File

@@ -16,20 +16,20 @@
*/
import { FormFields } from '../form-fields';
import { element, by } from 'protractor';
import { element, by, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DateTimeWidgetPage {
formFields = new FormFields();
outsideLayer = element(by.css('div[class*="cdk-overlay-container"]'));
outsideLayer = $('div[class*="cdk-overlay-container"]');
async checkWidgetIsVisible(fieldId: string): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
async getDateTimeLabel(fieldId: string): Promise<string> {
const label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
const label = $(`adf-form-field div[id="field-${fieldId}-container"] label`);
return BrowserActions.getText(label);
}
@@ -47,7 +47,7 @@ export class DateTimeWidgetPage {
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}
@@ -57,7 +57,7 @@ export class DateTimeWidgetPage {
}
async openDatepicker(fieldId: string): Promise<void> {
await BrowserActions.click(element(by.id(fieldId)));
await BrowserActions.click($(`#${fieldId}`));
}
async selectTime(time: string): Promise<void> {
@@ -78,13 +78,13 @@ export class DateTimeWidgetPage {
}
async removeFromDatetimeWidget(fieldId: string): Promise<void> {
const amountWidgetInput = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(await this.formFields.getWidget(fieldId));
const amountWidgetInput = element(by.id(fieldId));
await BrowserActions.clearWithBackSpace(amountWidgetInput);
}
async clearDateTimeInput(fieldId: string): Promise<void> {
const dateInput = element(by.id(fieldId));
const dateInput = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(dateInput);
await dateInput.clear();
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { element, by } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DateWidgetPage {
@@ -32,7 +32,7 @@ export class DateWidgetPage {
}
async getDateLabel(fieldId: string): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}
@@ -46,7 +46,7 @@ export class DateWidgetPage {
}
async clearDateInput(fieldId: string): Promise<void> {
const dateInput = element(by.id(fieldId));
const dateInput = $(`#${fieldId}`);
await BrowserActions.clearWithBackSpace(dateInput);
}
@@ -56,18 +56,18 @@ export class DateWidgetPage {
}
async checkErrorMessageIsNotDisplayed(fieldId: string): Promise<void> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
await BrowserVisibility.waitUntilElementIsNotVisible(errorMessage);
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}
async removeFromDatetimeWidget(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
await BrowserVisibility.waitUntilElementIsVisible(widget);
await BrowserActions.clearSendKeys(element(by.id(fieldId)), '');
await BrowserActions.clearSendKeys($(`#${fieldId}`), '');
}
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { by, element, Locator } from 'protractor';
import { by, Locator, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { EditJsonDialog } from '../../../dialog/public-api';
@@ -45,7 +45,7 @@ export class DisplayValueWidgetPage {
}
async checkDisplayValueWidgetIsHidden(fieldId: string): Promise<boolean> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`);
try {
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement);
return true;
@@ -55,7 +55,7 @@ export class DisplayValueWidgetPage {
}
async clickOnDisplayJsonValueWidget(fieldId: string) {
const jsonButton = element(by.css(`adf-form-field div[id='field-${fieldId}-container'] button`));
const jsonButton = $(`adf-form-field div[id='field-${fieldId}-container'] button`);
await BrowserActions.click(jsonButton);
await this.editJsonDialog.checkDialogIsDisplayed();
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { by, element } from 'protractor';
import { by, element, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DropdownWidgetPage {
@@ -35,12 +35,12 @@ export class DropdownWidgetPage {
async openDropdown(locator: string = '#dropdown'): Promise<void> {
await this.checkDropdownIsDisplayed(locator);
const dropdown = locator ? element(by.css(`${locator}`)) : element(by.css(`#dropdown`));
const dropdown = locator ? $(`${locator}`) : $(`#dropdown`);
await BrowserActions.click(dropdown);
}
async checkDropdownIsDisplayed(locator: string = '#dropdown'): Promise<void> {
const dropdown = element(by.css(`${locator}`));
const dropdown = $(`${locator}`);
await BrowserVisibility.waitUntilElementIsVisible(dropdown);
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { Locator, by, element, protractor } from 'protractor';
import { Locator, by, element, protractor, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DynamicTableWidgetPage {
@@ -27,14 +27,16 @@ export class DynamicTableWidgetPage {
columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th');
cancelButton = element(by.cssContainingText('button span', 'Cancel'));
editButton = element(by.cssContainingText('button span', 'edit'));
columnDateTime = element(by.id('columnDateTime'));
columnDate = element(by.id('columnDate'));
calendarHeader = element(by.css('.mat-datetimepicker-calendar-header-date-time'));
calendarContent = element(by.css('.mat-datetimepicker-calendar-content'));
columnDateTime = $('#columnDateTime');
columnDate = $('#columnDate');
calendarHeader = $('.mat-datetimepicker-calendar-header-date-time');
calendarContent = $('.mat-datetimepicker-calendar-content');
saveButton = element(by.cssContainingText('button span', 'Save'));
errorMessage = element(by.css('.adf-error-text'));
dateWidget = element.all(by.css('mat-datepicker-toggle button')).first();
tableRow = element.all(by.css('tbody tr'));
errorMessage = $('.adf-error-text');
dateWidget = $$('mat-datepicker-toggle button').first();
tableRow = $$('tbody tr');
private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`);
getFieldLabel(fieldId: string): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
@@ -45,12 +47,12 @@ export class DynamicTableWidgetPage {
}
async clickAddRow(id?: string): Promise<void> {
const rowButton = element(by.id(`${id ? id : 'label'}-add-row`));
const rowButton = $(`#${id ? id : 'label'}-add-row`);
await BrowserActions.click(rowButton);
}
async clickTableRow(rowNumber): Promise<void> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
const tableRowByIndex = this.getTableRowByIndex(rowNumber);
await BrowserActions.click(tableRowByIndex);
}
@@ -63,18 +65,18 @@ export class DynamicTableWidgetPage {
}
async setDatatableInput(text, id = 'id'): Promise<void> {
const dataTableInput = element(by.id(id));
const dataTableInput = $(`#${id}`);
await BrowserVisibility.waitUntilElementIsVisible(dataTableInput);
await BrowserActions.clearSendKeys(dataTableInput, text);
}
async getTableRowText(rowNumber): Promise<string> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
const tableRowByIndex = this.getTableRowByIndex(rowNumber);
return BrowserActions.getText(tableRowByIndex);
}
async checkTableRowIsNotVisible(rowNumber): Promise<void> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
const tableRowByIndex = this.getTableRowByIndex(rowNumber);
await BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex);
}

View File

@@ -16,13 +16,13 @@
*/
import { FormFields } from '../form-fields';
import { Locator, by, element } from 'protractor';
import { Locator, by, element, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class GroupWidgetPage {
groupField = element(by.css('input[data-automation-id="adf-group-search-input"]'));
firstResult = element(by.id('adf-group-widget-user-0'));
groupField = $('input[data-automation-id="adf-group-search-input"]');
firstResult = $('#adf-group-widget-user-0');
formFields = new FormFields();
groupDropDownList: Locator = by.css('.mat-autocomplete-panel');

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { Locator, by, element } from 'protractor';
import { Locator, by, $$ } from 'protractor';
import { BrowserActions } from '../../../utils/public-api';
export class HyperlinkWidgetPage {
@@ -33,7 +33,7 @@ export class HyperlinkWidgetPage {
}
async getFieldLabel(fieldId: string): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}
}

View File

@@ -17,16 +17,14 @@
import { FormFields } from '../form-fields';
import { BrowserActions } from '../../../utils/public-api';
import { Locator, by } from 'protractor';
export class JsonWidgetPage {
formFields = new FormFields();
jsonButtonLocator: Locator = by.css('button');
jsonButtonLocator = 'button';
async clickJsonButton(fieldId): Promise<void> {
async clickJsonButton(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.jsonButtonLocator);
const uploadButton = await widget.$(this.jsonButtonLocator);
await BrowserActions.click(uploadButton);
}

View File

@@ -38,7 +38,7 @@ export class MultilineTextWidgetPage {
}
setValue(fieldId, value): Promise<void> {
return this.formFields.setFieldValue(by.id, fieldId, value);
return this.formFields.setFieldValue(fieldId, value);
}
getErrorMessage(fieldId): Promise<string> {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $$, $ } from 'protractor';
import { FormFields } from '../form-fields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
@@ -24,7 +24,7 @@ export class NumberWidgetPage {
formFields = new FormFields();
async getNumberFieldLabel(fieldId: string): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}
@@ -37,7 +37,7 @@ export class NumberWidgetPage {
}
async clearFieldValue(fieldId: string): Promise<void> {
const numberField = element(by.id(fieldId));
const numberField = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(numberField);
await numberField.clear();
}
@@ -47,7 +47,7 @@ export class NumberWidgetPage {
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}

View File

@@ -16,17 +16,17 @@
*/
import { FormFields } from '../form-fields';
import { by, element, Locator } from 'protractor';
import { by, element, Locator, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class PeopleWidgetPage {
peopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
firstResult = element(by.id('adf-people-widget-user-0'));
peopleField = $('input[data-automation-id="adf-people-search-input"]');
firstResult = $('#adf-people-widget-user-0');
formFields = new FormFields();
labelLocator: Locator = by.css('div[class*="display-text-widget"]');
inputLocator: Locator = by.id('involvepeople');
peopleDropDownList: Locator = by.css('div[class*="adf-people-widget-list"]');
peopleDropDownList = $('div[class*="adf-people-widget-list"]');
getFieldLabel(fieldId: string): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
@@ -45,7 +45,7 @@ export class PeopleWidgetPage {
}
async checkDropDownListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(this.peopleDropDownList));
await BrowserVisibility.waitUntilElementIsVisible(this.peopleDropDownList);
}
async checkUserIsListed(userName: string): Promise<void> {
@@ -60,7 +60,7 @@ export class PeopleWidgetPage {
async getDropDownList(): Promise<any[]> {
await this.checkDropDownListIsDisplayed();
const users: Locator = by.css('.adf-people-label-name');
const users = by.css('.adf-people-label-name');
await BrowserVisibility.waitUntilElementIsVisible(element(users));
return element.all(users).map((elementFinder) => elementFinder.getText());
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { by, element, Locator } from 'protractor';
import { $$, by, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class RadioButtonsWidgetPage {
@@ -46,7 +46,7 @@ export class RadioButtonsWidgetPage {
}
async getRadioWidgetLabel(fieldId): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, $ } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../../utils/public-api';
export class TabPage {
changeTabAnimation = element(by.css('div[class="mat-ripple-element"]'));
changeTabAnimation = $('div[class="mat-ripple-element"]');
async clickTabByLabel(tabLabel): Promise<void> {
const user = element(by.cssContainingText('.mat-tab-label-content', tabLabel));

View File

@@ -33,7 +33,7 @@ export class TextWidgetPage {
}
async setValue(fieldId, value): Promise<void> {
await this.formFields.setFieldValue(by.id, fieldId, value);
await this.formFields.setFieldValue(fieldId, value);
}
getFieldValue(fieldId): Promise<string> {

View File

@@ -16,15 +16,15 @@
*/
import { FormFields } from '../form-fields';
import { Locator, by, element } from 'protractor';
import { by, element, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class TypeaheadWidgetPage {
field = element(by.css('input[data-automation-id="adf-typeahed-search-input"]'));
firstResult = element(by.id('adf-typeahed-widget-user-0'));
field = $('input[data-automation-id="adf-typeahed-search-input"]');
firstResult = $('#adf-typeahed-widget-user-0');
groupDropDownList = $('.mat-autocomplete-panel');
formFields = new FormFields();
groupDropDownList: Locator = by.css('.mat-autocomplete-panel');
getFieldLabel(fieldId: string): Promise<string> {
return this.formFields.getFieldLabel(fieldId);
@@ -43,7 +43,7 @@ export class TypeaheadWidgetPage {
}
async checkDropDownListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(this.groupDropDownList));
await BrowserVisibility.waitUntilElementIsVisible(this.groupDropDownList);
}
async checkOptionIsListed(option: string): Promise<void> {
@@ -51,9 +51,9 @@ export class TypeaheadWidgetPage {
await BrowserVisibility.waitUntilElementIsVisible(optionElement);
}
async getDropDownList(): Promise<any[]> {
const option: Locator = by.css('[id="adf-typeahed-label-name"]');
await BrowserVisibility.waitUntilElementIsVisible(element(option));
async getDropDownList(): Promise<string[]> {
const option = $('[id="adf-typeahed-label-name"]');
await BrowserVisibility.waitUntilElementIsVisible(option);
return element.all(option).map((elementFinder) => elementFinder.getText());
}

View File

@@ -15,23 +15,23 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { element, by, protractor, browser, $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
export class HeaderPage {
checkBox = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button'));
headerColor = element(by.css('option[value="primary"]'));
titleInput = element(by.css('input[name="title"]'));
iconInput = element(by.css('input[placeholder="URL path"]'));
hexColorInput = element(by.css('input[placeholder="hex color code"]'));
logoHyperlinkInput = element(by.css('input[placeholder="Redirect URL"]'));
logoTooltipInput = element(by.css('input[placeholder="Tooltip text"]'));
positionStart = element.all(by.css('mat-radio-button[value="start"]')).first();
positionEnd = element.all(by.css('mat-radio-button[value="end"]')).first();
sideBarPositionRight = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'));
sideBarPositionLeft = element(by.css('mat-sidenav.mat-drawer.mat-sidenav'));
headerColor = $('option[value="primary"]');
titleInput = $('input[name="title"]');
iconInput = $('input[placeholder="URL path"]');
hexColorInput = $('input[placeholder="hex color code"]');
logoHyperlinkInput = $('input[placeholder="Redirect URL"]');
logoTooltipInput = $('input[placeholder="Tooltip text"]');
positionStart = $$('mat-radio-button[value="start"]').first();
positionEnd = $$('mat-radio-button[value="end"]').first();
sideBarPositionRight = $('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end');
sideBarPositionLeft = $('mat-sidenav.mat-drawer.mat-sidenav');
async checkShowMenuCheckBoxIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
@@ -50,12 +50,12 @@ export class HeaderPage {
}
async clickShowMenuButton(): Promise<void> {
const checkBox = element.all(by.css('mat-checkbox')).first();
const checkBox = $$('mat-checkbox').first();
await BrowserActions.click(checkBox);
}
async changeHeaderColor(color: string): Promise<void> {
const headerColor = element(by.css('option[value="' + color + '"]'));
const headerColor = $('option[value="' + color + '"]');
await BrowserActions.click(headerColor);
}
@@ -71,7 +71,7 @@ export class HeaderPage {
}
async checkIconIsDisplayed(url: string): Promise<void> {
const icon = element(by.css('img[src="' + url + '"]'));
const icon = $('img[src="' + url + '"]');
await BrowserVisibility.waitUntilElementIsVisible(icon);
}

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder } from 'protractor';
import { ElementFinder, $ } from 'protractor';
import { BrowserVisibility } from './../utils/browser-visibility';
import { TabsPage } from './material/tabs.page';
export class InfoDrawerPage {
rootElement: ElementFinder;
infoDrawerHeader: Locator = by.css('adf-info-drawer-layout-header');
infoDrawerHeader = ('adf-info-drawer-layout-header');
tabsPage: TabsPage = new TabsPage();
constructor(classLocator: string = 'adf-info-drawer') {
this.rootElement = element(by.css(`adf-info-drawer[class*='${classLocator}']`));
this.rootElement = $(`adf-info-drawer[class*='${classLocator}']`);
}
async isInfoDrawerDisplayed(): Promise<boolean> {
@@ -49,7 +49,7 @@ export class InfoDrawerPage {
async isInfoDrawerHeaderDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.infoDrawerHeader));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.infoDrawerHeader));
return true;
} catch (error) {
return false;
@@ -58,7 +58,7 @@ export class InfoDrawerPage {
async isInfoDrawerHeaderNotDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(this.infoDrawerHeader));
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.$(this.infoDrawerHeader));
return true;
} catch (error) {
return false;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, browser, protractor } from 'protractor';
import { element, by, browser, protractor, $ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { LocalStorageUtil } from '../utils/local-storage.util';
@@ -25,17 +25,17 @@ export class LoginPage {
loginUrl = `${browser.baseUrl}/login`;
ssoButton = element(by.css(`[data-automation-id="login-button-sso"]`));
usernameField = element(by.id('username'));
passwordField = element(by.id('password'));
loginButton = element(by.css('input[type="submit"]'));
ssoButton = $(`[data-automation-id="login-button-sso"]`);
usernameField = $('#username');
passwordField = $('#password');
loginButton = $('input[type="submit"]');
header = element(by.tagName('adf-layout-header'));
loginError = element(by.css(`div[data-automation-id="login-error"]`));
visibilityLabel = element(by.id('v'));
loginError = $(`div[data-automation-id="login-error"]`);
visibilityLabel = $('#v');
txtUsernameBasicAuth = element(by.css('input[id="username"]'));
txtPasswordBasicAuth = element(by.css('input[id="password"]'));
signInButtonBasicAuth = element(by.id('login-button'));
txtUsernameBasicAuth = $('input[id="username"]');
txtPasswordBasicAuth = $('input[id="password"]');
signInButtonBasicAuth = $('#login-button');
async goToLoginPage(): Promise<void> {
let currentUrl;
@@ -144,7 +144,7 @@ export class LoginPage {
async displayPassword(): Promise<void> {
await BrowserActions.click(this.visibilityLabel);
const passwordInputTypeText = element(by.css(`input[name="password"][type="text"]`));
const passwordInputTypeText = $(`input[name="password"][type="text"]`);
await BrowserVisibility.waitUntilElementIsVisible(passwordInputTypeText);
}

View File

@@ -15,26 +15,26 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, $ } from 'protractor';
import { DateUtil } from '../../utils/date-util';
import { BrowserVisibility } from '../../utils/browser-visibility';
import { BrowserActions } from '../../utils/browser-actions';
export class DatePickerCalendarPage {
datePicker = element(by.css('mat-calendar'));
nextMonthButton = element(by.css('button[class*="mat-calendar-next-button"]'));
previousMonthButton = element(by.css('button[class*="mat-calendar-previous-button"]'));
todayDate = element(by.css('.mat-calendar-body-today'));
periodButton = element(by.css('button[class*=mat-calendar-period-button]'));
datePicker = $('mat-calendar');
nextMonthButton = $('button[class*="mat-calendar-next-button"]');
previousMonthButton = $('button[class*="mat-calendar-previous-button"]');
todayDate = $('.mat-calendar-body-today');
periodButton = $('button[class*=mat-calendar-period-button]');
async getSelectedDate(): Promise<string> {
return BrowserActions.getAttribute(element(by.css('td[class*="mat-calendar-body-active"]')), 'aria-label');
return BrowserActions.getAttribute($('td[class*="mat-calendar-body-active"]'), 'aria-label');
}
async checkDatesAfterDateAreDisabled(date): Promise<void> {
const afterDate = DateUtil.formatDate('DD-MM-YY', date, 1);
const afterCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`));
const afterCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`);
if (await afterCalendar.isPresent()) {
const aria = await BrowserActions.getAttribute(afterCalendar, 'aria-disabled');
await expect(aria).toBe('true');
@@ -45,7 +45,7 @@ export class DatePickerCalendarPage {
async checkDatesBeforeDateAreDisabled(date): Promise<void> {
const beforeDate = DateUtil.formatDate('DD-MM-YY', date, -1);
const beforeCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`));
const beforeCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`);
if (await beforeCalendar.isPresent()) {
const aria = await BrowserActions.getAttribute(beforeCalendar, 'aria-disabled');
await expect(aria).toBe('true');

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, ElementFinder } from 'protractor';
import { $, ElementFinder } from 'protractor';
import { BrowserActions } from '../../utils/browser-actions';
import { DatePickerCalendarPage } from './date-picker-calendar.page';
@@ -25,8 +25,8 @@ export class DatePickerPage {
dateTime = new DatePickerCalendarPage();
constructor(datePickerElement?: ElementFinder) {
const locator = by.css('.mat-datepicker-toggle');
this.datePicker = datePickerElement ? datePickerElement : element(locator);
const locator = $('.mat-datepicker-toggle');
this.datePicker = datePickerElement ? datePickerElement : locator;
}
async clickDatePicker() {

View File

@@ -15,21 +15,21 @@
* limitations under the License.
*/
import { Locator, element, by } from 'protractor';
import { element, by, $, $$ } from 'protractor';
import { BrowserVisibility } from '../../utils/browser-visibility';
import { BrowserActions } from '../../utils/browser-actions';
export class DateTimePickerCalendarPage {
datePicker = element(by.css(`.mat-datetimepicker-calendar`));
today = element(by.css(`.mat-datetimepicker-calendar-body-today`));
timePicker = element(by.css('.mat-datetimepicker-clock'));
hourTime = element.all(by.css('.mat-datetimepicker-clock-hours .mat-datetimepicker-clock-cell')).first();
minutesTime = element.all(by.css('.mat-datetimepicker-clock-minutes .mat-datetimepicker-clock-cell')).first();
firstEnabledHourSelector: Locator = by.css('.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)');
firstEnabledMinutesSelector: Locator = by.css('.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)');
hoursPicker = element(by.css('.mat-datetimepicker-clock-hours'));
minutePicker = element(by.css('.mat-datetimepicker-clock-minutes'));
datePicker = $(`.mat-datetimepicker-calendar`);
today = $(`.mat-datetimepicker-calendar-body-today`);
timePicker = $('.mat-datetimepicker-clock');
hourTime = $$('.mat-datetimepicker-clock-hours .mat-datetimepicker-clock-cell').first();
minutesTime = $$('.mat-datetimepicker-clock-minutes .mat-datetimepicker-clock-cell').first();
firstEnabledHourSelector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
firstEnabledMinutesSelector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
hoursPicker = $('.mat-datetimepicker-clock-hours');
minutePicker = $('.mat-datetimepicker-clock-minutes');
async waitTillDateDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.datePicker);
@@ -63,10 +63,10 @@ export class DateTimePickerCalendarPage {
}
async setDefaultEnabledHour(): Promise<void> {
await BrowserActions.click(this.hoursPicker.all(this.firstEnabledHourSelector).first());
await BrowserActions.click(this.hoursPicker.$$(this.firstEnabledHourSelector).first());
}
async setDefaultEnabledMinutes() {
await BrowserActions.click(this.minutePicker.all(this.firstEnabledMinutesSelector).first());
await BrowserActions.click(this.minutePicker.$$(this.firstEnabledMinutesSelector).first());
}
}

View File

@@ -15,20 +15,20 @@
* limitations under the License.
*/
import { element, by, ElementFinder } from 'protractor';
import { ElementFinder, $ } from 'protractor';
import { BrowserActions } from '../../utils/browser-actions';
import { DateTimePickerCalendarPage } from './date-time-picker-calendar.page';
export class DateTimePickerPage {
rootElement: ElementFinder;
dateTimePicker = element(by.css('.mat-datetimepicker-toggle'));
dateTimePicker = $('.mat-datetimepicker-toggle');
dateTime = new DateTimePickerCalendarPage();
constructor(rootElement?: ElementFinder) {
if (rootElement) {
this.rootElement = rootElement;
this.dateTimePicker = this.rootElement.element(by.css('.mat-datetimepicker-toggle'));
this.dateTimePicker = this.rootElement.$('.mat-datetimepicker-toggle');
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, ElementFinder, browser } from 'protractor';
import { element, by, ElementFinder, browser, $$, $ } from 'protractor';
import { BrowserVisibility } from '../../utils/browser-visibility';
import { BrowserActions } from '../../utils/browser-actions';
import { Logger } from '../../utils/logger';
@@ -24,7 +24,7 @@ export class DropdownPage {
dropDownElement: ElementFinder;
constructor(dropDownElement = element.all(by.css('div[class="mat-select-arrow-wrapper"]')).first()) {
constructor(dropDownElement = $$('div[class="mat-select-arrow-wrapper"]').first()) {
this.dropDownElement = dropDownElement;
}
@@ -41,11 +41,11 @@ export class DropdownPage {
}
async getValue(): Promise<string> {
return BrowserActions.getText(element(by.css('mat-form-field span')));
return BrowserActions.getText($('mat-form-field span'));
}
async getNumberOfOptions(): Promise<number> {
const dropdownOptions = element.all(by.css('.mat-select-panel mat-option'));
const dropdownOptions = $$('.mat-select-panel mat-option');
return dropdownOptions.count();
}
@@ -68,11 +68,11 @@ export class DropdownPage {
}
async checkOptionsPanelIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('.mat-select-panel')));
await BrowserVisibility.waitUntilElementIsVisible($('.mat-select-panel'));
}
async getSelectedOptionText(): Promise<string> {
const selectedOption = this.dropDownElement.element(by.css('.mat-select-value-text span'));
const selectedOption = this.dropDownElement.$('.mat-select-value-text span');
return BrowserActions.getText(selectedOption);
}

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, $$ } from 'protractor';
import { BrowserActions } from '../../utils/browser-actions';
import { BrowserVisibility } from '../../utils/browser-visibility';
export class TabsPage {
tabs = element.all(by.css("div[id*='mat-tab-label']"));
tabs = $$("div[id*='mat-tab-label']");
async clickTabByTitle(tabTitle): Promise<void> {
const tab = element(by.cssContainingText("div[id*='mat-tab-label']", tabTitle));

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, ElementFinder } from 'protractor';
import { ElementFinder } from 'protractor';
import { BrowserActions } from '../../utils/browser-actions';
export class TogglePage {
@@ -23,7 +23,7 @@ export class TogglePage {
async enableToggle(toggle: ElementFinder): Promise<void> {
const check = await BrowserActions.getAttribute(toggle, 'class');
if (check.indexOf('mat-checked') < 0) {
const elem = toggle.all(by.css('input')).first();
const elem = toggle.$$('input').first();
await BrowserActions.clickScript(elem);
}
}
@@ -31,7 +31,7 @@ export class TogglePage {
async disableToggle(toggle: ElementFinder): Promise<void> {
const check = await BrowserActions.getAttribute(toggle, 'class');
if (check.indexOf('mat-checked') >= 0) {
const elem = toggle.all(by.css('input')).first();
const elem = toggle.$$('input').first();
await BrowserActions.clickScript(elem);
}
}

View File

@@ -15,20 +15,20 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
import { BrowserVisibility } from '../utils/browser-visibility';
export class NotificationHistoryPage {
notificationList = element(by.css('.adf-notification-history-list'));
notificationList = $('.adf-notification-history-list');
async clickNotificationButton(): Promise<void> {
await BrowserActions.clickExecuteScript('#adf-notification-history-open-button');
}
async clickMarkAsRead(): Promise<void> {
await BrowserActions.click(element(by.id('adf-notification-history-mark-as-read')));
await BrowserActions.click($('#adf-notification-history-mark-as-read'));
}
async checkNotificationIsPresent(text: string): Promise<void> {
@@ -36,7 +36,7 @@ export class NotificationHistoryPage {
}
async checkNotificationCenterHasNewNotifications(): Promise<void> {
const notificationListButton = element(by.css('#adf-notification-history-open-button [class*="mat-badge-active"]'));
const notificationListButton = $('#adf-notification-history-open-button [class*="mat-badge-active"]');
await BrowserVisibility.waitUntilElementIsVisible(notificationListButton);
}

View File

@@ -15,29 +15,29 @@
* limitations under the License.
*/
import { Locator, by, element, browser } from 'protractor';
import { by, element, browser, $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { Logger } from '../utils/logger';
export class PaginationPage {
pageSelectorDropDown = element(by.css('div[class*="adf-pagination__page-selector"]'));
pageSelectorArrow = element(by.css('button[data-automation-id="page-selector"]'));
itemsPerPage = element(by.css('.adf-pagination__max-items'));
itemsPerPageOpenDropdown = element(by.css('.adf-pagination__perpage-block button'));
itemsPerPageOptions: Locator = by.css('.adf-pagination__page-selector .mat-menu-item');
currentPage = element(by.css('.adf-pagination__current-page'));
totalPages = element(by.css('.adf-pagination__total-pages'));
paginationRange = element(by.css('.adf-pagination__range'));
nextPageButton = element(by.css('button[class*="adf-pagination__next-button"]'));
nextButtonDisabled = element(by.css('button[class*="adf-pagination__next-button"][disabled]'));
previousButtonDisabled = element(by.css('button[class*="adf-pagination__previous-button"][disabled]'));
pageDropDown = element(by.css('div[class*="adf-pagination__actualinfo-block"] button'));
pageDropDownOptions: Locator = by.css('div[class*="mat-menu-content"] button');
paginationSection = element(by.css('adf-pagination'));
paginationSectionEmpty = element(by.css('adf-pagination[class*="adf-pagination__empty"]'));
totalFiles = element(by.css('.adf-pagination__range'));
pageSelectorDropDown = $('div[class*="adf-pagination__page-selector"]');
pageSelectorArrow = $('button[data-automation-id="page-selector"]');
itemsPerPage = $('.adf-pagination__max-items');
itemsPerPageOpenDropdown = $('.adf-pagination__perpage-block button');
itemsPerPageOptions = $$('.adf-pagination__page-selector .mat-menu-item');
currentPage = $('.adf-pagination__current-page');
totalPages = $('.adf-pagination__total-pages');
paginationRange = $('.adf-pagination__range');
nextPageButton = $('button[class*="adf-pagination__next-button"]');
nextButtonDisabled = $('button[class*="adf-pagination__next-button"][disabled]');
previousButtonDisabled = $('button[class*="adf-pagination__previous-button"][disabled]');
pageDropDown = $('div[class*="adf-pagination__actualinfo-block"] button');
pageDropDownOptions = $$('div[class*="mat-menu-content"] button');
paginationSection = $('adf-pagination');
paginationSectionEmpty = $('adf-pagination[class*="adf-pagination__empty"]');
totalFiles = $('.adf-pagination__range');
async selectItemsPerPage(numberOfItem: string): Promise<void> {
await BrowserActions.clickExecuteScript(`div[class*="adf-pagination__perpage-block"] button`);
@@ -93,15 +93,15 @@ export class PaginationPage {
}
async clickOnPageDropdownOption(numberOfItemPerPage: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first());
await BrowserVisibility.waitUntilElementIsVisible(this.pageDropDownOptions.first());
const option = element(by.cssContainingText('div[class*="mat-menu-content"] button', numberOfItemPerPage));
await BrowserActions.click(option);
}
async getPageDropdownOptions() {
await BrowserVisibility.waitUntilElementIsVisible(element.all(this.pageDropDownOptions).first());
await BrowserVisibility.waitUntilElementIsVisible(this.pageDropDownOptions.first());
const initialList = [];
await element.all(this.pageDropDownOptions).each(async (currentOption) => {
await this.pageDropDownOptions.each(async (currentOption) => {
const text = await BrowserActions.getText(currentOption);
if (text !== '') {
initialList.push(text);
@@ -111,9 +111,9 @@ export class PaginationPage {
}
async getItemsPerPageDropdownOptions() {
await BrowserVisibility.waitUntilElementIsVisible(element.all(this.itemsPerPageOptions).first());
await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageOptions.first());
const initialList = [];
await element.all(this.itemsPerPageOptions).each(async (currentOption) => {
await this.itemsPerPageOptions.each(async (currentOption) => {
const text = await BrowserActions.getText(currentOption);
if (text !== '') {
initialList.push(text);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser, by, element } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { DropdownPage } from '../../core/pages/material/dropdown.page';
@@ -23,23 +23,23 @@ import { DropdownPage } from '../../core/pages/material/dropdown.page';
export class SettingsPage {
settingsURL: string = browser.baseUrl + '/settings';
ecmText = element(by.css('input[data-automation-id*="ecmHost"]'));
bpmText = element(by.css('input[data-automation-id*="bpmHost"]'));
clientIdText = element(by.css('input[id="clientId"]'));
authHostText = element(by.css('input[id="oauthHost"]'));
logoutUrlText = element(by.css('input[id="logout-url"]'));
ecmText = $('input[data-automation-id*="ecmHost"]');
bpmText = $('input[data-automation-id*="bpmHost"]');
clientIdText = $('input[id="clientId"]');
authHostText = $('input[id="oauthHost"]');
logoutUrlText = $('input[id="logout-url"]');
basicAuthRadioButton = element(by.cssContainingText('mat-radio-button[id*="mat-radio"]', 'Basic Authentication'));
identityHostText = element(by.css('input[id="identityHost"]'));
identityHostText = $('input[id="identityHost"]');
ssoRadioButton = element(by.cssContainingText('[id*="mat-radio"]', 'SSO'));
silentLoginToggleLabel = element(by.css('mat-slide-toggle[name="silentLogin"] label'));
silentLoginToggleElement = element(by.css('mat-slide-toggle[name="silentLogin"]'));
implicitFlowLabel = element(by.css('mat-slide-toggle[name="implicitFlow"] label'));
implicitFlowElement = element(by.css('mat-slide-toggle[name="implicitFlow"]'));
applyButton = element(by.css('button[data-automation-id*="host-button"]'));
silentLoginToggleLabel = $('mat-slide-toggle[name="silentLogin"] label');
silentLoginToggleElement = $('mat-slide-toggle[name="silentLogin"]');
implicitFlowLabel = $('mat-slide-toggle[name="implicitFlow"] label');
implicitFlowElement = $('mat-slide-toggle[name="implicitFlow"]');
applyButton = $('button[data-automation-id*="host-button"]');
backButton = element(by.cssContainingText('button .mat-button-wrapper', 'Back'));
validationMessage = element(by.cssContainingText('mat-error', 'This field is required'));
providerDropdown = new DropdownPage(element(by.css('mat-select[id="adf-provider-selector"]')));
providerDropdown = new DropdownPage($('mat-select[id="adf-provider-selector"]'));
async goToSettingsPage(): Promise<void> {
let currentUrl;
@@ -208,7 +208,7 @@ export class SettingsPage {
}
async checkApplyButtonIsDisabled() {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[data-automation-id*="host-button"]:disabled')));
await BrowserVisibility.waitUntilElementIsVisible($('button[data-automation-id*="host-button"]:disabled'));
}
async checkProviderDropdownIsDisplayed() {

View File

@@ -15,24 +15,24 @@
* limitations under the License.
*/
import { Locator, element, by } from 'protractor';
import { $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
export class SnackbarPage {
notificationSnackBar = element.all(by.css('simple-snack-bar span')).first();
snackBarAction = element(by.css('simple-snack-bar button span'));
snackBarContainerCss: Locator = by.css('.mat-snack-bar-container');
notificationSnackBar = $$('simple-snack-bar span').first();
snackBarAction = $('simple-snack-bar button span');
snackBarContainerCss = $$('.mat-snack-bar-container');
async waitForSnackBarToAppear(timeout = 5000) {
return BrowserVisibility.waitUntilElementIsVisible(element.all(this.snackBarContainerCss).first(), timeout,
return BrowserVisibility.waitUntilElementIsVisible(this.snackBarContainerCss.first(), timeout,
'snackbar did not appear'
);
}
async waitForSnackBarToClose(timeout = 5000) {
return BrowserVisibility.waitUntilElementIsNotVisible(element.all(this.snackBarContainerCss).first(), timeout);
return BrowserVisibility.waitUntilElementIsNotVisible(this.snackBarContainerCss.first(), timeout);
}
async getSnackBarMessage(): Promise<string> {

View File

@@ -15,30 +15,30 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { TabsPage } from '../../core/pages/material/tabs.page';
import { BrowserActions } from '../utils/browser-actions';
export class UserInfoPage {
dialog = element.all(by.css('mat-card[class*="adf-userinfo-card"]')).first();
userImage = element(by.css('div[id="user-initial-image"]'));
userInfoEcmHeaderTitle = element(by.css('div[id="ecm-username"]'));
userInfoEcmTitle = element(by.css('mat-card-content span[id="ecm-full-name"]'));
ecmEmail = element(by.css('span[id="ecm-email"]'));
ecmJobTitle = element(by.css('span[id="ecm-job-title"]'));
userInfoProcessHeaderTitle = element(by.css('div[id="bpm-username"]'));
userInfoProcessTitle = element(by.css('mat-card-content span[id="bpm-full-name"]'));
processEmail = element(by.css('span[id="bpm-email"]'));
processTenant = element(by.css('.detail-profile'));
apsImage = element(by.css('img[id="bpm-user-detail-image"]'));
acsImage = element(by.css('img[id="ecm-user-detail-image"]'));
initialImage = element.all(by.css('div[id="user-initials-image"]')).first();
userInfoSsoHeaderTitle = this.dialog.element(by.css('div[id="identity-username"]'));
userInfoSsoTitle = element(by.css('.adf-userinfo__detail-title'));
ssoEmail = element(by.id('identity-email'));
userProfileButton = element(by.css('button[data-automation-id="adf-user-profile"]'));
dialog = $$('mat-card[class*="adf-userinfo-card"]').first();
userImage = $('div[id="user-initial-image"]');
userInfoEcmHeaderTitle = $('div[id="ecm-username"]');
userInfoEcmTitle = $('mat-card-content span[id="ecm-full-name"]');
ecmEmail = $('span[id="ecm-email"]');
ecmJobTitle = $('span[id="ecm-job-title"]');
userInfoProcessHeaderTitle = $('div[id="bpm-username"]');
userInfoProcessTitle = $('mat-card-content span[id="bpm-full-name"]');
processEmail = $('span[id="bpm-email"]');
processTenant = $('.detail-profile');
apsImage = $('img[id="bpm-user-detail-image"]');
acsImage = $('img[id="ecm-user-detail-image"]');
initialImage = $$('div[id="user-initials-image"]').first();
userInfoSsoHeaderTitle = this.dialog.$('div[id="identity-username"]');
userInfoSsoTitle = $('.adf-userinfo__detail-title');
ssoEmail = $('#identity-email');
userProfileButton = $('button[data-automation-id="adf-user-profile"]');
tabsPage = new TabsPage();
async dialogIsDisplayed(): Promise<void> {

View File

@@ -19,7 +19,7 @@ import { BrowserActions } from '../utils/browser-actions';
import { TabsPage } from './material/tabs.page';
import { TogglePage } from './material/toggle.page';
import { BrowserVisibility } from '../utils/browser-visibility';
import { element, by, browser, protractor } from 'protractor';
import { element, by, browser, protractor, $, $$ } from 'protractor';
import { Logger } from '../utils/logger';
export class ViewerPage {
@@ -29,88 +29,88 @@ export class ViewerPage {
tabsPage = new TabsPage();
togglePage = new TogglePage();
closeButton = element(by.css('button[data-automation-id="adf-toolbar-back"]'));
fileName = element(by.id('adf-viewer-display-name'));
infoButton = element(by.css('button[data-automation-id="adf-toolbar-sidebar"]'));
leftSideBarButton = element(by.css('button[data-automation-id="adf-toolbar-left-sidebar"]'));
previousPageButton = element(by.id('viewer-previous-page-button'));
nextPageButton = element(by.id('viewer-next-page-button'));
zoomInButton = element(by.id('viewer-zoom-in-button'));
zoomOutButton = element(by.id('viewer-zoom-out-button'));
scalePageButton = element(by.id('viewer-scale-page-button'));
fullScreenButton = element(by.css('button[data-automation-id="adf-toolbar-fullscreen"]'));
rotateLeft = element(by.css('button[id="viewer-rotate-left-button"]'));
rotateRight = element(by.css('button[id="viewer-rotate-right-button"]'));
scaleImg = element(by.css('button[id="viewer-reset-button"]'));
fileThumbnail = element(by.css('img[data-automation-id="adf-file-thumbnail"]'));
pageSelectorInput = element(by.css('input[data-automation-id="adf-page-selector"]'));
imgContainer = element(by.css('div[data-automation-id="adf-image-container"]'));
mediaContainer = element(by.css('.adf-media-player'));
percentage = element(by.css('div[data-automation-id="adf-page-scale"'));
thumbnailsBtn = element(by.css('button[data-automation-id="adf-thumbnails-button"]'));
thumbnailsContent = element(by.css('div[data-automation-id="adf-thumbnails-content"]'));
thumbnailsClose = element(by.css('button[data-automation-id="adf-thumbnails-close"]'));
secondThumbnail = element(by.css('adf-pdf-thumb > img[title="Page 2"'));
lastThumbnailDisplayed = element.all(by.css('adf-pdf-thumb')).last();
passwordDialog = element(by.css('adf-pdf-viewer-password-dialog'));
passwordSubmit = element(by.css('button[data-automation-id="adf-password-dialog-submit"]'));
passwordDialogClose = element(by.css('button[data-automation-id="adf-password-dialog-close"]'));
passwordSubmitDisabled = element(by.css('button[data-automation-id="adf-password-dialog-submit"][disabled]'));
passwordInput = element(by.css('input[data-automation-id="adf-password-dialog-input"]'));
passwordError = element(by.css('mat-error[data-automation-id="adf-password-dialog-error"]'));
infoSideBar = element(by.id('adf-right-sidebar'));
leftSideBar = element(by.id('adf-left-sidebar'));
viewer = element(by.css('adf-viewer'));
pdfViewer = element(by.css('adf-pdf-viewer'));
imgViewer = element(by.css('adf-img-viewer'));
activeTab = element(by.css('div[class*="mat-tab-label-active"]'));
toolbarSwitch = element(by.id('adf-switch-toolbar'));
toolbar = element(by.id('adf-viewer-toolbar'));
lastButton = element.all(by.css('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]')).last();
goBackSwitch = element(by.id('adf-switch-goback'));
canvasLayer = element.all(by.css('.canvasWrapper > canvas')).first();
closeButton = $('button[data-automation-id="adf-toolbar-back"]');
fileName = $('#adf-viewer-display-name');
infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]');
leftSideBarButton = $('button[data-automation-id="adf-toolbar-left-sidebar"]');
previousPageButton = $('#viewer-previous-page-button');
nextPageButton = $('#viewer-next-page-button');
zoomInButton = $('#viewer-zoom-in-button');
zoomOutButton = $('#viewer-zoom-out-button');
scalePageButton = $('#viewer-scale-page-button');
fullScreenButton = $('button[data-automation-id="adf-toolbar-fullscreen"]');
rotateLeft = $('button[id="viewer-rotate-left-button"]');
rotateRight = $('button[id="viewer-rotate-right-button"]');
scaleImg = $('button[id="viewer-reset-button"]');
fileThumbnail = $('img[data-automation-id="adf-file-thumbnail"]');
pageSelectorInput = $('input[data-automation-id="adf-page-selector"]');
imgContainer = $('div[data-automation-id="adf-image-container"]');
mediaContainer = $('.adf-media-player');
percentage = $('div[data-automation-id="adf-page-scale"');
thumbnailsBtn = $('button[data-automation-id="adf-thumbnails-button"]');
thumbnailsContent = $('div[data-automation-id="adf-thumbnails-content"]');
thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]');
secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"');
lastThumbnailDisplayed = $$('adf-pdf-thumb').last();
passwordDialog = $('adf-pdf-viewer-password-dialog');
passwordSubmit = $('button[data-automation-id="adf-password-dialog-submit"]');
passwordDialogClose = $('button[data-automation-id="adf-password-dialog-close"]');
passwordSubmitDisabled = $('button[data-automation-id="adf-password-dialog-submit"][disabled]');
passwordInput = $('input[data-automation-id="adf-password-dialog-input"]');
passwordError = $('mat-error[data-automation-id="adf-password-dialog-error"]');
infoSideBar = $('#adf-right-sidebar');
leftSideBar = $('#adf-left-sidebar');
viewer = $('adf-viewer');
pdfViewer = $('adf-pdf-viewer');
imgViewer = $('adf-img-viewer');
activeTab = $('div[class*="mat-tab-label-active"]');
toolbarSwitch = $('#adf-switch-toolbar');
toolbar = $('#adf-viewer-toolbar');
lastButton = $$('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]').last();
goBackSwitch = $('#adf-switch-goback');
canvasLayer = $$('.canvasWrapper > canvas').first();
openWithSwitch = element(by.id('adf-switch-openwith'));
openWith = element(by.id('adf-viewer-openwith'));
openWithSwitch = $('#adf-switch-openwith');
openWith = $('#adf-viewer-openwith');
moreActionsMenuSwitch = element(by.id('adf-switch-moreactionsmenu'));
moreActionsMenu = element(by.css('button[data-automation-id="adf-toolbar-more-actions"]'));
moreActionsMenuSwitch = $('#adf-switch-moreactionsmenu');
moreActionsMenu = $('button[data-automation-id="adf-toolbar-more-actions"]');
customNameSwitch = element(by.id('adf-switch-custoname'));
customToolbarToggle = element(by.id('adf-toggle-custom-toolbar'));
customToolbar = element(by.css('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]'));
customNameSwitch = $('#adf-switch-custoname');
customToolbarToggle = $('#adf-toggle-custom-toolbar');
customToolbar = $('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]');
showRightSidebarSwitch = element(by.id('adf-switch-showrightsidebar'));
showLeftSidebarSwitch = element(by.id('adf-switch-showleftsidebar'));
showRightSidebarSwitch = $('#adf-switch-showrightsidebar');
showLeftSidebarSwitch = $('#adf-switch-showleftsidebar');
moreActionsSwitch = element(by.id('adf-switch-moreactions'));
pdfPageLoaded = element(by.css('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer'));
moreActionsSwitch = $('#adf-switch-moreactions');
pdfPageLoaded = $('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer');
downloadSwitch = element(by.id('adf-switch-download'));
downloadButton = element(by.id('adf-viewer-download'));
downloadSwitch = $('#adf-switch-download');
downloadButton = $('#adf-viewer-download');
printSwitch = element(by.id('adf-switch-print'));
printButton = element(by.id('adf-viewer-print'));
printSwitch = $('#adf-switch-print');
printButton = $('#adf-viewer-print');
allowSidebarSwitch = element(by.id('adf-switch-allowsidebar'));
allowLeftSidebarSwitch = element(by.id('adf-switch-allowLeftSidebar'));
allowSidebarSwitch = $('#adf-switch-allowsidebar');
allowLeftSidebarSwitch = $('#adf-switch-allowLeftSidebar');
uploadButton = element(by.id('adf-viewer-upload'));
timeButton = element(by.id('adf-viewer-time'));
bugButton = element(by.id('adf-viewer-bug'));
uploadButton = $('#adf-viewer-upload');
timeButton = $('#adf-viewer-time');
bugButton = $('#adf-viewer-bug');
codeViewer = element(by.id('adf-monaco-file-editor'));
codeViewer = $('#adf-monaco-file-editor');
showTabWithIconSwitch = element(by.id('adf-tab-with-icon'));
showTabWithIconAndLabelSwitch = element(by.id('adf-icon-and-label-tab'));
unknownFormat = element(by.css(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`));
showTabWithIconSwitch = $('#adf-tab-with-icon');
showTabWithIconAndLabelSwitch = $('#adf-icon-and-label-tab');
unknownFormat = $(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`);
async checkCodeViewerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.codeViewer);
}
async viewFile(fileName: string): Promise<void> {
const fileView = element.all(by.css(`#document-list-container div[data-automation-id="${fileName}"]`)).first();
const fileView = $$(`#document-list-container div[data-automation-id="${fileName}"]`).first();
await BrowserActions.click(fileView);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await this.waitTillContentLoaded();
@@ -208,7 +208,7 @@ export class ViewerPage {
}
async checkCurrentThumbnailIsSelected(): Promise<void> {
const selectedThumbnail = element(by.css('adf-pdf-thumb.adf-pdf-thumbnails__thumb.adf-pdf-thumbnails__thumb--selected > img'));
const selectedThumbnail = $('adf-pdf-thumb.adf-pdf-thumbnails__thumb.adf-pdf-thumbnails__thumb--selected > img');
const pageNumber = await BrowserActions.getInputValue(this.pageSelectorInput);
await expect('Page ' + pageNumber).toEqual(await BrowserActions.getAttribute(selectedThumbnail, 'title'));
@@ -223,7 +223,7 @@ export class ViewerPage {
}
async checkThumbnailsBtnIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[data-automation-id="adf-thumbnails-button"]:disabled')));
await BrowserVisibility.waitUntilElementIsVisible($('button[data-automation-id="adf-thumbnails-button"]:disabled'));
}
async checkThumbnailsContentIsDisplayed(): Promise<void> {
@@ -311,8 +311,8 @@ export class ViewerPage {
async checkFileContent(pageNumber: string, text: string): Promise<void> {
const allPages = this.canvasLayer;
const pageLoaded = element.all(by.css('div[data-page-number="' + pageNumber + '"][data-loaded="true"]')).first();
const textLayerLoaded = element.all(by.css('div[data-page-number="' + pageNumber + '"] .textLayer')).first();
const pageLoaded = $$('div[data-page-number="' + pageNumber + '"][data-loaded="true"]').first();
const textLayerLoaded = $$('div[data-page-number="' + pageNumber + '"] .textLayer').first();
const specificText = element.all(by.cssContainingText('div[data-page-number="' + pageNumber + '"] .textLayer', text)).first();
await BrowserVisibility.waitUntilElementIsVisible(allPages);
@@ -375,7 +375,7 @@ export class ViewerPage {
}
async clickInfoButton(): Promise<void> {
await BrowserActions.click(element(by.css('button[data-automation-id="adf-toolbar-sidebar"]')));
await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]'));
}
async clickOnTab(tabName: string): Promise<void> {
@@ -630,39 +630,39 @@ export class ViewerPage {
}
async enterCustomName(text: string): Promise<void> {
const textField = element(by.css('input[data-automation-id="adf-text-custom-name"]'));
const textField = $('input[data-automation-id="adf-text-custom-name"]');
await BrowserActions.clearSendKeys(textField, text);
}
async disableOverlay(): Promise<void> {
await this.togglePage.disableToggle(element(by.id('adf-viewer-overlay')));
await this.togglePage.disableToggle($('#adf-viewer-overlay'));
}
async checkOverlayViewerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('div[class*="adf-viewer-overlay-container"]')));
await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-overlay-container"]'));
}
async checkInlineViewerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('div[class*="adf-viewer-inline-container"]')));
await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-inline-container"]'));
}
async checkTabHasNoIcon(index: number): Promise<void> {
const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`));
const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`);
await BrowserVisibility.waitUntilElementIsNotVisible(tab);
}
async checkTabHasNoLabel(index: number): Promise<void> {
const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`));
const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`);
await BrowserVisibility.waitUntilElementIsNotVisible(tab);
}
async getTabLabelById(index: number): Promise<string> {
const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`));
const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content span`);
return BrowserActions.getText(tab);
}
async getTabIconById(index: number): Promise<string> {
const tab = element(by.css(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`));
const tab = $(`div[id="mat-tab-label-1-${index}"] .mat-tab-label-content mat-icon`);
return BrowserActions.getText(tab);
}
@@ -671,7 +671,7 @@ export class ViewerPage {
}
async getUnknownFormatMessage(): Promise<string> {
const unknownFormatLabel = this.unknownFormat.element(by.css(`.adf-viewer__unknown-label`));
const unknownFormatLabel = this.unknownFormat.$(`.adf-viewer__unknown-label`);
return BrowserActions.getText(unknownFormatLabel);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element, ElementFinder, protractor } from 'protractor';
import { by, element, ElementFinder, protractor, $ } from 'protractor';
import { BrowserActions } from './utils/browser-actions';
import { BrowserVisibility } from './utils/browser-visibility';
@@ -39,7 +39,7 @@ export class TestElement {
* @param selector The CSS class name to lookup
*/
static byCss(selector: string): TestElement {
return new TestElement(element(by.css(selector)));
return new TestElement($(selector));
}
/**

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element, ElementArrayFinder, ElementFinder, protractor } from 'protractor';
import { browser, by, element, ElementArrayFinder, ElementFinder, protractor, $ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { Logger } from './logger';
@@ -68,7 +68,7 @@ export class BrowserActions {
static async clickExecuteScript(elementCssSelector: string): Promise<void> {
Logger.info(`Click execute script ${elementCssSelector}`);
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(elementCssSelector)));
await BrowserVisibility.waitUntilElementIsVisible($(elementCssSelector));
await browser.executeScript(`document.querySelector('${elementCssSelector}').click();`);
}
@@ -195,7 +195,7 @@ export class BrowserActions {
static async closeMenuAndDialogs(): Promise<void> {
Logger.info(`Close Menu And Dialogs`);
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
const container = $('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await BrowserVisibility.waitUntilElementIsNotVisible(container, 1000);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element, ElementFinder, protractor, until } from 'protractor';
import { browser, ElementFinder, protractor, until, $ } from 'protractor';
import { Logger } from './logger';
import { falseIfMissing } from 'protractor/built/util';
@@ -120,7 +120,7 @@ export class BrowserVisibility {
static async waitUntilDialogIsClose(): Promise<void> {
Logger.info(`Wait Until dialog close`);
const dialog = element(by.css('mat-dialog-container'));
const dialog = $('mat-dialog-container');
await this.waitUntilElementIsNotPresent(dialog);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ElementFinder, browser, by } from 'protractor';
import { ElementFinder, browser } from 'protractor';
/**
* Tagged template to convert a sting to an `ElementFinder`.
@@ -28,5 +28,5 @@ export function byCss(
...placeholders: string[]
): ElementFinder {
const selector = literals[0] || placeholders[0];
return browser.element(by.css(selector));
return browser.$(selector);
}

View File

@@ -15,16 +15,18 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $$, $, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class AppListCloudPage {
apsAppsContainer = element(by.css('adf-cloud-app-list'));
allApps = element.all(by.css('adf-cloud-app-details'));
nameOfAllApps = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1'));
firstApp = element.all(by.css('adf-cloud-app-details div[class*="item-card-title"] h1')).first();
apsAppsContainer = $('adf-cloud-app-list');
allApps = $$('adf-cloud-app-details');
nameOfAllApps = $$('adf-cloud-app-details div[class*="item-card-title"] h1');
firstApp = $$('adf-cloud-app-details div[class*="item-card-title"] h1').first();
getAppNameLocatorByAppName = (appName: string): ElementFinder => $(`mat-card[title="${appName}"]`);
async checkApsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
@@ -44,12 +46,12 @@ export class AppListCloudPage {
}
async checkAppIsNotDisplayed(applicationName: string): Promise<void> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getAppNameLocatorByAppName(applicationName);
await BrowserVisibility.waitUntilElementIsNotVisible(app);
}
async checkAppIsDisplayed(applicationName: string): Promise<void> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getAppNameLocatorByAppName(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
}

View File

@@ -15,39 +15,39 @@
* limitations under the License.
*/
import { Locator, browser, by, element } from 'protractor';
import { browser, $ } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class EditProcessFilterDialogPage {
componentElement = element(by.css('adf-cloud-process-filter-dialog-cloud'));
title = element(by.id('adf-process-filter-dialog-title'));
filterNameInput = element(by.id('adf-filter-name-id'));
saveButtonLocator: Locator = by.id('adf-save-button-id');
cancelButtonLocator: Locator = by.id('adf-cancel-button-id');
componentElement = $('adf-cloud-process-filter-dialog-cloud');
title = $('#adf-process-filter-dialog-title');
filterNameInput = $('#adf-filter-name-id');
saveButtonLocator = '#adf-save-button-id';
cancelButtonLocator = '#adf-cancel-button-id';
async clickOnSaveButton(): Promise<void> {
const saveButton = this.componentElement.element(this.saveButtonLocator);
const saveButton = this.componentElement.$(this.saveButtonLocator);
await BrowserActions.click(saveButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
await browser.driver.sleep(1000);
}
async checkSaveButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled();
}
async clickOnCancelButton(): Promise<void> {
const cancelButton = this.componentElement.element(this.cancelButtonLocator);
const cancelButton = this.componentElement.$(this.cancelButtonLocator);
await BrowserActions.click(cancelButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
}
async checkCancelButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
return this.componentElement.element(this.cancelButtonLocator).isEnabled();
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.cancelButtonLocator));
return this.componentElement.$(this.cancelButtonLocator).isEnabled();
}
async getFilterName(): Promise<string> {

View File

@@ -15,39 +15,39 @@
* limitations under the License.
*/
import { browser, by, element, Locator } from 'protractor';
import { $, browser } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class EditTaskFilterDialogPage {
componentElement = element(by.css('adf-cloud-task-filter-dialog'));
title = element(by.id('adf-task-filter-dialog-title'));
filterNameInput = element(by.id('adf-filter-name-id'));
saveButtonLocator: Locator = by.id('adf-save-button-id');
cancelButtonLocator: Locator = by.id('adf-cancel-button-id');
componentElement = $('adf-cloud-task-filter-dialog');
title = $('#adf-task-filter-dialog-title');
filterNameInput = $('#adf-filter-name-id');
saveButtonLocator = '#adf-save-button-id';
cancelButtonLocator = '#adf-cancel-button-id';
async clickOnSaveButton(): Promise<void> {
const saveButton = this.componentElement.element(this.saveButtonLocator);
const saveButton = this.componentElement.$(this.saveButtonLocator);
await BrowserActions.click(saveButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
await browser.driver.sleep(1000);
}
async checkSaveButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled();
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.saveButtonLocator));
return this.componentElement.$(this.saveButtonLocator).isEnabled();
}
async clickOnCancelButton(): Promise<void> {
const cancelButton = this.componentElement.element(this.cancelButtonLocator);
const cancelButton = this.componentElement.$(this.cancelButtonLocator);
await BrowserActions.click(cancelButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
}
async checkCancelButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
return this.componentElement.element(this.cancelButtonLocator).isEnabled();
await BrowserVisibility.waitUntilElementIsVisible(this.componentElement.$(this.cancelButtonLocator));
return this.componentElement.$(this.cancelButtonLocator).isEnabled();
}
async getFilterName(): Promise<string> {

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { browser, $$, $ } from 'protractor';
import { EditProcessFilterDialogPage } from './dialog/edit-process-filter-dialog.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -34,26 +34,25 @@ export interface FilterProps {
export class EditProcessFilterCloudComponentPage {
rootElement = element.all(by.css('adf-cloud-edit-process-filter')).first();
customiseFilter = element(by.id('adf-edit-process-filter-sub-title-id'));
saveButton = element(by.css('button[data-automation-id="adf-filter-action-save"]'));
saveAsButton = element(by.css('button[data-automation-id="adf-filter-action-saveAs"]'));
deleteButton = element(by.css('button[data-automation-id="adf-filter-action-delete"]'));
filter = element(by.css(`adf-cloud-edit-process-filter mat-expansion-panel-header`));
rootElement = $$('adf-cloud-edit-process-filter').first();
customiseFilter = $('#adf-edit-process-filter-sub-title-id');
saveButton = $('button[data-automation-id="adf-filter-action-save"]');
saveAsButton = $('button[data-automation-id="adf-filter-action-saveAs"]');
deleteButton = $('button[data-automation-id="adf-filter-action-delete"]');
filter = $(`adf-cloud-edit-process-filter mat-expansion-panel-header`);
private locatorAppNameDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`));
private locatorStatusDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`));
private locatorSortDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`));
private locatorOrderDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`));
private locatorProcessDefinitionNameDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`));
private locatorSuspendedDateRangeDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`));
private locatorStartedDateRangeDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`));
private locatorCompletedDateRangeDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`));
private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-appName']`);
private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-status']`);
private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-sort']`);
private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-order']`);
private locatorProcessDefinitionNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-processDefinitionName']`);
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
private locatorSuspendedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-suspendedDateRange']`);
private locatorStartedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-startedDateRange']`);
private locatorCompletedDateRangeDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-process-property-completedDateRange']`);
private locatorSuspendedDateRangeWithin = element(by.css(`mat-datepicker-toggle[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`));
private expansionPanelExtended = this.rootElement.element(by.css('mat-expansion-panel-header.mat-expanded'));
private content = this.rootElement.element(by.css('div.mat-expansion-panel-content[style*="visible"]'));
private locatorSuspendedDateRangeWithin = $(`mat-datepicker-toggle[data-automation-id='adf-cloud-edit-process-property-date-range-suspendedDateRange']`);
private content = this.rootElement.$('div.mat-expansion-panel-content[style*="visible"]');
appNameDropdown = new DropdownPage(this.locatorAppNameDropdown);
statusDropdown = new DropdownPage(this.locatorStatusDropdown);
@@ -104,7 +103,7 @@ export class EditProcessFilterCloudComponentPage {
}
getStateFilterDropDownValue(): Promise<string> {
return BrowserActions.getText(element(by.css("mat-form-field[data-automation-id='status'] span")));
return BrowserActions.getText($("mat-form-field[data-automation-id='status'] span"));
}
async setSortFilterDropDown(option) {
@@ -112,7 +111,7 @@ export class EditProcessFilterCloudComponentPage {
}
async getSortFilterDropDownValue(): Promise<string> {
const sortLocator = element.all(by.css("mat-form-field[data-automation-id='sort'] span")).first();
const sortLocator = $$("mat-form-field[data-automation-id='sort'] span").first();
return BrowserActions.getText(sortLocator);
}
@@ -122,7 +121,7 @@ export class EditProcessFilterCloudComponentPage {
}
getOrderFilterDropDownValue(): Promise<string> {
return BrowserActions.getText(element(by.css("mat-form-field[data-automation-id='order'] span")));
return BrowserActions.getText($("mat-form-field[data-automation-id='order'] span"));
}
async setAppNameDropDown(option: string) {
@@ -151,12 +150,12 @@ export class EditProcessFilterCloudComponentPage {
}
async getApplicationSelected(): Promise<string> {
const applicationDropdown = element(by.css(`[data-automation-id='adf-cloud-edit-process-property-appName']`));
const applicationDropdown = $(`[data-automation-id='adf-cloud-edit-process-property-appName']`);
return applicationDropdown.getText();
}
async checkAppNamesAreUnique(): Promise<boolean> {
const appNameList = element.all(by.css('mat-option[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span'));
const appNameList = $$('mat-option[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span');
const appTextList: any = await appNameList.getText();
const uniqueArray = appTextList.filter((appName) => {
const sameAppNameArray = appTextList.filter((eachApp) => eachApp === appName);
@@ -171,7 +170,7 @@ export class EditProcessFilterCloudComponentPage {
}
isApplicationListLoaded(): Promise<boolean> {
const emptyList = element(by.css(`[data-automation-id='adf-cloud-edit-process-property-appName'] .mat-select-placeholder`));
const emptyList = $(`[data-automation-id='adf-cloud-edit-process-property-appName'] .mat-select-placeholder`);
return BrowserVisibility.waitUntilElementIsNotVisible(emptyList);
}
@@ -196,12 +195,12 @@ export class EditProcessFilterCloudComponentPage {
}
async getProperty(property: string): Promise<string> {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
const locator = $$('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]').first();
return BrowserActions.getInputValue(locator);
}
async setProperty(property: string, option: string) {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
async setProperty(property: string, option: string): Promise<void> {
const locator = $$('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]').first();
await BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserActions.clearSendKeys(locator, option);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element, protractor, ElementFinder } from 'protractor';
import { browser, protractor, ElementFinder, $$, $ } from 'protractor';
import { EditTaskFilterDialogPage } from './dialog/edit-task-filter-dialog.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -28,31 +28,31 @@ export type StatusType = 'All' | 'Created' | 'Assigned' | 'Cancelled' | 'Suspend
export class EditTaskFilterCloudComponentPage {
rootElement = element.all(by.css('adf-cloud-edit-task-filter')).first();
customiseFilter = element(by.id('adf-edit-task-filter-sub-title-id'));
assignee = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-assignee"]'));
priority = element(by.css('[data-automation-id="adf-cloud-edit-task-property-priority"]'));
taskName = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskName"]'));
id = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskId"]'));
processDefinitionId = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-processDefinitionId"]'));
processInstanceId = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]'));
lastModifiedFrom = element(by.css('input[data-placeholder="LastModifiedFrom"]'));
lastModifiedTo = element(by.css('input[data-placeholder="LastModifiedTo"]'));
parentTaskId = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-parentTaskId"]'));
owner = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-owner"]'));
saveButton = element(by.css('[data-automation-id="adf-filter-action-save"]'));
saveAsButton = element(by.css('[data-automation-id="adf-filter-action-saveAs"]'));
deleteButton = element(by.css('[data-automation-id="adf-filter-action-delete"]'));
filter = element(by.css(`adf-cloud-edit-task-filter mat-expansion-panel-header`));
rootElement = $$('adf-cloud-edit-task-filter').first();
customiseFilter = $('#adf-edit-task-filter-sub-title-id');
assignee = $('input[data-automation-id="adf-cloud-edit-task-property-assignee"]');
priority = $('[data-automation-id="adf-cloud-edit-task-property-priority"]');
taskName = $('input[data-automation-id="adf-cloud-edit-task-property-taskName"]');
id = $('input[data-automation-id="adf-cloud-edit-task-property-taskId"]');
processDefinitionId = $('input[data-automation-id="adf-cloud-edit-task-property-processDefinitionId"]');
processInstanceId = $('input[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]');
lastModifiedFrom = $('input[data-placeholder="LastModifiedFrom"]');
lastModifiedTo = $('input[data-placeholder="LastModifiedTo"]');
parentTaskId = $('input[data-automation-id="adf-cloud-edit-task-property-parentTaskId"]');
owner = $('input[data-automation-id="adf-cloud-edit-task-property-owner"]');
saveButton = $('[data-automation-id="adf-filter-action-save"]');
saveAsButton = $('[data-automation-id="adf-filter-action-saveAs"]');
deleteButton = $('[data-automation-id="adf-filter-action-delete"]');
filter = $(`adf-cloud-edit-task-filter mat-expansion-panel-header`);
private locatorAppNameDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`));
private locatorStatusDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`));
private locatorSortDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`));
private locatorOrderDropdown = element(by.css(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`));
private locatorCompletedDateDropdown = element(by.css(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`));
private locatorAssignmentDropdown = element(by.css(`.adf-task-assignment-filter`));
private expansionPanelExtended = this.rootElement.element(by.css('mat-expansion-panel-header.mat-expanded'));
private content = this.rootElement.element(by.css('div.mat-expansion-panel-content[style*="visible"]'));
private locatorAppNameDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-appName']`);
private locatorStatusDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-status']`);
private locatorSortDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-sort']`);
private locatorOrderDropdown = $(`mat-select[data-automation-id='adf-cloud-edit-task-property-order']`);
private locatorCompletedDateDropdown = $(`mat-select[data-automation-id="adf-cloud-edit-process-property-completedDateRange"]`);
private locatorAssignmentDropdown = $(`.adf-task-assignment-filter`);
private expansionPanelExtended = this.rootElement.$('mat-expansion-panel-header.mat-expanded');
private content = this.rootElement.$('div.mat-expansion-panel-content[style*="visible"]');
appNameDropdown = new DropdownPage(this.locatorAppNameDropdown);
statusDropdown = new DropdownPage(this.locatorStatusDropdown);
@@ -66,7 +66,7 @@ export class EditTaskFilterCloudComponentPage {
peopleCloudComponent = new PeopleCloudComponentPage();
groupCloudComponent = new GroupCloudComponentPage();
dataTable = new DataTableComponentPage( element(by.css('adf-cloud-task-list')));
dataTable = new DataTableComponentPage( $('adf-cloud-task-list'));
editTaskFilterDialog(): EditTaskFilterDialogPage {
return this.editTaskFilterDialogPage;
@@ -275,7 +275,7 @@ export class EditTaskFilterCloudComponentPage {
}
async setProperty(property: string, option: string): Promise<void> {
const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]'));
const locator = $('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]');
await BrowserVisibility.waitUntilElementIsVisible(locator);
await locator.clear();
await locator.sendKeys(option);

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { ConfigEditorPage } from '../../core/pages/config-editor-page';
export class FormCloudComponentPage {
formCloudEditor = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1);
formCloudRender = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0);
formCloudEditor = $$('.mat-tab-list .mat-tab-label').get(1);
formCloudRender = $$('.mat-tab-list .mat-tab-label').get(0);
configEditorPage = new ConfigEditorPage();
@@ -36,8 +36,8 @@ export class FormCloudComponentPage {
}
async setConfigToEditor(text): Promise<void> {
const configEditor = element(by.id('adf-form-config-editor'));
const form = element(by.css('adf-cloud-form'));
const configEditor = $('#adf-form-config-editor');
const form = $('adf-cloud-form');
await this.goToEditor();
await BrowserVisibility.waitUntilElementIsVisible(configEditor);
await this.configEditorPage.enterBulkConfiguration(text);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder, browser } from 'protractor';
import { by, ElementFinder, browser, $ } from 'protractor';
import { BrowserActions } from '../../../../core/utils/browser-actions';
import { Logger } from '../../../../core/utils/logger';
import { BrowserVisibility } from '../../../../core/utils/browser-visibility';
@@ -23,33 +23,37 @@ import { BrowserVisibility } from '../../../../core/utils/browser-visibility';
export class AttachFileWidgetCloudPage {
widget: ElementFinder;
filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]');
constructor(fieldId: string) {
this.assignWidget(fieldId);
}
getFileAttachedLocatorByContainingText = async(text: string): Promise<ElementFinder> => {
const filesListLocator = 'div[id="adf-attach-widget-readonly-list"]';
return this.widget.$(filesListLocator).element(by.cssContainingText('mat-list-item span ', text));
}
assignWidget(fieldId: string): void {
this.widget = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
this.widget = $(`adf-form-field div[id='field-${fieldId}-container']`);
}
async clickAttachContentFile(fileId: string): Promise<void> {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
const uploadButton = this.widget.$(`button[id=${fileId}]`);
await BrowserActions.click(uploadButton);
}
async checkUploadContentButtonIsDisplayed(fileId: string): Promise<void> {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
const uploadButton = this.widget.$(`button[id=${fileId}]`);
await BrowserVisibility.waitUntilElementIsVisible(uploadButton);
}
async checkUploadContentButtonIsNotDisplayed(fileId: string): Promise<void> {
const uploadButton = this.widget.element(by.css(`button[id=${fileId}]`));
const uploadButton = this.widget.$(`button[id=${fileId}]`);
await BrowserVisibility.waitUntilElementIsNotVisible(uploadButton);
}
async checkFileIsAttached(name): Promise<void> {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileAttached = await this.getFileAttachedLocatorByContainingText(name);
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
@@ -60,12 +64,12 @@ export class AttachFileWidgetCloudPage {
}
async checkFileIsNotAttached(name): Promise<void> {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileAttached = await this.getFileAttachedLocatorByContainingText(name);
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
}
async getFileId(name: string): Promise<string> {
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileAttached = await this.getFileAttachedLocatorByContainingText(name);
return BrowserActions.getAttribute(fileAttached, 'id');
}
@@ -74,11 +78,11 @@ export class AttachFileWidgetCloudPage {
await BrowserActions.closeMenuAndDialogs();
const fileId = await this.getFileId(fileName);
Logger.info(`FileId ${fileId}`);
const optionMenu = this.widget.element(by.css(`button[id='${fileId}-option-menu']`));
const optionMenu = this.widget.$(`button[id='${fileId}-option-menu']`);
await BrowserActions.click(optionMenu);
await BrowserActions.waitUntilActionMenuIsVisible();
await browser.waitForAngular();
const actionButton = element(by.css(`button#${fileId}-${actionName}`));
const actionButton = $(`button#${fileId}-${actionName}`);
await BrowserActions.click(actionButton);
await BrowserVisibility.waitUntilElementIsNotVisible(actionButton);
await browser.waitForAngular();

View File

@@ -15,16 +15,19 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, $, ElementFinder, $$ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/form-fields';
export class GroupCloudComponentPage {
groupCloudSearch = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]'));
groupCloudSearch = $('input[data-automation-id="adf-cloud-group-search-input"]');
groupField = $('group-cloud-widget .adf-readonly');
formFields = new FormFields();
getGroupRowLocatorByName = async (name: string): Promise<ElementFinder> => $$(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`).first();
async searchGroups(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.groupCloudSearch, name);
}
@@ -38,19 +41,19 @@ export class GroupCloudComponentPage {
}
async selectGroupFromList(name: string): Promise<void> {
const groupRow = element.all(by.css(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`)).first();
const groupRow = await this.getGroupRowLocatorByName(name);
await BrowserActions.click(groupRow);
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
}
async checkGroupIsDisplayed(name: string): Promise<void> {
const groupRow = element.all(by.css(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`)).first();
const groupRow = await this.getGroupRowLocatorByName(name);
await BrowserVisibility.waitUntilElementIsVisible(groupRow);
}
async checkGroupIsNotDisplayed(name: string): Promise<void> {
const groupRow = element.all(by.css(`mat-option[data-automation-id="adf-cloud-group-chip-${name}"]`)).first();
const groupRow = await this.getGroupRowLocatorByName(name);
await BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
}
@@ -63,7 +66,7 @@ export class GroupCloudComponentPage {
}
async removeSelectedGroup(group: string): Promise<void> {
const locator = element(by.css(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`));
const locator = $(`mat-chip[data-automation-id*="adf-cloud-group-chip-${group}"] mat-icon`);
await BrowserActions.click(locator);
}
@@ -77,9 +80,8 @@ export class GroupCloudComponentPage {
}
async checkGroupWidgetIsReadOnly (): Promise <boolean> {
const readOnlyGroup = element(by.css('group-cloud-widget .adf-readonly'));
try {
await BrowserVisibility.waitUntilElementIsVisible(readOnlyGroup);
await BrowserVisibility.waitUntilElementIsVisible(this.groupField);
return true;
} catch {
return false;
@@ -87,9 +89,8 @@ export class GroupCloudComponentPage {
}
async checkGroupActiveField(name: string): Promise <boolean> {
const activeGroupField = element(by.css('group-cloud-widget .adf-readonly'));
try {
await BrowserActions.clearSendKeys(activeGroupField, name);
await BrowserActions.clearSendKeys(this.groupField, name);
return true;
} catch {
return false;
@@ -97,7 +98,7 @@ export class GroupCloudComponentPage {
}
async checkNoResultsFoundError(): Promise<void> {
const errorLocator = element(by.css('[data-automation-id="adf-cloud-group-no-results"]'));
const errorLocator = $('[data-automation-id="adf-cloud-group-no-results"]');
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
}

View File

@@ -15,21 +15,23 @@
* limitations under the License.
*/
import { Locator, by, element, protractor } from 'protractor';
import { Locator, by, element, protractor, $, $$, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/form-fields';
export class PeopleCloudComponentPage {
peopleCloudSearch = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
assigneeField = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
selectionReady = element(by.css('div[data-automation-id="adf-people-cloud-row"]'));
peopleCloudSearch = $('input[data-automation-id="adf-people-cloud-search-input"]');
assigneeField = $('input[data-automation-id="adf-people-cloud-search-input"]');
selectionReady = $('div[data-automation-id="adf-people-cloud-row"]');
formFields = new FormFields();
labelLocator: Locator = by.css("label[class*='adf-label']");
inputLocator: Locator = by.css('input');
assigneeChipList = element(by.css('mat-chip-list[data-automation-id="adf-cloud-people-chip-list"]'));
noOfUsersDisplayed = element.all(by.css('mat-option span.adf-people-label-name'));
assigneeChipList = $('mat-chip-list[data-automation-id="adf-cloud-people-chip-list"]');
noOfUsersDisplayed = $$('mat-option span.adf-people-label-name');
getAssigneeRowLocatorByContainingName = async (name: string): Promise<ElementFinder> => element.all(by.cssContainingText('mat-option span.adf-people-label-name', name)).first();
async clearAssignee(): Promise<void> {
await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' ');
@@ -37,7 +39,7 @@ export class PeopleCloudComponentPage {
}
async clearAssigneeFromChip(username: string): Promise<void> {
const assigneeChipRemoveIcon = element(by.css(`[data-automation-id="adf-people-cloud-chip-remove-icon-${username}"]`));
const assigneeChipRemoveIcon = $(`[data-automation-id="adf-people-cloud-chip-remove-icon-${username}"]`);
await assigneeChipRemoveIcon.click();
}
@@ -51,7 +53,7 @@ export class PeopleCloudComponentPage {
}
async selectAssigneeFromList(name: string): Promise<void> {
const assigneeRow = element.all(by.cssContainingText('mat-option span.adf-people-label-name', name)).first();
const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name);
await BrowserActions.click(assigneeRow);
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
}
@@ -72,7 +74,7 @@ export class PeopleCloudComponentPage {
async checkUserIsDisplayed(name: string): Promise<boolean> {
try {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name);
await BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
return true;
} catch {
@@ -82,7 +84,7 @@ export class PeopleCloudComponentPage {
async checkUserIsNotDisplayed(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.selectionReady);
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
const assigneeRow = await this.getAssigneeRowLocatorByContainingName(name);
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
}
@@ -91,12 +93,12 @@ export class PeopleCloudComponentPage {
}
async checkOptionIsDisplayed(): Promise<void> {
const optionList = element(by.css('.adf-people-cloud-list'));
const optionList = $('.adf-people-cloud-list');
await BrowserVisibility.waitUntilElementIsVisible(optionList);
}
async checkOptionIsNotDisplayed(): Promise<void> {
const optionList = element(by.css('.adf-people-cloud-list'));
const optionList = $('.adf-people-cloud-list');
await BrowserVisibility.waitUntilElementIsNotVisible(optionList);
}
@@ -126,7 +128,7 @@ export class PeopleCloudComponentPage {
}
async checkPeopleWidgetIsHidden(fieldId: string): Promise<boolean> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`);
try {
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement);
return true;
@@ -141,7 +143,7 @@ export class PeopleCloudComponentPage {
}
async checkPeopleWidgetIsReadOnly(): Promise<boolean> {
const readOnlyAttribute = element(by.css('people-cloud-widget .adf-readonly'));
const readOnlyAttribute = $('people-cloud-widget .adf-readonly');
try {
await BrowserVisibility.waitUntilElementIsVisible(readOnlyAttribute);
return true;
@@ -151,7 +153,7 @@ export class PeopleCloudComponentPage {
}
async checkPeopleActiveField(name: string): Promise<boolean> {
const activePeopleField = element(by.css('people-cloud-widget .adf-readonly'));
const activePeopleField = $('people-cloud-widget .adf-readonly');
try {
await BrowserActions.clearSendKeys(activePeopleField, name);
return true;
@@ -161,7 +163,7 @@ export class PeopleCloudComponentPage {
}
async checkNoResultsFoundError(): Promise<void> {
const errorLocator = element(by.css('[data-automation-id="adf-people-cloud-no-results"]'));
const errorLocator = $('[data-automation-id="adf-people-cloud-no-results"]');
await BrowserVisibility.waitUntilElementIsVisible(errorLocator);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, by, element, ElementFinder } from 'protractor';
import { ElementFinder, $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -27,12 +27,11 @@ const FILTERS = {
export class ProcessFiltersCloudComponentPage {
filterIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]');
processFilters = $("mat-expansion-panel[data-automation-id='Process Filters']");
activeFilter = $('.adf-active [data-automation-id="adf-filter-label"]');
processFiltersList = $('adf-cloud-process-filters');
processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
activeFilter = element(by.css('.adf-active [data-automation-id="adf-filter-label"]'));
processFiltersList = element(by.css('adf-cloud-process-filters'));
getProcessFilterLocatorByFilterName = (filterName: string): ElementFinder => $(`button[data-automation-id="${filterName}_filter"]`);
async checkProcessFilterIsDisplayed(filterName: string): Promise<void> {
const filter = this.getProcessFilterLocatorByFilterName(filterName);
@@ -91,8 +90,4 @@ export class ProcessFiltersCloudComponentPage {
async isProcessFiltersListVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processFiltersList);
}
getProcessFilterLocatorByFilterName(filterName: string): ElementFinder {
return element(by.css(`button[data-automation-id="${filterName}_filter"]`));
}
}

View File

@@ -15,19 +15,19 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $, $$ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class ProcessHeaderCloudPage {
idField = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first();
nameField = element.all(by.css('[data-automation-id="card-textitem-value-name"]')).first();
statusField = element(by.css('[data-automation-id="card-textitem-value-status"]'));
initiatorField = element(by.css('[data-automation-id="card-textitem-value-initiator"]'));
startDateField = element.all(by.css('span[data-automation-id*="startDate"] span')).first();
lastModifiedField = element.all(by.css('span[data-automation-id*="lastModified"] span')).first();
parentIdField = element(by.css('[data-automation-id="card-textitem-value-parentId"]'));
businessKeyField = element(by.css('[data-automation-id="card-textitem-value-businessKey"]'));
idField = $$('[data-automation-id="card-textitem-value-id"]').first();
nameField = $$('[data-automation-id="card-textitem-value-name"]').first();
statusField = $('[data-automation-id="card-textitem-value-status"]');
initiatorField = $('[data-automation-id="card-textitem-value-initiator"]');
startDateField = $$('span[data-automation-id*="startDate"] span').first();
lastModifiedField = $$('span[data-automation-id*="lastModified"] span').first();
parentIdField = $('[data-automation-id="card-textitem-value-parentId"]');
businessKeyField = $('[data-automation-id="card-textitem-value-businessKey"]');
async getId(): Promise<string> {
return BrowserActions.getInputValue(this.idField);

View File

@@ -17,7 +17,7 @@
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { Locator, element, by, browser } from 'protractor';
import { browser, $, $$ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class ProcessListCloudComponentPage {
@@ -28,10 +28,10 @@ export class ProcessListCloudComponentPage {
processDefinitionName: 'Process Definition Name'
};
processList = element(by.css('adf-cloud-process-list'));
noProcessFound = element.all(by.css('.adf-empty-content__title')).first();
actionMenu = element(by.css('*[role="menu"]'));
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
processList = $('adf-cloud-process-list');
noProcessFound = $$('.adf-empty-content__title').first();
actionMenu = $('*[role="menu"]');
optionButton = 'button[data-automation-id*="action_menu_"]';
dataTable = new DataTableComponentPage(this.processList);
@@ -111,17 +111,17 @@ export class ProcessListCloudComponentPage {
await BrowserActions.closeMenuAndDialogs();
const row = this.dataTable.getRow('Id', content);
await browser.sleep(1000);
await BrowserActions.click(row.element(this.optionButton));
await BrowserActions.click(row.$(this.optionButton));
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
}
async clickOnCustomActionMenu(action: string): Promise<void> {
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
const actionButton = $(`button[data-automation-id*="${action}"]`);
await BrowserActions.click(actionButton);
}
async isCustomActionEnabled(action: string): Promise<boolean> {
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
const actionButton = $(`button[data-automation-id*="${action}"]`);
return actionButton.isEnabled();
}
@@ -134,7 +134,7 @@ export class ProcessListCloudComponentPage {
}
async getNumberOfOptions(): Promise<number> {
const options = await this.actionMenu.all(by.css(`button`));
const options = await this.actionMenu.$$(`button`);
return options.length;
}

View File

@@ -15,23 +15,25 @@
* limitations under the License.
*/
import { by, element, Key, protractor, browser, ElementFinder } from 'protractor';
import { by, element, Key, protractor, browser, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/form-fields';
export class StartProcessCloudPage {
defaultProcessName = element(by.css('input[id="processName"]'));
processNameInput = element(by.id('processName'));
selectProcessDropdownArrow = element(by.css('button[id="adf-select-process-dropdown"]'));
cancelProcessButton = element(by.id('cancel_process'));
formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]'));
startProcessButton = element(by.css('button[data-automation-id="btn-start"]'));
startProcessButtonDisabled = element(by.css('button[data-automation-id="btn-start"][disabled]'));
noProcess = element(by.id('no-process-message'));
processDefinition = element(by.css('input[id="processDefinitionName"]'));
processDefinitionOptionsPanel = element(by.css('div[class*="processDefinitionOptions"]'));
defaultProcessName = $('input[id="processName"]');
processNameInput = $('#processName');
selectProcessDropdownArrow = $('button[id="adf-select-process-dropdown"]');
cancelProcessButton = $('#cancel_process');
formStartProcessButton = $('button[data-automation-id="adf-form-start process"]');
startProcessButton = $('button[data-automation-id="btn-start"]');
startProcessButtonDisabled = $('button[data-automation-id="btn-start"][disabled]');
noProcess = $('#no-process-message');
processDefinition = $('input[id="processDefinitionName"]');
processDefinitionOptionsPanel = $('div[class*="processDefinitionOptions"]');
getSelectProcessDropdownLocatorByName = (name: string): ElementFinder => element(by.cssContainingText('.mat-option-text', name));
async checkNoProcessMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
@@ -61,7 +63,7 @@ export class StartProcessCloudPage {
async selectFirstOptionFromProcessDropdown(): Promise<void> {
await this.clickProcessDropdownArrow();
const selectFirstProcessDropdown = element.all(by.css('.mat-option-text')).first();
const selectFirstProcessDropdown = $$('.mat-option-text').first();
await BrowserActions.click(selectFirstProcessDropdown);
}
@@ -70,13 +72,13 @@ export class StartProcessCloudPage {
}
async checkOptionIsDisplayed(name: string): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
const selectProcessDropdown = this.getSelectProcessDropdownLocatorByName(name);
await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
}
async selectOption(name: string): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
const selectProcessDropdown = this.getSelectProcessDropdownLocatorByName(name);
await BrowserActions.click(selectProcessDropdown);
}

View File

@@ -15,23 +15,23 @@
* limitations under the License.
*/
import { element, by, Key, ElementFinder } from 'protractor';
import { element, by, Key, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { DropdownPage } from '../../core/pages/material/dropdown.page';
export class StartTasksCloudPage {
name = element(by.css('input[id="name_id"]'));
dueDate = element(by.css('input[id="date_id"]'));
description = element(by.css('textarea[id="description_id"]'));
priority = element(by.css('mat-select[formcontrolname="priority"]'));
startButton = element(by.css('button[id="button-start"]'));
startButtonEnabled = element(by.css('button[id="button-start"]:not(disabled)'));
cancelButton = element(by.css('button[id="button-cancel"]'));
form = element.all(by.css('adf-cloud-start-task form')).first();
formDefinitionSelector = element(by.css('.adf-form-definition-selector'));
priorityStartTaskField = element(by.css('input[formControlName="priority"]'));
name = $('input[id="name_id"]');
dueDate = $('input[id="date_id"]');
description = $('textarea[id="description_id"]');
priority = $('mat-select[formcontrolname="priority"]');
startButton = $('button[id="button-start"]');
startButtonEnabled = $('button[id="button-start"]:not(disabled)');
cancelButton = $('button[id="button-cancel"]');
form = $$('adf-cloud-start-task form').first();
formDefinitionSelector = $('.adf-form-definition-selector');
priorityStartTaskField = $('input[formControlName="priority"]');
async checkFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.form);
@@ -65,7 +65,7 @@ export class StartTasksCloudPage {
}
async checkStartButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled')));
await BrowserVisibility.waitUntilElementIsVisible($('button[id="button-start"]:disabled'));
}
async clickCancelButton(): Promise<void> {

View File

@@ -15,29 +15,32 @@
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class TaskFiltersCloudComponentPage {
filter: ElementFinder;
taskFilters = element(by.css(`mat-expansion-panel[data-automation-id='Task Filters']`));
activeFilter = element(by.css('.adf-active [data-automation-id="adf-filter-label"]'));
taskFilters = $(`mat-expansion-panel[data-automation-id='Task Filters']`);
activeFilter = $('.adf-active [data-automation-id="adf-filter-label"]');
getTaskFilterLocatorByFilterName = async (filterName: string): Promise<ElementFinder> => $$(`button[data-automation-id="${filterName}_filter"]`).first();
getFilterCounterLocatorByFilterName = async (filterName: string): Promise<ElementFinder> => $$(`[data-automation-id="${filterName}_filter-counter"]`).first();
async checkTaskFilterIsDisplayed(filterName: string): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName);
this.filter = await this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
}
async clickTaskFilter(filterName): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName);
this.filter = await this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
await BrowserActions.click(this.filter);
}
async checkTaskFilterNotDisplayed(filterName: string): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName);
this.filter = await this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
}
@@ -50,22 +53,19 @@ export class TaskFiltersCloudComponentPage {
}
async getTaskFilterCounter(filterName: string): Promise<string> {
const filterCounter = element.all(by.css(`[data-automation-id="${filterName}_filter-counter"]`)).first();
const filterCounter = await this.getFilterCounterLocatorByFilterName(filterName);
return BrowserActions.getText(filterCounter);
}
async checkTaskFilterCounter(filterName: string): Promise<void> {
const filterCounter = element.all(by.css(`[data-automation-id="${filterName}_filter-counter"]`)).first();
const filterCounter = await this.getFilterCounterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementHasText(filterCounter, '0');
}
async checkNotificationCounterValue(filterName: string, counterValue: string): Promise<void> {
const filterCounter = element(by.css(`[data-automation-id="${filterName}_filter-counter"][class*="adf-active"]`));
const filterCounter = $(`[data-automation-id="${filterName}_filter-counter"][class*="adf-active"]`);
await BrowserVisibility.waitUntilElementIsVisible(filterCounter);
await BrowserVisibility.waitUntilElementHasText(filterCounter, counterValue);
}
getTaskFilterLocatorByFilterName(filterName: string): ElementFinder {
return element.all(by.css(`button[data-automation-id="${filterName}_filter"]`)).first();
}
}

View File

@@ -15,24 +15,26 @@
* limitations under the License.
*/
import { element, by, ElementFinder, browser } from 'protractor';
import { ElementFinder, browser, $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/form-fields';
export class TaskFormCloudComponent {
cancelButton = element(by.css('button[id="adf-cloud-cancel-task"]'));
completeButton = element(by.css('button[id="adf-form-complete"]'));
releaseButton = element(by.css('button[adf-cloud-unclaim-task]'));
saveButton = element(by.css('button[id="adf-form-save"]'));
claimButton = element(by.css('button[adf-cloud-claim-task]'));
form = element(by.css('adf-cloud-form'));
formTitle = element(by.css(`span.adf-form-title`));
emptyContentIcon = element(by.css(`div.adf-empty-content adf-icon.adf-empty-content__icon`));
emptyContentTitle = element(by.css(`div.adf-empty-content div.adf-empty-content__title`));
emptyContentSubtitle = element(by.css(`div.adf-empty-content div.adf-empty-content__subtitle`));
readOnlyForm = element(by.css('div[class="adf-readonly-form"]'));
cancelButton = $('button[id="adf-cloud-cancel-task"]');
completeButton = $('button[id="adf-form-complete"]');
releaseButton = $('button[adf-cloud-unclaim-task]');
saveButton = $('button[id="adf-form-save"]');
claimButton = $('button[adf-cloud-claim-task]');
form = $('adf-cloud-form');
formTitle = $(`span.adf-form-title`);
emptyContentIcon = $(`div.adf-empty-content adf-icon.adf-empty-content__icon`);
emptyContentTitle = $(`div.adf-empty-content div.adf-empty-content__title`);
emptyContentSubtitle = $(`div.adf-empty-content div.adf-empty-content__subtitle`);
readOnlyForm = $('div[class="adf-readonly-form"]');
getButtonLocatorByName = (name: string): ElementFinder => $(`button[id="adf-form-${name}"]`);
async isCompleteButtonEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
@@ -86,15 +88,15 @@ export class TaskFormCloudComponent {
}
async checkFormOutcomeButtonIsDisplayedByName(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`button[id="adf-form-${name}"]`)));
await BrowserVisibility.waitUntilElementIsVisible(this.getButtonLocatorByName(name));
}
async checkFormOutcomeButtonIsNotDisplayedByName(name: string) {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`button[id="adf-form-${name}"]`)));
await BrowserVisibility.waitUntilElementIsNotVisible(this.getButtonLocatorByName(name));
}
async clickFormOutcomeButtonByName(name: string): Promise<void> {
await BrowserActions.click(element(by.css(`button[id="adf-form-${name}"]`)));
await BrowserActions.click(this.getButtonLocatorByName(name));
}
async clickCancelButton(): Promise<void> {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { CardTextItemPage } from '../../core/pages/card-view/card-view-text-item.page';
@@ -26,15 +26,15 @@ export class TaskHeaderCloudPage {
assigneeCardTextItem = new CardTextItemPage('assignee');
statusCardTextItem = new CardTextItemPage('status');
priorityCardSelectItem = new CardSelectItemPage('priority');
dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
dueDateField = $$('span[data-automation-id*="dueDate"] span').first();
categoryCardTextItem = new CardTextItemPage('category');
createdField = element(by.css('span[data-automation-id="card-dateitem-created"]'));
createdField = $('span[data-automation-id="card-dateitem-created"]');
parentNameCardTextItem = new CardTextItemPage('parentName');
parentTaskIdCardTextItem = new CardTextItemPage('parentTaskId');
endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
endDateField = $$('span[data-automation-id*="endDate"] span').first();
idCardTextItem = new CardTextItemPage('id');
descriptionCardTextItem = new CardTextItemPage('description');
taskPropertyList = element(by.css('adf-cloud-task-header adf-card-view .adf-property-list'));
taskPropertyList = $('adf-cloud-task-header adf-card-view .adf-property-list');
async getAssignee(): Promise<string> {
return this.assigneeCardTextItem.getFieldValue();

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, ElementFinder, Locator } from 'protractor';
import { by, ElementFinder, $$, $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
const column = {
@@ -34,13 +34,14 @@ const column = {
export class TaskListCloudComponentPage {
taskList = element(by.css('adf-cloud-task-list'));
noTasksFound = element.all(by.css('.adf-empty-content__title')).first();
actionMenu = element(by.css('*[role="menu"]'));
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
taskList = $('adf-cloud-task-list');
noTasksFound = $$('.adf-empty-content__title').first();
actionMenu = $('*[role="menu"]');
optionButton = 'button[data-automation-id*="action_menu_"]';
dataTable = new DataTableComponentPage(this.taskList);
getButtonLocatorByAction = (action: string): ElementFinder => $(`button[data-automation-id*="${action}"]`);
getDataTable(): DataTableComponentPage {
return this.dataTable;
}
@@ -174,17 +175,17 @@ export class TaskListCloudComponentPage {
async clickOptionsButton(content: string) {
await BrowserActions.closeMenuAndDialogs();
const row = this.dataTable.getRow('Id', content);
await BrowserActions.click(row.element(this.optionButton));
await BrowserActions.click(row.$(this.optionButton));
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
}
async clickOnCustomActionMenu(action: string): Promise<void> {
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
const actionButton = this.getButtonLocatorByAction(action);
await BrowserActions.click(actionButton);
}
async isCustomActionEnabled(action: string): Promise<boolean> {
const actionButton = element(by.css(`button[data-automation-id*="${action}"]`));
const actionButton = this.getButtonLocatorByAction(action);
return actionButton.isEnabled();
}

View File

@@ -15,27 +15,27 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { ContentNodeSelectorDialogPage } from '../../content-services/dialog/content-node-selector-dialog.page';
import { DocumentListPage } from '../../content-services/pages/document-list.page';
import { Logger } from '../../core/utils/logger';
export class ExternalNodeSelectorDialogPage extends ContentNodeSelectorDialogPage {
txtUsername = element(by.css('input[id="username"]'));
txtPassword = element(by.css('input[id="password"]'));
loginElement = element(by.css('[data-automation-id="attach-file-dialog-actions-login"]'));
title = element(by.css('[data-automation-id="content-node-selector-title"]'));
txtUsername = $('input[id="username"]');
txtPassword = $('input[id="password"]');
loginElement = $('[data-automation-id="attach-file-dialog-actions-login"]');
title = $('[data-automation-id="content-node-selector-title"]');
constructor() {
super();
this.dialog = element(by.css(`adf-content-node-selector-panel`));
this.dialog = $(`adf-content-node-selector-panel`);
this.contentList = new DocumentListPage(this.dialog);
this.dataTable = this.contentList.dataTablePage();
this.header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`));
this.searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`));
this.selectedRow = this.dialog.element(by.css(`adf-datatable-row[class*="adf-is-selected"]`));
this.moveCopyButton = element(by.css(`button[data-automation-id="attach-file-dialog-actions-choose"]`));
this.header = this.dialog.$(`header[data-automation-id='content-node-selector-title']`);
this.searchInputElement = this.dialog.$(`input[data-automation-id='content-node-selector-search-input']`);
this.selectedRow = this.dialog.$(`adf-datatable-row[class*="adf-is-selected"]`);
this.moveCopyButton = $(`button[data-automation-id="attach-file-dialog-actions-choose"]`);
}
async getTitle(): Promise<string> {

View File

@@ -17,13 +17,16 @@
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { Locator, by, element, ElementFinder } from 'protractor';
import { ElementFinder, $ } from 'protractor';
export class FiltersPage {
accordionMenu = element(by.css('.app-processes-menu mat-accordion'));
buttonWindow = element(by.css('div > button[data-automation-id="btn-start-process"] > div'));
processIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]');
accordionMenu = $('.app-processes-menu mat-accordion');
buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div');
processIcon = 'adf-icon[data-automation-id="adf-filter-icon"]';
getLocatorForFilterByName = (name: string): ElementFinder => $(`[data-automation-id='${name}_filter']`);
getLocatorForActiveFilterByName = (name: string): ElementFinder => $(`.adf-active [data-automation-id='${name}_filter']`);
async clickFilterButton(filterElement: ElementFinder): Promise<void> {
await BrowserActions.click(filterElement);
@@ -34,7 +37,7 @@ export class FiltersPage {
}
async isFilterHighlighted(filterName: string): Promise<boolean> {
const filterNameHighlighted = element(by.css(`.adf-active [data-automation-id='${filterName}_filter']`));
const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName);
try {
await BrowserVisibility.waitUntilElementIsVisible(filterNameHighlighted);
return true;
@@ -44,7 +47,7 @@ export class FiltersPage {
}
async isFilterNotHighlighted(filterName: string): Promise<boolean> {
const filterNameHighlighted = element(by.css(`.adf-active [data-automation-id='${filterName}_filter']`));
const filterNameHighlighted = await this.getLocatorForActiveFilterByName(filterName);
try {
await BrowserVisibility.waitUntilElementIsNotVisible(filterNameHighlighted);
return true;
@@ -54,7 +57,7 @@ export class FiltersPage {
}
async isFilterDisplayed(name: string): Promise<boolean> {
const filterName = element(by.css(`[data-automation-id='${name}_filter']`));
const filterName = this.getLocatorForFilterByName(name);
try {
await BrowserVisibility.waitUntilElementIsVisible(filterName);
return true;
@@ -64,15 +67,15 @@ export class FiltersPage {
}
async checkFilterHasNoIcon(name: string): Promise<void> {
const filterName = element(by.css(`[data-automation-id='${name}_filter']`));
const filterName = this.getLocatorForFilterByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.element(this.processIcon));
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.$(this.processIcon));
}
async getFilterIcon(name: string): Promise<string> {
const filterName = element(by.css(`[data-automation-id='${name}_filter']`));
const filterName = this.getLocatorForFilterByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
const icon = filterName.element(this.processIcon);
const icon = filterName.$(this.processIcon);
return BrowserActions.getText(icon);
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { FiltersPage } from './filters.page';
export class ProcessFiltersPage {
@@ -27,10 +27,10 @@ export class ProcessFiltersPage {
filtersPage = new FiltersPage();
runningFilter = element(by.css('button[data-automation-id="Running_filter"]'));
completedFilter = element(by.css('button[data-automation-id="Completed_filter"]'));
allFilter = element(by.css('button[data-automation-id="All_filter"]'));
accordionMenu = element(by.css('.app-processes-menu mat-accordion'));
runningFilter = $('button[data-automation-id="Running_filter"]');
completedFilter = $('button[data-automation-id="Completed_filter"]');
allFilter = $('button[data-automation-id="All_filter"]');
accordionMenu = $('.app-processes-menu mat-accordion');
async clickRunningFilterButton(): Promise<void> {
await this.filtersPage.clickFilterButton(this.runningFilter);

View File

@@ -16,15 +16,15 @@
*/
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { by, element } from 'protractor';
import { by, $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class ProcessInstanceTasksPage {
startProcessDialog = element(by.id('adf-start-process-dialog'));
title = this.startProcessDialog.element(by.css('h4.mat-dialog-title'));
startProcessDialog = $('#adf-start-process-dialog');
title = this.startProcessDialog.$('h4.mat-dialog-title');
closeButton = this.startProcessDialog.element(by.cssContainingText(`div.adf-start-process-dialog-actions button span`, 'Close'));
startForm = element(by.css('div[data-automation-id="start-form"]'));
startForm = $('div[data-automation-id="start-form"]');
async clickOnStartForm(): Promise<void> {
await BrowserActions.click(this.startForm);

View File

@@ -16,16 +16,16 @@
*/
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { DropdownPage } from '../../core/pages/material/dropdown.page';
export class SelectAppsDialog {
selectAppsDialog = element(by.css('mat-dialog-container[aria-labelledby="adf-select-app-dialog-title"]'));
title = element(by.id('adf-select-app-dialog-title'));
appsDropdown = new DropdownPage(element(by.id('adf-select-app-dialog-dropdown')));
continueButton = element(by.css('adf-select-apps-dialog .mat-button-wrapper'));
selectAppsDialog = $('mat-dialog-container[aria-labelledby="adf-select-app-dialog-title"]');
title = $('#adf-select-app-dialog-title');
appsDropdown = new DropdownPage($('#adf-select-app-dialog-dropdown'));
continueButton = $('adf-select-apps-dialog .mat-button-wrapper');
async checkSelectAppsDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.selectAppsDialog);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element, Key, protractor, browser } from 'protractor';
import { by, element, Key, protractor, browser, $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
import { DropdownPage } from '../../core/pages/material/dropdown.page';
@@ -24,20 +24,20 @@ import { Logger } from '../../core/utils/logger';
export class StartProcessPage {
defaultProcessName = element(by.css('input[id="processName"]'));
processNameInput = element(by.id('processName'));
disabledSelectProcessDropdown = element(by.css('input[id="processDefinitionName"][disabled]'));
selectProcessDropdownArrow = element(by.css('button[id="adf-select-process-dropdown"]'));
cancelProcessButton = element(by.id('cancel_process'));
formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]'));
startProcessButton = element(by.css('button[data-automation-id="btn-start"]'));
startProcessButtonDisabled = element(by.css('button[data-automation-id="btn-start"][disabled]'));
noProcess = element(by.css('.adf-empty-content__title'));
processDefinition = element(by.css('input[id="processDefinitionName"]'));
processDefinitionOptionsPanel = element(by.css('div[class*="mat-autocomplete-panel"]'));
defaultProcessName = $('input[id="processName"]');
processNameInput = $('#processName');
disabledSelectProcessDropdown = $('input[id="processDefinitionName"][disabled]');
selectProcessDropdownArrow = $('button[id="adf-select-process-dropdown"]');
cancelProcessButton = $('#cancel_process');
formStartProcessButton = $('button[data-automation-id="adf-form-start process"]');
startProcessButton = $('button[data-automation-id="btn-start"]');
startProcessButtonDisabled = $('button[data-automation-id="btn-start"][disabled]');
noProcess = $('.adf-empty-content__title');
processDefinition = $('input[id="processDefinitionName"]');
processDefinitionOptionsPanel = $('div[class*="mat-autocomplete-panel"]');
processDefinitionDropdown = new DropdownPage(element(by.id('adf-select-process-dropdown')));
applicationDropdown = new DropdownPage(element(by.css('[data-automation-id*="start-process-app"] .mat-select-arrow')));
processDefinitionDropdown = new DropdownPage($('#adf-select-process-dropdown'));
applicationDropdown = new DropdownPage($('[data-automation-id*="start-process-app"] .mat-select-arrow'));
async checkNoProcessMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noProcess);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { FiltersPage } from './filters.page';
export class TaskFiltersPage {
@@ -28,11 +28,11 @@ export class TaskFiltersPage {
filtersPage = new FiltersPage();
myTasks = element(by.css('[data-automation-id="My Tasks_filter"]'));
queuedTask = element(by.css('[data-automation-id="Queued Tasks_filter"]'));
completedTask = element(by.css('[data-automation-id="Completed Tasks_filter"]'));
involvedTask = element(by.css('[data-automation-id="Involved Tasks_filter"]'));
accordionMenu = element(by.css('.app-processes-menu mat-accordion'));
myTasks = $('[data-automation-id="My Tasks_filter"]');
queuedTask = $('[data-automation-id="Queued Tasks_filter"]');
completedTask = $('[data-automation-id="Completed Tasks_filter"]');
involvedTask = $('[data-automation-id="Involved Tasks_filter"]');
accordionMenu = $('.app-processes-menu mat-accordion');
async clickMyTasksFilterButton(): Promise<void> {
await this.filtersPage.clickFilterButton(this.myTasks);
@@ -51,7 +51,7 @@ export class TaskFiltersPage {
}
async clickCustomFilterButton(customFilterName): Promise<void> {
await this.filtersPage.clickFilterButton(element(by.css(`[data-automation-id="${customFilterName}_filter"]`)));
await this.filtersPage.clickFilterButton($(`[data-automation-id="${customFilterName}_filter"]`));
}
async isMyTasksFilterHighlighted(): Promise<boolean> {

View File

@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../core/utils/public-api';
export class TaskFormPage {
saveButton = element(by.id('adf-form-save'));
claimButton = element(by.css('button[data-automation-id="adf-task-form-claim-button"]'));
releaseButton = element(by.css('button[data-automation-id="adf-task-form-unclaim-button"]'));
saveButton = $('#adf-form-save');
claimButton = $('button[data-automation-id="adf-task-form-claim-button"]');
releaseButton = $('button[data-automation-id="adf-task-form-unclaim-button"]');
async clickOnClaimButton(): Promise<void> {
await BrowserActions.click(this.claimButton);

View File

@@ -54,6 +54,7 @@ export class ApiService {
this.logger.log(`try to login with ${profile.username} on HOST: ${this.apiService.config.hostEcm} AUTHTYPE: ${this.apiService.config.authType} PROVIDER: ${this.apiService.config.provider}`);
try {
await this.apiService.login(profile.username, profile.password);
this.logger.log(`Successfuly logged in as ${profile.username}`);
} catch (error) {
this.logger.error(`Failed to login with ${profile.username}`, error?.message);
throw new Error(`Login failed with ${profile.username}`);