Skip to content

Commit

Permalink
Merge branch 'develop' into dev-mmaliarchuk/ACS-5994-remove-duplicate…
Browse files Browse the repository at this point in the history
…-method-to-delete-node
  • Loading branch information
akashrathod28 authored Oct 24, 2023
2 parents 5365a2b + 9b2cf2b commit 96aecfc
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 145 deletions.
5 changes: 4 additions & 1 deletion e2e/protractor/protractor.excludes.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@
"C325158" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5678",
"C325161" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5678",
"C325162" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5678",
"C325163" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5678"
"C325163" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5678",
"C269007" : "date test fail migrate to playwright https://alfresco.atlassian.net/browse/ACS-6185 ",
"C307106" : "date test fail migrate to playwright https://alfresco.atlassian.net/browse/ACS-6185 ",
"C269003" : "date test fail migrate to playwright https://alfresco.atlassian.net/browse/ACS-6185 "
}
17 changes: 12 additions & 5 deletions e2e/protractor/suites/extensions/ext-info-drawer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ describe('Extensions - Info Drawer', () => {

const file = `file-${Utils.random()}.txt`;
let fileId: string;
const fileRemove = `file-${Utils.random()}.txt`;
let fileIdRemove: string;

const PROPERTIES_TAB = {
order: 1,
Expand Down Expand Up @@ -79,10 +81,7 @@ describe('Extensions - Info Drawer', () => {
await userActions.login(username, username);

fileId = await apis.user.createFile(file);
});

afterAll(async () => {
await apis.user.nodes.deleteNodeById(fileId);
fileIdRemove = await apis.user.createFile(fileRemove);
});

describe('', () => {
Expand All @@ -97,6 +96,10 @@ describe('Extensions - Info Drawer', () => {
await page.dataTable.clearSelection();
});

afterAll(async () => {
await apis.user.nodes.deleteNodesById([fileId]);
});

it('[C284646] Add a new tab with icon and title ', async () => {
await page.dataTable.selectItem(file);
await BrowserActions.click(page.toolbar.viewDetailsButton);
Expand Down Expand Up @@ -152,8 +155,12 @@ describe('Extensions - Info Drawer', () => {
await page.clickPersonalFilesAndWait();
});

afterAll(async () => {
await apis.user.nodes.deleteNodesById([fileIdRemove]);
});

it('[C284650] Remove all tabs', async () => {
await page.dataTable.selectItem(file);
await page.dataTable.selectItem(fileRemove);
await BrowserActions.click(page.toolbar.viewDetailsButton);
await infoDrawer.waitForInfoDrawerToOpen();

Expand Down
137 changes: 4 additions & 133 deletions e2e/protractor/suites/info-drawer/file-folder-properties.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import {
AdminActions,
LoginPage,
BrowsingPage,
RepoClient,
InfoDrawer,
Utils,
FILES,
DATE_TIME_FORMAT,
DATE_FORMAT
} from '@alfresco/aca-testing-shared';
import { DateFnsUtils } from '@alfresco/adf-core';
import { AdminActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils, FILES } from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';

describe('File / Folder properties', () => {
Expand All @@ -49,15 +38,13 @@ describe('File / Folder properties', () => {
author: 'file author',
contentType: 'Content'
};
let file1Id: string;

const image1 = {
name: FILES.jpgFile,
title: 'image title',
description: 'image description',
author: 'image author'
};
let image1Id: string;

const folder1 = {
name: `folder1-${Utils.random()}`,
Expand All @@ -66,7 +53,6 @@ describe('File / Folder properties', () => {
author: 'folder author',
contentType: 'Folder'
};
let folder1Id: string;

const apis = {
user: new RepoClient(username, username)
Expand All @@ -83,9 +69,9 @@ describe('File / Folder properties', () => {
beforeAll(async () => {
await adminApiActions.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1.name, parentId, file1.title, file1.description, file1.author)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1.name, parentId, folder1.title, folder1.description, folder1.author)).entry.id;
image1Id = (await apis.user.upload.uploadFile(image1.name, parentId)).entry.id;
await apis.user.nodes.createFile(file1.name, parentId, file1.title, file1.description, file1.author);
await apis.user.nodes.createFolder(folder1.name, parentId, folder1.title, folder1.description, folder1.author);
await apis.user.upload.uploadFile(image1.name, parentId);

await loginPage.loginWith(username);
});
Expand All @@ -111,72 +97,6 @@ describe('File / Folder properties', () => {
expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs');
});

it('[C269003] File properties', async () => {
const apiProps = await apis.user.nodes.getNodeById(file1Id);

const expectedPropLabels = [
'Name',
'Title',
'Creator',
'Created Date',
'Size',
'Modifier',
'Modified Date',
'Mimetype',
'Author',
'Description',
'Content Type'
];
const expectedPropValues = [
file1.name,
file1.title,
apiProps.entry.createdByUser.displayName,
DateFnsUtils.formatDate(apiProps.entry.createdAt, DATE_FORMAT),
`${apiProps.entry.content.sizeInBytes} Bytes`,
apiProps.entry.modifiedByUser.displayName,
DateFnsUtils.formatDate(apiProps.entry.modifiedAt, DATE_FORMAT),
apiProps.entry.content.mimeTypeName,
file1.author,
file1.description,
file1.contentType
];

await dataTable.selectItem(file1.name);
await BrowserActions.click(page.toolbar.viewDetailsButton);
await infoDrawer.waitForInfoDrawerToOpen();

expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
});

it('[C307106] Folder properties', async () => {
const apiProps = await apis.user.nodes.getNodeById(folder1Id);

const expectedPropLabels = ['Name', 'Title', 'Creator', 'Created Date', 'Modifier', 'Modified Date', 'Author', 'Description', 'Content Type'];
const expectedPropValues = [
folder1.name,
folder1.title,
apiProps.entry.createdByUser.displayName,
DateFnsUtils.formatDate(apiProps.entry.createdAt, DATE_FORMAT),
apiProps.entry.modifiedByUser.displayName,
DateFnsUtils.formatDate(apiProps.entry.modifiedAt, DATE_FORMAT),
folder1.author,
folder1.description,
folder1.contentType
];

await dataTable.selectItem(folder1.name);
await BrowserActions.click(page.toolbar.viewDetailsButton);
await infoDrawer.waitForInfoDrawerToOpen();

expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
});

it('[C269004] Less / More information buttons', async () => {
await dataTable.selectItem(file1.name);
await BrowserActions.click(page.toolbar.viewDetailsButton);
Expand All @@ -198,55 +118,6 @@ describe('File / Folder properties', () => {
expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded');
});

it('[C269007] Image properties', async () => {
const apiProps = await apis.user.nodes.getNodeById(image1Id);
const properties = apiProps.entry.properties;

const expectedPropLabels = [
'Image Width',
'Image Height',
'Date and Time',
'Exposure Time',
'F Number',
'Flash Activated',
'Focal Length',
'ISO Speed',
'Orientation',
'Camera Manufacturer',
'Camera Model',
'Camera Software'
];
const expectedPropValues = [
properties['exif:pixelXDimension']?.toString(),
properties['exif:pixelYDimension']?.toString(),
DateFnsUtils.formatDate(new Date(properties['exif:dateTimeOriginal']), DATE_TIME_FORMAT),
properties['exif:exposureTime']?.toString(),
properties['exif:fNumber']?.toString(),
properties['exif:flash'],
properties['exif:focalLength']?.toString(),
properties['exif:isoSpeedRatings'],
properties['exif:orientation']?.toString(),
properties['exif:manufacturer'],
properties['exif:model'],
properties['exif:software']
];

await dataTable.selectItem(image1.name);
await BrowserActions.click(page.toolbar.viewDetailsButton);
await infoDrawer.waitForInfoDrawerToOpen();

await BrowserActions.click(propertiesTab.moreInfoButton);
await BrowserActions.click(propertiesTab.imagePropertiesPanel);

await propertiesTab.waitForImagePropertiesPanelToExpand();

expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed');
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
});

it('[C599174] Should be able to make the files/folders info drawer expandable as for Sites', async () => {
await dataTable.selectItem(file1.name);
await BrowserActions.click(page.toolbar.viewDetailsButton);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<aca-page-layout>
<div class="aca-page-layout-header">
<adf-breadcrumb [root]="title" [folderNode]="node" (navigate)="goBack()"> </adf-breadcrumb>
<adf-breadcrumb [root]="title" [folderNode]="node" (navigate)="onBreadcrumbNavigate($event)"> </adf-breadcrumb>
<aca-toolbar [items]="actions"></aca-toolbar>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import { of, Subject } from 'rxjs';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Store } from '@ngrx/store';
import { ContentApiService } from '@alfresco/aca-shared';
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { NodeEntry } from '@alfresco/js-api';
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction, NavigateToFolder } from '@alfresco/aca-shared/store';
import { NodeEntry, PathElement } from '@alfresco/js-api';
import { RouterTestingModule } from '@angular/router/testing';
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { BreadcrumbComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { By } from '@angular/platform-browser';

describe('DetailsComponent', () => {
let component: DetailsComponent;
Expand All @@ -45,7 +46,7 @@ describe('DetailsComponent', () => {

const mockStream = new Subject();
const storeMock = {
dispatch: jasmine.createSpy('dispatch'),
dispatch: jasmine.createSpy('dispatch').and.stub(),
select: () => mockStream
};

Expand Down Expand Up @@ -124,6 +125,17 @@ describe('DetailsComponent', () => {
expect(contentApiService.getNode).toHaveBeenCalled();
});

it('should dispatch navigation to a given folder', () => {
const breadcrumbComponent: BreadcrumbComponent = fixture.debugElement.query(By.directive(BreadcrumbComponent)).componentInstance;
const pathElement: PathElement = {
id: 'fake-id'
};
breadcrumbComponent.navigate.emit(pathElement);
fixture.detectChanges();

expect(store.dispatch).toHaveBeenCalledWith(new NavigateToFolder({ entry: pathElement } as NodeEntry));
});

it('should dispatch node selection', () => {
fixture.detectChanges();
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { Subject } from 'rxjs';
import { BreadcrumbModule, PermissionManagerModule } from '@alfresco/adf-content-services';
import { CommonModule } from '@angular/common';
Expand All @@ -36,6 +36,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatButtonModule } from '@angular/material/button';
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
import { NodeEntry, PathElement } from '@alfresco/js-api';

@Component({
standalone: true,
Expand Down Expand Up @@ -105,6 +106,10 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
this.store.dispatch(new NavigateToPreviousPage());
}

onBreadcrumbNavigate(path: PathElement) {
this.store.dispatch(new NavigateToFolder({ entry: path } as NodeEntry));
}

ngOnDestroy(): void {
this.store.dispatch(new SetSelectedNodesAction([]));
this.onDestroy$.next();
Expand Down

0 comments on commit 96aecfc

Please sign in to comment.