fix ordering e2e failing test (#4825)

* ordering fix use common method in datatable

* ordering fix use common method in datatable

* fix sorting ps e2e

* fix ordering

* move search page in testing and fix sorting boolean flag

* fix import

* fix moment

* use common sort method in document list test

* use common sort method in document list test

* remove unnecesary sort control

* remove duplicate test

* remove e2e suspended removed status

* documentation
This commit is contained in:
Eugenio Romano
2019-06-11 07:34:16 +01:00
committed by GitHub
parent c85df84a01
commit 990fa4625b
43 changed files with 951 additions and 477 deletions
@@ -251,35 +251,26 @@ describe('Document List - Pagination', function () {
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getElementsDisplayedName().then((elements) => {
contentServicesPage.checkElementsSortedAsc(elements);
});
contentServicesPage.sortByName(false);
contentServicesPage.getElementsDisplayedName().then(function (list) {
contentServicesPage.checkElementsSortedDesc(list);
});
expect(contentServicesPage.getContentList().dataTablePage().checkListIsSorted('ASC', 'Display name'));
contentServicesPage.sortByName('DESC');
expect(contentServicesPage.getContentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
paginationPage.selectItemsPerPage(itemsPerPage.five);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getElementsDisplayedName().then(function (list) {
contentServicesPage.checkElementsSortedDesc(list);
});
expect(contentServicesPage.getContentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
paginationPage.clickOnNextPage();
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getElementsDisplayedName().then(function (list) {
contentServicesPage.checkElementsSortedDesc(list);
});
expect(contentServicesPage.getContentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
paginationPage.selectItemsPerPage(itemsPerPage.ten);
contentServicesPage.checkAcsContainer();
contentServicesPage.waitForTableBody();
contentServicesPage.getElementsDisplayedName().then(function (list) {
contentServicesPage.checkElementsSortedDesc(list);
});
expect(contentServicesPage.getContentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
});
it('[C260107] Should not display pagination bar when a folder is empty', () => {
@@ -1,162 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, browser, protractor } from 'protractor';
import { DatePickerPage } from '../../../material/datePickerPage';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class DateRangeFilterPage {
fromField = by.css('input[data-automation-id="date-range-from-input"]');
fromDateToggle = by.css('mat-datepicker-toggle[data-automation-id="date-range-from-date-toggle"]');
toField = by.css('input[data-automation-id="date-range-to-input"]');
toDateToggle = by.css('mat-datepicker-toggle[data-automation-id="date-range-to-date-toggle"]');
applyButton = by.css('button[data-automation-id="date-range-apply-btn"]');
clearButton = by.css('button[data-automation-id="date-range-clear-btn"]');
fromErrorMessage = by.css('mat-error[data-automation-id="date-range-from-error"]');
toErrorMessage = by.css('mat-error[data-automation-id="date-range-to-error"]');
filter;
constructor(filter) {
this.filter = filter;
}
getFromDate() {
return this.filter.element(this.fromField).getAttribute('value');
}
putFromDate(date) {
this.checkFromFieldIsDisplayed();
this.filter.element(this.fromField).clear();
this.filter.element(this.fromField).sendKeys(date);
this.filter.element(this.fromField).sendKeys(protractor.Key.ENTER);
return this;
}
getFromCalendarSelectedDate() {
const selectedDate = this.openFromDatePicker().getSelectedDate();
new DatePickerPage().closeDatePicker();
return selectedDate;
}
openFromDatePicker() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromDateToggle));
this.filter.element(this.fromDateToggle).click();
return new DatePickerPage().checkDatePickerIsDisplayed();
}
openToDatePicker() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toDateToggle));
this.filter.element(this.toDateToggle).click();
return new DatePickerPage().checkDatePickerIsDisplayed();
}
clickFromField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromField));
this.filter.element(this.fromField).click();
return this;
}
checkFromErrorMessageIsDisplayed(msg) {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorMessage));
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.fromErrorMessage).getText()).toEqual(msg);
});
return this;
}
checkFromErrorMessageIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorMessage));
return this;
}
checkFromFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromField));
return this;
}
checkFromDateToggleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromDateToggle));
return this;
}
getToDate() {
return this.filter.element(this.toField).getAttribute('value');
}
putToDate(date) {
this.checkToFieldIsDisplayed();
this.filter.element(this.toField).clear();
this.filter.element(this.toField).sendKeys(date);
this.filter.element(this.toField).sendKeys(protractor.Key.ENTER);
return this;
}
clickToField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toField));
this.filter.element(this.toField).click();
return this;
}
checkToErrorMessageIsDisplayed(msg) {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorMessage));
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.toErrorMessage).getText()).toEqual(msg);
});
return this;
}
checkToFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toField));
return this;
}
checkToDateToggleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toDateToggle));
return this;
}
clickApplyButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.applyButton));
this.filter.element(this.applyButton).click();
return this;
}
checkApplyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
return this;
}
checkApplyButtonIsEnabled() {
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.applyButton).isEnabled()).toBe(true);
});
return this;
}
checkApplyButtonIsDisabled() {
browser.controlFlow().execute(async () => {
await expect(this.filter.element(this.applyButton).isEnabled()).toBe(false);
});
return this;
}
checkClearButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
return this;
}
}
@@ -1,164 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class NumberRangeFilterPage {
fromInput = by.css('input[data-automation-id="number-range-from-input"]');
toInput = by.css('input[data-automation-id="number-range-to-input"]');
applyButton = by.css('button[data-automation-id="number-range-btn-apply"]');
clearButton = by.css('button[data-automation-id="number-range-btn-clear"]');
fromErrorInvalid = by.css('mat-error[data-automation-id="number-range-from-error-invalid"]');
fromErrorRequired = by.css('mat-error[data-automation-id="number-range-from-error-required"]');
toErrorInvalid = by.css('mat-error[data-automation-id="number-range-to-error-invalid"]');
toErrorRequired = by.css('mat-error[data-automation-id="number-range-to-error-required"]');
filter;
constructor(filter) {
this.filter = filter;
}
clearFromField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromInput));
this.filter.element(this.fromInput).getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filter.element(this.fromInput).sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
}
getFromNumber() {
return this.filter.element(this.fromInput).getAttribute('value');
}
putFromNumber(value) {
this.checkFromFieldIsDisplayed();
this.filter.element(this.fromInput).clear();
this.filter.element(this.fromInput).sendKeys(value);
this.filter.element(this.fromInput).sendKeys(protractor.Key.ENTER);
return this;
}
getFromErrorRequired() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired));
return BrowserActions.getText(this.filter.element(this.fromErrorRequired));
}
checkFromErrorRequiredIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired));
return this;
}
getFromErrorInvalid() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid));
return BrowserActions.getText(this.filter.element(this.fromErrorInvalid));
}
checkFromErrorInvalidIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid));
return this;
}
checkFromFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromInput));
return this;
}
clearToField() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toInput));
this.filter.element(this.toInput).getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.filter.element(this.toInput).sendKeys(protractor.Key.BACK_SPACE);
}
});
return this;
}
getToNumber() {
return this.filter.element(this.toInput).getAttribute('value');
}
putToNumber(value) {
this.checkToFieldIsDisplayed();
this.filter.element(this.toInput).clear();
this.filter.element(this.toInput).sendKeys(value);
this.filter.element(this.toInput).sendKeys(protractor.Key.ENTER);
return this;
}
getToErrorRequired() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired));
return BrowserActions.getText(this.filter.element(this.toErrorRequired));
}
checkToErrorRequiredIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired));
return this;
}
getToErrorInvalid() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid));
return BrowserActions.getText(this.filter.element(this.toErrorInvalid));
}
checkToErrorInvalidIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid));
return this;
}
checkToFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toInput));
return this;
}
clickApplyButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.applyButton));
this.filter.element(this.applyButton).click();
return this;
}
checkApplyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
return this;
}
checkApplyButtonIsEnabled() {
return this.filter.element(this.applyButton).isEnabled();
}
clickClearButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.clearButton));
this.filter.element(this.clearButton).click();
return this;
}
checkClearButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
return this;
}
checkNoErrorMessageIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorInvalid));
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorRequired));
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorInvalid));
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorRequired));
return this;
}
}
@@ -1,181 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class SearchCheckListPage {
filter: ElementFinder;
inputBy = by.css('div[class*="mat-expansion-panel-content"] input');
showMoreBy = by.css('button[title="Show more"]');
showLessBy = by.css('button[title="Show less"]');
clearAllButton = by.css('button');
constructor(filter: ElementFinder) {
this.filter = filter;
}
clickCheckListOption(option) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.all(by.css(`mat-checkbox[data-automation-id*='${option}'] .mat-checkbox-inner-container`)).first();
BrowserActions.click(result);
}
checkChipIsDisplayed(option) {
BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
return this;
}
checkChipIsNotDisplayed(option) {
BrowserVisibility.waitUntilElementIsNotOnPage(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
return this;
}
removeFilterOption(option) {
const cancelChipButton = element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon'));
BrowserActions.click(cancelChipButton);
return this;
}
filterBy(option) {
this.checkSearchFilterInputIsDisplayed();
this.searchInFilter(option);
this.clickCheckListOption(option);
return this;
}
checkSearchFilterInputIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.all(this.inputBy).first());
return this;
}
searchInFilter(option) {
BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.all(this.inputBy).first();
BrowserVisibility.waitUntilElementIsClickable(inputElement);
inputElement.clear();
this.filter.all(this.inputBy).first().sendKeys(option);
return this;
}
checkShowLessButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showLessBy));
return this;
}
checkShowLessButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
return this;
}
checkShowMoreButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
return this;
}
checkShowMoreButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showMoreBy));
return this;
}
clickShowMoreButtonUntilIsNotDisplayed() {
this.filter.element(this.showMoreBy).isDisplayed().then(async (visible) => {
if (visible) {
this.filter.element(this.showMoreBy).click();
this.clickShowMoreButtonUntilIsNotDisplayed();
}
}, () => {
});
return this;
}
clickShowLessButtonUntilIsNotDisplayed() {
this.filter.element(this.showLessBy).isDisplayed().then(async (visible) => {
if (visible) {
this.filter.element(this.showLessBy).click();
this.clickShowLessButtonUntilIsNotDisplayed();
}
}, () => {
});
return this;
}
getBucketNumberOfFilterType(option) {
const fileTypeFilter = this.filter.all(by.css('mat-checkbox[data-automation-id*=".' + option + '"] span')).first();
BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter);
const bucketNumber = fileTypeFilter.getText().then((valueOfBucket) => {
const numberOfBucket = valueOfBucket.split('(')[1];
const totalNumberOfBucket = numberOfBucket.split(')')[0];
return totalNumberOfBucket.trim();
});
return bucketNumber;
}
checkCheckListOptionIsDisplayed(option) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}']`));
return BrowserVisibility.waitUntilElementIsVisible(result);
}
checkCheckListOptionIsNotSelected(option) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`));
return BrowserVisibility.waitUntilElementIsNotVisible(result);
}
checkCheckListOptionIsSelected(option) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`));
return BrowserVisibility.waitUntilElementIsVisible(result);
}
checkClearAllButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(this.clearAllButton);
return BrowserVisibility.waitUntilElementIsVisible(result);
}
clickClearAllButton() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(this.clearAllButton);
BrowserVisibility.waitUntilElementIsVisible(result);
return BrowserActions.click(result);
}
getCheckListOptionsNumberOnPage() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
const checkListOptions = this.filter.all(by.css('div[class="checklist"] mat-checkbox'));
return checkListOptions.count();
}
clickShowMoreButton() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
return this.filter.element(this.showMoreBy).click();
}
clickShowLessButton() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
return this.filter.element(this.showLessBy).click();
}
}
@@ -1,74 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class SearchRadioPage {
filter;
showMoreButton = element(by.css('adf-search-radio button[title="Show more"]'));
showLessButton = element(by.css('adf-search-radio button[title="Show less"]'));
constructor(filter) {
this.filter = filter;
}
checkFilterRadioButtonIsDisplayed(filterName) {
const filterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"]'));
return BrowserVisibility.waitUntilElementIsVisible(filterType);
}
checkFilterRadioButtonIsChecked(filterName) {
const selectedFilterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"][class*="checked"]'));
return BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
}
clickFilterRadioButton(filterName) {
browser.executeScript(`document.querySelector('[data-automation-id="search-radio-${filterName}"] input').click();`);
}
getRadioButtonsNumberOnPage() {
const radioButtons = element.all(by.css('mat-radio-button'));
return radioButtons.count();
}
checkShowMoreButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
}
checkShowLessButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
}
checkShowMoreButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.showMoreButton);
}
checkShowLessButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
}
clickShowMoreButton() {
return BrowserActions.click(this.showMoreButton);
}
clickShowLessButton() {
return BrowserActions.click(this.showLessButton);
}
}
@@ -1,77 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class SearchSliderPage {
filter;
slider = by.css('mat-slider[data-automation-id="slider-range"]');
clearButton = by.css('button[data-automation-id="slider-btn-clear"]');
sliderWithThumbLabel = by.css('mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]');
constructor(filter) {
this.filter = filter;
}
getMaxValue() {
return this.filter.element(this.slider).getAttribute('aria-valuemax');
}
getMinValue() {
return this.filter.element(this.slider).getAttribute('aria-valuemin');
}
getValue() {
return this.filter.element(this.slider).getAttribute('aria-valuenow');
}
setValue(value) {
browser.actions().dragAndDrop(
this.filter.element(this.slider).element(by.css('div[class="mat-slider-thumb"]')),
{x: value * 10, y: 0}
).perform();
return this;
}
checkSliderIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.slider));
return this;
}
checkSliderWithThumbLabelIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.sliderWithThumbLabel));
return this;
}
clickClearButton() {
BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.clearButton));
this.filter.element(this.clearButton).click();
return this;
}
checkClearButtonIsEnabled() {
return this.filter.element(this.clearButton).isEnabled();
}
checkClearButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
return this;
}
}
@@ -1,97 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class SearchSortingPickerPage {
sortingSelector = element(by.css('adf-sorting-picker div[class="mat-select-arrow"]'));
orderArrow = element(by.css('adf-sorting-picker button mat-icon'));
optionsDropdown = element(by.css('div[class*="mat-select-panel"]'));
sortBy(sortOrder, sortType) {
BrowserActions.click(this.sortingSelector);
const selectedSortingOption = element(by.cssContainingText('span[class="mat-option-text"]', sortType));
BrowserActions.click(selectedSortingOption);
this.sortByOrder(sortOrder);
}
sortByOrder(sortOrder) {
BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
this.orderArrow.getText().then((result) => {
if (sortOrder === true) {
if (result !== 'arrow_upward') {
browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
} else {
if (result === 'arrow_upward') {
browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
}
});
}
clickSortingOption(option) {
const selectedSortingOption = element(by.cssContainingText('span[class="mat-option-text"]', option));
BrowserActions.click(selectedSortingOption);
return this;
}
clickSortingSelector() {
BrowserActions.click(this.sortingSelector);
return this;
}
checkOptionIsDisplayed(option) {
const optionSelector = this.optionsDropdown.element(by.cssContainingText('span[class="mat-option-text"]', option));
BrowserVisibility.waitUntilElementIsVisible(optionSelector);
return this;
}
checkOptionIsNotDisplayed(option) {
const optionSelector = this.optionsDropdown.element(by.cssContainingText('span[class="mat-option-text"]', option));
BrowserVisibility.waitUntilElementIsNotVisible(optionSelector);
return this;
}
checkOptionsDropdownIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.optionsDropdown);
return this;
}
checkSortingSelectorIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.sortingSelector);
return this;
}
checkOrderArrowIsDownward() {
const deferred = protractor.promise.defer();
BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
this.orderArrow.getText().then((result) => {
deferred.fulfill(result !== 'arrow_upward');
});
return deferred.promise;
}
checkOrderArrowIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
return this;
}
}
@@ -1,41 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { protractor, by } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class SearchTextPage {
filter;
inputBy = by.css('input');
constructor(filter) {
this.filter = filter;
}
getNamePlaceholder() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this.filter.element(this.inputBy).getAttribute('placeholder');
}
searchByName(name) {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
this.filter.element(this.inputBy).clear();
this.filter.element(this.inputBy).sendKeys(name).sendKeys(protractor.Key.ENTER);
}
}
@@ -1,85 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, ElementFinder } from 'protractor';
import { SearchTextPage } from './components/search-text';
import { SearchCheckListPage } from './components/search-checkList';
import { SearchRadioPage } from './components/search-radio';
import { DateRangeFilterPage } from './components/dateRangeFilterPage';
import { NumberRangeFilterPage } from './components/numberRangeFilterPage';
import { SearchSliderPage } from './components/search-slider.page';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class SearchCategoriesPage {
checkListFiltersPage(filter: ElementFinder) {
return new SearchCheckListPage(filter);
}
textFiltersPage(filter: ElementFinder) {
return new SearchTextPage(filter);
}
radioFiltersPage(filter: ElementFinder) {
return new SearchRadioPage(filter);
}
dateRangeFilter(filter: ElementFinder) {
return new DateRangeFilterPage(filter);
}
numberRangeFilter(filter: ElementFinder) {
return new NumberRangeFilterPage(filter);
}
sliderFilter(filter: ElementFinder) {
return new SearchSliderPage(filter);
}
checkFilterIsDisplayed(filter: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(filter);
return this;
}
clickFilter(filter: ElementFinder) {
BrowserVisibility.waitUntilElementIsVisible(filter);
filter.element(by.css('mat-expansion-panel-header')).click();
return this;
}
clickFilterHeader(filter: ElementFinder) {
const fileSizeFilterHeader = filter.element(by.css('mat-expansion-panel-header'));
BrowserVisibility.waitUntilElementIsClickable(fileSizeFilterHeader);
BrowserActions.click(fileSizeFilterHeader);
return this;
}
checkFilterIsCollapsed(filter: ElementFinder) {
filter.getAttribute('class').then((elementClass) => {
expect(elementClass).not.toContain('mat-expanded');
});
return this;
}
checkFilterIsExpanded(filter: ElementFinder) {
filter.getAttribute('class').then((elementClass) => {
expect(elementClass).toContain('mat-expanded');
});
return this;
}
}
+11 -52
View File
@@ -22,8 +22,7 @@ import { DropActions } from '../../actions/drop.actions';
import { by, element, protractor, $$, browser } from 'protractor';
import path = require('path');
import { DateUtil } from '../../util/dateUtil';
import { BrowserVisibility, DocumentListPage, BrowserActions } from '@alfresco/adf-testing';
import { BrowserVisibility, DocumentListPage, BrowserActions, DateUtil } from '@alfresco/adf-testing';
import { NavigationBarPage } from './navigationBarPage';
export class ContentServicesPage {
@@ -183,50 +182,10 @@ export class ContentServicesPage {
return this;
}
getElementsDisplayedSize() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.size);
}
getElementsDisplayedName() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.name);
}
getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
checkElementsSortedAsc(elements) {
let sorted = true;
let i = 0;
while (elements.length > 1 && sorted === true && i < (elements.length - 1)) {
const left = elements[i];
const right = elements[i + 1];
if (left > right) {
sorted = false;
}
i++;
}
return sorted;
}
checkElementsSortedDesc(elements) {
let sorted = true;
let i = 0;
while (elements.length > 1 && sorted === true && i < (elements.length - 1)) {
const left = elements[i];
const right = elements[i + 1];
if (left < right) {
sorted = false;
}
i++;
}
return sorted;
}
checkElementsDateSortedAsc(elements) {
let sorted = true;
let i = 0;
@@ -328,19 +287,19 @@ export class ContentServicesPage {
return this.contentList.getAllRowsColumnValues(this.columns.name);
}
sortByName(sortOrder) {
sortByName(sortOrder: string) {
return this.contentList.dataTable.sortByColumn(sortOrder, this.nameColumnHeader);
}
sortByAuthor(sortOrder) {
sortByAuthor(sortOrder: string) {
return this.contentList.dataTable.sortByColumn(sortOrder, this.createdByColumnHeader);
}
sortByCreated(sortOrder) {
sortByCreated(sortOrder: string) {
return this.contentList.dataTable.sortByColumn(sortOrder, this.createdColumnHeader);
}
sortAndCheckListIsOrderedByName(sortOrder) {
sortAndCheckListIsOrderedByName(sortOrder: string) {
this.sortByName(sortOrder);
const deferred = protractor.promise.defer();
this.checkListIsSortedByNameColumn(sortOrder).then((result) => {
@@ -349,23 +308,23 @@ export class ContentServicesPage {
return deferred.promise;
}
async checkListIsSortedByNameColumn(sortOrder) {
async checkListIsSortedByNameColumn(sortOrder: string) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.name);
}
async checkListIsSortedByCreatedColumn(sortOrder) {
async checkListIsSortedByCreatedColumn(sortOrder: string) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.created);
}
async checkListIsSortedByAuthorColumn(sortOrder) {
async checkListIsSortedByAuthorColumn(sortOrder: string) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.createdBy);
}
async checkListIsSortedBySizeColumn(sortOrder) {
async checkListIsSortedBySizeColumn(sortOrder: string) {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.size);
}
sortAndCheckListIsOrderedByAuthor(sortOrder) {
sortAndCheckListIsOrderedByAuthor(sortOrder: string) {
this.sortByAuthor(sortOrder);
const deferred = protractor.promise.defer();
this.checkListIsSortedByAuthorColumn(sortOrder).then((result) => {
@@ -374,7 +333,7 @@ export class ContentServicesPage {
return deferred.promise;
}
sortAndCheckListIsOrderedByCreated(sortOrder) {
sortAndCheckListIsOrderedByCreated(sortOrder: string) {
this.sortByCreated(sortOrder);
const deferred = protractor.promise.defer();
this.checkListIsSortedByCreatedColumn(sortOrder).then((result) => {
-77
View File
@@ -1,77 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { DateUtil } from '../../../util/dateUtil';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class DatePickerPage {
datePicker = element(by.css('mat-calendar'));
nextMonthButton = element(by.css('button[class*="mat-calendar-next-button"]'));
previousMonthButton = element(by.css('button[class*="mat-calendar-previous-button"]'));
getSelectedDate() {
return element(by.css('td[class*="mat-calendar-body-active"]')).getAttribute('aria-label');
}
checkDatesAfterDateAreDisabled(date) {
const afterDate = DateUtil.formatDate('DD-MM-YY', date, 1);
const afterCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`));
browser.controlFlow().execute(async () => {
if (await afterCalendar.isPresent()) {
await expect(afterCalendar.getAttribute('aria-disabled')).toBe('true');
}
await expect(this.nextMonthButton.isEnabled()).toBe(false);
});
return this;
}
checkDatesBeforeDateAreDisabled(date) {
const beforeDate = DateUtil.formatDate('DD-MM-YY', date, -1);
const beforeCalendar = element(by.css(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`));
browser.controlFlow().execute(async () => {
if (await beforeCalendar.isPresent()) {
await expect(beforeCalendar.getAttribute('aria-disabled')).toBe('true');
}
await expect(this.previousMonthButton.isEnabled()).toBe(false);
});
return this;
}
selectTodayDate() {
this.checkDatePickerIsDisplayed();
const todayDate = element(by.css('.mat-calendar-body-today'));
BrowserActions.click(todayDate);
return this;
}
closeDatePicker() {
BrowserActions.closeMenuAndDialogs();
this.checkDatePickerIsNotDisplayed();
}
checkDatePickerIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.datePicker);
return this;
}
checkDatePickerIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.datePicker);
return this;
}
}
@@ -34,7 +34,7 @@ export class FiltersPage {
return this;
}
sortByName(sortOrder) {
sortByName(sortOrder: string) {
this.dataTable.sortByColumn(sortOrder, 'name');
}
@@ -96,9 +96,9 @@ export class ProcessFiltersPage {
/**
* Sort the list by name column.
*
* @param sortOrder : 'true' to sort the list ascendant and 'false' for descendant
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
sortByName(sortOrder) {
sortByName(sortOrder: string) {
this.dataTable.sortByColumn(sortOrder, 'name');
}
+2 -2
View File
@@ -151,11 +151,11 @@ export class TasksPage {
}
clickSortByNameAsc() {
return this.tasksListPage().getDataTable().sortByColumn(true, 'name');
return this.tasksListPage().getDataTable().sortByColumn('ASC', 'name');
}
clickSortByNameDesc() {
return this.tasksListPage().getDataTable().sortByColumn(false, 'name');
return this.tasksListPage().getDataTable().sortByColumn('DESC', 'name');
}
}
+3 -4
View File
@@ -16,8 +16,7 @@
*/
import { element, by } from 'protractor';
import { SearchCategoriesPage } from './content-services/search/search-categories';
import { BrowserVisibility } from '@alfresco/adf-testing';
import { BrowserVisibility, SearchCategoriesPage } from '@alfresco/adf-testing';
export class SearchFiltersPage {
@@ -282,12 +281,12 @@ export class SearchFiltersPage {
return this;
}
checkFileTypeFacetLabelIsDisplayed(fileType) {
checkFileTypeFacetLabelIsDisplayed(fileType: string | RegExp) {
BrowserVisibility.waitUntilElementIsVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
return this;
}
checkFileTypeFacetLabelIsNotDisplayed(fileType) {
checkFileTypeFacetLabelIsNotDisplayed(fileType: string | RegExp) {
BrowserVisibility.waitUntilElementIsNotVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
return this;
}
+8 -30
View File
@@ -16,10 +16,9 @@
*/
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { SearchSortingPickerPage } from './content-services/search/components/search-sortingPicker.page';
import { element, by } from 'protractor';
import { ContentServicesPage } from './contentServicesPage';
import { BrowserVisibility } from '@alfresco/adf-testing';
import { BrowserVisibility, SearchSortingPickerPage } from '@alfresco/adf-testing';
export class SearchResultsPage {
@@ -36,14 +35,6 @@ export class SearchResultsPage {
this.dataTable.tableIsLoaded();
}
closeActionButton() {
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
BrowserVisibility.waitUntilElementIsVisible(container);
container.click();
BrowserVisibility.waitUntilElementIsNotVisible(container);
return this;
}
checkContentIsDisplayed(content) {
this.dataTable.checkContentIsDisplayed('Display name', content);
return this;
@@ -77,46 +68,33 @@ export class SearchResultsPage {
this.contentServices.deleteContent(content);
}
checkDeleteIsDisabled(content) {
this.contentServices.checkDeleteIsDisabled(content);
this.closeActionButton();
}
sortByName(sortOrder) {
sortByName(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Name');
}
sortByAuthor(sortOrder) {
sortByAuthor(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Author');
}
sortByCreated(sortOrder) {
sortByCreated(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Created');
}
sortBySize(sortOrder) {
sortBySize(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Size');
return this;
}
async checkListIsOrderedByNameAsc() {
const list = await this.contentServices.getElementsDisplayedName();
return this.contentServices.checkElementsSortedAsc(list);
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Display name');
}
async checkListIsOrderedByNameDesc() {
const list = await this.contentServices.getElementsDisplayedName();
return this.contentServices.checkElementsSortedDesc(list);
return this.contentServices.contentList.dataTablePage().checkListIsSorted('DESC', 'Display name');
}
async checkListIsOrderedByAuthorAsc() {
const authorList = await this.dataTable.geCellElementDetail('Created by');
return this.contentServices.checkElementsSortedAsc(authorList);
}
async checkListIsOrderedByAuthorDesc() {
const authorList = await this.dataTable.geCellElementDetail('Created by');
return this.contentServices.checkElementsSortedDesc(authorList);
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Created by');
}
}
@@ -90,6 +90,7 @@ xdescribe('Process list cloud', () => {
'processInstanceId',
'order',
'sort',
'initiator',
'order'
],
'sortProperties': [
@@ -107,7 +108,7 @@ xdescribe('Process list cloud', () => {
done();
}, 5 * 60 * 1000);
afterAll(async(done) => {
afterAll(async (done) => {
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
await identityService.deleteIdentityUser(testUser.idIdentityService);
done();
@@ -124,45 +125,23 @@ xdescribe('Process list cloud', () => {
it('[C290069] Should display processes ordered by name when Name is selected from sort dropdown', async () => {
processCloudDemoPage.editProcessFilterCloudComponent().clickCustomiseFilterHeader().setStatusFilterDropDown('RUNNING')
.setSortFilterDropDown('Name').setOrderFilterDropDown('ASC');
processCloudDemoPage.processListCloudComponent().getAllRowsNameColumn().then(function (list) {
const initialList = list.slice(0);
list.sort();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(processCloudDemoPage.processListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Name')).toBe(true);
processCloudDemoPage.editProcessFilterCloudComponent().setOrderFilterDropDown('DESC');
processCloudDemoPage.processListCloudComponent().getAllRowsNameColumn().then(function (list) {
const initialList = list.slice(0);
list.sort();
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(processCloudDemoPage.processListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Name')).toBe(true);
});
it('[C291783] Should display processes ordered by id when Id is selected from sort dropdown', async () => {
processCloudDemoPage.editProcessFilterCloudComponent().clickCustomiseFilterHeader().setStatusFilterDropDown('RUNNING')
.setSortFilterDropDown('Id').setOrderFilterDropDown('ASC');
processCloudDemoPage.processListCloudComponent().getDataTable();
browser.driver.sleep(1000);
processCloudDemoPage.getAllRowsByIdColumn().then(function (list) {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(processCloudDemoPage.processListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Id')).toBe(true);
processCloudDemoPage.editProcessFilterCloudComponent().setOrderFilterDropDown('DESC');
processCloudDemoPage.processListCloudComponent().getDataTable();
browser.driver.sleep(1000);
processCloudDemoPage.getAllRowsByIdColumn().then(function (list) {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(processCloudDemoPage.processListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Id')).toBe(true);
});
it('[C297697] The value of the filter should be preserved when saving it', async () => {
@@ -20,14 +20,13 @@ import {
StringUtil, TasksService,
ProcessDefinitionsService, ProcessInstancesService,
LoginSSOPage, ApiService,
AppListCloudPage, LocalStorageUtil, IdentityService, SettingsPage, GroupIdentityService
AppListCloudPage, LocalStorageUtil, IdentityService, SettingsPage, GroupIdentityService, DateUtil
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
import { TaskListCloudConfiguration } from './taskListCloud.config';
import moment = require('moment');
import { DateUtil } from '../util/dateUtil';
import resources = require('../util/resources');
@@ -49,7 +48,8 @@ describe('Edit task filters and task list properties', () => {
const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;
const candidateBaseApp = resources.ACTIVITI7_APPS.CANDIDATE_BASE_APP.name;
const noTasksFoundMessage = 'No Tasks Found';
let createdTask, notAssigned, notDisplayedTask, processDefinition, processInstance, priorityTask, subTask, otherOwnerTask, testUser, groupInfo;
let createdTask, notAssigned, notDisplayedTask, processDefinition, processInstance, priorityTask, subTask,
otherOwnerTask, testUser, groupInfo;
const priority = 30;
const beforeDate = moment().add(-1, 'days').format('DD/MM/YYYY');
@@ -75,7 +75,7 @@ describe('Edit task filters and task list properties', () => {
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
notAssigned = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
priorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, {priority: priority});
priorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: priority });
await tasksService.claimTask(priorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
@@ -85,7 +85,7 @@ describe('Edit task filters and task list properties', () => {
processInstancesService = new ProcessInstancesService(apiService);
processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, {'parentTaskId': createdTask.entry.id});
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { 'parentTaskId': createdTask.entry.id });
await tasksService.claimTask(subTask.entry.id, simpleApp);
const jsonFile = new TaskListCloudConfiguration().getConfiguration();
@@ -135,7 +135,7 @@ describe('Edit task filters and task list properties', () => {
done();
}, 5 * 60 * 1000);
afterAll(async(done) => {
afterAll(async (done) => {
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
await identityService.deleteIdentityUser(testUser.idIdentityService);
done();
@@ -383,241 +383,85 @@ describe('Edit task filters and task list properties', () => {
it('[C306901] Should display tasks sorted by task name when taskName is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ASSIGNED')
.setSortFilterDropDown('Name').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsNameColumn().then( (list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Name')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsNameColumn().then( (list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Name')).toBe(true);
});
it('[C290156] Should display tasks ordered by id when Id is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ASSIGNED')
.setSortFilterDropDown('Id').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Id')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Id')).toBe(true);
});
it('[C306903] Should display tasks sorted by processDefinitionId when processDefinitionId is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ASSIGNED')
.setSortFilterDropDown('ProcessDefinitionId').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByProcessDefIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'ProcessDefinitionId')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByProcessDefIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'ProcessDefinitionId')).toBe(true);
});
it('[C306905] Should display tasks sorted by processInstanceId when processInstanceId is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ASSIGNED')
.setSortFilterDropDown('ProcessInstanceId').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByProcessInstanceIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'ProcessInstanceId')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByProcessInstanceIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'ProcessInstanceId')).toBe(true);
});
it('[C306907] Should display tasks sorted by assignee when assignee is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee().setStatusFilterDropDown('ALL')
.setSortFilterDropDown('Assignee').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByAssigneeColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Assignee')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByAssigneeColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Assignee')).toBe(true);
});
it('[C306911] Should display tasks sorted by parentTaskId when parentTaskId is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee().setStatusFilterDropDown('ALL')
.setSortFilterDropDown('ParentTaskId').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByParentTaskIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'ParentTaskId')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByParentTaskIdColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'ParentTaskId')).toBe(true);
});
it('[C306909] Should display tasks sorted by priority when priority is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee().setStatusFilterDropDown('ALL')
.setSortFilterDropDown('Priority').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByPriorityColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Priority')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByPriorityColumn().then((list) => {
list = list.map(Number);
const initialList = list.slice(0);
list.sort((a, b) => b - a);
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Priority')).toBe(true);
});
it('[C307114] Should display tasks sorted by standAlone when standAlone is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee().setStatusFilterDropDown('ALL')
.setSortFilterDropDown('StandAlone').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByStandAloneColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'StandAlone')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByStandAloneColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'StandAlone')).toBe(true);
});
it('[C307115] Should display tasks sorted by owner when owner is selected from sort dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee().setStatusFilterDropDown('ALL')
.setSortFilterDropDown('Owner').setOrderFilterDropDown('ASC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByOwnerColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('ASC', 'Owner')).toBe(true);
tasksCloudDemoPage.editTaskFilterCloudComponent().setOrderFilterDropDown('DESC');
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkSpinnerIsNotDisplayed();
tasksCloudDemoPage.taskListCloudComponent().getAllRowsByOwnerColumn().then((list) => {
const initialList = list.slice(0);
list.sort(function (firstStr, secondStr) {
return firstStr.localeCompare(secondStr);
});
list.reverse();
expect(JSON.stringify(initialList) === JSON.stringify(list)).toEqual(true);
});
expect(tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkListIsSorted('DESC', 'Owner')).toBe(true);
});
});
@@ -55,7 +55,7 @@ describe('Task filters cloud', () => {
completedTaskName = StringUtil.generateRandomString(),
assignedTaskName = StringUtil.generateRandomString(), deletedTaskName = StringUtil.generateRandomString();
const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;
let assignedTask, deletedTask, suspendedTasks, testUser, groupInfo;
let assignedTask, deletedTask, testUser, groupInfo;
const orderByNameAndPriority = ['cCreatedTask', 'dCreatedTask', 'eCreatedTask'];
let priority = 30;
const nrOfTasks = 3;
@@ -90,7 +90,6 @@ describe('Task filters cloud', () => {
const secondProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
queryService = new QueryService(apiService);
suspendedTasks = await queryService.getProcessInstanceTasks(processInstance.entry.id, simpleApp);
await queryService.getProcessInstanceTasks(secondProcessInstance.entry.id, simpleApp);
await processInstancesService.suspendProcessInstance(processInstance.entry.id, simpleApp);
await processInstancesService.deleteProcessInstance(secondProcessInstance.entry.id, simpleApp);
@@ -148,16 +147,6 @@ describe('Task filters cloud', () => {
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
});
it('[C290154] Should display only tasks with suspended statuses when Suspended is selected from status dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clickCustomiseFilterHeader().clearAssignee()
.setStatusFilterDropDown('SUSPENDED');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(suspendedTasks.list.entries[0].entry.id);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(deletedTaskName);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(createdTaskName);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTaskName);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(assignedTaskName);
});
it('[C290060] Should display only tasks with Created status when Created is selected from status dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clickCustomiseFilterHeader().clearAssignee().setStatusFilterDropDown('CREATED');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTaskName);
@@ -168,7 +157,6 @@ describe('Task filters cloud', () => {
it('[C290155] Should display only tasks with Cancelled status when Cancelled is selected from status dropdown', () => {
tasksCloudDemoPage.editTaskFilterCloudComponent().clickCustomiseFilterHeader().clearAssignee().setStatusFilterDropDown('CANCELLED');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(suspendedTasks.list.entries[0].entry.name);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(deletedTaskName);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(assignedTaskName);
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTaskName);
@@ -18,7 +18,7 @@
import { LoginPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TaskListDemoPage } from '../pages/adf/demo-shell/process-services/taskListDemoPage';
import { PaginationPage } from '@alfresco/adf-testing';
import { PaginationPage, DateUtil } from '@alfresco/adf-testing';
import moment = require('moment');
import { Tenant } from '../models/APS/tenant';
@@ -31,7 +31,6 @@ import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { AppsActions } from '../actions/APS/apps.actions';
import { AppsRuntimeActions } from '../actions/APS/appsRuntime.actions';
import { UsersActions } from '../actions/users.actions';
import { DateUtil } from '../util/dateUtil';
describe('Start Task - Custom App', () => {
@@ -15,10 +15,9 @@
* limitations under the License.
*/
import { LoginPage, Widget } from '@alfresco/adf-testing';
import { LoginPage, Widget, DatePickerPage } from '@alfresco/adf-testing';
import { ProcessFiltersPage } from '../pages/adf/process-services/processFiltersPage';
import { ProcessServiceTabBarPage } from '../pages/adf/process-services/processServiceTabBarPage';
import { DatePickerPage } from '../pages/adf/material/datePickerPage';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { browser } from 'protractor';
@@ -38,7 +37,7 @@ describe('Dynamic Table', () => {
const widget = new Widget();
let user, tenantId, appId, apps, users;
beforeAll(async(done) => {
beforeAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: browser.params.testConfig.adf.url
@@ -56,7 +55,7 @@ describe('Dynamic Table', () => {
done();
});
afterAll(async(done) => {
afterAll(async (done) => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
@@ -75,7 +74,7 @@ describe('Dynamic Table', () => {
const rowPosition = 0;
beforeAll(async(done) => {
beforeAll(async (done) => {
await this.alfrescoJsApi.login(user.email, user.password);
const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
@@ -86,7 +85,7 @@ describe('Dynamic Table', () => {
done();
});
afterAll(async(done) => {
afterAll(async (done) => {
await this.alfrescoJsApi.login(user.email, user.password);
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
@@ -129,7 +128,7 @@ describe('Dynamic Table', () => {
const app = resources.Files.APP_DYNAMIC_TABLE_DROPDOWN;
const dropdown = widget.dropdown();
beforeAll(async(done) => {
beforeAll(async (done) => {
await this.alfrescoJsApi.login(user.email, user.password);
@@ -141,7 +140,7 @@ describe('Dynamic Table', () => {
done();
});
afterAll(async(done) => {
afterAll(async (done) => {
await this.alfrescoJsApi.login(user.email, user.password);
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
@@ -376,11 +376,11 @@ describe('Process List - Pagination', function () {
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
processFiltersPage.sortByName(true);
processFiltersPage.sortByName('ASC');
processFiltersPage.waitForTableBody();
processFiltersPage.checkProcessesSortedByNameAsc();
processFiltersPage.sortByName(false);
processFiltersPage.sortByName('DESC');
processFiltersPage.waitForTableBody();
processFiltersPage.checkProcessesSortedByNameDesc();
});
@@ -395,7 +395,7 @@ describe('Process List - Pagination', function () {
processDetailsPage.checkProcessTitleIsDisplayed();
processFiltersPage.waitForTableBody();
processFiltersPage.sortByName(true);
processFiltersPage.sortByName('ASC');
processFiltersPage.waitForTableBody();
processFiltersPage.checkProcessesSortedByNameAsc();
@@ -83,12 +83,12 @@ describe('Task List Pagination - Sorting', () => {
taskPage.tasksListPage().getDataTable().waitForTableBody();
paginationPage.selectItemsPerPage(itemsPerPage.twenty);
taskPage.tasksListPage().getDataTable().waitForTableBody();
taskPage.filtersPage().sortByName(true);
taskPage.filtersPage().sortByName('ASC');
taskPage.tasksListPage().getDataTable().waitForTableBody();
taskPage.filtersPage().getAllRowsNameColumn().then(function (list) {
expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
});
taskPage.filtersPage().sortByName(false);
taskPage.filtersPage().sortByName('DESC');
taskPage.filtersPage().getAllRowsNameColumn().then(function (list) {
taskNames.reverse();
expect(JSON.stringify(list) === JSON.stringify(taskNames)).toEqual(true);
@@ -15,18 +15,16 @@
* limitations under the License.
*/
import { LoginPage, LocalStorageUtil } from '@alfresco/adf-testing';
import { LoginPage, LocalStorageUtil, DatePickerPage, DateUtil } from '@alfresco/adf-testing';
import { SearchDialog } from '../../pages/adf/dialog/searchDialog';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { SearchResultsPage } from '../../pages/adf/searchResultsPage';
import { DatePickerPage } from '../../pages/adf/material/datePickerPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage';
import { SearchConfiguration } from '../search.config';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { browser } from 'protractor';
import { DateUtil } from '../../util/dateUtil';
describe('Search Date Range Filter', () => {
@@ -131,7 +129,7 @@ describe('Search Date Range Filter', () => {
dateRangeFilter.checkApplyButtonIsEnabled()
.clickApplyButton();
searchResults.sortByCreated(true);
searchResults.sortByCreated('ASC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Created');
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { LoginPage, LocalStorageUtil } from '@alfresco/adf-testing';
import { LoginPage, LocalStorageUtil, DateUtil } from '@alfresco/adf-testing';
import { SearchDialog } from '../../pages/adf/dialog/searchDialog';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { SearchResultsPage } from '../../pages/adf/searchResultsPage';
@@ -29,7 +29,6 @@ import { FileModel } from '../../models/ACS/fileModel';
import { browser } from 'protractor';
import resources = require('../../util/resources');
import { SearchConfiguration } from '../search.config';
import { DateUtil } from '../../util/dateUtil';
describe('Search Number Range Filter', () => {
@@ -165,7 +164,7 @@ describe('Search Number Range Filter', () => {
sizeRangeFilter.clickApplyButton();
searchResults.tableIsLoaded();
searchResults.sortBySize(false);
searchResults.sortBySize('DESC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Size');
@@ -196,7 +195,7 @@ describe('Search Number Range Filter', () => {
expect(sizeRangeFilter.checkApplyButtonIsEnabled()).toBe(true);
sizeRangeFilter.clickApplyButton();
searchResults.sortBySize(false);
searchResults.sortBySize('DESC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Size');
@@ -214,7 +213,7 @@ describe('Search Number Range Filter', () => {
searchFilters.checkNameFilterIsDisplayed()
.checkNameFilterIsExpanded();
nameFilter.searchByName('z*');
searchResults.sortBySize(false);
searchResults.sortBySize('DESC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Size');
@@ -270,7 +269,7 @@ describe('Search Number Range Filter', () => {
sizeRangeFilter.clickApplyButton();
searchResults.tableIsLoaded();
searchResults.sortBySize(false);
searchResults.sortBySize('DESC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Size');
@@ -308,7 +307,7 @@ describe('Search Number Range Filter', () => {
expect(sizeRangeFilter.getToNumber()).toEqual('');
sizeRangeFilter.putFromNumber(0).putToNumber(1).clickApplyButton();
searchResults.sortBySize(false);
searchResults.sortBySize('DESC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Size');
@@ -418,7 +417,7 @@ describe('Search Number Range Filter', () => {
sizeRangeFilter.clickApplyButton();
searchResults.tableIsLoaded();
searchResults.sortByCreated(false);
searchResults.sortByCreated('DESC');
browser.controlFlow().execute(async () => {
const results = await dataTable.geCellElementDetail('Created');
+2 -2
View File
@@ -118,7 +118,7 @@ describe('Search Number Range Filter', () => {
it('[C276981] Should be able to clear value in Search Size Slider', () => {
const size = 5;
sizeSliderFilter.checkSliderIsDisplayed().setValue(size);
searchResults.sortBySize(false)
searchResults.sortBySize('DESC')
.tableIsLoaded();
browser.controlFlow().execute(async () => {
@@ -137,7 +137,7 @@ describe('Search Number Range Filter', () => {
sizeSliderFilter.checkSliderIsDisplayed()
.clickClearButton();
searchResults.sortBySize(false)
searchResults.sortBySize('DESC')
.tableIsLoaded();
browser.controlFlow().execute(async () => {
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { LoginPage, LocalStorageUtil, BrowserActions } from '@alfresco/adf-testing';
import { LoginPage, LocalStorageUtil, BrowserActions, SearchSortingPickerPage } from '@alfresco/adf-testing';
import { SearchDialog } from '../../pages/adf/dialog/searchDialog';
import { SearchResultsPage } from '../../pages/adf/searchResultsPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
@@ -29,7 +29,6 @@ import { AcsUserModel } from '../../models/ACS/acsUserModel';
import { browser } from 'protractor';
import resources = require('../../util/resources');
import { SearchConfiguration } from '../search.config';
import { SearchSortingPickerPage } from '../../pages/adf/content-services/search/components/search-sortingPicker.page';
describe('Search Sorting Picker', () => {
@@ -175,29 +174,20 @@ describe('Search Sorting Picker', () => {
it('[C277280] Should be able to sort the search results by "Name" ASC', () => {
searchFilters.checkSearchFiltersIsDisplayed();
searchFilters.creatorCheckListFiltersPage().filterBy(`${acsUser.firstName} ${acsUser.lastName}`);
searchResults.sortByName(true);
searchResults.sortByName('ASC');
expect(searchResults.checkListIsOrderedByNameAsc()).toBe(true);
});
it('[C277281] Should be able to sort the search results by "Name" DESC', () => {
searchFilters.checkSearchFiltersIsDisplayed();
searchFilters.creatorCheckListFiltersPage().filterBy(`${acsUser.firstName} ${acsUser.lastName}`);
searchResults.sortByName(false);
searchResults.sortByName('DESC');
expect(searchResults.checkListIsOrderedByNameDesc()).toBe(true);
});
it('[C277282] Should be able to sort the search results by "Author" ASC', () => {
searchResults.sortByAuthor(true);
expect(searchResults.checkListIsOrderedByAuthorAsc()).toBe(true);
});
it('[C277283] Should be able to sort the search results by "Author" DESC', () => {
searchResults.sortByAuthor(false);
expect(searchResults.checkListIsOrderedByAuthorDesc()).toBe(true);
});
it('[C277286] Should be able to sort the search results by "Created Date" ASC', () => {
searchResults.sortByCreated(true);
searchResults.sortByCreated('ASC');
browser.controlFlow().execute(async () => {
const results = await searchResults.dataTable.geCellElementDetail('Created');
expect(contentServices.checkElementsDateSortedAsc(results)).toBe(true);
@@ -205,7 +195,7 @@ describe('Search Sorting Picker', () => {
});
it('[C277287] Should be able to sort the search results by "Created Date" DESC', () => {
searchResults.sortByCreated(false);
searchResults.sortByCreated('DESC');
browser.controlFlow().execute(async () => {
const results = await searchResults.dataTable.geCellElementDetail('Created');
expect(contentServices.checkElementsDateSortedDesc(results)).toBe(true);
@@ -230,7 +220,7 @@ describe('Search Sorting Picker', () => {
.enterTextAndPressEnter(search);
searchSortingPicker.checkSortingSelectorIsDisplayed()
.sortBy(true, 'Modified Date');
.sortBy('ASC', 'Modified Date');
browser.controlFlow().execute(async () => {
const idList = await contentServices.getElementsDisplayedId();
@@ -245,25 +235,4 @@ describe('Search Sorting Picker', () => {
});
});
it('[C277301] Should be able to change default sorting option for the search results', async () => {
navigationBar.clickContentServicesButton();
jsonFile = SearchConfiguration.getConfiguration();
jsonFile.sorting.options.push({
'key': 'createdByUser',
'label': 'Author',
'type': 'FIELD',
'field': 'cm:creator',
'ascending': true
});
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
searchDialog.checkSearchIconIsVisible()
.clickOnSearchIcon()
.enterTextAndPressEnter(search);
searchSortingPicker.checkSortingSelectorIsDisplayed();
expect(searchResults.checkListIsOrderedByAuthorAsc()).toBe(true);
});
});
-29
View File
@@ -1,29 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as moment from 'moment';
export class DateUtil {
static formatDate(dateFormat: string, date: Date = new Date, days: number | string = 0): string {
return moment(date).add(days, 'days').format(dateFormat);
}
static parse(date: string, dateFormat: string = 'DD-MM-YY'): Date {
return moment(date, dateFormat).toDate();
}
}