Move process cloud page int @alfresco/adf-testing (#4540)

Move datatable @alfresco/adf-testing
This commit is contained in:
Eugenio Romano
2019-04-02 15:36:58 +01:00
committed by GitHub
parent 24779498a3
commit f46c848308
41 changed files with 124 additions and 253 deletions

View File

@@ -0,0 +1,285 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { ElementFinder, ElementArrayFinder } from 'protractor/built/element';
import { BrowserVisibility } from '../browser-visibility';
export class DataTableComponentPage {
rootElement: ElementFinder;
list: ElementArrayFinder;
contents;
tableBody;
spinner;
rows = by.css(`adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row']`);
allColumns;
selectedRowNumber;
allSelectedRows;
selectAll;
constructor(rootElement: ElementFinder = element.all(by.css('adf-datatable')).first()) {
this.rootElement = rootElement;
this.list = this.rootElement.all(by.css(`div[class*='adf-datatable-body'] div[class*='adf-datatable-row']`));
this.contents = this.rootElement.all(by.css('div[class="adf-datatable-body"] span'));
this.tableBody = this.rootElement.all(by.css(`div[class='adf-datatable-body']`)).first();
this.spinner = this.rootElement.element(by.css('mat-progress-spinner'));
this.allColumns = this.rootElement.all(by.css('div[data-automation-id*="auto_id_entry."]'));
this.selectedRowNumber = this.rootElement.element(by.css(`div[class*='is-selected'] div[data-automation-id*='text_']`));
this.allSelectedRows = this.rootElement.all(by.css(`div[class*='is-selected']`));
this.selectAll = this.rootElement.element(by.css(`div[class*='adf-datatable-header'] mat-checkbox`));
}
checkAllRowsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
return this;
}
checkAllRows() {
BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
BrowserVisibility.waitUntilElementIsClickable(this.selectAll).then(() => {
this.selectAll.click();
BrowserVisibility.waitUntilElementIsVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
});
return this;
}
clickCheckbox(columnName, columnValue) {
const checkbox = this.getRowCheckbox(columnName, columnValue);
BrowserVisibility.waitUntilElementIsClickable(checkbox);
checkbox.click();
}
checkRowIsNotChecked(columnName, columnValue) {
BrowserVisibility.waitUntilElementIsNotOnPage(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
}
checkRowIsChecked(columnName, columnValue) {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]')));
}
getRowCheckbox(columnName, columnValue) {
return this.getRow(columnName, columnValue)
.element(by.css('mat-checkbox'));
}
checkNoRowIsSelected() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.selectedRowNumber);
}
getNumberOfSelectedRows() {
return this.allSelectedRows.count();
}
selectRowWithKeyboard(columnName, columnValue) {
const row = this.getRow(columnName, columnValue);
browser.actions().sendKeys(protractor.Key.COMMAND).click(row).perform();
}
selectRow(columnName, columnValue) {
const row = this.getRow(columnName, columnValue);
BrowserVisibility.waitUntilElementIsVisible(row);
BrowserVisibility.waitUntilElementIsClickable(row);
row.click();
return this;
}
checkRowIsSelected(columnName, columnValue) {
const selectedRow = this.getRowElement(columnName, columnValue).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsVisible(selectedRow);
return this;
}
checkRowIsNotSelected(columnName, columnValue) {
const selectedRow = this.getRowElement(columnName, columnValue).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsNotOnPage(selectedRow);
return this;
}
getColumnValueForRow(identifyingColumn, identifyingValue, columnName) {
const row = this.getRow(identifyingColumn, identifyingValue);
BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
BrowserVisibility.waitUntilElementIsVisible(rowColumn);
return rowColumn.getText();
}
/**
* Check the list is sorted.
*
* @param sortOrder: 'true' if the list is expected to be sorted ascendant and 'false' for descendant
* @param locator: locator for column
* @return 'true' if the list is sorted as expected and 'false' if it isn't
*/
checkListIsSorted(sortOrder, locator) {
const deferred = protractor.promise.defer();
const column = element.all(by.css(`div[title='${locator}'] span`));
BrowserVisibility.waitUntilElementIsVisible(column.first());
const initialList = [];
column.each(function (currentElement) {
currentElement.getText().then(function (text) {
initialList.push(text);
});
}).then(function () {
let sortedList = initialList;
sortedList = sortedList.sort();
if (sortOrder === false) {
sortedList = sortedList.reverse();
}
deferred.fulfill(initialList.toString() === sortedList.toString());
});
return deferred.promise;
}
rightClickOnRow(columnName, columnValue) {
const row = this.getRow(columnName, columnValue);
browser.actions().click(row, protractor.Button.RIGHT).perform();
BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}
getTooltip(columnName, columnValue) {
return this.getRowElement(columnName, columnValue).getAttribute('title');
}
getFileHyperlink(filename) {
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));
}
numberOfRows() {
return this.rootElement.all(this.rows).count();
}
async getAllRowsColumnValues(column) {
const columnLocator = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='" + column + "'] span");
BrowserVisibility.waitUntilElementIsVisible(element.all(columnLocator).first());
const initialList: any = await element.all(columnLocator).getText();
return initialList.filter((el) => el);
}
async getRowsWithSameColumnValues(columnName, columnValue) {
const columnLocator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`);
BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
return this.rootElement.all(columnLocator).getText();
}
doubleClickRow(columnName, columnValue) {
const row = this.getRow(columnName, columnValue);
BrowserVisibility.waitUntilElementIsVisible(row);
BrowserVisibility.waitUntilElementIsClickable(row);
row.click();
this.checkRowIsSelected(columnName, columnValue);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
return this;
}
waitForTableBody() {
BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
getFirstElementDetail(detail) {
const firstNode = element.all(by.css(`adf-datatable div[title="${detail}"] span`)).first();
return firstNode.getText();
}
geCellElementDetail(detail) {
return element.all(by.css(`adf-datatable div[title="${detail}"] span`));
}
sortByColumn(sortOrder, column) {
const locator = by.css(`div[data-automation-id="auto_id_${column}"]`);
BrowserVisibility.waitUntilElementIsVisible(element(locator));
return element(locator).getAttribute('class').then(function (result) {
if (sortOrder === true) {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
element(locator).click();
}
}
} else {
if (result.includes('sorted-asc')) {
element(locator).click();
} else if (result.includes('sortable')) {
element(locator).click();
element(locator).click();
}
}
return Promise.resolve();
});
}
checkContentIsDisplayed(columnName, columnValue) {
const row = this.getRow(columnName, columnValue);
BrowserVisibility.waitUntilElementIsVisible(row);
return this;
}
checkContentIsNotDisplayed(columnName, columnValue) {
const row = this.getRowElement(columnName, columnValue);
BrowserVisibility.waitUntilElementIsNotOnPage(row);
return this;
}
contentInPosition(position) {
BrowserVisibility.waitUntilElementIsVisible(this.contents);
return this.contents.get(position - 1).getText();
}
getRow(columnName, columnValue) {
const row = this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"]`)).first()
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row')]`));
BrowserVisibility.waitUntilElementIsVisible(row);
return row;
}
getRowElement(columnName, columnValue) {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`)).first();
}
checkSpinnerIsDisplayed() {
BrowserVisibility.waitUntilElementIsPresent(this.spinner);
return this;
}
checkSpinnerIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.spinner);
return this;
}
tableIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
return this;
}
checkColumnIsDisplayed(column) {
BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`)));
return this;
}
getNumberOfColumns() {
return this.allColumns.count();
}
getNumberOfRows() {
return this.list.count();
}
getCellByRowAndColumn(rowColumn, rowContent, columnName) {
return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`));
}
}

View File

@@ -17,3 +17,5 @@
export * from './header.page';
export * from './user-info.page';
export * from './login-sso.page';
export * from './data-table-component.page';

View File

@@ -17,7 +17,7 @@
import { element, by, browser, protractor } from 'protractor';
import { BrowserVisibility } from '../browser-visibility';
import { TabsPage } from '../material/tabs.page';
import { TabsPage } from '../../material/pages/tabs.page';
export class UserInfoPage {

View File

@@ -18,6 +18,5 @@
export * from './browser-visibility';
export * from './actions/public-api';
export * from './pages/public-api';
export * from './material/public-api';
export * from './models/public-api';
export * from './string.util';

View File

@@ -16,7 +16,7 @@
*/
import { element, by } from 'protractor';
import { BrowserVisibility } from '../browser-visibility';
import { BrowserVisibility } from '../../core/browser-visibility';
export class TabsPage {

View File

@@ -15,4 +15,4 @@
* limitations under the License.
*/
export * from './tabs.page';
export * from './pages/public-api';

View File

@@ -0,0 +1,82 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { BrowserVisibility } from '../../../core/browser-visibility';
export class EditProcessFilterDialogPage {
componentElement = element(by.css('adf-cloud-process-filter-dialog-cloud'));
title = element(by.id('adf-process-filter-dialog-title'));
filterNameInput = element(by.id('adf-filter-name-id'));
saveButtonLocator = by.id('adf-save-button-id');
cancelButtonLocator = by.id('adf-cancel-button-id');
clickOnSaveButton() {
const saveButton = this.componentElement.element(this.saveButtonLocator);
BrowserVisibility.waitUntilElementIsVisible(saveButton);
saveButton.click();
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled();
}
clickOnCancelButton() {
const cancelButton = this.componentElement.element(this.cancelButtonLocator);
BrowserVisibility.waitUntilElementIsVisible(cancelButton);
cancelButton.click();
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
}
checkCancelButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
return this.componentElement.element(this.cancelButtonLocator).isEnabled();
}
getFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
return this.filterNameInput.getAttribute('value');
}
setFilterName(filterName) {
this.clearFilterName();
this.filterNameInput.sendKeys(filterName);
return this;
}
clearFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
this.filterNameInput.click();
this.filterNameInput.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filterNameInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
}
getTitle() {
BrowserVisibility.waitUntilElementIsVisible(this.title);
return this.title.getText();
}
}

View File

@@ -0,0 +1,82 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { BrowserVisibility } from '../../../core/browser-visibility';
export class EditTaskFilterDialogPage {
componentElement = element(by.css('adf-cloud-task-filter-dialog'));
title = element(by.id('adf-task-filter-dialog-title'));
filterNameInput = element(by.id('adf-filter-name-id'));
saveButtonLocator = by.id('adf-save-button-id');
cancelButtonLocator = by.id('adf-cancel-button-id');
clickOnSaveButton() {
const saveButton = this.componentElement.element(this.saveButtonLocator);
BrowserVisibility.waitUntilElementIsVisible(saveButton);
saveButton.click();
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.saveButtonLocator));
return this.componentElement.element(this.saveButtonLocator).isEnabled();
}
clickOnCancelButton() {
const cancelButton = this.componentElement.element(this.cancelButtonLocator);
BrowserVisibility.waitUntilElementIsVisible(cancelButton);
cancelButton.click();
BrowserVisibility.waitUntilElementIsNotVisible(this.componentElement);
return this;
}
checkCancelButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.componentElement.element(this.cancelButtonLocator));
return this.componentElement.element(this.cancelButtonLocator).isEnabled();
}
getFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
return this.filterNameInput.getAttribute('value');
}
setFilterName(filterName) {
this.clearFilterName();
this.filterNameInput.sendKeys(filterName);
return this;
}
clearFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.filterNameInput);
this.filterNameInput.click();
this.filterNameInput.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filterNameInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
}
getTitle() {
BrowserVisibility.waitUntilElementIsVisible(this.title);
return this.title.getText();
}
}

View File

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

View File

@@ -0,0 +1,203 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { EditProcessFilterDialogPage } from './dialog/edit-process-filter-dialog.page';
import { BrowserVisibility } from '../../core/browser-visibility';
export class EditProcessFilterCloudComponentPage {
customiseFilter = element(by.id('adf-edit-process-filter-title-id'));
selectedOption = element.all(by.css('mat-option[class*="mat-selected"]')).first();
saveButton = element(by.css('button[data-automation-id="adf-filter-action-save"]'));
saveAsButton = element(by.css('button[data-automation-id="adf-filter-action-saveAs"]'));
deleteButton = element(by.css('button[data-automation-id="adf-filter-action-delete"]'));
editProcessFilterDialogPage = new EditProcessFilterDialogPage();
editProcessFilterDialog() {
return this.editProcessFilterDialogPage;
}
clickCustomiseFilterHeader() {
BrowserVisibility.waitUntilElementIsVisible(this.customiseFilter);
this.customiseFilter.click();
return this;
}
checkCustomiseFilterHeaderIsExpanded() {
const expansionPanelExtended = element.all(by.css('mat-expansion-panel-header[class*="mat-expanded"]')).first();
BrowserVisibility.waitUntilElementIsVisible(expansionPanelExtended);
const content = element(by.css('div[class*="mat-expansion-panel-content "][style*="visible"]'));
BrowserVisibility.waitUntilElementIsVisible(content);
return this;
}
setStatusFilterDropDown(option) {
this.clickOnDropDownArrow('status');
const statusElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(statusElement);
BrowserVisibility.waitUntilElementIsVisible(statusElement);
statusElement.click();
return this;
}
getStateFilterDropDownValue() {
return element(by.css("mat-form-field[data-automation-id='status'] span")).getText();
}
setSortFilterDropDown(option) {
this.clickOnDropDownArrow('sort');
const sortElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(sortElement);
BrowserVisibility.waitUntilElementIsVisible(sortElement);
sortElement.click();
return this;
}
getSortFilterDropDownValue() {
const sortLocator = element.all(by.css("mat-form-field[data-automation-id='sort'] span")).first();
BrowserVisibility.waitUntilElementIsVisible(sortLocator);
return sortLocator.getText();
}
setOrderFilterDropDown(option) {
this.clickOnDropDownArrow('order');
const orderElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(orderElement);
BrowserVisibility.waitUntilElementIsVisible(orderElement);
orderElement.click();
return this;
}
getOrderFilterDropDownValue() {
return element(by.css("mat-form-field[data-automation-id='order'] span")).getText();
}
clickOnDropDownArrow(option) {
const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class='mat-select-arrow-wrapper']")).first();
BrowserVisibility.waitUntilElementIsVisible(dropDownArrow);
BrowserVisibility.waitUntilElementIsClickable(dropDownArrow);
dropDownArrow.click();
BrowserVisibility.waitUntilElementIsVisible(this.selectedOption);
}
setAppNameDropDown(option) {
this.clickOnDropDownArrow('appName');
const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(appNameElement);
BrowserVisibility.waitUntilElementIsVisible(appNameElement);
appNameElement.click();
return this;
}
async checkAppNamesAreUnique() {
const appNameList = element.all(by.css('mat-option[data-automation-id="adf-cloud-edit-process-property-optionsappName"] span'));
const appTextList: any = await appNameList.getText();
const uniqueArray = appTextList.filter((appName) => {
const sameAppNameArray = appTextList.filter((eachApp) => eachApp === appName);
return sameAppNameArray.length === 1;
});
return uniqueArray.length === appTextList.length;
}
getNumberOfAppNameOptions() {
this.clickOnDropDownArrow('appName');
const dropdownOptions = element.all(by.css('.mat-select-panel mat-option'));
return dropdownOptions.count();
}
setProcessInstanceId(option) {
return this.setProperty('processInstanceId', option);
}
getProcessInstanceId() {
return this.getProperty('processInstanceId');
}
getProperty(property) {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
BrowserVisibility.waitUntilElementIsVisible(locator);
return locator.getAttribute('value');
}
setProperty(property, option) {
const locator = element.all(by.css('input[data-automation-id="adf-cloud-edit-process-property-' + property + '"]')).first();
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.clear();
locator.sendKeys(option);
locator.sendKeys(protractor.Key.ENTER);
return this;
}
checkSaveButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this;
}
checkSaveAsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
return this;
}
checkDeleteButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
return this;
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.saveButton.isEnabled();
}
checkSaveAsButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
return this.saveAsButton.isEnabled();
}
checkDeleteButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
return this.deleteButton.isEnabled();
}
clickSaveAsButton() {
const disabledButton = element(by.css(("button[id='adf-save-as-id'][disabled]")));
BrowserVisibility.waitUntilElementIsClickable(this.saveAsButton);
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
this.saveAsButton.click();
return this.editProcessFilterDialogPage;
}
clickDeleteButton() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
this.deleteButton.click();
return this;
}
clickSaveButton() {
const disabledButton = element(by.css(("button[id='adf-save-as-id'][disabled]")));
BrowserVisibility.waitUntilElementIsClickable(this.saveButton);
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
this.saveButton.click();
return this;
}
}

View File

@@ -0,0 +1,266 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { EditTaskFilterDialogPage } from './dialog/edit-task-filter-dialog.page';
import { BrowserVisibility } from '../../core/browser-visibility';
export class EditTaskFilterCloudComponentPage {
customiseFilter = element(by.id('adf-edit-task-filter-title-id'));
selectedOption = element.all(by.css('mat-option[class*="mat-selected"]')).first();
assignee = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-assignee"]'));
priority = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-priority"]'));
taskName = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-taskName"]'));
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-automation-id="adf-cloud-edit-task-property-lastModifiedFrom"]'));
lastModifiedTo = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-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"]'));
editTaskFilterDialogPage = new EditTaskFilterDialogPage();
editTaskFilterDialog() {
return this.editTaskFilterDialogPage;
}
clickCustomiseFilterHeader() {
BrowserVisibility.waitUntilElementIsVisible(this.customiseFilter);
this.customiseFilter.click();
return this;
}
setStatusFilterDropDown(option) {
this.clickOnDropDownArrow('status');
const statusElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsVisible(statusElement);
BrowserVisibility.waitUntilElementIsClickable(statusElement);
statusElement.click();
return this;
}
getStatusFilterDropDownValue() {
return element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-status'] span")).first().getText();
}
setSortFilterDropDown(option) {
this.clickOnDropDownArrow('sort');
const sortElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(sortElement);
BrowserVisibility.waitUntilElementIsVisible(sortElement);
sortElement.click();
return this;
}
getSortFilterDropDownValue() {
const elementSort = element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-sort'] span")).first();
BrowserVisibility.waitUntilElementIsVisible(elementSort);
return elementSort.getText();
}
setOrderFilterDropDown(option) {
this.clickOnDropDownArrow('order');
const orderElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(orderElement);
BrowserVisibility.waitUntilElementIsVisible(orderElement);
orderElement.click();
return this;
}
getOrderFilterDropDownValue() {
return element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-order'] span")).first().getText();
}
clickOnDropDownArrow(option) {
const dropDownArrow = element.all(by.css("mat-form-field[data-automation-id='" + option + "'] div[class*='arrow']")).first();
BrowserVisibility.waitUntilElementIsVisible(dropDownArrow);
dropDownArrow.click();
BrowserVisibility.waitUntilElementIsVisible(this.selectedOption);
}
setAssignee(option) {
return this.setProperty('assignee', option);
}
getAssignee() {
return this.assignee.getText();
}
setPriority(option) {
return this.setProperty('priority', option);
}
getPriority() {
return this.priority.getText();
}
setParentTaskId(option) {
return this.setProperty('parentTaskId', option);
}
getParentTaskId() {
return this.parentTaskId.getText();
}
setOwner(option) {
return this.setProperty('owner', option);
}
getOwner() {
return this.owner.getText();
}
setLastModifiedFrom(option) {
this.clearField(this.lastModifiedFrom);
return this.setProperty('lastModifiedFrom', option);
}
getLastModifiedFrom() {
return this.lastModifiedFrom.getText();
}
setLastModifiedTo(option) {
this.clearField(this.lastModifiedTo);
return this.setProperty('lastModifiedTo', option);
}
getLastModifiedTo() {
return this.lastModifiedTo.getText();
}
checkSaveButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this;
}
checkSaveAsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
return this;
}
checkDeleteButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
return this;
}
checkSaveButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.saveButton.isEnabled();
}
checkSaveAsButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.saveAsButton.isEnabled();
}
checkDeleteButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
return this.deleteButton.isEnabled();
}
clickSaveAsButton() {
const disabledButton = element(by.css(("button[data-automation-id='adf-filter-action-saveAs'][disabled]")));
BrowserVisibility.waitUntilElementIsClickable(this.saveAsButton);
BrowserVisibility.waitUntilElementIsVisible(this.saveAsButton);
BrowserVisibility.waitUntilElementIsNotVisible(disabledButton);
this.saveAsButton.click();
return this.editTaskFilterDialogPage;
}
clickDeleteButton() {
BrowserVisibility.waitUntilElementIsVisible(this.deleteButton);
this.deleteButton.click();
return this;
}
clickSaveButton() {
BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
this.saveButton.click();
return this;
}
clearAssignee() {
this.clearField(this.assignee);
return this;
}
clearField(locator) {
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
locator.sendKeys(protractor.Key.BACK_SPACE);
}
});
}
setAppNameDropDown(option) {
this.clickOnDropDownArrow('appName');
const appNameElement = element.all(by.cssContainingText('mat-option span', option)).first();
BrowserVisibility.waitUntilElementIsClickable(appNameElement);
BrowserVisibility.waitUntilElementIsVisible(appNameElement);
appNameElement.click();
return this;
}
getAppNameDropDownValue() {
const locator = element.all(by.css("mat-select[data-automation-id='adf-cloud-edit-task-property-appName'] span")).first();
BrowserVisibility.waitUntilElementIsVisible(locator);
return locator.getText();
}
setTaskName(option) {
return this.setProperty('taskName', option);
}
getTaskName() {
return this.taskName.getAttribute('value');
}
setProcessDefinitionId(option) {
return this.setProperty('processDefinitionId', option);
}
getProcessDefinitionId() {
return this.processDefinitionId.getAttribute('value');
}
setProcessInstanceId(option) {
return this.setProperty('processInstanceId', option);
}
setProperty(property, option) {
const locator = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-' + property + '"]'));
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.clear();
locator.sendKeys(option);
locator.sendKeys(protractor.Key.ENTER);
return this;
}
getProcessInstanceId() {
return this.processInstanceId.getAttribute('value');
}
}

View File

@@ -0,0 +1,62 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { BrowserVisibility } from '../../core/browser-visibility';
export class GroupCloudComponentPage {
groupCloudSearch = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]'));
searchGroups(name) {
BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
this.groupCloudSearch.clear().then(() => {
for (let i = 0; i < name.length; i++) {
this.groupCloudSearch.sendKeys(name[i]);
}
this.groupCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
this.groupCloudSearch.sendKeys(name[name.length - 1]);
});
return this;
}
selectGroupFromList(name) {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
BrowserVisibility.waitUntilElementIsVisible(groupRow);
groupRow.click();
BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
return this;
}
checkGroupIsDisplayed(name) {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
BrowserVisibility.waitUntilElementIsVisible(groupRow);
return this;
}
checkGroupIsNotDisplayed(name) {
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
return this;
}
checkSelectedGroup(group) {
BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip[data-automation-id*="adf-cloud-group-chip-"]', group)));
return this;
}
}

View File

@@ -0,0 +1,75 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { BrowserVisibility } from '../../core/browser-visibility';
export class PeopleCloudComponentPage {
peopleCloudSearch = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
searchAssigneeAndSelect(name) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
this.peopleCloudSearch.clear();
this.peopleCloudSearch.sendKeys(name);
this.selectAssigneeFromList(name);
return this;
}
searchAssignee(name) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
this.peopleCloudSearch.clear().then(() => {
for (let i = 0; i < name.length; i++) {
this.peopleCloudSearch.sendKeys(name[i]);
}
this.peopleCloudSearch.sendKeys(protractor.Key.BACK_SPACE);
this.peopleCloudSearch.sendKeys(name[name.length - 1]);
});
return this;
}
selectAssigneeFromList(name) {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
assigneeRow.click();
BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
return this;
}
getAssignee() {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
return this.peopleCloudSearch.getAttribute('value');
}
checkUserIsDisplayed(name) {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
return this;
}
checkUserIsNotDisplayed(name) {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
return this;
}
checkSelectedPeople(person) {
BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-list mat-chip', person)));
return this;
}
}

View File

@@ -0,0 +1,58 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by } from 'protractor';
import { BrowserVisibility } from '../../core/browser-visibility';
export class ProcessFiltersCloudComponentPage {
filter;
filterIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
constructor(filter) {
this.filter = filter;
}
checkProcessFilterIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this;
}
getProcessFilterIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.filterIcon);
BrowserVisibility.waitUntilElementIsVisible(icon);
return icon.getText();
}
checkProcessFilterHasNoIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
BrowserVisibility.waitUntilElementIsNotOnPage(this.filter.element(this.filterIcon));
}
clickProcessFilter() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
BrowserVisibility.waitUntilElementIsClickable(this.filter);
return this.filter.click();
}
checkProcessFilterNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
return this.filter;
}
}

View File

@@ -0,0 +1,71 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserVisibility } from '../../core/browser-visibility';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { element, by } from 'protractor';
export class ProcessListCloudComponentPage {
processList = element(by.css('adf-cloud-process-list'));
noProcessFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
dataTable = new DataTableComponentPage(this.processList);
getDataTable() {
return this.dataTable;
}
selectRow(processName) {
return this.dataTable.selectRow('Name', processName);
}
selectRowById(processId) {
return this.dataTable.selectRow('Id', processId);
}
checkContentIsDisplayedByName(processName) {
return this.dataTable.checkContentIsDisplayed('Name', processName);
}
checkContentIsDisplayedById(processId) {
return this.dataTable.checkContentIsDisplayed('Id', processId);
}
checkContentIsNotDisplayedById(processId) {
return this.dataTable.checkContentIsNotDisplayed('Id', processId);
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues('Name');
}
checkProcessListIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.processList);
return this;
}
getNoProcessFoundMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.noProcessFound);
return this.noProcessFound.getText();
}
getAllRowsByColumn(column) {
return this.dataTable.getAllRowsColumnValues(column);
}
}

View File

@@ -15,7 +15,16 @@
* limitations under the License.
*/
export * from './login-sso.page';
export * from './start-tasks-cloud-component.page';
export * from './task-header-cloud-component.page';
export * from './process-header-cloud-component.page';
export * from './edit-process-filter-cloud-component.page';
export * from './edit-task-filter-cloud-component.page';
export * from './group-cloud-component.page';
export * from './people-cloud-component.page';
export * from './process-filters-cloud-component.page';
export * from './process-list-cloud-component.page';
export * from './task-filters-cloud-component.page';
export * from './task-list-cloud-component.page';
export * from './dialog/public-api';

View File

@@ -0,0 +1,57 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by } from 'protractor';
import { BrowserVisibility } from '../../core/browser-visibility';
export class TaskFiltersCloudComponentPage {
filter;
taskIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
constructor(filter) {
this.filter = filter;
}
checkTaskFilterIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this;
}
getTaskFilterIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.taskIcon);
BrowserVisibility.waitUntilElementIsVisible(icon);
return icon.getText();
}
checkTaskFilterHasNoIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
BrowserVisibility.waitUntilElementIsNotOnPage(this.filter.element(this.taskIcon));
}
clickTaskFilter() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this.filter.click();
}
checkTaskFilterNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
return this.filter;
}
}

View File

@@ -0,0 +1,113 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserVisibility } from '../../core/browser-visibility';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { element, by } from 'protractor';
const column = {
id: 'Id'
};
export class TaskListCloudComponentPage {
taskList = element(by.css('adf-cloud-task-list'));
noTasksFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
dataTable = new DataTableComponentPage(this.taskList);
getDataTable() {
return this.dataTable;
}
clickCheckbox(taskName) {
return this.dataTable.clickCheckbox('Name', taskName);
}
checkRowIsNotChecked(taskName) {
return this.dataTable.checkRowIsNotChecked('Name', taskName);
}
checkRowIsChecked(taskName) {
return this.dataTable.checkRowIsChecked('Name', taskName);
}
getRowsWithSameName(taskName) {
return this.dataTable.getRowsWithSameColumnValues('Name', taskName);
}
checkRowIsSelected(taskName) {
return this.dataTable.checkRowIsSelected('Name', taskName);
}
checkRowIsNotSelected(taskName) {
return this.dataTable.checkRowIsNotSelected('Name', taskName);
}
selectRowWithKeyboard(taskName) {
return this.dataTable.selectRowWithKeyboard('Name', taskName);
}
selectRow(taskName) {
return this.dataTable.selectRow('Name', taskName);
}
getRow(taskName) {
return this.dataTable.getRowElement('Name', taskName);
}
checkContentIsDisplayedByProcessInstanceId(taskName) {
return this.dataTable.checkContentIsDisplayed('ProcessInstanceId', taskName);
}
checkContentIsDisplayedById(taskName) {
return this.dataTable.checkContentIsDisplayed('Id', taskName);
}
checkContentIsDisplayedByName(taskName) {
return this.dataTable.checkContentIsDisplayed('Name', taskName);
}
checkContentIsNotDisplayedByName(taskName) {
return this.dataTable.checkContentIsNotDisplayed('Name', taskName);
}
checkTaskListIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.taskList);
return this;
}
getNoTasksFoundMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.noTasksFound);
return this.noTasksFound.getText();
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues('Name');
}
getAllRowsByColumn(columnName) {
return this.dataTable.getAllRowsColumnValues(columnName);
}
getIdCellValue(rowName) {
const locator = new DataTableComponentPage().getCellByRowAndColumn('Name', rowName, column.id);
BrowserVisibility.waitUntilElementIsVisible(locator);
return locator.getText();
}
}

View File

@@ -16,8 +16,9 @@
*/
export * from './lib/core/public-api';
export * from './lib/core/material/public-api';
export * from './lib/material/public-api';
export * from './lib/content-services/public-api';
export * from './lib/material/public-api';
export * from './lib/process-services/public-api';
export * from './lib/process-services-cloud/public-api';
export * from './lib/testing.module';