[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:
Denys Vuika
2023-10-18 07:56:10 +01:00
committed by GitHub
parent af24aceb65
commit 7d5fbecf3f
22 changed files with 350 additions and 428 deletions

View File

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