Skip to content

Commit

Permalink
[APPS-2171][APPS-2172] Replace from moment.js to date-fns in search-f…
Browse files Browse the repository at this point in the history
…ilter.test and search-results-file-folders.test (#3421)

* [APPS-2171][APPS-2172] Replace from moment.js to date-fns in search-filter.test and search-results-file-folders.test

* [APPS-2171][APPS-2172] Update date

* [APPS-2171] test update

* [APPS-2171] test changes
  • Loading branch information
arohilaGL authored Sep 20, 2023
1 parent d1ff001 commit df8b08f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions e2e/protractor/suites/search/search-filters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ import {
SizeOperator
} from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';

const moment = require('moment');
import { addDays, format, subDays } from 'date-fns';

describe('Search filters', () => {
const random = Utils.random();
Expand Down Expand Up @@ -162,9 +161,9 @@ describe('Search filters', () => {
});

describe('Filter by Created date', () => {
const yesterday = moment().subtract(1, 'day').format('DD-MMM-YY');
const today = moment().format('DD-MMM-YY');
const future = moment().add(1, 'month').format('DD-MMM-YY');
const yesterday = format(subDays(new Date(), 1), 'dd-MMM-yy');
const today = format(new Date(), 'dd-MMM-yy');
const future = format(addDays(new Date(), 1), 'dd-MMM-yy');

afterEach(async () => {
await Utils.pressEscape();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils } from '@alfresco/aca-testing-shared';
const moment = require('moment');
import { format } from 'date-fns';

describe('Search results - files and folders', () => {
const random = Utils.random();
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Search results - files and folders', () => {
await dataTable.waitForBody();

const fileEntry = await apis.user.nodes.getNodeById(fileId);
const modifiedDate = moment(fileEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A');
const modifiedDate = format(fileEntry.entry.modifiedAt, 'MMM d, yyyy, h:mm:ss aa');
const modifiedBy = fileEntry.entry.modifiedByUser.displayName;
const size = fileEntry.entry.content.sizeInBytes;

Expand All @@ -114,7 +114,7 @@ describe('Search results - files and folders', () => {
await dataTable.waitForBody();

const folderEntry = await apis.user.nodes.getNodeById(folderId);
const modifiedDate = moment(folderEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A');
const modifiedDate = format(folderEntry.entry.modifiedAt, 'MMM d, yyyy, h:mm:ss aa');
const modifiedBy = folderEntry.entry.modifiedByUser.displayName;

expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not displayed`);
Expand Down

0 comments on commit df8b08f

Please sign in to comment.