Revert snackbar changes (#2778)

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

This reverts commit 5ce4835e4ce413106f5e745f44724893579d2972.

* restore about dialog changes

* latest ADF alpha
This commit is contained in:
Denys Vuika 2022-11-15 17:01:04 +00:00 committed by GitHub
parent 854fb28374
commit cc41a575ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 134 additions and 303 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

36
package-lock.json generated
View File

@ -11,9 +11,9 @@
"dev": true
},
"@alfresco/adf-cli": {
"version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-5.2.0-36995.tgz",
"integrity": "sha512-uOn1EecgqmIkmnDtbiQ/rEAmmDdYiErDgsmDNbHXKbltx7hGQsWbYTW18DclYvbQmtyzNpadywHoxnTsqPjHgg==",
"version": "5.2.0-37012",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-5.2.0-37012.tgz",
"integrity": "sha512-orzwKN/oDnApzvRTNseE1mvuu24JB/jszU5P6BEGZ5BYImEsFNWuU5F9hEMwc7SE8YdlnMfqm4xuKNQF/K6KNw==",
"dev": true,
"requires": {
"@alfresco/js-api": "5.2.0-417",
@ -60,17 +60,17 @@
}
},
"@alfresco/adf-content-services": {
"version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-5.2.0-36995.tgz",
"integrity": "sha512-77hXGHTNm/GzjUNsAahja56tZJ+rOelmrYZkVhQfWAOavfB0WRMrErtLWoFpICbuAGzCmg5lLEO/O1HaJp3QkA==",
"version": "5.2.0-37012",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-5.2.0-37012.tgz",
"integrity": "sha512-y1jF0OLM1Xq/nKlYwldcS4H7pzEbLRcCPZQjuQLDxQFldrhelZVAIESqjtiSYJ/u7zc6EkCLlT6zTtV5GDgKTw==",
"requires": {
"tslib": "^2.3.0"
}
},
"@alfresco/adf-core": {
"version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-5.2.0-36995.tgz",
"integrity": "sha512-nL7n0QK/KW9rZBD+YJRdprCGDQKr6rO2ICSMC69Zema140nmC0THcA+Yi9cmXOa0Irx10pKXL6zeJOvCrf1BrQ==",
"version": "5.2.0-37012",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-5.2.0-37012.tgz",
"integrity": "sha512-a6lzk0+qVmbQHfsnaw/mxqEHd8+EGEAZ+gzftrEtmiHm36j+nTFVBQT6xgXPPh07GrB+S4gzmKzy0MuDOcBuAw==",
"requires": {
"@editorjs/code": "2.7.0",
"@editorjs/editorjs": "2.25.0",
@ -88,17 +88,17 @@
}
},
"@alfresco/adf-extensions": {
"version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-5.2.0-36995.tgz",
"integrity": "sha512-58CxcIx+zWzDtYOgS4O37sjmPV5MLLTsLQ2BZQSxShSjGlRXheKfVNwSdY6yt0ROkLnpdIYOh8rRJMfJsWDZ0Q==",
"version": "5.2.0-37012",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-5.2.0-37012.tgz",
"integrity": "sha512-jRhaO/7uutAm1p9LpT3pxkREJkW+zUu1+odcdeNs7RTZB/3eq5W696qGj+kbGf6QFBjLaiv7Y6VMkH/OKkdNaw==",
"requires": {
"tslib": "^2.3.0"
}
},
"@alfresco/adf-testing": {
"version": "5.2.0-36995",
"resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-5.2.0-36995.tgz",
"integrity": "sha512-5lPwqfZjGHSM402PeNgA4lWxwIiJmOkLuyFWgwur+6IAe5ulDbMiFyQ3y18OXpQ0kf7VTnY1oomX7BR6C45Tfg==",
"version": "5.2.0-37012",
"resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-5.2.0-37012.tgz",
"integrity": "sha512-IYI8FWuu5EWDyf2zg/GYbkzwhaTcBBrHY9hjcBiHk7Y62LWpHRfJlcVcPNNB8Ver7aJU37IgJ0bWV+09KNpkEQ==",
"dev": true,
"requires": {
"@alfresco/js-api": "5.2.0-417",
@ -160,9 +160,9 @@
}
},
"@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==",
"version": "5.2.0-418",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-5.2.0-418.tgz",
"integrity": "sha512-8+V2bRiDW9sYSl7DsDSy7/Y9A15RDyvWAbWOj4fPtNi1TcWTkGiFbKOmuRnI/VdkAxZV+eJXBnn82B27cpgkdw==",
"requires": {
"event-emitter": "^0.3.5",
"minimatch": "5.0.1",

View File

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

View File

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

View File

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

View File

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