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.
|
||||
*/
|
||||
|
||||
import {
|
||||
DropActions,
|
||||
BrowserActions,
|
||||
BrowserVisibility,
|
||||
DateUtil,
|
||||
DocumentListPage,
|
||||
DropdownPage,
|
||||
Logger
|
||||
} from '@alfresco/adf-testing';
|
||||
import { DropActions, BrowserActions, BrowserVisibility, DocumentListPage, DropdownPage, Logger } from '@alfresco/adf-testing';
|
||||
import { $$, browser, by, element, protractor, $ } from 'protractor';
|
||||
import { FolderDialogPage } from './dialog/folder-dialog.page';
|
||||
import { NavigationBarPage } from './navigation-bar.page';
|
||||
|
||||
import * as path from 'path';
|
||||
|
||||
export class ContentServicesPage {
|
||||
|
||||
columns = {
|
||||
name: 'Display name',
|
||||
size: 'Size',
|
||||
@@ -94,28 +84,28 @@ export class ContentServicesPage {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
|
||||
}
|
||||
|
||||
async deleteContent(content): Promise<void> {
|
||||
async deleteContent(content: string): Promise<void> {
|
||||
await this.contentList.clickOnActionMenu(content);
|
||||
await BrowserActions.click(this.deleteContentElement);
|
||||
await this.checkContentIsNotDisplayed(content);
|
||||
}
|
||||
|
||||
async metadataContent(content): Promise<void> {
|
||||
async metadataContent(content: string): Promise<void> {
|
||||
await this.contentList.clickOnActionMenu(content);
|
||||
await BrowserActions.click(this.metadataAction);
|
||||
}
|
||||
|
||||
async versionManagerContent(content): Promise<void> {
|
||||
async versionManagerContent(content: string): Promise<void> {
|
||||
await this.contentList.clickOnActionMenu(content);
|
||||
await BrowserActions.click(this.versionManagerAction);
|
||||
}
|
||||
|
||||
async clickFileHyperlink(fileName): Promise<void> {
|
||||
async clickFileHyperlink(fileName: string): Promise<void> {
|
||||
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
|
||||
await BrowserActions.click(hyperlink);
|
||||
}
|
||||
|
||||
async checkFileHyperlinkIsEnabled(fileName): Promise<void> {
|
||||
async checkFileHyperlinkIsEnabled(fileName: string): Promise<void> {
|
||||
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
|
||||
}
|
||||
@@ -129,38 +119,6 @@ export class ContentServicesPage {
|
||||
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
|
||||
async checkDocumentListElementsAreDisplayed(): Promise<void> {
|
||||
await this.checkAcsContainer();
|
||||
@@ -368,16 +326,16 @@ export class ContentServicesPage {
|
||||
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`);
|
||||
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);
|
||||
}
|
||||
|
||||
async checkEmptyFolderTextToBe(text): Promise<void> {
|
||||
async checkEmptyFolderTextToBe(text: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
|
||||
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);
|
||||
}
|
||||
|
||||
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`);
|
||||
return BrowserActions.getAttribute(iconRow, 'src');
|
||||
}
|
||||
@@ -415,12 +373,16 @@ export class ContentServicesPage {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -429,24 +391,10 @@ export class ContentServicesPage {
|
||||
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> {
|
||||
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> {
|
||||
await this.siteListDropdown.checkOptionIsSelected(siteName);
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ import { $$ } from 'protractor';
|
||||
import { BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
export class FolderDialogPage {
|
||||
|
||||
folderDialog = $$('adf-folder-dialog').first();
|
||||
folderNameField = this.folderDialog.$('#adf-folder-name-input');
|
||||
createUpdateButton = this.folderDialog.$('#adf-folder-create-button');
|
||||
@@ -29,7 +28,7 @@ export class FolderDialogPage {
|
||||
await BrowserActions.click(this.createUpdateButton);
|
||||
}
|
||||
|
||||
async addFolderName(folderName): Promise<void> {
|
||||
async addFolderName(folderName: string): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ import { $, browser } from 'protractor';
|
||||
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';
|
||||
|
||||
export class UploadTogglesPage {
|
||||
|
||||
togglePage = new TogglePage();
|
||||
multipleFileUploadToggle = $('#adf-multiple-upload-switch');
|
||||
uploadFolderToggle = $('#adf-folder-upload-switch');
|
||||
@@ -44,11 +43,6 @@ export class UploadTogglesPage {
|
||||
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> {
|
||||
const enabledToggle = $('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]');
|
||||
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
|
||||
|
@@ -31,7 +31,6 @@ export class MetadataViewPage {
|
||||
size = $(`[data-automation-id='card-textitem-value-content.sizeInBytes']`);
|
||||
description = $(`span[data-automation-id='card-textitem-value-properties.cm:description']`);
|
||||
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']`);
|
||||
informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`);
|
||||
informationSpan = $(`span[data-automation-id='meta-data-card-toggle-expand-label']`);
|
||||
@@ -96,10 +95,6 @@ export class MetadataViewPage {
|
||||
return BrowserActions.getInputValue(this.author);
|
||||
}
|
||||
|
||||
async getTitleProperty(): Promise<string> {
|
||||
return BrowserActions.getText(this.titleProperty);
|
||||
}
|
||||
|
||||
async editIconIsDisplayed(): Promise<void> {
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user