mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[APPS-2136] migrate search-datetime-range to date-fns (#9004)
* strongly typed forms * migrate to date-fns * [ci:force] mark moment pipes for deprecation * [ci:force] try migrate the metadata smoke e2e * [ci:force] remove dead code * cleanup dead code and switch e2e to date-fns * [ci:force] migrate tests * revert metadata * [ci:force] migrate e2e * [ci:force] delete date util
This commit is contained in:
@@ -15,23 +15,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { DropActions, BrowserActions, BrowserVisibility, DocumentListPage, DropdownPage, Logger } from '@alfresco/adf-testing';
|
||||||
DropActions,
|
|
||||||
BrowserActions,
|
|
||||||
BrowserVisibility,
|
|
||||||
DateUtil,
|
|
||||||
DocumentListPage,
|
|
||||||
DropdownPage,
|
|
||||||
Logger
|
|
||||||
} from '@alfresco/adf-testing';
|
|
||||||
import { $$, browser, by, element, protractor, $ } from 'protractor';
|
import { $$, browser, by, element, protractor, $ } from 'protractor';
|
||||||
import { FolderDialogPage } from './dialog/folder-dialog.page';
|
import { FolderDialogPage } from './dialog/folder-dialog.page';
|
||||||
import { NavigationBarPage } from './navigation-bar.page';
|
import { NavigationBarPage } from './navigation-bar.page';
|
||||||
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export class ContentServicesPage {
|
export class ContentServicesPage {
|
||||||
|
|
||||||
columns = {
|
columns = {
|
||||||
name: 'Display name',
|
name: 'Display name',
|
||||||
size: 'Size',
|
size: 'Size',
|
||||||
@@ -94,28 +84,28 @@ export class ContentServicesPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
|
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteContent(content): Promise<void> {
|
async deleteContent(content: string): Promise<void> {
|
||||||
await this.contentList.clickOnActionMenu(content);
|
await this.contentList.clickOnActionMenu(content);
|
||||||
await BrowserActions.click(this.deleteContentElement);
|
await BrowserActions.click(this.deleteContentElement);
|
||||||
await this.checkContentIsNotDisplayed(content);
|
await this.checkContentIsNotDisplayed(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
async metadataContent(content): Promise<void> {
|
async metadataContent(content: string): Promise<void> {
|
||||||
await this.contentList.clickOnActionMenu(content);
|
await this.contentList.clickOnActionMenu(content);
|
||||||
await BrowserActions.click(this.metadataAction);
|
await BrowserActions.click(this.metadataAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
async versionManagerContent(content): Promise<void> {
|
async versionManagerContent(content: string): Promise<void> {
|
||||||
await this.contentList.clickOnActionMenu(content);
|
await this.contentList.clickOnActionMenu(content);
|
||||||
await BrowserActions.click(this.versionManagerAction);
|
await BrowserActions.click(this.versionManagerAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickFileHyperlink(fileName): Promise<void> {
|
async clickFileHyperlink(fileName: string): Promise<void> {
|
||||||
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
|
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
|
||||||
await BrowserActions.click(hyperlink);
|
await BrowserActions.click(hyperlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkFileHyperlinkIsEnabled(fileName): Promise<void> {
|
async checkFileHyperlinkIsEnabled(fileName: string): Promise<void> {
|
||||||
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
|
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
|
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
|
||||||
}
|
}
|
||||||
@@ -129,38 +119,6 @@ export class ContentServicesPage {
|
|||||||
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
|
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkElementsDateSortedAsc(elements) {
|
|
||||||
let sorted = true;
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while (elements.length > 1 && sorted === true && i < (elements.length - 1)) {
|
|
||||||
const left = DateUtil.parse(elements[i], 'DD-MM-YY');
|
|
||||||
const right = DateUtil.parse(elements[i + 1], 'DD-MM-YY');
|
|
||||||
if (left > right) {
|
|
||||||
sorted = false;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sorted;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkElementsDateSortedDesc(elements) {
|
|
||||||
let sorted = true;
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while (elements.length > 1 && sorted === true && i < (elements.length - 1)) {
|
|
||||||
const left = DateUtil.parse(elements[i], 'DD-MM-YY');
|
|
||||||
const right = DateUtil.parse(elements[i + 1], 'DD-MM-YY');
|
|
||||||
if (left < right) {
|
|
||||||
sorted = false;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sorted;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @deprecated prefer waitTillContentLoaded
|
// @deprecated prefer waitTillContentLoaded
|
||||||
async checkDocumentListElementsAreDisplayed(): Promise<void> {
|
async checkDocumentListElementsAreDisplayed(): Promise<void> {
|
||||||
await this.checkAcsContainer();
|
await this.checkAcsContainer();
|
||||||
@@ -368,16 +326,16 @@ export class ContentServicesPage {
|
|||||||
await DropActions.dropFile(this.dragAndDrop, file);
|
await DropActions.dropFile(this.dragAndDrop, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkLockIsDisplayedForElement(name): Promise<void> {
|
async checkLockIsDisplayedForElement(name: string): Promise<void> {
|
||||||
const lockButton = $(`div.adf-datatable-cell[data-automation-id="${name}"] button`);
|
const lockButton = $(`div.adf-datatable-cell[data-automation-id="${name}"] button`);
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(lockButton);
|
await BrowserVisibility.waitUntilElementIsVisible(lockButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getColumnValueForRow(file, columnName): Promise<string> {
|
async getColumnValueForRow(file: string, columnName: string): Promise<string> {
|
||||||
return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
|
return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkEmptyFolderTextToBe(text): Promise<void> {
|
async checkEmptyFolderTextToBe(text: string): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
|
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
|
||||||
await expect(await this.emptyFolder.getText()).toContain(text);
|
await expect(await this.emptyFolder.getText()).toContain(text);
|
||||||
}
|
}
|
||||||
@@ -386,7 +344,7 @@ export class ContentServicesPage {
|
|||||||
await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url);
|
await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRowIconImageUrl(fileName): Promise<string> {
|
async getRowIconImageUrl(fileName: string): Promise<string> {
|
||||||
const iconRow = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`);
|
const iconRow = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`);
|
||||||
return BrowserActions.getAttribute(iconRow, 'src');
|
return BrowserActions.getAttribute(iconRow, 'src');
|
||||||
}
|
}
|
||||||
@@ -415,12 +373,16 @@ export class ContentServicesPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async checkDocumentCardPropertyIsShowed(elementName: string, propertyName: string): Promise<void> {
|
async checkDocumentCardPropertyIsShowed(elementName: string, propertyName: string): Promise<void> {
|
||||||
const elementProperty = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`);
|
const elementProperty = $(
|
||||||
|
`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`
|
||||||
|
);
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(elementProperty);
|
await BrowserVisibility.waitUntilElementIsVisible(elementProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAttributeValueForElement(elementName: string, propertyName: string): Promise<string> {
|
async getAttributeValueForElement(elementName: string, propertyName: string): Promise<string> {
|
||||||
const elementSize = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`);
|
const elementSize = $(
|
||||||
|
`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`
|
||||||
|
);
|
||||||
return BrowserActions.getText(elementSize);
|
return BrowserActions.getText(elementSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,24 +391,10 @@ export class ContentServicesPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsVisible(elementMenu);
|
await BrowserVisibility.waitUntilElementIsVisible(elementMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
async navigateToCardFolder(folderName: string): Promise<void> {
|
|
||||||
await BrowserActions.closeMenuAndDialogs();
|
|
||||||
const folderCard = $(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`);
|
|
||||||
await BrowserActions.click(folderCard);
|
|
||||||
const folderSelected = $(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`);
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);
|
|
||||||
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectGridSortingFromDropdown(sortingOption: string): Promise<void> {
|
async selectGridSortingFromDropdown(sortingOption: string): Promise<void> {
|
||||||
await this.sortingDropdown.selectDropdownOption(sortingOption);
|
await this.sortingDropdown.selectDropdownOption(sortingOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkRowIsDisplayed(rowName: string): Promise<void> {
|
|
||||||
const row = this.contentList.dataTablePage().getCellElementByValue(this.columns.name, rowName);
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkSelectedSiteIsDisplayed(siteName: string): Promise<void> {
|
async checkSelectedSiteIsDisplayed(siteName: string): Promise<void> {
|
||||||
await this.siteListDropdown.checkOptionIsSelected(siteName);
|
await this.siteListDropdown.checkOptionIsSelected(siteName);
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@ import { $$ } from 'protractor';
|
|||||||
import { BrowserActions } from '@alfresco/adf-testing';
|
import { BrowserActions } from '@alfresco/adf-testing';
|
||||||
|
|
||||||
export class FolderDialogPage {
|
export class FolderDialogPage {
|
||||||
|
|
||||||
folderDialog = $$('adf-folder-dialog').first();
|
folderDialog = $$('adf-folder-dialog').first();
|
||||||
folderNameField = this.folderDialog.$('#adf-folder-name-input');
|
folderNameField = this.folderDialog.$('#adf-folder-name-input');
|
||||||
createUpdateButton = this.folderDialog.$('#adf-folder-create-button');
|
createUpdateButton = this.folderDialog.$('#adf-folder-create-button');
|
||||||
@@ -29,7 +28,7 @@ export class FolderDialogPage {
|
|||||||
await BrowserActions.click(this.createUpdateButton);
|
await BrowserActions.click(this.createUpdateButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addFolderName(folderName): Promise<void> {
|
async addFolderName(folderName: string): Promise<void> {
|
||||||
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
|
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@ import { $, browser } from 'protractor';
|
|||||||
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';
|
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';
|
||||||
|
|
||||||
export class UploadTogglesPage {
|
export class UploadTogglesPage {
|
||||||
|
|
||||||
togglePage = new TogglePage();
|
togglePage = new TogglePage();
|
||||||
multipleFileUploadToggle = $('#adf-multiple-upload-switch');
|
multipleFileUploadToggle = $('#adf-multiple-upload-switch');
|
||||||
uploadFolderToggle = $('#adf-folder-upload-switch');
|
uploadFolderToggle = $('#adf-folder-upload-switch');
|
||||||
@@ -44,11 +43,6 @@ export class UploadTogglesPage {
|
|||||||
await this.togglePage.enableToggle(this.uploadFolderToggle);
|
await this.togglePage.enableToggle(this.uploadFolderToggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkMultipleFileUploadToggleIsEnabled(): Promise<void> {
|
|
||||||
const enabledToggle = $('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]');
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkMaxSizeToggleIsEnabled(): Promise<void> {
|
async checkMaxSizeToggleIsEnabled(): Promise<void> {
|
||||||
const enabledToggle = $('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]');
|
const enabledToggle = $('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]');
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
|
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
|
||||||
|
@@ -31,7 +31,6 @@ export class MetadataViewPage {
|
|||||||
size = $(`[data-automation-id='card-textitem-value-content.sizeInBytes']`);
|
size = $(`[data-automation-id='card-textitem-value-content.sizeInBytes']`);
|
||||||
description = $(`span[data-automation-id='card-textitem-value-properties.cm:description']`);
|
description = $(`span[data-automation-id='card-textitem-value-properties.cm:description']`);
|
||||||
author = $(`[data-automation-id='card-textitem-value-properties.cm:author']`);
|
author = $(`[data-automation-id='card-textitem-value-properties.cm:author']`);
|
||||||
titleProperty = $(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`);
|
|
||||||
editIcon = $(`button[data-automation-id='meta-data-card-toggle-edit']`);
|
editIcon = $(`button[data-automation-id='meta-data-card-toggle-edit']`);
|
||||||
informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`);
|
informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`);
|
||||||
informationSpan = $(`span[data-automation-id='meta-data-card-toggle-expand-label']`);
|
informationSpan = $(`span[data-automation-id='meta-data-card-toggle-expand-label']`);
|
||||||
@@ -96,10 +95,6 @@ export class MetadataViewPage {
|
|||||||
return BrowserActions.getInputValue(this.author);
|
return BrowserActions.getInputValue(this.author);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitleProperty(): Promise<string> {
|
|
||||||
return BrowserActions.getText(this.titleProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
async editIconIsDisplayed(): Promise<void> {
|
async editIconIsDisplayed(): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.editIcon);
|
await BrowserVisibility.waitUntilElementIsVisible(this.editIcon);
|
||||||
}
|
}
|
||||||
|
@@ -1,51 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @license
|
|
||||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
||||||
*
|
|
||||||
* 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 { BrowserActions, BrowserVisibility, DocumentListPage } from '@alfresco/adf-testing';
|
|
||||||
import { browser, $$, $ } from 'protractor';
|
|
||||||
|
|
||||||
export class TrashcanPage {
|
|
||||||
private contentList = new DocumentListPage($('adf-document-list'));
|
|
||||||
private restoreButton = $(`button[title='Restore']`);
|
|
||||||
|
|
||||||
async numberOfResultsDisplayed(): Promise<number> {
|
|
||||||
const rows = $$('adf-document-list div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]');
|
|
||||||
return rows.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitForTableBody(): Promise<void> {
|
|
||||||
const tableBody = $$('adf-document-list .adf-datatable-body').first();
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(tableBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkTrashcanIsEmpty(): Promise<void> {
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible($('adf-empty-content'));
|
|
||||||
}
|
|
||||||
|
|
||||||
getDocumentList(): DocumentListPage {
|
|
||||||
return this.contentList;
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickRestore(): Promise<void> {
|
|
||||||
await BrowserActions.click(this.restoreButton);
|
|
||||||
await browser.sleep(2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkRestoreButtonIsNotDisplayed(): Promise<void> {
|
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.restoreButton);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -33,7 +33,7 @@ export class FileModel {
|
|||||||
lastPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_text;
|
lastPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_text;
|
||||||
secondPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.second_page_text;
|
secondPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.second_page_text;
|
||||||
lastPageNumber = browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_number;
|
lastPageNumber = browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_number;
|
||||||
createdAt = '';
|
createdAt: Date = null;
|
||||||
password = '';
|
password = '';
|
||||||
createdByUser = new CreatedByModel();
|
createdByUser = new CreatedByModel();
|
||||||
modifiedByUser = new CreatedByModel();
|
modifiedByUser = new CreatedByModel();
|
||||||
|
@@ -81,7 +81,7 @@ export class TaskDetailsPage {
|
|||||||
return BrowserActions.getText(this.taskDetailsTitle);
|
return BrowserActions.getText(this.taskDetailsTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkSelectedForm(formName): Promise<void> {
|
async checkSelectedForm(formName: string): Promise<void> {
|
||||||
await this.attachFormDropdown.checkOptionIsSelected(formName);
|
await this.attachFormDropdown.checkOptionIsSelected(formName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ export class TaskDetailsPage {
|
|||||||
await BrowserActions.clearSendKeys(this.addPeopleField, user);
|
await BrowserActions.clearSendKeys(this.addPeopleField, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectUserToInvolve(user): Promise<void> {
|
async selectUserToInvolve(user: string): Promise<void> {
|
||||||
const row = this.getRowsUser(user);
|
const row = this.getRowsUser(user);
|
||||||
await BrowserActions.click(row);
|
await BrowserActions.click(row);
|
||||||
}
|
}
|
||||||
@@ -282,15 +282,14 @@ export class TaskDetailsPage {
|
|||||||
return $(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`);
|
return $(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeInvolvedUser(user): Promise<void> {
|
async removeInvolvedUser(user: string): Promise<void> {
|
||||||
const row = this.getRowsUser(user).element(by.xpath('ancestor::adf-datatable-row[contains(@class, "adf-datatable-row")]'));
|
const row = this.getRowsUser(user).element(by.xpath('ancestor::adf-datatable-row[contains(@class, "adf-datatable-row")]'));
|
||||||
await BrowserActions.click(row.$('button[data-automation-id="action_menu_0"]'));
|
await BrowserActions.click(row.$('button[data-automation-id="action_menu_0"]'));
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople);
|
await BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople);
|
||||||
await BrowserActions.click(this.removeInvolvedPeople);
|
await BrowserActions.click(this.removeInvolvedPeople);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getInvolvedUserEmail(user): Promise<string> {
|
async getInvolvedUserEmail(user: string): Promise<string> {
|
||||||
return BrowserActions.getText($(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`));
|
return BrowserActions.getText($(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,5 +400,4 @@ export class TaskDetailsPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsVisible(this.saveFormButton);
|
await BrowserVisibility.waitUntilElementIsVisible(this.saveFormButton);
|
||||||
await BrowserActions.click(this.saveFormButton);
|
await BrowserActions.click(this.saveFormButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -21,12 +21,11 @@ import { TaskDetailsPage } from './task-details.page';
|
|||||||
import { FiltersPage } from './filters.page';
|
import { FiltersPage } from './filters.page';
|
||||||
import { ChecklistDialog } from './dialog/create-checklist-dialog.page';
|
import { ChecklistDialog } from './dialog/create-checklist-dialog.page';
|
||||||
import { TasksListPage } from './tasks-list.page';
|
import { TasksListPage } from './tasks-list.page';
|
||||||
import { element, by, $ } from 'protractor';
|
import { $, by, element } from 'protractor';
|
||||||
import { BrowserVisibility, BrowserActions, FormFields } from '@alfresco/adf-testing';
|
import { BrowserActions, BrowserVisibility, FormFields } from '@alfresco/adf-testing';
|
||||||
|
|
||||||
export class TasksPage {
|
export class TasksPage {
|
||||||
createButton = $('button[data-automation-id="create-button"');
|
createButton = $('button[data-automation-id="create-button"');
|
||||||
newTaskButton = $('button[data-automation-id="btn-start-task"]');
|
|
||||||
addChecklistButton = $('button[class*="adf-add-to-checklist-button"]');
|
addChecklistButton = $('button[class*="adf-add-to-checklist-button"]');
|
||||||
rowByRowName = by.xpath('ancestor::mat-chip');
|
rowByRowName = by.xpath('ancestor::mat-chip');
|
||||||
checklistContainer = $('div[class*="checklist-menu"]');
|
checklistContainer = $('div[class*="checklist-menu"]');
|
||||||
@@ -88,8 +87,7 @@ export class TasksPage {
|
|||||||
|
|
||||||
getChecklistByName(name: string) {
|
getChecklistByName(name: string) {
|
||||||
const elem = this.getRowsName(name);
|
const elem = this.getRowsName(name);
|
||||||
const row = elem.element(this.rowByRowName);
|
return elem.element(this.rowByRowName);
|
||||||
return row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkChecklistIsDisplayed(name: string): Promise<void> {
|
async checkChecklistIsDisplayed(name: string): Promise<void> {
|
||||||
@@ -150,5 +148,4 @@ export class TasksPage {
|
|||||||
async clickSortByNameDesc(): Promise<any> {
|
async clickSortByNameDesc(): Promise<any> {
|
||||||
return this.tasksListPage().getDataTable().sortByColumn('DESC', 'name');
|
return this.tasksListPage().getDataTable().sortByColumn('DESC', 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,23 +15,24 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createApiService,
|
import {
|
||||||
|
createApiService,
|
||||||
ApplicationsUtil,
|
ApplicationsUtil,
|
||||||
ArrayUtil,
|
ArrayUtil,
|
||||||
DateUtil,
|
|
||||||
LoginPage,
|
LoginPage,
|
||||||
PaginationPage,
|
PaginationPage,
|
||||||
ProcessUtil, TaskUtil,
|
ProcessUtil,
|
||||||
UsersActions
|
TaskUtil,
|
||||||
|
UsersActions,
|
||||||
|
UserModel
|
||||||
} from '@alfresco/adf-testing';
|
} from '@alfresco/adf-testing';
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
import { TaskListDemoPage } from './../pages/task-list-demo.page';
|
import { TaskListDemoPage } from './../pages/task-list-demo.page';
|
||||||
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
||||||
import { TaskActionsApi, TaskRepresentation, TasksApi } from '@alfresco/js-api';
|
import { AppDefinitionRepresentation, ProcessInstanceRepresentation, TaskActionsApi, TaskRepresentation, TasksApi } from '@alfresco/js-api';
|
||||||
import { addDays, format, subDays } from 'date-fns';
|
import { addDays, format, subDays } from 'date-fns';
|
||||||
|
|
||||||
describe('Start Task - Custom App', () => {
|
describe('Start Task - Custom App', () => {
|
||||||
|
|
||||||
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
||||||
const secondApp = browser.params.resources.Files.WIDGETS_SMOKE_TEST;
|
const secondApp = browser.params.resources.Files.WIDGETS_SMOKE_TEST;
|
||||||
|
|
||||||
@@ -49,25 +50,66 @@ describe('Start Task - Custom App', () => {
|
|||||||
const taskActionsApi = new TaskActionsApi(apiService.getInstance());
|
const taskActionsApi = new TaskActionsApi(apiService.getInstance());
|
||||||
const tasksApi = new TasksApi(apiService.getInstance());
|
const tasksApi = new TasksApi(apiService.getInstance());
|
||||||
|
|
||||||
let processUserModel;
|
let processUserModel: UserModel;
|
||||||
let appRuntime; let secondAppRuntime;
|
let appRuntime: AppDefinitionRepresentation;
|
||||||
let appModel;
|
let secondAppRuntime: AppDefinitionRepresentation;
|
||||||
const completedTasks = [];
|
let appModel: AppDefinitionRepresentation;
|
||||||
const paginationTasksName = ['t01', 't02', 't03', 't04', 't05', 't06', 't07', 't08', 't09', 't10', 't11', 't12', 't13', 'taskOne', 'taskTwo', 'taskOne'];
|
const completedTasks: TaskRepresentation[] = [];
|
||||||
|
const paginationTasksName = [
|
||||||
|
't01',
|
||||||
|
't02',
|
||||||
|
't03',
|
||||||
|
't04',
|
||||||
|
't05',
|
||||||
|
't06',
|
||||||
|
't07',
|
||||||
|
't08',
|
||||||
|
't09',
|
||||||
|
't10',
|
||||||
|
't11',
|
||||||
|
't12',
|
||||||
|
't13',
|
||||||
|
'taskOne',
|
||||||
|
'taskTwo',
|
||||||
|
'taskOne'
|
||||||
|
];
|
||||||
const completedTasksName = ['completed01', 'completed02', 'completed03'];
|
const completedTasksName = ['completed01', 'completed02', 'completed03'];
|
||||||
const allTasksName = ['t01', 'taskOne', 'taskTwo', 'taskOne', 't13', 't12', 't11', 't10', 't09', 't08', 't07', 't06', 't05', 't04', 't03', 't02',
|
const allTasksName = [
|
||||||
'User Task', 'User Task', 'User Task', 'User Task'];
|
't01',
|
||||||
const invalidAppId = '1234567890'; const invalidName = 'invalidName'; const invalidTaskId = '0000';
|
'taskOne',
|
||||||
|
'taskTwo',
|
||||||
|
'taskOne',
|
||||||
|
't13',
|
||||||
|
't12',
|
||||||
|
't11',
|
||||||
|
't10',
|
||||||
|
't09',
|
||||||
|
't08',
|
||||||
|
't07',
|
||||||
|
't06',
|
||||||
|
't05',
|
||||||
|
't04',
|
||||||
|
't03',
|
||||||
|
't02',
|
||||||
|
'User Task',
|
||||||
|
'User Task',
|
||||||
|
'User Task',
|
||||||
|
'User Task'
|
||||||
|
];
|
||||||
|
const invalidAppId = '1234567890';
|
||||||
|
const invalidName = 'invalidName';
|
||||||
|
const invalidTaskId = '0000';
|
||||||
const noTasksFoundMessage = 'No Tasks Found';
|
const noTasksFoundMessage = 'No Tasks Found';
|
||||||
const nrOfTasks = 20;
|
const nrOfTasks = 20;
|
||||||
let currentPage = 1;
|
let currentPage = 1;
|
||||||
const totalNrOfPages = 'of 4';
|
const totalNrOfPages = 'of 4';
|
||||||
const currentDateStandardFormat = DateUtil.formatDate('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
const DATE_FORMAT = `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`;
|
||||||
|
const currentDateStandardFormat = format(new Date(), DATE_FORMAT);
|
||||||
const beforeDate = format(subDays(new Date(), 1), 'MM/dd/yyyy');
|
const beforeDate = format(subDays(new Date(), 1), 'MM/dd/yyyy');
|
||||||
const currentDate = DateUtil.formatDate('MM/DD/YYYY');
|
const currentDate = format(new Date(), 'MM/dd/yyyy');
|
||||||
const afterDate = format(addDays(new Date(), 1), 'MM/dd/yyyy');
|
const afterDate = format(addDays(new Date(), 1), 'MM/dd/yyyy');
|
||||||
let taskWithDueDate;
|
let taskWithDueDate: TaskRepresentation;
|
||||||
let processDefinitionId;
|
let processDefinitionId: ProcessInstanceRepresentation;
|
||||||
|
|
||||||
const itemsPerPage = {
|
const itemsPerPage = {
|
||||||
five: '5',
|
five: '5',
|
||||||
@@ -106,17 +148,21 @@ describe('Start Task - Custom App', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
completedTasks[i] = await tasksApi.createNewTask(new TaskRepresentation({
|
completedTasks[i] = await tasksApi.createNewTask(
|
||||||
|
new TaskRepresentation({
|
||||||
name: completedTasksName[i],
|
name: completedTasksName[i],
|
||||||
dueDate: new Date(DateUtil.formatDate('YYYY-MM-DDTHH:mm:ss.SSSZ', new Date(), i + 2))
|
dueDate: addDays(new Date(), i + 2)
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
await taskActionsApi.completeTask(completedTasks[i].id);
|
await taskActionsApi.completeTask(completedTasks[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
taskWithDueDate = await tasksApi.createNewTask(new TaskRepresentation({
|
taskWithDueDate = await tasksApi.createNewTask(
|
||||||
|
new TaskRepresentation({
|
||||||
name: paginationTasksName[0],
|
name: paginationTasksName[0],
|
||||||
dueDate: new Date(currentDateStandardFormat)
|
dueDate: new Date(currentDateStandardFormat)
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
await loginPage.login(processUserModel.username, processUserModel.password);
|
await loginPage.login(processUserModel.username, processUserModel.password);
|
||||||
});
|
});
|
||||||
@@ -132,7 +178,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -150,7 +199,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + nrOfTasks + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName)).toEqual(true);
|
||||||
});
|
});
|
||||||
await paginationPage.checkNextPageButtonIsDisabled();
|
await paginationPage.checkNextPageButtonIsDisabled();
|
||||||
@@ -164,7 +216,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -176,7 +231,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 6-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,10 +242,15 @@ describe('Start Task - Custom App', () => {
|
|||||||
currentPage++;
|
currentPage++;
|
||||||
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
|
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
|
||||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
|
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
|
||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual(
|
||||||
|
'Showing 11-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks
|
||||||
|
);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -195,9 +258,14 @@ describe('Start Task - Custom App', () => {
|
|||||||
currentPage++;
|
currentPage++;
|
||||||
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
|
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
|
||||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
|
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
|
||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual(
|
||||||
|
'Showing 16-' + itemsPerPage.fiveValue * currentPage + ' of ' + nrOfTasks
|
||||||
|
);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -209,7 +277,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
|
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
|
||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 10))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 10))).toEqual(true);
|
||||||
});
|
});
|
||||||
await paginationPage.clickOnNextPage();
|
await paginationPage.clickOnNextPage();
|
||||||
@@ -218,7 +289,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
|
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
|
||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 11-' + itemsPerPage.tenValue * currentPage + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.tenValue);
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 20))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 20))).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -228,9 +302,14 @@ describe('Start Task - Custom App', () => {
|
|||||||
await taskListSinglePage.typeItemsPerPage(itemsPerPage.fifteenValue);
|
await taskListSinglePage.typeItemsPerPage(itemsPerPage.fifteenValue);
|
||||||
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
|
await taskListSinglePage.taskList().getDataTable().waitTillContentLoaded();
|
||||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
|
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
|
||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + itemsPerPage.fifteenValue * currentPage + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual(
|
||||||
|
'Showing 1-' + itemsPerPage.fifteenValue * currentPage + ' of ' + nrOfTasks
|
||||||
|
);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fifteenValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fifteenValue);
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 15))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 15))).toEqual(true);
|
||||||
});
|
});
|
||||||
currentPage++;
|
currentPage++;
|
||||||
@@ -239,13 +318,16 @@ describe('Start Task - Custom App', () => {
|
|||||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
|
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
|
||||||
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfTasks + ' of ' + nrOfTasks);
|
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 16-' + nrOfTasks + ' of ' + nrOfTasks);
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks - itemsPerPage.fifteenValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(nrOfTasks - itemsPerPage.fifteenValue);
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C286366] Pagination is not displayed when no task is displayed', async () => {
|
it('[C286366] Pagination is not displayed when no task is displayed', async () => {
|
||||||
await taskListSinglePage.typeAppId(secondAppRuntime.id);
|
await taskListSinglePage.typeAppId(secondAppRuntime.id.toString());
|
||||||
await expect(await taskListSinglePage.getAppId()).toEqual(secondAppRuntime.id.toString());
|
await expect(await taskListSinglePage.getAppId()).toEqual(secondAppRuntime.id.toString());
|
||||||
|
|
||||||
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
|
await taskListSinglePage.paginationPage().checkPaginationIsNotDisplayed();
|
||||||
@@ -272,7 +354,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
|
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(0, 5))).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -288,7 +373,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
|
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(5, 10))).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -302,7 +390,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
await paginationPage.checkPageSelectorIsDisplayed();
|
await paginationPage.checkPageSelectorIsDisplayed();
|
||||||
|
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(10, 15))).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -317,7 +408,10 @@ describe('Start Task - Custom App', () => {
|
|||||||
|
|
||||||
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
await expect(await taskListSinglePage.taskList().getDataTable().numberOfRows()).toBe(itemsPerPage.fiveValue);
|
||||||
|
|
||||||
await taskListSinglePage.taskList().getAllRowsNameColumn('Name').then(async (list) => {
|
await taskListSinglePage
|
||||||
|
.taskList()
|
||||||
|
.getAllRowsNameColumn('Name')
|
||||||
|
.then(async (list) => {
|
||||||
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
|
await expect(ArrayUtil.arrayContainsArray(list, allTasksName.slice(15, 20))).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -385,7 +479,7 @@ describe('Start Task - Custom App', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('[C280515] Should be able to see only the tasks of a specific app when typing the apps id in the appId field', async () => {
|
it('[C280515] Should be able to see only the tasks of a specific app when typing the apps id in the appId field', async () => {
|
||||||
await taskListSinglePage.typeAppId(appRuntime.id);
|
await taskListSinglePage.typeAppId(appRuntime.id.toString());
|
||||||
await expect(await taskListSinglePage.getAppId()).toEqual(appRuntime.id.toString());
|
await expect(await taskListSinglePage.getAppId()).toEqual(appRuntime.id.toString());
|
||||||
|
|
||||||
await taskListSinglePage.taskList().checkContentIsDisplayed(app.taskName, 'Name');
|
await taskListSinglePage.taskList().checkContentIsDisplayed(app.taskName, 'Name');
|
||||||
@@ -472,8 +566,12 @@ describe('Start Task - Custom App', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('[C286622] Should be able to see only tasks that are part of a specific process when processDefinitionId is set', async () => {
|
it('[C286622] Should be able to see only tasks that are part of a specific process when processDefinitionId is set', async () => {
|
||||||
const processDefinitionIds = [processDefinitionId.processDefinitionId, processDefinitionId.processDefinitionId,
|
const processDefinitionIds = [
|
||||||
processDefinitionId.processDefinitionId, processDefinitionId.processDefinitionId];
|
processDefinitionId.processDefinitionId,
|
||||||
|
processDefinitionId.processDefinitionId,
|
||||||
|
processDefinitionId.processDefinitionId,
|
||||||
|
processDefinitionId.processDefinitionId
|
||||||
|
];
|
||||||
|
|
||||||
await navigationBarPage.clickTaskListButton();
|
await navigationBarPage.clickTaskListButton();
|
||||||
await taskListSinglePage.clickResetButton();
|
await taskListSinglePage.clickResetButton();
|
||||||
|
@@ -15,11 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BrowserActions, DataTableComponentPage, DateUtil, LoginPage } from '@alfresco/adf-testing';
|
import { BrowserActions, DataTableComponentPage, LoginPage } from '@alfresco/adf-testing';
|
||||||
import { browser, ElementFinder } from 'protractor';
|
import { browser, ElementFinder } from 'protractor';
|
||||||
import { SearchBarPage } from '../pages/search-bar.page';
|
import { SearchBarPage } from '../pages/search-bar.page';
|
||||||
import { SearchFiltersPage } from '../pages/search-filters.page';
|
import { SearchFiltersPage } from '../pages/search-filters.page';
|
||||||
import { SearchResultsPage } from '../pages/search-results.page';
|
import { SearchResultsPage } from '../pages/search-results.page';
|
||||||
|
import { format, parse, addDays } from 'date-fns';
|
||||||
|
|
||||||
describe('Search Date Range Filter', () => {
|
describe('Search Date Range Filter', () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
@@ -77,7 +78,7 @@ describe('Search Date Range Filter', () => {
|
|||||||
await datePickerToday.selectTodayDate();
|
await datePickerToday.selectTodayDate();
|
||||||
await datePickerToday.checkDatePickerIsNotDisplayed();
|
await datePickerToday.checkDatePickerIsNotDisplayed();
|
||||||
let fromDate = await dateRangeFilter.getFromDate();
|
let fromDate = await dateRangeFilter.getFromDate();
|
||||||
fromDate = DateUtil.formatDate('DD-MM-YY', DateUtil.parse(fromDate, 'DD-MMM-YY'));
|
fromDate = format(parse(fromDate, 'd-MMM-yy', new Date()), 'dd-MM-yy');
|
||||||
|
|
||||||
await dateRangeFilter.checkApplyButtonIsDisabled();
|
await dateRangeFilter.checkApplyButtonIsDisabled();
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ describe('Search Date Range Filter', () => {
|
|||||||
await toDatePicker.selectTodayDate();
|
await toDatePicker.selectTodayDate();
|
||||||
await toDatePicker.checkDatePickerIsNotDisplayed();
|
await toDatePicker.checkDatePickerIsNotDisplayed();
|
||||||
let toDate = await dateRangeFilter.getToDate();
|
let toDate = await dateRangeFilter.getToDate();
|
||||||
toDate = DateUtil.formatDate('DD-MM-YY', DateUtil.parse(toDate, 'DD-MMM-YY'), 1);
|
toDate = format(addDays(parse(toDate, 'dd-MMM-yy', new Date()), 1), 'dd-MM-yy');
|
||||||
|
|
||||||
await dateRangeFilter.checkApplyButtonIsEnabled();
|
await dateRangeFilter.checkApplyButtonIsEnabled();
|
||||||
await dateRangeFilter.clickApplyButton();
|
await dateRangeFilter.clickApplyButton();
|
||||||
@@ -97,10 +98,10 @@ describe('Search Date Range Filter', () => {
|
|||||||
const results = (await dataTable.geCellElementDetail('Created')) as ElementFinder[];
|
const results = (await dataTable.geCellElementDetail('Created')) as ElementFinder[];
|
||||||
for (const currentResult of results) {
|
for (const currentResult of results) {
|
||||||
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
const currentDateFormatted = DateUtil.parse(currentDate, 'MMM DD, YYYY, h:mm:ss a');
|
const currentDateFormatted = parse(currentDate, 'MMM dd, yyyy, h:mm:ss a', new Date());
|
||||||
|
|
||||||
await expect(currentDateFormatted <= DateUtil.parse(toDate, 'DD-MM-YY')).toBe(true);
|
await expect(currentDateFormatted <= parse(toDate, 'dd-MM-yy', new Date())).toBe(true);
|
||||||
await expect(currentDateFormatted >= DateUtil.parse(fromDate, 'DD-MM-YY')).toBe(true);
|
await expect(currentDateFormatted >= parse(fromDate, 'dd-MM-yy', new Date())).toBe(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -15,9 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createApiService, BrowserActions,
|
import {
|
||||||
|
createApiService,
|
||||||
|
BrowserActions,
|
||||||
DataTableComponentPage,
|
DataTableComponentPage,
|
||||||
DateUtil,
|
|
||||||
LocalStorageUtil,
|
LocalStorageUtil,
|
||||||
LoginPage,
|
LoginPage,
|
||||||
UploadActions,
|
UploadActions,
|
||||||
@@ -31,9 +32,10 @@ import { SearchFiltersPage } from '../pages/search-filters.page';
|
|||||||
import { FileModel } from '../../models/ACS/file.model';
|
import { FileModel } from '../../models/ACS/file.model';
|
||||||
import { browser, ElementFinder } from 'protractor';
|
import { browser, ElementFinder } from 'protractor';
|
||||||
import { SearchConfiguration } from '../search.config';
|
import { SearchConfiguration } from '../search.config';
|
||||||
|
import { parse } from 'date-fns';
|
||||||
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('Search Number Range Filter', () => {
|
describe('Search Number Range Filter', () => {
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const searchBarPage = new SearchBarPage();
|
const searchBarPage = new SearchBarPage();
|
||||||
const searchFilters = new SearchFiltersPage();
|
const searchFilters = new SearchFiltersPage();
|
||||||
@@ -54,7 +56,8 @@ describe('Search Number Range Filter', () => {
|
|||||||
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
|
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
|
||||||
});
|
});
|
||||||
|
|
||||||
let file2Bytes; let file0Bytes;
|
let file2Bytes: NodeEntry;
|
||||||
|
let file0Bytes: NodeEntry;
|
||||||
const apiService = createApiService();
|
const apiService = createApiService();
|
||||||
const usersActions = new UsersActions(apiService);
|
const usersActions = new UsersActions(apiService);
|
||||||
|
|
||||||
@@ -173,7 +176,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
await searchResults.dataTable.waitTillContentLoaded();
|
await searchResults.dataTable.waitTillContentLoaded();
|
||||||
await searchResults.sortBySize('DESC');
|
await searchResults.sortBySize('DESC');
|
||||||
|
|
||||||
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
|
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
|
||||||
for (const currentResult of results) {
|
for (const currentResult of results) {
|
||||||
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
|
|
||||||
@@ -203,7 +206,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
|
|
||||||
await searchResults.sortBySize('DESC');
|
await searchResults.sortBySize('DESC');
|
||||||
|
|
||||||
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
|
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
|
||||||
for (const currentResult of results) {
|
for (const currentResult of results) {
|
||||||
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
if (currentSize && currentSize.trim() !== '') {
|
if (currentSize && currentSize.trim() !== '') {
|
||||||
@@ -217,7 +220,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
await searchResults.dataTable.waitTillContentLoaded();
|
await searchResults.dataTable.waitTillContentLoaded();
|
||||||
await searchResults.sortBySize('DESC');
|
await searchResults.sortBySize('DESC');
|
||||||
|
|
||||||
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
|
const resultsSize = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
|
||||||
for (const currentResult of resultsSize) {
|
for (const currentResult of resultsSize) {
|
||||||
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
if (currentSize && currentSize.trim() !== '') {
|
if (currentSize && currentSize.trim() !== '') {
|
||||||
@@ -225,7 +228,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultsDisplay = await dataTable.geCellElementDetail('Display name') as ElementFinder[];
|
const resultsDisplay = (await dataTable.geCellElementDetail('Display name')) as ElementFinder[];
|
||||||
for (const currentResult of resultsDisplay) {
|
for (const currentResult of resultsDisplay) {
|
||||||
const name = await BrowserActions.getAttribute(currentResult, 'title');
|
const name = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
if (name && name.trim() !== '') {
|
if (name && name.trim() !== '') {
|
||||||
@@ -263,7 +266,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
|
|
||||||
await searchResults.sortBySize('DESC');
|
await searchResults.sortBySize('DESC');
|
||||||
|
|
||||||
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
|
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
|
||||||
for (const currentResult of results) {
|
for (const currentResult of results) {
|
||||||
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
if (currentSize && currentSize.trim() !== '') {
|
if (currentSize && currentSize.trim() !== '') {
|
||||||
@@ -302,7 +305,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
await sizeRangeFilter.clickApplyButton();
|
await sizeRangeFilter.clickApplyButton();
|
||||||
await searchResults.sortBySize('DESC');
|
await searchResults.sortBySize('DESC');
|
||||||
|
|
||||||
const results = await dataTable.geCellElementDetail('Size') as ElementFinder[];
|
const results = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
|
||||||
for (const currentResult of results) {
|
for (const currentResult of results) {
|
||||||
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
if (currentSize && currentSize.trim() !== '') {
|
if (currentSize && currentSize.trim() !== '') {
|
||||||
@@ -315,7 +318,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
await expect(await sizeRangeFilter.getFromNumber()).toEqual('');
|
await expect(await sizeRangeFilter.getFromNumber()).toEqual('');
|
||||||
await expect(await sizeRangeFilter.getToNumber()).toEqual('');
|
await expect(await sizeRangeFilter.getToNumber()).toEqual('');
|
||||||
|
|
||||||
const resultsSize = await dataTable.geCellElementDetail('Size') as ElementFinder[];
|
const resultsSize = (await dataTable.geCellElementDetail('Size')) as ElementFinder[];
|
||||||
for (const currentResult of resultsSize) {
|
for (const currentResult of resultsSize) {
|
||||||
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentSize = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
if (currentSize && currentSize.trim() !== '') {
|
if (currentSize && currentSize.trim() !== '') {
|
||||||
@@ -393,7 +396,7 @@ describe('Search Number Range Filter', () => {
|
|||||||
await searchFilters.clickSizeRangeFilterHeader();
|
await searchFilters.clickSizeRangeFilterHeader();
|
||||||
await searchFilters.checkSizeRangeFilterIsExpanded();
|
await searchFilters.checkSizeRangeFilterIsExpanded();
|
||||||
|
|
||||||
const fromYear = (new Date()).getFullYear();
|
const fromYear = new Date().getFullYear();
|
||||||
const toYear = fromYear + 1;
|
const toYear = fromYear + 1;
|
||||||
|
|
||||||
await sizeRangeFilter.checkToFieldIsDisplayed();
|
await sizeRangeFilter.checkToFieldIsDisplayed();
|
||||||
@@ -406,10 +409,10 @@ describe('Search Number Range Filter', () => {
|
|||||||
|
|
||||||
await searchResults.sortByCreated('DESC');
|
await searchResults.sortByCreated('DESC');
|
||||||
|
|
||||||
const results = await dataTable.geCellElementDetail('Created') as ElementFinder[];
|
const results = (await dataTable.geCellElementDetail('Created')) as ElementFinder[];
|
||||||
for (const currentResult of results) {
|
for (const currentResult of results) {
|
||||||
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
|
const currentDate = await BrowserActions.getAttribute(currentResult, 'title');
|
||||||
const currentDateFormatted = DateUtil.parse(currentDate, 'MMM DD, YYYY, h:mm:ss a');
|
const currentDateFormatted = parse(currentDate, 'MMM dd, yyyy, h:mm:ss a', new Date());
|
||||||
|
|
||||||
await expect(currentDateFormatted.getFullYear() <= toYear).toBe(true);
|
await expect(currentDateFormatted.getFullYear() <= toYear).toBe(true);
|
||||||
await expect(currentDateFormatted.getFullYear() >= fromYear).toBe(true);
|
await expect(currentDateFormatted.getFullYear() >= fromYear).toBe(true);
|
||||||
|
@@ -17,14 +17,11 @@
|
|||||||
|
|
||||||
import { BrowserVisibility, DataTableComponentPage, SearchSortingPickerPage } from '@alfresco/adf-testing';
|
import { BrowserVisibility, DataTableComponentPage, SearchSortingPickerPage } from '@alfresco/adf-testing';
|
||||||
import { $ } from 'protractor';
|
import { $ } from 'protractor';
|
||||||
import { ContentServicesPage } from '../../core/pages/content-services.page';
|
|
||||||
|
|
||||||
export class SearchResultsPage {
|
export class SearchResultsPage {
|
||||||
|
|
||||||
noResultsMessage = $('.app-no-result-message');
|
noResultsMessage = $('.app-no-result-message');
|
||||||
dataTable = new DataTableComponentPage();
|
dataTable = new DataTableComponentPage();
|
||||||
searchSortingPicker = new SearchSortingPickerPage();
|
searchSortingPicker = new SearchSortingPickerPage();
|
||||||
contentServices = new ContentServicesPage();
|
|
||||||
|
|
||||||
getNodeHighlight(content: string) {
|
getNodeHighlight(content: string) {
|
||||||
return this.dataTable.getCellByRowContentAndColumn('Display name', content, 'Search');
|
return this.dataTable.getCellByRowContentAndColumn('Display name', content, 'Search');
|
||||||
@@ -50,28 +47,6 @@ export class SearchResultsPage {
|
|||||||
await BrowserVisibility.waitUntilElementIsVisible(this.noResultsMessage);
|
await BrowserVisibility.waitUntilElementIsVisible(this.noResultsMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkNoResultMessageIsNotDisplayed(): Promise<void> {
|
|
||||||
await BrowserVisibility.waitUntilElementIsNotVisible(this.noResultsMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
async navigateToFolder(content: string): Promise<void> {
|
|
||||||
await this.contentServices.openFolder(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteContent(content: string): Promise<void> {
|
|
||||||
await this.contentServices.deleteContent(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
async sortByName(sortOrder: string): Promise<void> {
|
|
||||||
await this.searchSortingPicker.sortBy(sortOrder, 'Name');
|
|
||||||
await this.dataTable.waitTillContentLoaded();
|
|
||||||
}
|
|
||||||
|
|
||||||
async sortByAuthor(sortOrder: string): Promise<void> {
|
|
||||||
await this.searchSortingPicker.sortBy(sortOrder, 'Author');
|
|
||||||
await this.dataTable.waitTillContentLoaded();
|
|
||||||
}
|
|
||||||
|
|
||||||
async sortByCreated(sortOrder: string): Promise<void> {
|
async sortByCreated(sortOrder: string): Promise<void> {
|
||||||
await this.searchSortingPicker.sortBy(sortOrder, 'Created');
|
await this.searchSortingPicker.sortBy(sortOrder, 'Created');
|
||||||
await this.dataTable.waitTillContentLoaded();
|
await this.dataTable.waitTillContentLoaded();
|
||||||
@@ -81,13 +56,4 @@ export class SearchResultsPage {
|
|||||||
await this.searchSortingPicker.sortBy(sortOrder, 'Size');
|
await this.searchSortingPicker.sortBy(sortOrder, 'Size');
|
||||||
await this.dataTable.waitTillContentLoaded();
|
await this.dataTable.waitTillContentLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkListIsOrderedByNameAsc(): Promise<any> {
|
|
||||||
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Display name');
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkListIsOrderedByNameDesc(): Promise<any> {
|
|
||||||
return this.contentServices.contentList.dataTablePage().checkListIsSorted('DESC', 'Display name');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
import { createApiService,
|
import {
|
||||||
|
createApiService,
|
||||||
BrowserActions,
|
BrowserActions,
|
||||||
LocalStorageUtil,
|
LocalStorageUtil,
|
||||||
LoginPage,
|
LoginPage,
|
||||||
@@ -34,10 +35,9 @@ import { FileModel } from '../models/ACS/file.model';
|
|||||||
import { FolderModel } from '../models/ACS/folder.model';
|
import { FolderModel } from '../models/ACS/folder.model';
|
||||||
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
|
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
|
||||||
import { SearchConfiguration } from './search.config';
|
import { SearchConfiguration } from './search.config';
|
||||||
import { NodesApi } from '@alfresco/js-api';
|
import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('Search component - Search Bar', () => {
|
describe('Search component - Search Bar', () => {
|
||||||
|
|
||||||
const search = {
|
const search = {
|
||||||
inactive: {
|
inactive: {
|
||||||
firstChar: 'x',
|
firstChar: 'x',
|
||||||
@@ -65,25 +65,29 @@ describe('Search component - Search Bar', () => {
|
|||||||
const firstFolderName = StringUtil.generateRandomString(16);
|
const firstFolderName = StringUtil.generateRandomString(16);
|
||||||
const secondFolderName = StringUtil.generateRandomString(16);
|
const secondFolderName = StringUtil.generateRandomString(16);
|
||||||
const thirdFolderName = StringUtil.generateRandomString(16);
|
const thirdFolderName = StringUtil.generateRandomString(16);
|
||||||
const filesToDelete = [];
|
const filesToDelete: NodeEntry[] = [];
|
||||||
|
|
||||||
const firstFileModel = new FileModel({
|
const firstFileModel = new FileModel({
|
||||||
name: filename, shortName: filename.substring(0, 8)
|
name: filename,
|
||||||
|
shortName: filename.substring(0, 8)
|
||||||
});
|
});
|
||||||
|
|
||||||
const firstFolderModel = new FolderModel({
|
const firstFolderModel = new FolderModel({
|
||||||
name: firstFolderName, shortName: firstFolderName.substring(0, 8)
|
name: firstFolderName,
|
||||||
|
shortName: firstFolderName.substring(0, 8)
|
||||||
});
|
});
|
||||||
const secondFolder = new FolderModel({
|
const secondFolder = new FolderModel({
|
||||||
name: secondFolderName, shortName: secondFolderName.substring(0, 8)
|
name: secondFolderName,
|
||||||
|
shortName: secondFolderName.substring(0, 8)
|
||||||
});
|
});
|
||||||
const thirdFolder = new FolderModel({
|
const thirdFolder = new FolderModel({
|
||||||
name: thirdFolderName, shortName: thirdFolderName.substring(0, 8)
|
name: thirdFolderName,
|
||||||
|
shortName: thirdFolderName.substring(0, 8)
|
||||||
});
|
});
|
||||||
|
|
||||||
const term = 'Zoizo';
|
const term = 'Zoizo';
|
||||||
|
|
||||||
let fileHighlightUploaded;
|
let fileHighlightUploaded: NodeEntry;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await apiService.loginWithProfile('admin');
|
await apiService.loginWithProfile('admin');
|
||||||
@@ -116,7 +120,6 @@ describe('Search component - Search Bar', () => {
|
|||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
for (const currentNode of filesToDelete) {
|
for (const currentNode of filesToDelete) {
|
||||||
await uploadActions.deleteFileOrFolder(currentNode.entry.id);
|
await uploadActions.deleteFileOrFolder(currentNode.entry.id);
|
||||||
|
|
||||||
}
|
}
|
||||||
await navigationBarPage.clickLogoutButton();
|
await navigationBarPage.clickLogoutButton();
|
||||||
});
|
});
|
||||||
@@ -249,7 +252,7 @@ describe('Search component - Search Bar', () => {
|
|||||||
await searchResultPage.checkContentIsDisplayed(firstFileModel.name);
|
await searchResultPage.checkContentIsDisplayed(firstFileModel.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C290137] Should be able to search by \'%\'', async () => {
|
it("[C290137] Should be able to search by '%'", async () => {
|
||||||
await openSearchBar();
|
await openSearchBar();
|
||||||
|
|
||||||
await searchBarPage.enterTextAndPressEnter('%');
|
await searchBarPage.enterTextAndPressEnter('%');
|
||||||
@@ -268,7 +271,6 @@ describe('Search component - Search Bar', () => {
|
|||||||
|
|
||||||
await searchBarPage.enterTextAndPressEnter(term);
|
await searchBarPage.enterTextAndPressEnter(term);
|
||||||
await searchResultPage.dataTable.waitTillContentLoaded();
|
await searchResultPage.dataTable.waitTillContentLoaded();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C299212] Should be able to configure the highlight option for search results', async () => {
|
it('[C299212] Should be able to configure the highlight option for search results', async () => {
|
||||||
|
@@ -35,9 +35,9 @@ import {
|
|||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
import { SearchConfiguration } from './search.config';
|
import { SearchConfiguration } from './search.config';
|
||||||
import { getYear } from 'date-fns';
|
import { getYear } from 'date-fns';
|
||||||
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('Search Filters', () => {
|
describe('Search Filters', () => {
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const searchBarPage = new SearchBarPage();
|
const searchBarPage = new SearchBarPage();
|
||||||
const searchFiltersPage = new SearchFiltersPage();
|
const searchFiltersPage = new SearchFiltersPage();
|
||||||
@@ -59,7 +59,8 @@ describe('Search Filters', () => {
|
|||||||
const uniqueFileName3 = fileNamePrefix + StringUtil.generateRandomString(5);
|
const uniqueFileName3 = fileNamePrefix + StringUtil.generateRandomString(5);
|
||||||
|
|
||||||
const fileModel = new FileModel({
|
const fileModel = new FileModel({
|
||||||
name: filename, shortName: filename.substring(0, 8)
|
name: filename,
|
||||||
|
shortName: filename.substring(0, 8)
|
||||||
});
|
});
|
||||||
|
|
||||||
const pngFileModel = new FileModel({
|
const pngFileModel = new FileModel({
|
||||||
@@ -82,7 +83,11 @@ describe('Search Filters', () => {
|
|||||||
name: `${uniqueFileName3}.txt`
|
name: `${uniqueFileName3}.txt`
|
||||||
});
|
});
|
||||||
|
|
||||||
let fileUploaded; let fileTypePng; let fileTypeTxt1; let fileTypeJpg; let fileTypeTxt2;
|
let fileUploaded: NodeEntry;
|
||||||
|
let fileTypePng: NodeEntry;
|
||||||
|
let fileTypeTxt1: NodeEntry;
|
||||||
|
let fileTypeJpg: NodeEntry;
|
||||||
|
let fileTypeTxt2: NodeEntry;
|
||||||
|
|
||||||
const filter = { type: 'TYPE-PNG Image' };
|
const filter = { type: 'TYPE-PNG Image' };
|
||||||
|
|
||||||
@@ -90,9 +95,7 @@ describe('Search Filters', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await apiService.loginWithProfile('admin');
|
await apiService.loginWithProfile('admin');
|
||||||
|
|
||||||
await usersActions.createUser(acsUser);
|
await usersActions.createUser(acsUser);
|
||||||
|
|
||||||
await apiService.login(acsUser.username, acsUser.password);
|
await apiService.login(acsUser.username, acsUser.password);
|
||||||
|
|
||||||
fileUploaded = await uploadActions.uploadFile(fileModel.location, fileModel.name, '-my-');
|
fileUploaded = await uploadActions.uploadFile(fileModel.location, fileModel.name, '-my-');
|
||||||
@@ -104,7 +107,6 @@ describe('Search Filters', () => {
|
|||||||
await loginPage.login(acsUser.username, acsUser.password);
|
await loginPage.login(acsUser.username, acsUser.password);
|
||||||
|
|
||||||
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
|
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -140,7 +142,6 @@ describe('Search Filters', () => {
|
|||||||
group: 'Size facet queries'
|
group: 'Size facet queries'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
|
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
|
||||||
|
|
||||||
await searchBarPage.clickOnSearchIcon();
|
await searchBarPage.clickOnSearchIcon();
|
||||||
@@ -257,7 +258,6 @@ describe('Search Filters', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Change config', () => {
|
describe('Change config', () => {
|
||||||
|
|
||||||
it('[C291802] Should be able to filter facet fields with "Contains"', async () => {
|
it('[C291802] Should be able to filter facet fields with "Contains"', async () => {
|
||||||
await navigationBarPage.navigateToContentServices();
|
await navigationBarPage.navigateToContentServices();
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ import { SearchFiltersPage } from './pages/search-filters.page';
|
|||||||
import { FileModel } from '../models/ACS/file.model';
|
import { FileModel } from '../models/ACS/file.model';
|
||||||
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
|
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
|
||||||
import CONSTANTS = require('../util/constants');
|
import CONSTANTS = require('../util/constants');
|
||||||
import { SitesApi } from '@alfresco/js-api';
|
import { NodeEntry, SiteEntry, SitesApi } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('Search Component - Multi-Select Facet', () => {
|
describe('Search Component - Multi-Select Facet', () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
@@ -52,10 +52,14 @@ describe('Search Component - Multi-Select Facet', () => {
|
|||||||
name: `${randomName}.txt`
|
name: `${randomName}.txt`
|
||||||
});
|
});
|
||||||
|
|
||||||
let site; let userOption;
|
let site: SiteEntry;
|
||||||
|
let userOption: string;
|
||||||
|
|
||||||
describe('', () => {
|
describe('', () => {
|
||||||
let jpgFile; let jpgFileSite; let txtFile; let txtFileSite;
|
let jpgFile: NodeEntry;
|
||||||
|
let jpgFileSite: NodeEntry;
|
||||||
|
let txtFile: NodeEntry;
|
||||||
|
let txtFileSite: NodeEntry;
|
||||||
const acsUser = new UserModel();
|
const acsUser = new UserModel();
|
||||||
|
|
||||||
const jpgFileInfo = new FileModel({
|
const jpgFileInfo = new FileModel({
|
||||||
@@ -67,11 +71,8 @@ describe('Search Component - Multi-Select Facet', () => {
|
|||||||
await createSite(acsUser);
|
await createSite(acsUser);
|
||||||
|
|
||||||
jpgFile = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, '-my-');
|
jpgFile = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, '-my-');
|
||||||
|
|
||||||
jpgFileSite = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
|
jpgFileSite = await uploadActions.uploadFile(jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
|
||||||
|
|
||||||
txtFile = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, '-my-');
|
txtFile = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, '-my-');
|
||||||
|
|
||||||
txtFileSite = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, site.entry.guid);
|
txtFileSite = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, site.entry.guid);
|
||||||
|
|
||||||
await browser.sleep(browser.params.testConfig.timeouts.index_search);
|
await browser.sleep(browser.params.testConfig.timeouts.index_search);
|
||||||
@@ -132,7 +133,8 @@ describe('Search Component - Multi-Select Facet', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('', () => {
|
describe('', () => {
|
||||||
let jpgFile; let txtFile;
|
let jpgFile: NodeEntry;
|
||||||
|
let txtFile: NodeEntry;
|
||||||
const userUploadingTxt = new UserModel();
|
const userUploadingTxt = new UserModel();
|
||||||
const userUploadingImg = new UserModel();
|
const userUploadingImg = new UserModel();
|
||||||
|
|
||||||
@@ -195,7 +197,7 @@ describe('Search Component - Multi-Select Facet', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('', () => {
|
describe('', () => {
|
||||||
let txtFile;
|
let txtFile: NodeEntry;
|
||||||
const acsUser = new UserModel();
|
const acsUser = new UserModel();
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
@@ -15,20 +15,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SearchDatetimeRangeComponent } from './search-datetime-range.component';
|
import { DEFAULT_DATETIME_FORMAT, SearchDatetimeRangeComponent } from './search-datetime-range.component';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { MatDatetimepickerInputEvent } from '@mat-datetimepicker/core';
|
||||||
|
import { DateFnsUtils } from '@alfresco/adf-core';
|
||||||
|
import { isValid } from 'date-fns';
|
||||||
|
|
||||||
declare let moment: any;
|
|
||||||
|
|
||||||
describe('SearchDatetimeRangeComponent', () => {
|
describe('SearchDatetimeRangeComponent', () => {
|
||||||
let fixture: ComponentFixture<SearchDatetimeRangeComponent>;
|
let fixture: ComponentFixture<SearchDatetimeRangeComponent>;
|
||||||
let component: SearchDatetimeRangeComponent;
|
let component: SearchDatetimeRangeComponent;
|
||||||
const fromDatetime = '2016-10-16 12:30';
|
const fromDatetime = new Date('2016-10-16 12:30');
|
||||||
const toDatetime = '2017-10-16 20:00';
|
const toDatetime = new Date('2017-10-16 20:00');
|
||||||
const maxDatetime = '10-Mar-20 20:00';
|
const datetimeFormatFixture = 'DD-MMM-YY HH:mm'; // dd-MMM-yy HH:mm
|
||||||
const datetimeFormatFixture = 'DD-MMM-YY HH:mm';
|
const maxDatetime = DateFnsUtils.parseDate('10-Mar-20 20:00', datetimeFormatFixture);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -59,13 +61,13 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
const inputString = '20-feb-18 20:00';
|
const inputString = '20-feb-18 20:00';
|
||||||
const momentFromInput = moment(inputString, datetimeFormatFixture);
|
const fromDate = DateFnsUtils.parseDate(inputString, datetimeFormatFixture);
|
||||||
|
|
||||||
expect(momentFromInput.isValid()).toBeTruthy();
|
expect(isValid(fromDate)).toBeTrue();
|
||||||
|
|
||||||
component.onChangedHandler({ value: inputString }, component.from);
|
component.onChangedHandler({ value: fromDate } as MatDatetimepickerInputEvent<Date>, component.from);
|
||||||
|
|
||||||
expect(component.from.value.toString()).toEqual(momentFromInput.toString());
|
expect(component.from.value.toString()).toEqual(fromDate.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should NOT setup form control with invalid datetime on change', async () => {
|
it('should NOT setup form control with invalid datetime on change', async () => {
|
||||||
@@ -74,30 +76,28 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
const inputString = '2017-10-16 20:f:00';
|
component.onChangedHandler({ value: new Date('2017-10-16 20:f:00') } as MatDatetimepickerInputEvent<Date>, component.from);
|
||||||
const momentFromInput = moment(inputString, datetimeFormatFixture);
|
|
||||||
|
|
||||||
expect(momentFromInput.isValid()).toBeFalsy();
|
expect(component.from.value).toBeNull();
|
||||||
|
|
||||||
component.onChangedHandler({ value: inputString }, component.from);
|
|
||||||
|
|
||||||
expect(component.from.value.toString()).not.toEqual(momentFromInput.toString());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reset form', async () => {
|
it('should reset form', async () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
component.form.setValue({ from: fromDatetime, to: toDatetime });
|
component.form.setValue({
|
||||||
|
from: fromDatetime,
|
||||||
|
to: toDatetime
|
||||||
|
});
|
||||||
|
|
||||||
expect(component.from.value).toEqual(fromDatetime);
|
expect(component.from.value).toEqual(fromDatetime);
|
||||||
expect(component.to.value).toEqual(toDatetime);
|
expect(component.to.value).toEqual(toDatetime);
|
||||||
|
|
||||||
component.reset();
|
component.reset();
|
||||||
|
|
||||||
expect(component.from.value).toEqual('');
|
expect(component.from.value).toBeNull();
|
||||||
expect(component.to.value).toEqual('');
|
expect(component.to.value).toBeNull();
|
||||||
expect(component.form.value).toEqual({ from: '', to: '' });
|
expect(component.form.value).toEqual({ from: null, to: null });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reset fromMaxDatetime on reset', async () => {
|
it('should reset fromMaxDatetime on reset', async () => {
|
||||||
@@ -152,7 +152,7 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
to: toDatetime
|
to: toDatetime
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
const expectedQuery = `cm:created:['2016-10-16T12:30:00Z' TO '2017-10-16T20:00:59Z']`;
|
const expectedQuery = `cm:created:['2016-10-16T12:30:00.000Z' TO '2017-10-16T20:00:59.000Z']`;
|
||||||
|
|
||||||
expect(context.queryFragments[component.id]).toEqual(expectedQuery);
|
expect(context.queryFragments[component.id]).toEqual(expectedQuery);
|
||||||
expect(context.update).toHaveBeenCalled();
|
expect(context.update).toHaveBeenCalled();
|
||||||
@@ -163,8 +163,8 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
queryFragments: {},
|
queryFragments: {},
|
||||||
update: () => {}
|
update: () => {}
|
||||||
};
|
};
|
||||||
const fromInGmt = '2021-02-24T17:00:00+02:00';
|
const fromInGmt = new Date('2021-02-24T17:00:00+02:00');
|
||||||
const toInGmt = '2021-02-28T15:00:00+02:00';
|
const toInGmt = new Date('2021-02-28T15:00:00+02:00');
|
||||||
|
|
||||||
component.id = 'createdDateRange';
|
component.id = 'createdDateRange';
|
||||||
component.context = context;
|
component.context = context;
|
||||||
@@ -180,7 +180,7 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
to: toInGmt
|
to: toInGmt
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
const expectedQuery = `cm:created:['2021-02-24T15:00:00Z' TO '2021-02-28T13:00:59Z']`;
|
const expectedQuery = `cm:created:['2021-02-24T15:00:00.000Z' TO '2021-02-28T13:00:59.000Z']`;
|
||||||
|
|
||||||
expect(context.queryFragments[component.id]).toEqual(expectedQuery);
|
expect(context.queryFragments[component.id]).toEqual(expectedQuery);
|
||||||
expect(context.update).toHaveBeenCalled();
|
expect(context.update).toHaveBeenCalled();
|
||||||
@@ -190,7 +190,7 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
component.onChangedHandler({ value: '10/14/2020 10:00:00 PM' }, component.from);
|
component.onChangedHandler({ value: new Date('invalid') } as MatDatetimepickerInputEvent<Date>, component.from);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
@@ -198,18 +198,17 @@ describe('SearchDatetimeRangeComponent', () => {
|
|||||||
expect(component.getFromValidationMessage()).toEqual('SEARCH.FILTER.VALIDATION.INVALID-DATETIME');
|
expect(component.getFromValidationMessage()).toEqual('SEARCH.FILTER.VALIDATION.INVALID-DATETIME');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not show datetime-format error when valid found', async () => {
|
it('should display date with default format in the input', async () => {
|
||||||
|
component.settings = { field: 'cm:created' };
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
component.onChangedHandler({ value: new Date() } as MatDatetimepickerInputEvent<Date>, component.from);
|
||||||
|
|
||||||
const input = fixture.debugElement.nativeElement.querySelector('[data-automation-id="datetime-range-from-input"]');
|
const input = fixture.debugElement.nativeElement.querySelector('[data-automation-id="datetime-range-from-input"]');
|
||||||
input.value = '10/16/2017 9:00 PM';
|
const expected = DateFnsUtils.formatDate(new Date(), DEFAULT_DATETIME_FORMAT);
|
||||||
input.dispatchEvent(new Event('input'));
|
expect(input.value).toBe(expected);
|
||||||
|
|
||||||
fixture.detectChanges();
|
|
||||||
await fixture.whenStable();
|
|
||||||
|
|
||||||
expect(component.getFromValidationMessage()).toEqual('');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have no maximum datetime by default', async () => {
|
it('should have no maximum datetime by default', async () => {
|
||||||
|
@@ -15,42 +15,48 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
import { ADF_DATE_FORMATS, ADF_DATETIME_FORMATS, AdfDateFnsAdapter, AdfDateTimeFnsAdapter, DateFnsUtils } from '@alfresco/adf-core';
|
||||||
|
|
||||||
import { SearchWidget } from '../../models/search-widget.interface';
|
import { SearchWidget } from '../../models/search-widget.interface';
|
||||||
import { SearchWidgetSettings } from '../../models/search-widget-settings.interface';
|
import { SearchWidgetSettings } from '../../models/search-widget-settings.interface';
|
||||||
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
|
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
|
||||||
import { LiveErrorStateMatcher } from '../../forms/live-error-state-matcher';
|
import { LiveErrorStateMatcher } from '../../forms/live-error-state-matcher';
|
||||||
import { Moment } from 'moment';
|
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { DatetimeAdapter, MAT_DATETIME_FORMATS, MatDatetimepickerInputEvent } from '@mat-datetimepicker/core';
|
||||||
import { DatetimeAdapter, MAT_DATETIME_FORMATS } from '@mat-datetimepicker/core';
|
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
||||||
import { MAT_MOMENT_DATETIME_FORMATS } from '@mat-datetimepicker/moment';
|
import { isValid, isBefore, startOfMinute, endOfMinute } from 'date-fns';
|
||||||
|
|
||||||
export interface DatetimeRangeValue {
|
export interface DatetimeRangeValue {
|
||||||
from: string;
|
from: string;
|
||||||
to: string;
|
to: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare let moment: any;
|
interface FormProps {
|
||||||
|
from: FormControl<Date>;
|
||||||
|
to: FormControl<Date>;
|
||||||
|
}
|
||||||
|
|
||||||
const DEFAULT_DATETIME_FORMAT: string = 'DD/MM/YYYY HH:mm';
|
export const DEFAULT_DATETIME_FORMAT: string = 'dd/MM/yyyy HH:mm';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-search-datetime-range',
|
selector: 'adf-search-datetime-range',
|
||||||
templateUrl: './search-datetime-range.component.html',
|
templateUrl: './search-datetime-range.component.html',
|
||||||
styleUrls: ['./search-datetime-range.component.scss'],
|
styleUrls: ['./search-datetime-range.component.scss'],
|
||||||
providers: [{ provide: MAT_DATETIME_FORMATS, useValue: MAT_MOMENT_DATETIME_FORMATS }],
|
providers: [
|
||||||
|
{ provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS },
|
||||||
|
{ provide: MAT_DATETIME_FORMATS, useValue: ADF_DATETIME_FORMATS },
|
||||||
|
{ provide: DateAdapter, useClass: AdfDateFnsAdapter },
|
||||||
|
{ provide: DatetimeAdapter, useClass: AdfDateTimeFnsAdapter }
|
||||||
|
],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'adf-search-date-range' }
|
host: { class: 'adf-search-date-range' }
|
||||||
})
|
})
|
||||||
export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDestroy {
|
export class SearchDatetimeRangeComponent implements SearchWidget, OnInit {
|
||||||
from: UntypedFormControl;
|
from: FormControl<Date>;
|
||||||
to: UntypedFormControl;
|
to: FormControl<Date>;
|
||||||
|
|
||||||
form: UntypedFormGroup;
|
form: FormGroup<FormProps>;
|
||||||
matcher = new LiveErrorStateMatcher();
|
matcher = new LiveErrorStateMatcher();
|
||||||
|
|
||||||
id: string;
|
id: string;
|
||||||
@@ -64,9 +70,8 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
enableChangeUpdate: boolean;
|
enableChangeUpdate: boolean;
|
||||||
displayValue$: Subject<string> = new Subject<string>();
|
displayValue$: Subject<string> = new Subject<string>();
|
||||||
|
|
||||||
private onDestroy$ = new Subject<boolean>();
|
constructor(private dateAdapter: DateAdapter<Date>,
|
||||||
|
private dateTimeAdapter: DatetimeAdapter<Date>) {}
|
||||||
constructor(private dateAdapter: DatetimeAdapter<Moment>, private userPreferencesService: UserPreferencesService) {}
|
|
||||||
|
|
||||||
getFromValidationMessage(): string {
|
getFromValidationMessage(): string {
|
||||||
return this.from.hasError('invalidOnChange') || this.hasParseError(this.from)
|
return this.from.hasError('invalidOnChange') || this.hasParseError(this.from)
|
||||||
@@ -93,29 +98,30 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.datetimePickerFormat = this.settings?.datetimeFormat ? this.settings.datetimeFormat : DEFAULT_DATETIME_FORMAT;
|
this.datetimePickerFormat = this.settings?.datetimeFormat ? this.settings.datetimeFormat : DEFAULT_DATETIME_FORMAT;
|
||||||
|
|
||||||
this.userPreferencesService
|
const dateAdapter = this.dateAdapter as AdfDateFnsAdapter;
|
||||||
.select(UserPreferenceValues.Locale)
|
dateAdapter.displayFormat = this.datetimePickerFormat;
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe((locale) => this.setLocale(locale));
|
const dateTimeAdapter = this.dateTimeAdapter as AdfDateTimeFnsAdapter;
|
||||||
|
dateTimeAdapter.displayFormat = this.datetimePickerFormat;
|
||||||
|
|
||||||
const validators = Validators.compose([Validators.required]);
|
const validators = Validators.compose([Validators.required]);
|
||||||
|
|
||||||
if (this.settings?.maxDatetime) {
|
if (this.settings?.maxDatetime) {
|
||||||
this.maxDatetime = moment(this.settings.maxDatetime);
|
this.maxDatetime = new Date(this.settings.maxDatetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.startValue) {
|
if (this.startValue) {
|
||||||
const splitValue = this.startValue.split('||');
|
const splitValue = this.startValue.split('||');
|
||||||
const fromValue = this.dateAdapter.parse(splitValue[0], this.datetimePickerFormat);
|
const fromValue = this.dateAdapter.parse(splitValue[0], this.datetimePickerFormat);
|
||||||
const toValue = this.dateAdapter.parse(splitValue[1], this.datetimePickerFormat);
|
const toValue = this.dateAdapter.parse(splitValue[1], this.datetimePickerFormat);
|
||||||
this.from = new UntypedFormControl(fromValue, validators);
|
this.from = new FormControl<Date>(fromValue, validators);
|
||||||
this.to = new UntypedFormControl(toValue, validators);
|
this.to = new FormControl<Date>(toValue, validators);
|
||||||
} else {
|
} else {
|
||||||
this.from = new UntypedFormControl('', validators);
|
this.from = new FormControl<Date>(null, validators);
|
||||||
this.to = new UntypedFormControl('', validators);
|
this.to = new FormControl<Date>(null, validators);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.form = new UntypedFormGroup({
|
this.form = new FormGroup<FormProps>({
|
||||||
from: this.from,
|
from: this.from,
|
||||||
to: this.to
|
to: this.to
|
||||||
});
|
});
|
||||||
@@ -124,17 +130,12 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
this.enableChangeUpdate = this.settings?.allowUpdateOnChange ?? true;
|
this.enableChangeUpdate = this.settings?.allowUpdateOnChange ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
apply(model: Partial<{ from: Date; to: Date }>, isValidValue: boolean) {
|
||||||
this.onDestroy$.next(true);
|
if (isValidValue && this.id && this.context && this.settings && this.settings.field) {
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(model: { from: string; to: string }, isValid: boolean) {
|
|
||||||
if (isValid && this.id && this.context && this.settings && this.settings.field) {
|
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
|
|
||||||
const start = moment.utc(model.from).startOf('minute').format();
|
const start = DateFnsUtils.utcToLocal(startOfMinute(model.from)).toISOString();
|
||||||
const end = moment.utc(model.to).endOf('minute').format();
|
const end = DateFnsUtils.utcToLocal(endOfMinute(model.to)).toISOString();
|
||||||
|
|
||||||
this.context.queryFragments[this.id] = `${this.settings.field}:['${start}' TO '${end}']`;
|
this.context.queryFragments[this.id] = `${this.settings.field}:['${start}' TO '${end}']`;
|
||||||
this.updateDisplayValue();
|
this.updateDisplayValue();
|
||||||
@@ -186,8 +187,8 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
clear() {
|
clear() {
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
this.form.reset({
|
this.form.reset({
|
||||||
from: '',
|
from: null,
|
||||||
to: ''
|
to: null
|
||||||
});
|
});
|
||||||
if (this.id && this.context) {
|
if (this.id && this.context) {
|
||||||
this.context.queryFragments[this.id] = '';
|
this.context.queryFragments[this.id] = '';
|
||||||
@@ -211,10 +212,10 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangedHandler(event: any, formControl: UntypedFormControl) {
|
onChangedHandler(event: MatDatetimepickerInputEvent<Date>, formControl: FormControl<Date>) {
|
||||||
const inputValue = event.value;
|
const formatDate = event.value;
|
||||||
const formatDate = this.dateAdapter.parse(inputValue, this.datetimePickerFormat);
|
|
||||||
if (formatDate?.isValid()) {
|
if (isValid(formatDate)) {
|
||||||
formControl.setValue(formatDate);
|
formControl.setValue(formatDate);
|
||||||
} else if (formatDate) {
|
} else if (formatDate) {
|
||||||
formControl.setErrors({
|
formControl.setErrors({
|
||||||
@@ -225,21 +226,16 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
this.setFromMaxDatetime();
|
this.setFromMaxDatetime();
|
||||||
}
|
}
|
||||||
|
|
||||||
setLocale(locale) {
|
hasParseError(formControl: FormControl<Date>): boolean {
|
||||||
this.dateAdapter.setLocale(locale);
|
|
||||||
moment.locale(locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
hasParseError(formControl): boolean {
|
|
||||||
return formControl.hasError('matDatepickerParse') && formControl.getError('matDatepickerParse').text;
|
return formControl.hasError('matDatepickerParse') && formControl.getError('matDatepickerParse').text;
|
||||||
}
|
}
|
||||||
|
|
||||||
forcePlaceholder(event: any) {
|
forcePlaceholder(event: any) {
|
||||||
event.srcElement.click();
|
event.target.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFromMaxDatetime() {
|
setFromMaxDatetime() {
|
||||||
this.fromMaxDatetime =
|
this.fromMaxDatetime =
|
||||||
!this.to.value || (this.maxDatetime && moment(this.maxDatetime).isBefore(this.to.value)) ? this.maxDatetime : moment(this.to.value);
|
!this.to.value || (this.maxDatetime && isBefore(this.maxDatetime, this.to.value)) ? this.maxDatetime : this.to.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,9 @@
|
|||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import moment, { Moment } from 'moment';
|
import moment, { Moment } from 'moment';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated this pipe is deprecated and should no longer be used
|
||||||
|
*/
|
||||||
@Pipe({ name: 'adfMomentDate' })
|
@Pipe({ name: 'adfMomentDate' })
|
||||||
export class MomentDatePipe implements PipeTransform {
|
export class MomentDatePipe implements PipeTransform {
|
||||||
transform(value: moment.MomentInput, dateFormat: string): Moment {
|
transform(value: moment.MomentInput, dateFormat: string): Moment {
|
||||||
|
@@ -18,6 +18,9 @@
|
|||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import moment, { Moment } from 'moment';
|
import moment, { Moment } from 'moment';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated this pipe is deprecated and should no longer be used
|
||||||
|
*/
|
||||||
@Pipe({ name: 'adfMomentDateTime' })
|
@Pipe({ name: 'adfMomentDateTime' })
|
||||||
export class MomentDateTimePipe implements PipeTransform {
|
export class MomentDateTimePipe implements PipeTransform {
|
||||||
transform(value: moment.MomentInput, dateFormat: string): Moment {
|
transform(value: moment.MomentInput, dateFormat: string): Moment {
|
||||||
|
@@ -16,13 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { element, by, $ } from 'protractor';
|
import { element, by, $ } from 'protractor';
|
||||||
import { DateUtil } from '../../utils/date-util';
|
|
||||||
import { BrowserVisibility } from '../../utils/browser-visibility';
|
import { BrowserVisibility } from '../../utils/browser-visibility';
|
||||||
import { BrowserActions } from '../../utils/browser-actions';
|
import { BrowserActions } from '../../utils/browser-actions';
|
||||||
import { TestElement } from '../../test-element';
|
import { TestElement } from '../../test-element';
|
||||||
|
import { addDays, format, subDays } from 'date-fns';
|
||||||
|
|
||||||
export class DatePickerCalendarPage {
|
export class DatePickerCalendarPage {
|
||||||
|
|
||||||
datePicker = $('mat-calendar[id*="mat-datepicker"]');
|
datePicker = $('mat-calendar[id*="mat-datepicker"]');
|
||||||
nextMonthButton = $('button[class*="mat-calendar-next-button"]');
|
nextMonthButton = $('button[class*="mat-calendar-next-button"]');
|
||||||
previousMonthButton = $('button[class*="mat-calendar-previous-button"]');
|
previousMonthButton = $('button[class*="mat-calendar-previous-button"]');
|
||||||
@@ -33,8 +32,8 @@ export class DatePickerCalendarPage {
|
|||||||
return BrowserActions.getAttribute($('button[class*="mat-calendar-body-active"]'), 'aria-label');
|
return BrowserActions.getAttribute($('button[class*="mat-calendar-body-active"]'), 'aria-label');
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkDatesAfterDateAreDisabled(date): Promise<void> {
|
async checkDatesAfterDateAreDisabled(date: Date): Promise<void> {
|
||||||
const afterDate = DateUtil.formatDate('DD-MM-YY', date, 1);
|
const afterDate = format(addDays(date, 1), 'dd-MM-yy');
|
||||||
const afterCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`);
|
const afterCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${afterDate}"]`);
|
||||||
if (await afterCalendar.isPresent()) {
|
if (await afterCalendar.isPresent()) {
|
||||||
const aria = await BrowserActions.getAttribute(afterCalendar, 'aria-disabled');
|
const aria = await BrowserActions.getAttribute(afterCalendar, 'aria-disabled');
|
||||||
@@ -44,8 +43,8 @@ export class DatePickerCalendarPage {
|
|||||||
await expect(isEnabled).toBe(false);
|
await expect(isEnabled).toBe(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkDatesBeforeDateAreDisabled(date): Promise<void> {
|
async checkDatesBeforeDateAreDisabled(date: Date): Promise<void> {
|
||||||
const beforeDate = DateUtil.formatDate('DD-MM-YY', date, -1);
|
const beforeDate = format(subDays(date, 1), 'dd-MM-yy');
|
||||||
const beforeCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`);
|
const beforeCalendar = $(`td[class*="mat-calendar-body-cell"][aria-label="${beforeDate}"]`);
|
||||||
if (await beforeCalendar.isPresent()) {
|
if (await beforeCalendar.isPresent()) {
|
||||||
const aria = await BrowserActions.getAttribute(beforeCalendar, 'aria-disabled');
|
const aria = await BrowserActions.getAttribute(beforeCalendar, 'aria-disabled');
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @license
|
|
||||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
||||||
*
|
|
||||||
* 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();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -22,6 +22,5 @@ export * from './protractor.util';
|
|||||||
export * from './local-storage.util';
|
export * from './local-storage.util';
|
||||||
export * from './file-browser.util';
|
export * from './file-browser.util';
|
||||||
export * from './form.util';
|
export * from './form.util';
|
||||||
export * from './date-util';
|
|
||||||
export * from './wait-actions';
|
export * from './wait-actions';
|
||||||
export * from './logger';
|
export * from './logger';
|
||||||
|
Reference in New Issue
Block a user