From c6e54e20d0a7d3983e382eaaad4366f418ff8a02 Mon Sep 17 00:00:00 2001 From: Aayush Rohila <112551534+arohilaGL@users.noreply.github.com> Date: Wed, 20 Sep 2023 14:13:11 +0530 Subject: [PATCH] [APPS-2170] Replace moment.js to date-fns in file-folder-properties.test.ts (#3417) * [APPS-2170] replace moment.js to date-fns in file-folder-preoperties.ts * [APPS-2170] date change * [APPS-2170] Commit to run e2e * [APPS-2170] e2e fix --- .../info-drawer/file-folder-properties.test.ts | 13 ++++++------- projects/aca-testing-shared/src/configs.ts | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts b/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts index 0efdde86df..adf9b4a40c 100755 --- a/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts +++ b/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts @@ -34,8 +34,7 @@ import { DATE_FORMAT } from '@alfresco/aca-testing-shared'; import { BrowserActions } from '@alfresco/adf-testing'; - -const moment = require('moment'); +import { format } from 'date-fns'; describe('File / Folder properties', () => { const username = `user1-${Utils.random()}`; @@ -132,10 +131,10 @@ describe('File / Folder properties', () => { file1.name, file1.title, apiProps.entry.createdByUser.displayName, - moment(apiProps.entry.createdAt).format(DATE_FORMAT), + format(apiProps.entry.createdAt, DATE_FORMAT), `${apiProps.entry.content.sizeInBytes} Bytes`, apiProps.entry.modifiedByUser.displayName, - moment(apiProps.entry.modifiedAt).format(DATE_FORMAT), + format(apiProps.entry.modifiedAt, DATE_FORMAT), apiProps.entry.content.mimeTypeName, file1.author, file1.description, @@ -160,9 +159,9 @@ describe('File / Folder properties', () => { folder1.name, folder1.title, apiProps.entry.createdByUser.displayName, - moment(apiProps.entry.createdAt).format(DATE_FORMAT), + format(apiProps.entry.createdAt, DATE_FORMAT), apiProps.entry.modifiedByUser.displayName, - moment(apiProps.entry.modifiedAt).format(DATE_FORMAT), + format(apiProps.entry.modifiedAt, DATE_FORMAT), folder1.author, folder1.description, folder1.contentType @@ -220,7 +219,7 @@ describe('File / Folder properties', () => { const expectedPropValues = [ properties['exif:pixelXDimension']?.toString(), properties['exif:pixelYDimension']?.toString(), - moment(properties['exif:dateTimeOriginal']).format(DATE_TIME_FORMAT), + format(new Date(properties['exif:dateTimeOriginal']), DATE_TIME_FORMAT), properties['exif:exposureTime']?.toString(), properties['exif:fNumber']?.toString(), properties['exif:flash'], diff --git a/projects/aca-testing-shared/src/configs.ts b/projects/aca-testing-shared/src/configs.ts index e57262f6aa..df28f491b3 100755 --- a/projects/aca-testing-shared/src/configs.ts +++ b/projects/aca-testing-shared/src/configs.ts @@ -28,8 +28,8 @@ export const BROWSER_WAIT_TIMEOUT = 10000; export const USE_HASH_STRATEGY = true; // Dates -export const DATE_FORMAT = 'MMM D, YYYY'; -export const DATE_TIME_FORMAT = 'MMM D, YYYY, H:mm'; +export const DATE_FORMAT = 'MMM d, yyyy'; +export const DATE_TIME_FORMAT = 'MMM d, yyyy, H:mm'; // Application Routes export const APP_ROUTES = {