[AAE-10766] upgrade to new About component (#2769)

* [AAE-10766] upgrade to new About component

* upgrade to latest ADF alpha

* update e2e to reflect snackbar changes

* Revert "update e2e to reflect snackbar changes"

This reverts commit 6164804bab1e59ef2ec85caf13d85014fa19e2f8.

* ACS-3640 a 11 y aca 881740 snackbar messages disappear without option to adjust timing (#2734)

* ACS-3640 Increasing time of autoclosing snackbar and adding X icon to close snackbar

* ACS-3640 Fix lint issues

* ACS-3640 Addressing PR comments

* ACS-3640 Fix lint issue

* ACS-3640 Added aria label for action icon

* ACS-3640 Fixed one left file

* ACS-3640 Fixed lint issues

* use latest adf

* ACS-3640 Correction for e2e

Co-authored-by: Denys Vuika <denys.vuika@gmail.com>

* remove the action check from the snackbar

* update e2e

* update e2e

* update e2e

* Update e2e

Co-authored-by: AleksanderSklorz <115619721+AleksanderSklorz@users.noreply.github.com>
Co-authored-by: Aleksander Sklorz <Aleksander.Sklorz@hyland.com>
This commit is contained in:
Denys Vuika 2022-11-14 23:55:06 +00:00 committed by GitHub
parent bc4905631b
commit 5ce4835e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 418 additions and 140 deletions

View File

@ -53,9 +53,9 @@ import { AppHookService, ContentApiService } from '@alfresco/aca-shared';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ContentManagementService } from './content-management.service'; import { ContentManagementService } from './content-management.service';
import { NodeActionsService } from './node-actions.service'; import { NodeActionsService } from './node-actions.service';
import { TranslationService, AlfrescoApiService, FileModel } from '@alfresco/adf-core'; import { TranslationService, AlfrescoApiService, FileModel, NotificationService } from '@alfresco/adf-core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
import { NodeEntry, Node, VersionPaging } from '@alfresco/js-api'; import { NodeEntry, Node, VersionPaging } from '@alfresco/js-api';
import { NewVersionUploaderDataAction, NewVersionUploaderService, NodeAspectService, ViewVersion } from '@alfresco/adf-content-services'; import { NewVersionUploaderDataAction, NewVersionUploaderService, NodeAspectService, ViewVersion } from '@alfresco/adf-content-services';
@ -65,7 +65,7 @@ describe('ContentManagementService', () => {
let contentApi: ContentApiService; let contentApi: ContentApiService;
let store: Store<AppStore>; let store: Store<AppStore>;
let contentManagementService: ContentManagementService; let contentManagementService: ContentManagementService;
let snackBar: MatSnackBar; let notificationService: NotificationService;
let nodeActions: NodeActionsService; let nodeActions: NodeActionsService;
let translationService: TranslationService; let translationService: TranslationService;
let alfrescoApiService: AlfrescoApiService; let alfrescoApiService: AlfrescoApiService;
@ -82,7 +82,7 @@ describe('ContentManagementService', () => {
actions$ = TestBed.inject(Actions); actions$ = TestBed.inject(Actions);
store = TestBed.inject(Store); store = TestBed.inject(Store);
contentManagementService = TestBed.inject(ContentManagementService); contentManagementService = TestBed.inject(ContentManagementService);
snackBar = TestBed.inject(MatSnackBar); notificationService = TestBed.inject(NotificationService);
nodeActions = TestBed.inject(NodeActionsService); nodeActions = TestBed.inject(NodeActionsService);
translationService = TestBed.inject(TranslationService); translationService = TestBed.inject(TranslationService);
alfrescoApiService = TestBed.inject(AlfrescoApiService); alfrescoApiService = TestBed.inject(AlfrescoApiService);
@ -98,7 +98,7 @@ describe('ContentManagementService', () => {
beforeEach(() => { beforeEach(() => {
subject = new Subject<string>(); subject = new Subject<string>();
spyOn(snackBar, 'open').and.callThrough(); spyOn(notificationService, 'openSnackMessageAction').and.callThrough();
}); });
afterEach(() => subject.complete()); afterEach(() => subject.complete());
@ -114,7 +114,7 @@ describe('ContentManagementService', () => {
subject.next('OPERATION.SUCCESS.CONTENT.COPY'); subject.next('OPERATION.SUCCESS.CONTENT.COPY');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.SINGULAR');
}); });
it('notifies successful copy of multiple nodes', () => { it('notifies successful copy of multiple nodes', () => {
@ -128,7 +128,7 @@ describe('ContentManagementService', () => {
subject.next('OPERATION.SUCCESS.CONTENT.COPY'); subject.next('OPERATION.SUCCESS.CONTENT.COPY');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PLURAL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PLURAL');
}); });
it('notifies partially copy of one node out of a multiple selection of nodes', () => { it('notifies partially copy of one node out of a multiple selection of nodes', () => {
@ -142,7 +142,7 @@ describe('ContentManagementService', () => {
subject.next('OPERATION.SUCCESS.CONTENT.COPY'); subject.next('OPERATION.SUCCESS.CONTENT.COPY');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_SINGULAR');
}); });
it('notifies partially copy of more nodes out of a multiple selection of nodes', () => { it('notifies partially copy of more nodes out of a multiple selection of nodes', () => {
@ -160,7 +160,7 @@ describe('ContentManagementService', () => {
subject.next('OPERATION.SUCCESS.CONTENT.COPY'); subject.next('OPERATION.SUCCESS.CONTENT.COPY');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_PLURAL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_PLURAL');
}); });
it('notifies of failed copy of multiple nodes', () => { it('notifies of failed copy of multiple nodes', () => {
@ -178,7 +178,7 @@ describe('ContentManagementService', () => {
subject.next('OPERATION.SUCCESS.CONTENT.COPY'); subject.next('OPERATION.SUCCESS.CONTENT.COPY');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_PLURAL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_PLURAL');
}); });
it('notifies of failed copy of one node', () => { it('notifies of failed copy of one node', () => {
@ -192,7 +192,7 @@ describe('ContentManagementService', () => {
subject.next('OPERATION.SUCCESS.CONTENT.COPY'); subject.next('OPERATION.SUCCESS.CONTENT.COPY');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_SINGULAR');
}); });
it('notifies error if success message was not emitted', () => { it('notifies error if success message was not emitted', () => {
@ -205,7 +205,7 @@ describe('ContentManagementService', () => {
subject.next(''); subject.next('');
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC');
}); });
it('notifies permission error on copy of node', () => { it('notifies permission error on copy of node', () => {
@ -216,7 +216,7 @@ describe('ContentManagementService', () => {
subject.error(new Error(JSON.stringify({ error: { statusCode: 403 } }))); subject.error(new Error(JSON.stringify({ error: { statusCode: 403 } })));
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.PERMISSION'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.PERMISSION');
}); });
it('notifies generic error message on all errors, but 403', () => { it('notifies generic error message on all errors, but 403', () => {
@ -228,7 +228,7 @@ describe('ContentManagementService', () => {
subject.error(new Error(JSON.stringify({ error: { statusCode: 404 } }))); subject.error(new Error(JSON.stringify({ error: { statusCode: 404 } })));
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC');
}); });
}); });
@ -239,7 +239,7 @@ describe('ContentManagementService', () => {
subject = new Subject<string>(); subject = new Subject<string>();
spyOn(nodeActions, 'copyNodes').and.returnValue(subject); spyOn(nodeActions, 'copyNodes').and.returnValue(subject);
spyOn(snackBar, 'open').and.returnValue({ spyOn(notificationService, 'openSnackMessageAction').and.returnValue({
onAction: () => of(null) onAction: () => of(null)
} as MatSnackBarRef<SimpleSnackBar>); } as MatSnackBarRef<SimpleSnackBar>);
}); });
@ -255,7 +255,7 @@ describe('ContentManagementService', () => {
nodeActions.contentCopied.next(createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.SINGULAR');
expect(contentApi.deleteNode).toHaveBeenCalledWith(createdItems[0].entry.id, { permanent: true }); expect(contentApi.deleteNode).toHaveBeenCalledWith(createdItems[0].entry.id, { permanent: true });
}); });
@ -292,7 +292,7 @@ describe('ContentManagementService', () => {
nodeActions.contentCopied.next(createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PLURAL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PLURAL');
expect(spyOnDeleteNode).toHaveBeenCalled(); expect(spyOnDeleteNode).toHaveBeenCalled();
expect(spyOnDeleteNode.calls.allArgs()).toEqual([ expect(spyOnDeleteNode.calls.allArgs()).toEqual([
@ -313,7 +313,7 @@ describe('ContentManagementService', () => {
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(contentApi.deleteNode).toHaveBeenCalled(); expect(contentApi.deleteNode).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toEqual('APP.MESSAGES.INFO.NODE_COPY.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toEqual('APP.MESSAGES.INFO.NODE_COPY.SINGULAR');
}); });
it('notifies when some error of type Error occurs on Undo action', () => { it('notifies when some error of type Error occurs on Undo action', () => {
@ -328,7 +328,7 @@ describe('ContentManagementService', () => {
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(contentApi.deleteNode).toHaveBeenCalled(); expect(contentApi.deleteNode).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toEqual('APP.MESSAGES.INFO.NODE_COPY.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toEqual('APP.MESSAGES.INFO.NODE_COPY.SINGULAR');
}); });
it('notifies permission error when it occurs on Undo action', () => { it('notifies permission error when it occurs on Undo action', () => {
@ -343,7 +343,7 @@ describe('ContentManagementService', () => {
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(contentApi.deleteNode).toHaveBeenCalled(); expect(contentApi.deleteNode).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toEqual('APP.MESSAGES.INFO.NODE_COPY.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toEqual('APP.MESSAGES.INFO.NODE_COPY.SINGULAR');
}); });
}); });
@ -366,7 +366,7 @@ describe('ContentManagementService', () => {
beforeEach(() => { beforeEach(() => {
subject = new Subject<string>(); subject = new Subject<string>();
spyOn(snackBar, 'open').and.callThrough(); spyOn(notificationService, 'openSnackMessageAction').and.callThrough();
}); });
afterEach(() => subject.complete()); afterEach(() => subject.complete());
@ -388,7 +388,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR');
}); });
it('notifies successful move of multiple nodes', () => { it('notifies successful move of multiple nodes', () => {
@ -409,7 +409,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.PLURAL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.PLURAL');
}); });
it('notifies partial move of a node', () => { it('notifies partial move of a node', () => {
@ -428,7 +428,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR');
}); });
it('notifies partial move of multiple nodes', () => { it('notifies partial move of multiple nodes', () => {
@ -447,7 +447,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.PLURAL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.PLURAL');
}); });
it('notifies successful move and the number of nodes that could not be moved', () => { it('notifies successful move and the number of nodes that could not be moved', () => {
@ -466,7 +466,9 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.FAIL'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe(
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.FAIL'
);
}); });
it('notifies successful move and the number of partially moved ones', () => { it('notifies successful move and the number of partially moved ones', () => {
@ -485,7 +487,9 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe(
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR'
);
}); });
it('notifies error if success message was not emitted', () => { it('notifies error if success message was not emitted', () => {
@ -503,7 +507,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC');
}); });
it('notifies permission error on move of node', () => { it('notifies permission error on move of node', () => {
@ -514,7 +518,7 @@ describe('ContentManagementService', () => {
nodeActions.moveNodes(null).error(new Error(JSON.stringify({ error: { statusCode: 403 } }))); nodeActions.moveNodes(null).error(new Error(JSON.stringify({ error: { statusCode: 403 } })));
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.PERMISSION'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.PERMISSION');
}); });
it('notifies generic error message on all errors, but 403', () => { it('notifies generic error message on all errors, but 403', () => {
@ -525,7 +529,7 @@ describe('ContentManagementService', () => {
nodeActions.moveNodes(null).error(new Error(JSON.stringify({ error: { statusCode: 404 } }))); nodeActions.moveNodes(null).error(new Error(JSON.stringify({ error: { statusCode: 404 } })));
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC');
}); });
it('notifies conflict error message on 409', () => { it('notifies conflict error message on 409', () => {
@ -536,7 +540,7 @@ describe('ContentManagementService', () => {
nodeActions.moveNodes(null).error(new Error(JSON.stringify({ error: { statusCode: 409 } }))); nodeActions.moveNodes(null).error(new Error(JSON.stringify({ error: { statusCode: 409 } })));
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.NODE_MOVE'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.NODE_MOVE');
}); });
it('notifies error if move response has only failed items', () => { it('notifies error if move response has only failed items', () => {
@ -555,7 +559,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(moveResponse); nodeActions.contentMoved.next(moveResponse);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.ERRORS.GENERIC');
}); });
}); });
@ -580,7 +584,7 @@ describe('ContentManagementService', () => {
subject = new Subject<string>(); subject = new Subject<string>();
spyOn(nodeActions, 'moveNodes').and.returnValue(subject); spyOn(nodeActions, 'moveNodes').and.returnValue(subject);
spyOn(snackBar, 'open').and.returnValue({ spyOn(notificationService, 'openSnackMessageAction').and.returnValue({
onAction: () => of(null) onAction: () => of(null)
} as MatSnackBarRef<SimpleSnackBar>); } as MatSnackBarRef<SimpleSnackBar>);
}); });
@ -606,7 +610,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(movedItems); nodeActions.contentMoved.next(movedItems);
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(movedItems.succeeded[0].itemMoved.entry, movedItems.succeeded[0].initialParentId); expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(movedItems.succeeded[0].itemMoved.entry, movedItems.succeeded[0].initialParentId);
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR');
}); });
it('should move node back to initial parent, after succeeded move of a single file', () => { it('should move node back to initial parent, after succeeded move of a single file', () => {
@ -634,7 +638,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(movedItems); nodeActions.contentMoved.next(movedItems);
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(node.entry, initialParent); expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(node.entry, initialParent);
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR');
}); });
it('should restore deleted folder back to initial parent, after succeeded moving all its files', () => { it('should restore deleted folder back to initial parent, after succeeded moving all its files', () => {
@ -666,7 +670,7 @@ describe('ContentManagementService', () => {
nodeActions.contentMoved.next(movedItems); nodeActions.contentMoved.next(movedItems);
expect(contentApi.restoreNode).toHaveBeenCalled(); expect(contentApi.restoreNode).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR'); expect(notificationService.openSnackMessageAction['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR');
}); });
it('should notify when error occurs on Undo Move action', fakeAsync((done) => { it('should notify when error occurs on Undo Move action', fakeAsync((done) => {

View File

@ -56,7 +56,7 @@ import {
NewVersionUploaderData, NewVersionUploaderData,
NewVersionUploaderDataAction NewVersionUploaderDataAction
} from '@alfresco/adf-content-services'; } from '@alfresco/adf-content-services';
import { TranslationService, AlfrescoApiService } from '@alfresco/adf-core'; import { TranslationService, AlfrescoApiService, NotificationService } from '@alfresco/adf-core';
import { import {
DeletedNodesPaging, DeletedNodesPaging,
MinimalNodeEntity, MinimalNodeEntity,
@ -69,7 +69,6 @@ import {
} from '@alfresco/js-api'; } from '@alfresco/js-api';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { forkJoin, Observable, of, zip } from 'rxjs'; import { forkJoin, Observable, of, zip } from 'rxjs';
import { catchError, map, mergeMap, take, tap } from 'rxjs/operators'; import { catchError, map, mergeMap, take, tap } from 'rxjs/operators';
@ -94,7 +93,7 @@ export class ContentManagementService {
private dialogRef: MatDialog, private dialogRef: MatDialog,
private nodeActionsService: NodeActionsService, private nodeActionsService: NodeActionsService,
private translation: TranslationService, private translation: TranslationService,
private snackBar: MatSnackBar, private notificationService: NotificationService,
private nodeAspectService: NodeAspectService, private nodeAspectService: NodeAspectService,
private appHookService: AppHookService, private appHookService: AppHookService,
private newVersionUploaderService: NewVersionUploaderService, private newVersionUploaderService: NewVersionUploaderService,
@ -533,10 +532,9 @@ export class ContentManagementService {
failed: failedItems failed: failedItems
}); });
this.snackBar this.notificationService
.open(message, undo, { .openSnackMessageAction(message, undo, {
panelClass: 'info-snackbar', panelClass: 'info-snackbar'
duration: 3000
}) })
.onAction() .onAction()
.subscribe(() => this.undoCopyNodes(newItems)); .subscribe(() => this.undoCopyNodes(newItems));
@ -670,7 +668,6 @@ export class ContentManagementService {
const message = this.getDeleteMessage(status); const message = this.getDeleteMessage(status);
if (message && status.someSucceeded) { if (message && status.someSucceeded) {
message.duration = 10000;
message.userAction = new SnackbarUserAction('APP.ACTIONS.UNDO', new UndoDeleteNodesAction([...status.success])); message.userAction = new SnackbarUserAction('APP.ACTIONS.UNDO', new UndoDeleteNodesAction([...status.success]));
} }
@ -1069,13 +1066,12 @@ export class ContentManagementService {
}); });
// TODO: review in terms of i18n // TODO: review in terms of i18n
this.snackBar this.notificationService
.open( .openSnackMessageAction(
messages[successMessage] + beforePartialSuccessMessage + messages[partialSuccessMessage] + beforeFailedMessage + messages[failedMessage], messages[successMessage] + beforePartialSuccessMessage + messages[partialSuccessMessage] + beforeFailedMessage + messages[failedMessage],
undo, undo,
{ {
panelClass: 'info-snackbar', panelClass: 'info-snackbar'
duration: 3000
} }
) )
.onAction() .onAction()

View File

@ -485,9 +485,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} not present in source folder`); expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} not present in source folder`);
@ -505,9 +508,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(folderName)).toBe(true, `${folderName} not present in source folder`); expect(await dataTable.isItemPresent(folderName)).toBe(true, `${folderName} not present in source folder`);
@ -529,9 +535,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 2 items'); expect(msg).toContain('Copied 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(items[0])).toBe(true, `${items[0]} not present in source folder`); expect(await dataTable.isItemPresent(items[0])).toBe(true, `${items[0]} not present in source folder`);
@ -551,9 +560,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName}.txt not present in source folder`); expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName}.txt not present in source folder`);
@ -571,9 +583,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(folderName)).toBe(true, `${folderName} not present in source folder`); expect(await dataTable.isItemPresent(folderName)).toBe(true, `${folderName} not present in source folder`);
@ -597,9 +612,12 @@ describe('Copy content', () => {
await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain(`Copied ${noOfItems} ${noOfItems === 1 ? 'item' : 'items'}`); expect(msg).toContain(`Copied ${noOfItems} ${noOfItems === 1 ? 'item' : 'items'}`);
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
for (const item of items) { for (const item of items) {
@ -625,9 +643,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} not present in source folder`); expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} not present in source folder`);
@ -648,9 +669,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await copyDialog.waitForDialogToClose(); await copyDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(folderName)).toBe(true, `${folderName} not present in source folder`); expect(await dataTable.isItemPresent(folderName)).toBe(true, `${folderName} not present in source folder`);
@ -679,9 +703,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
@ -702,9 +729,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
@ -727,9 +757,12 @@ describe('Copy content', () => {
await copyDialog.dataTable.doubleClickOnRowByName(source); await copyDialog.dataTable.doubleClickOnRowByName(source);
await copyDialog.selectDestination(destination); await copyDialog.selectDestination(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await page.clickSnackBarAction(); await page.clickSnackBarAction();
@ -753,9 +786,12 @@ describe('Copy content', () => {
await copyDialog.selectLocation('Personal Files'); await copyDialog.selectLocation('Personal Files');
await copyDialog.dataTable.doubleClickOnRowByName(destination); await copyDialog.dataTable.doubleClickOnRowByName(destination);
await BrowserActions.click(copyDialog.copyButton); await BrowserActions.click(copyDialog.copyButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Copied 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await page.clickSnackBarAction(); await page.clickSnackBarAction();

View File

@ -162,9 +162,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file1)).toBe(false, `${file1} still present in source folder`); expect(await dataTable.isItemPresent(file1)).toBe(false, `${file1} still present in source folder`);
@ -180,9 +183,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(folder1)).toBe(false, `${folder1} still present in source folder`); expect(await dataTable.isItemPresent(folder1)).toBe(false, `${folder1} still present in source folder`);
@ -202,9 +208,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} still present in source folder`); expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} still present in source folder`);
@ -222,9 +231,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(`${existingFile}.txt`)).toBe(true, `${existingFile}.txt not present in source folder`); expect(await dataTable.isItemPresent(`${existingFile}.txt`)).toBe(true, `${existingFile}.txt not present in source folder`);
@ -241,9 +253,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationPF); await moveDialog.selectDestination(destinationPF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(existingFolder)).toBe(false, `${existingFolder} still present in source folder`); expect(await dataTable.isItemPresent(existingFolder)).toBe(false, `${existingFolder} still present in source folder`);
@ -266,9 +281,12 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSitePF); await moveDialog.selectDestination(folderSitePF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} still present in source folder`); expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} still present in source folder`);
@ -317,9 +335,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationRF); await moveDialog.selectDestination(destinationRF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file1, destinationRF)).toBe(true, `${file1} from ${destinationRF} not present`); expect(await dataTable.isItemPresent(file1, destinationRF)).toBe(true, `${file1} from ${destinationRF} not present`);
@ -336,9 +357,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationRF); await moveDialog.selectDestination(destinationRF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file2, destinationRF)).toBe(true, `${file2} from ${destinationRF} not present`); expect(await dataTable.isItemPresent(file2, destinationRF)).toBe(true, `${file2} from ${destinationRF} not present`);
@ -358,9 +382,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationRF); await moveDialog.selectDestination(destinationRF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(existingFile, sourceRF)).toBe(true, `${existingFile} from ${sourceRF} not present`); expect(await dataTable.isItemPresent(existingFile, sourceRF)).toBe(true, `${existingFile} from ${sourceRF} not present`);
@ -380,9 +407,12 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSiteRF); await moveDialog.selectDestination(folderSiteRF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file4, folderSiteRF)).toBe(true, `${file4} from ${folderSiteRF} not present`); expect(await dataTable.isItemPresent(file4, folderSiteRF)).toBe(true, `${file4} from ${folderSiteRF} not present`);
@ -441,9 +471,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationSF); await moveDialog.selectDestination(destinationSF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file1, destinationSF)).toBe(true, `${file1} from ${destinationSF} not present`); expect(await dataTable.isItemPresent(file1, destinationSF)).toBe(true, `${file1} from ${destinationSF} not present`);
@ -460,9 +493,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationSF); await moveDialog.selectDestination(destinationSF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file2, destinationSF)).toBe(true, `${file2} from ${destinationSF} not present`); expect(await dataTable.isItemPresent(file2, destinationSF)).toBe(true, `${file2} from ${destinationSF} not present`);
@ -482,9 +518,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationSF); await moveDialog.selectDestination(destinationSF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(existingFile, sourceSF)).toBe(true, `${existingFile} from ${sourceSF} not present`); expect(await dataTable.isItemPresent(existingFile, sourceSF)).toBe(true, `${existingFile} from ${sourceSF} not present`);
@ -504,9 +543,12 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSiteSF); await moveDialog.selectDestination(folderSiteSF);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file4, folderSiteSF)).toBe(true, `${file4} from ${folderSiteSF} not present`); expect(await dataTable.isItemPresent(file4, folderSiteSF)).toBe(true, `${file4} from ${folderSiteSF} not present`);
@ -591,9 +633,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file1, destinationFav)).toBe(true, `${file1} from ${destinationFav} not present`); expect(await dataTable.isItemPresent(file1, destinationFav)).toBe(true, `${file1} from ${destinationFav} not present`);
@ -610,9 +655,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(folder1, sourceFav)).toBe(false, `${folder1} from ${sourceFav} is present`); expect(await dataTable.isItemPresent(folder1, sourceFav)).toBe(false, `${folder1} from ${sourceFav} is present`);
@ -633,9 +681,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file2, destinationFav)).toBe(true, `${file2} from ${destinationFav} not present`); expect(await dataTable.isItemPresent(file2, destinationFav)).toBe(true, `${file2} from ${destinationFav} not present`);
@ -655,9 +706,12 @@ describe('Move content', () => {
await moveDialog.selectLocation('Personal Files'); await moveDialog.selectLocation('Personal Files');
await moveDialog.selectDestination(destinationFav); await moveDialog.selectDestination(destinationFav);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).toContain('Move unsuccessful, a file with the same name already exists');
expect(msg).not.toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(existingFile, sourceFav)).toBe(true, `${existingFile} from ${sourceFav} not present`); expect(await dataTable.isItemPresent(existingFile, sourceFav)).toBe(true, `${existingFile} from ${sourceFav} not present`);
@ -677,7 +731,8 @@ describe('Move content', () => {
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Moved 1 item');
expect(msg).toContain('Undo'); const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(existingFolder, sourceFav)).toBe(false, `${existingFolder} from ${sourceFav} is present`); expect(await dataTable.isItemPresent(existingFolder, sourceFav)).toBe(false, `${existingFolder} from ${sourceFav} is present`);
@ -699,9 +754,12 @@ describe('Move content', () => {
await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary');
await moveDialog.selectDestination(folderSiteFav); await moveDialog.selectDestination(folderSiteFav);
await BrowserActions.click(moveDialog.moveButton); await BrowserActions.click(moveDialog.moveButton);
const msg = await page.getSnackBarMessage(); const msg = await page.getSnackBarMessage();
expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Moved 2 items');
expect(msg).toContain('Undo');
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
await moveDialog.waitForDialogToClose(); await moveDialog.waitForDialogToClose();
expect(await dataTable.isItemPresent(file4, folderSiteFav)).toBe(true, `${file4} from ${folderSiteFav} not present`); expect(await dataTable.isItemPresent(file4, folderSiteFav)).toBe(true, `${file4} from ${folderSiteFav} not present`);

View File

@ -96,9 +96,13 @@ describe('Delete and undo delete', () => {
it('[C280528] delete a file and check notification', async () => { it('[C280528] delete a file and check notification', async () => {
await dataTable.selectItem(recentFile1, parent); await dataTable.selectItem(recentFile1, parent);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${recentFile1} deleted`); expect(message).toContain(`${recentFile1} deleted`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(recentFile1)).toBe(false, `${recentFile1} was not removed from list`); expect(await dataTable.isItemPresent(recentFile1)).toBe(false, `${recentFile1} was not removed from list`);
await page.clickTrashAndWait(); await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(recentFile1)).toBe(true, `${recentFile1} is not in trash`); expect(await dataTable.isItemPresent(recentFile1)).toBe(true, `${recentFile1} is not in trash`);
@ -107,9 +111,13 @@ describe('Delete and undo delete', () => {
it('[C280529] delete multiple files and check notification', async () => { it('[C280529] delete multiple files and check notification', async () => {
await dataTable.selectMultipleItems([recentFile2, recentFile3], parent); await dataTable.selectMultipleItems([recentFile2, recentFile3], parent);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(recentFile2)).toBe(false, `${recentFile2} was not removed from list`); expect(await dataTable.isItemPresent(recentFile2)).toBe(false, `${recentFile2} was not removed from list`);
expect(await dataTable.isItemPresent(recentFile3)).toBe(false, `${recentFile3} was not removed from list`); expect(await dataTable.isItemPresent(recentFile3)).toBe(false, `${recentFile3} was not removed from list`);
await page.clickTrashAndWait(); await page.clickTrashAndWait();
@ -236,9 +244,13 @@ describe('Delete and undo delete', () => {
let items = await page.dataTable.getRowsCount(); let items = await page.dataTable.getRowsCount();
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${file1} deleted`); expect(message).toContain(`${file1} deleted`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(file1)).toBe(false, `${file1} was not removed from list`); expect(await dataTable.isItemPresent(file1)).toBe(false, `${file1} was not removed from list`);
items--; items--;
expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`);
@ -276,9 +288,13 @@ describe('Delete and undo delete', () => {
it('[C217127] delete a folder containing locked files', async () => { it('[C217127] delete a folder containing locked files', async () => {
await dataTable.selectItem(folder2); await dataTable.selectItem(folder2);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${folder2} couldn't be deleted`); expect(message).toContain(`${folder2} couldn't be deleted`);
expect(message).not.toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
expect(await dataTable.isItemPresent(folder2)).toBe(true, `${folder2} was removed from list`); expect(await dataTable.isItemPresent(folder2)).toBe(true, `${folder2} was removed from list`);
await page.clickTrash(); await page.clickTrash();
expect(await dataTable.isItemPresent(folder2)).toBe(false, `${folder2} is in trash`); expect(await dataTable.isItemPresent(folder2)).toBe(false, `${folder2} is in trash`);
@ -288,17 +304,23 @@ describe('Delete and undo delete', () => {
it('[C217129] notification on multiple items deletion - some items fail to delete', async () => { it('[C217129] notification on multiple items deletion - some items fail to delete', async () => {
await dataTable.selectMultipleItems([file4, folder3]); await dataTable.selectMultipleItems([file4, folder3]);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 1 item, 1 couldn't be deleted`); expect(message).toContain(`Deleted 1 item, 1 couldn't be deleted`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
}); });
it('[C217130] notification on multiple items deletion - all items fail to delete', async () => { it('[C217130] notification on multiple items deletion - all items fail to delete', async () => {
await dataTable.selectMultipleItems([folder4, folder5]); await dataTable.selectMultipleItems([folder4, folder5]);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toEqual(`2 items couldn't be deleted`); expect(message).toEqual(`2 items couldn't be deleted`);
expect(message).not.toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
}); });
it('[C217132] undo delete of file', async () => { it('[C217132] undo delete of file', async () => {
@ -388,9 +410,13 @@ describe('Delete and undo delete', () => {
it('[C280316] delete a file and check notification', async () => { it('[C280316] delete a file and check notification', async () => {
await dataTable.selectItem(sharedFile1); await dataTable.selectItem(sharedFile1);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${sharedFile1} deleted`); expect(message).toContain(`${sharedFile1} deleted`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(sharedFile1)).toBe(false, `${sharedFile1} was not removed from list`); expect(await dataTable.isItemPresent(sharedFile1)).toBe(false, `${sharedFile1} was not removed from list`);
await page.clickTrashAndWait(); await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(sharedFile1)).toBe(true, `${sharedFile1} is not in trash`); expect(await dataTable.isItemPresent(sharedFile1)).toBe(true, `${sharedFile1} is not in trash`);
@ -399,9 +425,13 @@ describe('Delete and undo delete', () => {
it('[C280513] delete multiple files and check notification', async () => { it('[C280513] delete multiple files and check notification', async () => {
await dataTable.selectMultipleItems([sharedFile2, sharedFile3]); await dataTable.selectMultipleItems([sharedFile2, sharedFile3]);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(sharedFile2)).toBe(false, `${sharedFile2} was not removed from list`); expect(await dataTable.isItemPresent(sharedFile2)).toBe(false, `${sharedFile2} was not removed from list`);
expect(await dataTable.isItemPresent(sharedFile3)).toBe(false, `${sharedFile3} was not removed from list`); expect(await dataTable.isItemPresent(sharedFile3)).toBe(false, `${sharedFile3} was not removed from list`);
await page.clickTrashAndWait(); await page.clickTrashAndWait();
@ -534,9 +564,13 @@ describe('Delete and undo delete', () => {
it('[C280516] delete a file and check notification', async () => { it('[C280516] delete a file and check notification', async () => {
await dataTable.selectItem(favFile1); await dataTable.selectItem(favFile1);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`${favFile1} deleted`); expect(message).toContain(`${favFile1} deleted`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(favFile1)).toBe(false, `${favFile1} was not removed from list`); expect(await dataTable.isItemPresent(favFile1)).toBe(false, `${favFile1} was not removed from list`);
await page.clickTrashAndWait(); await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(favFile1)).toBe(true, `${favFile1} is not in trash`); expect(await dataTable.isItemPresent(favFile1)).toBe(true, `${favFile1} is not in trash`);
@ -545,9 +579,13 @@ describe('Delete and undo delete', () => {
it('[C280517] delete multiple files and check notification', async () => { it('[C280517] delete multiple files and check notification', async () => {
await dataTable.selectMultipleItems([favFile2, favFile3], parent); await dataTable.selectMultipleItems([favFile2, favFile3], parent);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
expect(await dataTable.isItemPresent(favFile2)).toBe(false, `${favFile2} was not removed from list`); expect(await dataTable.isItemPresent(favFile2)).toBe(false, `${favFile2} was not removed from list`);
expect(await dataTable.isItemPresent(favFile3)).toBe(false, `${favFile3} was not removed from list`); expect(await dataTable.isItemPresent(favFile3)).toBe(false, `${favFile3} was not removed from list`);
await page.clickTrashAndWait(); await page.clickTrashAndWait();
@ -579,17 +617,23 @@ describe('Delete and undo delete', () => {
it('[C280520] notification on multiple items deletion - some items fail to delete', async () => { it('[C280520] notification on multiple items deletion - some items fail to delete', async () => {
await dataTable.selectMultipleItems([favFile4, favFolder3], parent); await dataTable.selectMultipleItems([favFile4, favFolder3], parent);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 1 item, 1 couldn't be deleted`); expect(message).toContain(`Deleted 1 item, 1 couldn't be deleted`);
expect(message).toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).toContain('Undo');
}); });
it('[C280521] notification on multiple items deletion - all items fail to delete', async () => { it('[C280521] notification on multiple items deletion - all items fail to delete', async () => {
await dataTable.selectMultipleItems([favFolder4, favFolder5], parent); await dataTable.selectMultipleItems([favFolder4, favFolder5], parent);
await toolbar.clickMoreActionsDelete(); await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage(); const message = await page.getSnackBarMessage();
expect(message).toEqual(`2 items couldn't be deleted`); expect(message).toEqual(`2 items couldn't be deleted`);
expect(message).not.toContain(`Undo`);
const action = await page.getSnackBarAction();
expect(action).not.toContain('Undo');
}); });
it('[C280524] undo delete of file', async () => { it('[C280524] undo delete of file', async () => {

View File

@ -79,9 +79,13 @@ describe('Restore from Trash', () => {
it('[C217177] restore file', async () => { it('[C217177] restore file', async () => {
await dataTable.selectItem(file); await dataTable.selectItem(file);
await BrowserActions.click(toolbar.restoreButton); await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`${file} restored`); expect(text).toContain(`${file} restored`);
expect(text).toContain(`View`);
const action = await page.getSnackBarAction();
expect(action).toContain('View');
expect(await dataTable.isItemPresent(file)).toBe(false, 'Item was not removed from list'); expect(await dataTable.isItemPresent(file)).toBe(false, 'Item was not removed from list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
expect(await page.dataTable.isItemPresent(file)).toBe(true, 'Item not displayed in list'); expect(await page.dataTable.isItemPresent(file)).toBe(true, 'Item not displayed in list');
@ -92,9 +96,13 @@ describe('Restore from Trash', () => {
it('[C280438] restore folder', async () => { it('[C280438] restore folder', async () => {
await dataTable.selectItem(folder); await dataTable.selectItem(folder);
await BrowserActions.click(toolbar.restoreButton); await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`${folder} restored`); expect(text).toContain(`${folder} restored`);
expect(text).toContain(`View`);
const action = await page.getSnackBarAction();
expect(action).toContain('View');
expect(await dataTable.isItemPresent(folder)).toBe(false, 'Item was not removed from list'); expect(await dataTable.isItemPresent(folder)).toBe(false, 'Item was not removed from list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
expect(await page.dataTable.isItemPresent(folder)).toBe(true, 'Item not displayed in list'); expect(await page.dataTable.isItemPresent(folder)).toBe(true, 'Item not displayed in list');
@ -105,9 +113,13 @@ describe('Restore from Trash', () => {
it('[C290104] restore library', async () => { it('[C290104] restore library', async () => {
await dataTable.selectItem(site); await dataTable.selectItem(site);
await BrowserActions.click(toolbar.restoreButton); await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`${site} restored`); expect(text).toContain(`${site} restored`);
expect(text).toContain(`View`);
const action = await page.getSnackBarAction();
expect(action).toContain('View');
expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not removed from list`); expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not removed from list`);
await page.clickFileLibrariesAndWait(); await page.clickFileLibrariesAndWait();
expect(await page.dataTable.isItemPresent(site)).toBe(true, `${site} not displayed in list`); expect(await page.dataTable.isItemPresent(site)).toBe(true, `${site} not displayed in list`);
@ -116,9 +128,13 @@ describe('Restore from Trash', () => {
it('[C217182] restore multiple items', async () => { it('[C217182] restore multiple items', async () => {
await dataTable.selectMultipleItems([file, folder]); await dataTable.selectMultipleItems([file, folder]);
await BrowserActions.click(toolbar.restoreButton); await BrowserActions.click(toolbar.restoreButton);
const text = await page.getSnackBarMessage(); const text = await page.getSnackBarMessage();
expect(text).toContain(`Restore successful`); expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`);
const action = await page.getSnackBarAction();
expect(action).not.toContain('View');
expect(await dataTable.isItemPresent(file)).toBe(false, 'Item was not removed from list'); expect(await dataTable.isItemPresent(file)).toBe(false, 'Item was not removed from list');
expect(await dataTable.isItemPresent(folder)).toBe(false, 'Item was not removed from list'); expect(await dataTable.isItemPresent(folder)).toBe(false, 'Item was not removed from list');
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();

102
package-lock.json generated
View File

@ -11,12 +11,12 @@
"dev": true "dev": true
}, },
"@alfresco/adf-cli": { "@alfresco/adf-cli": {
"version": "5.2.0-36943", "version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-5.2.0-36943.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-5.2.0-36995.tgz",
"integrity": "sha512-93BmkPp/2tfLKwr5YSMMci+/rsi4+wsSiBGtssfpqG+TwVLttY5wzBUgkrhwzdSmSj1hCX/xpryTJr5hDj7iwQ==", "integrity": "sha512-uOn1EecgqmIkmnDtbiQ/rEAmmDdYiErDgsmDNbHXKbltx7hGQsWbYTW18DclYvbQmtyzNpadywHoxnTsqPjHgg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@alfresco/js-api": "5.2.0-409", "@alfresco/js-api": "5.2.0-417",
"commander": "6.2.1", "commander": "6.2.1",
"ejs": "^2.6.1", "ejs": "^2.6.1",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
@ -25,20 +25,52 @@
"rxjs": "^6.5.5", "rxjs": "^6.5.5",
"shelljs": "^0.8.3", "shelljs": "^0.8.3",
"spdx-license-list": "^5.0.0" "spdx-license-list": "^5.0.0"
},
"dependencies": {
"@alfresco/js-api": {
"version": "5.2.0-417",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.2.0-417.tgz",
"integrity": "sha512-UxTzCkH5KF749ZC4vYmK9OYrGT7iudirgmoc2W3Av6o/oUAfKAFfzT2BvyKao9N2TiA2//GN/5eC5LYi7PtRIQ==",
"dev": true,
"requires": {
"event-emitter": "^0.3.5",
"minimatch": "5.0.1",
"superagent": "^6.0.0",
"tslib": "^2.0.0"
}
},
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
"dev": true,
"requires": {
"brace-expansion": "^2.0.1"
}
}
} }
}, },
"@alfresco/adf-content-services": { "@alfresco/adf-content-services": {
"version": "5.2.0-36943", "version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-5.2.0-36943.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-5.2.0-36995.tgz",
"integrity": "sha512-uRSKGs0Ei8m2LCnh08YcbeE6OuWo5YxpEf21iDl2y/ziZjyR+djbaqTOZl3BqfBWGCZ3RXGTgAgum1DyIkByHw==", "integrity": "sha512-77hXGHTNm/GzjUNsAahja56tZJ+rOelmrYZkVhQfWAOavfB0WRMrErtLWoFpICbuAGzCmg5lLEO/O1HaJp3QkA==",
"requires": { "requires": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
} }
}, },
"@alfresco/adf-core": { "@alfresco/adf-core": {
"version": "5.2.0-36943", "version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-5.2.0-36943.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-5.2.0-36995.tgz",
"integrity": "sha512-SKHk8hrGluO3WCdQXUuLcdiW1qdtLcEfMEn/ZIMsqBHcaquF6R1PgmeMpZu3+agAG7uussH9txvpRX6jKTXMpA==", "integrity": "sha512-nL7n0QK/KW9rZBD+YJRdprCGDQKr6rO2ICSMC69Zema140nmC0THcA+Yi9cmXOa0Irx10pKXL6zeJOvCrf1BrQ==",
"requires": { "requires": {
"@editorjs/code": "2.7.0", "@editorjs/code": "2.7.0",
"@editorjs/editorjs": "2.25.0", "@editorjs/editorjs": "2.25.0",
@ -56,20 +88,20 @@
} }
}, },
"@alfresco/adf-extensions": { "@alfresco/adf-extensions": {
"version": "5.2.0-36943", "version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-5.2.0-36943.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-5.2.0-36995.tgz",
"integrity": "sha512-PoxNEEYpRxM1O75nSL5osaR9T4tEbFmKGhQRSSA5Iyyb9yNrZ18MaLWX4Ifg2GWsR2GXOCExhrlqnasGSYGUKg==", "integrity": "sha512-58CxcIx+zWzDtYOgS4O37sjmPV5MLLTsLQ2BZQSxShSjGlRXheKfVNwSdY6yt0ROkLnpdIYOh8rRJMfJsWDZ0Q==",
"requires": { "requires": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
} }
}, },
"@alfresco/adf-testing": { "@alfresco/adf-testing": {
"version": "5.2.0-36943", "version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-5.2.0-36943.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-5.2.0-36995.tgz",
"integrity": "sha512-3uzPt7Zu07QpD7oXS8zjiEU9LKVhSi0Eb2xObzB3+cKuUb8wbmryQYd628vAu0s2lAvIu8QW2xOKxflJAG2M2Q==", "integrity": "sha512-5lPwqfZjGHSM402PeNgA4lWxwIiJmOkLuyFWgwur+6IAe5ulDbMiFyQ3y18OXpQ0kf7VTnY1oomX7BR6C45Tfg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@alfresco/js-api": "5.2.0-409", "@alfresco/js-api": "5.2.0-417",
"@angular/compiler": "14.1.3", "@angular/compiler": "14.1.3",
"@angular/core": "14.1.3", "@angular/core": "14.1.3",
"rxjs": "6.6.6", "rxjs": "6.6.6",
@ -77,6 +109,18 @@
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
"dependencies": { "dependencies": {
"@alfresco/js-api": {
"version": "5.2.0-417",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.2.0-417.tgz",
"integrity": "sha512-UxTzCkH5KF749ZC4vYmK9OYrGT7iudirgmoc2W3Av6o/oUAfKAFfzT2BvyKao9N2TiA2//GN/5eC5LYi7PtRIQ==",
"dev": true,
"requires": {
"event-emitter": "^0.3.5",
"minimatch": "5.0.1",
"superagent": "^6.0.0",
"tslib": "^2.0.0"
}
},
"@angular/compiler": { "@angular/compiler": {
"version": "14.1.3", "version": "14.1.3",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-14.1.3.tgz", "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-14.1.3.tgz",
@ -94,13 +138,31 @@
"requires": { "requires": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
} }
},
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
"dev": true,
"requires": {
"brace-expansion": "^2.0.1"
}
} }
} }
}, },
"@alfresco/js-api": { "@alfresco/js-api": {
"version": "5.2.0-409", "version": "5.2.0-417",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.2.0-409.tgz", "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.2.0-417.tgz",
"integrity": "sha512-10GpjlJhs+rhBRXoBT6xxEFRhUNBd6+NFNK/7Q6eQHcAEctZYy9D0VuBYxTaK+TKumaG8KcRSlQNbTNobbByug==", "integrity": "sha512-UxTzCkH5KF749ZC4vYmK9OYrGT7iudirgmoc2W3Av6o/oUAfKAFfzT2BvyKao9N2TiA2//GN/5eC5LYi7PtRIQ==",
"requires": { "requires": {
"event-emitter": "^0.3.5", "event-emitter": "^0.3.5",
"minimatch": "5.0.1", "minimatch": "5.0.1",

View File

@ -25,10 +25,10 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "5.2.0-36943", "@alfresco/adf-content-services": "5.2.0-36995",
"@alfresco/adf-core": "5.2.0-36943", "@alfresco/adf-core": "5.2.0-36995",
"@alfresco/adf-extensions": "5.2.0-36943", "@alfresco/adf-extensions": "5.2.0-36995",
"@alfresco/js-api": "5.2.0-409", "@alfresco/js-api": "5.2.0-417",
"@angular/animations": "14.1.2", "@angular/animations": "14.1.2",
"@angular/cdk": "14.1.2", "@angular/cdk": "14.1.2",
"@angular/common": "14.1.2", "@angular/common": "14.1.2",
@ -57,8 +57,8 @@
"zone.js": "0.11.8" "zone.js": "0.11.8"
}, },
"devDependencies": { "devDependencies": {
"@alfresco/adf-cli": "5.2.0-36943", "@alfresco/adf-cli": "5.2.0-36995",
"@alfresco/adf-testing": "5.2.0-36943", "@alfresco/adf-testing": "5.2.0-36995",
"@angular-custom-builders/lite-serve": "^0.2.3", "@angular-custom-builders/lite-serve": "^0.2.3",
"@angular-devkit/build-angular": "14.1.2", "@angular-devkit/build-angular": "14.1.2",
"@angular-eslint/builder": "^14.1.2", "@angular-eslint/builder": "^14.1.2",

View File

@ -1,5 +1,29 @@
<aca-page-layout> <aca-page-layout>
<aca-page-layout-content [scrollable]="true"> <aca-page-layout-content [scrollable]="true">
<adf-about [dev]="dev" [pkg]="pkg"> </adf-about> <adf-about>
<adf-about-panel *ngIf="dev" [label]="'ABOUT.SERVER_SETTINGS.TITLE' | translate">
<ng-template>
<adf-about-server-settings></adf-about-server-settings>
</ng-template>
</adf-about-panel>
<adf-about-panel [label]="'ABOUT.REPOSITORY' | translate" *ngIf="repository">
<ng-template>
<adf-about-repository-info [data]="repository"></adf-about-repository-info>
</ng-template>
</adf-about-panel>
<adf-about-panel *ngIf="dev" [label]="'ABOUT.PACKAGES.TITLE' | translate">
<ng-template>
<adf-about-package-list [dependencies]="pkg?.dependencies"></adf-about-package-list>
</ng-template>
</adf-about-panel>
<adf-about-panel *ngIf="extensions$ | async as extensions" [label]="'ABOUT.PLUGINS.TITLE' | translate">
<ng-template>
<adf-about-extension-list [data]="extensions"></adf-about-extension-list>
</ng-template>
</adf-about-panel>
</adf-about>
</aca-page-layout-content> </aca-page-layout-content>
</aca-page-layout> </aca-page-layout>

View File

@ -23,21 +23,44 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { Component, Inject } from '@angular/core'; import { Component, Inject, OnInit } from '@angular/core';
import { DEV_MODE_TOKEN } from './dev-mode.tokens'; import { DEV_MODE_TOKEN } from './dev-mode.tokens';
import pkg from 'package.json'; import pkg from 'package.json';
import { Observable } from 'rxjs';
import { AppExtensionService, ExtensionRef } from '@alfresco/adf-extensions';
import { AuthenticationService, DiscoveryApiService, RepositoryInfo } from '@alfresco/adf-core';
@Component({ @Component({
selector: 'app-about-page', selector: 'app-about-page',
templateUrl: './about.component.html', templateUrl: './about.component.html',
styleUrls: ['./about.component.scss'] styleUrls: ['./about.component.scss']
}) })
export class AboutComponent { export class AboutComponent implements OnInit {
pkg: any; pkg: any;
dev = false; dev = false;
extensions$: Observable<ExtensionRef[]>;
repository: RepositoryInfo = null;
constructor(@Inject(DEV_MODE_TOKEN) devMode) { constructor(
@Inject(DEV_MODE_TOKEN) devMode,
private authService: AuthenticationService,
private appExtensions: AppExtensionService,
private discovery: DiscoveryApiService
) {
this.dev = !devMode; this.dev = !devMode;
this.pkg = pkg; this.pkg = pkg;
this.extensions$ = this.appExtensions.references$;
}
ngOnInit(): void {
if (this.authService.isEcmLoggedIn()) {
this.setECMInfo();
}
}
setECMInfo() {
this.discovery.getEcmProductInfo().subscribe((repository) => {
this.repository = repository as RepositoryInfo;
});
} }
} }

View File

@ -35,7 +35,7 @@ export interface SnackbarAction extends Action {
payload: string; payload: string;
params?: any; params?: any;
userAction?: SnackbarUserAction; userAction?: SnackbarUserAction;
duration: number; duration?: number;
} }
export class SnackbarUserAction { export class SnackbarUserAction {
@ -46,7 +46,6 @@ export class SnackbarInfoAction implements SnackbarAction {
readonly type = SnackbarActionTypes.Info; readonly type = SnackbarActionTypes.Info;
userAction?: SnackbarUserAction; userAction?: SnackbarUserAction;
duration = 4000;
constructor(public payload: string, public params?: any) {} constructor(public payload: string, public params?: any) {}
} }
@ -55,7 +54,6 @@ export class SnackbarWarningAction implements SnackbarAction {
readonly type = SnackbarActionTypes.Warning; readonly type = SnackbarActionTypes.Warning;
userAction?: SnackbarUserAction; userAction?: SnackbarUserAction;
duration = 4000;
constructor(public payload: string, public params?: any) {} constructor(public payload: string, public params?: any) {}
} }
@ -64,7 +62,6 @@ export class SnackbarErrorAction implements SnackbarAction {
readonly type = SnackbarActionTypes.Error; readonly type = SnackbarActionTypes.Error;
userAction?: SnackbarUserAction; userAction?: SnackbarUserAction;
duration = 4000;
constructor(public payload: string, public params?: any) {} constructor(public payload: string, public params?: any) {}
} }

View File

@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { TranslationService } from '@alfresco/adf-core'; import { SnackbarContentComponent, SnackBarData, TranslationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { Actions, ofType, createEffect } from '@ngrx/effects'; import { Actions, ofType, createEffect } from '@ngrx/effects';
@ -81,10 +81,17 @@ export class SnackbarEffects {
if (action.userAction) { if (action.userAction) {
actionName = this.translate(action.userAction.title); actionName = this.translate(action.userAction.title);
} }
const snackBarRef = this.snackBar.openFromComponent<SnackbarContentComponent, SnackBarData>(SnackbarContentComponent, {
const snackBarRef = this.snackBar.open(message, actionName, { ...(action.duration !== undefined && action.duration !== null && { duration: action.duration }),
duration: action.duration || 4000, panelClass,
panelClass data: {
message,
actionLabel: actionName,
actionIcon: 'close',
actionIconAriaLabel: 'CLOSE',
showAction: true,
callActionOnIconClick: false
}
}); });
if (action.userAction) { if (action.userAction) {

View File

@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, by, ElementFinder } from 'protractor'; import { browser, by, ElementFinder, WebElement } from 'protractor';
import { BrowserVisibility, Logger } from '@alfresco/adf-testing'; import { BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { APP_ROUTES, USE_HASH_STRATEGY } from './../configs'; import { APP_ROUTES, USE_HASH_STRATEGY } from './../configs';
import { Utils, waitElement, waitForPresence, isPresentAndDisplayed } from '../utilities/utils'; import { Utils, waitElement, waitForPresence, isPresentAndDisplayed } from '../utilities/utils';
@ -35,10 +35,10 @@ export abstract class Page {
layout = this.byCss('app-layout'); layout = this.byCss('app-layout');
overlay = this.byCss('.cdk-overlay-container'); overlay = this.byCss('.cdk-overlay-container');
snackBar = this.byCss('.mat-simple-snackbar-action button'); snackBar = this.byCss('.adf-snackbar-message-content-action-label');
dialogContainer = this.byCss('.mat-dialog-container'); dialogContainer = this.byCss('.mat-dialog-container');
snackBarContainer = this.byCss('.mat-snack-bar-container'); snackBarContainer = this.byCss('.mat-snack-bar-container');
snackBarAction = this.byCss('.mat-simple-snackbar-action button'); snackBarAction = this.byCss('.adf-snackbar-message-content-action-label');
genericError = this.byCss('aca-generic-error'); genericError = this.byCss('aca-generic-error');
genericErrorIcon = this.byCss('aca-generic-error .mat-icon'); genericErrorIcon = this.byCss('aca-generic-error .mat-icon');
genericErrorTitle = this.byCss('.generic-error__title'); genericErrorTitle = this.byCss('.generic-error__title');
@ -88,14 +88,25 @@ export abstract class Page {
} }
async getSnackBarMessage(): Promise<string> { async getSnackBarMessage(): Promise<string> {
const elem = await waitElement('.mat-snack-bar-container'); const elem = await waitElement('.adf-snackbar-message-content');
const attributeValue: string = await browser.executeScript(`return arguments[0].innerText`, elem);
return attributeValue || '';
}
async getSnackBarAction(): Promise<string> {
let elem: WebElement;
try {
elem = await waitElement('.adf-snackbar-message-content-action-label');
} catch (e) {
return '';
}
const attributeValue: string = await browser.executeScript(`return arguments[0].innerText`, elem); const attributeValue: string = await browser.executeScript(`return arguments[0].innerText`, elem);
return attributeValue || ''; return attributeValue || '';
} }
async clickSnackBarAction(): Promise<void> { async clickSnackBarAction(): Promise<void> {
try { try {
const action = await waitElement('.mat-simple-snackbar-action button'); const action = await waitElement('.adf-snackbar-message-content-action-label');
await action.click(); await action.click();
} catch (e) { } catch (e) {
Logger.error(e, '.......failed on click snack bar action.........'); Logger.error(e, '.......failed on click snack bar action.........');