mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
disable w3c due getValue problem (#7067)
* [ci:force]disable w3c due getValue problem * unify get Input value * [ci:force]fix * [ci:force] remove * [ci:force]remove all getAttribute * fix lint * fix lint * fix * fix * fix * fix * different fix try * rewrite wait for for value * fix lint * remove e2e already covered by unit * fix lint * fix
This commit is contained in:
@@ -37,7 +37,7 @@ export class DateRangeFilterPage {
|
||||
}
|
||||
|
||||
async getFromDate(): Promise<string> {
|
||||
return this.filter.element(this.fromField).getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.filter.element(this.fromField));
|
||||
}
|
||||
|
||||
async putFromDate(date): Promise<void> {
|
||||
@@ -91,7 +91,7 @@ export class DateRangeFilterPage {
|
||||
}
|
||||
|
||||
async getToDate(): Promise<string> {
|
||||
return this.filter.element(this.toField).getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.filter.element(this.toField));
|
||||
}
|
||||
|
||||
async putToDate(date): Promise<void> {
|
||||
|
@@ -40,7 +40,7 @@ export class NumberRangeFilterPage {
|
||||
}
|
||||
|
||||
async getFromNumber(): Promise<string> {
|
||||
return this.filter.element(this.fromInput).getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.filter.element(this.fromInput));
|
||||
}
|
||||
|
||||
async putFromNumber(value): Promise<void> {
|
||||
@@ -75,7 +75,7 @@ export class NumberRangeFilterPage {
|
||||
}
|
||||
|
||||
async getToNumber(): Promise<string> {
|
||||
return this.filter.element(this.toInput).getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.filter.element(this.toInput));
|
||||
}
|
||||
|
||||
async putToNumber(value): Promise<void> {
|
||||
|
@@ -65,12 +65,12 @@ export class SearchCategoriesPage {
|
||||
}
|
||||
|
||||
async checkFilterIsCollapsed(filter: ElementFinder): Promise<void> {
|
||||
const elementClass = await filter.getAttribute('class');
|
||||
const elementClass = await BrowserActions.getAttribute(filter, 'class');
|
||||
await expect(elementClass).not.toContain('mat-expanded');
|
||||
}
|
||||
|
||||
async checkFilterIsExpanded(filter: ElementFinder): Promise<void> {
|
||||
const elementClass = await filter.getAttribute('class');
|
||||
const elementClass = await BrowserActions.getAttribute(filter, 'class');
|
||||
await expect(elementClass).toContain('mat-expanded');
|
||||
}
|
||||
|
||||
|
@@ -31,15 +31,15 @@ export class SearchSliderPage {
|
||||
}
|
||||
|
||||
async getMaxValue() {
|
||||
return this.filter.element(this.slider).getAttribute('aria-valuemax');
|
||||
return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuemax');
|
||||
}
|
||||
|
||||
async getMinValue() {
|
||||
return this.filter.element(this.slider).getAttribute('aria-valuemin');
|
||||
return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuemin');
|
||||
}
|
||||
|
||||
async getValue() {
|
||||
return this.filter.element(this.slider).getAttribute('aria-valuenow');
|
||||
return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuenow');
|
||||
}
|
||||
|
||||
async setValue(value: number): Promise<void> {
|
||||
|
@@ -38,8 +38,7 @@ export class EditJsonDialog {
|
||||
}
|
||||
|
||||
async getDialogContent(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.dialogContent);
|
||||
return this.dialogContent.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.dialogContent);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -216,7 +216,7 @@ export class DataTableComponentPage {
|
||||
}
|
||||
|
||||
async getTooltip(columnName: string, columnValue: string): Promise<string> {
|
||||
return this.getCellElementByValue(columnName, columnValue).getAttribute('title');
|
||||
return BrowserActions.getAttribute(this.getCellElementByValue(columnName, columnValue), 'title');
|
||||
}
|
||||
|
||||
async rightClickOnRowByIndex(index: number): Promise<void> {
|
||||
@@ -295,7 +295,8 @@ export class DataTableComponentPage {
|
||||
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 element(locator).getAttribute('class');
|
||||
const result = await BrowserActions.getAttribute(element(locator), 'class');
|
||||
|
||||
if (sortOrder.toLocaleLowerCase() === 'asc') {
|
||||
if (!result.includes('sorted-asc')) {
|
||||
if (result.includes('sorted-desc') || result.includes('sortable')) {
|
||||
|
@@ -88,7 +88,7 @@ export class FormFields {
|
||||
async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise<string> {
|
||||
const placeHolderLocator = element(by.css(`${locator}#${fieldId}`));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
|
||||
return placeHolderLocator.getAttribute('data-placeholder');
|
||||
return BrowserActions.getAttribute(placeHolderLocator, 'data-placeholder');
|
||||
}
|
||||
|
||||
async checkFieldValue(locator, field, val): Promise<void> {
|
||||
|
@@ -80,19 +80,19 @@ export class AttachFileWidgetPage {
|
||||
const widget = await this.formFields.getWidget(fieldId);
|
||||
const fileAttached = await widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', fileName));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
|
||||
const id = await fileAttached.getAttribute('id');
|
||||
const id = await BrowserActions.getAttribute(fileAttached, 'id');
|
||||
const optionMenu = widget.element(by.css(`button[id='${id}-option-menu']`));
|
||||
await BrowserActions.click(optionMenu);
|
||||
}
|
||||
|
||||
async checkAttachFileOptionsActiveForm(): Promise <void> {
|
||||
async checkAttachFileOptionsActiveForm(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
|
||||
await this.removeFileOptionButton.waitVisible();
|
||||
}
|
||||
|
||||
async checkAttachFileOptionsCompletedForm(): Promise <void> {
|
||||
async checkAttachFileOptionsCompletedForm(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { FormFields } from '../form-fields';
|
||||
import { BrowserActions, BrowserVisibility } from '../../../utils/public-api';
|
||||
import { BrowserActions } from '../../../utils/public-api';
|
||||
import { Locator, by, element } from 'protractor';
|
||||
|
||||
export class CheckboxWidgetPage {
|
||||
@@ -43,12 +43,8 @@ export class CheckboxWidgetPage {
|
||||
}
|
||||
|
||||
async isCheckboxChecked(fieldId: string): Promise<boolean> {
|
||||
let isChecked: boolean = false;
|
||||
const checkboxWidget = await (await this.formFields.getWidget(fieldId)).element(this.checkboxLocator);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(checkboxWidget);
|
||||
await checkboxWidget.getAttribute('class').then((attributeValue) => {
|
||||
isChecked = attributeValue.includes('mat-checkbox-checked');
|
||||
});
|
||||
return isChecked;
|
||||
const attributeValue = await BrowserActions.getAttribute(checkboxWidget, 'class');
|
||||
return attributeValue.includes('mat-checkbox-checked');
|
||||
}
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ export class DynamicTableWidgetPage {
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
await this.columnDateTime.sendKeys(randomText);
|
||||
await this.columnDateTime.sendKeys(protractor.Key.ENTER);
|
||||
return this.columnDateTime.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.columnDateTime);
|
||||
}
|
||||
|
||||
async addRandomStringOnDate(randomText: string): Promise<void> {
|
||||
|
@@ -29,7 +29,7 @@ export class HyperlinkWidgetPage {
|
||||
}
|
||||
|
||||
async getFieldHref(fieldId: string): Promise<string> {
|
||||
return this.formFields.getWidget(fieldId).element(this.fieldLocator).getAttribute('href');
|
||||
return BrowserActions.getAttribute(this.formFields.getWidget(fieldId).element(this.fieldLocator), 'href');
|
||||
}
|
||||
|
||||
async getFieldLabel(fieldId: string): Promise<string> {
|
||||
|
@@ -17,21 +17,18 @@
|
||||
|
||||
import { ElementFinder } from 'protractor';
|
||||
import { BrowserActions } from '../../utils/browser-actions';
|
||||
import { BrowserVisibility } from '../../utils/browser-visibility';
|
||||
|
||||
export class CheckboxPage {
|
||||
|
||||
static async uncheck(el: ElementFinder) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(el);
|
||||
const classList = await el.getAttribute('class');
|
||||
const classList = await BrowserActions.getAttribute(el, 'class');
|
||||
if (classList && classList.indexOf('mat-checked') > -1) {
|
||||
await BrowserActions.click(el);
|
||||
}
|
||||
}
|
||||
|
||||
static async check(el: ElementFinder) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(el);
|
||||
const classList = await el.getAttribute('class');
|
||||
const classList = await BrowserActions.getAttribute(el, 'class');
|
||||
if (classList && classList.indexOf('mat-checked') === -1) {
|
||||
await BrowserActions.click(el);
|
||||
}
|
||||
|
@@ -28,14 +28,14 @@ export class DatePickerCalendarPage {
|
||||
todayDate = element(by.css('.mat-calendar-body-today'));
|
||||
|
||||
async getSelectedDate(): Promise<string> {
|
||||
return element(by.css('td[class*="mat-calendar-body-active"]')).getAttribute('aria-label');
|
||||
return BrowserActions.getAttribute(element(by.css('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}"]`));
|
||||
if (await afterCalendar.isPresent()) {
|
||||
const aria = await afterCalendar.getAttribute('aria-disabled');
|
||||
const aria = await BrowserActions.getAttribute(afterCalendar, 'aria-disabled');
|
||||
await expect(aria).toBe('true');
|
||||
}
|
||||
const isEnabled = await this.nextMonthButton.isEnabled();
|
||||
@@ -46,7 +46,7 @@ export class DatePickerCalendarPage {
|
||||
const beforeDate = DateUtil.formatDate('DD-MM-YY', date, -1);
|
||||
const beforeCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`));
|
||||
if (await beforeCalendar.isPresent()) {
|
||||
const aria = await beforeCalendar.getAttribute('aria-disabled');
|
||||
const aria = await BrowserActions.getAttribute(beforeCalendar, 'aria-disabled');
|
||||
await expect(aria).toBe('true');
|
||||
}
|
||||
const isEnabled = await this.previousMonthButton.isEnabled();
|
||||
@@ -79,5 +79,5 @@ export class DatePickerCalendarPage {
|
||||
await BrowserActions.click(startDayElement);
|
||||
await BrowserActions.click(endDayElement);
|
||||
await this.checkDatePickerIsNotDisplayed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ export class TabsPage {
|
||||
|
||||
async checkTabIsSelectedByTitle(tabTitle): Promise<void> {
|
||||
const tab = element(by.cssContainingText("div[id*='mat-tab-label']", tabTitle));
|
||||
const result = await tab.getAttribute('aria-selected');
|
||||
const result = await BrowserActions.getAttribute(tab, 'aria-selected');
|
||||
await expect(result).toBe('true');
|
||||
}
|
||||
|
||||
|
@@ -16,14 +16,12 @@
|
||||
*/
|
||||
|
||||
import { by, ElementFinder } from 'protractor';
|
||||
import { BrowserVisibility } from '../../utils/browser-visibility';
|
||||
import { BrowserActions } from '../../utils/browser-actions';
|
||||
|
||||
export class TogglePage {
|
||||
|
||||
async enableToggle(toggle: ElementFinder): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(toggle);
|
||||
const check = await toggle.getAttribute('class');
|
||||
const check = await BrowserActions.getAttribute(toggle, 'class');
|
||||
if (check.indexOf('mat-checked') < 0) {
|
||||
const elem = toggle.all(by.css('input')).first();
|
||||
await BrowserActions.clickScript(elem);
|
||||
@@ -31,8 +29,7 @@ export class TogglePage {
|
||||
}
|
||||
|
||||
async disableToggle(toggle: ElementFinder): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(toggle);
|
||||
const check = await toggle.getAttribute('class');
|
||||
const check = await BrowserActions.getAttribute(toggle, 'class');
|
||||
if (check.indexOf('mat-checked') >= 0) {
|
||||
const elem = toggle.all(by.css('input')).first();
|
||||
await BrowserActions.clickScript(elem);
|
||||
|
@@ -65,11 +65,11 @@ export class SettingsPage {
|
||||
}
|
||||
|
||||
async getBpmHostUrl() {
|
||||
return this.bpmText.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.bpmText);
|
||||
}
|
||||
|
||||
async getEcmHostUrl() {
|
||||
return this.ecmText.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.ecmText);
|
||||
}
|
||||
|
||||
async setProviderEcmBpm() {
|
||||
@@ -190,7 +190,7 @@ export class SettingsPage {
|
||||
async setSilentLogin(enableToggle) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.silentLoginToggleElement);
|
||||
|
||||
const isChecked = (await this.silentLoginToggleElement.getAttribute('class')).includes('mat-checked');
|
||||
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleElement, 'class')).includes('mat-checked');
|
||||
|
||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
||||
await BrowserActions.click(this.silentLoginToggleLabel);
|
||||
@@ -200,7 +200,7 @@ export class SettingsPage {
|
||||
async setImplicitFlow(enableToggle) {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.implicitFlowElement);
|
||||
|
||||
const isChecked = (await this.implicitFlowElement.getAttribute('class')).includes('mat-checked');
|
||||
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowElement, 'class')).includes('mat-checked');
|
||||
|
||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
||||
await BrowserActions.click(this.implicitFlowLabel);
|
||||
@@ -244,11 +244,12 @@ export class SettingsPage {
|
||||
|
||||
async checkBasicAuthRadioIsSelected() {
|
||||
const radioButton = this.getBasicAuthRadioButton();
|
||||
await expect(await radioButton.getAttribute('class')).toContain('mat-radio-checked');
|
||||
|
||||
await expect(await BrowserActions.getAttribute(radioButton, 'class')).toContain('mat-radio-checked');
|
||||
}
|
||||
|
||||
async checkSsoRadioIsNotSelected() {
|
||||
const radioButton = this.getSsoRadioButton();
|
||||
await expect(await radioButton.getAttribute('class')).not.toContain('mat-radio-checked');
|
||||
await expect(await BrowserActions.getAttribute(radioButton, 'class')).not.toContain('mat-radio-checked');
|
||||
}
|
||||
}
|
||||
|
@@ -153,11 +153,11 @@ export class ViewerPage {
|
||||
}
|
||||
|
||||
async getCanvasWidth(): Promise<string> {
|
||||
return this.canvasLayer.getAttribute(`width`);
|
||||
return BrowserActions.getAttribute(this.canvasLayer, `width`);
|
||||
}
|
||||
|
||||
async getCanvasHeight(): Promise<string> {
|
||||
return this.canvasLayer.getAttribute(`height`);
|
||||
return BrowserActions.getAttribute(this.canvasLayer, `height`);
|
||||
}
|
||||
|
||||
async getDisplayedFileName(): Promise<string> {
|
||||
@@ -204,14 +204,14 @@ export class ViewerPage {
|
||||
|
||||
async checkAllThumbnailsDisplayed(nbPages): Promise<void> {
|
||||
const defaultThumbnailHeight = 143;
|
||||
await expect(await this.thumbnailsContent.getAttribute('style')).toEqual('height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);');
|
||||
await expect(await BrowserActions.getAttribute(this.thumbnailsContent, 'style')).toEqual('height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);');
|
||||
}
|
||||
|
||||
async checkCurrentThumbnailIsSelected(): Promise<void> {
|
||||
const selectedThumbnail = element(by.css('adf-pdf-thumb.adf-pdf-thumbnails__thumb.adf-pdf-thumbnails__thumb--selected > img'));
|
||||
const pageNumber = await this.pageSelectorInput.getAttribute('value');
|
||||
const pageNumber = await BrowserActions.getInputValue(this.pageSelectorInput);
|
||||
|
||||
await expect('Page ' + pageNumber).toEqual(await selectedThumbnail.getAttribute('title'));
|
||||
await expect('Page ' + pageNumber).toEqual(await BrowserActions.getAttribute(selectedThumbnail, 'title'));
|
||||
}
|
||||
|
||||
async checkThumbnailsCloseIsDisplayed(): Promise<void> {
|
||||
@@ -239,11 +239,11 @@ export class ViewerPage {
|
||||
}
|
||||
|
||||
async getLastButtonTitle(): Promise<string> {
|
||||
return this.lastButton.getAttribute('title');
|
||||
return BrowserActions.getAttribute(this.lastButton, 'title');
|
||||
}
|
||||
|
||||
async getMoreActionsMenuTitle(): Promise<string> {
|
||||
return this.moreActionsMenu.getAttribute('title');
|
||||
return BrowserActions.getAttribute(this.moreActionsMenu, 'title');
|
||||
}
|
||||
|
||||
async checkDownloadButtonIsDisplayed(): Promise<void> {
|
||||
@@ -298,8 +298,7 @@ export class ViewerPage {
|
||||
}
|
||||
|
||||
async checkPageSelectorInputIsDisplayed(checkNumber): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.pageSelectorInput);
|
||||
await expect(await this.pageSelectorInput.getAttribute('value')).toEqual(checkNumber);
|
||||
await expect(await BrowserActions.getInputValue(this.pageSelectorInput)).toEqual(checkNumber);
|
||||
}
|
||||
|
||||
async checkImgContainerIsDisplayed(): Promise<void> {
|
||||
@@ -355,7 +354,7 @@ export class ViewerPage {
|
||||
}
|
||||
|
||||
async checkRotation(text): Promise<void> {
|
||||
const rotation = await this.imgContainer.getAttribute('style');
|
||||
const rotation = await BrowserActions.getAttribute(this.imgContainer, 'style');
|
||||
await expect(rotation).toEqual(text);
|
||||
}
|
||||
|
||||
|
@@ -138,6 +138,12 @@ export class TestElement {
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return this.elementFinder.isEnabled();
|
||||
}
|
||||
/**
|
||||
* Query whether the DOM element represented by this instance is disabled.
|
||||
*/
|
||||
async isDisabled(): Promise<boolean> {
|
||||
return !(await this.elementFinder.isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether this element is currently displayed.
|
||||
@@ -153,11 +159,10 @@ export class TestElement {
|
||||
|
||||
/**
|
||||
* Query for the value of the given attribute of the element.
|
||||
* @param name The name of the attribute to query.
|
||||
* @param attributeName The name of the attribute to query.
|
||||
*/
|
||||
async getAttribute(name: string): Promise<string> {
|
||||
await this.waitVisible();
|
||||
return this.elementFinder.getAttribute(name);
|
||||
async getAttribute(attributeName: string): Promise<string> {
|
||||
return BrowserActions.getAttribute(this.elementFinder, attributeName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -91,6 +91,12 @@ export class BrowserActions {
|
||||
return browser.get(url, timeout);
|
||||
}
|
||||
|
||||
static async getAttribute(elementFinder: ElementFinder, attribute: string): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsPresent(elementFinder);
|
||||
const attributeValue: string = await browser.executeScript(`return arguments[0].getAttribute(arguments[1])`, elementFinder, attribute);
|
||||
return attributeValue || '';
|
||||
}
|
||||
|
||||
static async getText(elementFinder: ElementFinder): Promise<string> {
|
||||
Logger.info(`Get Text ${elementFinder.locator().toString()}`);
|
||||
|
||||
@@ -123,7 +129,7 @@ export class BrowserActions {
|
||||
|
||||
const present = await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
|
||||
if (present) {
|
||||
return elementFinder.getAttribute('value');
|
||||
return browser.executeScript(`return arguments[0].value`, elementFinder);
|
||||
} else {
|
||||
Logger.error(`Get Input value ${elementFinder.locator().toString()} not present`);
|
||||
return '';
|
||||
@@ -145,10 +151,12 @@ export class BrowserActions {
|
||||
await elementFinder.click();
|
||||
await elementFinder.sendKeys(protractor.Key.END);
|
||||
|
||||
const value = await elementFinder.getAttribute('value');
|
||||
for (let i = value.length; i >= 0; i--) {
|
||||
await elementFinder.sendKeys(protractor.Key.BACK_SPACE);
|
||||
await browser.sleep(sleepTime);
|
||||
const value: string = await browser.executeScript(`return arguments[0].value`, elementFinder);
|
||||
if (value) {
|
||||
for (let i = value.length; i >= 0; i--) {
|
||||
await elementFinder.sendKeys(protractor.Key.BACK_SPACE);
|
||||
await browser.sleep(sleepTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,14 +185,6 @@ export class BrowserActions {
|
||||
}
|
||||
}
|
||||
|
||||
static async checkIsDisabled(elementFinder: ElementFinder): Promise<void> {
|
||||
Logger.info(`Check is disabled locator:${elementFinder.locator().toString()}`);
|
||||
|
||||
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
|
||||
const valueCheck = await elementFinder.getAttribute('disabled');
|
||||
await expect(valueCheck).toEqual('true');
|
||||
}
|
||||
|
||||
static async rightClick(elementFinder: ElementFinder): Promise<void> {
|
||||
Logger.info(`Right click locator:${elementFinder.locator().toString()}`);
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
import { browser, by, element, ElementFinder, protractor, until } from 'protractor';
|
||||
import { Logger } from './logger';
|
||||
import { falseIfMissing } from 'protractor/built/util';
|
||||
|
||||
export class BrowserVisibility {
|
||||
|
||||
@@ -89,7 +90,16 @@ export class BrowserVisibility {
|
||||
static async waitUntilElementHasValue(elementToCheck: ElementFinder, elementValue, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise<any> {
|
||||
Logger.info(`Wait Until Element has value ${elementToCheck.locator().toString()} for ${waitTimeout}`);
|
||||
|
||||
return browser.wait(protractor.ExpectedConditions.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, `Element doesn\'t have a value ${elementValue} ${elementToCheck.locator()}`);
|
||||
return browser.wait(BrowserVisibility.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, `Element doesn\'t have a value ${elementValue} ${elementToCheck.locator()}`);
|
||||
}
|
||||
|
||||
private static textToBePresentInElementValue(elementFinder: ElementFinder, text: string) {
|
||||
const hasText = async () => {
|
||||
return browser.executeScript(`return arguments[0].value`, elementFinder).then((actualText: string) => {
|
||||
return actualText.indexOf(text) > -1;
|
||||
}, falseIfMissing);
|
||||
};
|
||||
return protractor.ExpectedConditions.and(protractor.ExpectedConditions.presenceOf(elementFinder), hasText);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -51,8 +51,7 @@ export class EditProcessFilterDialogPage {
|
||||
}
|
||||
|
||||
async getFilterName(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
|
||||
return this.filterNameInput.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.filterNameInput);
|
||||
}
|
||||
|
||||
async setFilterName(filterName: string): Promise<void> {
|
||||
|
@@ -51,8 +51,7 @@ export class EditTaskFilterDialogPage {
|
||||
}
|
||||
|
||||
async getFilterName(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
|
||||
return this.filterNameInput.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.filterNameInput);
|
||||
}
|
||||
|
||||
async setFilterName(filterName: string): Promise<void> {
|
||||
|
@@ -166,8 +166,7 @@ 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();
|
||||
await BrowserVisibility.waitUntilElementIsVisible(locator);
|
||||
return locator.getAttribute('value');
|
||||
return BrowserActions.getInputValue(locator);
|
||||
}
|
||||
|
||||
async setProperty(property: string, option: string): Promise<void> {
|
||||
|
@@ -251,7 +251,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async getId(): Promise<string> {
|
||||
return this.id.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.id);
|
||||
}
|
||||
|
||||
async setTaskName(option: string): Promise<void> {
|
||||
@@ -259,7 +259,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async getTaskName(): Promise<string> {
|
||||
return this.taskName.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.taskName);
|
||||
}
|
||||
|
||||
async setProcessDefinitionId(option: string): Promise<void> {
|
||||
@@ -267,7 +267,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async getProcessDefinitionId(): Promise<string> {
|
||||
return this.processDefinitionId.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.processDefinitionId);
|
||||
}
|
||||
|
||||
async setProcessInstanceId(option: string): Promise<void> {
|
||||
@@ -284,7 +284,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async getProcessInstanceId(): Promise<string> {
|
||||
return this.processInstanceId.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.processInstanceId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -66,8 +66,7 @@ export class AttachFileWidgetCloudPage {
|
||||
|
||||
async getFileId(name: string): Promise<string> {
|
||||
const fileAttached = this.widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
|
||||
return fileAttached.getAttribute('id');
|
||||
return BrowserActions.getAttribute(fileAttached, 'id');
|
||||
}
|
||||
|
||||
async clickActionMenu(fileName: string, actionName: string): Promise<void> {
|
||||
|
@@ -34,8 +34,7 @@ export class GroupCloudComponentPage {
|
||||
}
|
||||
|
||||
async getGroupsFieldContent(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
|
||||
return this.groupCloudSearch.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.groupCloudSearch);
|
||||
}
|
||||
|
||||
async selectGroupFromList(name: string): Promise<void> {
|
||||
|
@@ -57,8 +57,7 @@ export class PeopleCloudComponentPage {
|
||||
}
|
||||
|
||||
async getAssignee(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
|
||||
return this.peopleCloudSearch.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.peopleCloudSearch);
|
||||
}
|
||||
|
||||
async getChipAssignee(): Promise<string> {
|
||||
@@ -106,8 +105,7 @@ export class PeopleCloudComponentPage {
|
||||
}
|
||||
|
||||
async getAssigneeFieldContent(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
|
||||
return this.assigneeField.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.assigneeField);
|
||||
}
|
||||
|
||||
getFieldLabel(fieldId: string): Promise<string> {
|
||||
|
@@ -50,8 +50,7 @@ export class StartProcessCloudPage {
|
||||
}
|
||||
|
||||
async getProcessName(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
|
||||
return this.processNameInput.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.processNameInput);
|
||||
}
|
||||
|
||||
async selectFromProcessDropdown(name: string): Promise<void> {
|
||||
|
@@ -52,8 +52,7 @@ export class StartProcessPage {
|
||||
}
|
||||
|
||||
async getDefaultName(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.defaultProcessName);
|
||||
return this.defaultProcessName.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.defaultProcessName);
|
||||
}
|
||||
|
||||
async deleteDefaultName() {
|
||||
@@ -105,8 +104,7 @@ export class StartProcessPage {
|
||||
}
|
||||
|
||||
async getProcessDefinitionValue(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
|
||||
return this.processDefinition.getAttribute('value');
|
||||
return BrowserActions.getInputValue(this.processDefinition);
|
||||
}
|
||||
|
||||
async clickCancelProcessButton(): Promise<void> {
|
||||
@@ -139,9 +137,7 @@ export class StartProcessPage {
|
||||
}
|
||||
|
||||
async checkSelectProcessPlaceholderIsDisplayed(): Promise<string> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
|
||||
const processPlaceholder = await this.processDefinition.getAttribute('value');
|
||||
return processPlaceholder;
|
||||
return BrowserActions.getInputValue(this.processDefinition);
|
||||
}
|
||||
|
||||
async checkValidationErrorIsDisplayed(error: string, elementRef = 'mat-error'): Promise<void> {
|
||||
|
Reference in New Issue
Block a user