[ACA-2062] toolbar updates ()

* john-doclist-actions-ACA-2062

* add “simpletask” to ignore list

* fix e2e

* add workaround for Favorites

* isSharedFile state evaluator

* update docs

* update store on share file modal closed

* share action definition

* rename evaluator

* context menu rule

* check for file selection

* use another selector

* update tests

* viewer share action

* fix e2e tests

* update viewer button ids
This commit is contained in:
john-knowles 2018-12-05 11:27:22 +00:00 committed by Denys Vuika
parent 8d64dfb0e8
commit 12a72afdac
14 changed files with 353 additions and 225 deletions

@ -142,6 +142,7 @@ The button will be visible only when the linked rule evaluates to `true`.
| app.selection.first.canUpdate | User has permission to update selected node(s). |
| app.selection.file | A single File node is selected. |
| app.selection.file.canShare | User is able to share the selected file. |
| app.selection.file.isShared | A shared node is selected |
| app.selection.library | A single Library node is selected. |
| app.selection.isPrivateLibrary | A private Library node is selected. |
| app.selection.hasLibraryRole | The selected Library node has a role property. |

@ -35,7 +35,9 @@ export class Menu extends Component {
icon: '.mat-icon',
uploadFiles: 'app-upload-files',
submenu: 'app-context-menu-item .mat-menu-item'
submenu: 'app-context-menu-item .mat-menu-item',
share: `[data-automation-id='share-action-button']`
};
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
@ -43,6 +45,9 @@ export class Menu extends Component {
uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu));
shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.share, 'Share'));
shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.share, 'Shared link settings'));
constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor);
}
@ -167,4 +172,14 @@ export class Menu extends Component {
uploadFile() {
return this.uploadFiles;
}
async clickShareAction() {
const action = this.shareAction;
await action.click();
}
async clickShareEditAction() {
const action = this.shareEditAction;
await action.click();
}
}

@ -30,12 +30,16 @@ import { Component } from '../component';
export class Toolbar extends Component {
private static selectors = {
root: '.adf-toolbar',
// button: '.mat-icon-button'
button: 'button'
button: 'button',
share: `.mat-icon-button[title='Share']`,
shareEdit: `.mat-icon-button[title='Shared link settings']`
};
menu: Menu = new Menu();
buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
shareButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.share));
shareEditButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.shareEdit));
constructor(ancestor?: ElementFinder) {
super(Toolbar.selectors.root, ancestor);
@ -82,4 +86,22 @@ export class Toolbar extends Component {
const btn = this.getButtonByTitleAttribute(title);
await btn.click();
}
async clickShareButton() {
const btn = this.shareButton;
await btn.click();
}
async isShareButtonPresent() {
return await browser.isElementPresent(this.shareButton);
}
async clickShareEditButton() {
const btn = this.shareEditButton;
await btn.click();
}
async isShareEditButtonPresent() {
return await browser.isElementPresent(this.shareEditButton);
}
}

@ -274,8 +274,7 @@ describe('Context menu actions - single selection : ', () => {
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
// TODO: enable this when the action is properly implemented: ACA-92
// expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Shared link settings')).toBe(true, `Shared link settings is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);

@ -120,8 +120,7 @@ describe('Share a file', () => {
it('Share dialog default values - [C286327]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
@ -137,8 +136,7 @@ describe('Share a file', () => {
it('Close dialog - [C286328]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.closeButton.isEnabled()).toBe(true, 'Close button is not enabled');
@ -148,8 +146,7 @@ describe('Share a file', () => {
it('Share a file - [C286329]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -165,8 +162,7 @@ describe('Share a file', () => {
it('Copy shared file URL - [C286330]', async () => {
await dataTable.selectItem(file4);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/');
@ -183,8 +179,7 @@ describe('Share a file', () => {
it('Share a file with expiration date - [C286332]', async () => {
await dataTable.selectItem(file5);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle();
@ -205,8 +200,7 @@ describe('Share a file', () => {
it('Expire date is displayed correctly - [C286337]', async () => {
await dataTable.selectItem(file6);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getNodeProperty(file6Id, 'qshare:expiryDate');
@ -217,8 +211,7 @@ describe('Share a file', () => {
it('Disable the share link expiration - [C286333]', async () => {
await dataTable.selectItem(file7);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
@ -234,8 +227,7 @@ describe('Share a file', () => {
it('Shared file URL is not changed when Share dialog is closed and opened again - [C286335]', async () => {
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose();
@ -243,8 +235,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection();
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl();
@ -253,7 +244,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286345]', async () => {
await dataTable.rightClickOnItem(file9);
await contextMenu.clickMenuItem('Share');
await contextMenu.clickShareAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -325,8 +316,7 @@ describe('Share a file', () => {
it('Share dialog default values - [C286639]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
@ -342,8 +332,7 @@ describe('Share a file', () => {
it('Close dialog - [C286640]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.closeButton.isEnabled()).toBe(true, 'Close button is not enabled');
@ -353,8 +342,7 @@ describe('Share a file', () => {
it('Share a file - [C286641]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -370,8 +358,7 @@ describe('Share a file', () => {
it('Copy shared file URL - [C286642]', async () => {
await dataTable.selectItem(file4);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/');
@ -388,8 +375,7 @@ describe('Share a file', () => {
it('Share a file with expiration date - [C286643]', async () => {
await dataTable.selectItem(file5);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle();
@ -410,8 +396,7 @@ describe('Share a file', () => {
it('Expire date is displayed correctly - [C286644]', async () => {
await dataTable.selectItem(file6);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getNodeProperty(file6Id, 'qshare:expiryDate');
@ -422,8 +407,7 @@ describe('Share a file', () => {
it('Disable the share link expiration - [C286645]', async () => {
await dataTable.selectItem(file7);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
@ -439,8 +423,7 @@ describe('Share a file', () => {
it('Shared file URL is not changed when Share dialog is closed and opened again - [C286646]', async () => {
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose();
@ -448,8 +431,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection();
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl();
@ -458,7 +440,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286647]', async () => {
await dataTable.rightClickOnItem(file9);
await contextMenu.clickMenuItem('Share');
await contextMenu.clickShareAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -528,8 +510,7 @@ describe('Share a file', () => {
it('Share dialog default values - [C286657]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
@ -545,8 +526,7 @@ describe('Share a file', () => {
it('Close dialog - [C286658]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.closeButton.isEnabled()).toBe(true, 'Close button is not enabled');
@ -556,8 +536,7 @@ describe('Share a file', () => {
it('Share a file - [C286659]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -573,8 +552,7 @@ describe('Share a file', () => {
it('Copy shared file URL - [C286660]', async () => {
await dataTable.selectItem(file4);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/');
@ -591,8 +569,7 @@ describe('Share a file', () => {
it('Share a file with expiration date - [C286661]', async () => {
await dataTable.selectItem(file5);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle();
@ -613,8 +590,7 @@ describe('Share a file', () => {
it('Expire date is displayed correctly - [C286662]', async () => {
await dataTable.selectItem(file6);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getNodeProperty(file6Id, 'qshare:expiryDate');
@ -625,8 +601,7 @@ describe('Share a file', () => {
it('Disable the share link expiration - [C286663]', async () => {
await dataTable.selectItem(file7);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
@ -642,8 +617,7 @@ describe('Share a file', () => {
it('Shared file URL is not changed when Share dialog is closed and opened again - [C286664]', async () => {
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose();
@ -651,8 +625,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection();
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl();
@ -661,7 +634,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286665]', async () => {
await dataTable.rightClickOnItem(file9);
await contextMenu.clickMenuItem('Share');
await contextMenu.clickShareAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -731,8 +704,7 @@ describe('Share a file', () => {
it('Share dialog default values - [C286648]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
@ -748,8 +720,7 @@ describe('Share a file', () => {
it('Close dialog - [C286649]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.closeButton.isEnabled()).toBe(true, 'Close button is not enabled');
@ -759,8 +730,7 @@ describe('Share a file', () => {
it('Copy shared file URL - [C286651]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/');
@ -777,8 +747,7 @@ describe('Share a file', () => {
it('Expire date is displayed correctly - [C286653]', async () => {
await dataTable.selectItem(file4);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getNodeProperty(file4Id, 'qshare:expiryDate');
@ -789,8 +758,7 @@ describe('Share a file', () => {
it('Disable the share link expiration - [C286654]', async () => {
await dataTable.selectItem(file5);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
@ -806,8 +774,7 @@ describe('Share a file', () => {
it('Shared file URL is not changed when Share dialog is closed and opened again - [C286655]', async () => {
await dataTable.selectItem(file6);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose();
@ -815,8 +782,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection();
await dataTable.selectItem(file6);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl();
@ -825,7 +791,7 @@ describe('Share a file', () => {
it('Open Share dialog from context menu - [C286656]', async () => {
await dataTable.rightClickOnItem(file7);
await contextMenu.clickMenuItem('Shared link settings');
await contextMenu.clickShareEditAction();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`);
@ -907,8 +873,7 @@ describe('Share a file', () => {
it('Share dialog default values - [C286666]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
@ -924,8 +889,7 @@ describe('Share a file', () => {
it('Close dialog - [C286667]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.closeButton.isEnabled()).toBe(true, 'Close button is not enabled');
@ -935,8 +899,7 @@ describe('Share a file', () => {
it('Share a file - [C286668]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
@ -952,8 +915,7 @@ describe('Share a file', () => {
it('Copy shared file URL - [C286669]', async () => {
await dataTable.selectItem(file4);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/');
@ -970,8 +932,7 @@ describe('Share a file', () => {
it('Share a file with expiration date - [C286670]', async () => {
await dataTable.selectItem(file5);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle();
@ -992,8 +953,7 @@ describe('Share a file', () => {
it('Expire date is displayed correctly - [C286671]', async () => {
await dataTable.selectItem(file6);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getNodeProperty(file6Id, 'qshare:expiryDate');
@ -1004,8 +964,7 @@ describe('Share a file', () => {
it('Disable the share link expiration - [C286672]', async () => {
await dataTable.selectItem(file7);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
@ -1021,8 +980,7 @@ describe('Share a file', () => {
it('Shared file URL is not changed when Share dialog is closed and opened again - [C286673]', async () => {
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url1 = await shareDialog.getLinkUrl();
await shareDialog.clickClose();
@ -1030,8 +988,7 @@ describe('Share a file', () => {
await page.dataTable.clearSelection();
await dataTable.selectItem(file8);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url2 = await shareDialog.getLinkUrl();

@ -629,10 +629,11 @@ describe('Granular permissions available actions : ', () => {
expect(await viewerToolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isShareEditButtonPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(false, `Share is displayed in More actions`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
@ -672,10 +673,11 @@ describe('Granular permissions available actions : ', () => {
expect(await viewerToolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isShareEditButtonPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(false, `Share is displayed in More actions`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
// TODO: enable when ACA-1737 is done
// expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);

@ -267,8 +267,8 @@ describe('Toolbar actions - single selection : ', () => {
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
expect(await toolbar.isShareEditButtonPresent()).toBe(true, `Shared link settings is not displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Shared link settings')).toBe(true, `Shared is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);

@ -106,8 +106,7 @@ describe('Unshare a file', () => {
it('Unshare dialog UI - [C286339]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
@ -122,8 +121,7 @@ describe('Unshare a file', () => {
it('Unshare a file - [C286340]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -147,8 +145,7 @@ describe('Unshare a file', () => {
it('Cancel the Unshare action - [C286341]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
@ -165,7 +162,7 @@ describe('Unshare a file', () => {
it('Unshare a file from the context menu - [C286359]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await contextMenu.clickShareEditAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -238,8 +235,7 @@ describe('Unshare a file', () => {
it('Unshare dialog UI - [C286679]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
@ -254,8 +250,7 @@ describe('Unshare a file', () => {
it('Unshare a file - [C286680]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -279,8 +274,7 @@ describe('Unshare a file', () => {
it('Cancel the Unshare action - [C286681]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
@ -297,7 +291,7 @@ describe('Unshare a file', () => {
it('Unshare a file from the context menu - [C286683]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await contextMenu.clickShareEditAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -362,8 +356,7 @@ describe('Unshare a file', () => {
it('Unshare dialog UI - [C286689]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
@ -378,8 +371,7 @@ describe('Unshare a file', () => {
it('Unshare a file - [C286690]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -403,8 +395,7 @@ describe('Unshare a file', () => {
it('Cancel the Unshare action - [C286691]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
@ -421,7 +412,7 @@ describe('Unshare a file', () => {
it('Unshare a file from the context menu - [C286693]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await contextMenu.clickShareEditAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -486,8 +477,7 @@ describe('Unshare a file', () => {
it('Unshare dialog UI - [C286684]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
@ -502,8 +492,7 @@ describe('Unshare a file', () => {
it('Unshare a file - [C286685]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -526,8 +515,7 @@ describe('Unshare a file', () => {
it('Cancel the Unshare action - [C286686]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
@ -544,7 +532,7 @@ describe('Unshare a file', () => {
it('Unshare a file from the context menu - [C286688]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await contextMenu.clickShareEditAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -615,8 +603,9 @@ describe('Unshare a file', () => {
it('Unshare dialog UI - [C286694]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
// TODO: remove workaround for favorites
// await toolbar.clickShareEditButton();
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
@ -631,8 +620,9 @@ describe('Unshare a file', () => {
it('Unshare a file - [C286695]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
// TODO: remove workaround for favorites
// await toolbar.clickShareEditButton();
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -656,8 +646,9 @@ describe('Unshare a file', () => {
it('Cancel the Unshare action - [C286696]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
// TODO: remove workaround for favorites
// await toolbar.clickShareEditButton();
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
@ -674,7 +665,9 @@ describe('Unshare a file', () => {
it('Unshare a file from the context menu - [C286698]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Share');
// TODO: remove workaround for favorites
// await toolbar.clickShareEditButton();
await contextMenu.clickShareAction();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
@ -744,8 +737,7 @@ describe('Unshare a file', () => {
await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
@ -756,8 +748,7 @@ describe('Unshare a file', () => {
await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader();
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
@ -766,8 +757,7 @@ describe('Unshare a file', () => {
it('on Shared Files - file shared by other user - [C286687]', async () => {
await page.clickSharedFilesAndWait();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
@ -776,8 +766,7 @@ describe('Unshare a file', () => {
it('on Shared Files - file shared by the user - [C286702]', async () => {
await page.clickSharedFilesAndWait();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await toolbar.clickShareEditButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
@ -786,8 +775,9 @@ describe('Unshare a file', () => {
it('on Favorites - file shared by other user - [C286697]', async () => {
await page.clickFavoritesAndWait();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
// TODO: remove workaround for favorites
// await toolbar.clickShareEditButton();
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
@ -796,8 +786,9 @@ describe('Unshare a file', () => {
it('on Favorites - file shared by the user - [C286703]', async () => {
await page.clickFavoritesAndWait();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
// TODO: remove workaround for favorites
// await toolbar.clickShareEditButton();
await toolbar.clickShareButton();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');

@ -105,17 +105,17 @@ describe('Viewer actions', () => {
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed`);
expect(await toolbar.isButtonPresent('Print')).toBe(true, `print`);
expect(await toolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `full screen`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `view details`);
expect(await toolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await toolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isShareButtonPresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `favorite`);
expect(await toolbar.menu.isMenuItemPresent('Share')).toBe(true, `share`);
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `copy`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `move`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `delete`);
expect(await toolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `manage versions`);
expect(await toolbar.menu.isMenuItemPresent('Permissions')).toBe(true, `permissions`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
await toolbar.closeMoreMenu();
});
@ -185,8 +185,7 @@ describe('Viewer actions', () => {
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfPersonalFiles} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.getRowByName(pdfPersonalFiles).isPresent()).toBe(true, 'Item is not present in Trash');
@ -208,8 +207,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -229,8 +227,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await Utils.pressEscape();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open');
@ -343,8 +340,7 @@ describe('Viewer actions', () => {
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfLibraries} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.getRowByName(pdfLibraries).isPresent()).toBe(true, 'Item is not present in Trash');
@ -354,8 +350,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -477,8 +472,7 @@ describe('Viewer actions', () => {
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfRecentFiles} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.getRowByName(pdfRecentFiles).isPresent()).toBe(true, 'Item is not present in Trash');
@ -488,8 +482,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -611,20 +604,17 @@ describe('Viewer actions', () => {
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfSharedFiles} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.getRowByName(pdfSharedFiles).isPresent()).toBe(true, 'Item is not present in Trash');
});
// TODO: enable tis when Unshare is implemented - ACA-122
xit('Share action - [C286381]', async () => {
it('Share action - [C286381]', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareEditButton();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
@ -748,8 +738,7 @@ describe('Viewer actions', () => {
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Delete');
expect(await page.getSnackBarMessage()).toContain(`${pdfFavorites} deleted`);
// TODO: enable this when ACA-1806 is fixed
// expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.getRowByName(pdfFavorites).isPresent()).toBe(true, 'Item is not present in Trash');
@ -759,8 +748,7 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await toolbar.clickShareButton();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});

@ -113,6 +113,7 @@ export class CoreExtensionsModule {
'app.selection.first.canUpdate': app.canUpdateSelectedNode,
'app.selection.file': app.hasFileSelected,
'app.selection.file.canShare': app.canShareFile,
'app.selection.file.isShared': app.isShared,
'app.selection.library': app.hasLibrarySelected,
'app.selection.isPrivateLibrary': app.isPrivateLibrary,
'app.selection.hasLibraryRole': app.hasLibraryRole,

@ -75,6 +75,28 @@ export function canShareFile(
return false;
}
export function isShared(
context: RuleContext,
...args: RuleParameter[]
): boolean {
if (isSharedFiles(context, ...args) && !context.selection.isEmpty) {
return true;
}
if (
(isNotTrashcan(context, ...args),
!context.selection.isEmpty && context.selection.file)
) {
return !!(
context.selection.file.entry &&
context.selection.file.entry.properties &&
context.selection.file.entry.properties['qshare:sharedId']
);
}
return false;
}
export function canDeleteSelection(
context: RuleContext,
...args: RuleParameter[]

@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { TestBed, fakeAsync } from '@angular/core/testing';
import { TestBed, fakeAsync, tick, flush } from '@angular/core/testing';
import { of, throwError } from 'rxjs';
import { MatDialog, MatSnackBar } from '@angular/material';
import { Actions, ofType, EffectsModule } from '@ngrx/effects';
@ -41,7 +41,9 @@ import {
NAVIGATE_ROUTE,
DeleteNodesAction,
MoveNodesAction,
CopyNodesAction
CopyNodesAction,
ShareNodeAction,
SetSelectedNodesAction
} from '../store/actions';
import { map } from 'rxjs/operators';
import { NodeEffects } from '../store/effects/node.effects';
@ -77,11 +79,6 @@ describe('ContentManagementService', () => {
translationService = TestBed.get(TranslationService);
dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
return of(true);
}
});
});
describe('Copy node action', () => {
@ -989,6 +986,14 @@ describe('ContentManagementService', () => {
});
describe('Permanent Delete', () => {
beforeEach(() => {
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
return of(true);
}
});
});
it('does not purge nodes if no selection', () => {
spyOn(contentApi, 'purgeDeletedNode');
@ -1484,4 +1489,68 @@ describe('ContentManagementService', () => {
}));
});
});
describe('Share Node', () => {
it('should open dialog for nodes without requesting getNodeInfo', fakeAsync(() => {
const node = { entry: { id: '1', name: 'name1' } };
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({}));
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
return of(null);
}
});
store.dispatch(new ShareNodeAction(node));
expect(contentApi.getNodeInfo).not.toHaveBeenCalled();
expect(dialog.open).toHaveBeenCalled();
}));
it('should open dialog with getNodeInfo data when `id` property is missing', fakeAsync(() => {
const node = { entry: { nodeId: '1', name: 'name1' } };
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({}));
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
return of(null);
}
});
store.dispatch(new ShareNodeAction(node));
expect(contentApi.getNodeInfo).toHaveBeenCalled();
expect(dialog.open).toHaveBeenCalled();
}));
it('should update node selection after dialog is closed', fakeAsync(() => {
const node = { entry: { id: '1', name: 'name1' } };
spyOn(store, 'dispatch').and.callThrough();
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
return of(null);
}
});
store.dispatch(new ShareNodeAction(node));
expect(store.dispatch['calls'].argsFor(1)[0]).toEqual(
new SetSelectedNodesAction([node])
);
}));
it('should emit event when node is un-shared', fakeAsync(() => {
const node = { entry: { id: '1', name: 'name1' } };
spyOn(contentManagementService.linksUnshared, 'next').and.callThrough();
spyOn(dialog, 'open').and.returnValue({
afterClosed: () => of(node)
});
store.dispatch(new ShareNodeAction(node));
tick();
flush();
expect(contentManagementService.linksUnshared.next).toHaveBeenCalledWith(
jasmine.any(Object)
);
}));
});
});

@ -212,6 +212,9 @@ export class ContentManagementService {
})
.afterClosed()
.subscribe(deletedSharedLink => {
this.store.dispatch(
new SetSelectedNodesAction([deletedSharedLink || node])
);
if (deletedSharedLink) {
this.linksUnshared.next(deletedSharedLink);
}

@ -54,13 +54,28 @@
]
},
{
"id": "app.toolbar.canShare",
"id": "app.context.canShare",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file.canShare" },
{ "type": "rule", "value": "repository.isQuickShareEnabled" }
]
},
{
"id": "app.toolbar.canShare",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file.canShare" },
{ "type": "rule", "value": "repository.isQuickShareEnabled" },
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.selection.file.isShared" }
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
@ -337,8 +352,32 @@
],
"toolbar": [
{
"id": "app.toolbar.preview",
"id": "app.toolbar.share",
"order": 100,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.toolbar.canShare"
}
},
{
"id": "app.toolbar.share.edit",
"order": 101,
"title": "APP.ACTIONS.SHARE_EDIT",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.isShared"
}
},
{
"id": "app.toolbar.preview",
"order": 300,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
@ -362,7 +401,7 @@
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"order": 250,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
@ -396,6 +435,11 @@
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.create.separator.2",
"type": "separator",
"order": 680
},
{
"id": "app.toolbar.info.infoDrawer",
"type": "custom",
@ -485,6 +529,11 @@
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.create.separator.3",
"type": "separator",
"order": 380
},
{
"id": "app.toolbar.copy",
"order": 400,
@ -509,15 +558,6 @@
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"type": "custom",
"order": 600,
"component": "app.shared-link.toggleSharedLink",
"rules": {
"visible": "app.toolbar.canShare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
@ -542,6 +582,11 @@
"visible": "app.selection.library"
}
},
{
"id": "app.create.separator.4",
"type": "separator",
"order": 980
},
{
"id": "app.toolbar.versions",
"order": 1000,
@ -571,8 +616,17 @@
],
"contextMenu": [
{
"id": "app.context.menu.download",
"id": "app.context.menu.share",
"type": "custom",
"order": 100,
"component": "app.shared-link.toggleSharedLink",
"rules": {
"visible": "app.context.canShare"
}
},
{
"id": "app.context.menu.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
@ -584,7 +638,7 @@
},
{
"id": "app.context.menu.preview",
"order": 200,
"order": 300,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
@ -596,7 +650,7 @@
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"order": 400,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
@ -606,15 +660,6 @@
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"type": "custom",
"order": 400,
"component": "app.shared-link.toggleSharedLink",
"rules": {
"visible": "app.toolbar.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
@ -679,10 +724,15 @@
"visible": "app.libraries.toolbar.canLeaveLibrary"
}
},
{
"id": "app.create.separator.5",
"type": "separator",
"order": 720
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"order": 750,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
@ -727,6 +777,11 @@
"visible": "app.libraries.toolbar"
}
},
{
"id": "app.create.separator.6",
"type": "separator",
"order": 980
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
@ -779,8 +834,8 @@
"viewer": {
"toolbarActions": [
{
"id": "app.toolbar.download",
"order": 100,
"id": "app.viewer.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
@ -792,7 +847,7 @@
},
{
"id": "app.viewer.print",
"order": 200,
"order": 300,
"title": "APP.ACTIONS.PRINT",
"icon": "print",
"actions": {
@ -804,7 +859,7 @@
},
{
"id": "app.viewer.share",
"order": 300,
"order": 400,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
@ -814,9 +869,21 @@
"visible": "app.toolbar.canShare"
}
},
{
"id": "app.viewer.share.edit",
"order": 401,
"title": "APP.ACTIONS.SHARE_EDIT",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.isShared"
}
},
{
"id": "app.viewer.fullscreen",
"order": 400,
"order": 100,
"title": "APP.ACTIONS.FULLSCREEN",
"icon": "fullscreen",
"actions": {
@ -862,15 +929,6 @@
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.viewer.share",
"type": "custom",
"order": 300,
"component": "app.shared-link.toggleSharedLink",
"rules": {
"visible": "app.toolbar.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,