[ACS-3640] Reverting reverted changes for a 11 y aca 881740 snackbar messages disappear without option to adjust timing (#2785)

* 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

* ACS-3640 Correction for e2e

* ACS-3640 Reverting reverted corrections for e2e

* ACS-3640 Use data automation id

* ACS-3640 Update ADF version
This commit is contained in:
AleksanderSklorz 2022-11-21 10:48:22 +01:00 committed by GitHub
parent 26b2b23a42
commit ae551f03fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 27265 additions and 210 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

@ -487,7 +487,8 @@ describe('Copy content', () => {
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`);
@ -507,7 +508,8 @@ describe('Copy content', () => {
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`);
@ -531,7 +533,8 @@ describe('Copy content', () => {
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`);
@ -553,7 +556,8 @@ describe('Copy content', () => {
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`);
@ -573,7 +577,8 @@ describe('Copy content', () => {
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`);
@ -599,7 +604,8 @@ describe('Copy content', () => {
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) {
@ -627,7 +633,8 @@ describe('Copy content', () => {
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`);
@ -650,7 +657,8 @@ describe('Copy content', () => {
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`);
@ -681,7 +689,8 @@ describe('Copy content', () => {
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();
@ -704,7 +713,8 @@ describe('Copy content', () => {
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();
@ -729,7 +739,8 @@ describe('Copy content', () => {
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();
@ -755,7 +766,8 @@ describe('Copy content', () => {
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

@ -164,7 +164,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(file1)).toBe(false, `${file1} still present in source folder`); expect(await dataTable.isItemPresent(file1)).toBe(false, `${file1} still present in source folder`);
@ -182,7 +183,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(folder1)).toBe(false, `${folder1} still present in source folder`); expect(await dataTable.isItemPresent(folder1)).toBe(false, `${folder1} still present in source folder`);
@ -204,7 +206,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 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`);
@ -224,7 +227,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('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`);
@ -243,7 +247,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)).toBe(false, `${existingFolder} still present in source folder`); expect(await dataTable.isItemPresent(existingFolder)).toBe(false, `${existingFolder} still present in source folder`);
@ -268,7 +273,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 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`);
@ -319,7 +325,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(file1, destinationRF)).toBe(true, `${file1} from ${destinationRF} not present`); expect(await dataTable.isItemPresent(file1, destinationRF)).toBe(true, `${file1} from ${destinationRF} not present`);
@ -338,7 +345,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 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`);
@ -360,7 +368,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('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`);
@ -382,7 +391,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(file4, folderSiteRF)).toBe(true, `${file4} from ${folderSiteRF} not present`); expect(await dataTable.isItemPresent(file4, folderSiteRF)).toBe(true, `${file4} from ${folderSiteRF} not present`);
@ -443,7 +453,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(file1, destinationSF)).toBe(true, `${file1} from ${destinationSF} not present`); expect(await dataTable.isItemPresent(file1, destinationSF)).toBe(true, `${file1} from ${destinationSF} not present`);
@ -462,7 +473,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 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`);
@ -484,7 +496,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('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`);
@ -506,7 +519,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(file4, folderSiteSF)).toBe(true, `${file4} from ${folderSiteSF} not present`); expect(await dataTable.isItemPresent(file4, folderSiteSF)).toBe(true, `${file4} from ${folderSiteSF} not present`);
@ -593,7 +607,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(file1, destinationFav)).toBe(true, `${file1} from ${destinationFav} not present`); expect(await dataTable.isItemPresent(file1, destinationFav)).toBe(true, `${file1} from ${destinationFav} not present`);
@ -612,7 +627,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(folder1, sourceFav)).toBe(false, `${folder1} from ${sourceFav} is present`); expect(await dataTable.isItemPresent(folder1, sourceFav)).toBe(false, `${folder1} from ${sourceFav} is present`);
@ -635,7 +651,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 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`);
@ -657,7 +674,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('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 +695,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`);
@ -701,7 +720,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 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

@ -98,7 +98,8 @@ describe('Delete and undo delete', () => {
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`);
@ -109,7 +110,8 @@ describe('Delete and undo delete', () => {
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();
@ -238,7 +240,8 @@ describe('Delete and undo delete', () => {
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}`);
@ -278,7 +281,8 @@ describe('Delete and undo delete', () => {
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`);
@ -290,7 +294,8 @@ describe('Delete and undo delete', () => {
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 () => {
@ -298,7 +303,8 @@ describe('Delete and undo delete', () => {
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 () => {
@ -390,7 +396,8 @@ describe('Delete and undo delete', () => {
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`);
@ -401,7 +408,8 @@ describe('Delete and undo delete', () => {
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();
@ -536,7 +544,8 @@ describe('Delete and undo delete', () => {
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`);
@ -547,7 +556,8 @@ describe('Delete and undo delete', () => {
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();
@ -581,7 +591,8 @@ describe('Delete and undo delete', () => {
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 () => {
@ -589,7 +600,8 @@ describe('Delete and undo delete', () => {
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

@ -81,7 +81,8 @@ describe('Restore from Trash', () => {
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');
@ -94,7 +95,8 @@ describe('Restore from Trash', () => {
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');
@ -107,7 +109,8 @@ describe('Restore from Trash', () => {
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`);
@ -118,7 +121,8 @@ describe('Restore from Trash', () => {
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();

27182
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,9 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "5.2.0-37070", "@alfresco/adf-content-services": "5.2.0-37090",
"@alfresco/adf-core": "5.2.0-37070", "@alfresco/adf-core": "5.2.0-37090",
"@alfresco/adf-extensions": "5.2.0-37070", "@alfresco/adf-extensions": "5.2.0-37090",
"@alfresco/js-api": "5.2.0-423", "@alfresco/js-api": "5.2.0-423",
"@angular/animations": "14.1.2", "@angular/animations": "14.1.2",
"@angular/cdk": "14.1.2", "@angular/cdk": "14.1.2",
@ -58,8 +58,8 @@
"zone.js": "0.11.8" "zone.js": "0.11.8"
}, },
"devDependencies": { "devDependencies": {
"@alfresco/adf-cli": "5.2.0-37070", "@alfresco/adf-cli": "5.2.0-37090",
"@alfresco/adf-testing": "5.2.0-37070", "@alfresco/adf-testing": "5.2.0-37090",
"@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

@ -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(`[data-automation-id='adf-snackbar-message-content-action-button']`);
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(`[data-automation-id='adf-snackbar-message-content-action-button']`);
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(`[data-automation-id='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(`[data-automation-id='adf-snackbar-message-content-action-button']`);
} 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(`[data-automation-id='adf-snackbar-message-content-action-button']`);
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.........');