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:
Eugenio Romano
2021-05-28 18:08:49 +01:00
committed by GitHub
parent 200cfb8dba
commit 9e0000a307
54 changed files with 34465 additions and 932 deletions

View File

@@ -16,7 +16,14 @@
*/
import { FileModel } from '../../models/ACS/file.model';
import { ApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import {
ApiService,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { TagPage } from '../../content-services/pages/tag.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { browser } from 'protractor';
@@ -78,18 +85,6 @@ describe('Tag component', () => {
await uploadActions.deleteFileOrFolder(pdfUploadedFile.entry.id);
});
it('[C260374] Should NOT be possible to add a new tag without Node ID', async () => {
await expect(await tagPage.getNodeId()).toEqual('');
await expect(await tagPage.newTagInput.getAttribute('data-placeholder')).toEqual('New Tag');
await expect(await tagPage.addTagButtonIsEnabled()).toEqual(false);
await tagPage.tagListRow.waitNotVisible();
await tagPage.tagListByNodeIdRow.waitNotVisible();
await tagPage.newTagInput.typeText('a');
await expect(await tagPage.addTagButtonIsEnabled()).toEqual(false);
await expect(await tagPage.newTagInput.getAttribute('value')).toEqual('a');
});
it('[C268151] Should be possible to add a new tag to a Node', async () => {
await tagPage.insertNodeId(pdfFileModel.id);
await tagPage.addTag(tagList[0]);

View File

@@ -77,7 +77,7 @@ describe('Create folder directive', () => {
const folderName = 'NotEnableFolder';
await contentServicesPage.clickOnCreateNewFolder();
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName(folderName);
@@ -129,20 +129,20 @@ describe('Create folder directive', () => {
await contentServicesPage.clickOnCreateNewFolder();
await createFolderDialog.addFolderName('*');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('<');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('>');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('\\');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('/');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('?');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName(':');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await createFolderDialog.addFolderName('|');
await createFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await createFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
});
});

View File

@@ -170,7 +170,7 @@ describe('Delete Directive', () => {
await contentServicesPage.chooseSelectionMode('None');
await contentListPage.selectRow(txtFileModel.name);
await contentListPage.dataTable.checkRowIsNotSelected('Display name', txtFileModel.name);
await contentServicesPage.checkToolbarDeleteIsDisabled();
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentServicesPage.chooseSelectionMode('Single');
await contentListPage.selectRow(txtFileModel.name);
@@ -278,16 +278,16 @@ describe('Delete Directive', () => {
it('[C216426] Delete file without delete permissions', async () => {
await contentListPage.selectRowWithKeyboard(filePdf.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', filePdf.entry.name);
await contentServicesPage.checkToolbarDeleteIsDisabled();
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentListPage.selectRowWithKeyboard(folderB.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', folderB.entry.name);
await contentServicesPage.checkToolbarDeleteIsDisabled();
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentListPage.selectRowWithKeyboard(folderA.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', folderA.entry.name);
await contentServicesPage.checkToolbarDeleteIsDisabled();
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
await contentListPage.selectRowWithKeyboard(fileTxt.entry.name);
await contentListPage.dataTable.checkRowIsSelected('Display name', fileTxt.entry.name);
await contentServicesPage.checkToolbarDeleteIsDisabled();
await expect(await contentServicesPage.checkToolbarDeleteIsDisabled()).toEqual(true);
});
});
});

View File

@@ -154,7 +154,7 @@ describe('Edit folder directive', () => {
await editFolderDialog.addFolderName('a*"<>\\/?:|');
await expect(await editFolderDialog.getValidationMessage()).toBe('Folder name can\'t contain these characters * " < > \\ / ? : |');
await editFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await editFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await editFolderDialog.addFolderName('a.a');
await editFolderDialog.checkValidationMessageIsNotDisplayed();
@@ -162,11 +162,11 @@ describe('Edit folder directive', () => {
await editFolderDialog.addFolderName('a.');
await expect(await editFolderDialog.getValidationMessage()).toBe('Folder name can\'t end with a period .');
await editFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await editFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await BrowserActions.clearSendKeys(editFolderDialog.getFolderNameField(), protractor.Key.SPACE);
await expect(await editFolderDialog.getValidationMessage()).toBe('Folder name can\'t contain only spaces');
await editFolderDialog.checkCreateUpdateBtnIsDisabled();
await expect(await editFolderDialog.checkCreateUpdateBtnIsEnabled()).toEqual(false);
await editFolderDialog.addFolderName(editFolder.entry.name);
await editFolderDialog.addFolderDescription('a*"<>\\/?:|');

View File

@@ -87,8 +87,7 @@ export class PermissionsPage {
async isInherited(): Promise<boolean> {
const inheritButton = TestElement.byCss(this.inheritedButton);
await inheritButton.waitVisible();
const appliedStyles = await inheritButton.getAttribute('class');
return appliedStyles.indexOf('mat-checked') !== -1;
return (await inheritButton.getAttribute('class')).indexOf('mat-checked') !== -1;
}
async toggleInheritPermission(): Promise<void> {

View File

@@ -16,15 +16,14 @@
*/
import { by, element } from 'protractor';
import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing';
import { BrowserActions } from '@alfresco/adf-testing';
export class SocialPage {
nodeIdField = element(by.css(`input[id="nodeId"]`));
async getNodeIdFieldValue(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.nodeIdField);
return this.nodeIdField.getAttribute('value');
return BrowserActions.getInputValue(this.nodeIdField);
}
async writeCustomNodeId(nodeId: string): Promise<void> {

View File

@@ -34,7 +34,7 @@ export class TagPage {
confirmTag = TestElement.byCss('#adf-tag-node-send');
getNodeId(): Promise<string> {
return new TestElement(this.insertNodeIdElement).getAttribute('value');
return BrowserActions.getInputValue(this.insertNodeIdElement);
}
async insertNodeId(nodeId) {

View File

@@ -30,8 +30,7 @@ export class TreeViewPage {
}
async getNodeId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.nodeIdInput);
return this.nodeIdInput.getAttribute('value');
return BrowserActions.getInputValue(this.nodeIdInput);
}
async clickNode(nodeName: string): Promise<void> {

View File

@@ -16,7 +16,13 @@
*/
import { by, element } from 'protractor';
import { BrowserVisibility, BrowserActions, CardTextItemPage, DropdownPage, CardBooleanItemPage } from '@alfresco/adf-testing';
import {
BrowserVisibility,
BrowserActions,
CardTextItemPage,
DropdownPage,
CardBooleanItemPage
} from '@alfresco/adf-testing';
export class CardViewComponentPage {
@@ -163,12 +169,10 @@ export class CardViewComponentPage {
}
async disableEdit(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editableSwitch);
const check = await this.editableSwitch.getAttribute('class');
const check = await BrowserActions.getAttribute(this.editableSwitch, 'class');
if (check.indexOf('mat-checked') > -1) {
await BrowserActions.click(this.editableSwitch);
await expect(await this.editableSwitch.getAttribute('class')).not.toContain('mat-checked');
await expect(await BrowserActions.getAttribute(this.editableSwitch, 'class')).not.toContain('mat-checked');
}
}
@@ -193,9 +197,7 @@ export class CardViewComponentPage {
}
async enableClearDate(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.clearDateSwitch);
const switchClass = await this.clearDateSwitch.getAttribute('class');
const switchClass = await BrowserActions.getAttribute(this.editableSwitch, 'class');
if (switchClass.indexOf('mat-checked') === -1) {
await this.clearDateSwitch.click();
const clearDateChecked = element(by.css('mat-slide-toggle[id="app-toggle-clear-date"][class*="mat-checked"]'));
@@ -204,9 +206,7 @@ export class CardViewComponentPage {
}
async enableNoneOption(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noneOptionSwitch);
const switchClass = await this.noneOptionSwitch.getAttribute('class');
const switchClass = await BrowserActions.getAttribute(this.noneOptionSwitch, 'class');
if (switchClass.indexOf('mat-checked') === -1) {
await this.noneOptionSwitch.click();
const noneOptionChecked = element(by.css('mat-slide-toggle[id="app-toggle-none-option"][class*="mat-checked"]'));
@@ -215,13 +215,13 @@ export class CardViewComponentPage {
}
async isErrorNotDisplayed(): Promise<boolean> {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
try {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
try {
await BrowserVisibility.waitUntilElementIsNotVisible(errorElement);
return true;
} catch {
} catch {
return false;
}
}
}
async getClickableValue(): Promise<string> {
@@ -246,7 +246,7 @@ export class CardViewComponentPage {
}
async clearIntField(): Promise<void> {
await this.intField.clear();
await this.intField.clear();
}
}

View File

@@ -146,8 +146,8 @@ export class ContentServicesPage {
await BrowserActions.click(this.deleteNodesButton);
}
async checkToolbarDeleteIsDisabled(): Promise<void> {
await BrowserActions.checkIsDisabled(this.deleteNodesButton);
async checkToolbarDeleteIsDisabled(): Promise<boolean> {
return !(await this.deleteNodesButton.isEnabled());
}
async metadataContent(content): Promise<void> {
@@ -427,8 +427,7 @@ export class ContentServicesPage {
}
async getActiveBreadcrumb(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.activeBreadcrumb);
return this.activeBreadcrumb.getAttribute('title');
return BrowserActions.getAttribute(this.activeBreadcrumb, 'title');
}
async uploadFile(fileLocation): Promise<void> {
@@ -454,17 +453,17 @@ export class ContentServicesPage {
async getSingleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFileButton);
return this.uploadFileButtonInput.getAttribute('title');
return BrowserActions.getAttribute(this.uploadFileButtonInput, 'title');
}
async getMultipleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
return this.uploadMultipleFileButton.getAttribute('title');
return BrowserActions.getAttribute(this.uploadMultipleFileButton, 'title');
}
async getFolderButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton);
return this.uploadFolderButton.getAttribute('title');
return BrowserActions.getAttribute(this.uploadFolderButton, 'title');
}
async checkUploadButton(): Promise<void> {
@@ -560,8 +559,7 @@ export class ContentServicesPage {
}
async checkEmptyFolderImageUrlToContain(url): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolderImage);
await expect(await this.emptyFolderImage.getAttribute('src')).toContain(url);
await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url);
}
async checkEmptyRecentFileIsDisplayed(): Promise<void> {
@@ -570,8 +568,7 @@ export class ContentServicesPage {
async getRowIconImageUrl(fileName): Promise<string> {
const iconRow = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`));
await BrowserVisibility.waitUntilElementIsVisible(iconRow);
return iconRow.getAttribute('src');
return BrowserActions.getAttribute(iconRow, 'src');
}
async checkGridViewButtonIsVisible(): Promise<void> {
@@ -594,7 +591,7 @@ export class ContentServicesPage {
async getDocumentCardIconForElement(elementName): Promise<string> {
const elementIcon = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`));
return elementIcon.getAttribute('src');
return BrowserActions.getAttribute(elementIcon, 'src');
}
async checkDocumentCardPropertyIsShowed(elementName, propertyName): Promise<void> {

View File

@@ -189,7 +189,6 @@ export class DataTablePage {
}
async getClipboardInputText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.pasteClipboardInput);
return this.pasteClipboardInput.getAttribute('value');
return BrowserActions.getInputValue(this.pasteClipboardInput);
}
}

View File

@@ -44,10 +44,6 @@ export class FolderDialogPage {
await BrowserActions.click(this.createUpdateButton);
}
async checkCreateUpdateBtnIsDisabled(): Promise<void> {
await BrowserActions.checkIsDisabled(this.createUpdateButton);
}
async clickOnCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
@@ -61,7 +57,7 @@ export class FolderDialogPage {
}
async getFolderName(): Promise<string> {
return this.folderNameField.getAttribute('value');
return BrowserActions.getInputValue(this.folderNameField);
}
async getValidationMessage(): Promise<string> {
@@ -80,8 +76,8 @@ export class FolderDialogPage {
return this.folderDescriptionField;
}
async checkCreateUpdateBtnIsEnabled(): Promise<void> {
await this.createUpdateButton.isEnabled();
async checkCreateUpdateBtnIsEnabled(): Promise<boolean> {
return this.createUpdateButton.isEnabled();
}
async checkCancelBtnIsEnabled(): Promise<void> {

View File

@@ -61,8 +61,7 @@ export class ShareDialogPage {
}
async getShareLink(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
return this.shareLink.getAttribute('value');
return BrowserActions.getInputValue(this.shareLink);
}
async clickCloseButton(): Promise<void> {
@@ -111,7 +110,7 @@ export class ShareDialogPage {
}
async getExpirationDate(): Promise<string> {
return this.expirationDateInput.getAttribute('value');
return BrowserActions.getInputValue(this.expirationDateInput);
}
async expirationDateInputHasValue(value): Promise<void> {

View File

@@ -97,8 +97,7 @@ export class LoginShellPage {
}
async checkLoginImgURL(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoImg);
return this.logoImg.getAttribute('src');
return BrowserActions.getAttribute(this.logoImg, 'src');
}
async checkUsernameInactive(): Promise<void> {
@@ -148,7 +147,7 @@ export class LoginShellPage {
}
async getShownPassword(): Promise<string> {
return this.txtPassword.getAttribute('value');
return BrowserActions.getInputValue(this.txtPassword);
}
async checkPasswordIsHidden(): Promise<void> {

View File

@@ -134,7 +134,7 @@ export class MetadataViewPage {
}
async getEditIconTooltip(): Promise<string> {
return this.editIcon.getAttribute('title');
return BrowserActions.getAttribute(this.editIcon, 'title');
}
async editPropertyIconIsDisplayed(propertyName: string) {
@@ -176,7 +176,7 @@ export class MetadataViewPage {
async getPropertyIconTooltip(propertyName: string): Promise<string> {
const editPropertyIcon = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'));
return editPropertyIcon.getAttribute('title');
return BrowserActions.getAttribute(editPropertyIcon, 'title');
}
async clickMetadataGroup(groupName: string): Promise<void> {
@@ -196,14 +196,12 @@ export class MetadataViewPage {
async checkMetadataGroupIsExpand(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
await BrowserVisibility.waitUntilElementIsVisible(group);
await expect(await group.getAttribute('class')).toContain('mat-expanded');
await expect(await BrowserActions.getAttribute(group, 'class')).toContain('mat-expanded');
}
async checkMetadataGroupIsNotExpand(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
await BrowserVisibility.waitUntilElementIsPresent(group);
await expect(await group.getAttribute('class')).not.toContain('mat-expanded');
await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded');
}
async getMetadataGroupTitle(groupName: string): Promise<string> {

View File

@@ -105,8 +105,7 @@ export class PeopleGroupCloudComponentPage {
}
async getPreselectValidationStatus(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.preselectValidationStatus);
return this.preselectValidationStatus.getAttribute('aria-checked');
return BrowserActions.getAttribute(this.preselectValidationStatus, 'aria-checked');
}
async clickPeopleFilerByApp(): Promise<void> {

View File

@@ -42,8 +42,7 @@ export class ChecklistDialog {
}
async getNameFieldPlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.nameField);
return this.nameField.getAttribute('data-placeholder');
return BrowserActions.getAttribute(this.nameField, 'data-placeholder');
}
async checkCancelButtonIsEnabled(): Promise<void> {

View File

@@ -58,8 +58,7 @@ export class StartTaskDialogPage {
}
async getAssignee(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.assignee);
return this.assignee.getAttribute('data-placeholder');
return BrowserActions.getAttribute(this.assignee, 'data-placeholder');
}
async selectForm(form): Promise<void> {

View File

@@ -205,8 +205,7 @@ export class TaskDetailsPage {
}
async getDescriptionPlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.descriptionField);
return this.descriptionField.getAttribute('data-placeholder');
return BrowserActions.getAttribute(this.descriptionField, 'data-placeholder');
}
getDueDate(): Promise<string> {
@@ -349,8 +348,7 @@ export class TaskDetailsPage {
}
async getInvolvePeoplePlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.addPeopleField);
return this.addPeopleField.getAttribute('data-placeholder');
return BrowserActions.getAttribute(this.addPeopleField, 'data-placeholder');
}
async checkCancelButtonIsEnabled(): Promise<void> {

View File

@@ -55,8 +55,7 @@ export class TaskListDemoPage {
}
async getAppId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.appId);
return this.appId.getAttribute('value');
return BrowserActions.getInputValue(this.appId);
}
async typeTaskId(input: string): Promise<void> {
@@ -64,8 +63,7 @@ export class TaskListDemoPage {
}
async getTaskId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskId);
return this.taskId.getAttribute('value');
return BrowserActions.getInputValue(this.taskId);
}
async typeTaskName(input: string): Promise<void> {
@@ -73,8 +71,7 @@ export class TaskListDemoPage {
}
async getTaskName(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskName);
return this.taskName.getAttribute('value');
return BrowserActions.getInputValue(this.taskName);
}
async typeItemsPerPage(input: number): Promise<void> {
@@ -87,8 +84,7 @@ export class TaskListDemoPage {
}
async getProcessDefinitionId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
return this.processInstanceId.getAttribute('value');
return BrowserActions.getInputValue(this.processInstanceId);
}
async typeProcessInstanceId(input: string): Promise<void> {
@@ -96,8 +92,7 @@ export class TaskListDemoPage {
}
async getProcessInstanceId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
return this.processInstanceId.getAttribute('value');
return BrowserActions.getInputValue(this.processInstanceId);
}
async getItemsPerPageFieldErrorMessage(): Promise<string> {
@@ -111,8 +106,7 @@ export class TaskListDemoPage {
}
async getPage(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.page);
return this.page.getAttribute('value');
return BrowserActions.getInputValue(this.page);
}
async getPageFieldErrorMessage(): Promise<string> {

View File

@@ -299,6 +299,7 @@ exports.config = {
} catch (error) {
Logger.error(`====== Demo shell not able to start ======`);
Logger.error(error);
process.exit();
}
},

View File

@@ -15,7 +15,14 @@
* limitations under the License.
*/
import { DataTableComponentPage, DatePickerCalendarPage, DateUtil, LocalStorageUtil, LoginPage } from '@alfresco/adf-testing';
import {
BrowserActions,
DataTableComponentPage,
DatePickerCalendarPage,
DateUtil,
LocalStorageUtil,
LoginPage
} from '@alfresco/adf-testing';
import { browser, ElementFinder } from 'protractor';
import { SearchBarPage } from '../pages/search-bar.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
@@ -124,7 +131,7 @@ describe('Search Date Range Filter', () => {
const results = await dataTable.geCellElementDetail('Created') as ElementFinder[];
for (const currentResult of results) {
const currentDate = await currentResult.getAttribute('title');
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
const currentDateFormatted = DateUtil.parse(currentDate, 'MMM DD, YYYY, h:mm:ss a');
await expect(currentDateFormatted <= DateUtil.parse(toDate, 'DD-MM-YY')).toBe(true);

View File

@@ -16,7 +16,7 @@
*/
import {
ApiService,
ApiService, BrowserActions,
DataTableComponentPage,
DateUtil,
LocalStorageUtil,
@@ -176,7 +176,7 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
@@ -206,7 +206,7 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
@@ -220,7 +220,7 @@ describe('Search Number Range Filter', () => {
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of resultsSize) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= toSize).toBe(true);
}
@@ -228,7 +228,7 @@ describe('Search Number Range Filter', () => {
const resultsDisplay = await dataTable.geCellElementDetail('Display name') as ElementFinder[];
for (const currentResult of resultsDisplay) {
const name = await currentResult.getAttribute('title');
const name = await BrowserActions.getAttribute(currentResult, 'title');
if (name && name.trim() !== '') {
await expect(/z*/i.test(name)).toBe(true);
}
@@ -266,7 +266,7 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(currentSize === '0').toBe(true);
}
@@ -305,7 +305,7 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= 1000).toBe(true);
}
@@ -318,7 +318,7 @@ describe('Search Number Range Filter', () => {
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of resultsSize) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) >= 1000).toBe(true);
}
@@ -409,7 +409,7 @@ describe('Search Number Range Filter', () => {
const results = await dataTable.geCellElementDetail('Created') as ElementFinder[];
for (const currentResult of results) {
const currentDate = await currentResult.getAttribute('title');
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
const currentDateFormatted = DateUtil.parse(currentDate, 'MMM DD, YYYY, h:mm:ss a');
await expect(currentDateFormatted.getFullYear() <= toYear).toBe(true);

View File

@@ -16,7 +16,7 @@
*/
import {
ApiService,
ApiService, BrowserActions,
DataTableComponentPage,
LocalStorageUtil,
LoginPage,
@@ -127,7 +127,7 @@ describe('Search Slider Filter', () => {
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of results) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) <= 5000).toBe(true);
@@ -141,7 +141,7 @@ describe('Search Slider Filter', () => {
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
for (const currentResult of resultsSize) {
const currentSize = await currentResult.getAttribute('title');
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
if (currentSize && currentSize.trim() !== '') {
await expect(parseInt(currentSize, 10) >= 5000).toBe(true);

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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');
}

View File

@@ -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> {

View File

@@ -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);
}
}

View File

@@ -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')) {

View File

@@ -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> {

View File

@@ -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);

View File

@@ -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');
}
}

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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);
}

View File

@@ -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();
}
}
}

View File

@@ -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');
}

View File

@@ -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);

View File

@@ -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');
}
}

View File

@@ -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);
}

View File

@@ -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);
}
/**

View File

@@ -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()}`);

View File

@@ -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);
}
/*

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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);
}
}

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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> {

34977
package-lock.json generated

File diff suppressed because it is too large Load Diff