mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
add tests for header extension (#701)
This commit is contained in:
committed by
Suzana Dirla
parent
253425971f
commit
d8ad020394
@@ -23,24 +23,32 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, by } from 'protractor';
|
||||
import { ElementFinder, by, browser } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import { UserInfo } from './user-info';
|
||||
import { protractor } from 'protractor';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Toolbar } from './../toolbar/toolbar';
|
||||
|
||||
export class Header extends Component {
|
||||
private locators = {
|
||||
root: 'app-header',
|
||||
logoLink: by.css('.app-menu__title'),
|
||||
userInfo: by.css('aca-current-user'),
|
||||
searchButton: by.css('#adf-search-button'),
|
||||
searchBar: by.css('#adf-control-input')
|
||||
searchBar: by.css('#adf-control-input'),
|
||||
moreActions: by.id('app.header.more')
|
||||
};
|
||||
|
||||
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
|
||||
userInfo: UserInfo = new UserInfo(this.component);
|
||||
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
|
||||
searchBar: ElementFinder = this.component.element(this.locators.searchBar);
|
||||
moreActions: ElementFinder = browser.element(this.locators.moreActions);
|
||||
|
||||
menu: Menu = new Menu();
|
||||
toolbar: Toolbar = new Toolbar();
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super('adf-layout-header', ancestor);
|
||||
@@ -59,5 +67,10 @@ export class Header extends Component {
|
||||
async waitForSearchBar() {
|
||||
await Utils.waitUntilElementClickable(this.searchBar);
|
||||
}
|
||||
|
||||
async openMoreMenu() {
|
||||
await this.moreActions.click();
|
||||
await this.menu.waitForMenuToOpen();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -112,6 +112,16 @@ export class Menu extends Component {
|
||||
return await this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
|
||||
}
|
||||
|
||||
async isMenuItemDisabled(title: string) {
|
||||
try {
|
||||
const item = this.getItemByLabel(title);
|
||||
const disabled = await item.getAttribute('disabled');
|
||||
return disabled;
|
||||
} catch (error) {
|
||||
console.log('----- isMenuItemDisabled catch: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
uploadFile() {
|
||||
return this.uploadFiles;
|
||||
}
|
||||
|
@@ -67,7 +67,6 @@ export class Toolbar extends Component {
|
||||
const moreMenu = this.getButtonByTitleAttribute('More actions');
|
||||
await moreMenu.click();
|
||||
await this.menu.waitForMenuToOpen();
|
||||
// return this.menu;
|
||||
}
|
||||
|
||||
async closeMoreMenu() {
|
||||
|
@@ -96,5 +96,6 @@ export const EXTENSIBILITY_CONFIGS = {
|
||||
DEFAULT_EXTENSIONS_CONFIG: 'extensions-default.json',
|
||||
INFO_DRAWER: 'info-drawer-ext.json',
|
||||
INFO_DRAWER_EMPTY: 'info-drawer-no-tabs-ext.json',
|
||||
VIEWER: 'viewer-ext.json'
|
||||
VIEWER: 'viewer-ext.json',
|
||||
HEADER: 'header-ext.json'
|
||||
};
|
||||
|
927
e2e/resources/extensibility-configs/header-ext.json
Normal file
927
e2e/resources/extensibility-configs/header-ext.json
Normal file
@@ -0,0 +1,927 @@
|
||||
{
|
||||
"$schema": "../../extension.schema.json",
|
||||
"$name": "app",
|
||||
"$version": "1.0.0",
|
||||
"$references": [
|
||||
"plugin1.json",
|
||||
"dev.tools.json",
|
||||
"app.header.json",
|
||||
"app.create.json",
|
||||
"metadata-plugin.json"
|
||||
],
|
||||
|
||||
"rules": [
|
||||
{
|
||||
"id": "app.toolbar.favorite.canToggle",
|
||||
"comment": "workaround for recent files and search api issue",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "core.some",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.selection.canAddFavorite"
|
||||
},
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.selection.canRemoveFavorite"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "core.some",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.navigation.isRecentFiles"
|
||||
},
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.navigation.isSharedFiles"
|
||||
},
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.navigation.isSearchResults"
|
||||
},
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.navigation.isFavorites"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.favorite.canAdd",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.canAddFavorite" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.navigation.isNotSearchResults"
|
||||
},
|
||||
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.favorite.canRemove",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.navigation.isNotSearchResults"
|
||||
},
|
||||
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.info",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.notEmpty" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.canCopyNode",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.notEmpty" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.permissions",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.first.canUpdate" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.versions",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.file" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.trashcan.hasSelection",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.notEmpty" },
|
||||
{ "type": "rule", "value": "app.navigation.isTrashcan" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.canEditFolder",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.folder" },
|
||||
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.canViewFile",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "app.selection.file"
|
||||
},
|
||||
{
|
||||
"type": "rule",
|
||||
"value": "core.not",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.navigation.isTrashcan" }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.canDownload",
|
||||
"type": "core.every",
|
||||
"parameters": [
|
||||
{ "type": "rule", "value": "app.selection.canDownload" },
|
||||
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
"features": {
|
||||
"create": [
|
||||
{
|
||||
"id": "app.create.uploadFile",
|
||||
"order": 100,
|
||||
"icon": "file_upload",
|
||||
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
|
||||
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
|
||||
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
|
||||
"actions": {
|
||||
"click": "UPLOAD_FILES"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canUpload"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.uploadFolder",
|
||||
"order": 200,
|
||||
"icon": "file_upload",
|
||||
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
|
||||
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
|
||||
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
|
||||
"actions": {
|
||||
"click": "UPLOAD_FOLDER"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canUpload"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.separator.1",
|
||||
"type": "separator",
|
||||
"order": 300
|
||||
},
|
||||
{
|
||||
"id": "app.create.folder",
|
||||
"order": 400,
|
||||
"icon": "create_new_folder",
|
||||
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
|
||||
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
|
||||
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
|
||||
"actions": {
|
||||
"click": "CREATE_FOLDER"
|
||||
},
|
||||
"rules": {
|
||||
"enabled": "app.navigation.folder.canCreate"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.create.library",
|
||||
"order": 600,
|
||||
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_LIBRARY",
|
||||
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_LIBRARY",
|
||||
"icon": "create_new_folder",
|
||||
"actions": {
|
||||
"click": "CREATE_LIBRARY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"navbar": [
|
||||
{
|
||||
"id": "app.navbar.primary",
|
||||
"items": [
|
||||
{
|
||||
"id": "app.navbar.personalFiles",
|
||||
"order": 100,
|
||||
"icon": "folder",
|
||||
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
|
||||
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
|
||||
"route": "personal-files"
|
||||
},
|
||||
{
|
||||
"id": "app.navbar.libraries",
|
||||
"order": 200,
|
||||
"icon": "group_work",
|
||||
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
|
||||
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
|
||||
"route": "libraries"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app.navbar.secondary",
|
||||
"items": [
|
||||
{
|
||||
"id": "app.navbar.shared",
|
||||
"order": 100,
|
||||
"icon": "people",
|
||||
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
|
||||
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
|
||||
"route": "shared",
|
||||
"rules": {
|
||||
"visible": "repository.isQuickShareEnabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.navbar.recentFiles",
|
||||
"order": 200,
|
||||
"icon": "schedule",
|
||||
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
|
||||
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
|
||||
"route": "recent-files"
|
||||
},
|
||||
{
|
||||
"id": "app.navbar.favorites",
|
||||
"order": 300,
|
||||
"icon": "star",
|
||||
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
|
||||
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
|
||||
"route": "favorites"
|
||||
},
|
||||
{
|
||||
"id": "app.navbar.trashcan",
|
||||
"order": 400,
|
||||
"icon": "delete",
|
||||
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
|
||||
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
|
||||
"route": "trashcan"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"toolbar": [
|
||||
{
|
||||
"id": "app.toolbar.preview",
|
||||
"order": 100,
|
||||
"title": "APP.ACTIONS.VIEW",
|
||||
"icon": "open_in_browser",
|
||||
"actions": {
|
||||
"click": "VIEW_FILE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.download",
|
||||
"order": 200,
|
||||
"title": "APP.ACTIONS.DOWNLOAD",
|
||||
"icon": "get_app",
|
||||
"actions": {
|
||||
"click": "DOWNLOAD_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canDownload"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.editFolder",
|
||||
"order": 300,
|
||||
"title": "APP.ACTIONS.EDIT",
|
||||
"icon": "create",
|
||||
"actions": {
|
||||
"click": "EDIT_FOLDER"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canEditFolder"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.purgeDeletedNodes",
|
||||
"order": 400,
|
||||
"title": "APP.ACTIONS.DELETE_PERMANENT",
|
||||
"icon": "delete_forever",
|
||||
"actions": {
|
||||
"click": "PURGE_DELETED_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.trashcan.hasSelection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.restoreDeletedNodes",
|
||||
"order": 500,
|
||||
"title": "APP.ACTIONS.RESTORE",
|
||||
"icon": "restore",
|
||||
"actions": {
|
||||
"click": "RESTORE_DELETED_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.trashcan.hasSelection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.info",
|
||||
"type": "custom",
|
||||
"order": 700,
|
||||
"component": "app.toolbar.toggleInfoDrawer",
|
||||
"rules": {
|
||||
"visible": "app.toolbar.info"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.toolbar.favorite",
|
||||
"comment": "workaround for Recent Files and Search API issue",
|
||||
"type": "custom",
|
||||
"order": 100,
|
||||
"component": "app.toolbar.toggleFavorite",
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canToggle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.favorite.add",
|
||||
"order": 200,
|
||||
"title": "APP.ACTIONS.FAVORITE",
|
||||
"icon": "star_border",
|
||||
"actions": {
|
||||
"click": "ADD_FAVORITE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canAdd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.favorite.remove",
|
||||
"order": 300,
|
||||
"title": "APP.ACTIONS.FAVORITE",
|
||||
"icon": "star",
|
||||
"actions": {
|
||||
"click": "REMOVE_FAVORITE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canRemove"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.copy",
|
||||
"order": 400,
|
||||
"title": "APP.ACTIONS.COPY",
|
||||
"icon": "content_copy",
|
||||
"actions": {
|
||||
"click": "COPY_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canCopyNode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.move",
|
||||
"order": 500,
|
||||
"title": "APP.ACTIONS.MOVE",
|
||||
"icon": "library_books",
|
||||
"actions": {
|
||||
"click": "MOVE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canDelete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.share",
|
||||
"order": 600,
|
||||
"title": "APP.ACTIONS.SHARE",
|
||||
"icon": "share",
|
||||
"actions": {
|
||||
"click": "SHARE_NODE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.file.canShare"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.unshare",
|
||||
"order": 700,
|
||||
"title": "APP.ACTIONS.UNSHARE",
|
||||
"icon": "stop_screen_share",
|
||||
"actions": {
|
||||
"click": "UNSHARE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canUnshare"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.delete",
|
||||
"order": 800,
|
||||
"title": "APP.ACTIONS.DELETE",
|
||||
"icon": "delete",
|
||||
"actions": {
|
||||
"click": "DELETE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canDelete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.deleteLibrary",
|
||||
"order": 900,
|
||||
"title": "APP.ACTIONS.DELETE",
|
||||
"icon": "delete",
|
||||
"actions": {
|
||||
"click": "DELETE_LIBRARY"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.library"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.versions",
|
||||
"order": 1000,
|
||||
"title": "APP.ACTIONS.VERSIONS",
|
||||
"icon": "history",
|
||||
"actions": {
|
||||
"click": "MANAGE_VERSIONS"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.versions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.permissions",
|
||||
"order": 1100,
|
||||
"title": "APP.ACTIONS.PERMISSIONS",
|
||||
"icon": "settings_input_component",
|
||||
"actions": {
|
||||
"click": "MANAGE_PERMISSIONS"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"contextMenu": [
|
||||
{
|
||||
"id": "app.context.menu.download",
|
||||
"order": 100,
|
||||
"title": "APP.ACTIONS.DOWNLOAD",
|
||||
"icon": "get_app",
|
||||
"actions": {
|
||||
"click": "DOWNLOAD_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canDownload"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.preview",
|
||||
"order": 200,
|
||||
"title": "APP.ACTIONS.VIEW",
|
||||
"icon": "open_in_browser",
|
||||
"actions": {
|
||||
"click": "VIEW_FILE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.editFolder",
|
||||
"order": 300,
|
||||
"title": "APP.ACTIONS.EDIT",
|
||||
"icon": "create",
|
||||
"actions": {
|
||||
"click": "EDIT_FOLDER"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canEditFolder"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.share",
|
||||
"title": "APP.ACTIONS.SHARE",
|
||||
"order": 400,
|
||||
"icon": "share",
|
||||
"actions": {
|
||||
"click": "SHARE_NODE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.file.canShare"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.favorite.add",
|
||||
"title": "APP.ACTIONS.FAVORITE",
|
||||
"order": 500,
|
||||
"icon": "star_border",
|
||||
"actions": {
|
||||
"click": "ADD_FAVORITE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canAdd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.favorite.remove",
|
||||
"title": "APP.ACTIONS.FAVORITE",
|
||||
"order": 600,
|
||||
"icon": "star",
|
||||
"actions": {
|
||||
"click": "REMOVE_FAVORITE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canRemove"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.favorite",
|
||||
"comment": "workaround for Recent Files and Search API issue",
|
||||
"type": "custom",
|
||||
"order": 501,
|
||||
"component": "app.toolbar.toggleFavorite",
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canToggle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.copy",
|
||||
"title": "APP.ACTIONS.COPY",
|
||||
"order": 700,
|
||||
"icon": "content_copy",
|
||||
"actions": {
|
||||
"click": "COPY_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canCopyNode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.move",
|
||||
"title": "APP.ACTIONS.MOVE",
|
||||
"order": 800,
|
||||
"icon": "library_books",
|
||||
"actions": {
|
||||
"click": "MOVE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canDelete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.delete",
|
||||
"title": "APP.ACTIONS.DELETE",
|
||||
"order": 900,
|
||||
"icon": "delete",
|
||||
"actions": {
|
||||
"click": "DELETE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canDelete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.versions",
|
||||
"title": "APP.ACTIONS.VERSIONS",
|
||||
"order": 1000,
|
||||
"icon": "history",
|
||||
"actions": {
|
||||
"click": "MANAGE_VERSIONS"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.versions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.permissions",
|
||||
"title": "APP.ACTIONS.PERMISSIONS",
|
||||
"icon": "settings_input_component",
|
||||
"order": 1100,
|
||||
"actions": {
|
||||
"click": "MANAGE_PERMISSIONS"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.purgeDeletedNodes",
|
||||
"order": 1200,
|
||||
"title": "APP.ACTIONS.DELETE_PERMANENT",
|
||||
"icon": "delete_forever",
|
||||
"actions": {
|
||||
"click": "PURGE_DELETED_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.trashcan.hasSelection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.restoreDeletedNodes",
|
||||
"order": 1300,
|
||||
"title": "APP.ACTIONS.RESTORE",
|
||||
"icon": "restore",
|
||||
"actions": {
|
||||
"click": "RESTORE_DELETED_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.trashcan.hasSelection"
|
||||
}
|
||||
}
|
||||
],
|
||||
"viewer": {
|
||||
"toolbarActions": [
|
||||
{
|
||||
"id": "app.toolbar.download",
|
||||
"order": 100,
|
||||
"title": "APP.ACTIONS.DOWNLOAD",
|
||||
"icon": "get_app",
|
||||
"actions": {
|
||||
"click": "DOWNLOAD_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canDownload"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.print",
|
||||
"order": 200,
|
||||
"title": "APP.ACTIONS.PRINT",
|
||||
"icon": "print",
|
||||
"actions": {
|
||||
"click": "PRINT_FILE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.share",
|
||||
"order": 300,
|
||||
"title": "APP.ACTIONS.SHARE",
|
||||
"icon": "share",
|
||||
"actions": {
|
||||
"click": "SHARE_NODE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.file.canShare"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.fullscreen",
|
||||
"order": 400,
|
||||
"title": "APP.ACTIONS.FULLSCREEN",
|
||||
"icon": "fullscreen",
|
||||
"actions": {
|
||||
"click": "FULLSCREEN_VIEWER"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
"title": "APP.ACTIONS.FAVORITE",
|
||||
"icon": "star_border",
|
||||
"actions": {
|
||||
"click": "ADD_FAVORITE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canAdd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.favorite.remove",
|
||||
"order": 200,
|
||||
"title": "APP.ACTIONS.FAVORITE",
|
||||
"icon": "star",
|
||||
"actions": {
|
||||
"click": "REMOVE_FAVORITE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canRemove"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.favorite",
|
||||
"comment": "workaround for Recent Files and Search API issue",
|
||||
"type": "custom",
|
||||
"order": 101,
|
||||
"component": "app.toolbar.toggleFavorite",
|
||||
"rules": {
|
||||
"visible": "app.toolbar.favorite.canToggle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.share",
|
||||
"order": 300,
|
||||
"title": "APP.ACTIONS.SHARE",
|
||||
"icon": "share",
|
||||
"actions": {
|
||||
"click": "SHARE_NODE"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.file.canShare"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.copy",
|
||||
"order": 400,
|
||||
"title": "APP.ACTIONS.COPY",
|
||||
"icon": "content_copy",
|
||||
"actions": {
|
||||
"click": "COPY_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canCopyNode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.move",
|
||||
"order": 500,
|
||||
"title": "APP.ACTIONS.MOVE",
|
||||
"icon": "library_books",
|
||||
"actions": {
|
||||
"click": "MOVE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canDelete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.delete",
|
||||
"order": 600,
|
||||
"title": "APP.ACTIONS.DELETE",
|
||||
"icon": "delete",
|
||||
"actions": {
|
||||
"click": "DELETE_NODES"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.selection.canDelete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.versions",
|
||||
"order": 700,
|
||||
"title": "APP.ACTIONS.VERSIONS",
|
||||
"icon": "history",
|
||||
"actions": {
|
||||
"click": "MANAGE_VERSIONS"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.versions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.permissions",
|
||||
"order": 800,
|
||||
"title": "APP.ACTIONS.PERMISSIONS",
|
||||
"icon": "settings_input_component",
|
||||
"actions": {
|
||||
"click": "MANAGE_PERMISSIONS"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
"id": "app.viewer.pdf",
|
||||
"disabled": true,
|
||||
"fileExtension": "pdf",
|
||||
"component": "app.components.tabs.metadata"
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.docx",
|
||||
"disabled": true,
|
||||
"fileExtension": "docx",
|
||||
"component": "app.components.tabs.comments"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sidebar": [
|
||||
{
|
||||
"id": "app.sidebar.properties",
|
||||
"order": 100,
|
||||
"title": "APP.INFO_DRAWER.TABS.PROPERTIES",
|
||||
"component": "app.components.tabs.metadata"
|
||||
},
|
||||
{
|
||||
"id": "app.sidebar.comments",
|
||||
"order": 200,
|
||||
"title": "APP.INFO_DRAWER.TABS.COMMENTS",
|
||||
"component": "app.components.tabs.comments"
|
||||
},
|
||||
{
|
||||
"id": "app.sidebar.versions",
|
||||
"order": 300,
|
||||
"disabled": true,
|
||||
"title": "APP.INFO_DRAWER.TABS.VERSIONS",
|
||||
"component": "app.components.tabs.versions"
|
||||
}
|
||||
],
|
||||
"content-metadata-presets": [
|
||||
{
|
||||
"id": "app.content.metadata.custom",
|
||||
"custom": [
|
||||
{
|
||||
"id": "app.content.metadata.customGroup",
|
||||
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
|
||||
"items": [
|
||||
{
|
||||
"id": "app.content.metadata.exifAspect",
|
||||
"aspect": "exif:exif",
|
||||
"properties": [
|
||||
"exif:pixelXDimension",
|
||||
"exif:pixelYDimension",
|
||||
"exif:dateTimeOriginal",
|
||||
"exif:exposureTime",
|
||||
"exif:fNumber",
|
||||
"exif:flash",
|
||||
"exif:focalLength",
|
||||
"exif:isoSpeedRatings",
|
||||
"exif:orientation",
|
||||
"exif:manufacturer",
|
||||
"exif:model",
|
||||
"exif:software"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"header": [
|
||||
{
|
||||
"id": "app.header.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "settings",
|
||||
"title": "App settings",
|
||||
"description": "Application settings",
|
||||
"icon": "settings",
|
||||
"disabled": true,
|
||||
"actions": {
|
||||
"click": "app.actions.settings"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "button",
|
||||
"title": "New Button",
|
||||
"description": "new button description",
|
||||
"icon": "alarm_on",
|
||||
"actions": {
|
||||
"click": "app.actions.settings"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
92
e2e/suites/extensions/ext-header.test.ts
Executable file
92
e2e/suites/extensions/ext-header.test.ts
Executable file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { EXTENSIBILITY_CONFIGS } from '../../configs';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { Header } from '../../components/components';
|
||||
import { Menu } from './../../components/menu/menu';
|
||||
|
||||
describe('Extensions - Info Drawer', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const disabledMenu = {
|
||||
id: 'settings',
|
||||
title: 'App settings',
|
||||
description: 'Application settings',
|
||||
icon: 'settings'
|
||||
};
|
||||
|
||||
const enabledMenu = {
|
||||
id: 'button',
|
||||
title: 'New Button',
|
||||
description: 'new button description',
|
||||
icon: 'alarm_on'
|
||||
};
|
||||
|
||||
const apis = {
|
||||
admin: new RepoClient(),
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const header = new Header();
|
||||
const toolbarMenu = new Menu();
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
|
||||
beforeAll(async (done) => {
|
||||
await apis.admin.people.createUser({ username });
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.HEADER);
|
||||
await loginPage.loginWith(username);
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await logoutPage.load();
|
||||
done();
|
||||
});
|
||||
|
||||
it('Add a new button in the header - [C286474]', async () => {
|
||||
await header.openMoreMenu();
|
||||
expect(await toolbarMenu.isMenuItemPresent(enabledMenu.title)).toBe(true, 'menu item not present');
|
||||
expect(await toolbarMenu.getItemIconText(enabledMenu.title)).toEqual(enabledMenu.icon);
|
||||
});
|
||||
|
||||
it('Disable a button from the header - [C286477]', async () => {
|
||||
await header.openMoreMenu();
|
||||
expect(await toolbarMenu.isMenuItemPresent(disabledMenu.title)).toBe(true, `${disabledMenu.title} menu item not present`);
|
||||
expect(await toolbarMenu.isMenuItemDisabled(disabledMenu.title)).toEqual('true', `${disabledMenu.title} is not disabled`);
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user