diff --git a/.gitignore b/.gitignore index 082d3efc1..3a5b6bbee 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ testem.log /e2e/*.js /e2e/*.map /e2e-output +/e2e-downloads # System Files .DS_Store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..dbbfe7e84 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "alfresco-js-api"] + path = alfresco-js-api + url = https://github.com/Alfresco/alfresco-js-api +[submodule "alfresco-ng2-components"] + path = alfresco-ng2-components + url = https://github.com/Alfresco/alfresco-ng2-components diff --git a/README.md b/README.md index 20ca051d8..3bea9eca0 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ Please include a clear description, steps to reproduce and screenshots where app #### What's new in the latest release -- Single Log Out -- WCAG AA accessibility improvements +- Create (file/folder) Templates +- More WCAG AA accessibility improvements Please refer to the [release notes] for details of all changes. @@ -59,6 +59,7 @@ Read up on our guidelines for [contributing] and then check out one of our issue | ACA Version | Built with | Tested on | | ----------- | ---------- | --------- | +| ACA 1.10 | ADF 3.7.0 | ACS 6.2 | | ACA 1.9 | ADF 3.6.0 | ACS 6.2 | | ACA 1.8 | ADF 3.3.0 | ACS 6.1 | | ACA 1.7 | ADF 3.0.0 | ACS 6.1 | @@ -100,6 +101,7 @@ Read up on our guidelines for [contributing] and then check out one of our issue | 1.8 | Extensibility improvements | Various - see [release notes](https://github.com/Alfresco/alfresco-content-app/releases) for details | | 1.9 | Single Log Out | Users will be automatically logged out from the Content App after logging out from another application in the same browser session | | 1.9 | Accessibility improvements | Various - see [release notes](https://github.com/Alfresco/alfresco-content-app/releases) for details | + 1.10 | Create (file/folder) from template | Users can create files and folders structures from pre-set templates | [contributing]: https://github.com/Alfresco/alfresco-content-app/blob/master/CONTRIBUTING.md [github]: https://github.com/Alfresco/alfresco-content-app/issues diff --git a/alfresco-js-api b/alfresco-js-api new file mode 160000 index 000000000..a7e88e552 --- /dev/null +++ b/alfresco-js-api @@ -0,0 +1 @@ +Subproject commit a7e88e55269df1969c98340516290555738df18b diff --git a/alfresco-ng2-components b/alfresco-ng2-components new file mode 160000 index 000000000..94e02c055 --- /dev/null +++ b/alfresco-ng2-components @@ -0,0 +1 @@ +Subproject commit 94e02c0552bf1cfd84af87a92fbf237ee75e5744 diff --git a/docker-compose-keycloak.yml b/docker-compose-keycloak.yml deleted file mode 100644 index 9ef10c92c..000000000 --- a/docker-compose-keycloak.yml +++ /dev/null @@ -1,210 +0,0 @@ -version: '2' - -services: - alfresco: - image: alfresco/alfresco-content-repository-community:latest - mem_limit: 1500m - depends_on: - - auth - environment: - HOST_IP: ${HOST_IP} - JAVA_OPTS: ' - -Ddb.driver=org.postgresql.Driver - -Ddb.username=alfresco - -Ddb.password=alfresco - -Ddb.url=jdbc:postgresql://postgres:5432/alfresco - -Dsolr.host=solr6 - -Dsolr.port=8983 - -Dsolr.secureComms=none - -Dsolr.base.url=/solr - -Dindex.subsystem.name=solr6 - -Dshare.host=localhost - -Dalfresco.port=8080 - -Daos.baseUrlOverwrite=http://${HOST_IP}:8080/alfresco/aos - -Dmessaging.broker.url="failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true" - -Ddeployment.method=DOCKER_COMPOSE - -Dcsrf.filter.enabled=false - -Xms1g -Xmx1g - - -Dlocal.transform.service.enabled=true - -DlocalTransform.pdfrenderer.url=http://alfresco-pdf-renderer:8090/ - -DlocalTransform.imagemagick.url=http://imagemagick:8090/ - -DlocalTransform.libreoffice.url=http://libreoffice:8090/ - -DlocalTransform.tika.url=http://tika:8090/ - -DlocalTransform.misc.url=http://transform-misc:8090/ - - -Dlegacy.transform.service.enabled=true - -Dalfresco-pdf-renderer.url=http://alfresco-pdf-renderer:8090/ - -Djodconverter.url=http://libreoffice:8090/ - -Dimg.url=http://imagemagick:8090/ - -Dtika.url=http://tika:8090/ - -Dtransform.misc.url=http://transform-misc:8090/ - - -Dauthentication.chain=identity-service1:identity-service,alfrescoNtlm1:alfrescoNtlm - -Didentity-service.enable-basic-auth=true - -Didentity-service.authentication.validation.failure.silent=false - -Didentity-service.auth-server-url=http://${HOST_IP}:8085/auth - -Didentity-service.realm=alfresco - -Didentity-service.resource=alfresco - ' - networks: - - internal - ports: - - 8080:8080 #Browser port - - alfresco-pdf-renderer: - image: alfresco/alfresco-pdf-renderer:2.1.0-EA4 - environment: - JAVA_OPTS: ' -Xms256m -Xmx256m' - networks: - - internal - ports: - - 8090:8090 - - imagemagick: - image: alfresco/alfresco-imagemagick:2.1.0-EA4 - environment: - JAVA_OPTS: ' -Xms256m -Xmx256m' - networks: - - internal - ports: - - 8091:8090 - - libreoffice: - image: alfresco/alfresco-libreoffice:2.1.0-EA4 - environment: - JAVA_OPTS: ' -Xms256m -Xmx256m' - networks: - - internal - ports: - - 8092:8090 - - tika: - image: alfresco/alfresco-tika:2.1.0-EA4 - environment: - JAVA_OPTS: ' -Xms256m -Xmx256m' - networks: - - internal - ports: - - 8093:8090 - - transform-misc: - image: alfresco/alfresco-transform-misc:2.1.0-EA4 - environment: - JAVA_OPTS: ' -Xms256m -Xmx256m' - networks: - - internal - ports: - - 8094:8090 - - share: - image: alfresco/alfresco-share:6.1.0-RC3 - mem_limit: 1g - depends_on: - - alfresco - environment: - - REPO_HOST=alfresco - - REPO_PORT=8080 - - 'CATALINA_OPTS= -Xms500m -Xmx500m' - networks: - - internal - ports: - - 8083:8080 - - postgres: - image: postgres:10.1 - mem_limit: 1500m - environment: - - POSTGRES_PASSWORD=alfresco - - POSTGRES_USER=alfresco - - POSTGRES_DB=alfresco - command: postgres -c max_connections=300 -c log_min_messages=LOG - networks: - - internal - ports: - - 5432:5432 - - solr6: - image: alfresco/alfresco-search-services:1.3.0-RC2 - mem_limit: 2500m - depends_on: - - alfresco - environment: - #Solr needs to know how to register itself with Alfresco - - SOLR_ALFRESCO_HOST=alfresco - - SOLR_ALFRESCO_PORT=8080 - #Alfresco needs to know how to call solr - - SOLR_SOLR_HOST=solr6 - - SOLR_SOLR_PORT=8983 - #Create the default alfresco and archive cores - - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive - - 'SOLR_JAVA_MEM=-Xms2g -Xmx2g' - networks: - - internal - ports: - - 8983:8983 #Browser port - - activemq: - image: alfresco/alfresco-activemq:5.15.6 - mem_limit: 2048m - networks: - - internal - ports: - - 8161:8161 # Web Console - - 5672:5672 # AMQP - - 61616:61616 # OpenWire - - 61613:61613 # STOMP - - content-app: - image: alfresco/alfresco-content-app:latest - build: . - environment: - # BASEPATH: ./ - APP_CONFIG_OAUTH2_HOST: ${APP_CONFIG_OAUTH2_HOST} - APP_CONFIG_AUTH_TYPE: ${APP_CONFIG_AUTH_TYPE} - APP_CONFIG_OAUTH2_CLIENTID: ${APP_CONFIG_OAUTH2_CLIENTID} - APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI: ${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI} - APP_CONFIG_OAUTH2_REDIRECT_LOGIN: ${APP_CONFIG_OAUTH2_REDIRECT_LOGIN} - APP_CONFIG_OAUTH2_REDIRECT_LOGOUT: ${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT} - networks: - - internal - depends_on: - - alfresco - ports: - - 4001:80 - # volumes: - # - ./app.config.json:/usr/share/nginx/html/app.config.json - # - ./nginx.conf:/etc/nginx/conf.d/default.conf - - proxy: - image: nginx:stable-alpine - depends_on: - - content-app - - alfresco - volumes: - - ./docker/proxy/nginx.conf:/etc/nginx/conf.d/default.conf - networks: - - internal - links: - - content-app - - alfresco - - share - ports: - - 8080:8080 - - auth: - image: jboss/keycloak:4.8.3.Final - volumes: - - ./docker/auth/alfresco-realm.json:/tmp/alfresco-realm.json - networks: - - internal - environment: - - KEYCLOAK_USER=admin - - KEYCLOAK_PASSWORD=admin - - KEYCLOAK_IMPORT=/tmp/alfresco-realm.json - - DB_VENDOR=h2 - ports: - - 8085:8080 - -networks: - internal: diff --git a/docker-compose.yml b/docker-compose.yml index a110f11ad..8eb77ff1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: alfresco: image: alfresco/alfresco-content-repository-community:latest mem_limit: 1500m + depends_on: + - auth volumes: - ./docker/acs-cm:/usr/local/tomcat/shared/classes/alfresco/extension environment: @@ -37,6 +39,14 @@ services: -Dtika.url=http://tika:8090/ -Dtransform.misc.url=http://transform-misc:8090/ -Dcsrf.filter.enabled=false + + -Didentity-service.enable-basic-auth=true + -Didentity-service.authentication.validation.failure.silent=false + -Didentity-service.auth-server-url=http://${HOST_IP}:8085/auth + -Didentity-service.realm=alfresco + -Didentity-service.resource=alfresco + + ${AIMS_PROPS} -Xms1500m -Xmx1500m ' @@ -132,6 +142,15 @@ services: build: . depends_on: - alfresco + environment: + BASE_PATH: ./ + APP_CONFIG_OAUTH2_HOST: ${APP_CONFIG_OAUTH2_HOST} + APP_CONFIG_AUTH_TYPE: ${APP_CONFIG_AUTH_TYPE} + APP_CONFIG_OAUTH2_CLIENTID: ${APP_CONFIG_OAUTH2_CLIENTID} + APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI: ${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI} + APP_CONFIG_OAUTH2_REDIRECT_LOGIN: ${APP_CONFIG_OAUTH2_REDIRECT_LOGIN} + APP_CONFIG_OAUTH2_REDIRECT_LOGOUT: ${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT} + APP_BASE_SHARE_URL: '{protocol}//{hostname}{:port}/content-app/#/preview/s' ports: - 4001:8080 @@ -148,3 +167,15 @@ services: - alfresco - share - content-app + + auth: + image: jboss/keycloak:4.8.3.Final + volumes: + - ./docker/auth/alfresco-realm.json:/tmp/alfresco-realm.json + environment: + - KEYCLOAK_USER=admin + - KEYCLOAK_PASSWORD=admin + - KEYCLOAK_IMPORT=/tmp/alfresco-realm.json + - DB_VENDOR=h2 + ports: + - 8085:8080 diff --git a/docker/proxy/nginx.conf b/docker/proxy/nginx.conf index 25f275517..a98763ab3 100644 --- a/docker/proxy/nginx.conf +++ b/docker/proxy/nginx.conf @@ -26,7 +26,11 @@ http { proxy_pass_header Set-Cookie; location / { - proxy_pass http://content-app:8080; + proxy_pass http://alfresco:8080; + } + + location /content-app/ { + proxy_pass http://content-app:8080/; } location /alfresco/ { diff --git a/docs/extending/application-actions.md b/docs/extending/application-actions.md index cd48959b2..4e14b50b3 100644 --- a/docs/extending/application-actions.md +++ b/docs/extending/application-actions.md @@ -124,3 +124,6 @@ Below is the list of public actions types you can use in the plugin definitions | 1.8.0 | VIEW_NODE | NodeId<`string`> , [ViewNodeExtras](../features/file-viewer.md#details)<`any`> | Lightweight preview of a node by id. Can be invoked from extensions. For details also see [File Viewer](../features/file-viewer.md#details) | | 1.8.0 | CLOSE_PREVIEW | n/a | Closes the viewer ( preview of the item ) | | 1.9.0 | RESET_SELECTION | n/a | Resets active document list selection | +| 1.10.0 | FILE_FROM_TEMPLATE | n/a | Invoke dialogs flow for creating a file from a template into current folder | +| 1.10.0 | FOLDER_FROM_TEMPLATE | n/a | Invoke dialogs flow for creating a folder structure from a template into current folder | +| 1.10.0 | CONTEXT_MENU | MouseEvent | Invoke context menu for [DocumentListComponent](https://www.alfresco.com/abn/adf/docs/content-services/components/document-list.component) | diff --git a/docs/extending/rules.md b/docs/extending/rules.md index 7096c6c3d..7ca46ea0b 100644 --- a/docs/extending/rules.md +++ b/docs/extending/rules.md @@ -166,6 +166,8 @@ The button will be visible only when the linked rule evaluates to `true`. | 1.8.0 | canManagePermissions | Checks if user can manage permissions for the selected node. | | 1.8.0 | canToggleEditOffline | Checks if user can toggle **Edit Offline** mode for selected node. | | 1.8.0 | user.isAdmin | Checks if user is admin. | +| 1.9.0 | app.canShowLanguagePicker | Whether language picker menu should be present or not. | +| 1.9.0 | app.canShowLogout | Whether logout action should be present or not. | ## Navigation Evaluators diff --git a/docs/ja/README.md b/docs/ja/README.md index b2806a1c2..3b64127cd 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -25,6 +25,7 @@ Alfresco Content Application は、[Alfresco Application Development Framework ( | ACA バージョン | 構築バージョン | テスト済み環境 | | ----------- | ---------- | --------- | +| ACA 1.9 | ADF 3.6.0 | ACS 6.2 | | ACA 1.8 | ADF 3.3.0 | ACS 6.1 | | ACA 1.7 | ADF 3.0.0 | ACS 6.1 | | ACA 1.6 | ADF 2.6.1 | ACS 6.1 | diff --git a/e2e/components/breadcrumb/breadcrumb.ts b/e2e/components/breadcrumb/breadcrumb.ts index b32e29c22..2cb117f42 100755 --- a/e2e/components/breadcrumb/breadcrumb.ts +++ b/e2e/components/breadcrumb/breadcrumb.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -36,7 +36,7 @@ export class Breadcrumb extends Component { items: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item)); currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(Breadcrumb.selectors.root, ancestor); } diff --git a/e2e/components/breadcrumb/dropdown-breadcrumb.ts b/e2e/components/breadcrumb/dropdown-breadcrumb.ts new file mode 100755 index 000000000..9a5cbed69 --- /dev/null +++ b/e2e/components/breadcrumb/dropdown-breadcrumb.ts @@ -0,0 +1,77 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { Component } from '../component'; + +export class DropDownBreadcrumb extends Component { + private static selectors = { + root: '.adf-dropdown-breadcrumb', + trigger: '.adf-dropdown-breadcrumb-trigger', + + currentFolder: '.adf-current-folder', + + pathOption: '.adf-dropdown-breadcrumb-path-option .mat-option-text' + }; + + trigger: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.trigger)); + pathItems: ElementArrayFinder = browser.$$(DropDownBreadcrumb.selectors.pathOption); + pathItemsContainer: ElementFinder = browser.element(by.css('.mat-select-panel')); + currentFolder: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.currentFolder)); + + constructor(ancestor?: string) { + super(DropDownBreadcrumb.selectors.root, ancestor); + } + + async waitForPathListDropdownToOpen(): Promise { + await browser.wait(EC.presenceOf(this.pathItemsContainer), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to open'); + } + + async waitForPathListDropdownToClose(): Promise { + await browser.wait(EC.stalenessOf(browser.$(DropDownBreadcrumb.selectors.pathOption)), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to close'); + } + + async getCurrentFolderName(): Promise { + return this.currentFolder.getText(); + } + + async openPath(): Promise { + await this.trigger.click(); + await this.waitForPathListDropdownToOpen(); + } + + async clickPathItem(name: string): Promise { + const elem = browser.element(by.cssContainingText(DropDownBreadcrumb.selectors.pathOption, name)); + await elem.click(); + } + + async getPathItems(): Promise { + const items: string[] = await this.pathItems.map(async elem => { + return elem.getText(); + }); + return items; + } +} diff --git a/e2e/components/component.ts b/e2e/components/component.ts index a4153987c..6a43ea35e 100755 --- a/e2e/components/component.ts +++ b/e2e/components/component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -29,11 +29,11 @@ import { BROWSER_WAIT_TIMEOUT } from '../configs'; export abstract class Component { component: ElementFinder; - constructor(selector: string, ancestor?: ElementFinder) { + constructor(selector: string, ancestor?: string) { const locator = selector; this.component = ancestor - ? ancestor.$$(locator).first() + ? browser.$$(ancestor).first().$$(locator).first() : browser.$$(locator).first(); } diff --git a/e2e/components/components.ts b/e2e/components/components.ts index 252410cb3..9407625f5 100755 --- a/e2e/components/components.ts +++ b/e2e/components/components.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index 19f244641..054bb1c73 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -34,11 +34,11 @@ export class DataTable extends Component { root: 'adf-datatable', head: '.adf-datatable-header', - columnHeader: '.adf-datatable-row .adf-datatable-cell-header', + columnHeader: '.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value', sortedColumnHeader: ` - .adf-datatable__header--sorted-asc, - .adf-datatable__header--sorted-desc - `, + .adf-datatable__header--sorted-asc .adf-datatable-cell-value, + .adf-datatable__header--sorted-desc .adf-datatable-cell-value + `, body: '.adf-datatable-body', row: '.adf-datatable-row[role]', @@ -57,7 +57,6 @@ export class DataTable extends Component { emptyListTitle: '.adf-empty-content__title', emptyListSubtitle: '.adf-empty-content__subtitle', - emptyListText: '.adf-empty-content__text', emptySearchText: '.empty-search__text', @@ -73,60 +72,59 @@ export class DataTable extends Component { emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop)); emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle)); emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle)); - emptyListText: ElementArrayFinder = this.component.all(by.css(DataTable.selectors.emptyListText)); emptySearchText: ElementFinder = this.component.element(by.css(DataTable.selectors.emptySearchText)); menu: Menu = new Menu(); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(DataTable.selectors.root, ancestor); } // Wait methods (waits for elements) - async waitForHeader() { + async waitForHeader(): Promise { await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---'); } - async waitForBody() { + async waitForBody(): Promise { await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---'); } - async waitForEmptyState() { + async waitForEmptyState(): Promise { await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT); } // Header/Column methods - getColumnHeaders() { + getColumnHeaders(): ElementArrayFinder { const locator = by.css(DataTable.selectors.columnHeader); return this.head.all(locator); } - async getColumnHeadersText() { + async getColumnHeadersText(): Promise { const el = this.getColumnHeaders(); return el.getText(); } - getNthColumnHeader(nth: number) { + getNthColumnHeader(nth: number): ElementFinder { return this.getColumnHeaders().get(nth - 1); } - getColumnHeaderByLabel(label: string) { + getColumnHeaderByLabel(label: string): ElementFinder { const locator = by.cssContainingText(DataTable.selectors.columnHeader, label); return this.head.element(locator); } - getSortedColumnHeader() { + getSortedColumnHeader(): ElementFinder { const locator = by.css(DataTable.selectors.sortedColumnHeader); return this.head.element(locator); } - async getSortedColumnHeaderText() { + async getSortedColumnHeaderText(): Promise { return this.getSortedColumnHeader().getText(); } async getSortingOrder(): Promise { - const str = await this.getSortedColumnHeader().getAttribute('class'); + const str = await this.getSortedColumnHeader().element(by.xpath('..')).getAttribute('class'); if (str.includes('asc')) { return 'asc'; } @@ -138,7 +136,7 @@ export class DataTable extends Component { return 'none'; } - async sortByColumn(columnName: string) { + async sortByColumn(columnName: string): Promise { const column = this.getColumnHeaderByLabel(columnName); const click = browser.actions().mouseMove(column).click(); @@ -146,27 +144,38 @@ export class DataTable extends Component { } // Rows methods - getRows() { + getRows(): ElementArrayFinder { return this.body.all(by.css(DataTable.selectors.row)); } - async countRows() { + async getRowsCount(): Promise { return this.getRows().count(); } - getSelectedRows() { + async waitForRowToBeSelected(): Promise { + await browser.wait(EC.presenceOf(this.component.element(by.css(DataTable.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for row to be selected'); + } + + getSelectedRows(): ElementArrayFinder { return this.body.all(by.css(DataTable.selectors.selectedRow)); } - async countSelectedRows() { + async getSelectedRowsNames(): Promise { + const rowsText: string[] = await this.getSelectedRows().map((row) => { + return row.element(by.css('.adf-datatable-cell[title="Name"]')).getText(); + }); + return rowsText; + } + + async getSelectedRowsCount(): Promise { return this.getSelectedRows().count(); } - getNthRow(nth: number) { + getNthRow(nth: number): ElementFinder { return this.getRows().get(nth - 1); } - getRowByName(name: string, location: string = '') { + getRowByName(name: string, location: string = ''): ElementFinder { if (location) { return this.body.all(by.cssContainingText(DataTable.selectors.row, name)) .filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.cell, location)))) @@ -175,46 +184,46 @@ export class DataTable extends Component { return this.body.element(by.cssContainingText(DataTable.selectors.row, name)); } - getRowCells(name: string, location: string = '') { + getRowCells(name: string, location: string = ''): ElementArrayFinder { return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell)); } - async getRowCellsCount(itemName: string) { + async getRowCellsCount(itemName: string): Promise { return this.getRowCells(itemName).count(); } - getRowFirstCell(name: string, location: string = '') { + getRowFirstCell(name: string, location: string = ''): ElementFinder { return this.getRowCells(name, location).get(0); } - getRowNameCell(name: string, location: string = '') { + getRowNameCell(name: string, location: string = ''): ElementFinder { return this.getRowCells(name, location).get(1); } - getRowNameCellSpan(name: string, location: string = '') { + getRowNameCellSpan(name: string, location: string = ''): ElementFinder { return this.getRowNameCell(name, location).$('span'); } - async getItemNameTooltip(name: string, location: string = '') { + async getItemNameTooltip(name: string, location: string = ''): Promise { return this.getRowNameCellSpan(name, location).getAttribute('title'); } - async hasCheckMarkIcon(itemName: string, location: string = '') { - const row = this.getRowByName(itemName, location); + async hasCheckMarkIcon(itemName: string, location: string = ''): Promise { + const row: ElementFinder = this.getRowByName(itemName, location); return row.element(by.css(DataTable.selectors.selectedIcon)).isPresent(); } - async hasLockIcon(itemName: string, location: string = '') { - const row = this.getRowByName(itemName, location); + async hasLockIcon(itemName: string, location: string = ''): Promise { + const row: ElementFinder = this.getRowByName(itemName, location); return row.element(by.css(DataTable.selectors.lockIcon)).isPresent(); } - async hasLockOwnerInfo(itemName: string, location: string = '') { - const row = this.getRowByName(itemName, location); + async hasLockOwnerInfo(itemName: string, location: string = ''): Promise { + const row: ElementFinder = this.getRowByName(itemName, location); return row.element(by.css(DataTable.selectors.lockOwner)).isPresent(); } - async getLockOwner(itemName: string, location: string = '') { + async getLockOwner(itemName: string, location: string = ''): Promise { if (await this.hasLockOwnerInfo(itemName, location)) { const row = this.getRowByName(itemName, location); return row.$(DataTable.selectors.lockOwner).$('.locked_by--name').getText(); @@ -222,16 +231,16 @@ export class DataTable extends Component { return ''; } - getNameLink(itemName: string) { + getNameLink(itemName: string): ElementFinder { return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink); } - async hasLinkOnName(itemName: string) { + async hasLinkOnName(itemName: string): Promise { return this.getNameLink(itemName).isPresent(); } // Navigation/selection methods - async doubleClickOnRowByName(name: string, location: string = '') { + async doubleClickOnRowByName(name: string, location: string = ''): Promise { try { const item = this.getRowFirstCell(name, location); await Utils.waitUntilElementClickable(item); @@ -242,7 +251,7 @@ export class DataTable extends Component { } } - async selectItem(name: string, location: string = '') { + async selectItem(name: string, location: string = ''): Promise { const isSelected = await this.hasCheckMarkIcon(name, location); if (!isSelected) { try { @@ -253,30 +262,42 @@ export class DataTable extends Component { console.log('--- select item catch : ', e); } } - } - async clickItem(name: string, location: string = '') { + async unselectItem(name: string, location: string = ''): Promise { + const isSelected = await this.hasCheckMarkIcon(name, location); + if (isSelected) { + try { + const item = this.getRowFirstCell(name, location); + await item.click(); + + } catch (e) { + console.log('--- unselect item catch : ', e); + } + } + } + + async clickItem(name: string, location: string = ''): Promise { const item = this.getRowFirstCell(name, location); await item.click(); } - async clickNameLink(itemName: string) { + async clickNameLink(itemName: string): Promise { await this.getNameLink(itemName).click(); } - async selectMultipleItems(names: string[], location: string = '') { + async selectMultipleItems(names: string[], location: string = ''): Promise { await this.clearSelection(); - await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); + await Utils.pressCmd(); for (const name of names) { await this.selectItem(name, location); } - await browser.actions().sendKeys(protractor.Key.NULL).perform(); + await Utils.releaseKeyPressed(); } - async clearSelection() { + async clearSelection(): Promise { try { - const count = await this.countSelectedRows(); + const count = await this.getSelectedRowsCount(); if (count !== 0) { await browser.refresh(); await this.wait(); @@ -286,27 +307,27 @@ export class DataTable extends Component { } } - async rightClickOnItem(itemName: string) { + async rightClickOnItem(itemName: string): Promise { const item = this.getRowFirstCell(itemName); await browser.actions().mouseMove(item).perform(); await browser.actions().click(protractor.Button.RIGHT).perform(); } - async rightClickOnMultipleSelection() { + async rightClickOnMultipleSelection(): Promise { const itemFromSelection = this.getSelectedRows().get(0); await browser.actions().mouseMove(itemFromSelection).perform(); await browser.actions().click(protractor.Button.RIGHT).perform(); } - getItemLocationEl(name: string) { + getItemLocationEl(name: string): ElementFinder { return this.getRowByName(name).element(by.css(DataTable.selectors.locationLink)); } - async getItemLocation(name: string) { + async getItemLocation(name: string): Promise { return this.getItemLocationEl(name).getText(); } - async getItemLocationTooltip(name: string) { + async getItemLocationTooltip(name: string): Promise { const location = this.getItemLocationEl(name).$('a'); const condition = () => location.getAttribute('title').then(value => value && value.length > 0); @@ -316,16 +337,16 @@ export class DataTable extends Component { return location.getAttribute('title'); } - async clickItemLocation(name: string) { + async clickItemLocation(name: string): Promise { await this.getItemLocationEl(name).click(); } // empty state methods - async isEmptyList() { + async isEmpty(): Promise { return this.emptyList.isPresent(); } - async isEmptyWithDragAndDrop() { + async isEmptyWithDragAndDrop(): Promise { return this.emptyFolderDragAndDrop.isDisplayed(); } @@ -334,66 +355,68 @@ export class DataTable extends Component { if (isEmpty) { return this.emptyFolderDragAndDrop.getText(); } - return ''; } async getEmptyStateTitle(): Promise { - const isEmpty = await this.isEmptyList(); + const isEmpty = await this.isEmpty(); if (isEmpty) { return this.emptyListTitle.getText(); } - return ''; } async getEmptyStateSubtitle(): Promise { - const isEmpty = await this.isEmptyList(); + const isEmpty = await this.isEmpty(); if (isEmpty) { return this.emptyListSubtitle.getText(); } - return ''; } - async getEmptyStateText(): Promise { - const isEmpty = await this.isEmptyList(); + async getEmptyListText(): Promise { + const isEmpty = await this.isEmpty(); if (isEmpty) { - return this.emptyListText.getText(); + return this.component.element(by.css('adf-custom-empty-content-template')).getText(); } - return ''; } - async getEmptySearchResultsText() { + async getEmptySearchResultsText(): Promise { return this.emptySearchText.getText(); } - async getCellsContainingName(name: string) { - const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); - return rows.map(async cell => await cell.getText()); + async getCellsContainingName(name: string): Promise { + const rows: ElementArrayFinder = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); + const cellsText: string[] = await rows.map(async cell => { + return cell.getText(); + }); + return cellsText; } - async hasContextMenu() { + async hasContextMenu(): Promise { const count = await this.menu.getItemsCount(); return count > 0; } - async getLibraryRole(name: string) { + async getLibraryRole(name: string): Promise { return this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText(); } - async isItemPresent(name: string, location? : string) { + async isItemPresent(name: string, location? : string): Promise { return this.getRowByName(name, location).isPresent(); } - async getEntireDataTableText() { - return this.getRows().map((row) => { - return row.all(by.css(DataTable.selectors.cell)).map(async cell => await cell.getText()); + async getEntireDataTableText(): Promise { + const text: string[] = await this.getRows().map((row) => { + return row.all(by.css(DataTable.selectors.cell)).map(async cell => { + return cell.getText(); + }); }); + return text; } - async getSitesNameAndVisibility() { + async getSitesNameAndVisibility(): Promise<{}> { const data = await this.getEntireDataTableText(); return data.reduce((acc, cell) => { acc[cell[1]] = cell[3].toUpperCase(); @@ -401,7 +424,7 @@ export class DataTable extends Component { }, {}); } - async getSitesNameAndRole() { + async getSitesNameAndRole(): Promise<{}> { const data = await this.getEntireDataTableText(); return data.reduce((acc, cell) => { acc[cell[1]] = cell[2]; @@ -409,7 +432,15 @@ export class DataTable extends Component { }, {}); } - getSearchResultsRowByName(name: string, location: string = '') { + getSearchResultsRows(): ElementArrayFinder { + return this.body.all(by.css(DataTable.selectors.searchResultsRow)); + } + + getNthSearchResultsRow(nth: number): ElementFinder { + return this.getSearchResultsRows().get(nth - 1); + } + + getSearchResultsRowByName(name: string, location: string = ''): ElementFinder { if (location) { return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name)) .filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location)))) @@ -418,43 +449,43 @@ export class DataTable extends Component { return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name)); } - getSearchResultRowLines(name: string, location: string = '') { + getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder { return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine)); } - async getSearchResultLinesCount(name: string, location: string = '') { + async getSearchResultLinesCount(name: string, location: string = ''): Promise { return this.getSearchResultRowLines(name, location).count(); } - getSearchResultNthLine(name: string, location: string = '', index: number) { + getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder { return this.getSearchResultRowLines(name, location).get(index); } - async getSearchResultNameAndTitle(name: string, location: string = '') { + async getSearchResultNameAndTitle(name: string, location: string = ''): Promise { return this.getSearchResultNthLine(name, location, 0).getText(); } - async getSearchResultDescription(name: string, location: string = '') { + async getSearchResultDescription(name: string, location: string = ''): Promise { return this.getSearchResultNthLine(name, location, 1).getText(); } - async getSearchResultModified(name: string, location: string = '') { + async getSearchResultModified(name: string, location: string = ''): Promise { return this.getSearchResultNthLine(name, location, 2).getText(); } - async getSearchResultLocation(name: string, location: string = '') { + async getSearchResultLocation(name: string, location: string = ''): Promise { return this.getSearchResultNthLine(name, location, 3).getText(); } - getSearchResultNameLink(itemName: string, location: string = '') { + getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder { return this.getSearchResultsRowByName(itemName, location).$(DataTable.selectors.searchResultsNameLink); } - async hasLinkOnSearchResultName(itemName: string, location: string = '') { + async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise { return this.getSearchResultNameLink(itemName, location).isPresent(); } - async clickSearchResultNameLink(itemName: string, location: string = '') { + async clickSearchResultNameLink(itemName: string, location: string = ''): Promise { await this.getSearchResultNameLink(itemName, location).click(); } diff --git a/e2e/components/datetime-picker/datetime-picker.ts b/e2e/components/datetime-picker/datetime-picker.ts index 6716c635b..c23eafbce 100755 --- a/e2e/components/datetime-picker/datetime-picker.ts +++ b/e2e/components/datetime-picker/datetime-picker.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -48,7 +48,7 @@ export class DateTimePicker extends Component { headerYear: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.year)); dayPicker: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.dayPicker)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(DateTimePicker.selectors.root, ancestor); } diff --git a/e2e/components/dialog/confirm-dialog.ts b/e2e/components/dialog/confirm-dialog.ts index 0c008ec05..9bed516b9 100755 --- a/e2e/components/dialog/confirm-dialog.ts +++ b/e2e/components/dialog/confirm-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -44,7 +44,7 @@ export class ConfirmDialog extends Component { cancelButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.cancel)); actionButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.actionButton)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(ConfirmDialog.selectors.root, ancestor); } diff --git a/e2e/components/dialog/content-node-selector-dialog.ts b/e2e/components/dialog/content-node-selector-dialog.ts new file mode 100755 index 000000000..0bac88b04 --- /dev/null +++ b/e2e/components/dialog/content-node-selector-dialog.ts @@ -0,0 +1,157 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { Component } from '../component'; +import { Utils } from '../../utilities/utils'; +import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; +import { DataTable } from '../data-table/data-table'; + +export class ContentNodeSelectorDialog extends Component { + private static selectors = { + root: '.adf-content-node-selector-dialog', + + title: '.mat-dialog-title', + locationDropDown: 'site-dropdown-container', + locationOption: '.mat-option .mat-option-text', + + dataTable: '.adf-datatable-body', + selectedRow: '.adf-is-selected', + + button: '.mat-dialog-actions button', + chooseAction: '.adf-choose-action', + + searchInput: '#searchInput', + toolbarTitle: '.adf-toolbar-title' + }; + + title: ElementFinder = this.component.element(by.css(ContentNodeSelectorDialog.selectors.title)); + locationDropDown: ElementFinder = this.component.element(by.id(ContentNodeSelectorDialog.selectors.locationDropDown)); + locationPersonalFiles: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'Personal Files')); + locationFileLibraries: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'File Libraries')); + + cancelButton: ElementFinder = this.component.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.button, 'Cancel')); + copyButton: ElementFinder = this.component.element(by.css(ContentNodeSelectorDialog.selectors.chooseAction)); + moveButton: ElementFinder = this.component.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.button, 'Move')); + + searchInput: ElementFinder = this.component.element(by.css(ContentNodeSelectorDialog.selectors.searchInput)); + toolbarTitle: ElementFinder = this.component.element(by.css(ContentNodeSelectorDialog.selectors.toolbarTitle)); + + breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb(); + dataTable: DataTable = new DataTable(ContentNodeSelectorDialog.selectors.root); + + constructor(ancestor?: string) { + super(ContentNodeSelectorDialog.selectors.root, ancestor); + } + + async waitForDialogToOpen(): Promise { + await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT, 'timeout waiting for dialog title'); + await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for overlay backdrop'); + } + + async waitForDialogToClose(): Promise { + await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT); + } + + async waitForDropDownToOpen(): Promise { + await browser.wait(EC.presenceOf(this.locationPersonalFiles), BROWSER_WAIT_TIMEOUT); + } + + async waitForDropDownToClose(): Promise { + await browser.wait(EC.stalenessOf(browser.$(ContentNodeSelectorDialog.selectors.locationOption)), BROWSER_WAIT_TIMEOUT); + } + + async waitForRowToBeSelected(): Promise { + await browser.wait(EC.presenceOf(this.component.element(by.css(ContentNodeSelectorDialog.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT); + } + + async isDialogOpen(): Promise { + return browser.$(ContentNodeSelectorDialog.selectors.root).isDisplayed(); + } + + async getTitle(): Promise { + return this.title.getText(); + } + + async clickCancel(): Promise { + await this.cancelButton.click(); + await this.waitForDialogToClose(); + } + + async clickCopy(): Promise { + await this.copyButton.click(); + } + + async clickMove(): Promise { + await this.moveButton.click(); + } + + async selectLocation(location: 'Personal Files' | 'File Libraries'): Promise { + await this.locationDropDown.click(); + await this.waitForDropDownToOpen(); + + if (location === 'Personal Files') { + await this.locationPersonalFiles.click(); + } else { + await this.locationFileLibraries.click(); + } + + await this.waitForDropDownToClose(); + } + + async selectDestination(folderName: string): Promise { + const row = this.dataTable.getRowByName(folderName); + await Utils.waitUntilElementClickable(row); + await row.click(); + await this.waitForRowToBeSelected(); + } + + async isSearchInputPresent(): Promise { + return await this.searchInput.isPresent(); + } + + async isSelectLocationDropdownDisplayed(): Promise { + return (await this.locationDropDown.isPresent()) && (await this.locationDropDown.isDisplayed()); + } + + async isCopyButtonEnabled(): Promise { + return (await this.copyButton.isPresent()) && (await this.copyButton.isEnabled()); + } + + async isCancelButtonEnabled(): Promise { + return (await this.cancelButton.isPresent()) && (await this.cancelButton.isEnabled()); + } + + async searchFor(text: string): Promise { + await Utils.clearFieldWithBackspace(this.searchInput); + await this.searchInput.sendKeys(text); + await this.searchInput.sendKeys(protractor.Key.ENTER); + } + + async getToolbarTitle(): Promise { + return await this.toolbarTitle.getText(); + } +} diff --git a/e2e/components/dialog/copy-move-dialog.ts b/e2e/components/dialog/copy-move-dialog.ts deleted file mode 100755 index 6f5321c46..000000000 --- a/e2e/components/dialog/copy-move-dialog.ts +++ /dev/null @@ -1,131 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; -import { Component } from '../component'; -import { Utils } from './../../utilities/utils'; - -export class CopyMoveDialog extends Component { - private static selectors = { - root: '.adf-content-node-selector-dialog', - - title: '.mat-dialog-title', - content: '.mat-dialog-content', - locationDropDown: 'site-dropdown-container', - locationOption: '.mat-option .mat-option-text', - - dataTable: '.adf-datatable-body', - row: '.adf-datatable-row[role]', - selectedRow: '.adf-is-selected', - - button: '.mat-dialog-actions button' - }; - - title: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.title)); - content: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.content)); - dataTable: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.dataTable)); - locationDropDown: ElementFinder = this.component.element(by.id(CopyMoveDialog.selectors.locationDropDown)); - locationPersonalFiles: ElementFinder = browser.element(by.cssContainingText(CopyMoveDialog.selectors.locationOption, 'Personal Files')); - locationFileLibraries: ElementFinder = browser.element(by.cssContainingText(CopyMoveDialog.selectors.locationOption, 'File Libraries')); - - row: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.row)); - - cancelButton: ElementFinder = this.component.element(by.cssContainingText(CopyMoveDialog.selectors.button, 'Cancel')); - copyButton: ElementFinder = this.component.element(by.cssContainingText(CopyMoveDialog.selectors.button, 'Copy')); - moveButton: ElementFinder = this.component.element(by.cssContainingText(CopyMoveDialog.selectors.button, 'Move')); - - constructor(ancestor?: ElementFinder) { - super(CopyMoveDialog.selectors.root, ancestor); - } - - async waitForDialogToClose() { - await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT); - } - - async waitForDropDownToOpen() { - await browser.wait(EC.presenceOf(this.locationPersonalFiles), BROWSER_WAIT_TIMEOUT); - } - - async waitForDropDownToClose() { - await browser.wait(EC.stalenessOf(browser.$(CopyMoveDialog.selectors.locationOption)), BROWSER_WAIT_TIMEOUT); - } - - async waitForRowToBeSelected() { - await browser.wait(EC.presenceOf(this.component.element(by.css(CopyMoveDialog.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT); - } - - async isDialogOpen() { - return browser.$(CopyMoveDialog.selectors.root).isDisplayed(); - } - - async getTitle() { - return this.title.getText(); - } - - async clickCancel() { - await this.cancelButton.click(); - await this.waitForDialogToClose(); - } - - async clickCopy() { - await this.copyButton.click(); - } - - async clickMove() { - await this.moveButton.click(); - } - - getRow(folderName: string) { - return this.dataTable.element(by.cssContainingText('.adf-name-location-cell', folderName)); - } - - async doubleClickOnRow(name: string) { - const item = this.getRow(name); - await Utils.waitUntilElementClickable(item); - await browser.actions().mouseMove(item).perform(); - await browser.actions().click().click().perform(); - } - - async selectLocation(location: 'Personal Files' | 'File Libraries') { - await this.locationDropDown.click(); - await this.waitForDropDownToOpen(); - - if (location === 'Personal Files') { - await this.locationPersonalFiles.click(); - } else { - await this.locationFileLibraries.click(); - } - - await this.waitForDropDownToClose(); - } - - async selectDestination(folderName: string) { - const row = this.getRow(folderName); - await Utils.waitUntilElementClickable(row); - await row.click(); - await this.waitForRowToBeSelected(); - } -} diff --git a/e2e/components/dialog/create-edit-folder-dialog.ts b/e2e/components/dialog/create-edit-folder-dialog.ts index 467404bae..d19d7a5df 100755 --- a/e2e/components/dialog/create-edit-folder-dialog.ts +++ b/e2e/components/dialog/create-edit-folder-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -47,7 +47,7 @@ export class CreateOrEditFolderDialog extends Component { updateButton: ElementFinder = this.component.element(by.cssContainingText(CreateOrEditFolderDialog.selectors.button, 'Update')); validationMessage: ElementFinder = this.component.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(CreateOrEditFolderDialog.selectors.root, ancestor); } @@ -68,8 +68,8 @@ export class CreateOrEditFolderDialog extends Component { return this.title.getText(); } - async isValidationMessageDisplayed() { - return this.validationMessage.isDisplayed(); + async isValidationMessageDisplayed(): Promise { + return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed()); } async isUpdateButtonEnabled() { @@ -92,9 +92,12 @@ export class CreateOrEditFolderDialog extends Component { return this.descriptionTextArea.isDisplayed(); } - async getValidationMessage() { - await this.isValidationMessageDisplayed(); - return this.validationMessage.getText(); + async getValidationMessage(): Promise { + if (await this.isValidationMessageDisplayed()) { + return this.validationMessage.getText(); + } else { + return ''; + } } async getName() { diff --git a/e2e/components/dialog/create-from-template-dialog.ts b/e2e/components/dialog/create-from-template-dialog.ts new file mode 100755 index 000000000..c98b245b5 --- /dev/null +++ b/e2e/components/dialog/create-from-template-dialog.ts @@ -0,0 +1,140 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, browser, protractor, ExpectedConditions as EC } from 'protractor'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { Component } from '../component'; + +export class CreateFromTemplateDialog extends Component { + private static selectors = { + root: '.aca-create-from-template-dialog', + + title: '.mat-dialog-title', + nameInput: 'input[placeholder="Name" i]', + titleInput: 'input[placeholder="Title" i]', + descriptionTextArea: 'textarea[placeholder="Description" i]', + button: '.mat-dialog-actions button', + validationMessage: '.mat-error' + }; + + title: ElementFinder = this.component.element(by.css(CreateFromTemplateDialog.selectors.title)); + nameInput: ElementFinder = this.component.element(by.css(CreateFromTemplateDialog.selectors.nameInput)); + titleInput: ElementFinder = this.component.element(by.css(CreateFromTemplateDialog.selectors.titleInput)); + descriptionTextArea: ElementFinder = this.component.element(by.css(CreateFromTemplateDialog.selectors.descriptionTextArea)); + createButton: ElementFinder = this.component.element(by.cssContainingText(CreateFromTemplateDialog.selectors.button, 'Create')); + cancelButton: ElementFinder = this.component.element(by.cssContainingText(CreateFromTemplateDialog.selectors.button, 'CANCEL')); + validationMessage: ElementFinder = this.component.element(by.css(CreateFromTemplateDialog.selectors.validationMessage)); + + constructor(ancestor?: string) { + super(CreateFromTemplateDialog.selectors.root, ancestor); + } + + async waitForDialogToOpen(): Promise { + await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT, 'timeout waiting for dialog title'); + await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for overlay backdrop'); + } + + async waitForDialogToClose(): Promise { + await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for dialog to close ----'); + } + + async isDialogOpen(): Promise { + return browser.isElementPresent(by.css(CreateFromTemplateDialog.selectors.root)); + } + + async getTitle(): Promise { + return this.title.getText(); + } + + async isValidationMessageDisplayed(): Promise { + return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed()); + } + + async isCreateButtonEnabled(): Promise { + return this.createButton.isEnabled(); + } + + async isCancelButtonEnabled(): Promise { + return this.cancelButton.isEnabled(); + } + + async isNameFieldDisplayed(): Promise { + return this.nameInput.isDisplayed(); + } + + async isTitleFieldDisplayed(): Promise { + return this.titleInput.isDisplayed(); + } + + async isDescriptionFieldDisplayed(): Promise { + return this.descriptionTextArea.isDisplayed(); + } + + async getValidationMessage(): Promise { + if (await this.isValidationMessageDisplayed()) { + return this.validationMessage.getText(); + } else { + return ''; + } + } + + async getName(): Promise { + return this.nameInput.getAttribute('value'); + } + + async getDescription(): Promise { + return this.descriptionTextArea.getAttribute('value'); + } + + async enterName(name: string): Promise { + await this.nameInput.clear(); + await this.nameInput.sendKeys(name); + } + + async enterTitle(title: string): Promise { + await this.titleInput.clear(); + await this.titleInput.sendKeys(title); + } + + async enterDescription(description: string): Promise { + await this.descriptionTextArea.clear(); + await this.descriptionTextArea.sendKeys(description); + } + + async deleteNameWithBackspace(): Promise { + await this.nameInput.clear(); + await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE); + } + + async clickCreate(): Promise { + await this.createButton.click(); + } + + async clickCancel(): Promise { + await this.cancelButton.click(); + await this.waitForDialogToClose(); + } + +} diff --git a/e2e/components/dialog/create-library-dialog.ts b/e2e/components/dialog/create-library-dialog.ts index c6929acf9..897c76d40 100755 --- a/e2e/components/dialog/create-library-dialog.ts +++ b/e2e/components/dialog/create-library-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -53,7 +53,7 @@ export class CreateLibraryDialog extends Component { cancelButton: ElementFinder = this.component.element(by.cssContainingText(CreateLibraryDialog.selectors.button, 'Cancel')); errorMessage: ElementFinder = this.component.element(by.css(CreateLibraryDialog.selectors.errorMessage)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(CreateLibraryDialog.selectors.root, ancestor); } diff --git a/e2e/components/dialog/manage-versions-dialog.ts b/e2e/components/dialog/manage-versions-dialog.ts index 15e4e3ca0..16eebbd1f 100755 --- a/e2e/components/dialog/manage-versions-dialog.ts +++ b/e2e/components/dialog/manage-versions-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -40,7 +40,7 @@ export class ManageVersionsDialog extends Component { content: ElementFinder = this.component.element(by.css(ManageVersionsDialog.selectors.content)); closeButton: ElementFinder = this.component.element(by.cssContainingText(ManageVersionsDialog.selectors.button, 'Close')); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(ManageVersionsDialog.selectors.root, ancestor); } diff --git a/e2e/components/dialog/password-dialog.ts b/e2e/components/dialog/password-dialog.ts index f451e9288..2ab7ce5e7 100755 --- a/e2e/components/dialog/password-dialog.ts +++ b/e2e/components/dialog/password-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -45,7 +45,7 @@ export class PasswordDialog extends Component { closeButton: ElementFinder = this.component.element(by.buttonText('Close')); submitButton: ElementFinder = this.component.element(by.buttonText('Submit')); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(PasswordDialog.selectors.root, ancestor); } @@ -58,7 +58,13 @@ export class PasswordDialog extends Component { } async isDialogOpen() { - return browser.isElementPresent(by.css(PasswordDialog.selectors.root)); + try { + const dialog = await browser.wait(until.elementLocated(by.css(PasswordDialog.selectors.root)), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for dialog') + return dialog.isDisplayed(); + } catch (error) { + return false; + } + } async getTitle() { diff --git a/e2e/components/dialog/select-template-dialog.ts b/e2e/components/dialog/select-template-dialog.ts new file mode 100755 index 000000000..39acbada4 --- /dev/null +++ b/e2e/components/dialog/select-template-dialog.ts @@ -0,0 +1,86 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { Component } from '../component'; +import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; +import { DataTable } from '../data-table/data-table'; + +export class SelectTemplateDialog extends Component { + private static selectors = { + root: '.aca-template-node-selector-dialog', + title: '.mat-dialog-title', + button: '.mat-dialog-actions button' + }; + + title: ElementFinder = this.component.element(by.css(SelectTemplateDialog.selectors.title)); + nextButton: ElementFinder = this.component.element(by.cssContainingText(SelectTemplateDialog.selectors.button, 'Next')); + cancelButton: ElementFinder = this.component.element(by.cssContainingText(SelectTemplateDialog.selectors.button, 'Cancel')); + + breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb(); + dataTable: DataTable = new DataTable(SelectTemplateDialog.selectors.root); + + constructor(ancestor?: string) { + super(SelectTemplateDialog.selectors.root, ancestor); + } + + async waitForDialogToOpen(): Promise { + await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT, 'timeout waiting for dialog title'); + await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for overlay backdrop'); + } + + async waitForDialogToClose(): Promise { + await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for dialog to close ----'); + } + + async isDialogOpen(): Promise { + return browser.isElementPresent(by.css(SelectTemplateDialog.selectors.root)); + } + + async getTitle(): Promise { + return this.title.getText(); + } + + // action buttons + + async isCancelButtonEnabled(): Promise { + return this.cancelButton.isEnabled(); + } + + async isNextButtonEnabled(): Promise { + return this.nextButton.isEnabled(); + } + + async clickCancel(): Promise { + await this.cancelButton.click(); + await this.waitForDialogToClose(); + } + + async clickNext(): Promise { + await this.nextButton.click(); + await this.waitForDialogToClose(); + } +} diff --git a/e2e/components/dialog/share-dialog.ts b/e2e/components/dialog/share-dialog.ts index c7c284158..e9da01d9c 100755 --- a/e2e/components/dialog/share-dialog.ts +++ b/e2e/components/dialog/share-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -58,7 +58,7 @@ export class ShareDialog extends Component { closeButton: ElementFinder = this.component.element(by.css(ShareDialog.selectors.button)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(ShareDialog.selectors.root, ancestor); } diff --git a/e2e/components/dialog/upload-new-version-dialog.ts b/e2e/components/dialog/upload-new-version-dialog.ts index 2e88c17da..3d9279875 100755 --- a/e2e/components/dialog/upload-new-version-dialog.ts +++ b/e2e/components/dialog/upload-new-version-dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -51,7 +51,7 @@ export class UploadNewVersionDialog extends Component { description: ElementFinder = this.component.element(by.css(UploadNewVersionDialog.selectors.descriptionTextArea)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(UploadNewVersionDialog.selectors.root, ancestor); } diff --git a/e2e/components/header/header.ts b/e2e/components/header/header.ts index 9cfed3b87..3faf45cf1 100755 --- a/e2e/components/header/header.ts +++ b/e2e/components/header/header.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -47,12 +47,12 @@ export class Header extends Component { moreActions: ElementFinder = browser.element(Header.selectors.moreActions); sidenavToggle: ElementFinder = this.component.element(by.css(Header.selectors.sidenavToggle)); - userInfo: UserInfo = new UserInfo(this.component); + userInfo: UserInfo = new UserInfo(); menu: Menu = new Menu(); toolbar: Toolbar = new Toolbar(); searchInput: SearchInput = new SearchInput(); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super('adf-layout-header', ancestor); } diff --git a/e2e/components/header/user-info.ts b/e2e/components/header/user-info.ts index 71c77b548..88a3c9b93 100755 --- a/e2e/components/header/user-info.ts +++ b/e2e/components/header/user-info.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -39,7 +39,7 @@ export class UserInfo extends Component { menu: Menu = new Menu(); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super('aca-current-user', ancestor); } diff --git a/e2e/components/info-drawer/info-drawer-comments-tab.ts b/e2e/components/info-drawer/info-drawer-comments-tab.ts index 8f8f5da49..5c5f8b877 100755 --- a/e2e/components/info-drawer/info-drawer-comments-tab.ts +++ b/e2e/components/info-drawer/info-drawer-comments-tab.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -58,7 +58,7 @@ export class CommentsTab extends Component { commentTime = by.id(CommentsTab.selectors.commentTime); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(CommentsTab.selectors.root, ancestor); } diff --git a/e2e/components/info-drawer/info-drawer-metadata-content.ts b/e2e/components/info-drawer/info-drawer-metadata-content.ts index dda4a77ba..f9e836fc7 100755 --- a/e2e/components/info-drawer/info-drawer-metadata-content.ts +++ b/e2e/components/info-drawer/info-drawer-metadata-content.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -53,7 +53,7 @@ export class ContentMetadata extends Component { imagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`)); expandedImagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(ContentMetadata.selectors.root, ancestor); } diff --git a/e2e/components/info-drawer/info-drawer-metadata-library.ts b/e2e/components/info-drawer/info-drawer-metadata-library.ts index b60546f37..047d2b13c 100755 --- a/e2e/components/info-drawer/info-drawer-metadata-library.ts +++ b/e2e/components/info-drawer/info-drawer-metadata-library.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -58,7 +58,7 @@ export class LibraryMetadata extends Component { error: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.error)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(LibraryMetadata.selectors.root, ancestor); } diff --git a/e2e/components/info-drawer/info-drawer.ts b/e2e/components/info-drawer/info-drawer.ts index fe9f65663..3caf2854b 100755 --- a/e2e/components/info-drawer/info-drawer.ts +++ b/e2e/components/info-drawer/info-drawer.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, $ } from 'protractor'; +import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { Component } from '../component'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { CommentsTab } from './info-drawer-comments-tab'; @@ -48,9 +48,9 @@ export class InfoDrawer extends Component { headerTitle: '.adf-info-drawer-layout-header-title' }; - commentsTab = new CommentsTab($(InfoDrawer.selectors.root)); - aboutTab = new LibraryMetadata($(InfoDrawer.selectors.root)); - propertiesTab = new ContentMetadata($(InfoDrawer.selectors.root)); + commentsTab = new CommentsTab(InfoDrawer.selectors.root); + aboutTab = new LibraryMetadata(InfoDrawer.selectors.root); + propertiesTab = new ContentMetadata(InfoDrawer.selectors.root); header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header)); headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle)); @@ -64,7 +64,7 @@ export class InfoDrawer extends Component { previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(InfoDrawer.selectors.root, ancestor); } diff --git a/e2e/components/login/login.ts b/e2e/components/login/login.ts index 3c7f4cd42..cd7872e28 100755 --- a/e2e/components/login/login.ts +++ b/e2e/components/login/login.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -45,7 +45,7 @@ export class LoginComponent extends Component { copyright: ElementFinder = this.component.element(LoginComponent.selectors.copyright); passwordVisibility: ElementFinder = this.component.element(LoginComponent.selectors.passwordVisibility); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(LoginComponent.selectors.root, ancestor); } diff --git a/e2e/components/menu/menu.ts b/e2e/components/menu/menu.ts index 408eedaaf..e6b44d3a6 100755 --- a/e2e/components/menu/menu.ts +++ b/e2e/components/menu/menu.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -33,7 +33,15 @@ export class Menu extends Component { root: '.mat-menu-panel', item: '.mat-menu-item', icon: '.mat-icon', - uploadFiles: 'app-upload-files', + + uploadFilesInput: 'app-upload-files', + + uploadFile: 'app.create.uploadFile', + uploadFolder: 'app.create.uploadFolder', + createFolder: 'app.create.folder', + createLibrary: 'app.create.library', + createFileFromTemplate: 'app.create.fileFromTemplate', + createFolderFromTemplate: 'app.create.folderFromTemplate', submenu: 'app-context-menu-item .mat-menu-item', @@ -46,14 +54,20 @@ export class Menu extends Component { items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item)); backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop')); - uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles)); + + uploadFilesInput: ElementFinder = browser.element(by.id(Menu.selectors.uploadFilesInput)); submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu)); + uploadFileAction: ElementFinder = this.component.element(by.id(Menu.selectors.uploadFile)); + uploadFolderAction: ElementFinder = this.component.element(by.id(Menu.selectors.uploadFolder)); + createFolderAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFolder)); + createLibraryAction: ElementFinder = this.component.element(by.id(Menu.selectors.createLibrary)); + createFileFromTemplateAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFileFromTemplate)); + createFolderFromTemplateAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFolderFromTemplate)); + cancelEditingAction: ElementFinder = this.component.element(by.css(Menu.selectors.cancelEditing)); cancelJoinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Cancel Join')); copyAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Copy')); - createFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create Folder')); - createLibraryAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create Library')); deleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Delete')); downloadAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Download')); editFolderAction: ElementFinder = this.component.element(by.css(Menu.selectors.editFolder)); @@ -72,69 +86,88 @@ export class Menu extends Component { restoreAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Restore')); shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Share')); shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Shared Link Settings')); - uploadFileAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload File')); - uploadFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload Folder')); viewAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View')); viewDetailsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View Details')); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(Menu.selectors.root, ancestor); } - async waitForMenuToOpen() { + async waitForMenuToOpen(): Promise { await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT); } - async waitForMenuToClose() { + async waitForMenuToClose(): Promise { await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')))), BROWSER_WAIT_TIMEOUT); } - async closeMenu() { + async closeMenu(): Promise { await Utils.pressEscape(); await this.waitForMenuToClose(); } - getNthItem(nth: number) { + getNthItem(nth: number): ElementFinder { return this.items.get(nth - 1); } - getItemByLabel(menuItem: string) { + getItemByLabel(menuItem: string): ElementFinder { return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem)); } - getSubItemByLabel(subMenuItem: string) { + getSubItemByLabel(subMenuItem: string): ElementFinder { return this.component.element(by.cssContainingText(Menu.selectors.submenu, subMenuItem)); } - getItemById(id: string) { + getItemById(id: string): ElementFinder { return this.component.element(by.id(id)); } - async getItemTooltip(menuItem: string) { + async getItemTooltip(menuItem: string): Promise { return this.getItemByLabel(menuItem).getAttribute('title'); } - async getItemIconText(menuItem: string) { + async getTooltipForUploadFile(): Promise { + return this.getItemTooltip('Upload File'); + } + + async getTooltipForUploadFolder(): Promise { + return this.getItemTooltip('Upload Folder'); + } + + async getTooltipForCreateFolder(): Promise { + return this.getItemTooltip('Create Folder'); + } + + async getTooltipForCreateLibrary(): Promise { + return this.getItemTooltip('Create Library'); + } + + async getTooltipForCreateFileFromTemplate(): Promise { + return this.getItemTooltip('Create file from template'); + } + + async getItemIconText(menuItem: string): Promise { return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText(); } - async getItemIdAttribute(menuItem: string) { + async getItemIdAttribute(menuItem: string): Promise { return this.getItemByLabel(menuItem).getAttribute('id'); } - async getItemsCount() { + async getItemsCount(): Promise { return this.items.count(); } async getMenuItems(): Promise { - return this.items.map(async (elem) => { - const text = await elem.element(by.css('span')).getText(); - return text; + const items: string[] = await this.items.map(async (elem) => { + const span: ElementFinder = elem.element(by.css('span')); + return span.getText(); }); + return items; } - async clickNthItem(nth: number) { + async clickNthItem(nth: number): Promise { try { const elem = this.getNthItem(nth); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable'); @@ -146,7 +179,7 @@ export class Menu extends Component { } } - async clickMenuItem(menuItem: string) { + async clickMenuItem(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable'); @@ -156,7 +189,7 @@ export class Menu extends Component { } } - async mouseOverMenuItem(menuItem: string) { + async mouseOverMenuItem(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); @@ -179,7 +212,7 @@ export class Menu extends Component { } } - async clickSubMenuItem(subMenuItem: string) { + async clickSubMenuItem(subMenuItem: string): Promise { try { const elem = this.getSubItemByLabel(subMenuItem); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); @@ -189,15 +222,15 @@ export class Menu extends Component { } } - async isMenuItemPresent(title: string) { + async isMenuItemPresent(title: string): Promise { return browser.element(by.cssContainingText(Menu.selectors.item, title)).isPresent(); } - async isSubMenuItemPresent(title: string) { + async isSubMenuItemPresent(title: string): Promise { return browser.element(by.cssContainingText(Menu.selectors.submenu, title)).isPresent(); } - async getSubmenuItemsCount() { + async getSubmenuItemsCount(): Promise { return this.submenus.count(); } @@ -212,164 +245,157 @@ export class Menu extends Component { } } - uploadFile() { - return this.uploadFiles; + uploadFile(): ElementFinder { + return this.uploadFilesInput; } - async clickEditFolder() { + async clickEditFolder(): Promise { await this.editFolderAction.click(); } - async clickShare() { + async clickShare(): Promise { const action = this.shareAction; await action.click(); } - async clickSharedLinkSettings() { + async clickSharedLinkSettings(): Promise { const action = this.shareEditAction; await action.click(); } - - async isViewPresent() { + async isViewPresent(): Promise { return this.viewAction.isPresent(); } - async isDownloadPresent() { + async isDownloadPresent(): Promise { return this.downloadAction.isPresent(); } - async isEditFolderPresent() { + async isEditFolderPresent(): Promise { return this.editFolderAction.isPresent(); } - async isEditOfflinePresent() { + async isEditOfflinePresent(): Promise { return this.editOfflineAction.isPresent(); } - async isCancelEditingPresent() { + async isCancelEditingPresent(): Promise { return this.cancelEditingAction.isPresent(); } - async isCopyPresent() { + async isCopyPresent(): Promise { return this.copyAction.isPresent(); } - async isMovePresent() { + async isMovePresent(): Promise { return this.moveAction.isPresent(); } - async isDeletePresent() { + async isDeletePresent(): Promise { return this.deleteAction.isPresent(); } - async isManagePermissionsPresent() { + async isManagePermissionsPresent(): Promise { return this.managePermissionsAction.isPresent(); } - async isManageVersionsPresent() { + async isManageVersionsPresent(): Promise { return this.manageVersionsAction.isPresent(); } - async isUploadNewVersionPresent() { + async isUploadNewVersionPresent(): Promise { return this.uploadNewVersionAction.isPresent(); } - async isFavoritePresent() { + async isFavoritePresent(): Promise { return this.favoriteAction.isPresent(); } - async isRemoveFavoritePresent() { + async isRemoveFavoritePresent(): Promise { return this.removeFavoriteAction.isPresent(); } - async isToggleFavoritePresent() { + async isToggleFavoritePresent(): Promise { return this.toggleFavoriteAction.isPresent(); } - async isToggleRemoveFavoritePresent() { + async isToggleRemoveFavoritePresent(): Promise { return this.toggleRemoveFavoriteAction.isPresent(); } - async isJoinLibraryPresent() { + async isJoinLibraryPresent(): Promise { return this.joinAction.isPresent(); } - async isCancelJoinPresent() { + async isCancelJoinPresent(): Promise { return this.cancelJoinAction.isPresent(); } - async isLeaveLibraryPresent() { + async isLeaveLibraryPresent(): Promise { return this.leaveAction.isPresent(); } - async isPermanentDeletePresent() { + async isPermanentDeletePresent(): Promise { return this.permanentDeleteAction.isPresent(); } - async isRestorePresent() { + async isRestorePresent(): Promise { return this.restoreAction.isPresent(); } - async isSharePresent() { + async isSharePresent(): Promise { return this.shareAction.isPresent(); } - async isSharedLinkSettingsPresent() { + async isSharedLinkSettingsPresent(): Promise { return this.shareEditAction.isPresent(); } - async isViewDetailsPresent() { + async isViewDetailsPresent(): Promise { return this.viewDetailsAction.isPresent(); } - async isCreateFolderPresent() { - return this.createFolderAction.isPresent(); - } - async isCreateFolderEnabled() { - return this.createFolderAction.isEnabled(); + async isCreateFolderEnabled(): Promise { + return (await this.createFolderAction.isPresent()) && (await this.createFolderAction.isEnabled()); } - async isCreateLibraryPresent() { - return this.createLibraryAction.isPresent(); - } - async isCreateLibraryEnabled() { - return this.createLibraryAction.isEnabled(); + async isCreateLibraryEnabled(): Promise { + return (await this.createLibraryAction.isPresent()) && (await this.createLibraryAction.isEnabled()); } - async isUploadFilePresent() { - return this.uploadFileAction.isPresent(); - } - async isUploadFileEnabled() { - return this.uploadFileAction.isEnabled(); + async isUploadFileEnabled(): Promise { + return (await this.uploadFileAction.isPresent()) && (await this.uploadFileAction.isEnabled()); } - async isUploadFolderPresent() { - return this.uploadFolderAction.isPresent(); - } - async isUploadFolderEnabled() { - return this.uploadFolderAction.isEnabled(); + async isUploadFolderEnabled(): Promise { + return (await this.uploadFolderAction.isPresent()) && (await this.uploadFolderAction.isEnabled()); } + async isCreateFileFromTemplateEnabled(): Promise { + return (await this.createFileFromTemplateAction.isPresent()) && (await this.createFileFromTemplateAction.isEnabled()); + } - async clickCreateFolder() { + async isCreateFolderFromTemplateEnabled(): Promise { + return (await this.createFolderFromTemplateAction.isPresent()) && (await this.createFolderFromTemplateAction.isEnabled()); + } + + async clickCreateFolder(): Promise { const action = this.createFolderAction; await action.click(); } - async clickCreateLibrary() { + async clickCreateLibrary(): Promise { const action = this.createLibraryAction; await action.click(); } - async clickUploadFile() { - const action = this.uploadFileAction; + async clickCreateFileFromTemplate(): Promise { + const action = this.createFileFromTemplateAction; await action.click(); } - async clickUploadFolder() { - const action = this.uploadFolderAction; + async clickCreateFolderFromTemplate(): Promise { + const action = this.createFolderFromTemplateAction; await action.click(); } - } diff --git a/e2e/components/metadata-card/metadata-card.ts b/e2e/components/metadata-card/metadata-card.ts index b451bb380..3dfd5cd3e 100644 --- a/e2e/components/metadata-card/metadata-card.ts +++ b/e2e/components/metadata-card/metadata-card.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -39,7 +39,7 @@ export class MetadataCard extends Component { expandButton: ElementFinder = this.component.element(by.css(MetadataCard.selectors.expandButton)); expansionPanels: ElementArrayFinder = this.component.all(by.css(MetadataCard.selectors.expansionPanel)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(MetadataCard.selectors.root, ancestor); } diff --git a/e2e/components/pagination/pagination.ts b/e2e/components/pagination/pagination.ts index 49e05a198..1d118016b 100755 --- a/e2e/components/pagination/pagination.ts +++ b/e2e/components/pagination/pagination.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -53,7 +53,7 @@ export class Pagination extends Component { menu: Menu = new Menu(); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(Pagination.selectors.root, ancestor); } diff --git a/e2e/components/search/filters/created-date-filter.ts b/e2e/components/search/filters/created-date-filter.ts new file mode 100755 index 000000000..ed413039f --- /dev/null +++ b/e2e/components/search/filters/created-date-filter.ts @@ -0,0 +1,137 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, protractor } from 'protractor'; +import { GenericFilterPanel } from './generic-filter-panel'; +import { Utils } from '../../../utilities/utils'; + +export class CreatedDateFilter extends GenericFilterPanel { + constructor() { + super('Created date'); + } + + fromField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'From')); + fromInput: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-input']`)); + fromFieldError: ElementFinder = this.fromField.element(by.css(`[data-automation-id='date-range-from-error']`)); + toField: ElementFinder = this.panelExpanded.element(by.cssContainingText('.adf-search-date-range .mat-form-field', 'To')); + toInput: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-input']`)) + toFieldError: ElementFinder = this.toField.element(by.css(`[data-automation-id='date-range-to-error']`)) + clearButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-clear-btn"]')); + applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]')); + + async isFromFieldDisplayed(): Promise { + return (await this.fromField.isPresent()) && (await this.fromField.isDisplayed()); + } + + async isFromErrorDisplayed(): Promise { + return (await this.fromFieldError.isPresent()) && (await this.fromFieldError.isDisplayed()); + } + + async isToFieldDisplayed(): Promise { + return (await this.toField.isPresent()) && (await this.toField.isDisplayed()); + } + + async isToErrorDisplayed(): Promise { + return (await this.toFieldError.isPresent()) && (await this.toFieldError.isDisplayed()); + } + + async isClearButtonEnabled(): Promise { + return await this.clearButton.isEnabled(); + } + + async isApplyButtonEnabled(): Promise { + return await this.applyButton.isEnabled(); + } + + async clickClearButton(): Promise { + if ( await this.isClearButtonEnabled() ) { + await this.clearButton.click(); + } + } + + async clickApplyButton(): Promise { + if ( await this.isApplyButtonEnabled() ) { + await this.applyButton.click(); + } + } + + async getFromValue(): Promise { + try { + const value = await this.fromInput.getAttribute('value'); + return value; + } catch (error) { + return ''; + } + } + + async getFromError(): Promise { + try { + const error = await this.fromFieldError.getText(); + return error; + } catch (err) { + return ''; + } + } + + async getToValue(): Promise { + try { + const value = await this.toInput.getAttribute('value'); + return value; + } catch (err) { + return ''; + } + } + + async getToError(): Promise { + try { + const error = await this.toFieldError.getText(); + return error; + } catch (err) { + return ''; + } + } + + async resetPanel(): Promise { + const fromValue = await this.getFromValue(); + const toValue = await this.getToValue(); + if ( fromValue.length > 0 || toValue.length > 0 ) { + await this.expandPanel(); + await this.clickClearButton(); + await this.collapsePanel(); + } + } + + async enterFromDate(date: string): Promise { + await this.expandPanel(); + await Utils.clearFieldWithBackspace(this.fromInput); + await this.fromInput.sendKeys(date, protractor.Key.TAB); + } + + async enterToDate(date: string): Promise { + await this.expandPanel(); + await Utils.clearFieldWithBackspace(this.toInput); + await this.toInput.sendKeys(date, protractor.Key.TAB); + } +} diff --git a/e2e/components/search/filters/facet-filter.ts b/e2e/components/search/filters/facet-filter.ts new file mode 100755 index 000000000..42f196c30 --- /dev/null +++ b/e2e/components/search/filters/facet-filter.ts @@ -0,0 +1,96 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, ElementArrayFinder, by, browser } from 'protractor'; +import { GenericFilterPanel } from './generic-filter-panel'; + +export class FacetFilter extends GenericFilterPanel { + private readonly locators = { + checkbox: '.mat-checkbox', + checkboxChecked: '.mat-checkbox.mat-checkbox-checked', + button: '.adf-facet-buttons button', + categoryInput: 'input[placeholder="Filter category"', + facetsFilter: '.adf-facet-result-filter' + } + + get facets(): ElementArrayFinder { return this.panelExpanded.all(by.css(this.locators.checkbox)); } + get selectedFacets(): ElementArrayFinder { return this.panel.all(by.css(this.locators.checkboxChecked)); } + get clearButton(): ElementFinder { return this.panel.element(by.cssContainingText(this.locators.button, 'Clear all')); } + get facetsFilter(): ElementFinder { return this.panelExpanded.element(by.css(this.locators.facetsFilter)); } + get filterCategoryInput(): ElementFinder { return this.facetsFilter.element(by.css(this.locators.categoryInput)); } + + async getFiltersValues(): Promise { + const list: string[] = await this.facets.map(option => { + return option.getText(); + }); + return list; + } + + async getFiltersCheckedValues(): Promise { + const list: string[] = await this.selectedFacets.map(option => { + return option.getText(); + }); + return list; + } + + async resetPanel(): Promise { + if ( (await this.selectedFacets.count()) > 0 ) { + await this.expandPanel(); + await this.selectedFacets.each(async elem => { + await elem.click(); + }); + } + await this.expandPanel(); + } + + async isFilterFacetsDisplayed(): Promise { + return await this.facetsFilter.isDisplayed(); + } + + async isClearButtonEnabled(): Promise { + return await this.clearButton.isEnabled(); + } + + async clickClearButton(): Promise { + if ( await this.isClearButtonEnabled() ) { + await this.clearButton.click(); + } + } + + async isFilterCategoryInputDisplayed(): Promise { + return await this.filterCategoryInput.isDisplayed(); + } + + async checkCategory(name: string): Promise { + const option = this.facets.filter(async (elem) => (await elem.getText()).includes(name)).first(); + await browser.executeScript(`arguments[0].scrollIntoView();`, option); + await browser.actions().mouseMove(option).perform(); + await browser.actions().click().perform(); + } + + async filterCategoriesBy(name: string): Promise { + await this.filterCategoryInput.sendKeys(name); + } +} diff --git a/e2e/components/search/filters/generic-filter-panel.ts b/e2e/components/search/filters/generic-filter-panel.ts new file mode 100755 index 000000000..44648d04e --- /dev/null +++ b/e2e/components/search/filters/generic-filter-panel.ts @@ -0,0 +1,71 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, browser } from 'protractor'; + +export class GenericFilterPanel { + private filterName: string; + + constructor(filterName: string) { + this.filterName = filterName; + } + + private readonly selectors = { + root: 'adf-search-filter', + + panel: '.mat-expansion-panel', + panelExpanded: '.mat-expansion-panel.mat-expanded', + panelHeader: '.mat-expansion-panel-header' + } + + get panel(): ElementFinder { return browser.element(by.cssContainingText(this.selectors.panel, this.filterName)); } + get panelExpanded(): ElementFinder { return browser.element(by.cssContainingText(this.selectors.panelExpanded, this.filterName)); } + get panelHeader(): ElementFinder { return this.panel.element(by.css(this.selectors.panelHeader)); } + + async clickPanelHeader(): Promise { + await this.panelHeader.click(); + } + + async isPanelDisplayed(): Promise { + return (await browser.isElementPresent(this.panel)) && (await this.panel.isDisplayed()); + } + + async isPanelExpanded(): Promise { + return (await this.panelExpanded.isPresent()) && (await this.panelExpanded.isDisplayed()); + } + + async expandPanel(): Promise { + if ( !(await this.isPanelExpanded()) ) { + await this.clickPanelHeader(); + } + } + + async collapsePanel(): Promise { + if ( await this.isPanelExpanded() ) { + await this.clickPanelHeader(); + } + } + +} diff --git a/e2e/components/search/filters/size-filter.ts b/e2e/components/search/filters/size-filter.ts new file mode 100755 index 000000000..2c4caf76f --- /dev/null +++ b/e2e/components/search/filters/size-filter.ts @@ -0,0 +1,92 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, ElementArrayFinder } from 'protractor'; +import { GenericFilterPanel } from './generic-filter-panel'; + +export class SizeFilter extends GenericFilterPanel { + constructor() { + super('Size'); + } + + facets: ElementArrayFinder = this.panelExpanded.all(by.css('.mat-checkbox')); + selectedFacets: ElementArrayFinder = this.panel.all(by.css('.mat-checkbox.mat-checkbox-checked')); + clearButton: ElementFinder = this.panel.element(by.cssContainingText('.adf-facet-buttons button', 'Clear all')); + + async getFiltersValues(): Promise { + const list: string[] = await this.facets.map(option => { + return option.getText(); + }); + return list; + } + + async getFiltersCheckedValues(): Promise { + const list: string[] = await this.selectedFacets.map(option => { + return option.getText(); + }); + return list; + } + + async resetPanel(): Promise { + if ( (await this.selectedFacets.count()) > 0 ) { + await this.expandPanel(); + await this.selectedFacets.each(async elem => { + await elem.click(); + }); + } + await this.collapsePanel(); + } + + async isClearButtonEnabled(): Promise { + return await this.clearButton.isEnabled(); + } + + async clickClearButton(): Promise { + if ( await this.isClearButtonEnabled() ) { + await this.clearButton.click(); + } + } + + async checkSizeSmall(): Promise { + const small = this.facets.filter(async (elem) => await elem.getText() === 'Small').first(); + await small.click(); + } + + async checkSizeMedium(): Promise { + const medium = this.facets.filter(async (elem) => await elem.getText() === 'Medium').first(); + await medium.click(); + } + + async checkSizeLarge(): Promise { + const large = this.facets.filter(async (elem) => await elem.getText() === 'Large').first(); + await large.click(); + } + + async checkSizeHuge(): Promise { + const huge = this.facets.filter(async (elem) => await elem.getText() === 'Huge').first(); + await huge.click(); + } + +} diff --git a/e2e/components/search/search-filters.ts b/e2e/components/search/search-filters.ts new file mode 100755 index 000000000..271462fad --- /dev/null +++ b/e2e/components/search/search-filters.ts @@ -0,0 +1,60 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, browser } from 'protractor'; +import { Component } from '../component'; +import { SizeFilter } from './filters/size-filter'; +import { CreatedDateFilter } from './filters/created-date-filter'; +import { FacetFilter } from './filters/facet-filter'; + +export class SearchFilters extends Component { + private static selectors = { + root: 'adf-search-filter', + }; + + mainPanel: ElementFinder = browser.element(by.css(SearchFilters.selectors.root)); + resetAllButton: ElementFinder = this.component.element(by.cssContainingText('.mat-button', 'Reset all')); + + size = new SizeFilter(); + createdDate = new CreatedDateFilter(); + fileType = new FacetFilter('File type'); + creator = new FacetFilter('Creator'); + modifier = new FacetFilter('Modifier'); + location = new FacetFilter('Location'); + modifiedDate = new FacetFilter('Modified date'); + + constructor(ancestor?: string) { + super(SearchFilters.selectors.root, ancestor); + } + + async isSearchFiltersPanelDisplayed(): Promise { + return (await this.mainPanel.isPresent()) && (await this.mainPanel.isDisplayed()); + } + + async clickResetAllButton(): Promise { + await this.resetAllButton.click(); + } + +} diff --git a/e2e/components/search/search-input.ts b/e2e/components/search/search-input.ts index 091cb5046..c72a65dd6 100755 --- a/e2e/components/search/search-input.ts +++ b/e2e/components/search/search-input.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -34,7 +34,7 @@ export class SearchInput extends Component { searchContainer: '.app-search-container', searchButton: '.app-search-button', searchControl: '.app-search-control', - searchInput: 'app-control-input', + searchInput: `input[id='app-control-input']`, searchOptionsArea: 'search-options', optionCheckbox: '.mat-checkbox', clearButton: '.app-clear-icon' @@ -43,14 +43,14 @@ export class SearchInput extends Component { searchButton: ElementFinder = this.component.element(by.css(SearchInput.selectors.searchButton)); searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer)); searchControl: ElementFinder = browser.element(by.css(SearchInput.selectors.searchControl)); - searchBar: ElementFinder = browser.element(by.id(SearchInput.selectors.searchInput)); + searchInput: ElementFinder = browser.element(by.css(SearchInput.selectors.searchInput)); searchOptionsArea: ElementFinder = browser.element(by.id(SearchInput.selectors.searchOptionsArea)); searchFilesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Files')); searchFoldersOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Folders')); searchLibrariesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Libraries')); clearSearchButton: ElementFinder = this.searchContainer.$(SearchInput.selectors.clearButton); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(SearchInput.selectors.root, ancestor); } @@ -58,6 +58,10 @@ export class SearchInput extends Component { await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---'); } + async waitForSearchInputToBeInteractive() { + await browser.wait(EC.elementToBeClickable(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---'); + } + async isSearchContainerDisplayed() { return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed()); } @@ -162,9 +166,9 @@ export class SearchInput extends Component { } async searchFor(text: string) { - await browser.wait(EC.elementToBeClickable(this.searchBar), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for searchBar to be clickable'); - await this.searchBar.clear(); - await this.searchBar.sendKeys(text); - await this.searchBar.sendKeys(protractor.Key.ENTER); + await this.waitForSearchInputToBeInteractive(); + await Utils.clearFieldWithBackspace(this.searchInput); + await this.searchInput.sendKeys(text); + await this.searchInput.sendKeys(protractor.Key.ENTER); } } diff --git a/e2e/components/search/search-sorting-picker.ts b/e2e/components/search/search-sorting-picker.ts new file mode 100755 index 000000000..71ca87ca1 --- /dev/null +++ b/e2e/components/search/search-sorting-picker.ts @@ -0,0 +1,141 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; +import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { Component } from '../component'; + +export class SearchSortingPicker extends Component { + private static selectors = { + root: 'adf-search-sorting-picker', + + sortByOption: '.mat-option .mat-option-text' + }; + + sortOrderButton: ElementFinder = this.component.element(by.css('button[mat-icon-button]')); + sortByDropdownCollapsed: ElementFinder = this.component.element(by.css('.mat-select')); + sortByDropdownExpanded: ElementFinder = browser.element(by.css('.mat-select-panel')); + sortByList: ElementArrayFinder = this.sortByDropdownExpanded.all(by.css(SearchSortingPicker.selectors.sortByOption)); + + constructor(ancestor?: string) { + super(SearchSortingPicker.selectors.root, ancestor); + } + + async waitForSortByDropdownToExpand(): Promise { + await browser.wait(EC.visibilityOf(this.sortByDropdownExpanded), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for sortBy dropdown to expand'); + } + + async isSortOrderButtonDisplayed(): Promise { + return (await this.sortOrderButton.isPresent()) && (await this.sortOrderButton.isDisplayed()); + } + + async getSortOrder(): Promise<'ASC' | 'DESC' | ''> { + const orderArrow = await this.sortOrderButton.getText(); + + if ( orderArrow.includes('upward') ) { + return 'ASC' + } else if ( orderArrow.includes('downward') ) { + return 'DESC' + } else { + return ''; + } + } + + async isSortByOptionDisplayed(): Promise { + return (await this.sortByDropdownCollapsed.isPresent()) && (await this.sortByDropdownCollapsed.isDisplayed()); + } + + async isSortByDropdownExpanded(): Promise { + return (await this.sortByDropdownExpanded.isPresent()) && (await this.sortByDropdownExpanded.isDisplayed()); + } + + async getSelectedSortByOption(): Promise { + return await this.sortByDropdownCollapsed.getText(); + } + + async clickSortByDropdown(): Promise { + await this.sortByDropdownCollapsed.click(); + await this.waitForSortByDropdownToExpand(); + } + + async getSortByOptionsList(): Promise { + const list: string[] = await this.sortByList.map(async option => { + return option.getText(); + }); + return list; + } + + async sortByOption(option: string): Promise { + if ( !(await this.isSortByDropdownExpanded()) ) { + await this.clickSortByDropdown(); + } + const elem = browser.element(by.cssContainingText(SearchSortingPicker.selectors.sortByOption, option)); + await elem.click(); + } + + async sortByName(): Promise { + await this.sortByOption('Filename'); + } + + async sortByRelevance(): Promise { + await this.sortByOption('Relevance'); + } + + async sortByTitle(): Promise { + await this.sortByOption('Title'); + } + + async sortByModifiedDate(): Promise { + await this.sortByOption('Modified date'); + } + + async sortByModifier(): Promise { + await this.sortByOption('Modifier'); + } + + async sortByCreatedDate(): Promise { + await this.sortByOption('Created date'); + } + + async sortBySize(): Promise { + await this.sortByOption('Size'); + } + + async sortByType(): Promise { + await this.sortByOption('Type'); + } + + async setSortOrderASC(): Promise { + if ( (await this.getSortOrder()) !== 'ASC' ) { + await this.sortOrderButton.click(); + } + } + + async setSortOrderDESC(): Promise { + if ( (await this.getSortOrder()) !== 'DESC' ) { + await this.sortOrderButton.click(); + } + } +} diff --git a/e2e/components/sidenav/sidenav.ts b/e2e/components/sidenav/sidenav.ts index 6a57252b2..24b231f2f 100755 --- a/e2e/components/sidenav/sidenav.ts +++ b/e2e/components/sidenav/sidenav.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -55,6 +55,7 @@ export class Sidenav extends Component { links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link)); activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeClass)); + newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton)); personalFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.personalFiles)); @@ -68,11 +69,11 @@ export class Sidenav extends Component { menu: Menu = new Menu(); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(Sidenav.selectors.root, ancestor); } - private async expandMenu(name: string) { + private async expandMenu(name: string): Promise { try{ if (await element(by.cssContainingText('.mat-expanded', name)).isPresent()) { @@ -89,37 +90,45 @@ export class Sidenav extends Component { } } - async openNewMenu() { - const { menu, newButton } = this; - - await newButton.click(); - await menu.waitForMenuToOpen(); + async openNewMenu(): Promise { + await this.newButton.click(); + await this.menu.waitForMenuToOpen(); } - async openCreateFolderDialog() { + async openCreateFolderDialog(): Promise { await this.openNewMenu(); - await this.menu.clickMenuItem('Create Folder'); + await this.menu.clickCreateFolder(); } - async openCreateLibraryDialog() { + async openCreateLibraryDialog(): Promise { await this.openNewMenu(); - await this.menu.clickMenuItem('Create Library'); + await this.menu.clickCreateLibrary(); } - async isActive(name: string) { + async openCreateFileFromTemplateDialog(): Promise { + await this.openNewMenu(); + await this.menu.clickCreateFileFromTemplate(); + } + + async openCreateFolderFromTemplateDialog(): Promise { + await this.openNewMenu(); + await this.menu.clickCreateFolderFromTemplate(); + } + + async isActive(name: string): Promise { return (await this.getLinkLabel(name).getAttribute('class')).includes(Sidenav.selectors.activeClassName); } - async childIsActive(name: string) { + async childIsActive(name: string): Promise { const childClass = await this.getLinkLabel(name).element(by.css('span')).getAttribute('class'); return childClass.includes(Sidenav.selectors.activeChild); } - getLink(name: string) { + getLink(name: string): ElementFinder { return this.getLinkLabel(name).element(by.xpath('..')); } - getLinkLabel(name: string) { + getLinkLabel(name: string): ElementFinder { switch (name) { case 'Personal Files': return this.personalFiles; case 'File Libraries': return this.fileLibraries; @@ -133,37 +142,35 @@ export class Sidenav extends Component { } } - getActiveLink() { + getActiveLink(): ElementFinder { return this.activeLink; } - async getLinkTooltip(name: string) { + async getLinkTooltip(name: string): Promise { const link = this.getLinkLabel(name); - const condition = () => link.getAttribute('title').then(value => value && value.length > 0); await browser.actions().mouseMove(link).perform(); - await browser.wait(condition, BROWSER_WAIT_TIMEOUT); return link.getAttribute('title'); } - async clickLink(name: string) { + async clickLink(name: string): Promise { try{ const link = this.getLinkLabel(name); await Utils.waitUntilElementClickable(link); - return await link.click(); + await link.click(); } catch (error) { console.log('---- sidebar navigation clickLink catch error: ', error); } } - async isFileLibrariesMenuExpanded() { + async isFileLibrariesMenuExpanded(): Promise { return element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent(); } - async expandFileLibraries() { + async expandFileLibraries(): Promise { await this.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES); } diff --git a/e2e/components/toolbar/toolbar.ts b/e2e/components/toolbar/toolbar.ts index 7c5627512..e0e69dfdd 100755 --- a/e2e/components/toolbar/toolbar.ts +++ b/e2e/components/toolbar/toolbar.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -64,7 +64,7 @@ export class Toolbar extends Component { permanentlyDeleteButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.permanentlyDelete)); restoreButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.restore)); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(Toolbar.selectors.root, ancestor); } diff --git a/e2e/components/viewer/viewer.ts b/e2e/components/viewer/viewer.ts index ed6af6c02..43be053c4 100755 --- a/e2e/components/viewer/viewer.ts +++ b/e2e/components/viewer/viewer.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -50,9 +50,9 @@ export class Viewer extends Component { viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent)); pdfViewerContentPages: ElementArrayFinder = this.component.all(by.css(Viewer.selectors.pdfViewerContentPage)); - toolbar = new Toolbar(this.component); + toolbar = new Toolbar(Viewer.selectors.root); - constructor(ancestor?: ElementFinder) { + constructor(ancestor?: string) { super(Viewer.selectors.root, ancestor); } diff --git a/e2e/configs.ts b/e2e/configs.ts index 5d5414620..4ca9262c4 100755 --- a/e2e/configs.ts +++ b/e2e/configs.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/pages/browsing-page.ts b/e2e/pages/browsing-page.ts index f11b78f20..c3d86b06d 100755 --- a/e2e/pages/browsing-page.ts +++ b/e2e/pages/browsing-page.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -28,12 +28,12 @@ import { SIDEBAR_LABELS } from './../configs'; import { Page } from './page'; export class BrowsingPage extends Page { - header = new Header(this.app); - sidenav = new Sidenav(this.app); - toolbar = new Toolbar(this.app); - breadcrumb = new Breadcrumb(this.app); - dataTable = new DataTable(this.app); - pagination = new Pagination(this.app); + header = new Header(this.appRoot); + sidenav = new Sidenav(this.appRoot); + toolbar = new Toolbar(this.appRoot); + breadcrumb = new Breadcrumb(this.appRoot); + dataTable = new DataTable(this.appRoot); + pagination = new Pagination(this.appRoot); async signOut() { await this.header.userInfo.signOut(); diff --git a/e2e/pages/login-page.ts b/e2e/pages/login-page.ts index 4bcc34750..479defe76 100755 --- a/e2e/pages/login-page.ts +++ b/e2e/pages/login-page.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -29,7 +29,7 @@ import { Page } from './page'; import { ADMIN_USERNAME, ADMIN_PASSWORD, BROWSER_WAIT_TIMEOUT, APP_ROUTES } from '../configs'; export class LoginPage extends Page { - login: LoginComponent = new LoginComponent(this.app); + login: LoginComponent = new LoginComponent(this.appRoot); /** @override */ constructor() { diff --git a/e2e/pages/page.ts b/e2e/pages/page.ts index 541a271b7..eb05cc09b 100755 --- a/e2e/pages/page.ts +++ b/e2e/pages/page.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -29,7 +29,7 @@ import { Utils } from '../utilities/utils'; export abstract class Page { protected static locators = { - app: 'app-root', + root: 'app-root', layout: 'app-layout', overlay: '.cdk-overlay-container', dialogContainer: '.mat-dialog-container', @@ -42,7 +42,8 @@ export abstract class Page { genericErrorTitle: '.generic-error__title' }; - app: ElementFinder = browser.element(by.css(Page.locators.app)); + appRoot: string = Page.locators.root; + layout: ElementFinder = browser.element(by.css(Page.locators.layout)); overlay: ElementFinder = browser.element(by.css(Page.locators.overlay)); snackBar: ElementFinder = browser.element(by.css(Page.locators.snackBar)); diff --git a/e2e/pages/pages.ts b/e2e/pages/pages.ts index 1a2bd70d3..22950897c 100755 --- a/e2e/pages/pages.ts +++ b/e2e/pages/pages.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/pages/search-results-page.ts b/e2e/pages/search-results-page.ts index f45bb32aa..038c6663a 100755 --- a/e2e/pages/search-results-page.ts +++ b/e2e/pages/search-results-page.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,37 +23,53 @@ * along with Alfresco. If not, see . */ -import { browser, by } from 'protractor'; +import { browser, by, By, ElementFinder, ElementArrayFinder } from 'protractor'; import { BrowsingPage } from './browsing-page'; +import { SearchSortingPicker } from '../components/search/search-sorting-picker'; +import { SearchFilters } from '../components/search/search-filters'; export class SearchResultsPage extends BrowsingPage { private static selectors = { root: 'aca-search-results', - filter: 'adf-search-filter', - expansionPanel: 'mat-expansion-panel', - size: '#expansion-panel-SEARCH.CATEGORIES.SIZE', - createdDate: '#expansion-panel-SEARCH.CATEGORIES.CREATED_DATE', - modifiedDate: '#expansion-panel-SEARCH.CATEGORIES.MODIFIED_DATE', - fileType: '#expansion-panel-SEARCH.FACET_FIELDS.FILE_TYPE', - creator: '#expansion-panel-SEARCH.CATEGORIES.CREATOR', - modifier: '#expansion-panel-SEARCH.CATEGORIES.MODIFIER', - location: '#expansion-panel-SEARCH.CATEGORIES.LOCATION', - - resultsContent: 'adf-search-results__content', resultsContentHeader: '.adf-search-results__content-header', - resultsInfoText: 'adf-search-results--info-text', - resultsFacets: 'adf-search-results__facets', - - sortingPicker: 'adf-sorting-picker' + infoText: '.adf-search-results--info-text', + chipList: '.adf-search-chip-list', + chip: '.mat-chip', + chipCloseIcon: '.mat-chip-remove' }; - async waitForResults() { + root: ElementFinder = browser.element(by.css(SearchResultsPage.selectors.root)); + chipList: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.chipList)); + infoText: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.infoText)); + + sortingPicker = new SearchSortingPicker(SearchResultsPage.selectors.root); + filters = new SearchFilters(SearchResultsPage.selectors.root); + + async waitForResults(): Promise { await this.dataTable.waitForBody(); } - async getResultsHeader() { - return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText(); + async getResultsHeader(): Promise { + return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText(); + } + + async getResultsFoundText(): Promise { + return await this.infoText.getText(); + } + + async getResultsChipsValues(): Promise { + const chips: ElementArrayFinder = this.chipList.all(by.css(SearchResultsPage.selectors.chip)); + const chipsValues: string[] = await chips.map(async elem => { + return (await elem.getText()).replace(`\ncancel`, ''); + }); + return chipsValues; + } + + async removeChip(chipName: string): Promise { + const chip: ElementFinder = browser.element(By.cssContainingText(SearchResultsPage.selectors.chip, chipName)); + const closeChip: ElementFinder = chip.element(by.css(SearchResultsPage.selectors.chipCloseIcon)); + await closeChip.click(); } } diff --git a/e2e/suites/actions-available/files-folders/favorites.test.ts b/e2e/suites/actions-available/files-folders/favorites.test.ts deleted file mode 100755 index 2351ed679..000000000 --- a/e2e/suites/actions-available/files-folders/favorites.test.ts +++ /dev/null @@ -1,182 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File/folder actions : on Favorites : ', () => { - - const random = Utils.random(); - - const username = `user-${random}`; - - const parent = `parent-${random}`; let parentId; - - let fileDocxFavId, fileFavId, fileDocxSharedFavId, fileSharedFavId, fileFavLockedId, fileSharedFavLockedId; - let folderFavId, folderFav2Id; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id; - fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id; - fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id; - fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id; - fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id; - fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id; - - folderFavId = (await apis.user.nodes.createFolder(data.folderFav.name, parentId)).entry.id; - folderFav2Id = (await apis.user.nodes.createFolder(data.folderFav2.name, parentId)).entry.id; - await apis.user.favorites.addFavoriteById('folder', folderFavId); - await apis.user.favorites.addFavoriteById('folder', folderFav2Id); - - await apis.user.shared.shareFilesByIds([ - fileDocxSharedFavId, - fileSharedFavId, - fileSharedFavLockedId - ]); - - await apis.user.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await apis.user.nodes.lockFile(fileFavLockedId); - await apis.user.nodes.lockFile(fileSharedFavLockedId); - - await apis.user.favorites.waitForApi({ expect: 8 }); - await apis.user.shared.waitForApi({ expect: 3 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickFavoritesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('on a file', () => { - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.favoritesContextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.favoritesContextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesContextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.favoritesContextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.favoritesContextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesContextMenu); - }); - }); - - describe('on a folder', () => { - it('Folder favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.favoritesContextMenu); - }); - }); - - describe('on multiple selection', () => { - it('multiple files - [C280656]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('multiple locked files - [C297631]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('multiple folders - [C280664]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('both files and folders - [C280657]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - }); -}); diff --git a/e2e/suites/actions-available/files-folders/favorites.ts b/e2e/suites/actions-available/files-folders/favorites.ts new file mode 100755 index 000000000..bcda94375 --- /dev/null +++ b/e2e/suites/actions-available/files-folders/favorites.ts @@ -0,0 +1,106 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; +import { BrowsingPage } from '../../../pages/pages'; + +export function favoritesTests() { + const page = new BrowsingPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickFavoritesAndWait(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('on a file', () => { + + it('File Office, favorite - [C297618]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.toolbarPrimary, testData.fileDocxFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.favoritesContextMenu); + }); + + it('File favorite - [C280461]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.toolbarPrimary, testData.fileFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.favoritesContextMenu); + }); + + it('File Office, shared, favorite - [C297620]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.favoritesToolbarPrimary, testData.fileDocxSharedFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.favoritesContextMenu); + }); + + it('File shared, favorite - [C280462]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.favoritesToolbarPrimary, testData.fileSharedFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.favoritesContextMenu); + }); + + it('File favorite, locked - [C280463]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.toolbarPrimary, testData.fileFavLocked.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.favoritesContextMenu); + }); + + it('File shared, favorite, locked - [C280469]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.favoritesToolbarPrimary, testData.fileSharedFavLocked.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.favoritesContextMenu); + }); + }); + + describe('on a folder', () => { + it('Folder favorite - [C291817]', async () => { + await testUtil.checkToolbarActions(testData.folderFav.name, testData.folderFav.toolbarPrimary, testData.folderFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.folderFav.name, testData.folderFav.favoritesContextMenu); + }); + }); + + describe('on multiple selection', () => { + it('multiple files - [C280656]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('multiple locked files - [C297631]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileFavLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileFavLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('multiple folders - [C280664]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.folderFav.name, testData.folderFav2.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.folderFav.name, testData.folderFav2.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('both files and folders - [C280657]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileFav.name, testData.folderFav.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileFav.name, testData.folderFav.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + }); + }); +} diff --git a/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts b/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts new file mode 100644 index 000000000..d371c2369 --- /dev/null +++ b/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts @@ -0,0 +1,174 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { RepoClient } from '../../../utilities/repo-client/repo-client'; +import { Utils } from '../../../utilities/utils'; +import { AdminActions } from '../../../utilities/admin-actions'; +import { LoginPage } from '../../../pages/pages'; +import { FILES } from '../../../configs'; +import * as testData from './test-data'; +import { personalFilesTests } from './personal-files'; +import { recentFilesTests } from './recent-files'; +import { favoritesTests } from './favorites'; +import { searchResultsTests } from './search-results'; +import { sharedFilesTests } from './shared-files'; +import { viewerTests } from './viewer'; +import { trashTests } from './trash'; + +describe('Files / folders actions : ', () => { + const random = Utils.random(); + + const username = `user-${random}` + + const parent = `parent-${random}`; + + let parentId: string; + let fileDocxFavId: string; + let fileFavId: string; + let fileDocxSharedId: string; + let fileDocxSharedFavId: string; + let fileSharedId: string; + let fileSharedFavId: string; + let fileLockedId: string; + let fileFavLockedId: string; + let fileSharedLockedId: string; + let fileSharedFavLockedId: string; + let folderFavId: string; + let folderFav2Id: string; + let fileInTrashId: string; + let file2InTrashId: string; + let folderInTrashId: string; + let folder2InTrashId: string; + + const userApi = new RepoClient(username, username); + const adminApiActions = new AdminActions(); + + const loginPage = new LoginPage(); + + beforeAll(async () => { + await adminApiActions.createUser({ username }); + + parentId = (await userApi.nodes.createFolder(parent)).entry.id; + + await userApi.upload.uploadFileWithRename(FILES.docxFile, parentId, testData.fileDocx.name ); + fileDocxFavId = (await userApi.upload.uploadFileWithRename(FILES.docxFile, parentId, testData.fileDocxFav.name)).entry.id; + await userApi.nodes.createFile(testData.file.name, parentId); + fileFavId = (await userApi.nodes.createFile(testData.fileFav.name, parentId)).entry.id; + fileDocxSharedId = (await userApi.upload.uploadFileWithRename(FILES.docxFile, parentId, testData.fileDocxShared.name)).entry.id; + fileDocxSharedFavId = (await userApi.upload.uploadFileWithRename(FILES.docxFile, parentId, testData.fileDocxSharedFav.name)).entry.id; + fileSharedId = (await userApi.nodes.createFile(testData.fileShared.name, parentId)).entry.id; + fileSharedFavId = (await userApi.nodes.createFile(testData.fileSharedFav.name, parentId)).entry.id; + fileLockedId = (await userApi.nodes.createFile(testData.fileLocked.name, parentId)).entry.id; + fileFavLockedId = (await userApi.nodes.createFile(testData.fileFavLocked.name, parentId)).entry.id; + fileSharedLockedId = (await userApi.nodes.createFile(testData.fileSharedLocked.name, parentId)).entry.id; + fileSharedFavLockedId = (await userApi.nodes.createFile(testData.fileSharedFavLocked.name, parentId)).entry.id; + + await userApi.nodes.createFolder(testData.folder.name, parentId); + folderFavId = (await userApi.nodes.createFolder(testData.folderFav.name, parentId)).entry.id; + folderFav2Id = (await userApi.nodes.createFolder(testData.folderFav2.name, parentId)).entry.id; + + await userApi.favorites.addFavoritesByIds('folder', [folderFavId, folderFav2Id]); + + await userApi.favorites.addFavoritesByIds('file', [ + fileDocxFavId, + fileFavId, + fileDocxSharedFavId, + fileSharedFavId, + fileFavLockedId, + fileSharedFavLockedId + ]); + + await userApi.shared.shareFilesByIds([ + fileDocxSharedId, + fileDocxSharedFavId, + fileSharedId, + fileSharedFavId, + fileSharedLockedId, + fileSharedFavLockedId + ]); + + await userApi.nodes.lockFile(fileLockedId); + await userApi.nodes.lockFile(fileFavLockedId); + await userApi.nodes.lockFile(fileSharedLockedId); + await userApi.nodes.lockFile(fileSharedFavLockedId); + + fileInTrashId = (await userApi.nodes.createFile(testData.fileInTrash.name)).entry.id; + file2InTrashId = (await userApi.nodes.createFile(testData.file2InTrash.name)).entry.id; + folderInTrashId = (await userApi.nodes.createFolder(testData.folderInTrash.name)).entry.id; + folder2InTrashId = (await userApi.nodes.createFolder(testData.folder2InTrash.name)).entry.id; + + await userApi.nodes.deleteNodeById(fileInTrashId, false); + await userApi.nodes.deleteNodeById(file2InTrashId, false); + await userApi.nodes.deleteNodeById(folderInTrashId, false); + await userApi.nodes.deleteNodeById(folder2InTrashId, false); + + await Promise.all([ + userApi.favorites.waitForApi({ expect: 8 }), + userApi.shared.waitForApi({ expect: 6 }), + userApi.search.waitForApi(username, { expect: 12 }), + userApi.trashcan.waitForApi({ expect: 4 }) + ]); + + await loginPage.loginWith(username); + }); + + afterAll(async () => { + await userApi.nodes.deleteNodeById(parentId); + await userApi.trashcan.emptyTrash(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('on Personal Files : ', () => { + personalFilesTests(parent); + }); + + describe('on Recent Files : ', () => { + recentFilesTests(); + }); + + describe('on Favorites : ', () => { + favoritesTests(); + }); + + describe('on Search Results : ', () => { + searchResultsTests(); + }); + + describe('on Shared Files : ', () => { + sharedFilesTests(); + }); + + describe('on Viewer : ', () => { + viewerTests(parent); + }); + + describe('on Trash : ', () => { + trashTests(); + }); + +}); diff --git a/e2e/suites/actions-available/files-folders/personal-files.ts b/e2e/suites/actions-available/files-folders/personal-files.ts new file mode 100755 index 000000000..b18256bdf --- /dev/null +++ b/e2e/suites/actions-available/files-folders/personal-files.ts @@ -0,0 +1,150 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; +import { BrowsingPage } from '../../../pages/pages'; + +export function personalFilesTests(parentName?: string) { + const page = new BrowsingPage(); + const { dataTable } = page; + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parentName); + await dataTable.waitForHeader(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('on a file', () => { + + it('File Office - [C213122]', async () => { + await testUtil.checkToolbarActions(testData.fileDocx.name, testData.fileDocx.toolbarPrimary, testData.fileDocx.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocx.name, testData.fileDocx.contextMenu); + }); + + it('File Office, favorite - [C297612]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.toolbarPrimary, testData.fileDocxFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.contextMenu); + }); + + it('File simple - [C286265]', async () => { + await testUtil.checkToolbarActions(testData.file.name, testData.file.toolbarPrimary, testData.file.toolbarMore); + await testUtil.checkContextMenu(testData.file.name, testData.file.contextMenu); + }); + + it('File favorite - [C297615]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.toolbarPrimary, testData.fileFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.contextMenu); + }); + + it('File Office, shared - [C280448]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.toolbarPrimary, testData.fileDocxShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.contextMenu); + }); + + it('File Office, shared, favorite - [C297616]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.toolbarPrimary, testData.fileDocxSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.contextMenu); + }); + + it('File shared - [C286323]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.toolbarPrimary, testData.fileShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.contextMenu); + }); + + it('File shared, favorite - [C280450]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.toolbarPrimary, testData.fileSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.contextMenu); + }); + + it('File locked - [C297617]', async () => { + await testUtil.checkToolbarActions(testData.fileLocked.name, testData.fileLocked.toolbarPrimary, testData.fileLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileLocked.name, testData.fileLocked.contextMenu); + }); + + it('File favorite, locked - [C291816]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.toolbarPrimary, testData.fileFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.contextMenu); + }); + + it('File shared, locked - [C280453]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.toolbarPrimary, testData.fileSharedLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.contextMenu); + }); + + it('File shared, favorite, locked - [C280454]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.toolbarPrimary, testData.fileSharedFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.contextMenu); + }); + }); + + describe('on a folder', () => { + + it('Folder not favorite - [C213123]', async () => { + await testUtil.checkToolbarActions(testData.folder.name, testData.folder.toolbarPrimary, testData.folder.toolbarMore); + await testUtil.checkContextMenu(testData.folder.name, testData.folder.contextMenu); + }); + + it('Folder favorite - [C280451]', async () => { + await testUtil.checkToolbarActions(testData.folderFav.name, testData.folderFav.toolbarPrimary, testData.folderFav.toolbarMore); + await testUtil.checkContextMenu(testData.folderFav.name, testData.folderFav.contextMenu); + }); + }); + + describe('on multiple selection', () => { + it('multiple files - [C217112]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocx.name, testData.fileDocxSharedFav.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocx.name, testData.fileDocxSharedFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files - all favorite - [C297619]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + it('multiple locked files - [C326688]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple folders - [C280459]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.folderFav.name, testData.folder.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.folderFav.name, testData.folder.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('both files and folders - [C280460]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.file.name, testData.folder.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.file.name, testData.folder.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + }); + }); +} diff --git a/e2e/suites/actions-available/files-folders/personal.test.ts b/e2e/suites/actions-available/files-folders/personal.test.ts deleted file mode 100755 index 27eb29841..000000000 --- a/e2e/suites/actions-available/files-folders/personal.test.ts +++ /dev/null @@ -1,244 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File/folder actions : on Personal Files: ', () => { - - const random = Utils.random(); - - const username = `user-${random}`; - - const parent = `parent-${random}`; let parentId; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - let folderFavId; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name ); - fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id; - await apis.user.nodes.createFile(data.file.name, parentId); - fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id; - fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id; - fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id; - fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id; - fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id; - fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id; - fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id; - - await apis.user.nodes.createFolder(data.folder.name, parentId); - folderFavId = (await apis.user.nodes.createFolder(data.folderFav.name, parentId)).entry.id; - await apis.user.favorites.addFavoriteById('folder', folderFavId); - - await apis.user.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await apis.user.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await apis.user.nodes.lockFile(fileLockedId); - await apis.user.nodes.lockFile(fileFavLockedId); - await apis.user.nodes.lockFile(fileSharedLockedId); - await apis.user.nodes.lockFile(fileSharedFavLockedId); - - await apis.user.favorites.waitForApi({ expect: 7 }); - await apis.user.shared.waitForApi({ expect: 6 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - await dataTable.waitForHeader(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('on a file', () => { - - it('File Office - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore); - await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu); - }); - - it('File simple - []', async () => { - await testUtil.checkToolbarPrimary(data.file.name, data.file.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore); - await testUtil.checkContextMenu(data.file.name, data.file.contextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu); - }); - - it('File locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu); - }); - }); - - describe('on a folder', () => { - - it('Folder not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folder.name, data.folder.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.toolbarMore); - await testUtil.checkContextMenu(data.folder.name, data.folder.contextMenu); - }); - - it('Folder favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.toolbarMore); - await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.contextMenu); - }); - }); - - describe('on multiple selection', () => { - it('multiple files - [C217112]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarMore); - }); - - it('multiple locked files - [C297619]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore); - }); - - it('multiple folders - [C280459]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folder.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarMore); - }); - - it('both files and folders - [C280460]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folder.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folder.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folder.name ], data.multipleSel.toolbarMore); - }); - }); -}); diff --git a/e2e/suites/actions-available/files-folders/recent-files.ts b/e2e/suites/actions-available/files-folders/recent-files.ts new file mode 100755 index 000000000..de1243444 --- /dev/null +++ b/e2e/suites/actions-available/files-folders/recent-files.ts @@ -0,0 +1,124 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; +import { BrowsingPage } from '../../../pages/pages'; + +export function recentFilesTests() { + const page = new BrowsingPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickRecentFilesAndWait(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('on single selection', () => { + it('File Office - [C297625]', async () => { + await testUtil.checkToolbarActions(testData.fileDocx.name, testData.fileDocx.toolbarPrimary, testData.fileDocx.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocx.name, testData.fileDocx.contextMenu); + }); + + it('File Office, favorite - [C280470]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.toolbarPrimary, testData.fileDocxFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.contextMenu); + }); + + it('File simple - [C280471]', async () => { + await testUtil.checkToolbarActions(testData.file.name, testData.file.toolbarPrimary, testData.file.toolbarMore); + await testUtil.checkContextMenu(testData.file.name, testData.file.contextMenu); + }); + + it('File favorite - [C280615]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.toolbarPrimary, testData.fileFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.contextMenu); + }); + + it('File Office, shared - [C297633]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.toolbarPrimary, testData.fileDocxShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.contextMenu); + }); + + it('File Office, shared, favorite - [C280616]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.toolbarPrimary, testData.fileDocxSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.contextMenu); + }); + + it('File shared - [C280601]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.toolbarPrimary, testData.fileShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.contextMenu); + }); + + it('File shared, favorite - [C297635]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.toolbarPrimary, testData.fileSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.contextMenu); + }); + + it('File locked - [C280622]', async () => { + await testUtil.checkToolbarActions(testData.fileLocked.name, testData.fileLocked.toolbarPrimary, testData.fileLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileLocked.name, testData.fileLocked.contextMenu); + }); + + it('File favorite, locked - [C280608]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.toolbarPrimary, testData.fileFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.contextMenu); + }); + + it('File shared, locked - [C297636]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.toolbarPrimary, testData.fileSharedLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.contextMenu); + }); + + it('File shared, favorite, locked - [C286324]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.toolbarPrimary, testData.fileSharedFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.contextMenu); + }); + }); + + describe('on multiple selection', () => { + it('multiple files - [C280468]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files - all favorite - [C326689]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileFav.name ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + it('multiple locked files - [C297624]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + }); + + }); +} diff --git a/e2e/suites/actions-available/files-folders/recent.test.ts b/e2e/suites/actions-available/files-folders/recent.test.ts deleted file mode 100755 index e6e13bbb5..000000000 --- a/e2e/suites/actions-available/files-folders/recent.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File actions : on Recent Files: ', () => { - - const random = Utils.random(); - - const username = `user-${random}`; - - const parent = `parent-${random}`; let parentId; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name); - fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id; - await apis.user.nodes.createFile(data.file.name, parentId); - fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id; - fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id; - fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id; - fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id; - fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id; - fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id; - fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id; - - await apis.user.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await apis.user.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await apis.user.nodes.lockFile(fileLockedId); - await apis.user.nodes.lockFile(fileFavLockedId); - await apis.user.nodes.lockFile(fileSharedLockedId); - await apis.user.nodes.lockFile(fileSharedFavLockedId); - - await apis.user.favorites.waitForApi({ expect: 6 }); - await apis.user.shared.waitForApi({ expect: 6 }); - await apis.user.search.waitForApi(username, { expect: 12 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickRecentFilesAndWait(); - await dataTable.waitForHeader(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('on single selection', () => { - it('File Office - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore); - await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu); - }); - - it('File simple - []', async () => { - await testUtil.checkToolbarPrimary(data.file.name, data.file.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore); - await testUtil.checkContextMenu(data.file.name, data.file.contextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu); - }); - - it('File locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu); - }); - }); - - describe('on multiple selection', () => { - it('multiple files - [C280468]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileLocked.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileFav.name ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileFav.name ], data.multipleSelAllFav.toolbarMore); - }); - - it('multiple locked files - [C297624]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore); - }); - }); - -}); diff --git a/e2e/suites/actions-available/files-folders/search-results.ts b/e2e/suites/actions-available/files-folders/search-results.ts new file mode 100755 index 000000000..5a3ea878b --- /dev/null +++ b/e2e/suites/actions-available/files-folders/search-results.ts @@ -0,0 +1,179 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage, SearchResultsPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; + +export function searchResultsTests() { + const page = new BrowsingPage(); + const { searchInput } = page.header; + const searchResultsPage = new SearchResultsPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('on a file', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('file-'); + await searchResultsPage.waitForResults(); + }); + + it('File Office - [C297637]', async () => { + await testUtil.checkToolbarActions(testData.fileDocx.name, testData.fileDocx.searchToolbarPrimary, testData.fileDocx.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileDocx.name, testData.fileDocx.searchContextMenu); + }); + + it('File Office, favorite - [C291827]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.searchToolbarPrimary, testData.fileDocxFav.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.searchContextMenu); + }); + + it('File simple - [C297638]', async () => { + await testUtil.checkToolbarActions(testData.file.name, testData.file.searchToolbarPrimary, testData.file.searchToolbarMore); + await testUtil.checkContextMenu(testData.file.name, testData.file.searchContextMenu); + }); + + it('File favorite - [C280661]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.searchToolbarPrimary, testData.fileFav.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.searchContextMenu); + }); + + it('File Office, shared - [C297627]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.searchToolbarPrimary, testData.fileDocxShared.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.searchContextMenu); + }); + + it('File Office, shared, favorite - [C280631]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.searchToolbarPrimary, testData.fileDocxSharedFav.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.searchContextMenu); + }); + + it('File shared - [C280632]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.searchToolbarPrimary, testData.fileShared.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.searchContextMenu); + }); + + it('File shared, favorite - [C280641]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.searchToolbarPrimary, testData.fileSharedFav.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.searchContextMenu); + }); + + it('File locked - [C297628]', async () => { + await testUtil.checkToolbarActions(testData.fileLocked.name, testData.fileLocked.searchToolbarPrimary, testData.fileLocked.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileLocked.name, testData.fileLocked.searchContextMenu); + }); + + it('File favorite, locked - [C280648]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.searchToolbarPrimary, testData.fileFavLocked.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.searchContextMenu); + }); + + it('File shared, locked - [C280574]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.searchToolbarPrimary, testData.fileSharedLocked.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.searchContextMenu); + }); + + it('File shared, favorite, locked - [C280642]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.searchToolbarPrimary, testData.fileSharedFavLocked.searchToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.searchContextMenu); + }); + }); + + describe('on a folder', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('folder-'); + await searchResultsPage.waitForResults(); + }); + + it('Folder not favorite - [C280609]', async () => { + await testUtil.checkToolbarActions(testData.folder.name, testData.folder.searchToolbarPrimary, testData.folder.searchToolbarMore); + await testUtil.checkContextMenu(testData.folder.name, testData.folder.searchContextMenu); + }); + + it('Folder favorite - [C291828]', async () => { + await testUtil.checkToolbarActions(testData.folderFav.name, testData.folderFav.searchToolbarPrimary, testData.folderFav.searchToolbarMore); + await testUtil.checkContextMenu(testData.folderFav.name, testData.folderFav.searchContextMenu); + }); + }); + + describe('on multiple selection', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('file-'); + await searchResultsPage.waitForResults(); + }); + + it('multiple files - [C291820]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.file.name, testData.fileDocxShared.name ], testData.multipleSel.searchContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.file.name, testData.fileDocxShared.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.searchToolbarMore); + }); + + it('multiple files - all favorite - [C326690]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileSharedFav.name ], testData.multipleSelAllFav.searchContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileSharedFav.name ], testData.multipleSelAllFav.searchToolbarPrimary, testData.multipleSelAllFav.searchToolbarMore); + }); + + it('multiple locked files - [C297626]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.searchContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.searchToolbarMore); + }); + + it('multiple folders - [C291821]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor('folder-'); + await searchResultsPage.waitForResults(); + + await testUtil.checkMultipleSelContextMenu([ testData.folder.name, testData.folderFav.name ], testData.multipleSel.searchContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.folder.name, testData.folderFav.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.searchToolbarMore); + }); + + it('both files and folders - [C291822]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(`=${testData.file.name} or =${testData.folderFav.name}`); + await searchResultsPage.waitForResults(); + + await testUtil.checkMultipleSelContextMenu([ testData.file.name, testData.folderFav.name ], testData.multipleSel.searchContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.file.name, testData.folderFav.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.searchToolbarMore); + }); + }); + }); +} diff --git a/e2e/suites/actions-available/files-folders/search.test.ts b/e2e/suites/actions-available/files-folders/search.test.ts deleted file mode 100755 index 44ca36573..000000000 --- a/e2e/suites/actions-available/files-folders/search.test.ts +++ /dev/null @@ -1,291 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File/folder actions : on Search Results : ', () => { - - const random = Utils.random(); - - const username = `user-${random}`; - - const parent = `parent-${random}`; let parentId; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - let folderFavId; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { searchInput } = page.header; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name ); - fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id; - await apis.user.nodes.createFile(data.file.name, parentId); - fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id; - fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id; - fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id; - fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id; - fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id; - fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id; - fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id; - - await apis.user.nodes.createFolder(data.folder.name, parentId); - folderFavId = (await apis.user.nodes.createFolder(data.folderFav.name, parentId)).entry.id; - await apis.user.favorites.addFavoriteById('folder', folderFavId); - - await apis.user.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await apis.user.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await apis.user.nodes.lockFile(fileLockedId); - await apis.user.nodes.lockFile(fileFavLockedId); - await apis.user.nodes.lockFile(fileSharedLockedId); - await apis.user.nodes.lockFile(fileSharedFavLockedId); - - await apis.user.favorites.waitForApi({ expect: 7 }); - await apis.user.shared.waitForApi({ expect: 6 }); - await apis.user.search.waitForApi(username, { expect: 12 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - describe('on a file', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.searchToolbarMore); - await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.searchContextMenu); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.searchToolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.searchContextMenu); - }); - - it('File simple - []', async () => { - await testUtil.checkToolbarPrimary(data.file.name, data.file.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.file.name, data.file.searchToolbarMore); - await testUtil.checkContextMenu(data.file.name, data.file.searchContextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.searchToolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.searchContextMenu); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.searchToolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.searchContextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchToolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchContextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.searchToolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.searchContextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.searchToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.searchContextMenu); - }); - - it('File locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.searchToolbarMore); - await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.searchContextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.searchToolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.searchContextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.searchToolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.searchContextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchContextMenu); - }); - }); - - describe('on a folder', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFolders(); - await searchInput.searchFor('folder-'); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('Folder not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folder.name, data.folder.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.searchToolbarMore); - await testUtil.checkContextMenu(data.folder.name, data.folder.searchContextMenu); - }); - - it('Folder favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.searchToolbarMore); - await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.searchContextMenu); - }); - }); - - describe('on multiple selection', () => { - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('multiple files - [C291820]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchToolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.searchContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.searchToolbarMore); - }); - - it('multiple locked files - [C297626]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchToolbarMore); - }); - - it('multiple folders - [C291821]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFolders(); - await searchInput.searchFor('folder-'); - - await testUtil.checkMultipleSelContextMenu([ data.folder.name, data.folderFav.name ], data.multipleSel.searchContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.folder.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.folder.name, data.folderFav.name ], data.multipleSel.searchToolbarMore); - }); - - it('both files and folders - [C291822]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); - await searchInput.searchFor(`=${data.file.name} or =${data.folderFav.name}`); - - await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folderFav.name ], data.multipleSel.searchContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folderFav.name ], data.multipleSel.searchToolbarMore); - }); - }); -}); diff --git a/e2e/suites/actions-available/files-folders/shared-files.ts b/e2e/suites/actions-available/files-folders/shared-files.ts new file mode 100755 index 000000000..aa94eee39 --- /dev/null +++ b/e2e/suites/actions-available/files-folders/shared-files.ts @@ -0,0 +1,94 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; + +export function sharedFilesTests() { + const page = new BrowsingPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickSharedFilesAndWait(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('single selection', () => { + it('File Office, shared - [C297629]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.toolbarPrimary, testData.fileDocxShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.contextMenu); + }); + + it('File Office, shared, favorite - [C280652]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.toolbarPrimary, testData.fileDocxSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.contextMenu); + }); + + it('File shared - [C297630]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.toolbarPrimary, testData.fileShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.contextMenu); + }); + + it('File shared, favorite - [C286273]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.toolbarPrimary, testData.fileSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.contextMenu); + }); + + it('File shared, locked - [C286274]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.toolbarPrimary, testData.fileSharedLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.contextMenu); + }); + + it('File shared, favorite, locked - [C286275]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.toolbarPrimary, testData.fileSharedFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.contextMenu); + }); + }); + + describe('multiple selection', () => { + it('multiple files - [C280467]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileShared.name, testData.fileSharedFav.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileShared.name, testData.fileSharedFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files - all favorite - [C326691]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileSharedFav.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileSharedFav.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + it('multiple locked files - [C297623]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileSharedLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileSharedLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + }); + + }); +} diff --git a/e2e/suites/actions-available/files-folders/shared.test.ts b/e2e/suites/actions-available/files-folders/shared.test.ts deleted file mode 100755 index 105e365f4..000000000 --- a/e2e/suites/actions-available/files-folders/shared.test.ts +++ /dev/null @@ -1,162 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File actions : on Shared Files : ', () => { - - const random = Utils.random(); - - const username = `user-${random}`; - - const parent = `parent-${random}`; let parentId; - - let fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileSharedLockedId, fileSharedFavLockedId; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id; - fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id; - fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id; - fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id; - - await apis.user.favorites.addFavoritesByIds('file', [ - fileDocxSharedFavId, - fileSharedFavId, - fileSharedFavLockedId - ]); - - await apis.user.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await apis.user.nodes.lockFile(fileSharedLockedId); - await apis.user.nodes.lockFile(fileSharedFavLockedId); - - await apis.user.favorites.waitForApi({ expect: 3 }); - await apis.user.shared.waitForApi({ expect: 6 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickSharedFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('single selection', () => { - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.sharedContextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedContextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.sharedContextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.sharedContextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.sharedContextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedContextMenu); - }); - }); - - describe('multiple selection', () => { - it('multiple files - [C280467]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarMore); - }); - - it('multiple locked files - [C297623]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore); - }); - }); - -}); diff --git a/e2e/suites/actions-available/files-folders/test-data-files-folders.ts b/e2e/suites/actions-available/files-folders/test-data.ts similarity index 83% rename from e2e/suites/actions-available/files-folders/test-data-files-folders.ts rename to e2e/suites/actions-available/files-folders/test-data.ts index c2c24971e..10cb960af 100644 --- a/e2e/suites/actions-available/files-folders/test-data-files-folders.ts +++ b/e2e/suites/actions-available/files-folders/test-data.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -64,22 +64,18 @@ const viewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favori // ---- FAVORITES workarounds ---- -// TODO: add Edit Offline when ACA-2174 is fixed -// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done -// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue - -// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done -const favoritesSharedToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions']; -// TODO: add Edit Offline when ACA-2174 is fixed -// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue +// TODO: investigate why 'Edit Offline', 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue const favoritesContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; -// TODO: add Edit Offline when ACA-2174 is fixed -// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue +// TODO: investigate why 'Permissions' is not displayed and raise issue +const favoritesLockedContextMenu = ['Share', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; +// TODO: investigate why 'Edit Offline', 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue const favoritesToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; -// TODO: add Edit Offline when ACA-2174 is fixed -// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue -// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done -const favoritesSharedContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; +// TODO: investigate why 'Permissions' is not displayed and raise issue +const favoritesLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; +// TODO: investigate why 'Edit Offline', 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue +const favoritesSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; +// TODO: investigate why 'Permissions' is not displayed and raise issue +const favoritesSharedLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; // ---- SEARCH workarounds ---- @@ -111,27 +107,6 @@ const searchViewerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version' const searchViewerDocxFavToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; const searchViewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions']; -// ---- SHARED workarounds ---- - -// TODO: add Edit Offline to expectedContextMenu when ACA-2173 is fixed -const sharedFilesDocxContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Edit Offline to expectedToolbarMore when ACA-2173 is fixed -const sharedFilesDocxToolbarMore = ['Edit in Microsoft Office™', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Edit Offline to expectedContextMenu when ACA-2173 is fixed -const sharedFilesDocxSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Edit Offline to expectedToolbarMore when ACA-2173 is fixed -const sharedFilesDocxSharedFavToolbarMore = ['Edit in Microsoft Office™', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Cancel Editing to expectedContextMenu when ACA-2173 is fixed -const sharedFilesSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Cancel Editing to expectedToolbarMore when ACA-2173 is fixed -const sharedFilesSharedToolbarMore = ['Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Edit Offline to expectedToolbarMore when ACA-2173 is fixed -const sharedFilesFavSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; -// TODO: add Cancel Editing to expectedToolbarMore when ACA-2173 is fixed -const sharedFilesSharedFavToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; - - - export const fileDocx = { name: `file-docx-${Utils.random()}.docx`, @@ -216,10 +191,7 @@ export const fileDocxShared = { searchContextMenu: searchDocxSharedContextMenu, searchToolbarPrimary: searchSharedToolbarPrimary, searchToolbarMore: searchDocxToolbarMore, - searchViewerToolbarMore: searchViewerDocxToolbarMore, - - sharedContextMenu: sharedFilesDocxContextMenu, - sharedToolbarMore: sharedFilesDocxToolbarMore + searchViewerToolbarMore: searchViewerDocxToolbarMore }; export const fileDocxSharedFav = { @@ -233,16 +205,13 @@ export const fileDocxSharedFav = { viewerToolbarMore: viewerDocxFavToolbarMore, favoritesContextMenu: favoritesSharedContextMenu, - favoritesToolbarPrimary: favoritesSharedToolbarPrimary, + favoritesToolbarPrimary: fileSharedToolbarPrimary, favoritesToolbarMore, searchContextMenu: searchDocxSharedFavContextMenu, searchToolbarPrimary: searchSharedToolbarPrimary, searchToolbarMore: searchDocxFavToolbarMore, - searchViewerToolbarMore: searchViewerDocxFavToolbarMore, - - sharedContextMenu: sharedFilesDocxSharedFavContextMenu, - sharedToolbarMore: sharedFilesDocxSharedFavToolbarMore + searchViewerToolbarMore: searchViewerDocxFavToolbarMore }; export const fileShared = { @@ -258,10 +227,7 @@ export const fileShared = { searchContextMenu: searchSharedContextMenu, searchToolbarPrimary: searchSharedToolbarPrimary, searchToolbarMore, - searchViewerToolbarMore, - - sharedContextMenu: sharedFilesSharedContextMenu, - sharedToolbarMore: sharedFilesSharedToolbarMore + searchViewerToolbarMore }; export const fileSharedFav = { @@ -275,16 +241,13 @@ export const fileSharedFav = { viewerToolbarMore: viewerFavToolbarMore, favoritesContextMenu: favoritesSharedContextMenu, - favoritesToolbarPrimary: favoritesSharedToolbarPrimary, + favoritesToolbarPrimary: fileSharedToolbarPrimary, favoritesToolbarMore, searchContextMenu: searchSharedFavContextMenu, searchToolbarPrimary: searchSharedToolbarPrimary, searchToolbarMore: searchFavToolbarMore, - searchViewerToolbarMore: searchViewerFavToolbarMore, - - sharedContextMenu: sharedFilesFavSharedContextMenu, - sharedToolbarMore: sharedFilesSharedFavToolbarMore + searchViewerToolbarMore: searchViewerFavToolbarMore }; export const fileLocked = { @@ -313,8 +276,8 @@ export const fileFavLocked = { viewerToolbarPrimary, viewerToolbarMore: viewerFavLockedToolbarMore, - favoritesContextMenu, - favoritesToolbarMore, + favoritesContextMenu: favoritesLockedContextMenu, + favoritesToolbarMore: favoritesLockedToolbarMore, searchContextMenu: searchFavLockedContextMenu, searchToolbarPrimary, @@ -335,10 +298,7 @@ export const fileSharedLocked = { searchContextMenu: searchSharedLockedContextMenu, searchToolbarPrimary: searchSharedToolbarPrimary, searchToolbarMore: searchLockedToolbarMore, - searchViewerToolbarMore: searchViewerLockedToolbarMore, - - sharedContextMenu: sharedFilesSharedContextMenu, - sharedToolbarMore: sharedFilesSharedToolbarMore + searchViewerToolbarMore: searchViewerLockedToolbarMore }; export const fileSharedFavLocked = { @@ -351,17 +311,14 @@ export const fileSharedFavLocked = { viewerToolbarPrimary: viewerSharedToolbarPrimary, viewerToolbarMore: viewerFavLockedToolbarMore, - favoritesContextMenu: favoritesSharedContextMenu, - favoritesToolbarPrimary: favoritesSharedToolbarPrimary, - favoritesToolbarMore, + favoritesToolbarMore: favoritesLockedToolbarMore, + favoritesContextMenu: favoritesSharedLockedContextMenu, + favoritesToolbarPrimary: fileSharedToolbarPrimary, searchContextMenu: searchSharedFavLockedContextMenu, searchToolbarPrimary: searchSharedToolbarPrimary, searchToolbarMore: searchFavLockedToolbarMore, - searchViewerToolbarMore: searchViewerFavLockedToolbarMore, - - sharedContextMenu: sharedFilesFavSharedContextMenu, - sharedToolbarMore: sharedFilesSharedFavToolbarMore + searchViewerToolbarMore: searchViewerFavLockedToolbarMore }; export const fileInTrash = { diff --git a/e2e/suites/actions-available/files-folders/trash.test.ts b/e2e/suites/actions-available/files-folders/trash.test.ts deleted file mode 100755 index af1e1e19d..000000000 --- a/e2e/suites/actions-available/files-folders/trash.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File/folder actions : on Trash : ', () => { - - const username = `user-${Utils.random()}`; - - let fileInTrashId, file2InTrashId, folderInTrashId, folder2InTrashId; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - fileInTrashId = (await apis.user.nodes.createFile(data.fileInTrash.name)).entry.id; - file2InTrashId = (await apis.user.nodes.createFile(data.file2InTrash.name)).entry.id; - folderInTrashId = (await apis.user.nodes.createFolder(data.folderInTrash.name)).entry.id; - folder2InTrashId = (await apis.user.nodes.createFolder(data.folder2InTrash.name)).entry.id; - - await apis.user.nodes.deleteNodeById(fileInTrashId, false); - await apis.user.nodes.deleteNodeById(file2InTrashId, false); - await apis.user.nodes.deleteNodeById(folderInTrashId, false); - await apis.user.nodes.deleteNodeById(folder2InTrashId, false); - - await apis.user.trashcan.waitForApi({ expect: 4 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.trashcan.emptyTrash(); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickTrashAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('on a file - [C286258]', async () => { - await testUtil.checkToolbarPrimary(data.fileInTrash.name, data.fileInTrash.trashActions); - await testUtil.checkContextMenu(data.fileInTrash.name, data.fileInTrash.trashActions); - }); - - it('on a folder - [C286259]', async () => { - await testUtil.checkToolbarPrimary(data.folderInTrash.name, data.folderInTrash.trashActions); - await testUtil.checkContextMenu(data.folderInTrash.name, data.folderInTrash.trashActions); - }); - - it('multiple files - [C280472]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileInTrash.name, data.file2InTrash.name ], data.trashActions); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileInTrash.name, data.file2InTrash.name ], data.trashActions); - }); - - it('multiple folders - [C280473]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.folderInTrash.name, data.folder2InTrash.name ], data.trashActions); - await testUtil.checkMultipleSelToolbarPrimary([ data.folderInTrash.name, data.folder2InTrash.name ], data.trashActions); - }); - - it('both files and folders - [C280474]', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileInTrash.name, data.folderInTrash.name ], data.trashActions); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileInTrash.name, data.folderInTrash.name ], data.trashActions); - }); - -}); diff --git a/e2e/suites/actions-available/files-folders/trash.ts b/e2e/suites/actions-available/files-folders/trash.ts new file mode 100755 index 000000000..7521a56c2 --- /dev/null +++ b/e2e/suites/actions-available/files-folders/trash.ts @@ -0,0 +1,70 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; + +export function trashTests() { + const page = new BrowsingPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickTrashAndWait(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + it('on a file - [C286258]', async () => { + await testUtil.checkToolbarPrimary(testData.fileInTrash.name, testData.fileInTrash.trashActions); + await testUtil.checkContextMenu(testData.fileInTrash.name, testData.fileInTrash.trashActions); + }); + + it('on a folder - [C286259]', async () => { + await testUtil.checkToolbarPrimary(testData.folderInTrash.name, testData.folderInTrash.trashActions); + await testUtil.checkContextMenu(testData.folderInTrash.name, testData.folderInTrash.trashActions); + }); + + it('multiple files - [C280472]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileInTrash.name, testData.file2InTrash.name ], testData.trashActions); + await testUtil.checkMultipleSelToolbarPrimary([ testData.fileInTrash.name, testData.file2InTrash.name ], testData.trashActions); + }); + + it('multiple folders - [C280473]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.folderInTrash.name, testData.folder2InTrash.name ], testData.trashActions); + await testUtil.checkMultipleSelToolbarPrimary([ testData.folderInTrash.name, testData.folder2InTrash.name ], testData.trashActions); + }); + + it('both files and folders - [C280474]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileInTrash.name, testData.folderInTrash.name ], testData.trashActions); + await testUtil.checkMultipleSelToolbarPrimary([ testData.fileInTrash.name, testData.folderInTrash.name ], testData.trashActions); + }); + + }); +} diff --git a/e2e/suites/actions-available/files-folders/viewer.test.ts b/e2e/suites/actions-available/files-folders/viewer.test.ts deleted file mode 100755 index fbb575534..000000000 --- a/e2e/suites/actions-available/files-folders/viewer.test.ts +++ /dev/null @@ -1,421 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-files-folders'; -import * as testUtil from '../test-util'; - -describe('File/folder actions : in the viewer : ', () => { - - const random = Utils.random(); - - const username = `user-${random}`; - - const parent = `parent-${random}`; let parentId; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - - await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name ); - fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id; - await apis.user.nodes.createFile(data.file.name, parentId); - fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id; - fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id; - fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id; - fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id; - fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id; - fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id; - fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id; - - await apis.user.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await apis.user.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await apis.user.nodes.lockFile(fileLockedId); - await apis.user.nodes.lockFile(fileFavLockedId); - await apis.user.nodes.lockFile(fileSharedLockedId); - await apis.user.nodes.lockFile(fileSharedFavLockedId); - - await apis.user.favorites.waitForApi({ expect: 6 }); - await apis.user.shared.waitForApi({ expect: 6 }); - - await loginPage.loginWith(username); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - describe('file opened from Personal Files', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - await dataTable.waitForHeader(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore); - }); - - it('File simple - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore); - }); - - it('File favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Recent Files', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickRecentFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore); - }); - - it('File simple - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore); - }); - - it('File favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Favorites', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickFavoritesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore); - }); - - it('File favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Shared Files', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickSharedFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Search Results', () => { - - beforeAll(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.searchViewerToolbarMore); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.searchViewerToolbarMore); - }); - - it('File simple - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.searchViewerToolbarMore); - }); - - it('File favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.searchViewerToolbarMore); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.searchViewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchViewerToolbarMore); - }); - - it('File shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.searchViewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.searchViewerToolbarMore); - }); - - it('File locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.searchViewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.searchViewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.searchViewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchViewerToolbarMore); - }); - }); - -}); diff --git a/e2e/suites/actions-available/files-folders/viewer.ts b/e2e/suites/actions-available/files-folders/viewer.ts new file mode 100755 index 000000000..9c6a9babc --- /dev/null +++ b/e2e/suites/actions-available/files-folders/viewer.ts @@ -0,0 +1,283 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage, SearchResultsPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data'; +import * as testUtil from '../test-util'; + +export function viewerTests(parentName?: string) { + const page = new BrowsingPage(); + const searchResultsPage = new SearchResultsPage(); + const { dataTable } = page; + const { searchInput } = page.header; + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('file opened from Personal Files', () => { + + beforeAll(async () => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parentName); + await dataTable.waitForHeader(); + }); + + it('File Office - [C282025]', async () => { + await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.viewerToolbarMore); + }); + + it('File Office, favorite - [C297583]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.viewerToolbarMore); + }); + + it('File simple - [C297587]', async () => { + await testUtil.checkViewerActions(testData.file.name, testData.file.viewerToolbarPrimary, testData.file.viewerToolbarMore); + }); + + it('File favorite - [C297588]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.viewerToolbarMore); + }); + + it('File Office, shared - [C297597]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C297598]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared - [C291831]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.viewerToolbarMore); + }); + + it('File shared, favorite - [C297632]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File locked - [C291832]', async () => { + await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.viewerToolbarMore); + }); + + it('File favorite, locked - [C297593]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.viewerToolbarMore); + }); + + it('File shared, locked - [C291833]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C297592]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + }); + + describe('file opened from Recent Files', () => { + + beforeAll(async () => { + await page.clickRecentFilesAndWait(); + }); + + it('File Office - [C297599]', async () => { + await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.viewerToolbarMore); + }); + + it('File Office, favorite - [C297600]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.viewerToolbarMore); + }); + + it('File simple - [C326692]', async () => { + await testUtil.checkViewerActions(testData.file.name, testData.file.viewerToolbarPrimary, testData.file.viewerToolbarMore); + }); + + it('File favorite - [C326693]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.viewerToolbarMore); + }); + + it('File Office, shared - [C326694]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326695]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared - [C326696]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.viewerToolbarMore); + }); + + it('File shared, favorite - [C326697]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File locked - [C326698]', async () => { + await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.viewerToolbarMore); + }); + + it('File favorite, locked - [C326701]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.viewerToolbarMore); + }); + + it('File shared, locked - [C326699]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326700]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + }); + + describe('file opened from Favorites', () => { + + beforeAll(async () => { + await page.clickFavoritesAndWait(); + }); + + it('File Office, favorite - [C326702]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.viewerToolbarMore); + }); + + it('File favorite - [C326703]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326704]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared, favorite - [C326705]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File favorite, locked - [C326707]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326706]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + }); + + describe('file opened from Shared Files', () => { + + beforeAll(async () => { + await page.clickSharedFilesAndWait(); + }); + + it('File Office, shared - [C326708]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326709]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared - [C326710]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.viewerToolbarMore); + }); + + it('File shared, favorite - [C326711]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File shared, locked - [C326712]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326713]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + }); + + describe('file opened from Search Results', () => { + + beforeAll(async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor('file-'); + await searchResultsPage.waitForResults(); + }); + + it('File Office - [C326714]', async () => { + await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.searchViewerToolbarMore); + }); + + it('File Office, favorite - [C326715]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.searchViewerToolbarMore); + }); + + it('File simple - [C326716]', async () => { + await testUtil.checkViewerActions(testData.file.name, testData.file.viewerToolbarPrimary, testData.file.searchViewerToolbarMore); + }); + + it('File favorite - [C326717]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.searchViewerToolbarMore); + }); + + it('File Office, shared - [C326718]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.searchViewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326719]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.searchViewerToolbarMore); + }); + + it('File shared - [C326720]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.searchViewerToolbarMore); + }); + + it('File shared, favorite - [C326721]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.searchViewerToolbarMore); + }); + + it('File locked - [C326722]', async () => { + await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.searchViewerToolbarMore); + }); + + it('File favorite, locked - [C326725]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.searchViewerToolbarMore); + }); + + it('File shared, locked - [C326723]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.searchViewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326724]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.searchViewerToolbarMore); + }); + }); + + }); +} diff --git a/e2e/suites/actions-available/generic.test.ts b/e2e/suites/actions-available/generic.test.ts index 467b2d5c2..c92cd1571 100755 --- a/e2e/suites/actions-available/generic.test.ts +++ b/e2e/suites/actions-available/generic.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,202 +23,194 @@ * along with Alfresco. If not, see . */ -import { browser, protractor } from 'protractor'; import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; import { Utils } from '../../utilities/utils'; - +import { AdminActions } from '../../utilities/admin-actions'; describe('Generic tests : ', () => { - const random = Utils.random(); const username = `user-${random}`; - const parent = `parent-${random}`; let parentId; + const parent = `parent-${random}`; const file1 = `file1-${random}.txt`; const file2 = `file2-${random}.txt`; - const folder1 = `my-folder1-${Utils.random()}`; - const folder2 = `my-folder2-${Utils.random()}`; + const folder1 = `my-folder1-${random}`; + const folder2 = `my-folder2-${random}`; - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) + const content: NodeContentTree = { + name: parent, + files: [file1, file2], + folders: [folder1, folder2] }; + const userApi = new RepoClient(username, username); + + const adminApiActions = new AdminActions(); + const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; const { searchInput } = page.header; const contextMenu = dataTable.menu; - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); + beforeAll(async () => { + await adminApiActions.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - await apis.user.nodes.createFile(file1, parentId); - await apis.user.nodes.createFile(file2, parentId); - - await apis.user.nodes.createFolder(folder1, parentId); - await apis.user.nodes.createFolder(folder2, parentId); + await userApi.nodes.createContent(content); await loginPage.loginWith(username); - done(); }); - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); + afterAll(async () => { + await userApi.nodes.deleteNodeByPath(parent); }); - beforeEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - await dataTable.waitForHeader(); - done(); }); - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); + describe('single selection', () => { + beforeEach(async () => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parent); + await dataTable.waitForHeader(); + }); - it('selected row is marked with a check circle icon - [C213134]', async () => { - await dataTable.selectItem(file1); - expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, 'check mark missing'); - }); + it('selected row is marked with a check circle icon - [C213134]', async () => { + await dataTable.selectItem(file1); + expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, 'check mark missing'); + }); - it('Row is marked with a check circle icon on direct right click - [C286252]', async () => { - await dataTable.rightClickOnItem(file2); - expect(await dataTable.hasCheckMarkIcon(file2)).toBe(true, 'check mark missing'); - }); + it('Row is marked with a check circle icon on direct right click - [C286252]', async () => { + await dataTable.rightClickOnItem(file2); + expect(await dataTable.hasCheckMarkIcon(file2)).toBe(true, 'check mark missing'); + }); - it('Context menu appears on direct right click on an item - [C286253]', async () => { - await dataTable.rightClickOnItem(file1); - expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - }); + it('Context menu appears on direct right click on an item - [C286253]', async () => { + await dataTable.rightClickOnItem(file1); + expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); + }); - it('Context menu appears when selecting an item and then right clicking on it - [C286254]', async () => { - await dataTable.selectItem(file2); - await dataTable.rightClickOnItem(file2); - expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - }); + it('Context menu appears when selecting an item and then right clicking on it - [C286254]', async () => { + await dataTable.selectItem(file2); + await dataTable.rightClickOnItem(file2); + expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); + }); - it('Context menu appears correctly when right clicking on another item - [C284666]', async () => { - await dataTable.selectItem(file1); - await dataTable.rightClickOnItem(file2); - expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed`); - expect(await dataTable.hasCheckMarkIcon(file2)).toBe(true, `${file2} is not selected`); - expect(await dataTable.hasCheckMarkIcon(file1)).toBe(false, `${file1} is not selected`); - }); + it('Context menu appears correctly when right clicking on another item - [C284666]', async () => { + await dataTable.selectItem(file1); + await dataTable.rightClickOnItem(file2); + expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed`); + expect(await dataTable.hasCheckMarkIcon(file2)).toBe(true, `${file2} is not selected`); + expect(await dataTable.hasCheckMarkIcon(file1)).toBe(false, `${file1} is not selected`); + }); - it('Context menu closes when clicking away from it - [C280619]', async () => { - await dataTable.rightClickOnItem(file1); - expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - await page.breadcrumb.getCurrentItem().click(); - expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed'); + it('Context menu closes when clicking away from it - [C280619]', async () => { + await dataTable.rightClickOnItem(file1); + expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); + await page.breadcrumb.getCurrentItem().click(); + expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed'); + }); }); describe('Actions are not displayed when no item is selected', () => { + it('on Personal Files - [C213120]', async () => { await page.clickPersonalFilesAndWait(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on Trash - [C280452]', async () => { await page.clickTrash(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on Favorites - [C280449]', async () => { await page.clickFavorites(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on Recent Files - [C280447]', async () => { + await userApi.search.waitForApi(username, { expect: 2 }); await page.clickRecentFilesAndWait(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on Shared Files - [C280445]', async () => { await page.clickSharedFiles(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on My Libraries - [C280439]', async () => { await page.goToMyLibraries(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on Favorite Libraries - [C280439]', async () => { await page.goToFavoriteLibraries(); - await dataTable.clearSelection(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); it('on Search Results - [C291815]', async () => { await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); await searchInput.searchFor('*'); - expect(await toolbar.isToggleSearchFiltersPresent()).toBe(true, `Search filter toggle is not displayed`); - expect(await toolbar.numberOfAvailableActions()).toBe(1, `more than 1 action is present`); + expect(await toolbar.getButtons()).toEqual(['Toggle search filter']); }); }); - it('Context menu appears on right click on a multiple selection of items - [C286268]', async () => { - await dataTable.selectMultipleItems([ file1, file2 ]); - await dataTable.rightClickOnMultipleSelection(); + describe('multiple selection', () => { + beforeEach(async () => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parent); + await dataTable.waitForHeader(); + }); - expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - }); + it('Context menu appears on right click on a multiple selection of items - [C286268]', async () => { + await dataTable.selectMultipleItems([ file1, file2 ]); + await dataTable.rightClickOnMultipleSelection(); - it('Context menu appears when right clicking on a single item while having multiple items selected - [C286269]', async () => { - await dataTable.selectMultipleItems([ file2, folder1 ]); - await dataTable.rightClickOnItem(file1); + expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); + }); - expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${file1}`); - expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect number of selected rows'); - expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); - expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`); - expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`); - expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`); - }); + it('Context menu appears when right clicking on a single item while having multiple items selected - [C286269]', async () => { + await dataTable.selectMultipleItems([ file2, folder1 ]); + await dataTable.rightClickOnItem(file1); - it('Unselect items with single click - [C280458]', async () => { - await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); + expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${file1}`); + expect(await dataTable.getSelectedRowsCount()).toEqual(1, 'incorrect number of selected rows'); + expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); + expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`); + expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`); + expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`); + }); - expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number'); + it('Unselect items with single click - [C280458]', async () => { + await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); + expect(await dataTable.getSelectedRowsCount()).toEqual(4, 'incorrect selected rows number'); - await dataTable.clickItem(file1); + await dataTable.clickItem(file1); + expect(await dataTable.getSelectedRowsCount()).toEqual(1, 'incorrect selected rows number'); + }); - expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number'); - }); + it('Select / unselect items by CMD+click - [C217110]', async () => { + await Utils.pressCmd(); + await dataTable.clickItem(file1); + await dataTable.clickItem(file2); + await dataTable.clickItem(folder1); + await dataTable.clickItem(folder2); + await Utils.releaseKeyPressed(); + expect(await dataTable.getSelectedRowsCount()).toEqual(4, 'incorrect selected rows number'); - it('Select / unselect items by CMD+click - [C217110]', async () => { - await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); - await dataTable.clickItem(file1); - await dataTable.clickItem(file2); - await dataTable.clickItem(folder1); - await dataTable.clickItem(folder2); - await browser.actions().sendKeys(protractor.Key.NULL).perform(); - - expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number'); - - await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); - await dataTable.clickItem(file1); - await dataTable.clickItem(file2); - await browser.actions().sendKeys(protractor.Key.NULL).perform(); - - expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number'); + await Utils.pressCmd(); + await dataTable.clickItem(file1); + await dataTable.clickItem(file2); + await Utils.releaseKeyPressed(); + expect(await dataTable.getSelectedRowsCount()).toEqual(2, 'incorrect selected rows number'); + }); }); }); diff --git a/e2e/suites/actions-available/libraries/library.test.ts b/e2e/suites/actions-available/libraries/library.test.ts index 5d2ad5fe4..d650b5056 100755 --- a/e2e/suites/actions-available/libraries/library.test.ts +++ b/e2e/suites/actions-available/libraries/library.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -24,305 +24,269 @@ */ import { LoginPage, BrowsingPage, SearchResultsPage } from '../../../pages/pages'; -import { SITE_VISIBILITY } from '../../../configs'; import { RepoClient } from '../../../utilities/repo-client/repo-client'; import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-libraries'; +import { AdminActions } from '../../../utilities/admin-actions'; +import * as testData from './test-data-libraries'; import * as testUtil from '../test-util'; describe('Library actions : ', () => { const username = `user-${Utils.random()}`; - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; + const userApi = new RepoClient(username, username); + + const adminApiActions = new AdminActions(); const loginPage = new LoginPage(); const page = new BrowsingPage(); const searchResultsPage = new SearchResultsPage(); const { searchInput } = searchResultsPage.header; - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); + beforeAll(async () => { + await adminApiActions.createUser({ username }); - await apis.user.sites.createSite(data.publicUserMemberFav.name); - await apis.user.sites.createSite(data.privateUserMemberFav.name, SITE_VISIBILITY.PRIVATE); - await apis.user.sites.createSite(data.moderatedUserMemberFav.name, SITE_VISIBILITY.MODERATED); + await userApi.sites.createSite(testData.publicUserMemberFav.name); + await userApi.sites.createSitePrivate(testData.privateUserMemberFav.name); + await userApi.sites.createSiteModerated(testData.moderatedUserMemberFav.name); - const publicUserMemberNotFavId = (await apis.user.sites.createSite(data.publicUserMemberNotFav.name)).entry.guid; - const privateUserMemberNotFavId = (await apis.user.sites.createSite(data.privateUserMemberNotFav.name, SITE_VISIBILITY.PRIVATE)).entry.guid; - const moderatedUserMemberNotFavId = (await apis.user.sites.createSite(data.moderatedUserMemberNotFav.name, SITE_VISIBILITY.MODERATED)).entry.guid; + const publicUserMemberNotFavId = (await userApi.sites.createSite(testData.publicUserMemberNotFav.name)).entry.guid; + const privateUserMemberNotFavId = (await userApi.sites.createSitePrivate(testData.privateUserMemberNotFav.name)).entry.guid; + const moderatedUserMemberNotFavId = (await userApi.sites.createSiteModerated(testData.moderatedUserMemberNotFav.name)).entry.guid; - await apis.admin.sites.createSite(data.publicNotMemberFav.name); - await apis.admin.sites.createSite(data.moderatedNotMemberFav.name, SITE_VISIBILITY.MODERATED); + await adminApiActions.sites.createSite(testData.publicNotMemberFav.name); + await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberFav.name); - await apis.admin.sites.createSite(data.publicNotMemberNotFav.name); - await apis.admin.sites.createSite(data.moderatedNotMemberNotFav.name, SITE_VISIBILITY.MODERATED); + await adminApiActions.sites.createSite(testData.publicNotMemberNotFav.name); + await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberNotFav.name); - await apis.admin.sites.createSite(data.moderatedRequestedJoinFav.name, SITE_VISIBILITY.MODERATED); - await apis.admin.sites.createSite(data.moderatedRequestedJoinNotFav.name, SITE_VISIBILITY.MODERATED); + await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinFav.name); + await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinNotFav.name); - await apis.user.sites.createSite(data.siteInTrash.name, SITE_VISIBILITY.PUBLIC); - await apis.user.sites.createSite(data.site2InTrash.name, SITE_VISIBILITY.PUBLIC); + await userApi.sites.createSite(testData.siteInTrash.name); + await userApi.sites.createSite(testData.site2InTrash.name); - await apis.user.sites.waitForApi({ expect: 8 }); - await apis.admin.sites.waitForApi({ expect: 6 }); + await Promise.all([ + userApi.sites.waitForApi({ expect: 8 }), + adminApiActions.sites.waitForApi({ expect: 6 + 1 }) + ]); - await apis.user.favorites.removeFavoriteById(publicUserMemberNotFavId); - await apis.user.favorites.removeFavoriteById(privateUserMemberNotFavId); - await apis.user.favorites.removeFavoriteById(moderatedUserMemberNotFavId); + await userApi.favorites.removeFavoritesByIds([publicUserMemberNotFavId, privateUserMemberNotFavId, moderatedUserMemberNotFavId]); - await apis.user.favorites.addFavoriteById('site', data.publicNotMemberFav.name); - await apis.user.favorites.addFavoriteById('site', data.moderatedNotMemberFav.name); - await apis.user.favorites.addFavoriteById('site', data.moderatedRequestedJoinFav.name); + await userApi.favorites.addFavoritesByIds('site', [testData.publicNotMemberFav.name, testData.moderatedNotMemberFav.name, testData.moderatedRequestedJoinFav.name]); - await apis.user.sites.requestToJoin(data.moderatedRequestedJoinFav.name); - await apis.user.sites.requestToJoin(data.moderatedRequestedJoinNotFav.name); + await userApi.sites.requestToJoin(testData.moderatedRequestedJoinFav.name); + await userApi.sites.requestToJoin(testData.moderatedRequestedJoinNotFav.name); - await apis.user.queries.waitForSites('site-', { expect: 13 }); + await userApi.queries.waitForSites('site-', { expect: 14 + 1 }); - await apis.user.sites.deleteSite(data.siteInTrash.name, false); - await apis.user.sites.deleteSite(data.site2InTrash.name, false); + await userApi.sites.deleteSite(testData.siteInTrash.name, false); + await userApi.sites.deleteSite(testData.site2InTrash.name, false); - await apis.user.trashcan.waitForApi({ expect: 2 }); + await userApi.trashcan.waitForApi({ expect: 2 }); await loginPage.loginWith(username); - done(); }); - afterAll(async (done) => { + afterAll(async () => { await Promise.all([ - apis.user.sites.deleteSites([ - data.publicUserMemberFav.name, - data.privateUserMemberFav.name, - data.moderatedUserMemberFav.name, - data.publicUserMemberNotFav.name, - data.privateUserMemberNotFav.name, - data.moderatedUserMemberNotFav.name + userApi.sites.deleteSites([ + testData.publicUserMemberFav.name, + testData.privateUserMemberFav.name, + testData.moderatedUserMemberFav.name, + testData.publicUserMemberNotFav.name, + testData.privateUserMemberNotFav.name, + testData.moderatedUserMemberNotFav.name ]), - apis.admin.sites.deleteSites([ - data.publicNotMemberFav.name, - data.moderatedNotMemberFav.name, - data.publicNotMemberNotFav.name, - data.moderatedNotMemberNotFav.name, - data.moderatedRequestedJoinFav.name, - data.moderatedRequestedJoinNotFav.name + adminApiActions.sites.deleteSites([ + testData.publicNotMemberFav.name, + testData.moderatedNotMemberFav.name, + testData.publicNotMemberNotFav.name, + testData.moderatedNotMemberNotFav.name, + testData.moderatedRequestedJoinFav.name, + testData.moderatedRequestedJoinNotFav.name ]), - apis.user.trashcan.emptyTrash() + userApi.trashcan.emptyTrash() ]); - done(); }); describe('on My Libraries', () => { - beforeEach(async (done) => { + beforeAll(async () => { await Utils.pressEscape(); await page.goToMyLibrariesAndWait(); - done(); }); - afterEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); - done(); }); - it('Public library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.publicUserMemberFav.name, data.publicUserMemberFav.contextMenu); + it('Public library, user is a member, favorite - [C213135]', async () => { + await testUtil.checkToolbarActions(testData.publicUserMemberFav.name, testData.publicUserMemberFav.toolbarPrimary, testData.publicUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicUserMemberFav.name, testData.publicUserMemberFav.contextMenu); }); - it('Private library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.privateUserMemberFav.name, data.privateUserMemberFav.contextMenu); + it('Private library, user is a member, favorite - [C290080]', async () => { + await testUtil.checkToolbarActions(testData.privateUserMemberFav.name, testData.privateUserMemberFav.toolbarPrimary, testData.privateUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.privateUserMemberFav.name, testData.privateUserMemberFav.contextMenu); }); - it('Moderated library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.contextMenu); + it('Moderated library, user is a member, favorite - [C326676]', async () => { + await testUtil.checkToolbarActions(testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.toolbarPrimary, testData.moderatedUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.contextMenu); }); - it('Public library, user is a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.contextMenu); + it('Public library, user is a member, not favorite - [C326677]', async () => { + await testUtil.checkToolbarActions(testData.publicUserMemberNotFav.name, testData.publicUserMemberNotFav.toolbarPrimary, testData.publicUserMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicUserMemberNotFav.name, testData.publicUserMemberNotFav.contextMenu); }); - it('Private library, user is a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.contextMenu); + it('Private library, user is a member, not favorite - [C326678]', async () => { + await testUtil.checkToolbarActions(testData.privateUserMemberNotFav.name, testData.privateUserMemberNotFav.toolbarPrimary, testData.privateUserMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.privateUserMemberNotFav.name, testData.privateUserMemberNotFav.contextMenu); }); - it('Moderated library, user is a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.contextMenu); + it('Moderated library, user is a member, not favorite - [C326679]', async () => { + await testUtil.checkToolbarActions(testData.moderatedUserMemberNotFav.name, testData.moderatedUserMemberNotFav.toolbarPrimary, testData.moderatedUserMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedUserMemberNotFav.name, testData.moderatedUserMemberNotFav.contextMenu); }); }); describe('on Favorite Libraries', () => { - beforeEach(async (done) => { + beforeAll(async () => { await Utils.pressEscape(); await page.goToFavoriteLibrariesAndWait(); - done(); }); - afterEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); - done(); }); - it('Public library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.publicUserMemberFav.name, data.publicUserMemberFav.contextMenu); + it('Public library, user is a member, favorite - [C289892]', async () => { + await testUtil.checkToolbarActions(testData.publicUserMemberFav.name, testData.publicUserMemberFav.toolbarPrimary, testData.publicUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicUserMemberFav.name, testData.publicUserMemberFav.contextMenu); }); - it('Private library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.privateUserMemberFav.name, data.privateUserMemberFav.contextMenu); + it('Private library, user is a member, favorite - [C290090]', async () => { + await testUtil.checkToolbarActions(testData.privateUserMemberFav.name, testData.privateUserMemberFav.toolbarPrimary, testData.privateUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.privateUserMemberFav.name, testData.privateUserMemberFav.contextMenu); }); - it('Moderated library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.contextMenu); + it('Moderated library, user is a member, favorite - [C290091]', async () => { + await testUtil.checkToolbarActions(testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.toolbarPrimary, testData.moderatedUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.contextMenu); }); - it('Public library, user not a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicNotMemberFav.name, data.publicNotMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicNotMemberFav.name, data.publicNotMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.publicNotMemberFav.name, data.publicNotMemberFav.contextMenu); + it('Public library, user not a member, favorite - [C290081]', async () => { + await testUtil.checkToolbarActions(testData.publicNotMemberFav.name, testData.publicNotMemberFav.toolbarPrimary, testData.publicNotMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicNotMemberFav.name, testData.publicNotMemberFav.contextMenu); }); - it('Moderated library, user not a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.contextMenu); + it('Moderated library, user not a member, favorite - [C290082]', async () => { + await testUtil.checkToolbarActions(testData.moderatedNotMemberFav.name, testData.moderatedNotMemberFav.toolbarPrimary, testData.moderatedNotMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedNotMemberFav.name, testData.moderatedNotMemberFav.contextMenu); }); - it('Moderated library, user requested to join, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.contextMenu); + it('Moderated library, user requested to join, favorite - [C290089]', async () => { + await testUtil.checkToolbarActions(testData.moderatedRequestedJoinFav.name, testData.moderatedRequestedJoinFav.toolbarPrimary, testData.moderatedRequestedJoinFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedRequestedJoinFav.name, testData.moderatedRequestedJoinFav.contextMenu); }); }); describe('on Search Results', () => { - beforeEach(async (done) => { + beforeAll(async () => { await Utils.pressEscape(); await page.clickPersonalFiles(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); await searchInput.searchFor('site-'); - done(); }); - afterEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); - done(); }); - it('Public library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicUserMemberFav.name, data.publicUserMemberFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.publicUserMemberFav.name, data.publicUserMemberFav.contextMenu); + it('Public library, user is a member, favorite - [C290084]', async () => { + await testUtil.checkToolbarActions(testData.publicUserMemberFav.name, testData.publicUserMemberFav.searchToolbarPrimary, testData.publicUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicUserMemberFav.name, testData.publicUserMemberFav.contextMenu); }); - it('Private library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.privateUserMemberFav.name, data.privateUserMemberFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.privateUserMemberFav.name, data.privateUserMemberFav.contextMenu); + it('Private library, user is a member, favorite - [C290085]', async () => { + await testUtil.checkToolbarActions(testData.privateUserMemberFav.name, testData.privateUserMemberFav.searchToolbarPrimary, testData.privateUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.privateUserMemberFav.name, testData.privateUserMemberFav.contextMenu); }); - it('Moderated library, user is a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.contextMenu); + it('Moderated library, user is a member, favorite - [C290086]', async () => { + await testUtil.checkToolbarActions(testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.searchToolbarPrimary, testData.moderatedUserMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.contextMenu); }); - it('Public library, user is a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.contextMenu); + it('Public library, user is a member, not favorite - [C291812]', async () => { + await testUtil.checkToolbarActions(testData.publicUserMemberNotFav.name, testData.publicUserMemberNotFav.searchToolbarPrimary, testData.publicUserMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicUserMemberNotFav.name, testData.publicUserMemberNotFav.contextMenu); }); - it('Private library, user is a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.contextMenu); + it('Private library, user is a member, not favorite - [C291813]', async () => { + await testUtil.checkToolbarActions(testData.privateUserMemberNotFav.name, testData.privateUserMemberNotFav.searchToolbarPrimary, testData.privateUserMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.privateUserMemberNotFav.name, testData.privateUserMemberNotFav.contextMenu); }); - it('Moderated library, user is a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.contextMenu); + it('Moderated library, user is a member, not favorite - [C291814]', async () => { + await testUtil.checkToolbarActions(testData.moderatedUserMemberNotFav.name, testData.moderatedUserMemberNotFav.searchToolbarPrimary, testData.moderatedUserMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedUserMemberNotFav.name, testData.moderatedUserMemberNotFav.contextMenu); }); - it('Public library, user not a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicNotMemberFav.name, data.publicNotMemberFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicNotMemberFav.name, data.publicNotMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.publicNotMemberFav.name, data.publicNotMemberFav.contextMenu); + it('Public library, user not a member, favorite - [C326680]', async () => { + await testUtil.checkToolbarActions(testData.publicNotMemberFav.name, testData.publicNotMemberFav.searchToolbarPrimary, testData.publicNotMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicNotMemberFav.name, testData.publicNotMemberFav.contextMenu); }); - it('Moderated library, user not a member, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.contextMenu); + it('Moderated library, user not a member, favorite - [C326681]', async () => { + await testUtil.checkToolbarActions(testData.moderatedNotMemberFav.name, testData.moderatedNotMemberFav.searchToolbarPrimary, testData.moderatedNotMemberFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedNotMemberFav.name, testData.moderatedNotMemberFav.contextMenu); }); - it('Public library, user not a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.publicNotMemberNotFav.name, data.publicNotMemberNotFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.publicNotMemberNotFav.name, data.publicNotMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.publicNotMemberNotFav.name, data.publicNotMemberNotFav.contextMenu); + it('Public library, user not a member, not favorite - [C326682]', async () => { + await testUtil.checkToolbarActions(testData.publicNotMemberNotFav.name, testData.publicNotMemberNotFav.searchToolbarPrimary, testData.publicNotMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.publicNotMemberNotFav.name, testData.publicNotMemberNotFav.contextMenu); }); - it('Moderated library, user not a member, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedNotMemberNotFav.name, data.moderatedNotMemberNotFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedNotMemberNotFav.name, data.moderatedNotMemberNotFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedNotMemberNotFav.name, data.moderatedNotMemberNotFav.contextMenu); + it('Moderated library, user not a member, not favorite - [C326683]', async () => { + await testUtil.checkToolbarActions(testData.moderatedNotMemberNotFav.name, testData.moderatedNotMemberNotFav.searchToolbarPrimary, testData.moderatedNotMemberNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedNotMemberNotFav.name, testData.moderatedNotMemberNotFav.contextMenu); }); - it('Moderated library, user requested to join, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.contextMenu); + it('Moderated library, user requested to join, favorite - [C326685]', async () => { + await testUtil.checkToolbarActions(testData.moderatedRequestedJoinFav.name, testData.moderatedRequestedJoinFav.searchToolbarPrimary, testData.moderatedRequestedJoinFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedRequestedJoinFav.name, testData.moderatedRequestedJoinFav.contextMenu); }); - it('Moderated library, user requested to join, not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.moderatedRequestedJoinNotFav.name, data.moderatedRequestedJoinNotFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.moderatedRequestedJoinNotFav.name, data.moderatedRequestedJoinNotFav.toolbarMore); - await testUtil.checkContextMenu(data.moderatedRequestedJoinNotFav.name, data.moderatedRequestedJoinNotFav.contextMenu); + it('Moderated library, user requested to join, not favorite - [C326684]', async () => { + await testUtil.checkToolbarActions(testData.moderatedRequestedJoinNotFav.name, testData.moderatedRequestedJoinNotFav.searchToolbarPrimary, testData.moderatedRequestedJoinNotFav.toolbarMore); + await testUtil.checkContextMenu(testData.moderatedRequestedJoinNotFav.name, testData.moderatedRequestedJoinNotFav.contextMenu); }); }); describe('on Trash', () => { - beforeEach(async (done) => { - await page.clickTrashAndWait(); - done(); - }); - - afterEach(async (done) => { + beforeAll(async () => { await Utils.pressEscape(); - done(); + await page.clickTrashAndWait(); }); - it('single library - []', async () => { - await testUtil.checkToolbarPrimary(data.siteInTrash.name, data.siteInTrash.trashActions); - await testUtil.checkContextMenu(data.siteInTrash.name, data.siteInTrash.trashActions); + beforeEach(async () => { + await Utils.pressEscape(); }); - it('multiple libraries - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.siteInTrash.name, data.site2InTrash.name ], data.trashActions); - await testUtil.checkMultipleSelToolbarPrimary([ data.siteInTrash.name, data.site2InTrash.name ], data.trashActions); + it('single library - [C326686]', async () => { + await testUtil.checkToolbarPrimary(testData.siteInTrash.name, testData.siteInTrash.trashActions); + await testUtil.checkContextMenu(testData.siteInTrash.name, testData.siteInTrash.trashActions); + }); + + it('multiple libraries - [C326687]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.siteInTrash.name, testData.site2InTrash.name ], testData.trashActions); + await testUtil.checkMultipleSelToolbarPrimary([ testData.siteInTrash.name, testData.site2InTrash.name ], testData.trashActions); }); }); }); diff --git a/e2e/suites/actions-available/libraries/test-data-libraries.ts b/e2e/suites/actions-available/libraries/test-data-libraries.ts index bc4b3d442..258704938 100644 --- a/e2e/suites/actions-available/libraries/test-data-libraries.ts +++ b/e2e/suites/actions-available/libraries/test-data-libraries.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions-available/special-permissions/favorites.ts b/e2e/suites/actions-available/special-permissions/favorites.ts new file mode 100755 index 000000000..1e39fc052 --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/favorites.ts @@ -0,0 +1,121 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data-permissions'; +import * as testUtil from '../test-util'; + +export function favoritesTests() { + const page = new BrowsingPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickFavoritesAndWait(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('on a file', () => { + + it('File Office, favorite - [C286311]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.toolbarPrimary, testData.fileDocxFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.favoritesContextMenu); + }); + + it('File favorite - [C306991]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.toolbarPrimary, testData.fileFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.favoritesContextMenu); + }); + + it('File Office, shared, favorite - [C279187]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.toolbarPrimary, testData.fileDocxSharedFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.favoritesContextMenu); + }); + + it('File shared, favorite - [C280053]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.toolbarPrimary, testData.fileSharedFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.favoritesContextMenu); + }); + + it('File favorite, locked - [C280050]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.toolbarPrimary, testData.fileFavLocked.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.favoritesContextMenu); + }); + + it('File shared, favorite, locked - [C325011]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.toolbarPrimary, testData.fileSharedFavLocked.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.favoritesContextMenu); + }); + + }); + + describe('on a folder', () => { + + it('Folder favorite - [C325012]', async () => { + await testUtil.checkToolbarActions(testData.folderFav.name, testData.folderFav.toolbarPrimary, testData.folderFav.favoritesToolbarMore); + await testUtil.checkContextMenu(testData.folderFav.name, testData.folderFav.favoritesContextMenu); + }); + + }); + + describe('on multiple selection', () => { + + it('multiple files - [C325046]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('multiple locked files - [C217145]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileFavLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileFavLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('multiple folders - [C213196]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.folderFav.name, testData.folderFav2.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.folderFav.name, testData.folderFav2.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('both files and folders - [C217146]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileFav.name, testData.folderFav.name ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileFav.name, testData.folderFav.name ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + it('multiple files with different granular permissions - [C213193]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileFav.name, testData.fileGranularPermission ], testData.multipleSelAllFav.favoritesContextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileFav.name, testData.fileGranularPermission ], testData.multipleSelAllFav.toolbarPrimary, testData.multipleSelAllFav.favoritesToolbarMore); + }); + + }); + + }); +} diff --git a/e2e/suites/actions-available/special-permissions/my-libraries.ts b/e2e/suites/actions-available/special-permissions/my-libraries.ts new file mode 100755 index 000000000..9f04dc589 --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/my-libraries.ts @@ -0,0 +1,162 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data-permissions'; +import * as testUtil from '../test-util'; + +export function librariesTests(siteName?: string) { + const page = new BrowsingPage(); + const { dataTable } = page; + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.goToMyLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('on a file', () => { + + it('File Office - [C280476]', async () => { + await testUtil.checkToolbarActions(testData.fileDocx.name, testData.fileDocx.toolbarPrimary, testData.fileDocx.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocx.name, testData.fileDocx.contextMenu); + }); + + it('File Office, favorite - [C280455]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.toolbarPrimary, testData.fileDocxFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.contextMenu); + }); + + it('File simple - [C280444]', async () => { + await testUtil.checkToolbarActions(testData.file.name, testData.file.toolbarPrimary, testData.file.toolbarMore); + await testUtil.checkContextMenu(testData.file.name, testData.file.contextMenu); + }); + + it('File favorite - [C280464]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.toolbarPrimary, testData.fileFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.contextMenu); + }); + + it('File Office, shared - [C280465]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.toolbarPrimary, testData.fileDocxShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.contextMenu); + }); + + it('File Office, shared, favorite - [C280466]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.toolbarPrimary, testData.fileDocxSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.contextMenu); + }); + + it('File shared - [C280599]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.toolbarPrimary, testData.fileShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.contextMenu); + }); + + it('File shared, favorite - [C280600]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.toolbarPrimary, testData.fileSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.contextMenu); + }); + + it('File locked - [C280647]', async () => { + await testUtil.checkToolbarActions(testData.fileLocked.name, testData.fileLocked.toolbarPrimary, testData.fileLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileLocked.name, testData.fileLocked.contextMenu); + }); + + it('File favorite, locked - [C280477]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.toolbarPrimary, testData.fileFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.contextMenu); + }); + + it('File shared, locked - [C280666]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.toolbarPrimary, testData.fileSharedLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.contextMenu); + }); + + it('File shared, favorite, locked - [C280669]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.toolbarPrimary, testData.fileSharedFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.contextMenu); + }); + + }); + + describe('on a folder', () => { + + it('Folder not favorite - [C280456]', async () => { + await testUtil.checkToolbarActions(testData.folder.name, testData.folder.toolbarPrimary, testData.folder.toolbarMore); + await testUtil.checkContextMenu(testData.folder.name, testData.folder.contextMenu); + }); + + it('Folder favorite - [C286284]', async () => { + await testUtil.checkToolbarActions(testData.folderFav.name, testData.folderFav.toolbarPrimary, testData.folderFav.toolbarMore); + await testUtil.checkContextMenu(testData.folderFav.name, testData.folderFav.contextMenu); + }); + }); + + describe('on multiple selection', () => { + + it('multiple files - [C286264]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocx.name, testData.fileDocxSharedFav.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocx.name, testData.fileDocxSharedFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files - all favorite - [C286283]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileDocxSharedFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + it('multiple locked files - [C280478]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple folders - [C213121]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.folderFav.name, testData.folder.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.folderFav.name, testData.folder.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('both files and folders - [C286266]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.file.name, testData.folder.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.file.name, testData.folder.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files with different granular permissions - [C286285]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileGranularPermission ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileGranularPermission ], testData.multipleSel.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + }); + }); +} diff --git a/e2e/suites/actions-available/special-permissions/other-permissions.test.ts b/e2e/suites/actions-available/special-permissions/other-permissions.test.ts deleted file mode 100755 index 7a7af0e99..000000000 --- a/e2e/suites/actions-available/special-permissions/other-permissions.test.ts +++ /dev/null @@ -1,841 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage, SearchResultsPage } from '../../../pages/pages'; -import { SITE_VISIBILITY, SITE_ROLES, FILES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import { Viewer } from '../../../components/viewer/viewer'; - -describe('', () => { - const userConsumer = `consumer-${Utils.random()}`; - const userCollaborator = `collaborator-${Utils.random()}`; - const userDemoted = `demoted-${Utils.random()}`; - - const siteName = `site-private-${Utils.random()}`; - const file1 = `my-file1-${Utils.random()}.txt`; - let file1Id; - const file2 = `my-file2-${Utils.random()}.txt`; - let file2Id; - const file3 = `my-file3-${Utils.random()}.txt`; - let file3Id; - const fileLocked = `my-file-locked-${Utils.random()}.txt`; - let fileLockedId; - - const folder1 = `my-folder1-${Utils.random()}`; - let folder1Id; - const folder2 = `my-folder2-${Utils.random()}`; - let folder2Id; - - const docxFile = FILES.docxFile; - let docxFileId; - - const apis = { - admin: new RepoClient(), - userConsumer: new RepoClient(userConsumer, userConsumer), - userCollaborator: new RepoClient(userCollaborator, userCollaborator), - userDemoted: new RepoClient(userDemoted, userDemoted) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, toolbar } = page; - const viewer = new Viewer(); - const viewerToolbar = viewer.toolbar; - const searchResultsPage = new SearchResultsPage(); - const { searchInput } = searchResultsPage.header; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username: userConsumer }); - await apis.admin.people.createUser({ username: userCollaborator }); - await apis.admin.people.createUser({ username: userDemoted }); - - await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(siteName); - - file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id; - file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id; - file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id; - folder1Id = (await apis.admin.nodes.createFolder(folder1, docLibId)).entry.id; - folder2Id = (await apis.admin.nodes.createFolder(folder2, docLibId)).entry.id; - - docxFileId = (await apis.admin.upload.uploadFile(docxFile, docLibId)).entry.id; - - await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - await apis.admin.sites.addSiteMember(siteName, userCollaborator, SITE_ROLES.SITE_COLLABORATOR.ROLE); - await apis.admin.sites.addSiteMember(siteName, userDemoted, SITE_ROLES.SITE_MANAGER.ROLE); - - fileLockedId = (await apis.admin.nodes.createFile(fileLocked, docLibId)).entry.id; - await apis.userDemoted.nodes.lockFile(fileLockedId); - await apis.userDemoted.favorites.addFavoriteById('file', fileLockedId); - await apis.userDemoted.shared.shareFileById(fileLockedId); - await apis.admin.sites.updateSiteMember(siteName, userDemoted, SITE_ROLES.SITE_CONSUMER.ROLE); - - await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); - - await apis.userConsumer.shared.shareFileById(file1Id); - await apis.userConsumer.shared.shareFileById(file2Id); - await apis.userConsumer.shared.shareFileById(docxFileId); - await apis.userConsumer.shared.shareFileById(file3Id); - await apis.userConsumer.shared.waitForApi({ expect: 5 }); - - await apis.userConsumer.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, docxFileId]); - await apis.userConsumer.favorites.addFavoritesByIds('folder', [folder1Id, folder2Id]); - await apis.userConsumer.favorites.waitForApi({ expect: 6 }); - - await apis.userCollaborator.favorites.addFavoritesByIds('file', [file1Id, docxFileId]); - await apis.userCollaborator.favorites.waitForApi({ expect: 2 }); - - await apis.admin.favorites.addFavoriteById('file', fileLockedId); - - done(); - }); - - afterAll(async (done) => { - await apis.admin.sites.deleteSite(siteName); - done(); - }); - - describe('Collaborator', () => { - beforeAll(async (done) => { - await loginPage.loginWith(userCollaborator); - done(); - }); - - it('on File Libraries - [C297647]', async () => { - await page.clickFileLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteName); - await dataTable.waitForHeader(); - await dataTable.selectItem(file1); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${file1}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${file1}`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${file1}`); - expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await toolbar.closeMoreMenu(); - }); - - it('on Shared Files - [C297651]', async () => { - await page.clickSharedFilesAndWait(); - await page.dataTable.selectItem(file1); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - // TODO: change expect to true when ACA-2173 is done - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${file1}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${file1}`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${file1}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await toolbar.closeMoreMenu(); - }); - - it('on Favorites - [C297652]', async () => { - await page.clickFavoritesAndWait(); - await dataTable.selectItem(file1); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); - // TODO: replace with isSharedLinkSettingsPresent when ACA-2175 is done - expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`); - - await toolbar.openMoreMenu(); - - // TODO: change expect to true when ACA-2174 is done - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is not displayed for ${file1}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`); - // TODO: change expect to false when ACA-1737 is done - expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is displayed for ${file1}`); - // TODO: change expect to false when ACA-1737 is done - expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is displayed for ${file1}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await toolbar.closeMoreMenu(); - }); - - it('on Search Results - [C297653]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(file1); - await dataTable.selectItem(file1); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${file1}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${file1}`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${file1}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await toolbar.closeMoreMenu(); - }); - - describe('in the viewer', () => { - beforeEach(async (done) => { - await Utils.pressEscape(); - await dataTable.clearSelection(); - await page.clickPersonalFiles(); - done(); - }); - - afterAll(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('file opened from File Libraries - [C297654]', async () => { - await page.clickFileLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteName); - await dataTable.waitForHeader(); - await dataTable.doubleClickOnRowByName(docxFile); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Shared Files - [C297655]', async () => { - await page.clickSharedFilesAndWait(); - await dataTable.doubleClickOnRowByName(docxFile); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Favorites - [C297656]', async () => { - await page.clickFavoritesAndWait(); - await dataTable.doubleClickOnRowByName(docxFile); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove Favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Search Results - [C306992]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(docxFile); - await dataTable.waitForBody(); - await dataTable.doubleClickOnRowByName(docxFile); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - }); - }); - - describe('File locked - lock owner : ', () => { - beforeAll(async (done) => { - await loginPage.loginWith(userDemoted); - done(); - }); - - it('on File Libraries - [C297657]', async () => { - await page.clickFileLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteName); - await dataTable.waitForHeader(); - await dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`); - expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed'); - - await toolbar.closeMoreMenu(); - }); - - it('on Shared Files - [C297658]', async () => { - await page.clickSharedFilesAndWait(); - await page.dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - // TODO: change expect to true when ACA-2173 is done - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed'); - - await toolbar.closeMoreMenu(); - }); - - it('on Favorites - [C297659]', async () => { - await page.clickFavoritesAndWait(); - await dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - // TODO: replace with isSharedLinkSettingsPresent when ACA-2175 is done - expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - // TODO: change expect to true when ACA-2174 is fixed - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - // TODO: change expect to false when ACA-1737 is fixed - expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is displayed for ${fileLocked}`); - // TODO: change expect to false when ACA-1737 is fixed - expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is displayed for ${fileLocked}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed'); - - await toolbar.closeMoreMenu(); - }); - - it('on Search Results - [C297660]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(fileLocked); - await dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed'); - - await toolbar.closeMoreMenu(); - }); - - describe('in the viewer', () => { - beforeEach(async (done) => { - await Utils.pressEscape(); - await dataTable.clearSelection(); - await page.clickPersonalFiles(); - done(); - }); - - afterAll(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('file opened from File Libraries - [C297661]', async () => { - await page.clickFileLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteName); - await dataTable.waitForHeader(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Shared Files - [C297662]', async () => { - await page.clickSharedFilesAndWait(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Favorites - [C297663]', async () => { - await page.clickFavoritesAndWait(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`); - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Search Results - [C306993]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(fileLocked); - await dataTable.waitForBody(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - }); - }); - - describe('File locked - manager : ', () => { - beforeAll(async (done) => { - await loginPage.loginWithAdmin(); - done(); - }); - - it('on File Libraries - [C297664]', async () => { - await page.clickFileLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteName); - await dataTable.waitForHeader(); - await dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, 'Upload new version is displayed'); - - await toolbar.closeMoreMenu(); - }); - - it('on Shared Files - [C297665]', async () => { - await page.clickSharedFilesAndWait(); - await page.dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - // TODO: change expect to true when ACA-2173 is done - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - // TODO: change expect to false when ACA-2173 is done - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is displayed'); - - await toolbar.closeMoreMenu(); - }); - - it('on Favorites - [C297666]', async () => { - await page.clickFavoritesAndWait(); - await dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - // TODO: replace with isSharedLinkSettingsPresent when ACA-2175 is done - expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - // TODO: change expect to true when ACA-2174 is fixed - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - // TODO: change expect to false when ACA-1737 is done - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is displayed'); - - await toolbar.closeMoreMenu(); - }); - - it('on Search Results - [C297667]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(fileLocked); - await dataTable.selectItem(fileLocked); - - expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`); - expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`); - expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`); - expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`); - expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`); - - await toolbar.openMoreMenu(); - - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked} in Search Results`); - expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked} in Search Results`); - expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`); - expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed'); - expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, 'Upload new version is displayed'); - - await toolbar.closeMoreMenu(); - }); - - describe('in the viewer', () => { - beforeEach(async (done) => { - await Utils.pressEscape(); - await dataTable.clearSelection(); - await page.clickPersonalFiles(); - done(); - }); - - afterAll(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('file opened from File Libraries - [C297671]', async () => { - await page.clickFileLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteName); - await dataTable.waitForHeader(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Shared Files - [C297672]', async () => { - await page.clickSharedFilesAndWait(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Favorites - [C297673]', async () => { - await page.clickFavoritesAndWait(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`); - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - expect(await viewerToolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`); - expect(await viewerToolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - - it('file opened from Search Results - [C306994]', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(fileLocked); - await dataTable.waitForBody(); - await dataTable.doubleClickOnRowByName(fileLocked); - await viewer.waitForViewerToOpen(); - - expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`); - expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`); - expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`); - expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`); - expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed'); - expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`); - - await viewerToolbar.openMoreMenu(); - - expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`); - expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`); - expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`); - expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`); - expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`); - // TODO: change expect to true when ACA-2319 is fixed - expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is not displayed`); - // TODO: change expect to true when ACA-2319 is fixed - expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is not displayed`); - expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`); - expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`); - - await viewerToolbar.closeMoreMenu(); - }); - }); - }); -}); diff --git a/e2e/suites/actions-available/special-permissions/other-permissions.ts b/e2e/suites/actions-available/special-permissions/other-permissions.ts new file mode 100755 index 000000000..9f8ae1f76 --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/other-permissions.ts @@ -0,0 +1,324 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage, SearchResultsPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data-permissions'; +import * as testUtil from '../test-util'; + +const page = new BrowsingPage(); +const { dataTable } = page; +const searchResultsPage = new SearchResultsPage(); +const { searchInput } = searchResultsPage.header; + +export function collaboratorTests(siteName?: string) { + describe('available actions : ', () => { + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + it('on File Libraries - [C297647]', async () => { + await page.clickFileLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Shared Files - [C297651]', async () => { + await page.clickSharedFilesAndWait(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Favorites - [C297652]', async () => { + await page.clickFavoritesAndWait(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + // TODO: investigate why 'Edit Offline' is not displayed and raise issue + // TODO: remove 'Move' and 'Delete' when ACA-1737 is done + const expectedToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; + + await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Search Results - [C297653]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(testData.fileSharedFav.name); + + const expectedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + describe('available actions in the viewer : ', () => { + it('file opened from File Libraries - [C297654]', async () => { + await page.clickFileLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Shared Files - [C297655]', async () => { + await page.clickSharedFilesAndWait(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Favorites - [C297656]', async () => { + await page.clickFavoritesAndWait(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Search Results - [C306992]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(testData.fileDocxSharedFav.name); + await searchResultsPage.waitForResults(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, expectedToolbarPrimary, expectedToolbarMore); + }); + }); + }); +} + +export function filesLockedByCurrentUser(siteName?: string) { + describe('available actions : ', () => { + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + it('on File Libraries - [C297657]', async () => { + await page.clickFileLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Shared Files - [C297658]', async () => { + await page.clickSharedFilesAndWait(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Favorites - [C297659]', async () => { + await page.clickFavoritesAndWait(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + // TODO: remove 'Move' and 'Delete' when ACA-1737 is fixed + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Search Results - [C297660]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(testData.fileLockedByUser); + await searchResultsPage.waitForResults(); + + const expectedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + describe('available actions in the viewer : ', () => { + it('file opened from File Libraries - [C297661]', async () => { + await page.clickFileLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Shared Files - [C297662]', async () => { + await page.clickSharedFilesAndWait(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Favorites - [C297663]', async () => { + await page.clickFavoritesAndWait(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Search Results - [C306993]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(testData.fileLockedByUser); + await searchResultsPage.waitForResults(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + }); + }); +} + +export function filesLockedByOtherUser(siteName?: string) { + describe('available actions : ', () => { + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + it('on File Libraries - [C297664]', async () => { + await page.clickFileLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Shared Files - [C297665]', async () => { + await page.clickSharedFilesAndWait(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + // TODO: investigate why 'Upload New Version' appears and raise issue + const expectedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Favorites - [C297666]', async () => { + await page.clickFavoritesAndWait(); + + const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + // TODO: investigate why 'Cancel Editing' doesn't appear and raise issue + // TODO: remove 'Upload New Version' when ACA-1737 is done + const expectedToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('on Search Results - [C297667]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(testData.fileLockedByUser); + await searchResultsPage.waitForResults(); + + const expectedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkToolbarActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + describe('available actions in the viewer : ', () => { + it('file opened from File Libraries - [C297671]', async () => { + await page.clickFileLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Shared Files - [C297672]', async () => { + await page.clickSharedFilesAndWait(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Favorites - [C297673]', async () => { + await page.clickFavoritesAndWait(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + + it('file opened from Search Results - [C306994]', async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor(testData.fileLockedByUser); + await searchResultsPage.waitForResults(); + + const expectedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; + // TODO: add 'Move' and 'Delete' when ACA-2319 is fixed + const expectedToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; + + await testUtil.checkViewerActions(testData.fileLockedByUser, expectedToolbarPrimary, expectedToolbarMore); + }); + }); + }); +} diff --git a/e2e/suites/actions-available/special-permissions/permissions-favorites.test.ts b/e2e/suites/actions-available/special-permissions/permissions-favorites.test.ts deleted file mode 100755 index a645b9c8c..000000000 --- a/e2e/suites/actions-available/special-permissions/permissions-favorites.test.ts +++ /dev/null @@ -1,198 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-permissions'; -import * as testUtil from '../test-util'; - -describe('Special permissions actions : on Favorites : ', () => { - - const site = `site-private-${Utils.random()}`; - - const userConsumer = `consumer-${Utils.random()}`; - - let fileDocxFavId, fileFavId, fileDocxSharedFavId, fileSharedFavId, fileFavLockedId, fileSharedFavLockedId; - let folderFavId, folderFav2Id; - - const file3 = `file-3-${Utils.random()}.txt`; - let file3Id; - - const apis = { - admin: new RepoClient(), - userConsumer: new RepoClient(userConsumer, userConsumer) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username: userConsumer }); - - await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(site); - await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - - fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id; - fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id; - fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id; - fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id; - fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id; - fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id; - - file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id; - - folderFavId = (await apis.admin.nodes.createFolder(data.folderFav.name, docLibId)).entry.id; - folderFav2Id = (await apis.admin.nodes.createFolder(data.folderFav2.name, docLibId)).entry.id; - await apis.userConsumer.favorites.addFavoriteById('folder', folderFavId); - await apis.userConsumer.favorites.addFavoriteById('folder', folderFav2Id); - - await apis.userConsumer.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.userConsumer.shared.shareFilesByIds([ - fileDocxSharedFavId, - fileSharedFavId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.admin.nodes.lockFile(fileFavLockedId); - await apis.admin.nodes.lockFile(fileSharedFavLockedId); - - await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); - - await apis.userConsumer.favorites.waitForApi({ expect: 9 }); - await apis.userConsumer.shared.waitForApi({ expect: 4 }); - - await loginPage.loginWith(userConsumer); - done(); - }); - - afterAll(async (done) => { - await apis.admin.sites.deleteSite(site); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickFavoritesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('on a file', () => { - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.favoritesContextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.favoritesContextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesContextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.favoritesContextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.favoritesContextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesContextMenu); - }); - }); - - describe('on a folder', () => { - it('Folder favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.favoritesToolbarMore); - await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.favoritesContextMenu); - }); - }); - - describe('on multiple selection', () => { - it('multiple files - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('multiple locked files - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('multiple folders - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('both files and folders - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesToolbarMore); - }); - - it('multiple files with different granular permissions - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileFav.name, file3 ], data.multipleSelAllFav.favoritesContextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileFav.name, file3 ], data.multipleSelAllFav.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFav.name, file3 ], data.multipleSelAllFav.favoritesToolbarMore); - }); - }); - -}); diff --git a/e2e/suites/actions-available/special-permissions/permissions-my-libraries.test.ts b/e2e/suites/actions-available/special-permissions/permissions-my-libraries.test.ts deleted file mode 100755 index bc6abb7a1..000000000 --- a/e2e/suites/actions-available/special-permissions/permissions-my-libraries.test.ts +++ /dev/null @@ -1,266 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-permissions'; -import * as testUtil from '../test-util'; - -describe('Special permissions actions : on File Libraries : ', () => { - - const site = `site-private-${Utils.random()}`; - - const userConsumer = `consumer-${Utils.random()}`; - - const file3 = `file-3-${Utils.random()}.txt`; - let file3Id; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - let folderFavId; - - const apis = { - admin: new RepoClient(), - userConsumer: new RepoClient(userConsumer, userConsumer) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username: userConsumer }); - - await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(site); - await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - - await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocx.name ); - fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id; - await apis.admin.nodes.createFile(data.file.name, docLibId); - fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id; - fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id; - fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id; - fileLockedId = (await apis.admin.nodes.createFile(data.fileLocked.name, docLibId)).entry.id; - fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id; - fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id; - fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id; - - file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id; - - await apis.admin.nodes.createFolder(data.folder.name, docLibId); - folderFavId = (await apis.admin.nodes.createFolder(data.folderFav.name, docLibId)).entry.id; - done(); - }); - - beforeAll(async (done) => { - await apis.userConsumer.favorites.addFavoriteById('folder', folderFavId); - - await apis.userConsumer.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.userConsumer.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.admin.nodes.lockFile(fileLockedId); - await apis.admin.nodes.lockFile(fileFavLockedId); - await apis.admin.nodes.lockFile(fileSharedLockedId); - await apis.admin.nodes.lockFile(fileSharedFavLockedId); - - await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); - - await apis.userConsumer.favorites.waitForApi({ expect: 8 }); - await apis.userConsumer.shared.waitForApi({ expect: 7 }); - done(); - }); - - beforeAll(async (done) => { - await loginPage.loginWith(userConsumer); - done(); - }); - - afterAll(async (done) => { - await apis.admin.sites.deleteSite(site); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(site); - await dataTable.waitForHeader(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('on a file', () => { - - it('File Office - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore); - await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu); - }); - - it('File simple - []', async () => { - await testUtil.checkToolbarPrimary(data.file.name, data.file.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore); - await testUtil.checkContextMenu(data.file.name, data.file.contextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu); - }); - - it('File locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu); - }); - }); - - describe('on a folder', () => { - - it('Folder not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folder.name, data.folder.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.toolbarMore); - await testUtil.checkContextMenu(data.folder.name, data.folder.contextMenu); - }); - - it('Folder favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.toolbarMore); - await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.contextMenu); - }); - }); - - describe('on multiple selection', () => { - it('multiple files - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarMore); - }); - - it('multiple locked files - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore); - }); - - it('multiple folders - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folder.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarMore); - }); - - it('both files and folders - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folder.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folder.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folder.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files with different granular permissions - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, file3 ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.toolbarMore); - }); - }); -}); diff --git a/e2e/suites/actions-available/special-permissions/permissions-search.test.ts b/e2e/suites/actions-available/special-permissions/permissions-search.test.ts deleted file mode 100755 index 6bcfdd7b4..000000000 --- a/e2e/suites/actions-available/special-permissions/permissions-search.test.ts +++ /dev/null @@ -1,310 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-permissions'; -import * as testUtil from '../test-util'; - -describe('Special permissions actions : on Search Results : ', () => { - - const site = `site-private-${Utils.random()}`; - - const userConsumer = `consumer-${Utils.random()}`; - - const file3 = `file-3-${Utils.random()}.txt`; - let file3Id; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - let folderFavId; - - const apis = { - admin: new RepoClient(), - userConsumer: new RepoClient(userConsumer, userConsumer) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { searchInput } = page.header; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username: userConsumer }); - - await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(site); - await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - - await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocx.name ); - fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id; - await apis.admin.nodes.createFile(data.file.name, docLibId); - fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id; - fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id; - fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id; - fileLockedId = (await apis.admin.nodes.createFile(data.fileLocked.name, docLibId)).entry.id; - fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id; - fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id; - fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id; - - file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id; - - await apis.admin.nodes.createFolder(data.folder.name, docLibId); - folderFavId = (await apis.admin.nodes.createFolder(data.folderFav.name, docLibId)).entry.id; - await apis.userConsumer.favorites.addFavoriteById('folder', folderFavId); - - await apis.userConsumer.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.userConsumer.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.admin.nodes.lockFile(fileLockedId); - await apis.admin.nodes.lockFile(fileFavLockedId); - await apis.admin.nodes.lockFile(fileSharedLockedId); - await apis.admin.nodes.lockFile(fileSharedFavLockedId); - - await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); - - await apis.userConsumer.favorites.waitForApi({ expect: 8 }); - await apis.userConsumer.shared.waitForApi({ expect: 7 }); - await apis.userConsumer.search.waitForApi(userConsumer, { expect: 13 }); - - await loginPage.loginWith(userConsumer); - done(); - }); - - afterAll(async (done) => { - await apis.admin.sites.deleteSite(site); - done(); - }); - - describe('on a file', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore); - await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu); - }); - - it('File simple - []', async () => { - await testUtil.checkToolbarPrimary(data.file.name, data.file.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore); - await testUtil.checkContextMenu(data.file.name, data.file.contextMenu); - }); - - it('File favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore); - await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu); - }); - - it('File locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu); - }); - }); - - describe('on a folder', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFolders(); - await searchInput.searchFor('folder-'); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('Folder not favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folder.name, data.folder.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.toolbarMore); - await testUtil.checkContextMenu(data.folder.name, data.folder.contextMenu); - }); - - it('Folder favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.searchToolbarPrimary); - await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.toolbarMore); - await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.contextMenu); - }); - }); - - describe('on multiple selection', () => { - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('multiple files - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.file.name, data.fileDocxShared.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.fileDocxShared.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.toolbarMore); - }); - - it('multiple locked files - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore); - }); - - it('multiple folders - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFolders(); - await searchInput.searchFor('folder-'); - - await testUtil.checkMultipleSelContextMenu([ data.folder.name, data.folderFav.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.folder.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.folder.name, data.folderFav.name ], data.multipleSel.toolbarMore); - }); - - it('both files and folders - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); - await searchInput.searchFor(`=${data.file.name} or =${data.folderFav.name}`); - - await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folderFav.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folderFav.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files with different granular permissions - []', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - - await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, file3 ], data.multipleSel.searchToolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.toolbarMore); - }); - }); -}); diff --git a/e2e/suites/actions-available/special-permissions/permissions-shared.test.ts b/e2e/suites/actions-available/special-permissions/permissions-shared.test.ts deleted file mode 100755 index 6f5404bc0..000000000 --- a/e2e/suites/actions-available/special-permissions/permissions-shared.test.ts +++ /dev/null @@ -1,179 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-permissions'; -import * as testUtil from '../test-util'; - -describe('Special permissions actions : on Shared Files : ', () => { - - const site = `site-private-${Utils.random()}`; - - const userConsumer = `consumer-${Utils.random()}`; - - const file3 = `file-3-${Utils.random()}.txt`; - let file3Id; - - let fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileSharedLockedId, fileSharedFavLockedId; - - const apis = { - admin: new RepoClient(), - userConsumer: new RepoClient(userConsumer, userConsumer) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username: userConsumer }); - - await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(site); - await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - - fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id; - fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id; - fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id; - fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id; - - file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id; - - await apis.userConsumer.favorites.addFavoritesByIds('file', [ - fileDocxSharedFavId, - fileSharedFavId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.userConsumer.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId, - file3Id - ]); - - await apis.admin.nodes.lockFile(fileSharedLockedId); - await apis.admin.nodes.lockFile(fileSharedFavLockedId); - - await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); - - await apis.userConsumer.favorites.waitForApi({ expect: 7 }); - await apis.userConsumer.shared.waitForApi({ expect: 4 }); - - await loginPage.loginWith(userConsumer); - done(); - }); - - afterAll(async (done) => { - await apis - await apis.admin.sites.deleteSite(site); - done(); - }); - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickSharedFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - describe('single selection', () => { - - it('File Office, shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.sharedContextMenu); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedContextMenu); - }); - - it('File shared - []', async () => { - await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.sharedContextMenu); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.sharedContextMenu); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.sharedContextMenu); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary); - await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedToolbarMore); - await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedContextMenu); - }); - }); - - describe('multiple selection', () => { - it('multiple files - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files - all favorite - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarMore); - }); - - it('multiple locked files - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore); - }); - - it('multiple files with different granular permissions - []', async () => { - await testUtil.checkMultipleSelContextMenu([ data.fileSharedFav.name, file3 ], data.multipleSelAllFav.contextMenu); - await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedFav.name, file3 ], data.multipleSel.toolbarPrimary); - await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedFav.name, file3 ], data.multipleSelAllFav.toolbarMore); - }); - }); - -}); diff --git a/e2e/suites/actions-available/special-permissions/permissions-viewer.test.ts b/e2e/suites/actions-available/special-permissions/permissions-viewer.test.ts deleted file mode 100755 index 967536163..000000000 --- a/e2e/suites/actions-available/special-permissions/permissions-viewer.test.ts +++ /dev/null @@ -1,401 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../../pages/pages'; -import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs'; -import { RepoClient } from '../../../utilities/repo-client/repo-client'; -import { Utils } from '../../../utilities/utils'; -import * as data from './test-data-permissions'; -import * as testUtil from '../test-util'; - -describe('Special permissions actions : in the Viewer : ', () => { - - const site = `site-private-${Utils.random()}`; - - const userConsumer = `consumer-${Utils.random()}`; - - let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId; - - const apis = { - admin: new RepoClient(), - userConsumer: new RepoClient(userConsumer, userConsumer) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username: userConsumer }); - - await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(site); - await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE); - - await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocx.name ); - fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id; - await apis.admin.nodes.createFile(data.file.name, docLibId); - fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id; - fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id; - fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id; - fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id; - fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id; - fileLockedId = (await apis.admin.nodes.createFile(data.fileLocked.name, docLibId)).entry.id; - fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id; - fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id; - fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id; - - done(); - }); - - beforeAll(async (done) => { - await apis.userConsumer.favorites.addFavoritesByIds('file', [ - fileDocxFavId, - fileFavId, - fileDocxSharedFavId, - fileSharedFavId, - fileFavLockedId, - fileSharedFavLockedId - ]); - - await apis.userConsumer.shared.shareFilesByIds([ - fileDocxSharedId, - fileDocxSharedFavId, - fileSharedId, - fileSharedFavId, - fileSharedLockedId, - fileSharedFavLockedId - ]); - - await apis.admin.nodes.lockFile(fileLockedId); - await apis.admin.nodes.lockFile(fileFavLockedId); - await apis.admin.nodes.lockFile(fileSharedLockedId); - await apis.admin.nodes.lockFile(fileSharedFavLockedId); - - await apis.userConsumer.favorites.waitForApi({ expect: 6 }); - await apis.userConsumer.shared.waitForApi({ expect: 6 }); - done(); - }); - - beforeAll(async (done) => { - await loginPage.loginWith(userConsumer); - done(); - }); - - afterAll(async (done) => { - await apis.admin.sites.deleteSite(site); - done(); - }); - - describe('file opened from File Libraries', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(site); - await dataTable.waitForHeader(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore); - }); - - it('File simple - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore); - }); - - it('File favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Favorites', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickFavoritesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore); - }); - - it('File favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Shared Files', () => { - - beforeEach(async (done) => { - await Utils.pressEscape(); - await page.clickSharedFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office, shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); - - describe('file opened from Search Results', () => { - - beforeAll(async (done) => { - await Utils.pressEscape(); - await page.clickPersonalFiles(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('file-'); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - it('File Office - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore); - }); - - it('File Office, favorite - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore); - }); - - it('File simple - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore); - }); - - it('File favorite - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore); - }); - - it('File Office, shared - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore); - }); - - it('File Office, shared, favorite - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore); - }); - - it('File shared - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore); - }); - - it('File shared, favorite - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore); - }); - - it('File locked - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore); - }); - - it('File favorite, locked - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore); - }); - - it('File shared, locked - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore); - }); - - it('File shared, favorite, locked - []', async () => { - // await searchInput.clickSearchButton(); - // await searchInput.checkOnlyFiles(); - // await searchInput.searchFor('file-'); - - await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary); - await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore); - }); - }); -}); diff --git a/e2e/suites/actions-available/special-permissions/search-results.ts b/e2e/suites/actions-available/special-permissions/search-results.ts new file mode 100755 index 000000000..99e601456 --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/search-results.ts @@ -0,0 +1,190 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage, SearchResultsPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data-permissions'; +import * as testUtil from '../test-util'; + +export function searchResultsTests() { + const page = new BrowsingPage(); + const searchResultsPage = new SearchResultsPage(); + const { searchInput } = page.header; + + describe('available actions : ', () => { + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('on a file', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('file-'); + await searchResultsPage.waitForResults(); + }); + + it('File Office - [C286286]', async () => { + await testUtil.checkToolbarActions(testData.fileDocx.name, testData.fileDocx.searchToolbarPrimary, testData.fileDocx.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocx.name, testData.fileDocx.contextMenu); + }); + + it('File Office, favorite - [C286287]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxFav.name, testData.fileDocxFav.searchToolbarPrimary, testData.fileDocxFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxFav.name, testData.fileDocxFav.contextMenu); + }); + + it('File simple - [C286262]', async () => { + await testUtil.checkToolbarActions(testData.file.name, testData.file.searchToolbarPrimary, testData.file.toolbarMore); + await testUtil.checkContextMenu(testData.file.name, testData.file.contextMenu); + }); + + it('File favorite - [C286263]', async () => { + await testUtil.checkToolbarActions(testData.fileFav.name, testData.fileFav.searchToolbarPrimary, testData.fileFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileFav.name, testData.fileFav.contextMenu); + }); + + it('File Office, shared - [C286280]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.searchToolbarPrimary, testData.fileDocxShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.contextMenu); + }); + + it('File Office, shared, favorite - [C286281]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.searchToolbarPrimary, testData.fileDocxSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.contextMenu); + }); + + it('File shared - [C286282]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.searchToolbarPrimary, testData.fileShared.toolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.contextMenu); + }); + + it('File shared, favorite - [C291823]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.searchToolbarPrimary, testData.fileSharedFav.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.contextMenu); + }); + + it('File locked - [C291818]', async () => { + await testUtil.checkToolbarActions(testData.fileLocked.name, testData.fileLocked.searchToolbarPrimary, testData.fileLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileLocked.name, testData.fileLocked.contextMenu); + }); + + it('File favorite, locked - [C291819]', async () => { + await testUtil.checkToolbarActions(testData.fileFavLocked.name, testData.fileFavLocked.searchToolbarPrimary, testData.fileFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileFavLocked.name, testData.fileFavLocked.contextMenu); + }); + + it('File shared, locked - [C291824]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.searchToolbarPrimary, testData.fileSharedLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.contextMenu); + }); + + it('File shared, favorite, locked - [C291825]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.searchToolbarPrimary, testData.fileSharedFavLocked.toolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.contextMenu); + }); + + }); + + describe('on a folder', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('folder-'); + await searchResultsPage.waitForResults(); + }); + + it('Folder not favorite - [C291826]', async () => { + await testUtil.checkToolbarActions(testData.folder.name, testData.folder.searchToolbarPrimary, testData.folder.toolbarMore); + await testUtil.checkContextMenu(testData.folder.name, testData.folder.contextMenu); + }); + + it('Folder favorite - [C291829]', async () => { + await testUtil.checkToolbarActions(testData.folderFav.name, testData.folderFav.searchToolbarPrimary, testData.folderFav.toolbarMore); + await testUtil.checkContextMenu(testData.folderFav.name, testData.folderFav.contextMenu); + }); + + }); + + describe('on multiple selection', () => { + + describe('of files', () => { + + beforeAll(async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('file-'); + await searchResultsPage.waitForResults(); + }); + + it('multiple files - [C291830]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.file.name, testData.fileDocxShared.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.file.name, testData.fileDocxShared.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files - all favorite - [C291834]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileSharedFav.name ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileSharedFav.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + it('multiple locked files - [C291835]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files with different granular permissions - [C286310]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileDocxFav.name, testData.fileGranularPermission ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileDocxFav.name, testData.fileGranularPermission ], testData.multipleSel.searchToolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + }); + + it('multiple folders - [C291836]', async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor('folder-'); + + await testUtil.checkMultipleSelContextMenu([ testData.folder.name, testData.folderFav.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.folder.name, testData.folderFav.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('both files and folders - [C268128]', async () => { + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.searchFor(`=${testData.file.name} or =${testData.folderFav.name}`); + + await testUtil.checkMultipleSelContextMenu([ testData.file.name, testData.folderFav.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.file.name, testData.folderFav.name ], testData.multipleSel.searchToolbarPrimary, testData.multipleSel.toolbarMore); + }); + + }); + }); +} diff --git a/e2e/suites/actions-available/special-permissions/shared-files.ts b/e2e/suites/actions-available/special-permissions/shared-files.ts new file mode 100755 index 000000000..452306681 --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/shared-files.ts @@ -0,0 +1,107 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data-permissions'; +import * as testUtil from '../test-util'; + +export function sharedFilesTests() { + const page = new BrowsingPage(); + + describe('available actions : ', () => { + + beforeAll(async () => { + await page.clickSharedFilesAndWait(); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('single selection', () => { + + it('File Office, shared - [C326626]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxShared.name, testData.fileDocxShared.toolbarPrimary, testData.fileDocxShared.sharedToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxShared.name, testData.fileDocxShared.sharedContextMenu); + }); + + it('File Office, shared, favorite - [C326627]', async () => { + await testUtil.checkToolbarActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.toolbarPrimary, testData.fileDocxSharedFav.sharedToolbarMore); + await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.sharedContextMenu); + }); + + it('File shared - [C326628]', async () => { + await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.toolbarPrimary, testData.fileShared.sharedToolbarMore); + await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.sharedContextMenu); + }); + + it('File shared, favorite - [C326629]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFav.name, testData.fileSharedFav.toolbarPrimary, testData.fileSharedFav.sharedToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFav.name, testData.fileSharedFav.sharedContextMenu); + }); + + it('File shared, locked - [C326631]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedLocked.name, testData.fileSharedLocked.toolbarPrimary, testData.fileSharedLocked.sharedToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedLocked.name, testData.fileSharedLocked.sharedContextMenu); + }); + + it('File shared, favorite, locked - [C326632]', async () => { + await testUtil.checkToolbarActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.toolbarPrimary, testData.fileSharedFavLocked.sharedToolbarMore); + await testUtil.checkContextMenu(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.sharedContextMenu); + }); + + }); + + describe('multiple selection', () => { + + it('multiple files - [C326634]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileShared.name, testData.fileSharedFav.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileShared.name, testData.fileSharedFav.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files - all favorite - [C326635]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileSharedFav.name, testData.fileSharedFavLocked.name ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileSharedFav.name, testData.fileSharedFavLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + it('multiple locked files - [C326636]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileSharedLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileSharedLocked.name, testData.fileSharedFavLocked.name ], testData.multipleSel.toolbarPrimary, testData.multipleSel.toolbarMore); + }); + + it('multiple files with different granular permissions - [C326639]', async () => { + await testUtil.checkMultipleSelContextMenu([ testData.fileSharedFav.name, testData.fileGranularPermission ], testData.multipleSelAllFav.contextMenu); + await testUtil.checkMultipleSelToolbarActions([ testData.fileSharedFav.name, testData.fileGranularPermission ], testData.multipleSel.toolbarPrimary, testData.multipleSelAllFav.toolbarMore); + }); + + }); + + }); +} diff --git a/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts b/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts new file mode 100644 index 000000000..9ba463a3c --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts @@ -0,0 +1,207 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage } from '../../../pages/pages'; +import { FILES, SITE_ROLES } from '../../../configs'; +import { RepoClient } from '../../../utilities/repo-client/repo-client'; +import { Utils } from '../../../utilities/utils'; +import { AdminActions } from '../../../utilities/admin-actions'; +import * as testData from './test-data-permissions'; +import { librariesTests } from './my-libraries'; +import { favoritesTests } from './favorites'; +import { searchResultsTests } from './search-results'; +import { viewerTests } from './viewer'; +import { sharedFilesTests } from './shared-files'; +import { collaboratorTests, filesLockedByCurrentUser, filesLockedByOtherUser } from './other-permissions'; + +describe('Special permissions : ', () => { + const random = Utils.random(); + + const sitePrivate = `site-private-${random}`; + + const userManager = `manager-${random}`; + const userConsumer = `consumer-${random}`; + const userCollaborator = `collaborator-${random}`; + const userDemoted = `demoted-${random}`; + + let fileDocxFavId: string; + let fileFavId: string; + let fileDocxSharedId: string; + let fileDocxSharedFavId: string; + let fileSharedId: string; + let fileSharedFavId: string; + let fileLockedId: string; + let fileFavLockedId: string; + let fileSharedLockedId: string; + let fileSharedFavLockedId: string; + let fileGranularPermissionId: string; + let fileLockedByUserId: string; + let folderFavId: string; + let folderFav2Id: string; + + const adminApiActions = new AdminActions(); + + const userManagerApi = new RepoClient(userManager, userManager); + const userConsumerApi = new RepoClient(userConsumer, userConsumer); + const userCollaboratorApi = new RepoClient(userCollaborator, userCollaborator); + const userDemotedApi = new RepoClient(userDemoted, userDemoted); + + const loginPage = new LoginPage(); + + beforeAll(async () => { + await adminApiActions.createUser({ username: userManager }); + await adminApiActions.createUser({ username: userConsumer }); + await adminApiActions.createUser({ username: userCollaborator }); + await adminApiActions.createUser({ username: userDemoted }); + + await userManagerApi.sites.createSitePrivate(sitePrivate); + const docLibId = await userManagerApi.sites.getDocLibId(sitePrivate); + await userManagerApi.sites.addSiteConsumer(sitePrivate, userConsumer); + await userManagerApi.sites.addSiteCollaborator(sitePrivate, userCollaborator); + await userManagerApi.sites.addSiteManager(sitePrivate, userDemoted); + + await userManagerApi.upload.uploadFileWithRename(FILES.docxFile, docLibId, testData.fileDocx.name ); + fileDocxFavId = (await userManagerApi.upload.uploadFileWithRename(FILES.docxFile, docLibId, testData.fileDocxFav.name)).entry.id; + await userManagerApi.nodes.createFile(testData.file.name, docLibId); + fileFavId = (await userManagerApi.nodes.createFile(testData.fileFav.name, docLibId)).entry.id; + fileDocxSharedId = (await userManagerApi.upload.uploadFileWithRename(FILES.docxFile, docLibId, testData.fileDocxShared.name)).entry.id; + fileDocxSharedFavId = (await userManagerApi.upload.uploadFileWithRename(FILES.docxFile, docLibId, testData.fileDocxSharedFav.name)).entry.id; + fileSharedId = (await userManagerApi.nodes.createFile(testData.fileShared.name, docLibId)).entry.id; + fileSharedFavId = (await userManagerApi.nodes.createFile(testData.fileSharedFav.name, docLibId)).entry.id; + fileLockedId = (await userManagerApi.nodes.createFile(testData.fileLocked.name, docLibId)).entry.id; + fileFavLockedId = (await userManagerApi.nodes.createFile(testData.fileFavLocked.name, docLibId)).entry.id; + fileSharedLockedId = (await userManagerApi.nodes.createFile(testData.fileSharedLocked.name, docLibId)).entry.id; + fileSharedFavLockedId = (await userManagerApi.nodes.createFile(testData.fileSharedFavLocked.name, docLibId)).entry.id; + fileGranularPermissionId = (await userManagerApi.nodes.createFile(testData.fileGranularPermission, docLibId)).entry.id; + + fileLockedByUserId = (await userManagerApi.nodes.createFile(testData.fileLockedByUser, docLibId)).entry.id; + await userDemotedApi.nodes.lockFile(fileLockedByUserId); + await userDemotedApi.favorites.addFavoriteById('file', fileLockedByUserId); + await userDemotedApi.shared.shareFileById(fileLockedByUserId); + await userManagerApi.sites.updateSiteMember(sitePrivate, userDemoted, SITE_ROLES.SITE_CONSUMER.ROLE); + + await userManagerApi.nodes.createFolder(testData.folder.name, docLibId); + folderFavId = (await userManagerApi.nodes.createFolder(testData.folderFav.name, docLibId)).entry.id; + folderFav2Id = (await userManagerApi.nodes.createFolder(testData.folderFav2.name, docLibId)).entry.id; + await userConsumerApi.favorites.addFavoritesByIds('folder', [folderFavId, folderFav2Id]); + + await userConsumerApi.favorites.addFavoritesByIds('file', [ + fileDocxFavId, + fileFavId, + fileDocxSharedFavId, + fileSharedFavId, + fileFavLockedId, + fileSharedFavLockedId, + fileGranularPermissionId + ]); + + await userConsumerApi.shared.shareFilesByIds([ + fileDocxSharedId, + fileDocxSharedFavId, + fileSharedId, + fileSharedFavId, + fileSharedLockedId, + fileSharedFavLockedId, + fileGranularPermissionId + ]); + + await userCollaboratorApi.favorites.addFavoritesByIds('file', [fileDocxSharedFavId, fileSharedFavId]); + + await userManagerApi.nodes.lockFile(fileLockedId); + await userManagerApi.nodes.lockFile(fileFavLockedId); + await userManagerApi.nodes.lockFile(fileSharedLockedId); + await userManagerApi.nodes.lockFile(fileSharedFavLockedId); + + await userManagerApi.nodes.setGranularPermission(fileGranularPermissionId, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE); + + await userManagerApi.favorites.addFavoriteById('file', fileLockedByUserId); + + await Promise.all([ + userConsumerApi.favorites.waitForApi({ expect: 9 }), + userConsumerApi.shared.waitForApi({ expect: 8 }), + userManagerApi.search.waitForApi(userManager, { expect: 14 }), + userCollaboratorApi.favorites.waitForApi({ expect: 2 }) + ]); + }); + + afterAll(async () => { + await userManagerApi.sites.deleteSite(sitePrivate); + }); + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + describe('Consumer', () => { + + beforeAll(async () => { + await loginPage.loginWith(userConsumer); + }); + + describe('on File Libraries', () => { + librariesTests(sitePrivate); + }); + + describe('on Favorites', () => { + favoritesTests(); + }); + + describe('on Search Results', () => { + searchResultsTests(); + }); + + describe('on Viewer', () => { + viewerTests(sitePrivate); + }); + + describe('on Shared Files', () => { + sharedFilesTests(); + }); + }); + + describe('Collaborator', () => { + beforeAll(async () => { + await loginPage.loginWith(userCollaborator); + }); + + collaboratorTests(sitePrivate); + }); + + describe('File locked - user is lock owner', () => { + beforeAll(async () => { + await loginPage.loginWith(userDemoted); + }); + + filesLockedByCurrentUser(sitePrivate); + }); + + describe('File locked by other user - user is manager', () => { + beforeAll(async () => { + await loginPage.loginWith(userManager); + }); + + filesLockedByOtherUser(sitePrivate); + }); +}); diff --git a/e2e/suites/actions-available/special-permissions/test-data-permissions.ts b/e2e/suites/actions-available/special-permissions/test-data-permissions.ts index 58c8cb8e7..3df083069 100644 --- a/e2e/suites/actions-available/special-permissions/test-data-permissions.ts +++ b/e2e/suites/actions-available/special-permissions/test-data-permissions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -52,29 +52,38 @@ const consumerViewerToolbarMore = ['Favorite', 'Copy', 'Manage Versions']; // ---- FAVORITES workarounds ---- // TODO: remove 'Move' and 'Delete' when ACA-1737 is done -// TODO: remove 'Upload New Version' when ACA-2175 is done +// TODO: investigate why 'Upload New Version' appears and raise issue const favoritesConsumerToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; // TODO: remove 'Move' and 'Delete' when ACA-1737 is done -// TODO: remove 'Upload New Version' when ACA-2175 is done +// TODO: investigate why 'Upload New Version' appears and raise issue const favoritesConsumerContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; // TODO: remove 'Move' and 'Delete' when ACA-1737 is done -// TODO: remove 'Upload New Version' when ACA-2175 is done -// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done -const favoritesConsumerSharedContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; -// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done -const favoritesConsumerSharedToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions']; +// TODO: investigate why 'Upload New Version' appears and raise issue +const favoritesConsumerSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions']; // ---- SHARED FILES workaround ---- -// TODO: remove 'Upload New Version' when ACA-2173 is done +// TODO: investigate why 'Upload New Version' appears and raise issue const sharedConsumerToolbarMore = ['Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; -// TODO: remove 'Upload New Version' when ACA-2173 is done +// TODO: investigate why 'Cancel Editing' appears and raise issue +// TODO: investigate why 'Upload New Version' appears and raise issue +const sharedConsumerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; +// TODO: investigate why 'Upload New Version' appears and raise issue const sharedConsumerFavToolbarMore = ['Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; -// TODO: remove 'Upload New Version' when ACA-2173 is done +// TODO: investigate why 'Cancel Editing' appears and raise issue +// TODO: investigate why 'Upload New Version' appears and raise issue +const sharedConsumerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; +// TODO: investigate why 'Upload New Version' appears and raise issue const sharedConsumerContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; -// TODO: remove 'Upload New Version' when ACA-2173 is done +// TODO: investigate why 'Cancel Editing' appears and raise issue +// TODO: investigate why 'Upload New Version' appears and raise issue +const sharedConsumerLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions']; +// TODO: investigate why 'Upload New Version' appears and raise issue const sharedConsumerFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; +// TODO: investigate why 'Cancel Editing' appears and raise issue +// TODO: investigate why 'Upload New Version' appears and raise issue +const sharedConsumerFavLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions']; export const fileDocx = { @@ -163,7 +172,6 @@ export const fileDocxSharedFav = { favoritesToolbarMore: favoritesConsumerToolbarMore, favoritesContextMenu: favoritesConsumerSharedContextMenu, - favoritesToolbarPrimary: favoritesConsumerSharedToolbarPrimary, sharedToolbarMore: sharedConsumerFavToolbarMore, sharedContextMenu: sharedConsumerFavContextMenu, @@ -199,7 +207,6 @@ export const fileSharedFav = { favoritesToolbarMore: favoritesConsumerToolbarMore, favoritesContextMenu: favoritesConsumerSharedContextMenu, - favoritesToolbarPrimary: favoritesConsumerSharedToolbarPrimary, sharedToolbarMore: sharedConsumerFavToolbarMore, sharedContextMenu: sharedConsumerFavContextMenu, @@ -246,8 +253,8 @@ export const fileSharedLocked = { viewerToolbarPrimary: consumerViewerSharedToolbarPrimary, viewerToolbarMore: consumerViewerToolbarMore, - sharedToolbarMore: sharedConsumerToolbarMore, - sharedContextMenu: sharedConsumerContextMenu, + sharedToolbarMore: sharedConsumerLockedToolbarMore, + sharedContextMenu: sharedConsumerLockedContextMenu, searchToolbarPrimary: searchConsumerSharedToolbarPrimary }; @@ -264,14 +271,16 @@ export const fileSharedFavLocked = { favoritesToolbarMore: favoritesConsumerToolbarMore, favoritesContextMenu: favoritesConsumerSharedContextMenu, - favoritesToolbarPrimary: favoritesConsumerSharedToolbarPrimary, - sharedToolbarMore: sharedConsumerFavToolbarMore, - sharedContextMenu: sharedConsumerFavContextMenu, + sharedToolbarMore: sharedConsumerFavLockedToolbarMore, + sharedContextMenu: sharedConsumerFavLockedContextMenu, searchToolbarPrimary: searchConsumerSharedToolbarPrimary }; +export const fileGranularPermission = `file-granular-${Utils.random()}.txt`; +export const fileLockedByUser = `my-file-locked-${Utils.random()}.txt`; + // ---- folders --- const consumerFolderContextMenu = ['Download', 'Favorite', 'Copy']; diff --git a/e2e/suites/actions-available/special-permissions/viewer.ts b/e2e/suites/actions-available/special-permissions/viewer.ts new file mode 100755 index 000000000..e6ec6b0b0 --- /dev/null +++ b/e2e/suites/actions-available/special-permissions/viewer.ts @@ -0,0 +1,227 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage, SearchResultsPage } from '../../../pages/pages'; +import { Utils } from '../../../utilities/utils'; +import * as testData from './test-data-permissions'; +import * as testUtil from '../test-util'; + +export function viewerTests(siteName?: string) { + const page = new BrowsingPage(); + const searchResultsPage = new SearchResultsPage(); + const { dataTable } = page; + const { searchInput } = page.header; + + describe('available actions : ', () => { + + beforeEach(async () => { + await Utils.pressEscape(); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('file opened from File Libraries', () => { + + beforeAll(async () => { + await page.goToMyLibrariesAndWait(); + await dataTable.doubleClickOnRowByName(siteName); + await dataTable.waitForHeader(); + }); + + it('File Office - [C326622]', async () => { + await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.viewerToolbarMore); + }); + + it('File Office, favorite - [C326623]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.viewerToolbarMore); + }); + + it('File simple - [C326624]', async () => { + await testUtil.checkViewerActions(testData.file.name, testData.file.viewerToolbarPrimary, testData.file.viewerToolbarMore); + }); + + it('File favorite - [C326625]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.viewerToolbarMore); + }); + + it('File Office, shared - [C326637]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326638]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared - [C326648]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.viewerToolbarMore); + }); + + it('File shared, favorite - [C326649]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File locked - [C326630]', async () => { + await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.viewerToolbarMore); + }); + + it('File favorite, locked - [C326633]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.viewerToolbarMore); + }); + + it('File shared, locked - [C326650]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326651]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + + }); + + describe('file opened from Favorites', () => { + + beforeAll(async () => { + await page.clickFavoritesAndWait(); + }); + + it('File Office, favorite - [C326652]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.viewerToolbarMore); + }); + + it('File favorite - [C326653]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326655]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared, favorite - [C326656]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File favorite, locked - [C326654]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326657]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + + }); + + describe('file opened from Shared Files', () => { + + beforeAll(async () => { + await page.clickSharedFilesAndWait(); + }); + + it('File Office, shared - [C326658]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326659]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared - [C326660]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.viewerToolbarMore); + }); + + it('File shared, favorite - [C326661]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File shared, locked - [C326662]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326663]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + + }); + + describe('file opened from Search Results', () => { + + beforeAll(async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor('file-'); + await searchResultsPage.waitForResults(); + }); + + it('File Office - [C326664]', async () => { + await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.viewerToolbarMore); + }); + + it('File Office, favorite - [C326665]', async () => { + await testUtil.checkViewerActions(testData.fileDocxFav.name, testData.fileDocxFav.viewerToolbarPrimary, testData.fileDocxFav.viewerToolbarMore); + }); + + it('File simple - [C326666]', async () => { + await testUtil.checkViewerActions(testData.file.name, testData.file.viewerToolbarPrimary, testData.file.viewerToolbarMore); + }); + + it('File favorite - [C326667]', async () => { + await testUtil.checkViewerActions(testData.fileFav.name, testData.fileFav.viewerToolbarPrimary, testData.fileFav.viewerToolbarMore); + }); + + it('File Office, shared - [C326670]', async () => { + await testUtil.checkViewerActions(testData.fileDocxShared.name, testData.fileDocxShared.viewerToolbarPrimary, testData.fileDocxShared.viewerToolbarMore); + }); + + it('File Office, shared, favorite - [C326671]', async () => { + await testUtil.checkViewerActions(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.viewerToolbarPrimary, testData.fileDocxSharedFav.viewerToolbarMore); + }); + + it('File shared - [C326672]', async () => { + await testUtil.checkViewerActions(testData.fileShared.name, testData.fileShared.viewerToolbarPrimary, testData.fileShared.viewerToolbarMore); + }); + + it('File shared, favorite - [C326673]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFav.name, testData.fileSharedFav.viewerToolbarPrimary, testData.fileSharedFav.viewerToolbarMore); + }); + + it('File locked - [C326668]', async () => { + await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.viewerToolbarMore); + }); + + it('File favorite, locked - [C326669]', async () => { + await testUtil.checkViewerActions(testData.fileFavLocked.name, testData.fileFavLocked.viewerToolbarPrimary, testData.fileFavLocked.viewerToolbarMore); + }); + + it('File shared, locked - [C326674]', async () => { + await testUtil.checkViewerActions(testData.fileSharedLocked.name, testData.fileSharedLocked.viewerToolbarPrimary, testData.fileSharedLocked.viewerToolbarMore); + }); + + it('File shared, favorite, locked - [C326675]', async () => { + await testUtil.checkViewerActions(testData.fileSharedFavLocked.name, testData.fileSharedFavLocked.viewerToolbarPrimary, testData.fileSharedFavLocked.viewerToolbarMore); + }); + + }); + }); +} diff --git a/e2e/suites/actions-available/test-util.ts b/e2e/suites/actions-available/test-util.ts index 7d440a4ef..1ede1e179 100644 --- a/e2e/suites/actions-available/test-util.ts +++ b/e2e/suites/actions-available/test-util.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -33,101 +33,97 @@ const contextMenu = dataTable.menu; const viewer = new Viewer(); const viewerToolbar = viewer.toolbar; - -export async function checkContextMenu(item: string, expectedContextMenu: string[]) { +export async function checkContextMenu(item: string, expectedContextMenu: string[]): Promise { await dataTable.rightClickOnItem(item); + const actualActions = await contextMenu.getMenuItems(); - expect(actualActions.length).toBe(expectedContextMenu.length, 'Incorrect number of context menu items'); - expect(JSON.stringify(actualActions)).toEqual(JSON.stringify(expectedContextMenu), 'Incorrect context menu actions'); + expect(actualActions).toEqual(expectedContextMenu); + + await Utils.pressEscape(); } -export async function checkToolbarPrimary(item: string, expectedToolbarPrimary: string[]) { +export async function checkToolbarPrimary(item: string, expectedToolbarPrimary: string[]): Promise { await dataTable.selectItem(item); const actualPrimaryActions = await toolbar.getButtons(); - expect(actualPrimaryActions.length).toBe(expectedToolbarPrimary.length, 'Incorrect number of toolbar primary items'); - expect(JSON.stringify(actualPrimaryActions)).toEqual(JSON.stringify(expectedToolbarPrimary), 'Incorrect toolbar primary actions'); + expect(actualPrimaryActions).toEqual(expectedToolbarPrimary); } -export async function checkToolbarMoreActions(item: string, expectedToolbarMore: string[]) { +export async function checkToolbarMoreActions(item: string, expectedToolbarMore: string[]): Promise { await dataTable.selectItem(item); - await toolbar.openMoreMenu(); const actualMoreActions = await toolbar.menu.getMenuItems(); - expect(actualMoreActions.length).toBe(expectedToolbarMore.length, 'Incorrect number of toolbar More menu items'); - expect(JSON.stringify(actualMoreActions)).toEqual(JSON.stringify(expectedToolbarMore), 'Incorrect toolbar More actions'); + expect(actualMoreActions).toEqual(expectedToolbarMore); await toolbar.closeMoreMenu(); } -export async function checkMultipleSelContextMenu(items: string[], expectedContextMenu: string[]) { +export async function checkToolbarActions(item: string, expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise { + await dataTable.selectItem(item); + + const actualPrimaryActions = await toolbar.getButtons(); + expect(actualPrimaryActions).toEqual(expectedToolbarPrimary); + + await toolbar.openMoreMenu(); + + const actualMoreActions = await toolbar.menu.getMenuItems(); + expect(actualMoreActions).toEqual(expectedToolbarMore); + + await toolbar.closeMoreMenu(); +} + +export async function checkMultipleSelContextMenu(items: string[], expectedContextMenu: string[]): Promise { await dataTable.selectMultipleItems(items); await dataTable.rightClickOnMultipleSelection(); const actualActions = await contextMenu.getMenuItems(); - expect(actualActions.length).toBe(expectedContextMenu.length, 'Incorrect number of context menu items'); - expect(JSON.stringify(actualActions)).toEqual(JSON.stringify(expectedContextMenu), 'Incorrect context menu actions'); + expect(actualActions).toEqual(expectedContextMenu); + + await Utils.pressEscape(); } -export async function checkMultipleSelToolbarPrimary(items: string[], expectedToolbarPrimary: string[]) { +export async function checkMultipleSelToolbarPrimary(items: string[], expectedToolbarPrimary: string[]): Promise { await dataTable.selectMultipleItems(items); const actualPrimaryActions = await toolbar.getButtons(); - expect(actualPrimaryActions.length).toBe(expectedToolbarPrimary.length, 'Incorrect number of toolbar primary items'); - expect(JSON.stringify(actualPrimaryActions)).toEqual(JSON.stringify(expectedToolbarPrimary), 'Incorrect toolbar primary actions'); + expect(actualPrimaryActions).toEqual(expectedToolbarPrimary); } -export async function checkMultipleSelToolbarMoreActions(items: string[], expectedToolbarMore: string[]) { +export async function checkMultipleSelToolbarActions(items: string[], expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise { await dataTable.selectMultipleItems(items); + const actualPrimaryActions = await toolbar.getButtons(); + expect(actualPrimaryActions).toEqual(expectedToolbarPrimary); + await toolbar.openMoreMenu(); const actualMoreActions = await toolbar.menu.getMenuItems(); - expect(actualMoreActions.length).toBe(expectedToolbarMore.length, 'Incorrect number of toolbar More menu items'); - expect(JSON.stringify(actualMoreActions)).toEqual(JSON.stringify(expectedToolbarMore), 'Incorrect toolbar More actions'); + expect(actualMoreActions).toEqual(expectedToolbarMore); await toolbar.closeMoreMenu(); } -export async function checkViewerToolbarPrimaryActions(item: string, expectedToolbarPrimary: string[]) { - // await dataTable.doubleClickOnRowByName(item); +export async function checkViewerActions(item: string, expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise { await dataTable.selectItem(item); await toolbar.clickView(); await viewer.waitForViewerToOpen(); let actualPrimaryActions = await viewerToolbar.getButtons(); - actualPrimaryActions = removeClosePreviousNextOldInfo(actualPrimaryActions); + expect(actualPrimaryActions).toEqual(expectedToolbarPrimary); - expect(actualPrimaryActions.length).toBe(expectedToolbarPrimary.length, 'Incorrect number of viewer toolbar primary items'); - expect(JSON.stringify(actualPrimaryActions)).toEqual(JSON.stringify(expectedToolbarPrimary), 'Incorrect viewer toolbar primary actions'); - - await Utils.pressEscape(); -} - -export async function checkViewerToolbarMoreActions(item: string, expectedToolbarMore: string[]) { - // await dataTable.doubleClickOnRowByName(item); - await dataTable.selectItem(item); - await toolbar.clickView(); - await viewer.waitForViewerToOpen(); await viewerToolbar.openMoreMenu(); const actualMoreActions = await viewerToolbar.menu.getMenuItems(); - - expect(actualMoreActions.length).toBe(expectedToolbarMore.length, 'Incorrect number of toolbar More menu items'); - expect(JSON.stringify(actualMoreActions)).toEqual(JSON.stringify(expectedToolbarMore), 'Incorrect toolbar More actions'); + expect(actualMoreActions).toEqual(expectedToolbarMore); await toolbar.closeMoreMenu(); await Utils.pressEscape(); } +const toRemove = ['Close', 'Previous File', 'Next File', 'View details']; function removeClosePreviousNextOldInfo(actions: string[]): string[] { - return actions.filter(elem => { - if ( (elem !== 'Close') && (elem !== 'Previous File') && (elem !== 'Next File') && (elem !== 'View details')) { - return elem; - } - return null - }).filter((action) => action != null); + return actions.filter((elem) => !toRemove.includes(elem)); } diff --git a/e2e/suites/actions/copy.test.ts b/e2e/suites/actions/copy-move/copy.test.ts similarity index 97% rename from e2e/suites/actions/copy.test.ts rename to e2e/suites/actions/copy-move/copy.test.ts index aa1b0267d..ac421b607 100755 --- a/e2e/suites/actions/copy.test.ts +++ b/e2e/suites/actions/copy-move/copy.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,10 +23,10 @@ * along with Alfresco. If not, see . */ -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { CopyMoveDialog } from './../../components/dialog/copy-move-dialog'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; -import { Utils } from '../../utilities/utils'; +import { LoginPage, BrowsingPage } from '../../../pages/pages'; +import { ContentNodeSelectorDialog } from '../../../components/dialog/content-node-selector-dialog'; +import { RepoClient } from '../../../utilities/repo-client/repo-client'; +import { Utils } from '../../../utilities/utils'; describe('Copy content', () => { const username = `user-${Utils.random()}`; @@ -86,7 +86,7 @@ describe('Copy content', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; - const copyDialog = new CopyMoveDialog(); + const copyDialog = new ContentNodeSelectorDialog(); const { searchInput } = page.header; beforeAll(async (done) => { @@ -539,8 +539,8 @@ describe('Copy content', () => { await dataTable.selectMultipleItems(items, location); await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('File Libraries'); - await copyDialog.doubleClickOnRow(siteName); - await copyDialog.doubleClickOnRow('documentLibrary'); + await copyDialog.dataTable.doubleClickOnRowByName(siteName); + await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await copyDialog.selectDestination(destination); await copyDialog.clickCopy(); const msg = await page.getSnackBarMessage(); @@ -631,7 +631,7 @@ describe('Copy content', () => { expect(await dataTable.isItemPresent(fileName)).toBe(false, `${fileName} present in ${destination} folder`); await page.clickTrash(); - expect(await dataTable.isEmptyList()).toBe(true, 'Trash is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'Trash is not empty'); } async function undoCopyFolder(folderName: string, location: string = '', destination: string, doBefore = null) { @@ -654,7 +654,7 @@ describe('Copy content', () => { expect(await dataTable.isItemPresent(folderName)).toBe(false, `${folderName} present in ${destination} folder`); await page.clickTrash(); - expect(await dataTable.isEmptyList()).toBe(true, 'Trash is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'Trash is not empty'); } async function undoCopyFileWithExistingName(fileName: string, location: string = '', destination: string, doBefore = null) { @@ -665,7 +665,7 @@ describe('Copy content', () => { await dataTable.selectItem(fileName, location); await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); - await copyDialog.doubleClickOnRow(source); + await copyDialog.dataTable.doubleClickOnRowByName(source); await copyDialog.selectDestination(destination); await copyDialog.clickCopy(); const msg = await page.getSnackBarMessage(); @@ -681,7 +681,7 @@ describe('Copy content', () => { expect(await dataTable.isItemPresent(`${fileInFolder2}-1`)).toBe(false, `${fileInFolder2}-1 is present in ${destination} folder`); await page.clickTrash(); - expect(await dataTable.isEmptyList()).toBe(true, 'Trash is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'Trash is not empty'); } async function undoCopyFolderWithExistingName(folderName: string, location: string = '', destination: string, doBefore = null) { @@ -692,7 +692,7 @@ describe('Copy content', () => { await dataTable.selectItem(folderName, location); await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); - await copyDialog.doubleClickOnRow(destination); + await copyDialog.dataTable.doubleClickOnRowByName(destination); await copyDialog.clickCopy(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); @@ -708,7 +708,7 @@ describe('Copy content', () => { expect(await dataTable.isItemPresent(file1InFolderExisting)).toBe(false, `${file1InFolderExisting} present in ${folderName} in ${destination} folder`); await page.clickTrash(); - expect(await dataTable.isEmptyList()).toBe(true, 'Trash is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'Trash is not empty'); } }); diff --git a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts new file mode 100755 index 000000000..02c0e372e --- /dev/null +++ b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts @@ -0,0 +1,332 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage, BrowsingPage } from '../../../pages/pages'; +import { ContentNodeSelectorDialog } from '../../../components/dialog/content-node-selector-dialog'; +import { RepoClient } from '../../../utilities/repo-client/repo-client'; +import { Utils } from '../../../utilities/utils'; +import { AdminActions } from '../../../utilities/admin-actions'; + +describe('Destination picker dialog : ', () => { + const random = Utils.random(); + + const username = `user-${random}`; + + const consumer = `consumer-${random}`; + const contributor = `contributor-${random}`; + const collaborator = `collaborator-${random}`; + + const file = `file-${random}.txt`; + let fileId: string; + let fileIdConsumer: string; + let fileIdContributor: string; + let fileIdCollaborator: string; + + const adminFolder = `admin-folder-${random}`; + let adminFolderId: string; + + const destination = `destination-folder-${random}`; + let destinationId: string; + const fileInDestination = `file-in-dest-${random}.txt`; + const folderInDestination = `folder-in-dest-${random}`; + const folder2InDestination = `folder2-in-dest-${random}`; + let folderLink: string; + + const searchFolder = `search-${random}`; + let searchFolderId: string; + let searchFolderSiteId: string; + const searchSubFolder1 = `sub-folder-${random}`; + let searchSubFolder1Id: string; + let searchSubFolder1SiteId: string; + const searchSubFolder2 = `sub-folder-${random}`; + + const site = `site-${random}`; + + const userApi = new RepoClient(username, username); + const consumerApi = new RepoClient(consumer, consumer); + const contributorApi = new RepoClient(contributor, contributor); + const collaboratorApi = new RepoClient(collaborator, collaborator); + const adminApiActions = new AdminActions(); + + const loginPage = new LoginPage(); + const page = new BrowsingPage(); + const { dataTable, toolbar } = page; + const contentNodeSelector = new ContentNodeSelectorDialog(); + + beforeAll(async () => { + await adminApiActions.createUser({ username }); + await adminApiActions.createUser({ username: consumer }); + await adminApiActions.createUser({ username: contributor }); + await adminApiActions.createUser({ username: collaborator }); + + fileId = (await userApi.nodes.createFile(file)).entry.id; + + destinationId = (await userApi.nodes.createFolder(destination)).entry.id; + await userApi.nodes.createFile(fileInDestination, destinationId); + await userApi.nodes.createFolder(folderInDestination, destinationId); + const folder2Id = (await userApi.nodes.createFolder(folder2InDestination, destinationId)).entry.id; + folderLink = (await userApi.nodes.createFolderLink(folder2Id, destinationId)).entry.name; + searchFolderId = (await userApi.nodes.createFolder(searchFolder, destinationId)).entry.id; + searchSubFolder1Id = (await userApi.nodes.createFolder(searchSubFolder1, searchFolderId)).entry.id; + await userApi.nodes.createFolder(searchSubFolder2, searchSubFolder1Id); + + await userApi.sites.createSitePrivate(site); + const docLibId = await userApi.sites.getDocLibId(site); + searchFolderSiteId = (await userApi.nodes.createFolder(searchFolder, docLibId)).entry.id; + searchSubFolder1SiteId = (await userApi.nodes.createFolder(searchSubFolder1, searchFolderSiteId)).entry.id; + await userApi.nodes.createFolder(searchSubFolder2, searchSubFolder1SiteId); + + await userApi.sites.addSiteConsumer(site, consumer); + await userApi.sites.addSiteContributor(site, contributor); + await userApi.sites.addSiteCollaborator(site, collaborator); + + fileIdConsumer = (await consumerApi.nodes.createFile(file)).entry.id; + fileIdContributor = (await contributorApi.nodes.createFile(file)).entry.id; + fileIdCollaborator = (await collaboratorApi.nodes.createFile(file)).entry.id; + + adminFolderId = (await adminApiActions.nodes.createFolder(adminFolder)).entry.id; + + await userApi.search.waitForNodes(searchFolder, { expect: 2 }); + }); + + afterAll(async () => { + await userApi.nodes.deleteNodeById(fileId); + await userApi.nodes.deleteNodeById(destinationId); + await userApi.sites.deleteSite(site); + + await consumerApi.nodes.deleteNodeById(fileIdConsumer); + await contributorApi.nodes.deleteNodeById(fileIdContributor); + await collaboratorApi.nodes.deleteNodeById(fileIdCollaborator); + + await adminApiActions.nodes.deleteNodeById(adminFolderId); + }); + + afterEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('general', () => { + beforeAll(async () => { + await loginPage.loginWith(username); + }); + + beforeEach(async () => { + await dataTable.selectItem(file); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + }); + + it('Dialog UI - [C263875]', async () => { + expect(await contentNodeSelector.getTitle()).toEqual(`Copy '${file}' to...`); + expect(await contentNodeSelector.isSearchInputPresent()).toBe(true, 'Search input is not displayed'); + expect(await contentNodeSelector.isSelectLocationDropdownDisplayed()).toBe(true, 'Select Location dropdown not displayed'); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Personal Files'); + expect(await contentNodeSelector.dataTable.isItemPresent(destination)).toBe(true, 'Personal Files content not displayed'); + expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy button is not disabled'); + expect(await contentNodeSelector.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + }); + + it('Files are not displayed - [C263880]', async () => { + await contentNodeSelector.selectLocation('Personal Files'); + expect(await contentNodeSelector.dataTable.isItemPresent(destination)).toBe(true, 'destination folder not displayed'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); + expect(await contentNodeSelector.dataTable.isItemPresent(folderInDestination)).toBe(true, 'folder is not displayed'); + expect(await contentNodeSelector.dataTable.isItemPresent(fileInDestination)).toBe(false, 'file is displayed'); + }); + + it('Folder links are not displayed - [C263881]', async() => { + await contentNodeSelector.selectLocation('Personal Files'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); + + expect(await contentNodeSelector.dataTable.isItemPresent(folderInDestination)).toBe(true, `${folderInDestination} is not displayed`); + expect(await contentNodeSelector.dataTable.isItemPresent(folder2InDestination)).toBe(true, `${folder2InDestination} is not displayed`); + expect(await contentNodeSelector.dataTable.isItemPresent(folderLink)).toBe(false, 'Link to folder is displayed'); + }); + + it('User can see his Libraries - [C263885]', async () => { + await contentNodeSelector.selectLocation('File Libraries'); + expect(await contentNodeSelector.dataTable.isItemPresent(site)).toBe(true, 'user site is not displayed'); + }); + + it('Search - No results displayed - [C263889]', async () => { + await contentNodeSelector.searchFor('nonexistent-folder'); + expect(await contentNodeSelector.dataTable.isEmpty()).toBe(true, 'datatable not empty'); + expect(await contentNodeSelector.dataTable.getEmptyListText()).toEqual('No results found'); + }); + + it('Search - results found - [C263888]', async () => { + await contentNodeSelector.searchFor(searchFolder); + expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder, username)).toBe(true, 'folder from Personal Files not displayed'); + expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder, site)).toBe(true, 'folder from site not displayed'); + }); + }); + + describe('multiple selection', () => { + beforeAll(async () => { + await loginPage.loginWith(username); + }); + + beforeEach(async () => { + await dataTable.selectMultipleItems([file, destination]); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + }); + + it('Dialog title - multiple selection - [C263879]', async () => { + expect(await contentNodeSelector.getTitle()).toEqual(`Copy 2 items to...`); + }); + }); + + describe('breadcrumb', () => { + beforeAll(async () => { + await loginPage.loginWith(username); + }); + + beforeEach(async () => { + await dataTable.selectItem(file); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + }); + + it('Personal Files breadcrumb - main node - [C263890]', async () => { + await contentNodeSelector.selectLocation('Personal Files'); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Personal Files'); + }); + + it('File Libraries breadcrumb - main node - [C263891]', async () => { + await contentNodeSelector.selectLocation('File Libraries'); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('File Libraries'); + }); + + it('Search results breadcrumb - [C263899]', async () => { + await contentNodeSelector.searchFor(searchFolder); + expect(await contentNodeSelector.getToolbarTitle()).toEqual('Search results'); + }); + + it('Search results breadcrumb when selecting a folder - [C263900]', async () => { + await contentNodeSelector.searchFor(searchFolder); + await contentNodeSelector.dataTable.selectItem(searchFolder, site); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); + }); + + it('Personal Files breadcrumb - folder structure - [C263897]', async () => { + await contentNodeSelector.selectLocation('Personal Files'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(destination); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder1); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder2); + await contentNodeSelector.breadcrumb.openPath(); + expect(await contentNodeSelector.breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, destination, 'Personal Files']); + }); + + it('File Libraries breadcrumb - folder structure - [C263898]', async () => { + await contentNodeSelector.selectLocation('File Libraries'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(site); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(site); + await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(site); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder1); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder2); + await contentNodeSelector.breadcrumb.openPath(); + expect(await contentNodeSelector.breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, site, 'File Libraries']); + }); + + it('Select a node from the breadcrumb path - [C263895]', async () => { + await contentNodeSelector.selectLocation('Personal Files'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); + await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); + await contentNodeSelector.breadcrumb.openPath(); + + await contentNodeSelector.breadcrumb.clickPathItem(destination); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(destination); + expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder)).toBe(true, 'folder not displayed'); + }); + }); + + describe('Users with different permissions', () => { + + it('Consumer user cannot select the folder as destination - [C263876]', async () => { + await loginPage.loginWith(consumer); + await dataTable.selectItem(file); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + + await contentNodeSelector.selectLocation('File Libraries'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(site); + await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); + await contentNodeSelector.dataTable.selectItem(searchFolder); + + expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(false, 'Copy should be disabled'); + }); + + it('Contributor user can select the folder as destination - [C263877]', async () => { + await loginPage.loginWith(contributor); + await dataTable.selectItem(file); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + + await contentNodeSelector.selectLocation('File Libraries'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(site); + await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); + await contentNodeSelector.dataTable.selectItem(searchFolder); + + expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); + }); + + it('Collaborator user can select the folder as destination - [C263878]', async () => { + await loginPage.loginWith(collaborator); + await dataTable.selectItem(file); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + + await contentNodeSelector.selectLocation('File Libraries'); + await contentNodeSelector.dataTable.doubleClickOnRowByName(site); + await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); + await contentNodeSelector.dataTable.selectItem(searchFolder); + + expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); + }); + + it('Admin user - Personal Files breadcrumb main node - [C263892]', async () => { + await loginPage.loginWithAdmin(); + await dataTable.selectItem(adminFolder); + await toolbar.clickMoreActionsCopy(); + await contentNodeSelector.waitForDialogToOpen(); + + await contentNodeSelector.selectLocation('Personal Files'); + expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Company Home'); + }); + }); +}); diff --git a/e2e/suites/actions/move.test.ts b/e2e/suites/actions/copy-move/move.test.ts similarity index 97% rename from e2e/suites/actions/move.test.ts rename to e2e/suites/actions/copy-move/move.test.ts index 70e4538b8..a6536e352 100755 --- a/e2e/suites/actions/move.test.ts +++ b/e2e/suites/actions/copy-move/move.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,10 +23,10 @@ * along with Alfresco. If not, see . */ -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { CopyMoveDialog } from './../../components/dialog/copy-move-dialog'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; -import { Utils } from '../../utilities/utils'; +import { LoginPage, BrowsingPage } from '../../../pages/pages'; +import { ContentNodeSelectorDialog } from '../../../components/dialog/content-node-selector-dialog'; +import { RepoClient } from '../../../utilities/repo-client/repo-client'; +import { Utils } from '../../../utilities/utils'; describe('Move content', () => { const username = `user-${Utils.random()}`; @@ -57,7 +57,7 @@ describe('Move content', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; - const moveDialog = new CopyMoveDialog(); + const moveDialog = new ContentNodeSelectorDialog(); beforeAll(async (done) => { await apis.admin.people.createUser({ username }); @@ -254,8 +254,8 @@ describe('Move content', () => { await dataTable.selectMultipleItems([file4, folder2]); await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('File Libraries'); - await moveDialog.doubleClickOnRow(siteName); - await moveDialog.doubleClickOnRow('documentLibrary'); + await moveDialog.dataTable.doubleClickOnRowByName(siteName); + await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSitePF); await moveDialog.clickMove(); const msg = await page.getSnackBarMessage(); @@ -374,8 +374,8 @@ describe('Move content', () => { await dataTable.selectItem(file4, sourceRF); await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('File Libraries'); - await moveDialog.doubleClickOnRow(siteName); - await moveDialog.doubleClickOnRow('documentLibrary'); + await moveDialog.dataTable.doubleClickOnRowByName(siteName); + await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteRF); await moveDialog.clickMove(); const msg = await page.getSnackBarMessage(); @@ -496,8 +496,8 @@ describe('Move content', () => { await dataTable.selectItem(file4, sourceSF); await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('File Libraries'); - await moveDialog.doubleClickOnRow(siteName); - await moveDialog.doubleClickOnRow('documentLibrary'); + await moveDialog.dataTable.doubleClickOnRowByName(siteName); + await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteSF); await moveDialog.clickMove(); const msg = await page.getSnackBarMessage(); @@ -686,8 +686,8 @@ describe('Move content', () => { await dataTable.selectMultipleItems([file4, folder2], sourceFav); await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('File Libraries'); - await moveDialog.doubleClickOnRow(siteName); - await moveDialog.doubleClickOnRow('documentLibrary'); + await moveDialog.dataTable.doubleClickOnRowByName(siteName); + await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteFav); await moveDialog.clickMove(); const msg = await page.getSnackBarMessage(); diff --git a/e2e/suites/actions/create-file-from-template.test.ts b/e2e/suites/actions/create-file-from-template.test.ts new file mode 100755 index 000000000..21f40ef69 --- /dev/null +++ b/e2e/suites/actions/create-file-from-template.test.ts @@ -0,0 +1,402 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage, BrowsingPage } from '../../pages/pages'; +import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog'; +import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog'; +import { Utils } from '../../utilities/utils'; +import { AdminActions } from '../../utilities/admin-actions'; +import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; + +describe('Create file from template', () => { + const random = Utils.random(); + + const username = `user-${random}`; + + const restrictedTemplateFolder = `restricted-templates-${random}`; + const templateInRestrictedFolder = `template-restricted-${random}.txt`; + + const templatesFolder1 = `templates-folder1-${random}`; + const template1InFolder1 = `template1-1-${random}.txt`; + const template2InFolder1 = `template1-2-${random}.txt`; + + const templatesFolder2 = `templates-folder2-${random}`; + const template1InFolder2 = `template2-1-${random}.txt`; + const templatesSubFolder = `template-subFolder-${random}`; + + const template1InRootFolder = `template3-${random}.txt`; + const template2InRootFolder = `template4-${random}.txt`; + + const parent = `parent-${random}`; let parentId; + const file1 = { + name: `file1-${random}.txt` + }; + const file2 = { + name: `file2-${random}.txt`, + title: `file2 title`, + description: `file2 description` + }; + const duplicateFileName = `duplicate-file-${random}.txt`; + const nameWithSpaces = ` file-${random}.txt `; + + const siteName = `site-${random}`; + const fileSite = { + name: `file-site-${random}.txt`, + title: `file site title`, + description: `file site description` + }; + const duplicateFileSite = `duplicate-file-site-${random}.txt`; + let docLibUserSite: string; + + const userApi = new RepoClient(username, username); + + const adminApiActions = new AdminActions(); + + const loginPage = new LoginPage(); + const page = new BrowsingPage(); + const selectTemplateDialog = new SelectTemplateDialog(); + const createFromTemplateDialog = new CreateFromTemplateDialog(); + const { sidenav } = page; + + beforeAll(async () => { + await adminApiActions.createUser({ username }); + + parentId = (await userApi.nodes.createFolder(parent)).entry.id; + await userApi.nodes.createFile(duplicateFileName, parentId); + + await userApi.sites.createSite(siteName); + docLibUserSite = await userApi.sites.getDocLibId(siteName); + await userApi.nodes.createFile(duplicateFileSite, docLibUserSite); + + await loginPage.loginWith(username); + }); + + afterAll(async () => { + await userApi.nodes.deleteNodeById(parentId); + await userApi.sites.deleteSite(siteName); + await adminApiActions.cleanupNodeTemplatesFolder(); + }); + + beforeEach(async () => { + await page.closeOpenDialogs(); + }); + + it('Select template - dialog UI - when no templates exist in the repo - [C325049]', async () => { + await sidenav.openCreateFileFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + + expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template'); + expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'Datatable is not empty'); + expect(await selectTemplateDialog.dataTable.getEmptyListText()).toEqual('No results found'); + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Node Templates'); + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); + expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + }); + + describe('with existing templates', () => { + const templates: NodeContentTree = { + folders: [ + { + name: templatesFolder1, + files: [template1InFolder1, template2InFolder1] + }, + { + name: templatesFolder2, + folders: [ + { + name: templatesSubFolder + } + ], + files: [template1InFolder2] + }, + { + name: restrictedTemplateFolder, + files: [templateInRestrictedFolder] + } + ], + files: [template1InRootFolder, template2InRootFolder] + }; + let link: string; + + beforeAll(async () => { + await adminApiActions.createNodeTemplatesHierarchy(templates); + await adminApiActions.removeUserAccessOnNodeTemplate(restrictedTemplateFolder); + link = (await adminApiActions.createLinkToFileName(template2InRootFolder, await adminApiActions.getNodeTemplatesFolderId())).entry.name; + }); + + describe('Select Template dialog', () => { + beforeEach(async () => { + await sidenav.openCreateFileFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + }); + + it('Select template - dialog UI - with existing templates - [C325043]', async () => { + expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template'); + expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(false, 'Datatable is empty'); + expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder1)).toBe(true, 'template folder not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder2)).toBe(true, 'template folder not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(true, 'template not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(true, 'template not displayed'); + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Node Templates'); + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); + expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + }); + + it(`Templates don't appear if user doesn't have permissions to see them - [C325044]`, async () => { + expect(await selectTemplateDialog.dataTable.isItemPresent(restrictedTemplateFolder)).toBe(false, 'restricted templates folder is displayed'); + }); + + it('Navigate through the templates list with folder hierarchy - [C325045]', async () => { + expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder2)).toBe(true, 'template folder not displayed'); + + await selectTemplateDialog.dataTable.doubleClickOnRowByName(templatesFolder2); + + expect(await selectTemplateDialog.dataTable.isItemPresent(templatesSubFolder)).toBe(true, 'template sub-folder not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(template1InFolder2)).toBe(true, 'template not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(false, 'template is displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(false, 'template is displayed'); + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templatesFolder2); + + await selectTemplateDialog.dataTable.doubleClickOnRowByName(templatesSubFolder); + + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templatesSubFolder); + expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty'); + + await selectTemplateDialog.breadcrumb.openPath(); + + expect(await selectTemplateDialog.breadcrumb.getPathItems()).toEqual([ templatesFolder2, 'Node Templates' ]); + }); + + it(`Templates list doesn't allow multiple selection - [C325047]`, async () => { + expect(await selectTemplateDialog.dataTable.getSelectedRowsCount()).toEqual(0, 'Incorrect number of selected rows'); + + await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); + expect(await selectTemplateDialog.dataTable.getSelectedRowsCount()).toEqual(1, 'Incorrect number of selected rows'); + expect(await selectTemplateDialog.dataTable.getSelectedRowsNames()).toEqual([ template1InRootFolder ], 'Incorrect selected item'); + + await Utils.pressCmd(); + await selectTemplateDialog.dataTable.selectItem(template2InRootFolder); + await Utils.releaseKeyPressed(); + + expect(await selectTemplateDialog.dataTable.getSelectedRowsCount()).toEqual(1, 'Incorrect number of selected rows'); + expect(await selectTemplateDialog.dataTable.getSelectedRowsNames()).toEqual([ template2InRootFolder ], 'Incorrect selected item'); + }); + + it('Links to files are not displayed - [C325050]', async () => { + expect(await selectTemplateDialog.dataTable.isItemPresent(link)).toBe(false, 'Link to file is displayed'); + }); + + it('Cancel the Select template dialog - [C325048]', async () => { + expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + + await selectTemplateDialog.clickCancel(); + + expect(await selectTemplateDialog.isDialogOpen()).toBe(false, 'Select Template dialog is open'); + }); + + it('Next button is disabled when selecting a folder - [C216339]', async () => { + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is enabled'); + + await selectTemplateDialog.dataTable.selectItem(templatesFolder1); + + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is enabled'); + }); + }); + + describe('Create from template dialog', () => { + beforeEach(async () => { + await sidenav.openCreateFileFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); + await selectTemplateDialog.clickNext(); + await createFromTemplateDialog.waitForDialogToOpen(); + }); + + it('Create file from template - dialog UI - [C325020]', async () => { + expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new document from '${template1InRootFolder}'`); + expect(await createFromTemplateDialog.isNameFieldDisplayed()).toBe(true, 'Name field not displayed'); + expect(await createFromTemplateDialog.isTitleFieldDisplayed()).toBe(true, 'Title field not displayed'); + expect(await createFromTemplateDialog.isDescriptionFieldDisplayed()).toBe(true, 'Description field not displayed'); + expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled'); + }); + + it('File name is required - [C325031]', async () => { + expect(await createFromTemplateDialog.getName()).toEqual(template1InRootFolder); + await createFromTemplateDialog.deleteNameWithBackspace(); + + expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + }); + + it('Special characters in file name - [C325032]', async () => { + const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; + + for (const name of namesWithSpecialChars) { + await createFromTemplateDialog.enterName(name); + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toContain(`Name can't contain these characters`); + } + }); + + it('File name ending with a dot - [C325033]', async () => { + await createFromTemplateDialog.enterName('file-name.'); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Name can't end with a period .`); + }); + + it('File name containing only spaces - [C325034]', async () => { + await createFromTemplateDialog.enterName(' '); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Name can't contain only spaces`); + }); + + it('Title too long - [C290146]', async () => { + await createFromTemplateDialog.enterTitle(Utils.string257); + await Utils.pressTab(); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Use 256 characters or less for title`); + }); + + it('Description too long - [C290142]', async () => { + await createFromTemplateDialog.enterDescription(Utils.string513); + await Utils.pressTab(); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Use 512 characters or less for description`); + }); + }); + + describe('On Personal Files', () => { + beforeEach(async () => { + await page.clickPersonalFilesAndWait(); + await page.dataTable.doubleClickOnRowByName(parent); + await sidenav.openCreateFileFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); + await selectTemplateDialog.clickNext(); + await createFromTemplateDialog.waitForDialogToOpen(); + }); + + it('Create a file from a template - with a new Name - [C325030]', async () => { + await createFromTemplateDialog.enterName(file1.name); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(file1.name)).toBe(true, 'File not displayed in list view'); + }); + + it('Create a file from a template - with a Name, Title and Description - [C325026]', async () => { + await createFromTemplateDialog.enterName(file2.name); + await createFromTemplateDialog.enterTitle(file2.title); + await createFromTemplateDialog.enterDescription(file2.description); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(file2.name)).toBe(true, 'File not displayed in list view'); + const desc = await userApi.nodes.getNodeDescription(file2.name, parentId); + expect(desc).toEqual(file2.description); + const title = await userApi.nodes.getNodeTitle(file2.name, parentId); + expect(title).toEqual(file2.title); + }); + + it('Create a file with a duplicate name - [C325028]', async () => { + await createFromTemplateDialog.enterName(duplicateFileName); + await createFromTemplateDialog.clickCreate(); + + expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); + expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); + }); + + it('Cancel file creation - [C325027]', async () => { + await createFromTemplateDialog.enterName('test'); + await createFromTemplateDialog.clickCancel(); + + expect(await createFromTemplateDialog.isDialogOpen()).not.toBe(true, 'dialog is not closed'); + expect(await page.dataTable.isItemPresent('test')).toBe(false, 'File should not appear in the list'); + }); + + it('Trim spaces from file Name - [C325042]', async () => { + await createFromTemplateDialog.enterName(nameWithSpaces); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(nameWithSpaces.trim())).toBe(true, 'File not displayed in list view'); + }); + }); + + describe('On File Libraries', () => { + const fileLibrariesPage = new BrowsingPage(); + + beforeEach(async () => { + await fileLibrariesPage.goToMyLibrariesAndWait(); + await page.dataTable.doubleClickOnRowByName(siteName); + await sidenav.openCreateFileFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); + await selectTemplateDialog.clickNext(); + await createFromTemplateDialog.waitForDialogToOpen(); + }); + + it('Create a file from a template - with Name, Title and Description - [C325023]', async () => { + await createFromTemplateDialog.enterName(fileSite.name); + await createFromTemplateDialog.enterTitle(fileSite.title); + await createFromTemplateDialog.enterDescription(fileSite.description); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(fileSite.name)).toBe(true, 'File not displayed in list view'); + const desc = await userApi.nodes.getNodeDescription(fileSite.name, docLibUserSite); + expect(desc).toEqual(fileSite.description); + const title = await userApi.nodes.getNodeTitle(fileSite.name, docLibUserSite); + expect(title).toEqual(fileSite.title); + }); + + it('Cancel file creation - [C325024]', async () => { + await createFromTemplateDialog.enterName('test'); + await createFromTemplateDialog.clickCancel(); + + expect(await createFromTemplateDialog.isDialogOpen()).not.toBe(true, 'dialog is not closed'); + expect(await page.dataTable.isItemPresent('test')).toBe(false, 'File should not appear in the list'); + }); + + it('Create a file with a duplicate name - [C325025]', async () => { + await createFromTemplateDialog.enterName(duplicateFileSite); + await createFromTemplateDialog.clickCreate(); + + expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); + expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); + }); + }); + }); + +}); diff --git a/e2e/suites/actions/create-folder-from-template.test.ts b/e2e/suites/actions/create-folder-from-template.test.ts new file mode 100755 index 000000000..02364c15a --- /dev/null +++ b/e2e/suites/actions/create-folder-from-template.test.ts @@ -0,0 +1,387 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage, BrowsingPage } from '../../pages/pages'; +import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog'; +import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog'; +import { Utils } from '../../utilities/utils'; +import { AdminActions } from '../../utilities/admin-actions'; +import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; + +describe('Create folder from template', () => { + const random = Utils.random(); + + const username = `user-${random}`; + + const restrictedTemplateFolder = `restricted-folder-${random}`; + const fileInRestrictedFolder = `restricted-file-${random}.txt`; + + const templateFolder1 = `template-folder1-${random}`; + const fileInFolder1 = `file-1-${random}.txt`; + + const templateFolder2 = `template-folder2-${random}`; + const fileInFolder2 = `file-2-${random}.txt`; + const templateSubFolder = `template-sub-folder-${random}`; + + const fileInRootFolder = `file-in-root-${random}.txt`; + const folderInRootFolder = `folder-in-root-${random}`; + + const parent = `parent-${random}`; + let parentId: string; + + const folder1 = { + name: `folder1-${random}` + }; + const folder2 = { + name: `folder2-${random}`, + title: `folder2 title`, + description: `folder2 description` + }; + const duplicateFolderName = `duplicate-folder-${random}`; + const nameWithSpaces = ` folder-${random} `; + + const siteName = `site-${random}`; + const folderSite = { + name: `folder-site-${random}`, + title: `folder site title`, + description: `folder site description` + }; + const duplicateFolderSite = `duplicate-folder-site-${random}`; + let docLibUserSite: string; + + const templates: NodeContentTree = { + folders: [ + { + name: folderInRootFolder + }, + { + name: templateFolder1, + files: [fileInFolder1] + }, + { + name: templateFolder2, + folders: [ + { + name: templateSubFolder + } + ], + files: [fileInFolder2] + }, + { + name: restrictedTemplateFolder, + files: [fileInRestrictedFolder] + } + ], + files: [fileInRootFolder] + }; + let folderLink: string; + + const userApi = new RepoClient(username, username); + const adminApiActions = new AdminActions(); + + const loginPage = new LoginPage(); + const page = new BrowsingPage(); + const selectTemplateDialog = new SelectTemplateDialog(); + const createFromTemplateDialog = new CreateFromTemplateDialog(); + const { sidenav } = page; + + beforeAll(async () => { + await adminApiActions.createUser({ username }); + + parentId = (await userApi.nodes.createFolder(parent)).entry.id; + await userApi.nodes.createFolder(duplicateFolderName, parentId); + + await userApi.sites.createSite(siteName); + docLibUserSite = await userApi.sites.getDocLibId(siteName); + await userApi.nodes.createFolder(duplicateFolderSite, docLibUserSite); + + await adminApiActions.createSpaceTemplatesHierarchy(templates); + await adminApiActions.removeUserAccessOnSpaceTemplate(restrictedTemplateFolder); + folderLink = (await adminApiActions.createLinkToFolderName(folderInRootFolder, await adminApiActions.getSpaceTemplatesFolderId())).entry.name; + + await loginPage.loginWith(username); + }); + + afterAll(async () => { + await userApi.nodes.deleteNodeById(parentId); + await userApi.sites.deleteSite(siteName); + await adminApiActions.cleanupSpaceTemplatesFolder(); + }); + + beforeEach(async () => { + await page.closeOpenDialogs(); + }); + + describe('Select Template dialog', () => { + beforeEach(async () => { + await sidenav.openCreateFolderFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + }); + + it('Select template - dialog UI - with existing templates - [C325147]', async () => { + expect(await selectTemplateDialog.getTitle()).toEqual('Select a folder template'); + expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(false, 'Datatable is empty'); + expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(true, 'template folder not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder2)).toBe(true, 'template folder not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(fileInRootFolder)).toBe(true, 'file not displayed'); + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Space Templates'); + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); + expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + }); + + it(`Templates don't appear if user doesn't have permissions to see them - [C325148]`, async () => { + expect(await selectTemplateDialog.dataTable.isItemPresent(restrictedTemplateFolder)).toBe(false, 'restricted template folder is displayed'); + }); + + it('Navigate through the templates list with folder hierarchy - [C325149]', async () => { + expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder2)).toBe(true, 'template folder not displayed'); + + await selectTemplateDialog.dataTable.doubleClickOnRowByName(templateFolder2); + + expect(await selectTemplateDialog.dataTable.isItemPresent(templateSubFolder)).toBe(true, 'template sub-folder not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(fileInFolder2)).toBe(true, 'template not displayed'); + expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(false, 'template folder is displayed'); + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templateFolder2); + + await selectTemplateDialog.dataTable.doubleClickOnRowByName(templateSubFolder); + + expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templateSubFolder); + expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty'); + + await selectTemplateDialog.breadcrumb.openPath(); + + expect(await selectTemplateDialog.breadcrumb.getPathItems()).toEqual([ templateFolder2, 'Space Templates' ]); + }); + + it(`Templates list doesn't allow multiple selection - [C325150]`, async () => { + expect(await selectTemplateDialog.dataTable.getSelectedRowsCount()).toEqual(0, 'Incorrect number of selected rows'); + + await selectTemplateDialog.dataTable.selectItem(templateFolder1); + expect(await selectTemplateDialog.dataTable.getSelectedRowsCount()).toEqual(1, 'Incorrect number of selected rows'); + expect(await selectTemplateDialog.dataTable.getSelectedRowsNames()).toEqual([ templateFolder1 ], 'Incorrect selected item'); + + await Utils.pressCmd(); + await selectTemplateDialog.dataTable.selectItem(templateFolder2); + await Utils.releaseKeyPressed(); + + expect(await selectTemplateDialog.dataTable.getSelectedRowsCount()).toEqual(1, 'Incorrect number of selected rows'); + expect(await selectTemplateDialog.dataTable.getSelectedRowsNames()).toEqual([ templateFolder2 ], 'Incorrect selected item'); + }); + + it('Links to folders are not displayed - [C325153]', async () => { + expect(await selectTemplateDialog.dataTable.isItemPresent(folderLink)).toBe(false, 'Link to folder is displayed'); + }); + + it('Cancel the Select template dialog - [C325151]', async () => { + expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + + await selectTemplateDialog.clickCancel(); + + expect(await selectTemplateDialog.isDialogOpen()).toBe(false, 'Select Template dialog is open'); + }); + + it('Next button is disabled when selecting a file - [C325139]', async () => { + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is enabled'); + + await selectTemplateDialog.dataTable.selectItem(fileInRootFolder); + + expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is enabled'); + }); + }); + + describe('Create from template dialog', () => { + beforeEach(async () => { + await sidenav.openCreateFolderFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + await selectTemplateDialog.dataTable.selectItem(templateFolder1); + await selectTemplateDialog.clickNext(); + await createFromTemplateDialog.waitForDialogToOpen(); + }); + + it('Create folder from template - dialog UI - [C325142]', async () => { + expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new folder from '${templateFolder1}'`); + expect(await createFromTemplateDialog.isNameFieldDisplayed()).toBe(true, 'Name field not displayed'); + expect(await createFromTemplateDialog.isTitleFieldDisplayed()).toBe(true, 'Title field not displayed'); + expect(await createFromTemplateDialog.isDescriptionFieldDisplayed()).toBe(true, 'Description field not displayed'); + expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled'); + }); + + it('Folder name is required - [C325143]', async () => { + expect(await createFromTemplateDialog.getName()).toEqual(templateFolder1); + await createFromTemplateDialog.deleteNameWithBackspace(); + + expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + }); + + it('Special characters in folder name - [C325144]', async () => { + const namesWithSpecialChars = [ 'a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; + + for (const name of namesWithSpecialChars) { + await createFromTemplateDialog.enterName(name); + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toContain(`Name can't contain these characters`); + } + }); + + it('Folder name ending with a dot - [C325145]', async () => { + await createFromTemplateDialog.enterName('folder-name.'); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Name can't end with a period .`); + }); + + it('Folder name containing only spaces - [C325146]', async () => { + await createFromTemplateDialog.enterName(' '); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Name can't contain only spaces`); + }); + + it('Title too long - [C325141]', async () => { + await createFromTemplateDialog.enterTitle(Utils.string257); + await Utils.pressTab(); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Use 256 characters or less for title`); + }); + + it('Description too long - [C325140]', async () => { + await createFromTemplateDialog.enterDescription(Utils.string513); + await Utils.pressTab(); + + expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); + expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Use 512 characters or less for description`); + }); + }); + + describe('On Personal Files', () => { + beforeEach(async () => { + await page.clickPersonalFilesAndWait(); + await page.dataTable.doubleClickOnRowByName(parent); + await sidenav.openCreateFolderFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + await selectTemplateDialog.dataTable.selectItem(templateFolder1); + await selectTemplateDialog.clickNext(); + await createFromTemplateDialog.waitForDialogToOpen(); + }); + + it('Create a folder from a template - with a new Name - [C325157]', async () => { + await createFromTemplateDialog.enterName(folder1.name); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(folder1.name)).toBe(true, 'Folder not displayed in list view'); + }); + + it('Create a folder from a template - with a Name, Title and Description - [C325154]', async () => { + await createFromTemplateDialog.enterName(folder2.name); + await createFromTemplateDialog.enterTitle(folder2.title); + await createFromTemplateDialog.enterDescription(folder2.description); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(folder2.name)).toBe(true, 'Folder not displayed in list view'); + const desc = await userApi.nodes.getNodeDescription(folder2.name, parentId); + expect(desc).toEqual(folder2.description); + const title = await userApi.nodes.getNodeTitle(folder2.name, parentId); + expect(title).toEqual(folder2.title); + }); + + it('Create a folder with a duplicate name - [C325156]', async () => { + await createFromTemplateDialog.enterName(duplicateFolderName); + await createFromTemplateDialog.clickCreate(); + + expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); + expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); + }); + + it('Cancel folder creation - [C325155]', async () => { + await createFromTemplateDialog.enterName('test'); + await createFromTemplateDialog.clickCancel(); + + expect(await createFromTemplateDialog.isDialogOpen()).not.toBe(true, 'dialog is not closed'); + expect(await page.dataTable.isItemPresent('test')).toBe(false, 'Folder should not appear in the list'); + }); + + it('Trim spaces from folder Name - [C325158]', async () => { + await createFromTemplateDialog.enterName(nameWithSpaces); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(nameWithSpaces.trim())).toBe(true, 'Folder not displayed in list view'); + }); + }); + + describe('On File Libraries', () => { + const fileLibrariesPage = new BrowsingPage(); + + beforeEach(async () => { + await fileLibrariesPage.goToMyLibrariesAndWait(); + await page.dataTable.doubleClickOnRowByName(siteName); + await sidenav.openCreateFolderFromTemplateDialog(); + await selectTemplateDialog.waitForDialogToOpen(); + await selectTemplateDialog.dataTable.selectItem(templateFolder1); + await selectTemplateDialog.clickNext(); + await createFromTemplateDialog.waitForDialogToOpen(); + }); + + it('Create a folder from a template - with Name, Title and Description - [C325161]', async () => { + await createFromTemplateDialog.enterName(folderSite.name); + await createFromTemplateDialog.enterTitle(folderSite.title); + await createFromTemplateDialog.enterDescription(folderSite.description); + await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.waitForDialogToClose(); + await page.dataTable.waitForHeader(); + + expect(await page.dataTable.isItemPresent(folderSite.name)).toBe(true, 'Folder not displayed in list view'); + const desc = await userApi.nodes.getNodeDescription(folderSite.name, docLibUserSite); + expect(desc).toEqual(folderSite.description); + const title = await userApi.nodes.getNodeTitle(folderSite.name, docLibUserSite); + expect(title).toEqual(folderSite.title); + }); + + it('Cancel folder creation - [C325162]', async () => { + await createFromTemplateDialog.enterName('test'); + await createFromTemplateDialog.clickCancel(); + + expect(await createFromTemplateDialog.isDialogOpen()).not.toBe(true, 'dialog is not closed'); + expect(await page.dataTable.isItemPresent('test')).toBe(false, 'Folder should not appear in the list'); + }); + + it('Create a folder with a duplicate name - [C325163]', async () => { + await createFromTemplateDialog.enterName(duplicateFolderSite); + await createFromTemplateDialog.clickCreate(); + + expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); + expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); + }); + }); + +}); diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts index b42370425..a3b58accc 100755 --- a/e2e/suites/actions/create-folder.test.ts +++ b/e2e/suites/actions/create-folder.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,7 +23,6 @@ * along with Alfresco. If not, see . */ -import { SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { LoginPage, BrowsingPage } from '../../pages/pages'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; import { Utils } from '../../utilities/utils'; @@ -39,7 +38,6 @@ describe('Create folder', () => { const duplicateFolderName = `folder-${Utils.random()}`; const nameWithSpaces = ` folder-${Utils.random()} `; - const sitePrivate = `site-private-${Utils.random()}`; const siteName = `site-${Utils.random()}`; const folderSite = `folder-site-${Utils.random()}`; @@ -59,11 +57,6 @@ describe('Create folder', () => { beforeAll(async (done) => { await apis.admin.people.createUser({ username }); - await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE); - const docLibId = await apis.admin.sites.getDocLibId(sitePrivate); - await apis.admin.nodes.createFolder(folderName1, docLibId); - await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; await apis.user.nodes.createFolder(duplicateFolderName, parentId); @@ -76,7 +69,6 @@ describe('Create folder', () => { }); afterAll(async (done) => { - await apis.admin.sites.deleteSite(sitePrivate); await apis.user.sites.deleteSite(siteName); await apis.user.nodes.deleteNodeById(parentId); done(); diff --git a/e2e/suites/actions/create-library.test.ts b/e2e/suites/actions/create-library.test.ts index 6d8c8d3ac..ca3cd25a4 100755 --- a/e2e/suites/actions/create-library.test.ts +++ b/e2e/suites/actions/create-library.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/delete-undo-delete.test.ts b/e2e/suites/actions/delete-undo-delete.test.ts index f478e5df5..1a7b2a50e 100755 --- a/e2e/suites/actions/delete-undo-delete.test.ts +++ b/e2e/suites/actions/delete-undo-delete.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -126,7 +126,7 @@ describe('Delete and undo delete', () => { }); it('delete a file and check notification - [C217125]', async () => { - let items = await page.dataTable.countRows(); + let items = await page.dataTable.getRowsCount(); await dataTable.selectItem(file1); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); @@ -140,7 +140,7 @@ describe('Delete and undo delete', () => { }); it('delete multiple files and check notification - [C280502]', async () => { - let items = await page.dataTable.countRows(); + let items = await page.dataTable.getRowsCount(); await dataTable.selectMultipleItems([file2, file3]); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); @@ -155,7 +155,7 @@ describe('Delete and undo delete', () => { }); it('delete a folder with content - [C217126]', async () => { - let items = await page.dataTable.countRows(); + let items = await page.dataTable.getRowsCount(); await dataTable.selectItem(folder1); await toolbar.clickMoreActionsDelete(); expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not removed from list'); @@ -195,7 +195,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of file - [C217132]', async () => { - const items = await page.dataTable.countRows(); + const items = await page.dataTable.getRowsCount(); await dataTable.selectItem(file5); await toolbar.clickMoreActionsDelete(); @@ -206,7 +206,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of folder with content - [C280503]', async () => { - const items = await page.dataTable.countRows(); + const items = await page.dataTable.getRowsCount(); await dataTable.selectItem(folder6); await toolbar.clickMoreActionsDelete(); @@ -218,7 +218,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of multiple files - [C280504]', async () => { - const items = await page.dataTable.countRows(); + const items = await page.dataTable.getRowsCount(); await dataTable.selectMultipleItems([file6, file7]); await toolbar.clickMoreActionsDelete(); @@ -393,7 +393,7 @@ describe('Delete and undo delete', () => { }); it('delete a file and check notification - [C280516]', async () => { - let items = await page.dataTable.countRows(); + let items = await page.dataTable.getRowsCount(); await dataTable.selectItem(favFile1); await toolbar.clickMoreActionsDelete(); @@ -408,7 +408,7 @@ describe('Delete and undo delete', () => { }); it('delete multiple files and check notification - [C280517]', async () => { - let items = await page.dataTable.countRows(); + let items = await page.dataTable.getRowsCount(); await dataTable.selectMultipleItems([favFile2, favFile3]); await toolbar.clickMoreActionsDelete(); @@ -425,7 +425,7 @@ describe('Delete and undo delete', () => { }); it('delete a folder with content - [C280518]', async () => { - let items = await page.dataTable.countRows(); + let items = await page.dataTable.getRowsCount(); await dataTable.selectItem(favFolder1); await toolbar.clickMoreActionsDelete(); expect(await dataTable.isItemPresent(favFolder1)).toBe(false, 'Item was not removed from list'); @@ -464,7 +464,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of file - [C280524]', async () => { - const items = await page.dataTable.countRows(); + const items = await page.dataTable.getRowsCount(); await dataTable.selectItem(favFile5); await toolbar.clickMoreActionsDelete(); @@ -474,7 +474,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of folder with content - [C280526]', async () => { - const items = await page.dataTable.countRows(); + const items = await page.dataTable.getRowsCount(); await dataTable.selectItem(favFolder6); await toolbar.clickMoreActionsDelete(); @@ -486,7 +486,7 @@ describe('Delete and undo delete', () => { }); it('undo delete of multiple files - [C280525]', async () => { - const items = await page.dataTable.countRows(); + const items = await page.dataTable.getRowsCount(); await dataTable.selectMultipleItems([favFile6, favFile7]); await toolbar.clickMoreActionsDelete(); diff --git a/e2e/suites/actions/download.test.ts b/e2e/suites/actions/download.test.ts index 02c694f31..5f1f31fc9 100755 --- a/e2e/suites/actions/download.test.ts +++ b/e2e/suites/actions/download.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index 780c6ca66..afa31c4ce 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/edit-offline.test.ts b/e2e/suites/actions/edit-offline.test.ts index 30ee08b68..80f3dd45e 100755 --- a/e2e/suites/actions/edit-offline.test.ts +++ b/e2e/suites/actions/edit-offline.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -55,29 +55,14 @@ describe('Edit offline', () => { const { dataTable, toolbar } = page; const { searchInput } = page.header; - beforeAll(async (done) => { + beforeAll(async () => { await apis.admin.people.createUser({ username }); - - parentPFId = (await apis.user.nodes.createFolder(parentPF)).entry.id; - parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id; - parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id; - parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id; - parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id; - - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentPFId); - await apis.user.nodes.deleteNodeById(parentSFId); - await apis.user.nodes.deleteNodeById(parentRFId); - await apis.user.nodes.deleteNodeById(parentFavId); - await apis.user.nodes.deleteNodeById(parentSearchId); - done(); }); describe('on Personal Files', () => { - beforeAll(async (done) => { + beforeAll(async () => { + parentPFId = (await apis.user.nodes.createFolder(parentPF)).entry.id; + file1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentPFId, file1)).entry.id; fileLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentPFId, fileLocked)).entry.id; fileLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentPFId, fileLocked2)).entry.id; @@ -86,18 +71,19 @@ describe('Edit offline', () => { await apis.user.nodes.lockFile(fileLocked2Id); await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + beforeEach(async () => { await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(parentPF); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); + }); + + afterAll(async () => { + await apis.user.nodes.deleteNodeById(parentPFId); }); it('File is locked and downloaded when clicking Edit Offline - [C297538]', async () => { @@ -117,16 +103,17 @@ describe('Edit offline', () => { it('Cancel Editing unlocks the file - [C297540]', async () => { await dataTable.selectItem(fileLocked); await toolbar.clickMoreActionsCancelEditing(); - await dataTable.clearSelection(); + await dataTable.unselectItem(fileLocked); expect(await apis.user.nodes.isFileLockedWrite(fileLockedId)).toBe(false, `${fileLocked} is still locked`); expect(await dataTable.hasLockIcon(fileLocked)).toBe(false, `${fileLocked} has a lock icon`); }); }); - // TODO: enable tests when ACA-2173 is done - xdescribe('on Shared Files', () => { - beforeAll(async (done) => { + describe('on Shared Files', () => { + beforeAll(async () => { + parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id; + file1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSFId, file1)).entry.id; fileLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSFId, fileLocked)).entry.id; fileLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSFId, fileLocked2)).entry.id; @@ -138,20 +125,21 @@ describe('Edit offline', () => { await apis.user.shared.waitForApi({ expect: 3 }); await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + afterAll(async () => { + await apis.user.nodes.deleteNodeById(parentSFId); + }); + + beforeEach(async () => { await page.clickSharedFilesAndWait(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); - xit('File is locked and downloaded when clicking Edit Offline - [C306950]', async () => { + it('File is locked and downloaded when clicking Edit Offline - [C306950]', async () => { await dataTable.selectItem(file1, parentSF); await toolbar.clickMoreActionsEditOffline(); @@ -159,16 +147,16 @@ describe('Edit offline', () => { expect(await apis.user.nodes.isFileLockedWrite(file1Id)).toBe(true, `${file1} is not locked`); }); - xit('Lock information is displayed - [C306951]', async () => { + it('Lock information is displayed - [C306951]', async () => { expect(await dataTable.isItemPresent(fileLocked2, parentSF)).toBe(true, `${fileLocked2} is not displayed`); expect(await dataTable.hasLockIcon(fileLocked2, parentSF)).toBe(true, `${fileLocked2} does not have a lock icon`); expect(await dataTable.getLockOwner(fileLocked2, parentSF)).toContain(username, `${fileLocked2} does not have correct lock owner info`); }); - xit('Cancel Editing unlocks the file - [C306952]', async () => { + it('Cancel Editing unlocks the file - [C306952]', async () => { await dataTable.selectItem(fileLocked); await toolbar.clickMoreActionsCancelEditing(); - await dataTable.clearSelection(); + await dataTable.unselectItem(fileLocked); expect(await apis.user.nodes.isFileLockedWrite(fileLockedId)).toBe(false, `${fileLocked} is still locked`); expect(await dataTable.hasLockIcon(fileLocked, parentSF)).toBe(false, `${fileLocked} has a lock icon`); @@ -176,7 +164,11 @@ describe('Edit offline', () => { }); describe('on Recent Files', () => { - beforeAll(async (done) => { + beforeAll(async () => { + parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id; + + await apis.user.search.waitForApi(username, { expect: 0 }); + file1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentRFId, file1)).entry.id; fileLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentRFId, fileLocked)).entry.id; fileLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentRFId, fileLocked2)).entry.id; @@ -184,20 +176,21 @@ describe('Edit offline', () => { await apis.user.nodes.lockFile(fileLockedId); await apis.user.nodes.lockFile(fileLocked2Id); - await apis.user.search.waitForApi(username, { expect: 6 }); + await apis.user.search.waitForApi(username, { expect: 3 }); await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + afterAll(async () => { + await apis.user.nodes.deleteNodeById(parentRFId); + }); + + beforeEach(async () => { await page.clickRecentFilesAndWait(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); it('File is locked and downloaded when clicking Edit Offline - [C297541]', async () => { @@ -217,16 +210,17 @@ describe('Edit offline', () => { it('Cancel Editing unlocks the file - [C297543]', async () => { await dataTable.selectItem(fileLocked, parentRF); await toolbar.clickMoreActionsCancelEditing(); - await dataTable.clearSelection(); + await dataTable.unselectItem(fileLocked, parentRF); expect(await apis.user.nodes.isFileLockedWrite(fileLockedId)).toBe(false, `${fileLocked} is still locked`); expect(await dataTable.hasLockIcon(fileLocked, parentRF)).toBe(false, `${fileLocked} has a lock icon`); }); }); - // TODO: enable tests when ACA-2174 is done - xdescribe('on Favorite Files', () => { - beforeAll(async (done) => { + describe('on Favorite Files', () => { + beforeAll(async () => { + parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id; + file1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentFavId, file1)).entry.id; fileLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentFavId, fileLocked)).entry.id; fileLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentFavId, fileLocked2)).entry.id; @@ -238,19 +232,21 @@ describe('Edit offline', () => { await apis.user.favorites.waitForApi({ expect: 3 }); await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + afterAll(async () => { + await apis.user.nodes.deleteNodeById(parentFavId); + }); + + beforeEach(async () => { await page.clickFavoritesAndWait(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); + // TODO: raise REPO issue: permissions not returned in /people/${personId}/favorites api xit('File is locked and downloaded when clicking Edit Offline - [C306956]', async () => { await dataTable.selectItem(file1); await toolbar.clickMoreActionsEditOffline(); @@ -259,16 +255,16 @@ describe('Edit offline', () => { expect(await apis.user.nodes.isFileLockedWrite(file1Id)).toBe(true, `${file1} is not locked`); }); - xit('Lock information is displayed - [C306957]', async () => { + it('Lock information is displayed - [C306957]', async () => { expect(await dataTable.isItemPresent(fileLocked2)).toBe(true, `${fileLocked2} is not displayed`); expect(await dataTable.hasLockIcon(fileLocked2)).toBe(true, `${fileLocked2} does not have a lock icon`); expect(await dataTable.getLockOwner(fileLocked2)).toContain(username, `${fileLocked2} does not have correct lock owner info`); }); - xit('Cancel Editing unlocks the file - [C306958]', async () => { + it('Cancel Editing unlocks the file - [C306958]', async () => { await dataTable.selectItem(fileLocked); await toolbar.clickMoreActionsCancelEditing(); - await dataTable.clearSelection(); + await dataTable.unselectItem(fileLocked); expect(await apis.user.nodes.isFileLockedWrite(fileLockedId)).toBe(false, `${fileLocked} is still locked`); expect(await dataTable.hasLockIcon(fileLocked)).toBe(false, `${fileLocked} has a lock icon`); @@ -276,7 +272,9 @@ describe('Edit offline', () => { }); describe('on Search Results', () => { - beforeAll(async (done) => { + beforeAll(async () => { + parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id; + fileSearch1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearch1)).entry.id; fileSearchLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked)).entry.id; fileSearchLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked2)).entry.id; @@ -287,21 +285,21 @@ describe('Edit offline', () => { await apis.user.search.waitForNodes('file-search', { expect: 3 }); await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + afterAll(async () => { + await apis.user.nodes.deleteNodeById(parentSearchId); + }); + + beforeEach(async () => { await page.clickPersonalFilesAndWait(); await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); await searchInput.searchFor('file-search'); await dataTable.waitForBody(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); it('File is locked and downloaded when clicking Edit Offline - [C306953]', async () => { @@ -312,21 +310,20 @@ describe('Edit offline', () => { expect(await apis.user.nodes.isFileLockedWrite(fileSearch1Id)).toBe(true, `${fileSearch1} is not locked`); }); - // TODO: enable when ACA-2314 is fixed - xit('Lock information is displayed - [C306954]', async () => { + it('Lock information is displayed - [C306954]', async () => { expect(await dataTable.isItemPresent(fileSearchLocked2, parentSearch)).toBe(true, `${fileSearchLocked2} is not displayed`); expect(await dataTable.hasLockIcon(fileSearchLocked2, parentSearch)).toBe(true, `${fileSearchLocked2} does not have a lock icon`); - expect(await dataTable.getLockOwner(fileSearchLocked2, parentSearch)).toContain(username, `${fileSearchLocked2} does not have correct lock owner info`); + // TODO: enable when ACA-2314 is fixed + // expect(await dataTable.getLockOwner(fileSearchLocked2, parentSearch)).toContain(username, `${fileSearchLocked2} does not have correct lock owner info`); }); it('Cancel Editing unlocks the file - [C306955]', async () => { await dataTable.selectItem(fileSearchLocked); await toolbar.clickMoreActionsCancelEditing(); - await dataTable.clearSelection(); + await dataTable.unselectItem(fileSearchLocked); expect(await apis.user.nodes.isFileLockedWrite(fileSearchLockedId)).toBe(false, `${fileSearchLocked} is still locked`); - // TODO: enable when ACA-2314 is fixed - // expect(await dataTable.hasLockIcon(fileSearchLocked, parentSearch)).toBe(false, `${fileSearchLocked} has a lock icon`); + expect(await dataTable.hasLockIcon(fileSearchLocked, parentSearch)).toBe(false, `${fileSearchLocked} has a lock icon`); }); }); }); diff --git a/e2e/suites/actions/library-actions.test.ts b/e2e/suites/actions/library-actions.test.ts index 0bf77ad99..f243c770f 100755 --- a/e2e/suites/actions/library-actions.test.ts +++ b/e2e/suites/actions/library-actions.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/mark-favorite.test.ts b/e2e/suites/actions/mark-favorite.test.ts index 0130dd47b..3cf1eebcb 100644 --- a/e2e/suites/actions/mark-favorite.test.ts +++ b/e2e/suites/actions/mark-favorite.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/new-menu.test.ts b/e2e/suites/actions/new-menu.test.ts index e5b1349cc..59627e4a0 100755 --- a/e2e/suites/actions/new-menu.test.ts +++ b/e2e/suites/actions/new-menu.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -42,7 +42,7 @@ describe('New menu', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, sidenav } = page; - + const { menu } = sidenav; beforeAll(async (done) => { await apis.admin.people.createUser({ username }); @@ -66,107 +66,90 @@ describe('New menu', () => { done(); }); - it('has correct actions - [C286524]', async () => { + it('Actions in Personal Files - [C286524]', async () => { await page.clickPersonalFiles(); await sidenav.openNewMenu(); - expect(await sidenav.menu.isCreateFolderPresent()).toBe(true, 'Create Folder option not present'); - expect(await sidenav.menu.isCreateLibraryPresent()).toBe(true, 'Create Library option not present'); - expect(await sidenav.menu.isUploadFilePresent()).toBe(true, 'Upload File option not present'); - expect(await sidenav.menu.isUploadFolderPresent()).toBe(true, 'Upload Folder option not present'); + expect(await menu.isUploadFileEnabled()).toBe(true, 'Upload File option not enabled'); + expect(await menu.isUploadFolderEnabled()).toBe(true, 'Upload Folder option not enabled'); - expect(await sidenav.menu.isCreateLibraryEnabled()).toBe(true, 'Create Library is not enabled'); + expect(await menu.isCreateFolderEnabled()).toBe(true, 'Create Folder option not enabled'); + expect(await menu.isCreateLibraryEnabled()).toBe(true, 'Create Library option not enabled'); + + expect(await menu.isCreateFileFromTemplateEnabled()).toBe(true, 'Create file from template is not enabled'); + expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(true, 'Create folder from template is not enabled'); }); - it('Create folder is enabled when having enough permissions - Personal Files - [C216339]', async () => { - await page.clickPersonalFiles(); - await page.sidenav.openNewMenu(); - - expect(await sidenav.menu.isCreateFolderEnabled()).toBe(true, 'Create folder is not enabled'); - }); - - it('Create folder is enabled when having enough permissions - File Libraries - [C280393]', async () => { - await page.goToMyLibrariesAndWait(); - await page.dataTable.doubleClickOnRowByName(siteUser); - await page.sidenav.openNewMenu(); - expect(await sidenav.menu.isCreateFolderEnabled()).toBe(true, 'Create folder is not enabled'); - }); - - it('Create folder is disabled when not enough permissions - [C280397]', async () => { - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteAdmin); - await sidenav.openNewMenu(); - expect(await sidenav.menu.isCreateFolderEnabled()).toBe(false, 'Create folder is not disabled'); - }); - - it('Upload File option is enabled when having enough permissions - on Personal Files - [C217145]', async () => { - await page.clickPersonalFiles(); - await sidenav.openNewMenu(); - - expect(await sidenav.menu.isUploadFileEnabled()).toBe(true, 'Upload file is not enabled in Personal Files'); - }); - - it('Upload File option is enabled when having permissions - on File Libraries - [C290142]', async () => { + it('Actions in File Libraries - user with enough permissions - [C280393]', async () => { await page.goToMyLibrariesAndWait(); await dataTable.doubleClickOnRowByName(siteUser); await sidenav.openNewMenu(); - expect(await sidenav.menu.isUploadFileEnabled()).toBe(true, 'Upload file is not enabled in File Libraries'); + expect(await menu.isUploadFileEnabled()).toBe(true, 'Upload file is not enabled in File Libraries'); + expect(await menu.isUploadFolderEnabled()).toBe(true, 'Upload folder is not enabled in File Libraries'); + + expect(await menu.isCreateFolderEnabled()).toBe(true, 'Create folder is not enabled'); + expect(await menu.isCreateLibraryEnabled()).toBe(true, 'Create Library option not enabled'); + + expect(await menu.isCreateFileFromTemplateEnabled()).toBe(true, 'Create file from template is not enabled'); + expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(true, 'Create folder from template is not enabled'); }); - it('Upload File option is disabled when user cannot create content in that location - [C217146]', async () => { + it('Actions in File Libraries - user without enough permissions - [C280397]', async () => { await page.goToMyLibrariesAndWait(); await dataTable.doubleClickOnRowByName(siteAdmin); await sidenav.openNewMenu(); - expect(await sidenav.menu.isUploadFileEnabled()).toBe(false, 'Upload file is not disabled'); + expect(await menu.isUploadFileEnabled()).toBe(false, 'Upload file is not disabled'); + expect(await menu.isUploadFolderEnabled()).toBe(false, 'Upload folder is not disabled'); + + expect(await menu.isCreateFolderEnabled()).toBe(false, 'Create folder is not disabled'); + expect(await menu.isCreateLibraryEnabled()).toBe(true, 'Create Library option not enabled'); + + expect(await menu.isCreateFileFromTemplateEnabled()).toBe(false, 'Create file from template is not disabled'); + expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(false, 'Create folder from template is not disabled'); }); - it('Upload Folder option is enabled when having enough permissions - on Personal Files - [C213196]', async () => { + it('Enabled actions tooltips - [C216342]', async () => { await page.clickPersonalFiles(); await sidenav.openNewMenu(); - expect(await sidenav.menu.isUploadFolderEnabled()).toBe(true, 'Upload folder is not enabled in Personal Files'); - }); + let tooltip: string; - it('Upload Folder option is enabled when having permissions - on File Libraries - [C290146]', async () => { - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteUser); - await sidenav.openNewMenu(); + tooltip = await menu.getTooltipForUploadFile(); + expect(tooltip).toContain('Select files to upload'); - expect(await sidenav.menu.isUploadFolderEnabled()).toBe(true, 'Upload folder is not enabled in File Libraries'); - }); + tooltip = await menu.getTooltipForUploadFolder(); + expect(tooltip).toContain('Select folders to upload'); - it('Upload Folder option is disabled when user cannot create content in that location - [C213193]', async () => { - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteAdmin); - await sidenav.openNewMenu(); - - expect(await sidenav.menu.isUploadFolderEnabled()).toBe(false, 'Upload folder is not disabled'); - }); - - it('Create folder enabled button tooltip - [C216342]', async () => { - await page.clickPersonalFiles(); - await sidenav.openNewMenu(); - - const tooltip = await sidenav.menu.getItemTooltip('Create Folder'); + tooltip = await menu.getTooltipForCreateFolder(); expect(tooltip).toContain('Create new folder'); + + tooltip = await menu.getTooltipForCreateLibrary(); + expect(tooltip).toContain('Create a new File Library'); + + tooltip = await menu.getTooltipForCreateFileFromTemplate(); + expect(tooltip).toContain('Create file from template'); }); - it('Create folder disabled button tooltip - [C280398]', async () => { + it('Disabled actions tooltips - [C280398]', async () => { await page.goToMyLibrariesAndWait(); await dataTable.doubleClickOnRowByName(siteAdmin); await sidenav.openNewMenu(); - const tooltip = await sidenav.menu.getItemTooltip('Create Folder'); - expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`); - }); + let tooltip: string; - it('Create Library button tooltip - [C286526]', async () => { - await sidenav.openNewMenu(); + tooltip = await menu.getTooltipForUploadFile(); + expect(tooltip).toContain('Files cannot be uploaded whilst viewing the current items'); - const tooltip = await sidenav.menu.getItemTooltip('Create Library'); - expect(tooltip).toContain('Create a new File Library'); + tooltip = await menu.getTooltipForUploadFolder(); + expect(tooltip).toContain('Folders cannot be uploaded whilst viewing the current items'); + + tooltip = await menu.getTooltipForCreateFolder(); + expect(tooltip).toContain('Folders cannot be created whilst viewing the current items'); + + tooltip = await menu.getTooltipForCreateFileFromTemplate(); + expect(tooltip).toContain('Files cannot be created whilst viewing the current items'); }); }); diff --git a/e2e/suites/actions/permanently-delete.test.ts b/e2e/suites/actions/permanently-delete.test.ts index d028fc2ad..fdc212437 100755 --- a/e2e/suites/actions/permanently-delete.test.ts +++ b/e2e/suites/actions/permanently-delete.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/restore.test.ts index d5783f769..29cdb4b9e 100755 --- a/e2e/suites/actions/restore.test.ts +++ b/e2e/suites/actions/restore.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/share-file.test.ts b/e2e/suites/actions/share-file.test.ts index 4f3522d55..8ff0db5da 100755 --- a/e2e/suites/actions/share-file.test.ts +++ b/e2e/suites/actions/share-file.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -48,7 +48,7 @@ describe('Share a file', () => { const viewer = new Viewer(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; - const shareLinkPreUrl = "/#/preview/s/"; + const shareLinkPreUrl = `${browser.baseUrl}/#/preview/s/`; const apis = { admin: new RepoClient(), @@ -924,7 +924,7 @@ describe('Share a file', () => { it('Expire date is displayed correctly - [C286671]', async () => { await dataTable.selectItem(file6); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -935,7 +935,7 @@ describe('Share a file', () => { it('Disable the share link expiration - [C286672]', async () => { await dataTable.selectItem(file7); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); @@ -959,7 +959,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); diff --git a/e2e/suites/actions/unshare-file-search-results.test.ts b/e2e/suites/actions/unshare-file-search-results.test.ts index 5b494b835..acf2ea55f 100755 --- a/e2e/suites/actions/unshare-file-search-results.test.ts +++ b/e2e/suites/actions/unshare-file-search-results.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/actions/unshare-file.test.ts b/e2e/suites/actions/unshare-file.test.ts index e3b802962..aee35f584 100755 --- a/e2e/suites/actions/unshare-file.test.ts +++ b/e2e/suites/actions/unshare-file.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -479,9 +479,6 @@ describe('Unshare a file', () => { expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`); - // TODO: disable check cause api is slow to update - // expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} is in the Shared files list`); - await browser.get(url); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.getFileTitle()).not.toEqual(file2); @@ -519,9 +516,6 @@ describe('Unshare a file', () => { expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`); - // TODO: disable check cause api is slow to update - // expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} is in the Shared files list`); - await browser.get(url); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.getFileTitle()).not.toEqual(file4); @@ -579,9 +573,7 @@ describe('Unshare a file', () => { it('Unshare dialog UI - [C286694]', async () => { await dataTable.selectItem(file1); - // TODO: remove workaround for favorites - // await toolbar.clickSharedLinkSettings(); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); @@ -596,9 +588,7 @@ describe('Unshare a file', () => { it('Unshare a file - [C286695]', async () => { await dataTable.selectItem(file2); - // TODO: remove workaround for favorites - // await toolbar.clickSharedLinkSettings(); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); await shareDialog.clickShareToggle(); @@ -618,9 +608,7 @@ describe('Unshare a file', () => { it('Cancel the Unshare action - [C286696]', async () => { await dataTable.selectItem(file3); - // TODO: remove workaround for favorites - // await toolbar.clickSharedLinkSettings(); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); @@ -637,9 +625,7 @@ describe('Unshare a file', () => { it('Unshare a file from the context menu - [C286698]', async () => { await dataTable.rightClickOnItem(file4); - // TODO: remove workaround for favorites - // await toolbar.clickSharedLinkSettings(); - await contextMenu.clickShare(); + await contextMenu.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); await shareDialog.clickShareToggle(); @@ -780,9 +766,7 @@ describe('Unshare a file', () => { it('on Favorites - file shared by other user - [C286697]', async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(file1Fav); - // TODO: remove workaround for favorites - // await toolbar.clickSharedLinkSettings(); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); @@ -797,9 +781,7 @@ describe('Unshare a file', () => { it('on Favorites - file shared by the user - [C286703]', async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(file2Fav); - // TODO: remove workaround for favorites - // await toolbar.clickSharedLinkSettings(); - await toolbar.clickShare(); + await toolbar.clickSharedLinkSettings(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); diff --git a/e2e/suites/actions/upload-file.test.ts b/e2e/suites/actions/upload-file.test.ts index b99a54c43..b9eb37dfb 100755 --- a/e2e/suites/actions/upload-file.test.ts +++ b/e2e/suites/actions/upload-file.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -63,5 +63,7 @@ describe('Upload files', () => { await dataTable.doubleClickOnRowByName(folder1); await page.sidenav.openNewMenu(); await page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`); + + expect(await dataTable.isItemPresent('create-folder.test.ts')).toBe(true, 'file not uploaded'); }); }); diff --git a/e2e/suites/actions/upload-new-version.test.ts b/e2e/suites/actions/upload-new-version.test.ts index 3a3594679..715a388e0 100755 --- a/e2e/suites/actions/upload-new-version.test.ts +++ b/e2e/suites/actions/upload-new-version.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/application/general.test.ts b/e2e/suites/application/general.test.ts index 393a88aab..891f5d4b3 100644 --- a/e2e/suites/application/general.test.ts +++ b/e2e/suites/application/general.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/application/page-titles.test.ts b/e2e/suites/application/page-titles.test.ts index dbcb51f52..26f48694c 100755 --- a/e2e/suites/application/page-titles.test.ts +++ b/e2e/suites/application/page-titles.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/authentication/login.test.ts b/e2e/suites/authentication/login.test.ts index ae7123ebb..551427407 100755 --- a/e2e/suites/authentication/login.test.ts +++ b/e2e/suites/authentication/login.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/authentication/logout.test.ts b/e2e/suites/authentication/logout.test.ts index b6926ea49..ed7f2158f 100755 --- a/e2e/suites/authentication/logout.test.ts +++ b/e2e/suites/authentication/logout.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/extensions/ext-context-submenus.test.ts b/e2e/suites/extensions/ext-context-submenus.test.ts index e7a38a41e..9f3f8582e 100644 --- a/e2e/suites/extensions/ext-context-submenus.test.ts +++ b/e2e/suites/extensions/ext-context-submenus.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/extensions/ext-document-list.test.ts b/e2e/suites/extensions/ext-document-list.test.ts index 554c5c19f..adeaa446b 100644 --- a/e2e/suites/extensions/ext-document-list.test.ts +++ b/e2e/suites/extensions/ext-document-list.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -38,10 +38,6 @@ describe('Extensions - DocumentList presets', () => { id: 'app.files.name', label: 'Name' }, - { - id: 'app.files.thumbnail', - label: 'Thumbnail' - }, { id: 'app.files.size', label: 'Size', diff --git a/e2e/suites/extensions/ext-header.test.ts b/e2e/suites/extensions/ext-header.test.ts index 8e9b5b76d..7b3179071 100755 --- a/e2e/suites/extensions/ext-header.test.ts +++ b/e2e/suites/extensions/ext-header.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/extensions/ext-info-drawer.test.ts b/e2e/suites/extensions/ext-info-drawer.test.ts index a6a24b7d5..6b51e37ff 100755 --- a/e2e/suites/extensions/ext-info-drawer.test.ts +++ b/e2e/suites/extensions/ext-info-drawer.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/extensions/ext-metadata.test.ts b/e2e/suites/extensions/ext-metadata.test.ts index f292b1b43..5bcee0151 100644 --- a/e2e/suites/extensions/ext-metadata.test.ts +++ b/e2e/suites/extensions/ext-metadata.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/extensions/ext-viewer.test.ts b/e2e/suites/extensions/ext-viewer.test.ts index 80d7275a4..97d66e580 100755 --- a/e2e/suites/extensions/ext-viewer.test.ts +++ b/e2e/suites/extensions/ext-viewer.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/info-drawer/comments.test.ts b/e2e/suites/info-drawer/comments.test.ts index b7a76fe6d..936c4d2d7 100755 --- a/e2e/suites/info-drawer/comments.test.ts +++ b/e2e/suites/info-drawer/comments.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -75,8 +75,6 @@ describe('Comments', () => { fileWith1CommentId = (await apis.user.nodes.createFile(fileWith1Comment, parentId)).entry.id; fileWith2CommentsId = (await apis.user.nodes.createFile(fileWith2Comments, parentId)).entry.id; - commentFile1Entry = (await apis.user.comments.addComment(fileWith1CommentId, 'this is my comment')).entry; - comment1File2Entry = (await apis.user.comments.addComment(fileWith2CommentsId, 'first comment')).entry; comment2File2Entry = (await apis.user.comments.addComment(fileWith2CommentsId, 'second comment')).entry; @@ -96,6 +94,11 @@ describe('Comments', () => { done(); }); + afterEach(async (done) => { + await page.clickPersonalFiles(); + done(); + }); + describe('from Personal Files', () => { beforeEach(async (done) => { await page.clickPersonalFilesAndWait(); @@ -115,23 +118,6 @@ describe('Comments', () => { expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); }); - it('Comment info display - [C280582]', async () => { - await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - - expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); - }); - it('Comments are displayed ordered by created date in descending order - [C280583]', async () => { await dataTable.selectItem(fileWith2Comments); await page.toolbar.clickViewDetails(); @@ -219,29 +205,6 @@ describe('Comments', () => { done(); }); - afterEach(async (done) => { - await page.clickPersonalFiles(); - done(); - }); - - it('Comment info display - [C299196]', async () => { - await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - - expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - // ACA-2348 expect broken because of parallel test suites - // expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); - }); - it('Comments are displayed ordered by created date in descending order - [C299197]', async () => { await dataTable.selectItem(fileWith2Comments); await page.toolbar.clickViewDetails(); @@ -303,28 +266,6 @@ describe('Comments', () => { done(); }); - afterEach(async (done) => { - await page.clickPersonalFiles(); - done(); - }); - - it('Comment info display - [C299188]', async () => { - await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - - expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); - }); - it('Comments are displayed ordered by created date in descending order - [C299189]', async () => { await dataTable.selectItem(fileWith2Comments); await page.toolbar.clickViewDetails(); @@ -371,28 +312,6 @@ describe('Comments', () => { done(); }); - afterEach(async (done) => { - await page.clickPersonalFiles(); - done(); - }); - - it('Comment info display - [C299192]', async () => { - await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); - await infoDrawer.waitForInfoDrawerToOpen(); - await infoDrawer.clickCommentsTab(); - - expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); - expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); - expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); - - expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); - expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); - expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); - expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); - expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); - }); - it('Comments are displayed ordered by created date in descending order - [C299193]', async () => { await dataTable.selectItem(fileWith2Comments); await page.toolbar.clickViewDetails(); @@ -428,4 +347,94 @@ describe('Comments', () => { }); }); + describe('Comment info display', () => { + beforeAll(async (done) => { + commentFile1Entry = (await apis.user.comments.addComment(fileWith1CommentId, 'this is my comment')).entry; + + await apis.user.favorites.waitForApi({ expect: 4 }); + await apis.user.shared.waitForApi({ expect: 3 }); + await apis.user.search.waitForApi(username, { expect: 7 }); + + done(); + }); + + it('File from Personal files - [C280582]', async () => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parent); + + await dataTable.selectItem(fileWith1Comment); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + await infoDrawer.clickCommentsTab(); + + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + }); + + it('File from Favorites - [C299196]', async () => { + await page.clickFavoritesAndWait(); + + await dataTable.selectItem(fileWith1Comment); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + await infoDrawer.clickCommentsTab(); + + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + }); + + it('File from Shared Files - [C299188]', async () => { + await page.clickSharedFilesAndWait(); + + await dataTable.selectItem(fileWith1Comment); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + await infoDrawer.clickCommentsTab(); + + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + }); + + it('File from Recent Files - [C299192]', async () => { + await page.clickRecentFilesAndWait(); + + await dataTable.selectItem(fileWith1Comment); + await page.toolbar.clickViewDetails(); + await infoDrawer.waitForInfoDrawerToOpen(); + await infoDrawer.clickCommentsTab(); + + expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)'); + expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); + expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); + + expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); + expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); + expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); + expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); + expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); + }); + + }); + }); diff --git a/e2e/suites/info-drawer/file-folder-properties.test.ts b/e2e/suites/info-drawer/file-folder-properties.test.ts index d26ad95b1..161ccdea8 100755 --- a/e2e/suites/info-drawer/file-folder-properties.test.ts +++ b/e2e/suites/info-drawer/file-folder-properties.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -140,7 +140,7 @@ describe('File / Folder properties', () => { expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values'); expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled'); - expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); }); it('Folder properties - [C307106]', async () => { @@ -174,7 +174,7 @@ describe('File / Folder properties', () => { expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values'); expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled'); - expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); }); it('Less / More information buttons - [C269004]', async () => { @@ -182,19 +182,19 @@ describe('File / Folder properties', () => { await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); - expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); - - await propertiesTab.clickLessInformationButton(); - - expect(await propertiesTab.isLessInfoButtonDisplayed()).toBe(false, 'Less information button displayed'); expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); - expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded'); + expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); await propertiesTab.clickMoreInformationButton(); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); + expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded'); + + await propertiesTab.clickLessInformationButton(); + + expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(true, 'More information button not displayed'); + expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(false, 'Less information button enabled'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); }); @@ -234,7 +234,7 @@ describe('File / Folder properties', () => { await page.toolbar.clickViewDetails(); await infoDrawer.waitForInfoDrawerToOpen(); - await propertiesTab.clickLessInformationButton(); + await propertiesTab.clickMoreInformationButton(); await propertiesTab.clickImagePropertiesPanel(); await propertiesTab.waitForImagePropertiesPanelToExpand(); @@ -242,7 +242,7 @@ describe('File / Folder properties', () => { expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values'); expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled'); - expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); + expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); }); }); diff --git a/e2e/suites/info-drawer/general.test.ts b/e2e/suites/info-drawer/general.test.ts index 4465e5f55..872bc4125 100755 --- a/e2e/suites/info-drawer/general.test.ts +++ b/e2e/suites/info-drawer/general.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/info-drawer/library-properties.test.ts b/e2e/suites/info-drawer/library-properties.test.ts index 29518cc14..c798d96ba 100755 --- a/e2e/suites/info-drawer/library-properties.test.ts +++ b/e2e/suites/info-drawer/library-properties.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/suites/list-views/empty-list.test.ts index 93ecafd09..e17e24134 100755 --- a/e2e/suites/list-views/empty-list.test.ts +++ b/e2e/suites/list-views/empty-list.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { LoginPage, BrowsingPage } from '../../pages/pages'; +import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages'; import { Utils } from '../../utilities/utils'; import { RepoClient } from '../../utilities/repo-client/repo-client'; @@ -38,6 +38,7 @@ describe('Empty list views', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); + const searchResultsPage = new SearchResultsPage(); const { dataTable, pagination } = page; const { searchInput } = page.header; @@ -49,51 +50,51 @@ describe('Empty list views', () => { it('empty Personal Files - [C280131]', async () => { await page.clickPersonalFiles(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyDragAndDropText()).toContain('Drag and drop'); }); it('empty My Libraries - [C217099]', async () => { await page.goToMyLibraries(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`); expect(await dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.'); }); it('empty Favorite Libraries - [C289911]', async () => { await page.goToFavoriteLibraries(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain(`No Favorite Libraries`); expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite a library that you want to find easily later.'); }); it('empty Shared Files - [C280132]', async () => { await page.clickSharedFiles(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('No shared files or folders'); expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you share using the Share option are shown here.'); }); it('empty Recent Files - [C213169]', async () => { await page.clickRecentFiles(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('No recent files'); expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you uploaded or edited in the last 30 days are shown here.'); }); it('empty Favorites - [C280133]', async () => { await page.clickFavorites(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('No favorite files or folders'); expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite items that you want to easily find later.'); }); it('empty Trash - [C280134]', async () => { await page.clickTrash(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('Trash is empty'); - expect(await dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.'); - expect(await dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.'); + expect(await dataTable.getEmptyListText()).toContain('Items you delete are moved to the Trash.'); + expect(await dataTable.getEmptyListText()).toContain('Empty Trash to permanently delete items.'); }); it('Favorites - pagination controls not displayed - [C280111]', async () => { @@ -168,7 +169,6 @@ describe('Empty list views', () => { it('Search results - pagination controls not displayed - [C290123]', async () => { await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); /* cspell:disable-next-line */ await searchInput.searchFor('qwertyuiop'); await dataTable.waitForBody(); @@ -181,6 +181,15 @@ describe('Empty list views', () => { expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present'); }); + it('Search filters panel is not displayed on empty Search Results page - [C279189]', async () => { + await searchInput.clickSearchButton(); + /* cspell:disable-next-line */ + await searchInput.searchFor('qwertyuiop'); + await dataTable.waitForBody(); + + expect(await searchResultsPage.filters.isSearchFiltersPanelDisplayed()).toBe(false, 'Search filters panel is present'); + }); + it('Empty Search results - Libraries - [C290020]', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); @@ -188,7 +197,7 @@ describe('Empty list views', () => { await searchInput.searchFor('qwertyuiop'); await dataTable.waitForBody(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results'); }); @@ -199,7 +208,7 @@ describe('Empty list views', () => { await searchInput.searchFor('qwertyuiop'); await dataTable.waitForBody(); - expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty'); + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results'); }); }); diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/suites/list-views/favorites.test.ts index dbef1d15e..f071eb3eb 100755 --- a/e2e/suites/list-views/favorites.test.ts +++ b/e2e/suites/list-views/favorites.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -88,14 +88,14 @@ describe('Favorites', () => { }); it('has the correct columns - [C280482]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by' ]; + const expectedColumns = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); }); it('displays the favorite files and folders - [C213226]', async () => { - expect(await dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed'); + expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed'); expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`); expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`); expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`); diff --git a/e2e/suites/list-views/file-libraries.test.ts b/e2e/suites/list-views/file-libraries.test.ts index 7ff6e3847..3c5713ed4 100755 --- a/e2e/suites/list-views/file-libraries.test.ts +++ b/e2e/suites/list-views/file-libraries.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -103,14 +103,14 @@ describe('File Libraries', () => { }); it('has the correct columns - [C217095]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'My Role', 'Visibility' ]; + const expectedColumns = [ 'Name', 'My Role', 'Visibility' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); }); it('User can see only the sites he is a member of - [C280501]', async () => { - const sitesCount = await dataTable.countRows(); + const sitesCount = await dataTable.getRowsCount(); expect(sitesCount).toEqual(10, 'Incorrect number of sites displayed'); expect(await dataTable.isItemPresent(adminSite5)).toBe(false, `${adminSite5} should not appear in the list`); @@ -150,10 +150,8 @@ describe('File Libraries', () => { `${siteName} (${siteId1})`, `${siteName} (${siteId2})` ]; - const cells = await dataTable.getCellsContainingName(siteName); - const expectedJSON = JSON.stringify(expectedSites.sort()); - const actualJSON = JSON.stringify(cells.sort()); - expect(actualJSON).toEqual(expectedJSON); + const actualSites = await dataTable.getCellsContainingName(siteName); + expect(actualSites.sort()).toEqual(expectedSites.sort()); }); it('Tooltip for sites without description - [C217096]', async () => { @@ -174,14 +172,14 @@ describe('File Libraries', () => { }); it('has the correct columns - [C289893]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'My Role', 'Visibility' ]; + const expectedColumns = [ 'Name', 'My Role', 'Visibility' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); }); it('User can see only his favorite sites - [C289897]', async () => { - const sitesCount = await dataTable.countRows(); + const sitesCount = await dataTable.getRowsCount(); expect(sitesCount).toEqual(9, 'Incorrect number of sites displayed'); expect(await dataTable.isItemPresent(adminSite6)).toBe(false, `${adminSite6} should not appear`); @@ -221,10 +219,8 @@ describe('File Libraries', () => { `${siteName} (${siteId1})`, `${siteName} (${siteId2})` ]; - const cells = await dataTable.getCellsContainingName(siteName); - const expectedJSON = JSON.stringify(expectedSites.sort()); - const actualJSON = JSON.stringify(cells.sort()); - expect(actualJSON).toEqual(expectedJSON); + const actualSites = await dataTable.getCellsContainingName(siteName); + expect(actualSites.sort()).toEqual(expectedSites.sort()); }); it('Tooltip for sites without description - [C289894]', async () => { diff --git a/e2e/suites/list-views/generic-errors.test.ts b/e2e/suites/list-views/generic-errors.test.ts index 92422f035..50122996e 100755 --- a/e2e/suites/list-views/generic-errors.test.ts +++ b/e2e/suites/list-views/generic-errors.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/list-views/permissions.test.ts b/e2e/suites/list-views/permissions.test.ts index 0e42c6efd..f2598bea6 100755 --- a/e2e/suites/list-views/permissions.test.ts +++ b/e2e/suites/list-views/permissions.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -80,26 +80,26 @@ describe('Special permissions', () => { it('on Recent Files - [C213173]', async () => { await page.clickRecentFilesAndWait(); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username); await page.refresh(); - expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed'); + expect(await dataTable.isEmpty()).toBe(true, 'Items are still displayed'); }); it('on Favorites - [C213227]', async () => { await page.clickFavoritesAndWait(); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username); await page.refresh(); - expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed'); + expect(await dataTable.isEmpty()).toBe(true, 'Items are still displayed'); }); it('on Shared Files - [C213116]', async () => { await page.clickSharedFilesAndWait(); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username); await page.refresh(); - expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed'); + expect(await dataTable.isEmpty()).toBe(true, 'Items are still displayed'); }); it('on Search Results - [C290122]', async () => { @@ -147,19 +147,19 @@ describe('Special permissions', () => { it(`on Recent Files - [C213178]`, async () => { await page.clickRecentFilesAndWait(); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown'); }); it(`on Favorites - [C213672]`, async () => { await page.clickFavoritesAndWait(); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown'); }); it(`on Shared Files - [C213668]`, async () => { await page.clickSharedFilesAndWait(); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown'); }); diff --git a/e2e/suites/list-views/personal-files.test.ts b/e2e/suites/list-views/personal-files.test.ts index 3f72219c2..5f8072e45 100755 --- a/e2e/suites/list-views/personal-files.test.ts +++ b/e2e/suites/list-views/personal-files.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -94,7 +94,7 @@ describe('Personal Files', () => { }); it('has the correct columns - [C217142]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'Size', 'Modified', 'Modified by' ]; + const expectedColumns = [ 'Name', 'Size', 'Modified', 'Modified by' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); diff --git a/e2e/suites/list-views/recent-files.test.ts b/e2e/suites/list-views/recent-files.test.ts index c9ee41353..37a1ffc69 100755 --- a/e2e/suites/list-views/recent-files.test.ts +++ b/e2e/suites/list-views/recent-files.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -81,7 +81,7 @@ describe('Recent Files', () => { }); it('has the correct columns - [C213168]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified' ]; + const expectedColumns = [ 'Name', 'Location', 'Size', 'Modified' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); @@ -93,7 +93,7 @@ describe('Recent Files', () => { }); it('displays the files added by the current user in the last 30 days - [C213170]', async () => { - expect(await dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed'); + expect(await dataTable.getRowsCount()).toEqual(3, 'Incorrect number of files displayed'); expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`); expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`); expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); diff --git a/e2e/suites/list-views/shared-files.test.ts b/e2e/suites/list-views/shared-files.test.ts index c0c0a447f..909a45fa5 100755 --- a/e2e/suites/list-views/shared-files.test.ts +++ b/e2e/suites/list-views/shared-files.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -87,7 +87,7 @@ describe('Shared Files', () => { }); it('has the correct columns - [C213113]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ]; + const expectedColumns = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); diff --git a/e2e/suites/list-views/tooltips.test.ts b/e2e/suites/list-views/tooltips.test.ts index 53499c659..a54861138 100755 --- a/e2e/suites/list-views/tooltips.test.ts +++ b/e2e/suites/list-views/tooltips.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/list-views/trash.test.ts b/e2e/suites/list-views/trash.test.ts index 63216feb6..890afd8a9 100755 --- a/e2e/suites/list-views/trash.test.ts +++ b/e2e/suites/list-views/trash.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -99,14 +99,14 @@ describe('Trash', () => { }); it('has the correct columns - [C213217]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ]; + const expectedColumns = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); }); it('displays the files and folders deleted by everyone - [C280493]', async () => { - expect(await dataTable.countRows()).toEqual(8, 'Incorrect number of deleted items displayed'); + expect(await dataTable.getRowsCount()).toEqual(8, 'Incorrect number of deleted items displayed'); expect(await dataTable.isItemPresent(fileAdmin)).toBe(true, `${fileAdmin} not displayed`); expect(await dataTable.isItemPresent(folderAdmin)).toBe(true, `${folderAdmin} not displayed`); @@ -128,14 +128,14 @@ describe('Trash', () => { }); it('has the correct columns - [C280494]', async () => { - const expectedColumns = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Deleted']; + const expectedColumns = [ 'Name', 'Location', 'Size', 'Deleted']; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); }); it('displays the files and folders deleted by the user - [C213218]', async () => { - expect(await dataTable.countRows()).toEqual(6, 'Incorrect number of deleted items displayed'); + expect(await dataTable.getRowsCount()).toEqual(6, 'Incorrect number of deleted items displayed'); expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); expect(await dataTable.isItemPresent(fileUser)).toBe(true, `${fileUser} not displayed`); diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/suites/navigation/breadcrumb.test.ts index 198870a5a..449c9973f 100755 --- a/e2e/suites/navigation/breadcrumb.test.ts +++ b/e2e/suites/navigation/breadcrumb.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/navigation/sidebar.test.ts b/e2e/suites/navigation/sidebar.test.ts index 773acbdaf..66ea8ccb0 100755 --- a/e2e/suites/navigation/sidebar.test.ts +++ b/e2e/suites/navigation/sidebar.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/navigation/single-click.test.ts b/e2e/suites/navigation/single-click.test.ts index d37251789..e27a4a18c 100755 --- a/e2e/suites/navigation/single-click.test.ts +++ b/e2e/suites/navigation/single-click.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/pagination/favorites.ts b/e2e/suites/pagination/favorites.ts new file mode 100755 index 000000000..1b7f282ac --- /dev/null +++ b/e2e/suites/pagination/favorites.ts @@ -0,0 +1,131 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../pages/pages'; +import { Utils } from '../../utilities/utils'; + +export function favoritesTests() { + const page = new BrowsingPage(); + const { dataTable, pagination } = page; + + describe('Pagination controls : ', () => { + + beforeAll(async () => { + await page.clickFavoritesAndWait(); + }); + + afterEach(async () => { + await Utils.pressEscape(); + }); + + it('Pagination control default values - [C280113]', async () => { + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + }); + + it('Items per page values - [C280114]', async () => { + await pagination.openMaxItemsMenu(); + expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); + expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); + expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); + await pagination.menu.closeMenu(); + }); + + it('current page menu items - [C280115]', async () => { + await pagination.openMaxItemsMenu() + await pagination.menu.clickMenuItem('25'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getTotalPages()).toContain('of 5'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(5); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); + expect(await pagination.getTotalPages()).toContain('of 3'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(3); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 2'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(2); + await pagination.menu.closeMenu(); + + await pagination.resetToDefaultPageSize(); + }); + + it('change the current page from menu - [C280116]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(3); + expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); + expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + expect(await dataTable.isItemPresent('my-file-40')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('navigate to next and previous pages - [C280119]', async () => { + await pagination.clickNext(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('26-50 of 101'); + expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page'); + await pagination.resetToDefaultPageNumber(); + + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(2); + await dataTable.waitForHeader(); + await pagination.clickPrevious(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('Previous button is disabled on first page - [C280117]', async () => { + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); + }); + + it('Next button is disabled on last page - [C280118]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(5); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); + expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); + }); + }); +} diff --git a/e2e/suites/pagination/multiple-pages-files.test.ts b/e2e/suites/pagination/multiple-pages-files.test.ts new file mode 100644 index 000000000..37f40a402 --- /dev/null +++ b/e2e/suites/pagination/multiple-pages-files.test.ts @@ -0,0 +1,94 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage } from '../../pages/pages'; +import { Utils } from '../../utilities/utils'; +import { AdminActions } from '../../utilities/admin-actions'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { personalFilesTests } from './personal-files'; +import { recentFilesTests } from './recent-files'; +import { searchResultsTests } from './search-results'; +import { sharedFilesTests } from './shared-files'; +import { favoritesTests } from './favorites'; + +describe('Pagination on multiple pages : ', () => { + const random = Utils.random(); + const username = `user-${random}`; + + const parent = `parent-${random}`; + let parentId: string; + + const files = Array(101) + .fill('my-file') + .map((name, index): string => `${name}-${index + 1}-${random}.txt`); + let filesIds: string[]; + + const userApi = new RepoClient(username, username); + const adminApiActions = new AdminActions(); + + const loginPage = new LoginPage(); + + beforeAll(async () => { + await adminApiActions.createUser({ username }); + parentId = (await userApi.nodes.createFolder(parent)).entry.id; + filesIds = (await userApi.nodes.createFiles(files, parent)).list.entries.map(entries => entries.entry.id); + + await userApi.shared.shareFilesByIds(filesIds); + await userApi.favorites.addFavoritesByIds('file', filesIds); + + await Promise.all([ + userApi.favorites.waitForApi({ expect: 101 }), + userApi.shared.waitForApi({ expect: 101 }), + userApi.search.waitForApi(username, { expect: 101 }), + ]); + + await loginPage.loginWith(username); + }); + + afterAll(async () => { + await userApi.nodes.deleteNodeById(parentId); + }); + + describe('on Personal Files', () => { + personalFilesTests(parent); + }); + + describe('on Recent Files', () => { + recentFilesTests(); + }); + + describe('on Search Results', () => { + searchResultsTests(); + }); + + describe('on Shared Files', () => { + sharedFilesTests(); + }); + + describe('on Favorites', () => { + favoritesTests(); + }); + +}); diff --git a/e2e/suites/pagination/pag-file-libraries.test.ts b/e2e/suites/pagination/multiple-pages-libraries.test.ts similarity index 90% rename from e2e/suites/pagination/pag-file-libraries.test.ts rename to e2e/suites/pagination/multiple-pages-libraries.test.ts index 91edddffc..dd601b5ea 100755 --- a/e2e/suites/pagination/pag-file-libraries.test.ts +++ b/e2e/suites/pagination/multiple-pages-libraries.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,48 +23,45 @@ * along with Alfresco. If not, see . */ -import { SITE_VISIBILITY } from '../../configs'; import { LoginPage, BrowsingPage } from '../../pages/pages'; import { Utils } from '../../utilities/utils'; +import { AdminActions } from '../../utilities/admin-actions'; import { RepoClient } from '../../utilities/repo-client/repo-client'; describe('Pagination on multiple pages', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); + + const username = `user-${random}`; + + const userApi = new RepoClient(username, username); + const adminApiActions = new AdminActions(); - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, pagination } = page; const sites = Array(101) .fill('site') - .map((name, index): string => `${name}-${index + 1}-${Utils.random()}`); + .map((name, index): string => `${name}-${index + 1}-${random}`); - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - await apis.user.sites.createSites(sites, SITE_VISIBILITY.PRIVATE); - await apis.user.sites.waitForApi({ expect: 101 }); + beforeAll(async () => { + await adminApiActions.createUser({ username }); + await userApi.sites.createSitesPrivate(sites); + await userApi.sites.waitForApi({ expect: 101 }); await loginPage.loginWith(username); - done(); }); - afterAll(async (done) => { - await apis.user.sites.deleteSites(sites); - done(); + afterAll(async () => { + await userApi.sites.deleteSites(sites); }) describe('on My Libraries', () => { - beforeEach(async (done) => { + beforeAll(async () => { await page.goToMyLibrariesAndWait(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); it('Pagination control default values - [C280086]', async () => { @@ -151,21 +148,19 @@ describe('Pagination on multiple pages', () => { it('Next button is disabled on last page - [C280091]', async () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); expect(await pagination.getCurrentPage()).toContain('Page 5'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); describe('on Favorite Libraries', () => { - beforeEach(async (done) => { + beforeAll(async () => { await page.goToFavoriteLibrariesAndWait(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); it('Pagination control default values - [C291875]', async () => { @@ -252,7 +247,7 @@ describe('Pagination on multiple pages', () => { it('Next button is disabled on last page - [C291880]', async () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); expect(await pagination.getCurrentPage()).toContain('Page 5'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); diff --git a/e2e/suites/pagination/pag-trash.test.ts b/e2e/suites/pagination/multiple-pages-trash.test.ts similarity index 86% rename from e2e/suites/pagination/pag-trash.test.ts rename to e2e/suites/pagination/multiple-pages-trash.test.ts index bebb729d7..f8c9c03aa 100755 --- a/e2e/suites/pagination/pag-trash.test.ts +++ b/e2e/suites/pagination/multiple-pages-trash.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -25,46 +25,42 @@ import { LoginPage, BrowsingPage } from '../../pages/pages'; import { Utils } from '../../utilities/utils'; +import { AdminActions } from '../../utilities/admin-actions'; import { RepoClient } from '../../utilities/repo-client/repo-client'; describe('Pagination on multiple pages on Trash', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); + + const username = `user-${random}`; const filesForDelete = Array(101) .fill('file') - .map((name, index): string => `${name}-${index + 1}.txt`); - let filesDeletedIds; + .map((name, index): string => `${name}-${index + 1}-${random}.txt`); + let filesDeletedIds: string[]; - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; + const userApi = new RepoClient(username, username); + const adminApiActions = new AdminActions(); const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, pagination } = page; - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - filesDeletedIds = (await apis.user.nodes.createFiles(filesForDelete)).list.entries.map(entries => entries.entry.id); - await apis.user.nodes.deleteNodesById(filesDeletedIds, false); - await apis.user.trashcan.waitForApi({expect: 101}); + beforeAll(async () => { + await adminApiActions.createUser({ username }); + filesDeletedIds = (await userApi.nodes.createFiles(filesForDelete)).list.entries.map(entries => entries.entry.id); + + await userApi.nodes.deleteNodesById(filesDeletedIds, false); + await userApi.trashcan.waitForApi({expect: 101}); + await loginPage.loginWith(username); - done(); - }); - - beforeEach(async (done) => { await page.clickTrashAndWait(); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await Utils.pressEscape(); - done(); }); - afterAll(async (done) => { - await apis.user.trashcan.emptyTrash(); - done(); + afterAll(async () => { + await userApi.trashcan.emptyTrash(); }); it('Pagination control default values - [C280122]', async () => { @@ -151,7 +147,7 @@ describe('Pagination on multiple pages on Trash', () => { it('Next button is disabled on last page - [C280127]', async () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); expect(await pagination.getCurrentPage()).toContain('Page 5'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); diff --git a/e2e/suites/pagination/pag-favorites.test.ts b/e2e/suites/pagination/pag-favorites.test.ts deleted file mode 100755 index 0a94f9ab9..000000000 --- a/e2e/suites/pagination/pag-favorites.test.ts +++ /dev/null @@ -1,162 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { Utils } from '../../utilities/utils'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; - -describe('Pagination on multiple pages on Favorites', () => { - const username = `user-${Utils.random()}`; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const parent = `parent-${Utils.random()}`; let parentId; - - const files = Array(101) - .fill('file') - .map((name, index): string => `${name}-${index + 1}-${Utils.random()}.txt`); - let filesIds; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - filesIds = (await apis.user.nodes.createFiles(files, parent)).list.entries.map(entries => entries.entry.id); - await apis.user.favorites.addFavoritesByIds('file', filesIds); - await apis.user.favorites.waitForApi({ expect: 101 }); - await loginPage.loginWith(username); - done(); - }); - - beforeEach(async (done) => { - await page.clickFavoritesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - await apis.user.favorites.waitForApi({ expect: 0 }); - done(); - }); - - it('Pagination control default values - [C280113]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('Items per page values - [C280114]', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('current page menu items - [C280115]', async () => { - await pagination.openMaxItemsMenu() - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.resetToDefaultPageSize(); - }); - - it('change the current page from menu - [C280116]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await pagination.getRange()).toContain('51-75 of 101'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('file-40')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('navigate to next and previous pages - [C280119]', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('Previous button is disabled on first page - [C280117]', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('Next button is disabled on last page - [C280118]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); -}); diff --git a/e2e/suites/pagination/pag-personal-files.test.ts b/e2e/suites/pagination/pag-personal-files.test.ts deleted file mode 100755 index 18a0a948b..000000000 --- a/e2e/suites/pagination/pag-personal-files.test.ts +++ /dev/null @@ -1,160 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { Utils } from '../../utilities/utils'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; - -describe('Pagination on multiple pages on Personal Files', () => { - const username = `user-${Utils.random()}`; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const parent = `parent-${Utils.random()}`; let parentId; - const files = Array(101) - .fill('file') - .map((name, index): string => `${name}-${index + 1}.txt`); - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - await apis.user.nodes.createFiles(files, parent); - await loginPage.loginWith(username); - done(); - }); - - beforeEach(async (done) => { - await page.clickPersonalFilesAndWait(); - await dataTable.doubleClickOnRowByName(parent); - await dataTable.waitForHeader(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - it('Pagination control default values - [C280077]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('Items per page values - [C280078]', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('current page menu items - [C280079]', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.resetToDefaultPageSize(); - }); - - it('change the current page from menu - [C280080]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('file-60')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('navigate to next and previous pages - [C280083]', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('file-31')).toBe(true, 'file-31 not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('file-12')).toBe(true, 'file-12 not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('Previous button is disabled on first page - [C280081]', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('Next button is disabled on last page - [C280082]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); -}); diff --git a/e2e/suites/pagination/pag-recent-files.test.ts b/e2e/suites/pagination/pag-recent-files.test.ts deleted file mode 100755 index 32e377dcf..000000000 --- a/e2e/suites/pagination/pag-recent-files.test.ts +++ /dev/null @@ -1,159 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { Utils } from '../../utilities/utils'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; - -describe('Pagination on multiple pages on Recent Files', () => { - const username = `user-${Utils.random()}`; - - const parent = `parent-${Utils.random()}`; let parentId; - const files = Array(101) - .fill('file') - .map((name, index): string => `${name}-${index + 1}.txt`); - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - await apis.user.nodes.createFiles(files, parent); - await apis.user.search.waitForApi(username, { expect: 101 }); - await loginPage.loginWith(username); - done(); - }); - - beforeEach(async (done) => { - await page.clickRecentFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - it('Pagination control default values - [C280104]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('Items per page values - [C280105]', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('current page menu items - [C280106]', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.resetToDefaultPageSize(); - }); - - it('change the current page from menu - [C280107]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('file-40')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('navigate to next and previous pages - [C280110]', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('Previous button is disabled on first page - [C280108]', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('Next button is disabled on last page - [C280109]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); -}); diff --git a/e2e/suites/pagination/pag-search-results.test.ts b/e2e/suites/pagination/pag-search-results.test.ts deleted file mode 100755 index dd9fa015b..000000000 --- a/e2e/suites/pagination/pag-search-results.test.ts +++ /dev/null @@ -1,158 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { Utils } from '../../utilities/utils'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; - -describe('Pagination on multiple pages on Search Results', () => { - const username = `user-${Utils.random()}`; - - const parent = `parent-${Utils.random()}`; let parentId; - const files = Array(101) - .fill('myFile') - .map((name, index): string => `${name}-${index + 1}.txt`); - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - const { searchInput } = page.header; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - await apis.user.nodes.createFiles(files, parent); - await apis.user.search.waitForApi(username, { expect: 101 }); - await loginPage.loginWith(username); - - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor('myFile-'); - await dataTable.waitForBody(); - - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - it('Pagination control default values - [C290125]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('Items per page values - [C290126]', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('current page menu items - [C290127]', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.resetToDefaultPageSize(); - }); - - it('change the current page from menu - [C290128]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('51-75 of 101'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('navigate to next and previous pages - [C290131]', async () => { - await pagination.clickNext(); - await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForBody(); - await pagination.clickPrevious(); - await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('Previous button is disabled on first page - [C290129]', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('Next button is disabled on last page - [C290130]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); -}); diff --git a/e2e/suites/pagination/pag-shared-files.test.ts b/e2e/suites/pagination/pag-shared-files.test.ts deleted file mode 100755 index 4a2695cc3..000000000 --- a/e2e/suites/pagination/pag-shared-files.test.ts +++ /dev/null @@ -1,162 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2019 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 . - */ - -import { LoginPage, BrowsingPage } from '../../pages/pages'; -import { Utils } from '../../utilities/utils'; -import { RepoClient } from '../../utilities/repo-client/repo-client'; - -describe('Pagination on multiple pages on Shared Files', () => { - const username = `user-${Utils.random()}`; - - const parent = `parent-${Utils.random()}`; let parentId; - const files = Array(101) - .fill('file') - .map((name, index): string => `${name}-${index + 1}.txt`); - let filesIds; - - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - filesIds = (await apis.user.nodes.createFiles(files, parent)).list.entries.map(entries => entries.entry.id); - - await apis.user.shared.shareFilesByIds(filesIds); - await apis.user.shared.waitForApi({ expect: 101 }); - await loginPage.loginWith(username); - done(); - }); - - beforeEach(async (done) => { - await page.clickSharedFilesAndWait(); - done(); - }); - - afterEach(async (done) => { - await Utils.pressEscape(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(parentId); - done(); - }); - - it('Pagination control default values - [C280095]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('Items per page values - [C280096]', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('current page menu items - [C280097]', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.resetToDefaultPageSize(); - }); - - it('change the current page from menu - [C280098]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('file-40')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('navigate to next and previous pages - [C280101]', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('Previous button is disabled on first page - [C280099]', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('Next button is disabled on last page - [C280100]', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); - expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); -}); diff --git a/e2e/suites/pagination/personal-files.ts b/e2e/suites/pagination/personal-files.ts new file mode 100755 index 000000000..b36ee7727 --- /dev/null +++ b/e2e/suites/pagination/personal-files.ts @@ -0,0 +1,134 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../pages/pages'; +import { Utils } from '../../utilities/utils'; + +export function personalFilesTests(parentName: string) { + const page = new BrowsingPage(); + const { dataTable, pagination } = page; + + describe('Pagination controls : ', () => { + + beforeAll(async () => { + await page.clickPersonalFilesAndWait(); + await dataTable.doubleClickOnRowByName(parentName); + await dataTable.waitForHeader(); + }); + + afterEach(async () => { + await Utils.pressEscape(); + }); + + it('Pagination control default values - [C280077]', async () => { + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + }); + + it('Items per page values - [C280078]', async () => { + await pagination.openMaxItemsMenu(); + expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); + expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); + expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); + await pagination.menu.closeMenu(); + }); + + it('current page menu items - [C280079]', async () => { + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('25'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getTotalPages()).toContain('of 5'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(5); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); + expect(await pagination.getTotalPages()).toContain('of 3'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(3); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 2'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(2); + await pagination.menu.closeMenu(); + + await pagination.resetToDefaultPageSize(); + }); + + it('change the current page from menu - [C280080]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(3); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); + expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + expect(await dataTable.isItemPresent('my-file-60')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('navigate to next and previous pages - [C280083]', async () => { + await pagination.clickNext(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('26-50 of 101'); + expect(await dataTable.isItemPresent('my-file-31')).toBe(true, 'file-31 not found on page'); + await pagination.resetToDefaultPageNumber(); + + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(2); + await dataTable.waitForHeader(); + await pagination.clickPrevious(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await dataTable.isItemPresent('my-file-12')).toBe(true, 'my-file-12 not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('Previous button is disabled on first page - [C280081]', async () => { + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); + }); + + it('Next button is disabled on last page - [C280082]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(5); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); + expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); + }); + }); +} diff --git a/e2e/suites/pagination/recent-files.ts b/e2e/suites/pagination/recent-files.ts new file mode 100755 index 000000000..866e46585 --- /dev/null +++ b/e2e/suites/pagination/recent-files.ts @@ -0,0 +1,132 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../pages/pages'; +import { Utils } from '../../utilities/utils'; + +export function recentFilesTests() { + const page = new BrowsingPage(); + const { dataTable, pagination } = page; + + describe('Pagination controls : ', () => { + + beforeAll(async () => { + await page.clickRecentFilesAndWait(); + }); + + afterEach(async () => { + await Utils.pressEscape(); + }); + + it('Pagination control default values - [C280104]', async () => { + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + }); + + it('Items per page values - [C280105]', async () => { + await pagination.openMaxItemsMenu(); + expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); + expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); + expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); + await pagination.menu.closeMenu(); + }); + + it('current page menu items - [C280106]', async () => { + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('25'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getTotalPages()).toContain('of 5'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(5); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); + expect(await pagination.getTotalPages()).toContain('of 3'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(3); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 2'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(2); + await pagination.menu.closeMenu(); + + await pagination.resetToDefaultPageSize(); + }); + + it('change the current page from menu - [C280107]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(3); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); + expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + expect(await dataTable.isItemPresent('my-file-40')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('navigate to next and previous pages - [C280110]', async () => { + await pagination.clickNext(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('26-50 of 101'); + expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page'); + await pagination.resetToDefaultPageNumber(); + + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(2); + await dataTable.waitForHeader(); + await pagination.clickPrevious(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('Previous button is disabled on first page - [C280108]', async () => { + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); + }); + + it('Next button is disabled on last page - [C280109]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(5); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); + expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); + }); + }); +} diff --git a/e2e/suites/pagination/search-results.ts b/e2e/suites/pagination/search-results.ts new file mode 100755 index 000000000..8ed3ef219 --- /dev/null +++ b/e2e/suites/pagination/search-results.ts @@ -0,0 +1,132 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../pages/pages'; +import { Utils } from '../../utilities/utils'; + +export function searchResultsTests() { + const page = new BrowsingPage(); + const { dataTable, pagination } = page; + const { searchInput } = page.header; + + describe('Pagination controls : ', () => { + + beforeAll(async () => { + await searchInput.clickSearchButton(); + await searchInput.searchFor('my-file-'); + await dataTable.waitForBody(); + }); + + afterEach(async () => { + await Utils.pressEscape(); + }); + + it('Pagination control default values - [C290125]', async () => { + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + }); + + it('Items per page values - [C290126]', async () => { + await pagination.openMaxItemsMenu(); + expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); + expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); + expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); + await pagination.menu.closeMenu(); + }); + + it('current page menu items - [C290127]', async () => { + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('25'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getTotalPages()).toContain('of 5'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(5); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); + expect(await pagination.getTotalPages()).toContain('of 3'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(3); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 2'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(2); + await pagination.menu.closeMenu(); + + await pagination.resetToDefaultPageSize(); + }); + + it('change the current page from menu - [C290128]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(3); + await dataTable.waitForBody(); + expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); + expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('navigate to next and previous pages - [C290131]', async () => { + await pagination.clickNext(); + await dataTable.waitForBody(); + expect(await pagination.getRange()).toContain('26-50 of 101'); + await pagination.resetToDefaultPageNumber(); + + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(2); + await dataTable.waitForBody(); + await pagination.clickPrevious(); + await dataTable.waitForBody(); + expect(await pagination.getRange()).toContain('1-25 of 101'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('Previous button is disabled on first page - [C290129]', async () => { + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); + }); + + it('Next button is disabled on last page - [C290130]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(5); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); + expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); + }); + }); +} diff --git a/e2e/suites/pagination/shared-files.ts b/e2e/suites/pagination/shared-files.ts new file mode 100755 index 000000000..c52ded324 --- /dev/null +++ b/e2e/suites/pagination/shared-files.ts @@ -0,0 +1,132 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { BrowsingPage } from '../../pages/pages'; +import { Utils } from '../../utilities/utils'; + +export function sharedFilesTests() { + const page = new BrowsingPage(); + const { dataTable, pagination } = page; + + describe('Pagination controls : ', () => { + + beforeAll(async () => { + await page.clickSharedFilesAndWait(); + }); + + afterEach(async () => { + await Utils.pressEscape(); + }); + + it('Pagination control default values - [C280095]', async () => { + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + }); + + it('Items per page values - [C280096]', async () => { + await pagination.openMaxItemsMenu(); + expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); + expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); + expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); + await pagination.menu.closeMenu(); + }); + + it('current page menu items - [C280097]', async () => { + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('25'); + expect(await pagination.getMaxItems()).toContain('25'); + expect(await pagination.getTotalPages()).toContain('of 5'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(5); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); + expect(await pagination.getTotalPages()).toContain('of 3'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(3); + await pagination.menu.closeMenu(); + + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 2'); + await pagination.openCurrentPageMenu(); + expect(await pagination.menu.getItemsCount()).toBe(2); + await pagination.menu.closeMenu(); + + await pagination.resetToDefaultPageSize(); + }); + + it('change the current page from menu - [C280098]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(3); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); + expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); + expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + expect(await dataTable.isItemPresent('my-file-40')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('navigate to next and previous pages - [C280101]', async () => { + await pagination.clickNext(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('26-50 of 101'); + expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page'); + await pagination.resetToDefaultPageNumber(); + + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(2); + await dataTable.waitForHeader(); + await pagination.clickPrevious(); + await dataTable.waitForHeader(); + expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page'); + + await pagination.resetToDefaultPageNumber(); + }); + + it('Previous button is disabled on first page - [C280099]', async () => { + expect(await pagination.getCurrentPage()).toContain('Page 1'); + expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); + }); + + it('Next button is disabled on last page - [C280100]', async () => { + await pagination.openCurrentPageMenu(); + await pagination.menu.clickNthItem(5); + expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); + expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); + }); + }); +} diff --git a/e2e/suites/pagination/pag-single-page.test.ts b/e2e/suites/pagination/single-page.test.ts similarity index 67% rename from e2e/suites/pagination/pag-single-page.test.ts rename to e2e/suites/pagination/single-page.test.ts index 6c9560549..9689c3f52 100755 --- a/e2e/suites/pagination/pag-single-page.test.ts +++ b/e2e/suites/pagination/single-page.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,60 +23,60 @@ * along with Alfresco. If not, see . */ -import { LoginPage, BrowsingPage } from '../../pages/pages'; +import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages'; import { Utils } from '../../utilities/utils'; +import { AdminActions } from '../../utilities/admin-actions'; import { RepoClient } from '../../utilities/repo-client/repo-client'; describe('Pagination on single page', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); - const siteName = `site-${Utils.random()}`; let siteId; + const username = `user-${random}`; - const file = `file-${Utils.random()}.txt`; let fileId; - const fileInTrash = `fileInTrash-${Utils.random()}.txt`; let fileInTrashId; + const siteName = `site-${random}`; + let siteId: string; - const apis = { - admin: new RepoClient(), - user: new RepoClient(username, username) - }; + const file = `file-${random}.txt`; + let fileId: string; + const fileInTrash = `fileInTrash-${random}.txt`; + let fileInTrashId: string; + + const userApi = new RepoClient(username, username); + const adminApiActions = new AdminActions(); const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { pagination, dataTable } = page; + const { pagination } = page; const { searchInput } = page.header; + const searchResultsPage = new SearchResultsPage(); - beforeAll(async (done) => { - await apis.admin.people.createUser({ username }); - const [fileP, fileInTrashP, siteP] = await Promise.all([ - apis.user.nodes.createFile(file), - apis.user.nodes.createFile(fileInTrash), - apis.user.sites.createSite(siteName) + beforeAll(async () => { + await adminApiActions.createUser({ username }); + + fileId = (await userApi.nodes.createFile(file)).entry.id; + fileInTrashId = (await userApi.nodes.createFile(fileInTrash)).entry.id; + siteId = (await userApi.sites.createSite(siteName)).entry.id; + + await userApi.nodes.deleteNodeById(fileInTrashId, false); + await userApi.favorites.addFavoriteById('file', fileId); + await userApi.shared.shareFileById(fileId); + + await Promise.all([ + userApi.favorites.waitForApi({ expect: 2 }), + userApi.search.waitForApi(username, { expect: 1 }), + userApi.shared.waitForApi({ expect: 1 }), + userApi.trashcan.waitForApi({ expect: 1 }) ]); - fileId = fileP.entry.id; - fileInTrashId = fileInTrashP.entry.id; - siteId = siteP.entry.id; - - await apis.user.nodes.deleteNodeById(fileInTrashId, false); - await apis.user.favorites.addFavoriteById('file', fileId); - await apis.user.shared.shareFileById(fileId); - - await apis.user.favorites.waitForApi({ expect: 2 }); - await apis.user.search.waitForApi(username, { expect: 1 }); - await apis.user.shared.waitForApi({ expect: 1 }); - await apis.user.trashcan.waitForApi({ expect: 1 }); - await loginPage.loginWith(username); - done(); }); - afterAll(async (done) => { + afterAll(async () => { await Promise.all([ - apis.user.nodes.deleteNodeById(fileId), - apis.user.sites.deleteSite(siteId), - apis.user.trashcan.emptyTrash() + userApi.nodes.deleteNodeById(fileId), + userApi.sites.deleteSite(siteId), + userApi.trashcan.emptyTrash() ]); - done(); }); it('page selector not displayed on Favorites - [C280112]', async () => { @@ -116,9 +116,8 @@ describe('Pagination on single page', () => { it('page selector not displayed on Search results - [C290124]', async () => { await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); await searchInput.searchFor(file); - await dataTable.waitForBody(); + await searchResultsPage.waitForResults(); expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); }); diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/suites/search/search-filters.test.ts new file mode 100644 index 000000000..66df49fac --- /dev/null +++ b/e2e/suites/search/search-filters.test.ts @@ -0,0 +1,635 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage, SearchResultsPage } from '../../pages/pages'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { Utils } from '../../utilities/utils'; +import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../configs'; +import * as moment from 'moment'; + +describe('Search filters', () => { + const random = Utils.random(); + + const user1 = `user1-${random}`; + const user2 = `user2-${random}`; + + const parent = `parent-${random}`; + let parentId: string; + + const site = `site-${Utils.random()}`; let docLibId; + + const fileJpgUser1 = { + name: `search-filters-file-1-${random}.jpg`, + source: FILES.jpgFile + }; + + const filePdfUser2 = { + name: `search-filters-file-2-${random}.pdf`, + title: 'search filters title', + description: 'search filters', + source: FILES.pdfFile + }; + + const expectedFileTypes = ['Adobe PDF Document (1)', 'JPEG Image (1)']; + const expectedCreators = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`]; + const expectedModifiers = [`${user1} ${user1} (1)`, `${user2} ${user2} (1)`]; + const expectedLocations = ['_REPOSITORY_ (1)', `${site} (1)`]; + + const apis = { + admin: new RepoClient(), + user1: new RepoClient(user1, user1), + user2: new RepoClient(user2, user2) + }; + + const loginPage = new LoginPage(); + const page = new SearchResultsPage(); + const { searchInput } = page.header; + const { dataTable, filters } = page; + + const sizeFilter = filters.size; + const fileTypeFilter = filters.fileType; + const createdDateFilter = filters.createdDate; + const creatorFilter = filters.creator; + const locationFilter = filters.location; + const modifierFilter = filters.modifier; + const modifiedDateFilter = filters.modifiedDate; + + beforeAll(async (done) => { + await apis.admin.people.createUser({ username: user1 }); + await apis.admin.people.createUser({ username: user2 }); + parentId = (await apis.user1.nodes.createFolder(parent)).entry.id; + await apis.user1.sites.createSite(site, SITE_VISIBILITY.PUBLIC); + await apis.user1.sites.addSiteMember(site, user2, SITE_ROLES.SITE_MANAGER.ROLE); + docLibId = await apis.admin.sites.getDocLibId(site); + + await apis.user1.nodes.setGranularPermission(parentId, true, user2, 'Collaborator'); + + await apis.user1.upload.uploadFileWithRename(fileJpgUser1.source, docLibId, fileJpgUser1.name); + await apis.user2.upload.uploadFileWithRename(filePdfUser2.source, parentId, filePdfUser2.name, filePdfUser2.title, filePdfUser2.description); + + await apis.user1.search.waitForNodes('search-filters', { expect: 2 }); + + await loginPage.loginWith(user1); + done(); + }); + + beforeEach(async (done) => { + await Utils.pressEscape(); + await page.clickPersonalFilesAndWait(); + + await searchInput.clickSearchButton(); + await searchInput.searchFor('search filters'); + await dataTable.waitForBody(); + done(); + }); + + afterAll(async (done) => { + await Promise.all([ + apis.user1.nodes.deleteNodeById(parentId), + apis.user1.sites.deleteSite(site) + ]); + done(); + }); + + it('Filters are displayed - [C279186]', async () => { + expect(await sizeFilter.isPanelDisplayed()).toBe(true, 'Size filter panel not displayed'); + expect(await createdDateFilter.isPanelDisplayed()).toBe(true, 'Created date filter panel not displayed'); + expect(await fileTypeFilter.isPanelDisplayed()).toBe(true, 'File type filter panel not displayed'); + expect(await creatorFilter.isPanelDisplayed()).toBe(true, 'Creator filter panel not displayed'); + expect(await modifierFilter.isPanelDisplayed()).toBe(true, 'Modifier filter panel not displayed'); + expect(await locationFilter.isPanelDisplayed()).toBe(true, 'Location filter panel not displayed'); + expect(await modifiedDateFilter.isPanelDisplayed()).toBe(true, 'Modified date filter panel not displayed'); + }); + + describe('Filter by Size', () => { + afterEach(async (done) => { + await sizeFilter.resetPanel(); + done(); + }); + + it('Expand / Collapse the Size filter panel - [C279197]', async () => { + expect(await sizeFilter.isPanelExpanded()).toBe(false, 'Size filter panel is expanded'); + + await sizeFilter.expandPanel(); + expect(await sizeFilter.isPanelExpanded()).toBe(true, 'Size filter panel not expanded'); + + const expectedSizes = ['Small', 'Medium', 'Large', 'Huge']; + expect(await sizeFilter.getFiltersValues()).toEqual(expectedSizes, 'Incorrect Size filters facets'); + expect(await sizeFilter.isClearButtonEnabled()).toBe(true, 'Size filter Clear button not enabled'); + + await sizeFilter.collapsePanel(); + expect(await sizeFilter.isPanelExpanded()).toBe(false, 'Size filter panel is expanded'); + }); + + it('Filter by Small - [C279199]', async () => { + await sizeFilter.expandPanel(); + await sizeFilter.checkSizeSmall(); + + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, `${fileJpgUser1.name} not in the list`); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, `${filePdfUser2.name} not in the list`); + }); + + it('Filter by Huge - [C279202]', async () => { + await sizeFilter.expandPanel(); + await sizeFilter.checkSizeHuge(); + + expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); + }); + + it('Filter by multiple size categories - [C279203]', async () => { + await sizeFilter.expandPanel(); + await sizeFilter.checkSizeSmall(); + await sizeFilter.checkSizeMedium(); + await sizeFilter.checkSizeLarge(); + + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, `${fileJpgUser1.name} not in the list`); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, `${filePdfUser2.name} not in the list`); + }); + + it('Clear the Size filter options - [C279198]', async () => { + await sizeFilter.expandPanel(); + await sizeFilter.checkSizeSmall(); + await sizeFilter.checkSizeMedium(); + expect(await sizeFilter.getFiltersCheckedValues()).toEqual(['Small', 'Medium'], 'Incorrect checked Size filters'); + + await sizeFilter.clickClearButton(); + expect(await sizeFilter.getFiltersCheckedValues()).toEqual([], 'Size filters not cleared'); + }); + }); + + describe('Filter by Created date', () => { + const yesterday = moment().subtract(1, 'day').format('DD-MMM-YY'); + const today = moment().format('DD-MMM-YY'); + const future = moment().add(1, 'month').format('DD-MMM-YY'); + + afterEach(async (done) => { + await createdDateFilter.resetPanel(); + done(); + }); + + it('Expand / Collapse the Created date filter panel - [C279211]', async () => { + expect(await createdDateFilter.isPanelExpanded()).toBe(false, 'Created date filter panel is expanded'); + + await createdDateFilter.expandPanel(); + expect(await createdDateFilter.isPanelExpanded()).toBe(true, 'Created date filter panel not expanded'); + + expect(await createdDateFilter.isClearButtonEnabled()).toBe(true, 'Created date CLEAR button not enabled'); + expect(await createdDateFilter.isApplyButtonEnabled()).toBe(false, 'Created date APPLY button not disabled'); + + await createdDateFilter.collapsePanel(); + expect(await createdDateFilter.isPanelExpanded()).toBe(false, 'Created date filter panel is expanded'); + }); + + it('Results are filtered by Created date - [C279217]', async () => { + await createdDateFilter.expandPanel(); + await createdDateFilter.enterFromDate(yesterday); + await createdDateFilter.enterToDate(yesterday); + + expect(await createdDateFilter.isApplyButtonEnabled()).toBe(true, 'Created date filter Apply button not enabled'); + + await createdDateFilter.clickApplyButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed'); + + await createdDateFilter.enterFromDate(yesterday); + await createdDateFilter.enterToDate(today); + + expect(await createdDateFilter.isApplyButtonEnabled()).toBe(true, 'Created date filter Apply button not enabled'); + + await createdDateFilter.clickApplyButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + }); + + it('Clear the Created date filter options - [C279216]', async () => { + await createdDateFilter.expandPanel(); + await createdDateFilter.enterFromDate(yesterday); + await createdDateFilter.enterToDate(yesterday); + await createdDateFilter.clickApplyButton(); + + expect(await createdDateFilter.getFromValue()).toContain(yesterday); + expect(await createdDateFilter.getToValue()).toContain(yesterday); + + await createdDateFilter.clickClearButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file is displayed'); + expect(await createdDateFilter.getFromValue()).toEqual('', 'From field not empty'); + expect(await createdDateFilter.getToValue()).toEqual('', 'To field not empty'); + }); + + it('From and To values are required - [C279212]', async () => { + await createdDateFilter.expandPanel(); + await createdDateFilter.enterFromDate(''); + await createdDateFilter.enterToDate(''); + + expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field'); + expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field'); + expect(await createdDateFilter.getFromError()).toEqual('Required value'); + expect(await createdDateFilter.getToError()).toEqual('Required value'); + }); + + it('Error message is displayed when entering an incorrect date format - [C279213]', async () => { + await createdDateFilter.expandPanel(); + await createdDateFilter.enterFromDate('03.31.2019'); + await createdDateFilter.enterToDate('invalid text'); + + expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field'); + expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field'); + expect(await createdDateFilter.getFromError()).toEqual(`Invalid date. The date must be in the format 'DD-MMM-YY'`); + expect(await createdDateFilter.getToError()).toEqual(`Invalid date. The date must be in the format 'DD-MMM-YY'`); + }); + + it('Error message is displayed when entering a date from the future - [C279214]', async () => { + await createdDateFilter.expandPanel(); + await createdDateFilter.enterFromDate(future); + await createdDateFilter.enterToDate(future); + + expect(await createdDateFilter.isFromErrorDisplayed()).toBe(true, 'Error missing for From field'); + expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field'); + expect(await createdDateFilter.getFromError()).toEqual('The date is beyond the maximum date.'); + expect(await createdDateFilter.getToError()).toEqual('The date is beyond the maximum date.'); + }); + + it('Error message is displayed when From value is bigger than To value - [C279215]', async () => { + await createdDateFilter.expandPanel(); + await createdDateFilter.enterFromDate(today); + await createdDateFilter.enterToDate(yesterday); + + expect(await createdDateFilter.isToErrorDisplayed()).toBe(true, 'Error missing for To field'); + expect(await createdDateFilter.getToError()).toEqual('No days selected.'); + }); + }); + + describe('Filter by File type', () => { + afterEach(async (done) => { + await filters.clickResetAllButton(); + done(); + }); + + it('Expand / Collapse the File type filter panel - [C279191]', async () => { + expect(await fileTypeFilter.isPanelExpanded()).toBe(true, 'File type filter panel not expanded'); + expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes, 'Incorrect File type filters facets'); + expect(await fileTypeFilter.isFilterCategoryInputDisplayed()).toBe(true, 'File type filter categories not displayed'); + + await fileTypeFilter.collapsePanel(); + expect(await fileTypeFilter.isPanelExpanded()).toBe(false, 'File type filter panel is expanded'); + }); + + it('Results are filtered by File type - [C279192]', async () => { + await fileTypeFilter.expandPanel(); + await fileTypeFilter.checkCategory('Adobe PDF Document'); + + expect(await fileTypeFilter.isClearButtonEnabled()).toBe(true, 'File type filter Clear button not enabled'); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed'); + expect(await page.getResultsChipsValues()).toEqual(['Adobe PDF Document']); + + await fileTypeFilter.checkCategory('JPEG Image'); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual(['Adobe PDF Document', 'JPEG Image']); + }); + + it('Clear the File type filter options - [C279193]', async () => { + await fileTypeFilter.expandPanel(); + await fileTypeFilter.checkCategory('Adobe PDF Document'); + + expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual(['Adobe PDF Document (1)']); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(false, 'JPG file is displayed'); + + await fileTypeFilter.clickClearButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await fileTypeFilter.getFiltersCheckedValues()).toEqual([], 'File types selection not cleared'); + }); + + it('Search for a specific file type - [C279195]', async () => { + await fileTypeFilter.expandPanel(); + expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes, 'Incorrect File type filters facets'); + await fileTypeFilter.filterCategoriesBy('PDF'); + expect(await fileTypeFilter.getFiltersValues()).toEqual(['Adobe PDF Document (1)'], 'Incorrect File type filters facets'); + }); + }); + + describe('Filter by Creator', () => { + afterEach(async (done) => { + await filters.clickResetAllButton(); + done(); + }); + + it('Expand / Collapse the Creator filter panel - [C279205]', async () => { + expect(await creatorFilter.isPanelExpanded()).toBe(true, 'Creator filter panel not expanded'); + + expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators, 'Incorrect Creator filters facets'); + expect(await creatorFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Creator filter categories not displayed'); + + await creatorFilter.collapsePanel(); + expect(await creatorFilter.isPanelExpanded()).toBe(false, 'Creator filter panel is expanded'); + }); + + it('Results are filtered by Creator - [C279206]', async () => { + await creatorFilter.expandPanel(); + await creatorFilter.checkCategory(user1); + + expect(await creatorFilter.isClearButtonEnabled()).toBe(true, 'Creator filter Clear button not enabled'); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`]); + + await creatorFilter.checkCategory(user2); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`, `${user2} ${user2}`]); + }); + + it('Clear the Creator filter options - [C279207]', async () => { + await creatorFilter.expandPanel(); + await creatorFilter.checkCategory(user1); + + expect(await creatorFilter.getFiltersCheckedValues()).toEqual([`${user1} ${user1} (1)`]); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + + await creatorFilter.clickClearButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await creatorFilter.getFiltersCheckedValues()).toEqual([], 'Creator selection not cleared'); + }); + + it('Search for a specific creator - [C279208]', async () => { + await creatorFilter.expandPanel(); + expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators, 'Incorrect Creator filters facets'); + await creatorFilter.filterCategoriesBy(user1); + expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`], 'Incorrect Creator filters facets'); + }); + }); + + describe('Filter by Modifier', () => { + afterEach(async (done) => { + await filters.clickResetAllButton(); + done(); + }); + + it('Expand / Collapse the Modifier filter panel - [C279224]', async () => { + expect(await modifierFilter.isPanelExpanded()).toBe(true, 'Modifier filter panel not expanded'); + + expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers, 'Incorrect Modifier filters facets'); + expect(await modifierFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Modifier filter categories not displayed'); + + await modifierFilter.collapsePanel(); + expect(await modifierFilter.isPanelExpanded()).toBe(false, 'Modifier filter panel is expanded'); + }); + + it('Results are filtered by Modifier - [C279225]', async () => { + await modifierFilter.expandPanel(); + await modifierFilter.checkCategory(user1); + + expect(await modifierFilter.isClearButtonEnabled()).toBe(true, 'Modifier filter Clear button not enabled'); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`]); + + await modifierFilter.checkCategory(user2); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([`${user1} ${user1}`, `${user2} ${user2}`]); + }); + + it('Clear the Modifier filter options - [C279226]', async () => { + await modifierFilter.expandPanel(); + await modifierFilter.checkCategory(user1); + + expect(await modifierFilter.getFiltersCheckedValues()).toEqual([`${user1} ${user1} (1)`]); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + + await modifierFilter.clickClearButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await modifierFilter.getFiltersCheckedValues()).toEqual([], 'Modifier selection not cleared'); + }); + + it('Search for a specific modifier - [C279227]', async () => { + await modifierFilter.expandPanel(); + expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers, 'Incorrect Modifier filters facets'); + await modifierFilter.filterCategoriesBy(user1); + expect(await modifierFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`], 'Incorrect Modifier filters facets'); + }); + }); + + describe('Filter by Location', () => { + afterEach(async (done) => { + await filters.clickResetAllButton(); + done(); + }); + + it('Expand / Collapse the Location filter panel - [C279230]', async () => { + expect(await locationFilter.isPanelExpanded()).toBe(true, 'Location filter panel not expanded'); + + expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations, 'Incorrect Location filters facets'); + expect(await locationFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Location filter categories not displayed'); + + await locationFilter.collapsePanel(); + expect(await locationFilter.isPanelExpanded()).toBe(false, 'Location filter panel is expanded'); + }); + + it('Results are filtered by Location - [C279231]', async () => { + await locationFilter.expandPanel(); + await locationFilter.checkCategory(site); + + expect(await locationFilter.isClearButtonEnabled()).toBe(true, 'Location filter Clear button not enabled'); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([site]); + + await locationFilter.checkCategory('_REPOSITORY_'); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([site, '_REPOSITORY_']); + }); + + it('Clear the Location filter options - [C279232]', async () => { + await locationFilter.expandPanel(); + await locationFilter.checkCategory(site); + + expect(await locationFilter.getFiltersCheckedValues()).toEqual([`${site} (1)`]); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + + await locationFilter.clickClearButton(); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await locationFilter.getFiltersCheckedValues()).toEqual([], 'Location selection not cleared'); + }); + + it('Search for a specific location - [C279233]', async () => { + await locationFilter.expandPanel(); + expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations, 'Incorrect Location filters facets'); + await locationFilter.filterCategoriesBy(site); + expect(await locationFilter.getFiltersValues()).toEqual([`${site} (1)`], 'Incorrect Location filters facets'); + }); + }); + + describe('Filter by Modified date', () => { + const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)']; + + afterEach(async (done) => { + await filters.clickResetAllButton(); + done(); + }); + + it('Expand / Collapse the Modified date filter panel - [C279219]', async () => { + expect(await modifiedDateFilter.isPanelExpanded()).toBe(true, 'Modified Date filter panel not expanded'); + + expect(await modifiedDateFilter.getFiltersValues()).toEqual(expectedDateFilters, 'Incorrect Modified Date filters facets'); + expect(await modifiedDateFilter.isFilterCategoryInputDisplayed()).toBe(true, 'Modified Date filter categories not displayed'); + + await modifiedDateFilter.collapsePanel(); + expect(await modifiedDateFilter.isPanelExpanded()).toBe(false, 'Modified Date filter panel is expanded'); + }); + + it('Results are filtered by Modified date - [C279221]', async () => { + await modifiedDateFilter.expandPanel(); + await modifiedDateFilter.checkCategory('Today'); + + expect(await modifiedDateFilter.isClearButtonEnabled()).toBe(true, 'Modified date filter Clear button not enabled'); + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual(['Today']); + + await modifiedDateFilter.checkCategory('This week'); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual(['Today', 'This week']); + }); + + it('Clear the Modified date filter options - [C279220]', async () => { + await modifiedDateFilter.expandPanel(); + await modifiedDateFilter.checkCategory('Today'); + await modifiedDateFilter.checkCategory('This week'); + await modifiedDateFilter.checkCategory('This month'); + await modifiedDateFilter.checkCategory('In the last 6 months'); + await modifiedDateFilter.checkCategory('This year'); + + expect(await modifiedDateFilter.getFiltersCheckedValues()).toEqual(expectedDateFilters, 'Incorrect checked Modified date filters'); + + await modifiedDateFilter.clickClearButton(); + expect(await modifiedDateFilter.getFiltersCheckedValues()).toEqual([], 'Modified date selection not cleared'); + }); + + it('Search for a specific modified date option - [C325006]', async () => { + await modifiedDateFilter.expandPanel(); + expect(await modifiedDateFilter.getFiltersValues()).toEqual(expectedDateFilters, 'Incorrect Modified date filters facets'); + await modifiedDateFilter.filterCategoriesBy('This'); + expect(await modifiedDateFilter.getFiltersValues()).toEqual(['This week (2)', 'This month (2)', 'This year (2)'], 'Incorrect Modified date filters facets'); + }); + }); + + describe('Multiple filters', () => { + afterEach(async (done) => { + await filters.clickResetAllButton(); + await sizeFilter.resetPanel(); + await createdDateFilter.resetPanel(); + done(); + }); + + it('Multiple filters can be applied - [C280051]', async () => { + await sizeFilter.expandPanel(); + await sizeFilter.checkSizeSmall(); + + await fileTypeFilter.expandPanel(); + await fileTypeFilter.checkCategory('JPEG Image'); + await creatorFilter.checkCategory(user1); + await locationFilter.checkCategory(site); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(false, 'PDF file is displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual(['JPEG Image', `${user1} ${user1}`, site]); + + await page.removeChip('JPEG Image'); + await page.removeChip(`${user1} ${user1}`); + await page.removeChip(site); + + expect(await dataTable.isItemPresent(filePdfUser2.name)).toBe(true, 'PDF file not displayed'); + expect(await dataTable.isItemPresent(fileJpgUser1.name)).toBe(true, 'JPG file not displayed'); + expect(await page.getResultsChipsValues()).toEqual([]); + }); + + it('Total results is updated correctly - [C280052]', async () => { + await fileTypeFilter.expandPanel(); + await fileTypeFilter.checkCategory('JPEG Image'); + await creatorFilter.checkCategory(user1); + + expect(await page.getResultsFoundText()).toEqual('1 result found'); + + await page.removeChip('JPEG Image'); + await page.removeChip(`${user1} ${user1}`); + + expect(await page.getResultsFoundText()).toEqual('2 results found'); + }); + + it('Pagination is correct when search results are filtered - [C279188]', async () => { + await fileTypeFilter.expandPanel(); + await fileTypeFilter.checkCategory('JPEG Image'); + await creatorFilter.checkCategory(user1); + + expect(await page.pagination.getRange()).toEqual('Showing 1-1 of 1'); + + await page.removeChip('JPEG Image'); + await page.removeChip(`${user1} ${user1}`); + + expect(await page.pagination.getRange()).toEqual('Showing 1-2 of 2'); + }); + + it('The filter facets display is updated when making a new query - [C308042]', async () => { + expect(await fileTypeFilter.getFiltersValues()).toEqual(expectedFileTypes); + expect(await creatorFilter.getFiltersValues()).toEqual(expectedCreators); + expect(await modifierFilter.getFiltersValues()).toEqual(expectedModifiers); + expect(await locationFilter.getFiltersValues()).toEqual(expectedLocations); + + await searchInput.clickSearchButton(); + await searchInput.searchFor(fileJpgUser1.name); + await dataTable.waitForBody(); + + expect(await fileTypeFilter.getFiltersValues()).toEqual(['JPEG Image (1)']); + expect(await creatorFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]); + expect(await modifierFilter.getFiltersValues()).toEqual([`${user1} ${user1} (1)`]); + expect(await locationFilter.getFiltersValues()).toEqual([`${site} (1)`]); + }); + }); +}); diff --git a/e2e/suites/search/search-input.test.ts b/e2e/suites/search/search-input.test.ts index ac57d4d98..0c41ce2c4 100644 --- a/e2e/suites/search/search-input.test.ts +++ b/e2e/suites/search/search-input.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -48,13 +48,13 @@ describe('Search input', () => { it('Search options are displayed when clicking in the search input - [C289848]', async () => { await searchInput.clickSearchButton(); - expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, '1. Search options not displayed'); - expect(await searchInput.isFilesOptionEnabled()).toBe(true, '2. Files option not enabled'); - expect(await searchInput.isFoldersOptionEnabled()).toBe(true, '3. Folders option not enabled'); - expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, '4. Libraries option not enabled'); - expect(await searchInput.isFilesOptionChecked()).toBe(false, '5. Files option is checked'); - expect(await searchInput.isFoldersOptionChecked()).toBe(false, '6. Folders option is checked'); - expect(await searchInput.isLibrariesOptionChecked()).toBe(false, '7. Libraries option is checked'); + expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, 'Search options not displayed'); + expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled'); + expect(await searchInput.isFoldersOptionEnabled()).toBe(true, 'Folders option not enabled'); + expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, 'Libraries option not enabled'); + expect(await searchInput.isFilesOptionChecked()).toBe(false, 'Files option is checked'); + expect(await searchInput.isFoldersOptionChecked()).toBe(false, 'Folders option is checked'); + expect(await searchInput.isLibrariesOptionChecked()).toBe(false, 'Libraries option is checked'); }); it('Search options are correctly enabled / disabled - [C289849]', async () => { diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/suites/search/search-results-files-folders.test.ts index db589b197..6f9cf33e2 100644 --- a/e2e/suites/search/search-results-files-folders.test.ts +++ b/e2e/suites/search/search-results-files-folders.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -60,19 +60,9 @@ describe('Search results - files and folders', () => { beforeAll(async done => { await apis.admin.people.createUser({ username }); - fileId = (await apis.user.nodes.createFile( - file, - '-my-', - fileTitle, - fileDescription - )).entry.id; + fileId = (await apis.user.nodes.createFile(file, '-my-', fileTitle, fileDescription)).entry.id; await apis.user.nodes.editNodeContent(fileId, 'edited by user'); - folderId = (await apis.user.nodes.createFolder( - folder, - '-my-', - folderTitle, - folderDescription - )).entry.id; + folderId = (await apis.user.nodes.createFolder(folder, '-my-', folderTitle, folderDescription)).entry.id; fileRussianId = (await apis.user.nodes.createFile(fileRussian)).entry.id; await apis.user.sites.createSite(site); @@ -83,6 +73,11 @@ describe('Search results - files and folders', () => { done(); }); + beforeEach(async done => { + await page.refresh(); + done(); + }); + afterAll(async done => { await Promise.all([ apis.user.nodes.deleteNodeById(fileId), @@ -93,20 +88,13 @@ describe('Search results - files and folders', () => { done(); }); - beforeEach(async done => { - await page.refresh(); - done(); - }); - it('Results page title - [C307002]', async () => { await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor('test-'); await dataTable.waitForBody(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual( - 'Search Results' - ); + expect(await page.breadcrumb.getCurrentItemName()).toEqual('Search Results'); }); it('File information - [C279183]', async () => { @@ -116,38 +104,17 @@ describe('Search results - files and folders', () => { await dataTable.waitForBody(); const fileEntry = await apis.user.nodes.getNodeById(fileId); - const modifiedDate = moment(fileEntry.entry.modifiedAt).format( - 'MMM D, YYYY, h:mm:ss A' - ); + const modifiedDate = moment(fileEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A'); const modifiedBy = fileEntry.entry.modifiedByUser.displayName; const size = fileEntry.entry.content.sizeInBytes; - expect(await dataTable.isItemPresent(file)).toBe( - true, - `${file} is not displayed` - ); - - expect(await dataTable.getRowCellsCount(file)).toEqual( - 2, - 'incorrect number of columns' - ); - - expect(await dataTable.getSearchResultLinesCount(file)).toEqual( - 4, - 'incorrect number of lines for search result' - ); - expect(await dataTable.getSearchResultNameAndTitle(file)).toBe( - `${file} ( ${fileTitle} )` - ); - expect(await dataTable.getSearchResultDescription(file)).toBe( - fileDescription - ); - expect(await dataTable.getSearchResultModified(file)).toBe( - `Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes` - ); - expect(await dataTable.getSearchResultLocation(file)).toMatch( - /Location:\s+Personal Files/ - ); + expect(await dataTable.isItemPresent(file)).toBe(true, `${file} is not displayed`); + expect(await dataTable.getRowCellsCount(file)).toEqual(2, 'incorrect number of columns'); + expect(await dataTable.getSearchResultLinesCount(file)).toEqual(4, 'incorrect number of lines for search result'); + expect(await dataTable.getSearchResultNameAndTitle(file)).toBe(`${file} ( ${fileTitle} )`); + expect(await dataTable.getSearchResultDescription(file)).toBe(fileDescription); + expect(await dataTable.getSearchResultModified(file)).toBe(`Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes`); + expect(await dataTable.getSearchResultLocation(file)).toMatch(/Location:\s+Personal Files/); }); it('Folder information - [C306867]', async () => { @@ -157,37 +124,16 @@ describe('Search results - files and folders', () => { await dataTable.waitForBody(); const folderEntry = await apis.user.nodes.getNodeById(folderId); - const modifiedDate = moment(folderEntry.entry.modifiedAt).format( - 'MMM D, YYYY, h:mm:ss A' - ); + const modifiedDate = moment(folderEntry.entry.modifiedAt).format('MMM D, YYYY, h:mm:ss A'); const modifiedBy = folderEntry.entry.modifiedByUser.displayName; - expect(await dataTable.isItemPresent(folder)).toBe( - true, - `${folder} is not displayed` - ); - - expect(await dataTable.getRowCellsCount(folder)).toEqual( - 2, - 'incorrect number of columns' - ); - - expect(await dataTable.getSearchResultLinesCount(folder)).toEqual( - 4, - 'incorrect number of lines for search result' - ); - expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe( - `${folder} ( ${folderTitle} )` - ); - expect(await dataTable.getSearchResultDescription(folder)).toBe( - folderDescription - ); - expect(await dataTable.getSearchResultModified(folder)).toBe( - `Modified: ${modifiedDate} by ${modifiedBy}` - ); - expect(await dataTable.getSearchResultLocation(folder)).toMatch( - /Location:\s+Personal Files/ - ); + expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not displayed`); + expect(await dataTable.getRowCellsCount(folder)).toEqual(2, 'incorrect number of columns'); + expect(await dataTable.getSearchResultLinesCount(folder)).toEqual(4, 'incorrect number of lines for search result'); + expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe(`${folder} ( ${folderTitle} )`); + expect(await dataTable.getSearchResultDescription(folder)).toBe(folderDescription); + expect(await dataTable.getSearchResultModified(folder)).toBe(`Modified: ${modifiedDate} by ${modifiedBy}`); + expect(await dataTable.getSearchResultLocation(folder)).toMatch(/Location:\s+Personal Files/); }); it('Search file with special characters - [C290029]', async () => { @@ -196,10 +142,7 @@ describe('Search results - files and folders', () => { await searchInput.searchFor(fileRussian); await dataTable.waitForBody(); - expect(await dataTable.isItemPresent(fileRussian)).toBe( - true, - `${fileRussian} is not displayed` - ); + expect(await dataTable.isItemPresent(fileRussian)).toBe(true, `${fileRussian} is not displayed`); }); it('Location column redirect - file in user Home - [C279177]', async () => { diff --git a/e2e/suites/search/search-results-general.test.ts b/e2e/suites/search/search-results-general.test.ts index cc21b4ef5..6876f525c 100644 --- a/e2e/suites/search/search-results-general.test.ts +++ b/e2e/suites/search/search-results-general.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts index a40ed84f7..6316009b2 100644 --- a/e2e/suites/search/search-results-libraries.test.ts +++ b/e2e/suites/search/search-results-libraries.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -63,7 +63,6 @@ describe('Search results - libraries', () => { const adminSite2 = `admin-site-${Utils.random()}`; const adminSite3 = `admin-site-${Utils.random()}`; const adminSite4 = `admin-site-${Utils.random()}`; - const adminPrivate = `admin-site-${Utils.random()}`; const apis = { @@ -173,7 +172,7 @@ describe('Search results - libraries', () => { await searchInput.searchFor(site1.name); await dataTable.waitForBody(); - const expectedColumns = [ 'Thumbnail', 'Name', 'My Role', 'Visibility' ]; + const expectedColumns = [ 'Name', 'My Role', 'Visibility' ]; const actualColumns = await dataTable.getColumnHeadersText(); expect(actualColumns).toEqual(expectedColumns); diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/suites/search/search-sorting.test.ts new file mode 100644 index 000000000..6b824f854 --- /dev/null +++ b/e2e/suites/search/search-sorting.test.ts @@ -0,0 +1,202 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { LoginPage, SearchResultsPage } from '../../pages/pages'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { Utils } from '../../utilities/utils'; +import { FILES } from '../../configs'; + +describe('Search sorting', () => { + const random = Utils.random(); + + const user1 = `user1-${random}`; + const user2 = `user2-${random}`; + + const parent = `parent-${random}`; + let parentId: string; + + const fileJpg = { + name: `search-sort-file-1-${random}.jpg`, + source: FILES.jpgFile + }; + + const filePdf = { + name: `search-sort-file-2-${random}.pdf`, + title: 'search sort title', + description: 'search sort', + source: FILES.pdfFile + }; + + const apis = { + admin: new RepoClient(), + user1: new RepoClient(user1, user1), + user2: new RepoClient(user2, user2) + }; + + const loginPage = new LoginPage(); + const page = new SearchResultsPage(); + const { searchInput } = page.header; + const { dataTable } = page; + + beforeAll(async (done) => { + await apis.admin.people.createUser({ username: user1 }); + await apis.admin.people.createUser({ username: user2 }); + parentId = (await apis.user1.nodes.createFolder(parent)).entry.id; + + await apis.user1.nodes.setGranularPermission(parentId, true, user2, 'Collaborator'); + + await apis.user1.upload.uploadFileWithRename(fileJpg.source, parentId, fileJpg.name); + await apis.user2.upload.uploadFileWithRename(filePdf.source, parentId, filePdf.name, filePdf.title, filePdf.description); + + await apis.user1.search.waitForNodes('search-sort', { expect: 2 }); + + await loginPage.loginWith(user1); + done(); + }); + + beforeEach(async (done) => { + await Utils.pressEscape(); + await page.clickPersonalFilesAndWait(); + + await searchInput.clickSearchButton(); + await searchInput.searchFor('search sort'); + await dataTable.waitForBody(); + done(); + }); + + afterAll(async () => { + await apis.user1.nodes.deleteNodeById(parentId); + }); + + it('Sorting options are displayed - [C277722]', async () => { + expect(await page.sortingPicker.isSortOrderButtonDisplayed()).toBe(true, 'Sort order button not displayed'); + expect(await page.sortingPicker.isSortByOptionDisplayed()).toBe(true, 'Sort options not displayed'); + expect(await page.sortingPicker.getSortOrder()).toBe('DESC', 'Incorrect default sort order'); + expect(await page.sortingPicker.getSelectedSortByOption()).toBe('Relevance', 'Incorrect selected sort option'); + + await page.sortingPicker.clickSortByDropdown(); + + const expectedOptions = [ 'Relevance', 'Filename', 'Title', 'Modified date', 'Modifier', 'Created date', 'Size', 'Type' ]; + expect(await page.sortingPicker.getSortByOptionsList()).toEqual(expectedOptions, 'Incorrect sort options list'); + }); + + it('Sort by Name - [C277728]', async () => { + await page.sortingPicker.sortByName(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + + await page.sortingPicker.sortByName(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + }); + + it('Sort by Type - [C277740]', async () => { + await page.sortingPicker.sortByType(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + + await page.sortingPicker.sortByType(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + }); + + it('Sort by Size - [C277738]', async () => { + await page.sortingPicker.sortBySize(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + + await page.sortingPicker.sortBySize(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + }); + + it('Sort by Created date - [C277734]', async () => { + await page.sortingPicker.sortByCreatedDate(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + + await page.sortingPicker.sortByCreatedDate(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + }); + + it('Sort by Modified date - [C277736]', async () => { + await page.sortingPicker.sortByModifiedDate(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + + await page.sortingPicker.sortByModifiedDate(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + }); + + it('Sort by Relevance - [C277727]', async () => { + await page.sortingPicker.sortByRelevance(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + + await page.sortingPicker.sortByRelevance(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + }); + + it('Sort by Modifier - [C277732]', async () => { + await page.sortingPicker.sortByModifier(); + await page.sortingPicker.setSortOrderASC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); + + await page.sortingPicker.sortByModifier(); + await page.sortingPicker.setSortOrderDESC(); + + expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); + expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); + }); +}); diff --git a/e2e/suites/viewer/viewer-actions.test.ts b/e2e/suites/viewer/viewer-actions.test.ts index f295917a1..0c9801403 100755 --- a/e2e/suites/viewer/viewer-actions.test.ts +++ b/e2e/suites/viewer/viewer-actions.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -28,7 +28,7 @@ import { FILES } from '../../configs'; import { RepoClient } from '../../utilities/repo-client/repo-client'; import { Utils } from '../../utilities/utils'; import { Viewer } from '../../components/viewer/viewer'; -import { CopyMoveDialog } from './../../components/dialog/copy-move-dialog'; +import { ContentNodeSelectorDialog } from './../../components/dialog/content-node-selector-dialog'; import { ShareDialog } from './../../components/dialog/share-dialog'; import { ManageVersionsDialog } from './../../components/dialog/manage-versions-dialog'; import { UploadNewVersionDialog } from './../../components/dialog/upload-new-version-dialog'; @@ -51,7 +51,7 @@ describe('Viewer actions', () => { const dataTable = page.dataTable; const viewer = new Viewer(); const { toolbar } = viewer; - const copyMoveDialog = new CopyMoveDialog(); + const copyMoveDialog = new ContentNodeSelectorDialog(); const shareDialog = new ShareDialog(); const manageVersionsDialog = new ManageVersionsDialog(); const uploadNewVersionDialog = new UploadNewVersionDialog(); @@ -74,6 +74,7 @@ describe('Viewer actions', () => { const fileForEditOffline = `file1-${Utils.random()}.docx`; let fileForEditOfflineId; const fileForCancelEditing = `file2-${Utils.random()}.docx`; let fileForCancelEditingId; const fileForUploadNewVersion = `file3-${Utils.random()}.docx`; let fileForUploadNewVersionId; + const fileForUploadNewVersion2 = `file4-${Utils.random()}.docx`; let fileForUploadNewVersionId2; beforeAll(async (done) => { parentId = (await apis.user.nodes.createFolder(parent)).entry.id; @@ -88,9 +89,11 @@ describe('Viewer actions', () => { fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id; fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id; fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id; + fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id; await apis.user.nodes.lockFile(fileForCancelEditingId); await apis.user.nodes.lockFile(fileForUploadNewVersionId); + await apis.user.nodes.lockFile(fileForUploadNewVersionId2); await loginPage.loginWith(username); @@ -221,6 +224,25 @@ describe('Viewer actions', () => { expect(await apis.user.nodes.getFileVersionLabel(filePersonalFilesId)).toEqual('2.0', 'File has incorrect version label'); }); + it('Upload new version action when node is locked - [MNT-21058]', async () => { + await dataTable.doubleClickOnRowByName(fileForUploadNewVersion2); + await viewer.waitForViewerToOpen(); + + await toolbar.openMoreMenu(); + expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `'Cancel Editing' button should be shown`); + expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `'Edit Offline' shouldn't be shown`); + + await toolbar.menu.clickMenuItem('Upload New Version'); + await Utils.uploadFileNewVersion(docxFile); + await page.waitForDialog(); + + await uploadNewVersionDialog.clickUpload(); + + await toolbar.openMoreMenu(); + expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`); + expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `'Edit Offline' should be shown`); + }); + it('Full screen action - [C279282]', async () => { await dataTable.doubleClickOnRowByName(docxPersonalFiles); await viewer.waitForViewerToOpen(); diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/suites/viewer/viewer-general.test.ts index 15bcb6f2f..77da91905 100755 --- a/e2e/suites/viewer/viewer-general.test.ts +++ b/e2e/suites/viewer/viewer-general.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/suites/viewer/viewer-protected-file.test.ts b/e2e/suites/viewer/viewer-protected-file.test.ts index b6ecebd46..a7e1863ac 100755 --- a/e2e/suites/viewer/viewer-protected-file.test.ts +++ b/e2e/suites/viewer/viewer-protected-file.test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -48,16 +48,15 @@ describe('Viewer - password protected file', () => { const viewer = new Viewer(); const passwordDialog = new PasswordDialog(); - beforeAll(async (done) => { + beforeAll(async () => { await apis.admin.people.createUser({ username }); parentId = (await apis.user.nodes.createFolder(parent)).entry.id; await apis.user.upload.uploadFile(protectedFile.name, parentId); await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + beforeEach(async () => { await page.header.expandSideNav(); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(parent); @@ -65,20 +64,15 @@ describe('Viewer - password protected file', () => { await dataTable.doubleClickOnRowByName(protectedFile.name); await viewer.waitForViewerToOpen(); await page.waitForDialog(); - done(); }); - afterEach(async (done) => { - if (await passwordDialog.isDialogOpen()) { - await passwordDialog.clickClose(); - } + afterEach(async () => { + await page.closeOpenDialogs(); await Utils.pressEscape(); - done(); }); - afterAll(async (done) => { + afterAll(async () => { await apis.user.nodes.deleteNodeById(parentId); - done(); }); it('Password dialog appears when opening a protected file - [C268958]', async () => { diff --git a/e2e/utilities/admin-actions.ts b/e2e/utilities/admin-actions.ts new file mode 100755 index 000000000..980c59825 --- /dev/null +++ b/e2e/utilities/admin-actions.ts @@ -0,0 +1,142 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { RepoClient, NodeContentTree } from './repo-client/repo-client'; +import { PersonEntry, NodeEntry } from '@alfresco/js-api'; +import { PersonModel } from './repo-client/apis/people/people-api-models'; + +import { SitesApi } from './repo-client/apis/sites/sites-api'; +import { UploadApi } from './repo-client/apis/upload/upload-api'; +import { NodesApi } from './repo-client/apis/nodes/nodes-api'; +import { FavoritesApi } from './repo-client/apis/favorites/favorites-api'; +import { SearchApi } from './repo-client/apis/search/search-api'; + +export class AdminActions { + private adminApi: RepoClient; + + constructor() { + this.adminApi = new RepoClient(); + } + + sites: SitesApi = new SitesApi(); + upload: UploadApi = new UploadApi(); + nodes: NodesApi = new NodesApi(); + favorites: FavoritesApi = new FavoritesApi(); + search: SearchApi = new SearchApi(); + + async getDataDictionaryId(): Promise { + return await this.adminApi.nodes.getNodeIdFromParent('Data Dictionary', '-root-'); + } + + async getNodeTemplatesFolderId(): Promise { + return await this.adminApi.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId()); + } + + async getSpaceTemplatesFolderId(): Promise { + return await this.adminApi.nodes.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId()); + } + + async createUser(user: PersonModel): Promise { + return await this.adminApi.people.createUser(user); + } + + async createNodeTemplate(name: string, title: string = '', description: string = '', author: string = ''): Promise { + const templatesRootFolderId: string = await this.getNodeTemplatesFolderId(); + + return await this.adminApi.nodes.createFile(name, templatesRootFolderId, title, description, author); + } + + async createNodeTemplatesHierarchy(hierarchy: NodeContentTree): Promise { + return await this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`); + } + + async createSpaceTemplate(name: string, title: string = '', description: string = ''): Promise { + const templatesRootFolderId: string = await this.getSpaceTemplatesFolderId(); + + return await this.adminApi.nodes.createFolder(name, templatesRootFolderId, title, description); + } + + async createSpaceTemplatesHierarchy(hierarchy: NodeContentTree): Promise { + return await this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`); + } + + async removeUserAccessOnNodeTemplate(nodeName: string): Promise { + const templatesRootFolderId = await this.getNodeTemplatesFolderId(); + const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId); + + return await this.adminApi.nodes.setInheritPermissions(nodeId, false); + } + + async removeUserAccessOnSpaceTemplate(nodeName: string): Promise { + const templatesRootFolderId = await this.getSpaceTemplatesFolderId(); + const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId); + + return await this.adminApi.nodes.setInheritPermissions(nodeId, false); + } + + async cleanupNodeTemplatesFolder(): Promise { + return await this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId()); + } + + async cleanupSpaceTemplatesFolder(): Promise { + const spaceTemplatesNodeId = await this.getSpaceTemplatesFolderId(); + + // folder links are deleted automatically when original folder is deleted + // Software Engineering Project is the default folder template coming from ACS, should not be deleted + const nodesToDelete = (await this.adminApi.nodes.getNodeChildren(spaceTemplatesNodeId)).list.entries + .filter(node => (node.entry.nodeType !== 'app:folderlink') && (node.entry.name !== 'Software Engineering Project')) + .map(node => node.entry.id); + return await this.adminApi.nodes.deleteNodesById(nodesToDelete); + } + + async createLinkToFileId(originalFileId: string, destinationParentId: string): Promise { + return await this.adminApi.nodes.createFileLink(originalFileId, destinationParentId); + } + + async createLinkToFileName(originalFileName: string, originalFileParentId: string, destinationParentId?: string): Promise { + if (!destinationParentId) { + destinationParentId = originalFileParentId + }; + + const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFileName, originalFileParentId); + + return await this.createLinkToFileId(nodeId, destinationParentId); + } + + async createLinkToFolderId(originalFolderId: string, destinationParentId: string): Promise { + return await this.adminApi.nodes.createFolderLink(originalFolderId, destinationParentId); + } + + async createLinkToFolderName(originalFolderName: string, originalFolderParentId: string, destinationParentId?: string): Promise { + if (!destinationParentId) { + destinationParentId = originalFolderParentId + }; + + const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFolderName, originalFolderParentId); + + return await this.createLinkToFolderId(nodeId, destinationParentId); + } + +} diff --git a/e2e/utilities/browser-utils.ts b/e2e/utilities/browser-utils.ts index 3f5c0cde4..3b56c4bf6 100644 --- a/e2e/utilities/browser-utils.ts +++ b/e2e/utilities/browser-utils.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/authentication/authentication-api.ts b/e2e/utilities/repo-client/apis/authentication/authentication-api.ts index b5d103095..f0caf9ce0 100755 --- a/e2e/utilities/repo-client/apis/authentication/authentication-api.ts +++ b/e2e/utilities/repo-client/apis/authentication/authentication-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/comments/comments-api.ts b/e2e/utilities/repo-client/apis/comments/comments-api.ts index 09f3fbf4c..cd320ba6d 100755 --- a/e2e/utilities/repo-client/apis/comments/comments-api.ts +++ b/e2e/utilities/repo-client/apis/comments/comments-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/favorites/favorites-api.ts b/e2e/utilities/repo-client/apis/favorites/favorites-api.ts index 71b41b3b5..3c66f6abd 100755 --- a/e2e/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/e2e/utilities/repo-client/apis/favorites/favorites-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/nodes/node-body-create.ts b/e2e/utilities/repo-client/apis/nodes/node-body-create.ts index c22d1f1fe..10dd0842a 100755 --- a/e2e/utilities/repo-client/apis/nodes/node-body-create.ts +++ b/e2e/utilities/repo-client/apis/nodes/node-body-create.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/nodes/node-content-tree.ts b/e2e/utilities/repo-client/apis/nodes/node-content-tree.ts index 1a99300d7..ae66e795b 100755 --- a/e2e/utilities/repo-client/apis/nodes/node-content-tree.ts +++ b/e2e/utilities/repo-client/apis/nodes/node-content-tree.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/nodes/nodes-api.ts b/e2e/utilities/repo-client/apis/nodes/nodes-api.ts index e7535ee36..4db0b18c9 100755 --- a/e2e/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/e2e/utilities/repo-client/apis/nodes/nodes-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -36,7 +36,7 @@ export class NodesApi extends RepoApi { super(username, password); } - async getNodeByPath(relativePath: string = '/'): Promise { + async getNodeByPath(relativePath: string = '/'): Promise { try { await this.apiAuth(); return await this.nodesApi.getNode('-my-', { relativePath }); @@ -46,7 +46,7 @@ export class NodesApi extends RepoApi { } } - async getNodeById(id: string): Promise { + async getNodeById(id: string): Promise { try { await this.apiAuth(); const node = await this.nodesApi.getNode(id); @@ -77,7 +77,17 @@ export class NodesApi extends RepoApi { } } - async getNodeProperty(nodeId: string, property: string): Promise { + async getNodeTitle(name: string, parentId: string): Promise { + try { + const children = (await this.getNodeChildren(parentId)).list.entries; + return children.find(elem => elem.entry.name === name).entry.properties['cm:title'] || ''; + } catch (error) { + this.handleError(`${this.constructor.name} ${this.getNodeTitle.name}`, error); + return ''; + } + } + + async getNodeProperty(nodeId: string, property: string): Promise { try { const node = await this.getNodeById(nodeId); return (node.entry.properties && node.entry.properties[property]) || ''; @@ -169,17 +179,15 @@ export class NodesApi extends RepoApi { async deleteNodesById(ids: string[], permanent: boolean = true): Promise { try { - await ids.reduce(async (previous, current) => { - await previous; - const req = await this.deleteNodeById(current, permanent); - return req; - }, Promise.resolve()); + for (const id of ids) { + await this.deleteNodeById(id, permanent); + } } catch (error) { this.handleError(`${this.constructor.name} ${this.deleteNodesById.name}`, error); } } - async getNodeChildren(nodeId: string): Promise { + async getNodeChildren(nodeId: string): Promise { try { const opts = { include: [ 'properties' ] @@ -192,17 +200,24 @@ export class NodesApi extends RepoApi { } } - async deleteNodeChildren(parentId: string): Promise { + async deleteNodeChildren(parentId: string, exceptNodesNamed?: string[]): Promise { try { const listEntries = (await this.getNodeChildren(parentId)).list.entries; - const nodeIds = listEntries.map(entries => entries.entry.id); + let nodeIds: string[]; + if (exceptNodesNamed) { + nodeIds = listEntries + .filter(entries => !exceptNodesNamed.includes(entries.entry.name)) + .map(entries => entries.entry.id); + } else { + nodeIds = listEntries.map(entries => entries.entry.id); + } await this.deleteNodesById(nodeIds); } catch (error) { this.handleError(`${this.constructor.name} ${this.deleteNodeChildren.name}`, error); } } - async createImageNode(name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise { + async createImageNode(name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise { const imageProps = { 'exif:pixelXDimension': 1000, 'exif:pixelYDimension': 1200 @@ -211,10 +226,11 @@ export class NodesApi extends RepoApi { return await this.createNode('cm:content', name, parentId, title, description, imageProps); } catch (error) { this.handleError(`${this.constructor.name} ${this.createImageNode.name}`, error); + return null; } } - async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, author: string = '', majorVersion: boolean = true): Promise { + async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, author: string = '', majorVersion: boolean = true, aspectNames: string[] = null): Promise { const nodeBody = { name, nodeType, @@ -223,7 +239,7 @@ export class NodesApi extends RepoApi { 'cm:description': description, 'cm:author': author }, - aspectNames: ['cm:versionable'] // workaround for REPO-4772 + aspectNames }; if (imageProps) { nodeBody.properties = Object.assign(nodeBody.properties, imageProps); @@ -234,34 +250,41 @@ export class NodesApi extends RepoApi { return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion }); } catch (error) { this.handleError(`${this.constructor.name} ${this.createNode.name}`, error); + return null; } } - async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '', majorVersion: boolean = true): Promise { + async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '', majorVersion: boolean = true, aspectNames: string[] = null): Promise { + if (!aspectNames) { + aspectNames = ['cm:versionable'] // workaround for REPO-4772 + } try { - return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion); + return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion, aspectNames); } catch (error) { this.handleError(`${this.constructor.name} ${this.createFile.name}`, error); + return null; } } - async createImage(name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise { + async createImage(name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise { try { return await this.createImageNode(name, parentId, title, description); } catch (error) { this.handleError(`${this.constructor.name} ${this.createImage.name}`, error); + return null; } } - async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = ''): Promise { + async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '', aspectNames: string[] = null): Promise { try { - return await this.createNode('cm:folder', name, parentId, title, description, null, author); + return await this.createNode('cm:folder', name, parentId, title, description, null, author, null, aspectNames); } catch (error) { this.handleError(`${this.constructor.name} ${this.createFolder.name}`, error); + return null; } } - async createChildren(data: NodeBodyCreate[]): Promise { + async createChildren(data: NodeBodyCreate[]): Promise { try { await this.apiAuth(); return await this.nodesApi.createNode('-my-', data); @@ -270,7 +293,7 @@ export class NodesApi extends RepoApi { } } - async createContent(content: NodeContentTree, relativePath: string = '/'): Promise { + async createContent(content: NodeContentTree, relativePath: string = '/'): Promise { try { return await this.createChildren(flattenNodeContentTree(content, relativePath)); } catch (error) { @@ -278,7 +301,7 @@ export class NodesApi extends RepoApi { } } - async createFolders(names: string[], relativePath: string = '/'): Promise { + async createFolders(names: string[], relativePath: string = '/'): Promise { try { return await this.createContent({ folders: names }, relativePath); } catch (error) { @@ -286,7 +309,7 @@ export class NodesApi extends RepoApi { } } - async createFiles(names: string[], relativePath: string = '/'): Promise { + async createFiles(names: string[], relativePath: string = '/'): Promise { try { return await this.createContent({ files: names }, relativePath); } catch (error) { @@ -294,6 +317,61 @@ export class NodesApi extends RepoApi { } } + async addAspects(nodeId: string, aspectNames: string[]): Promise { + try { + await this.apiAuth(); + return this.nodesApi.updateNode(nodeId, { aspectNames }); + } catch (error) { + this.handleError(`${this.constructor.name} ${this.addAspects.name}`, error); + return null; + } + } + + async createFileLink(originalNodeId: string, destinationId: string): Promise { + const name = (await this.getNodeById(originalNodeId)).entry.name; + const nodeBody = { + name: `Link to ${name}.url`, + nodeType: 'app:filelink', + properties: { + 'cm:destination': originalNodeId + } + } + + try { + await this.apiAuth(); + const link = await this.nodesApi.createNode(destinationId, nodeBody); + await this.addAspects(originalNodeId, ['app:linked']); + return link; + } catch (error) { + this.handleError(`${this.constructor.name} ${this.createFileLink.name}`, error); + return null; + } + } + + async createFolderLink(originalNodeId: string, destinationId: string): Promise { + const name = (await this.getNodeById(originalNodeId)).entry.name; + const nodeBody = { + name: `Link to ${name}.url`, + nodeType: 'app:folderlink', + properties: { + 'cm:title': `Link to ${name}.url`, + 'cm:destination': originalNodeId, + 'cm:description': `Link to ${name}.url`, + 'app:icon': 'space-icon-link' + } + } + + try { + await this.apiAuth(); + const link = await this.nodesApi.createNode(destinationId, nodeBody); + await this.addAspects(originalNodeId, ['app:linked']); + return link; + } catch (error) { + this.handleError(`${this.constructor.name} ${this.createFolderLink.name}`, error); + return null; + } + } + // node content async getNodeContent(nodeId: string): Promise { try { @@ -325,6 +403,22 @@ export class NodesApi extends RepoApi { } // node permissions + async setInheritPermissions(nodeId: string, inheritPermissions: boolean): Promise { + const data = { + permissions: { + isInheritanceEnabled: inheritPermissions + } + }; + + try { + await this.apiAuth(); + return await this.nodesApi.updateNode(nodeId, data); + } catch (error) { + this.handleError(`${this.constructor.name} ${this.setGranularPermission.name}`, error); + return null; + } + } + async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string): Promise { const data = { permissions: { @@ -355,7 +449,7 @@ export class NodesApi extends RepoApi { try { await this.apiAuth(); - return await this.nodesApi.lockNode(nodeId, data ); + return await this.nodesApi.lockNode(nodeId, data); } catch (error) { this.handleError(`${this.constructor.name} ${this.lockFile.name}`, error); return null; @@ -372,7 +466,7 @@ export class NodesApi extends RepoApi { } } - async getLockType(nodeId: string): Promise { + async getLockType(nodeId: string): Promise { try { const lockType = await this.getNodeProperty(nodeId, 'cm:lockType'); return lockType || ''; @@ -382,7 +476,7 @@ export class NodesApi extends RepoApi { } } - async getLockOwner(nodeId: string): Promise { + async getLockOwner(nodeId: string): Promise { try { const lockOwner = await this.getNodeProperty(nodeId, 'cm:lockOwner'); return lockOwner || ''; diff --git a/e2e/utilities/repo-client/apis/people/people-api-models.ts b/e2e/utilities/repo-client/apis/people/people-api-models.ts index 153d62e14..04d0511e4 100755 --- a/e2e/utilities/repo-client/apis/people/people-api-models.ts +++ b/e2e/utilities/repo-client/apis/people/people-api-models.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/people/people-api.ts b/e2e/utilities/repo-client/apis/people/people-api.ts index 188e08dbd..61ac04bb5 100755 --- a/e2e/utilities/repo-client/apis/people/people-api.ts +++ b/e2e/utilities/repo-client/apis/people/people-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/queries/queries-api.ts b/e2e/utilities/repo-client/apis/queries/queries-api.ts index e1641701f..12d487c0e 100755 --- a/e2e/utilities/repo-client/apis/queries/queries-api.ts +++ b/e2e/utilities/repo-client/apis/queries/queries-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/repo-api.ts b/e2e/utilities/repo-client/apis/repo-api.ts index ec9cdc08f..39b8c8c01 100644 --- a/e2e/utilities/repo-client/apis/repo-api.ts +++ b/e2e/utilities/repo-client/apis/repo-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/search/search-api.ts b/e2e/utilities/repo-client/apis/search/search-api.ts index b2cf7c2ac..4b18a406c 100755 --- a/e2e/utilities/repo-client/apis/search/search-api.ts +++ b/e2e/utilities/repo-client/apis/search/search-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts b/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts index b43cc2a4b..3c29020ad 100755 --- a/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts +++ b/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/sites/sites-api.ts b/e2e/utilities/repo-client/apis/sites/sites-api.ts index 13f4b915b..0fba767aa 100755 --- a/e2e/utilities/repo-client/apis/sites/sites-api.ts +++ b/e2e/utilities/repo-client/apis/sites/sites-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -24,8 +24,8 @@ */ import { RepoApi } from '../repo-api'; -import { SiteBody, SiteMemberRoleBody, SiteMemberBody, SiteEntry, SiteMembershipRequestEntry, SitesApi as AdfSiteApi } from '@alfresco/js-api'; -import { SITE_VISIBILITY } from '../../../../configs'; +import { SiteBody, SiteMemberRoleBody, SiteMemberBody, SiteEntry, SiteMembershipRequestEntry, SitesApi as AdfSiteApi, SiteMemberEntry } from '@alfresco/js-api'; +import { SITE_VISIBILITY, SITE_ROLES } from '../../../../configs'; import { Utils } from '../../../../utilities/utils'; export class SitesApi extends RepoApi { @@ -112,7 +112,15 @@ export class SitesApi extends RepoApi { } } - async createSites(titles: string[], visibility?: string) { + async createSitePrivate(title: string, description?: string, siteId?: string): Promise { + return this.createSite(title, SITE_VISIBILITY.PRIVATE, description, siteId); + } + + async createSiteModerated(title: string, description?: string, siteId?: string): Promise { + return this.createSite(title, SITE_VISIBILITY.MODERATED, description, siteId); + } + + async createSites(titles: string[], visibility?: string): Promise { try { return titles.reduce(async (previous: any, current: any) => { await previous; @@ -123,6 +131,10 @@ export class SitesApi extends RepoApi { } } + async createSitesPrivate(siteNames: string[]): Promise { + return this.createSites(siteNames, SITE_VISIBILITY.PRIVATE) + } + async deleteSite(siteId: string, permanent: boolean = true) { try { await this.apiAuth(); @@ -185,6 +197,22 @@ export class SitesApi extends RepoApi { } } + async addSiteConsumer(siteId: string, userId: string): Promise { + return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_CONSUMER.ROLE); + } + + async addSiteContributor(siteId: string, userId: string): Promise { + return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_CONTRIBUTOR.ROLE); + } + + async addSiteCollaborator(siteId: string, userId: string): Promise { + return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_COLLABORATOR.ROLE); + } + + async addSiteManager(siteId: string, userId: string): Promise { + return this.addSiteMember(siteId, userId, SITE_ROLES.SITE_MANAGER.ROLE); + } + async deleteSiteMember(siteId: string, userId: string) { try { await this.apiAuth(); diff --git a/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts b/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts index cabace88f..72316fbcc 100644 --- a/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts +++ b/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/apis/upload/upload-api.ts b/e2e/utilities/repo-client/apis/upload/upload-api.ts index 2e9bcaea8..7d3997f35 100644 --- a/e2e/utilities/repo-client/apis/upload/upload-api.ts +++ b/e2e/utilities/repo-client/apis/upload/upload-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -51,8 +51,15 @@ export class UploadApi extends RepoApi { } } - async uploadFileWithRename(fileName: string, parentFolderId: string = '-my-', newName: string) { + async uploadFileWithRename(fileName: string, parentId: string = '-my-', newName: string, title: string = '', description: string = '') { const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`); + const nodeProps = { + properties: { + 'cm:title': title, + 'cm:description': description + } + }; + const opts = { name: newName, nodeType: 'cm:content' @@ -60,7 +67,7 @@ export class UploadApi extends RepoApi { try { await this.apiAuth(); - return await this.upload.uploadFile(file, '', parentFolderId, null, opts); + return await this.upload.uploadFile(file, '', parentId, nodeProps, opts); } catch (error) { this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error); } diff --git a/e2e/utilities/repo-client/repo-client-models.ts b/e2e/utilities/repo-client/repo-client-models.ts index 4df714dbc..54cc3e751 100755 --- a/e2e/utilities/repo-client/repo-client-models.ts +++ b/e2e/utilities/repo-client/repo-client-models.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/e2e/utilities/repo-client/repo-client.ts b/e2e/utilities/repo-client/repo-client.ts index bf0176ef7..da47aeb8e 100755 --- a/e2e/utilities/repo-client/repo-client.ts +++ b/e2e/utilities/repo-client/repo-client.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -48,7 +48,7 @@ export class RepoClient { return { username, password }; } - get people () { + get people() { return new PeopleApi(this.auth.username, this.auth.password); } diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts index 886b57507..78c8a3abd 100755 --- a/e2e/utilities/utils.ts +++ b/e2e/utilities/utils.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { browser, protractor, promise, ElementFinder, ExpectedConditions as EC, by } from 'protractor'; +import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging } from 'protractor'; import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH, EXTENSIBILITY_CONFIGS } from '../configs'; const path = require('path'); @@ -41,35 +41,35 @@ export class Utils { lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live'; // generate a random value - static random() { + static random(): string { return Math.random().toString(36).substring(5, 10).toLowerCase(); } // local storage - static clearLocalStorage(): promise.Promise { - return browser.executeScript('window.localStorage.clear();'); + static async clearLocalStorage(): Promise { + await browser.executeScript('window.localStorage.clear();'); } // session storage - static clearSessionStorage(): promise.Promise { - return browser.executeScript('window.sessionStorage.clear();'); + static async clearSessionStorage(): Promise { + await browser.executeScript('window.sessionStorage.clear();'); } - static getSessionStorage() { - return browser.executeScript('return window.sessionStorage.getItem("app.extension.config");'); + static async getSessionStorage(): Promise { + return await browser.executeScript('return window.sessionStorage.getItem("app.extension.config");'); } - static setSessionStorageFromConfig(configFileName: string) { + static async setSessionStorageFromConfig(configFileName: string): Promise { const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`; const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' })); - return browser.executeScript(`window.sessionStorage.setItem('app.extension.config', ${fileContent});`); + await browser.executeScript(`window.sessionStorage.setItem('app.extension.config', ${fileContent});`); } - static resetExtensionConfig() { + static async resetExtensionConfig(): Promise { const defConfig = `${E2E_ROOT_PATH}/resources/extensibility-configs/${EXTENSIBILITY_CONFIGS.DEFAULT_EXTENSIONS_CONFIG}`; - return this.setSessionStorageFromConfig(defConfig); + await this.setSessionStorageFromConfig(defConfig); } static retryCall(fn: () => Promise, retry: number = 30, delay: number = 1000): Promise { @@ -80,11 +80,11 @@ export class Utils { return run(retry); } - static async waitUntilElementClickable(element: ElementFinder) { + static async waitUntilElementClickable(element: ElementFinder): Promise { await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error); } - static async typeInField(elem: ElementFinder, value: string) { + static async typeInField(elem: ElementFinder, value: string): Promise { for (let i = 0; i < value.length; i++) { const c = value.charAt(i); await elem.sendKeys(c); @@ -92,7 +92,14 @@ export class Utils { } } - static async fileExistsOnOS(fileName: string, folderName: string = '', subFolderName: string = '') { + static async clearFieldWithBackspace(elem: ElementFinder): Promise { + const text = await elem.getAttribute('value'); + for (let i = 0; i < text.length; i++) { + await elem.sendKeys(protractor.Key.BACK_SPACE); + } + } + + static async fileExistsOnOS(fileName: string, folderName: string = '', subFolderName: string = ''): Promise { const config = await browser.getProcessedConfig(); const filePath = path.join(config.params.downloadFolder, folderName, subFolderName, fileName); @@ -117,7 +124,7 @@ export class Utils { }); } - static async renameFile(oldName: string, newName: string) { + static async renameFile(oldName: string, newName: string): Promise { const config = await browser.getProcessedConfig(); const oldFilePath = path.join(config.params.downloadFolder, oldName); const newFilePath = path.join(config.params.downloadFolder, newName); @@ -133,7 +140,7 @@ export class Utils { } } - static async unzip(filename: string, unzippedName: string = '') { + static async unzip(filename: string, unzippedName: string = ''): Promise { const config = await browser.getProcessedConfig(); const filePath = path.join(config.params.downloadFolder, filename); const output = path.join(config.params.downloadFolder, unzippedName ? unzippedName : ''); @@ -155,23 +162,31 @@ export class Utils { }); } - static async pressEscape() { + static async pressEscape(): Promise { await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); } - static async pressTab() { + static async pressTab(): Promise { await browser.actions().sendKeys(protractor.Key.TAB).perform(); } - static async getBrowserLog() { + static async pressCmd(): Promise { + await browser.actions().sendKeys(protractor.Key.COMMAND).perform(); + } + + static async releaseKeyPressed(): Promise { + await browser.actions().sendKeys(protractor.Key.NULL).perform(); + } + + static async getBrowserLog(): Promise { return browser.manage().logs().get('browser'); } - static formatDate(date: string) { + static formatDate(date: string): string { return new Date(date).toLocaleDateString('en-US'); } - static async uploadFileNewVersion(fileFromOS: string) { + static async uploadFileNewVersion(fileFromOS: string): Promise { const el = browser.element(by.id('app-upload-file-version')); await el.sendKeys(`${E2E_ROOT_PATH}/resources/test-files/${fileFromOS}`); } diff --git a/extension.schema.json b/extension.schema.json index d9fe567aa..99f2bebcf 100644 --- a/extension.schema.json +++ b/extension.schema.json @@ -676,6 +676,12 @@ "items": { "$ref": "#/definitions/iconRef" }, "minItems": 1 }, + "userActions": { + "description": "User option menu extensions", + "type": "array", + "items": { "$ref": "#/definitions/contentActionRef" }, + "minItems": 1 + }, "header": { "description": "Application header extensions", "type": "array", diff --git a/init-submodules.sh b/init-submodules.sh new file mode 100755 index 000000000..9dcb97458 --- /dev/null +++ b/init-submodules.sh @@ -0,0 +1,2 @@ +#!/bin/bash +git submodule update --init diff --git a/license-header.txt b/license-header.txt index c36094de4..fa74adf2e 100644 --- a/license-header.txt +++ b/license-header.txt @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/package-lock.json b/package-lock.json index 8340f2ff3..5afbba802 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,41 +1,41 @@ { "name": "alfresco-content-app", - "version": "1.9.0", + "version": "1.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@alfresco/adf-content-services": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.6.0.tgz", - "integrity": "sha512-npEPJ4eAIalIWd4lmTltYiS3XyLdagzfqDUfC9oHwFz8QfX7y8mUtaSDBVYqTGRm3lZ7vElczfsbuKlknLaxog==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.7.0.tgz", + "integrity": "sha512-AMFck7pdrYGL0I4AhbFV4RBNE5I273Q9/99m4tNcpctAQJVVo/ZeZ1dpgibkrz2LL9Bd+WwNsqWMUTf0e0ZIMQ==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-core": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.6.0.tgz", - "integrity": "sha512-WlYvxuBpJ6sug5iPfJprdWDZcDtJ7Y6/SFzEchEhan30O4Efb/MgWY+3s1nCsIwX0eYhyv8pj9NHQjHNjPotLw==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.7.0.tgz", + "integrity": "sha512-A5z85OkZSG6CdH4KUbhDFchZp0mQderSjOPhjGw6EI409DpbZy4UcNf0dsocAMTIdDXh0s4ubmcWN+5NqZqQpw==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-extensions": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.6.0.tgz", - "integrity": "sha512-/B2+TKrjQswXsTkkuU7qgK9Ud8Wn02bZRgRuKZiPwUxIo8s4wSMZpgWkfrIw58WDNDiL/MDgDeNiCrpxxrzdow==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.7.0.tgz", + "integrity": "sha512-tYM6ddTKceTRemKW2nHiiHJJFH1a+U7l4LTdqNoRyTM66J4s5HDm/G+zsQBy1k7ybPTGC56d1mWA0jqq+gnEEQ==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/js-api": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0.tgz", - "integrity": "sha512-aXc4twC3jDTZqyyhrlQX5DvyuSAnsfmZ7LT03itm/II9EqFEHcpXGWzyOA2VyZSyfuYz5e13KuM6v1VqBZxCwQ==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.7.0.tgz", + "integrity": "sha512-5bAk+RVC/VkmYHTI+LQVrOC2xqE308ns/Z4FF+FYUikhhqgB1OJIyt3vPSVP4hNSaxFsvan1owmVXMVqqCCgeA==", "requires": { "event-emitter": "^0.3.5", "minimatch": "3.0.4", - "superagent": "^3.8.2" + "superagent": "^5.1.2" } }, "@angular-devkit/architect": { @@ -262,7 +262,7 @@ "dependencies": { "source-map": { "version": "0.5.6", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", "dev": true } @@ -592,7 +592,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -639,7 +639,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -1249,6 +1249,12 @@ "@types/jasmine": "*" } }, + "@types/mime-types": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz", + "integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=", + "dev": true + }, "@types/node": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-9.3.0.tgz", @@ -1263,7 +1269,7 @@ }, "@types/q": { "version": "0.0.32", - "resolved": "http://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", + "resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", "integrity": "sha1-vShOV8hPEyXacCur/IKlMoGQwMU=", "dev": true }, @@ -1615,6 +1621,20 @@ "uri-js": "^4.2.2" } }, + "ajv-cli": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-cli/-/ajv-cli-3.0.0.tgz", + "integrity": "sha1-WCMjH2TigzBUEwaQsYCZYJ6YDyk=", + "dev": true, + "requires": { + "ajv": "^6.0.0", + "ajv-pack": "^0.3.0", + "fast-json-patch": "^0.5.6", + "glob": "^7.0.3", + "json-schema-migrate": "^0.2.0", + "minimist": "^1.2.0" + } + }, "ajv-errors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", @@ -1626,6 +1646,24 @@ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.3.0.tgz", "integrity": "sha512-CMzN9S62ZOO4sA/mJZIO4S++ZM7KFWzH3PPWkveLhy4OZ9i1/VatgwWMD46w/XbGCBy7Ye0gCk+Za6mmyfKK7g==" }, + "ajv-pack": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/ajv-pack/-/ajv-pack-0.3.1.tgz", + "integrity": "sha1-tyxNQhnjko5ihC10Le2Tv1B5ZWA=", + "dev": true, + "requires": { + "js-beautify": "^1.6.4", + "require-from-string": "^1.2.0" + }, + "dependencies": { + "require-from-string": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", + "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", + "dev": true + } + } + }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -1876,7 +1914,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1980,7 +2018,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -2417,7 +2455,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -2454,7 +2492,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -2583,7 +2621,7 @@ }, "cacache": { "version": "10.0.4", - "resolved": "http://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", "dev": true, "requires": { @@ -2657,7 +2695,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -2966,7 +3004,7 @@ }, "colors": { "version": "1.1.2", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", "dev": true }, @@ -2974,6 +3012,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -3014,7 +3053,8 @@ "component-emitter": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true }, "component-inherit": { "version": "0.0.3", @@ -3088,6 +3128,16 @@ "typedarray": "^0.0.6" } }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "dev": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "configstore": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", @@ -3264,7 +3314,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cosmiconfig": { "version": "4.0.0", @@ -3323,7 +3374,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -3336,7 +3387,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -3736,6 +3787,7 @@ "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, "requires": { "ms": "^2.1.1" } @@ -3854,7 +3906,7 @@ "dependencies": { "globby": { "version": "6.1.0", - "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { @@ -3867,7 +3919,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -3943,7 +3995,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -4041,6 +4093,26 @@ "safer-buffer": "^2.1.0" } }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "dev": true, + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + }, + "dependencies": { + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + } + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -4136,7 +4208,7 @@ }, "engine.io-client": { "version": "3.2.1", - "resolved": "http://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", "dev": true, "requires": { @@ -4252,7 +4324,7 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { @@ -4514,7 +4586,7 @@ }, "array-flatten": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", "dev": true }, @@ -4655,9 +4727,9 @@ } }, "ext": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.2.1.tgz", - "integrity": "sha512-x+OKKC57tNiLhDW26UmWtvQBpvO+2wxdC/A0jP7RkmjAc4gze9/U98hQyIYJUzo9A+o9ntMHpC+LH3pWMSbrVQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", + "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", "requires": { "type": "^2.0.0" }, @@ -4672,7 +4744,8 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extend-shallow": { "version": "3.0.2", @@ -4822,11 +4895,22 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" }, + "fast-json-patch": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-0.5.7.tgz", + "integrity": "sha1-taj0nSWWJFlu+YuHLz/aiVtNhmU=", + "dev": true + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, "fastparse": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", @@ -5078,6 +5162,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -5122,7 +5207,7 @@ }, "fs-access": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { @@ -5795,7 +5880,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, @@ -5891,7 +5976,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -6168,7 +6253,7 @@ }, "http-proxy-middleware": { "version": "0.18.0", - "resolved": "http://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", "integrity": "sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q==", "dev": true, "requires": { @@ -6791,7 +6876,7 @@ }, "is-accessor-descriptor": { "version": "0.1.6", - "resolved": "http://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { @@ -6850,7 +6935,7 @@ }, "is-data-descriptor": { "version": "0.1.4", - "resolved": "http://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { @@ -6976,7 +7061,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -7079,7 +7164,8 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isbinaryfile": { "version": "3.0.3", @@ -7217,7 +7303,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -7432,6 +7518,31 @@ "integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==", "dev": true }, + "js-beautify": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.10.2.tgz", + "integrity": "sha512-ZtBYyNUYJIsBWERnQP0rPN9KjkrDfJcMjuVGcvXOUJrD1zmOGwhRwQ4msG+HJ+Ni/FA7+sRQEMYVzdTQDvnzvQ==", + "dev": true, + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.3", + "glob": "^7.1.3", + "mkdirp": "~0.5.1", + "nopt": "~4.0.1" + }, + "dependencies": { + "nopt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "dev": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + } + } + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -7470,7 +7581,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -7495,6 +7606,41 @@ "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", "dev": true }, + "json-schema-migrate": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-0.2.0.tgz", + "integrity": "sha1-ukelsAcvxyOWRg4b1gtE1SF4u8Y=", + "dev": true, + "requires": { + "ajv": "^5.0.0" + }, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + } + } + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -7661,7 +7807,7 @@ }, "karma-cli": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/karma-cli/-/karma-cli-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/karma-cli/-/karma-cli-1.0.1.tgz", "integrity": "sha1-rmw8WKMTodALRRZMRVubhs4X+WA=", "dev": true, "requires": { @@ -7686,7 +7832,7 @@ }, "karma-jasmine-html-reporter": { "version": "0.2.2", - "resolved": "http://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-0.2.2.tgz", + "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-0.2.2.tgz", "integrity": "sha1-SKjl7xiAdhfuK14zwRlMNbQ5Ukw=", "dev": true, "requires": { @@ -7790,7 +7936,7 @@ "dependencies": { "promise": { "version": "7.0.4", - "resolved": "http://registry.npmjs.org/promise/-/promise-7.0.4.tgz", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.0.4.tgz", "integrity": "sha1-Nj6EpMNsg1a4kP7WLJHOhdAu1Tk=", "dev": true, "requires": { @@ -8014,7 +8160,7 @@ }, "supports-color": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true } @@ -8034,7 +8180,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -8047,7 +8193,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -8393,7 +8539,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, @@ -8428,7 +8574,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -8489,7 +8635,8 @@ "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true }, "mime-db": { "version": "1.37.0", @@ -8653,7 +8800,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -8945,7 +9092,7 @@ "dependencies": { "semver": { "version": "5.3.0", - "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true } @@ -9032,7 +9179,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -9391,13 +9538,13 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -9406,7 +9553,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -9711,7 +9858,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -9762,12 +9909,12 @@ } }, "pdfjs-dist": { - "version": "2.0.489", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.0.489.tgz", - "integrity": "sha1-Y+VLKSqGeQpFRpfrRNQ0e4+/rSc=", + "version": "2.3.200", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.3.200.tgz", + "integrity": "sha512-+8wBjU5h8LPZOIvR9X2uCrp/8xWQG1DRDKMLg5lzGN1qyIAZlYUxA0KQyy12Nw5jN7ozulC6v97PMaDcLgAcFg==", "requires": { "node-ensure": "^0.0.0", - "worker-loader": "^1.1.1" + "worker-loader": "^2.0.0" } }, "pend": { @@ -9975,7 +10122,8 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true }, "progress": { "version": "2.0.3", @@ -10015,6 +10163,12 @@ "integrity": "sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g==", "dev": true }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", + "dev": true + }, "protoduck": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/protoduck/-/protoduck-5.0.1.tgz", @@ -10055,7 +10209,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -10210,21 +10364,29 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "puppeteer": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.20.0.tgz", - "integrity": "sha512-bt48RDBy2eIwZPrkgbcwHtb51mj2nKvHOPMaSH2IsWiv7lOG9k9zhaRzpDZafrk05ajMc3cu+lSQYYOfH2DkVQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.0.tgz", + "integrity": "sha512-PC4oKMtwAElo8YtS/cYnk2/dew/3TonsGKKzjpFLWwkhBCteFsOZCVOXTt2QlP6w53mH0YsJE+fPLPzOW+DCug==", "dev": true, "requires": { + "@types/mime-types": "^2.1.0", "debug": "^4.1.0", "extract-zip": "^1.6.6", - "https-proxy-agent": "^2.2.1", + "https-proxy-agent": "^4.0.0", "mime": "^2.0.3", + "mime-types": "^2.1.25", "progress": "^2.0.1", "proxy-from-env": "^1.0.0", "rimraf": "^2.6.1", "ws": "^6.1.0" }, "dependencies": { + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -10234,12 +10396,37 @@ "ms": "^2.1.1" } }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + }, "mime": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==", "dev": true }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "dev": true, + "requires": { + "mime-db": "1.43.0" + } + }, "ws": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", @@ -10266,7 +10453,8 @@ "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "dev": true }, "querystring": { "version": "0.2.0", @@ -10369,7 +10557,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -10399,7 +10587,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -10438,8 +10626,9 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -10510,7 +10699,7 @@ }, "regexpu-core": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", "dev": true, "requires": { @@ -10540,13 +10729,13 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -10555,7 +10744,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -10914,7 +11103,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -10964,7 +11153,7 @@ }, "sax": { "version": "0.5.8", - "resolved": "http://registry.npmjs.org/sax/-/sax-0.5.8.tgz", + "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz", "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=", "dev": true }, @@ -10995,7 +11184,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -11253,7 +11442,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -11306,6 +11495,12 @@ "rechoir": "^0.6.2" } }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -11340,7 +11535,7 @@ }, "slice-ansi": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", "dev": true }, @@ -11556,7 +11751,7 @@ }, "socket.io-parser": { "version": "3.2.0", - "resolved": "http://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", "dev": true, "requires": { @@ -11820,7 +12015,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -11961,7 +12156,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -11972,7 +12167,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { "safe-buffer": "~5.1.0" @@ -11991,7 +12186,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -12009,7 +12204,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, @@ -12081,7 +12276,7 @@ }, "source-map": { "version": "0.1.43", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", "dev": true, "requires": { @@ -12102,20 +12297,79 @@ } }, "superagent": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.3.tgz", - "integrity": "sha512-GLQtLMCoEIK4eDv6OGtkOoSMt3D+oq0y3dsxMuYuDvaNUvuT8eFBuLmfR0iYYzHC1e8hpzC6ZsxbuP6DIalMFA==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.2.1.tgz", + "integrity": "sha512-46b4Lkwnlz7Ebdv2FBbfuqb3kVkG1jV/SK3EW6NnwL9a3T4h5hHtegNEQfbXvTFbDoUZXId4W3dMgap2f6ic1g==", "requires": { - "component-emitter": "^1.2.0", - "cookiejar": "^2.1.0", - "debug": "^3.1.0", - "extend": "^3.0.0", - "form-data": "^2.3.1", - "formidable": "^1.2.0", - "methods": "^1.1.1", - "mime": "^1.4.1", - "qs": "^6.5.1", - "readable-stream": "^2.3.5" + "component-emitter": "^1.3.0", + "cookiejar": "^2.1.2", + "debug": "^4.1.1", + "fast-safe-stringify": "^2.0.7", + "form-data": "^3.0.0", + "formidable": "^1.2.1", + "methods": "^1.1.2", + "mime": "^2.4.4", + "qs": "^6.9.1", + "readable-stream": "^3.4.0", + "semver": "^6.3.0" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, + "qs": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz", + "integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==" + }, + "readable-stream": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", + "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } } }, "supports-color": { @@ -12408,7 +12662,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -12672,7 +12926,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, @@ -13232,7 +13486,7 @@ }, "source-map": { "version": "0.4.4", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -13704,9 +13958,9 @@ } }, "worker-loader": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-1.1.1.tgz", - "integrity": "sha512-qJZLVS/jMCBITDzPo/RuweYSIG8VJP5P67mP/71alGyTZRe1LYJFdwLjLalY3T5ifx0bMDRD3OB6P2p1escvlg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-2.0.0.tgz", + "integrity": "sha512-tnvNp4K3KQOpfRnD20m8xltE3eWh89Ye+5oj7wXEEHKac1P4oZ6p9oTj8/8ExqoSBnk9nu5Pr4nKfQ1hn2APJw==", "requires": { "loader-utils": "^1.0.0", "schema-utils": "^0.4.0" @@ -13714,7 +13968,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { diff --git a/package.json b/package.json index 78c457248..adc8ab417 100644 --- a/package.json +++ b/package.json @@ -1,45 +1,49 @@ { "name": "alfresco-content-app", - "version": "1.9.0", + "version": "1.10.0", "license": "LGPL-3.0", "scripts": { "ng": "ng", - "start": "npm run build.shared && npm run build.extensions && ng serve --open", - "start:prod": "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng serve --prod --open", + "start": "npm run validate-config && npm run build.extensions && ng serve --open", + "start:prod": "npm run validate-config && node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng serve --prod --open", "build:aos-extension": "npx rimraf dist/@alfresco/adf-office-services-ext && ng build adf-office-services-ext && cpr projects/adf-office-services-ext/ngi.json dist/@alfresco/adf-office-services-ext/ngi.json && cpr projects/adf-office-services-ext/assets dist/@alfresco/adf-office-services-ext/assets", "build.shared": "ng build aca-shared", - "build.extensions": "npm run build:aos-extension", + "build.aos": "npm run build:aos-extension", + "build.extensions": "npm run build.shared && npm run build.aos", "build.app": "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app", - "build": "npm run build.shared && npm run build.extensions && npm run build.app -- --prod", - "build.e2e": "npm run build.shared && npm run build.extensions && npm run build.app -- --prod --configuration=e2e", + "build": "npm run validate-config && npm run build.extensions && npm run build.app -- --prod", + "build.js-api": "./scripts/install-local-js-api.sh && npm run build", + "build.adf": "./scripts/install-local-adf.sh && npm run build.extensions && npm run build.app", + "build.e2e": "npm run build.extensions && npm run build.app -- --prod --configuration=e2e", "test": "ng test app --code-coverage", - "test:ci": "npm run build.shared && npm run build.extensions && ng test adf-office-services-ext --watch=false && ng test app --code-coverage --watch=false", + "test:ci": "npm run build.extensions && ng test adf-office-services-ext --watch=false && ng test app --code-coverage --watch=false", "lint": "ng lint && npm run spellcheck && npm run format:check && npm run e2e.typecheck", "wd:update": "webdriver-manager update --gecko=false $VERSION_CHROME", "e2e.typecheck": "tsc -p ./e2e/tsconfig.e2e.typecheck.json", - "e2e": "npm run wd:update && protractor --baseUrl=${TEST_BASE_URL:-http://localhost:8080} $SUITE", + "e2e": "npm run wd:update && protractor --baseUrl=${TEST_BASE_URL:-http://localhost:8080/content-app} $SUITE", "e2e.local": "npm run wd:update && protractor --baseUrl=http://localhost:4200 $SUITE", - "wait:app": "wait-on http://localhost:8080/alfresco/ -t 1000000 && wait-on http://localhost:8080 -t 400000", - "start:docker": "docker-compose up -d --build && npm run wait:app", - "stop:docker": "docker-compose stop", - "e2e:docker": "npm run start:docker && npm run e2e && npm run stop:docker", + "wait:app": "wait-on http://${HOST_IP:-localhost}:${HOST_PORT:-8080}/alfresco/ -t 1000000 && wait-on http://${HOST_IP:-localhost}:${HOST_PORT:-8080}/content-app/ -t 400000", + "start:docker": "./start.sh", + "stop:docker": "./start.sh -d", + "e2e:docker": "./start.sh && npm run e2e && ./start.sh -d", "spellcheck": "cspell '{src,e2e,projects}/**/*.ts'", "inspect.bundle": "ng build app --prod --stats-json && npx webpack-bundle-analyzer dist/app/stats.json", "format:check": "prettier --check \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"", "format:fix": "prettier --write \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"", - "build.tomcat": "npm run build.shared && npm run build.extensions && npm run build.app -- --prod --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .", + "build.tomcat": "npm run validate-config && npm run build.extensions && npm run build.app -- --prod --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .", "build.tomcat.e2e": "./build-tomcat-e2e.sh", "e2e.tomcat": "npm run wd:update && protractor --baseUrl=http://localhost:8080/content-app/ $SUITE", "docker.tomcat.start": "cd docker/tomcat && docker-compose up -d --build && npm run wait:app", "docker.tomcat.stop": "cd docker/tomcat && docker-compose stop", - "docker.tomcat.e2e": "npm run docker.tomcat.start && npm run e2e.tomcat" + "docker.tomcat.e2e": "npm run docker.tomcat.start && npm run e2e.tomcat", + "validate-config": "ajv validate -s ./node_modules/@alfresco/adf-core/app.config.schema.json -d ./src/app.config.json --errors=text --verbose" }, "private": true, "dependencies": { - "@alfresco/adf-content-services": "3.6.0", - "@alfresco/adf-core": "3.6.0", - "@alfresco/adf-extensions": "3.6.0", - "@alfresco/js-api": "3.6.0", + "@alfresco/adf-content-services": "3.7.0", + "@alfresco/adf-core": "3.7.0", + "@alfresco/adf-extensions": "3.7.0", + "@alfresco/js-api": "3.7.0", "@angular/animations": "7.2.15", "@angular/cdk": "^7.3.7", "@angular/common": "7.2.15", @@ -65,7 +69,7 @@ "minimatch-browser": "^1.0.0", "moment": "^2.24.0", "moment-es6": "1.0.0", - "pdfjs-dist": "2.0.489", + "pdfjs-dist": "2.3.200", "rxjs": "^6.5.2", "zone.js": "0.8.29" }, @@ -79,6 +83,7 @@ "@types/jasminewd2": "^2.0.2", "@types/node": "9.3.0", "@types/selenium-webdriver": "^3.0.8", + "ajv-cli": "^3.0.0", "adf-tslint-rules": "0.0.7", "chrome-remote-interface": "^0.26.1", "codelyzer": "^4.5.0", @@ -102,7 +107,7 @@ "prettier": "^1.17.1", "protractor": "5.4.2", "protractor-screenshoter-plugin": "0.10.3", - "puppeteer": "^1.20.0", + "puppeteer": "^2.1.0", "rxjs-tslint-rules": "^4.19.0", "selenium-webdriver": "4.0.0-alpha.1", "ts-node": "^8.0.3", diff --git a/projects/aca-shared/package.json b/projects/aca-shared/package.json index 232e60e55..3d154ab00 100644 --- a/projects/aca-shared/package.json +++ b/projects/aca-shared/package.json @@ -1,6 +1,6 @@ { "name": "@alfresco/aca-shared", - "version": "1.9.1", + "version": "1.9.2", "peerDependencies": { "@angular/common": "^7.2.0", "@angular/core": "^7.2.0", diff --git a/projects/aca-shared/rules/src/app.rules.spec.ts b/projects/aca-shared/rules/src/app.rules.spec.ts index 3306e147e..d04750627 100644 --- a/projects/aca-shared/rules/src/app.rules.spec.ts +++ b/projects/aca-shared/rules/src/app.rules.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -439,4 +439,40 @@ describe('app.evaluators', () => { expect(app.isShared(context)).toBe(true); }); }); + + describe('canShowLanguagePicker', () => { + it('should return true when property is true', () => { + const context: any = { + languagePicker: true + }; + + expect(app.canShowLanguagePicker(context)).toBe(true); + }); + + it('should return false when property is false', () => { + const context: any = { + languagePicker: false + }; + + expect(app.canShowLanguagePicker(context)).toBe(false); + }); + }); + + describe('canShowLogout', () => { + it('should return false when `withCredentials` property is true', () => { + const context: any = { + withCredentials: true + }; + + expect(app.canShowLogout(context)).toBe(false); + }); + + it('should return true when `withCredentials` property is false', () => { + const context: any = { + withCredentials: false + }; + + expect(app.canShowLanguagePicker(context)).toBe(true); + }); + }); }); diff --git a/projects/aca-shared/rules/src/app.rules.ts b/projects/aca-shared/rules/src/app.rules.ts index 426d49eab..11381309e 100644 --- a/projects/aca-shared/rules/src/app.rules.ts +++ b/projects/aca-shared/rules/src/app.rules.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -27,6 +27,11 @@ import { RuleContext } from '@alfresco/adf-extensions'; import * as navigation from './navigation.rules'; import * as repository from './repository.rules'; +export interface AcaRuleContext extends RuleContext { + languagePicker: boolean; + withCredentials: boolean; +} + /** * Checks if user can copy selected node. * JSON ref: `app.canCopyNode` @@ -147,7 +152,7 @@ export function canDeleteSelection(context: RuleContext): boolean { return false; } - // temp workaround for Search api + // temp workaround for Favorites api if (navigation.isFavorites(context)) { return true; } @@ -386,7 +391,7 @@ export function canLockFile(context: RuleContext): boolean { /** * Checks if user can unlock selected file. - * JSON ref: `app.selection.file.canLock` + * JSON ref: `app.selection.file.canUnlock` */ export function canUnlockFile(context: RuleContext): boolean { const { file } = context.selection; @@ -503,9 +508,6 @@ export function canToggleEditOffline(context: RuleContext): boolean { return [ hasFileSelected(context), navigation.isNotTrashcan(context), - navigation.isNotFavorites(context) || - navigation.isFavoritesPreview(context), - navigation.isNotSharedFiles(context) || navigation.isSharedPreview(context), canLockFile(context) || canUnlockFile(context) ].every(Boolean); } @@ -526,3 +528,21 @@ export function canToggleFavorite(context: RuleContext): boolean { ].some(Boolean) ].every(Boolean); } + +/** + * Checks if application should render language picker menu. + * JSON ref: `canShowLanguagePicker` + * @param context Rule execution context + */ +export function canShowLanguagePicker(context: AcaRuleContext): boolean { + return context.languagePicker; +} + +/** + * Checks if application should render logout option. + * JSON ref: `canShowLogout` + * @param context Rule execution context + */ +export function canShowLogout(context: AcaRuleContext): boolean { + return !context.withCredentials; +} diff --git a/projects/aca-shared/rules/src/navigation.rules.spec.ts b/projects/aca-shared/rules/src/navigation.rules.spec.ts index e8453f4d6..ebd86e355 100644 --- a/projects/aca-shared/rules/src/navigation.rules.spec.ts +++ b/projects/aca-shared/rules/src/navigation.rules.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/rules/src/navigation.rules.ts b/projects/aca-shared/rules/src/navigation.rules.ts index 1a8c02a3a..27885fa12 100644 --- a/projects/aca-shared/rules/src/navigation.rules.ts +++ b/projects/aca-shared/rules/src/navigation.rules.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/rules/src/public_api.ts b/projects/aca-shared/rules/src/public_api.ts index b83e40475..56fded04e 100644 --- a/projects/aca-shared/rules/src/public_api.ts +++ b/projects/aca-shared/rules/src/public_api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/rules/src/repository.rules.ts b/projects/aca-shared/rules/src/repository.rules.ts index b7ad66a40..85d863957 100644 --- a/projects/aca-shared/rules/src/repository.rules.ts +++ b/projects/aca-shared/rules/src/repository.rules.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/rules/src/user.rules.spec.ts b/projects/aca-shared/rules/src/user.rules.spec.ts index 47c91d2f2..aa0d55a22 100644 --- a/projects/aca-shared/rules/src/user.rules.spec.ts +++ b/projects/aca-shared/rules/src/user.rules.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/rules/src/user.rules.ts b/projects/aca-shared/rules/src/user.rules.ts index 62cb67c77..daf4457ca 100644 --- a/projects/aca-shared/rules/src/user.rules.ts +++ b/projects/aca-shared/rules/src/user.rules.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/generic-error/generic-error.component.spec.ts b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.spec.ts index 99542683f..0e7bbfaed 100644 --- a/projects/aca-shared/src/lib/components/generic-error/generic-error.component.spec.ts +++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts index bdcfdd912..2b396d4b3 100644 --- a/projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts +++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts b/projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts index 819ade5ba..1599148b1 100644 --- a/projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts +++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/dl-custom-components/locked-by/locked-by.component.scss b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.scss similarity index 52% rename from src/app/components/dl-custom-components/locked-by/locked-by.component.scss rename to projects/aca-shared/src/lib/components/locked-by/locked-by.component.scss index 95483bd13..d8af3451a 100644 --- a/src/app/components/dl-custom-components/locked-by/locked-by.component.scss +++ b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.scss @@ -1,4 +1,9 @@ .aca-locked-by { + display: flex; + align-items: center; + padding: 0 10px; + color: var(--theme-text-color, rgba(0, 0, 0, 0.54)); + .locked_by--icon { font-size: 14px; width: 14px; @@ -7,5 +12,6 @@ .locked_by--name { font-size: 12px; + padding: 0 2px; } } diff --git a/src/app/components/dl-custom-components/locked-by/locked-by.component.ts b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.ts similarity index 94% rename from src/app/components/dl-custom-components/locked-by/locked-by.component.ts rename to projects/aca-shared/src/lib/components/locked-by/locked-by.component.ts index 60eb9b18b..664dea37c 100644 --- a/src/app/components/dl-custom-components/locked-by/locked-by.component.ts +++ b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -46,7 +46,7 @@ import { NodeEntry } from '@alfresco/js-api'; class: 'aca-locked-by' } }) -export class LockByComponent implements OnInit { +export class LockedByComponent implements OnInit { @Input() context: any; diff --git a/projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts b/projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts new file mode 100644 index 000000000..578023565 --- /dev/null +++ b/projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts @@ -0,0 +1,36 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { NgModule } from '@angular/core'; +import { LockedByComponent } from './locked-by.component'; +import { MatIconModule } from '@angular/material/icon'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + imports: [CommonModule, MatIconModule], + declarations: [LockedByComponent], + exports: [LockedByComponent] +}) +export class LockedByModule {} diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts index 375f2c746..f38f0c753 100644 --- a/projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts +++ b/projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts index a171d5219..43f278964 100644 --- a/projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts +++ b/projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts index 2890c4048..1b5431d15 100644 --- a/projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts +++ b/projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts index cc378408d..10fdce346 100644 --- a/projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts +++ b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts index defead023..f86a22a1b 100644 --- a/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts +++ b/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu.directives.spec.ts b/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.directive.spec.ts similarity index 75% rename from src/app/components/context-menu/context-menu.directives.spec.ts rename to projects/aca-shared/src/lib/directives/contextmenu/contextmenu.directive.spec.ts index 3add678bd..36f75c365 100644 --- a/src/app/components/context-menu/context-menu.directives.spec.ts +++ b/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,24 +23,25 @@ * along with Alfresco. If not, see . */ -import { ContextActionsDirective } from './context-menu.directive'; +import { ContextActionsDirective } from './contextmenu.directive'; +import { ContextMenu } from '@alfresco/aca-shared/store'; import { fakeAsync, tick } from '@angular/core/testing'; describe('ContextActionsDirective', () => { let directive; - const contextMenuServiceMock = { - open: jasmine.createSpy('open') + const storeMock = { + dispatch: jasmine.createSpy('dispatch') }; beforeEach(() => { - directive = new ContextActionsDirective(contextMenuServiceMock); + directive = new ContextActionsDirective(storeMock); }); it('should not render context menu when `enabled` property is false', () => { directive.enabled = false; directive.onContextMenuEvent(new MouseEvent('contextmenu')); - expect(contextMenuServiceMock.open).not.toHaveBeenCalled(); + expect(storeMock.dispatch).not.toHaveBeenCalled(); }); it('should call service to render context menu', fakeAsync(() => { @@ -51,13 +52,16 @@ describe('ContextActionsDirective', () => { const fragment = document.createDocumentFragment(); fragment.appendChild(el); const target = fragment.querySelector('div'); + const mouseEventMock = { preventDefault: () => {}, target }; directive.ngOnInit(); - directive.onContextMenuEvent({ preventDefault: () => {}, target }); + directive.onContextMenuEvent(mouseEventMock); tick(500); - expect(contextMenuServiceMock.open).toHaveBeenCalled(); + expect(storeMock.dispatch).toHaveBeenCalledWith( + new ContextMenu(mouseEventMock) + ); })); }); diff --git a/src/app/components/context-menu/context-menu.directive.ts b/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.directive.ts similarity index 68% rename from src/app/components/context-menu/context-menu.directive.ts rename to projects/aca-shared/src/lib/directives/contextmenu/contextmenu.directive.ts index dd1dbafbe..448b4b085 100644 --- a/src/app/components/context-menu/context-menu.directive.ts +++ b/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -30,18 +30,18 @@ import { OnInit, OnDestroy } from '@angular/core'; -import { ContextMenuOverlayRef } from './context-menu-overlay'; -import { ContextMenuService } from './context-menu.service'; -import { debounceTime } from 'rxjs/operators'; -import { Subject, fromEvent, Subscription } from 'rxjs'; +import { debounceTime, takeUntil } from 'rxjs/operators'; +import { Subject } from 'rxjs'; +import { Store } from '@ngrx/store'; +import { AppStore, ContextMenu } from '@alfresco/aca-shared/store'; @Directive({ - selector: '[acaContextActions]' + selector: '[acaContextActions]', + exportAs: 'acaContextActions' }) export class ContextActionsDirective implements OnInit, OnDestroy { private execute$: Subject = new Subject(); - private subscriptions: Subscription[] = []; - private overlayRef: ContextMenuOverlayRef = null; + onDestroy$: Subject = new Subject(); // tslint:disable-next-line:no-input-rename @Input('acaContextEnable') @@ -61,42 +61,30 @@ export class ContextActionsDirective implements OnInit, OnDestroy { } } - constructor(private contextMenuService: ContextMenuService) {} + constructor(private store: Store) {} ngOnInit() { - this.subscriptions.push( - fromEvent(document.body, 'contextmenu').subscribe(() => { - if (this.overlayRef) { - this.overlayRef.close(); - } - }), - - this.execute$.pipe(debounceTime(300)).subscribe((event: MouseEvent) => { - this.render(event); - }) - ); + this.execute$ + .pipe( + debounceTime(300), + takeUntil(this.onDestroy$) + ) + .subscribe((event: MouseEvent) => { + this.store.dispatch(new ContextMenu(event)); + }); } ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); - this.subscriptions = []; - this.execute$ = null; + this.onDestroy$.next(true); + this.onDestroy$.complete(); } execute(event: MouseEvent, target: Element) { if (!this.isSelected(target)) { target.dispatchEvent(new MouseEvent('click')); } - this.execute$.next(event); - } - private render(event: MouseEvent) { - this.overlayRef = this.contextMenuService.open({ - source: event, - hasBackdrop: false, - backdropClass: 'cdk-overlay-transparent-backdrop', - panelClass: 'cdk-overlay-pane' - }); + this.execute$.next(event); } private getTarget(event: MouseEvent): Element { diff --git a/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.module.ts b/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.module.ts new file mode 100644 index 000000000..30ecdc60d --- /dev/null +++ b/projects/aca-shared/src/lib/directives/contextmenu/contextmenu.module.ts @@ -0,0 +1,33 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { NgModule } from '@angular/core'; +import { ContextActionsDirective } from './contextmenu.directive'; + +@NgModule({ + declarations: [ContextActionsDirective], + exports: [ContextActionsDirective] +}) +export class ContextActionsModule {} diff --git a/projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts b/projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts index cd6fd61ef..d007cd934 100644 --- a/projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts +++ b/projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/routing/app.routes.strategy.ts b/projects/aca-shared/src/lib/routing/app.routes.strategy.ts index ee134a6cd..bc8393150 100644 --- a/projects/aca-shared/src/lib/routing/app.routes.strategy.ts +++ b/projects/aca-shared/src/lib/routing/app.routes.strategy.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/routing/shared.guard.ts b/projects/aca-shared/src/lib/routing/shared.guard.ts index f2f06bb63..ea9b93e32 100644 --- a/projects/aca-shared/src/lib/routing/shared.guard.ts +++ b/projects/aca-shared/src/lib/routing/shared.guard.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/services/app.service.spec.ts b/projects/aca-shared/src/lib/services/app.service.spec.ts index 440289ee4..a82489d1c 100644 --- a/projects/aca-shared/src/lib/services/app.service.spec.ts +++ b/projects/aca-shared/src/lib/services/app.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/services/app.service.ts b/projects/aca-shared/src/lib/services/app.service.ts index 5c097d937..643c0dda0 100644 --- a/projects/aca-shared/src/lib/services/app.service.ts +++ b/projects/aca-shared/src/lib/services/app.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/services/content-api.service.spec.ts b/projects/aca-shared/src/lib/services/content-api.service.spec.ts index 5c265efca..d3f8bf597 100644 --- a/projects/aca-shared/src/lib/services/content-api.service.spec.ts +++ b/projects/aca-shared/src/lib/services/content-api.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/services/content-api.service.ts b/projects/aca-shared/src/lib/services/content-api.service.ts index 418083743..e080f8fbd 100644 --- a/projects/aca-shared/src/lib/services/content-api.service.ts +++ b/projects/aca-shared/src/lib/services/content-api.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/services/node-permission.service.spec.ts b/projects/aca-shared/src/lib/services/node-permission.service.spec.ts index 698b3ce92..694d5cd91 100644 --- a/projects/aca-shared/src/lib/services/node-permission.service.spec.ts +++ b/projects/aca-shared/src/lib/services/node-permission.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/services/node-permission.service.ts b/projects/aca-shared/src/lib/services/node-permission.service.ts index 3b2ef5a6d..e20333b60 100644 --- a/projects/aca-shared/src/lib/services/node-permission.service.ts +++ b/projects/aca-shared/src/lib/services/node-permission.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/lib/shared.module.ts b/projects/aca-shared/src/lib/shared.module.ts index 327fe0b8b..54b96cb65 100644 --- a/projects/aca-shared/src/lib/shared.module.ts +++ b/projects/aca-shared/src/lib/shared.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -27,8 +27,11 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; import { ContentApiService } from './services/content-api.service'; import { NodePermissionService } from './services/node-permission.service'; import { AppService } from './services/app.service'; - -@NgModule({}) +import { ContextActionsModule } from './directives/contextmenu/contextmenu.module'; +@NgModule({ + imports: [ContextActionsModule], + exports: [ContextActionsModule] +}) export class SharedModule { static forRoot(): ModuleWithProviders { return { diff --git a/src/app/utils/node.utils.ts b/projects/aca-shared/src/lib/utils/node.utils.ts similarity index 96% rename from src/app/utils/node.utils.ts rename to projects/aca-shared/src/lib/utils/node.utils.ts index 79cac4553..0a473016c 100644 --- a/src/app/utils/node.utils.ts +++ b/projects/aca-shared/src/lib/utils/node.utils.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts index 0d87b4502..a3a2a55b1 100644 --- a/projects/aca-shared/src/public-api.ts +++ b/projects/aca-shared/src/public-api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -28,6 +28,8 @@ export * from './lib/components/page-layout/page-layout-error.component'; export * from './lib/components/page-layout/page-layout-header.component'; export * from './lib/components/page-layout/page-layout.component'; export * from './lib/components/page-layout/page-layout.module'; +export * from './lib/components/locked-by/locked-by.component'; +export * from './lib/components/locked-by/locked-by.module'; export * from './lib/routing/app.routes.strategy'; export * from './lib/routing/shared.guard'; @@ -39,4 +41,9 @@ export * from './lib/services/node-permission.service'; export * from './lib/components/generic-error/generic-error.component'; export * from './lib/components/generic-error/generic-error.module'; +export * from './lib/directives/contextmenu/contextmenu.directive'; +export * from './lib/directives/contextmenu/contextmenu.module'; + +export * from './lib/utils/node.utils'; + export * from './lib/shared.module'; diff --git a/projects/aca-shared/store/src/actions/app.actions.ts b/projects/aca-shared/store/src/actions/app.actions.ts index f29c3d731..1fbed4459 100644 --- a/projects/aca-shared/store/src/actions/app.actions.ts +++ b/projects/aca-shared/store/src/actions/app.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/contextmenu.actions.ts b/projects/aca-shared/store/src/actions/contextmenu.actions.ts new file mode 100644 index 000000000..c0cac2f7f --- /dev/null +++ b/projects/aca-shared/store/src/actions/contextmenu.actions.ts @@ -0,0 +1,36 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Action } from '@ngrx/store'; + +export enum ContextMenuActionTypes { + ContextMenu = 'CONTEXT_MENU' +} + +export class ContextMenu implements Action { + readonly type = ContextMenuActionTypes.ContextMenu; + + constructor(public event: MouseEvent) {} +} diff --git a/projects/aca-shared/store/src/actions/library.actions.ts b/projects/aca-shared/store/src/actions/library.actions.ts index fc3e34c9b..9843d4a7d 100644 --- a/projects/aca-shared/store/src/actions/library.actions.ts +++ b/projects/aca-shared/store/src/actions/library.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/metadata-aspect.actions.ts b/projects/aca-shared/store/src/actions/metadata-aspect.actions.ts index 1668b89c5..03c1d5934 100644 --- a/projects/aca-shared/store/src/actions/metadata-aspect.actions.ts +++ b/projects/aca-shared/store/src/actions/metadata-aspect.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/node.actions.ts b/projects/aca-shared/store/src/actions/node.actions.ts index 7fdf132c3..1cea752c9 100644 --- a/projects/aca-shared/store/src/actions/node.actions.ts +++ b/projects/aca-shared/store/src/actions/node.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/router.actions.ts b/projects/aca-shared/store/src/actions/router.actions.ts index 0bf984ddd..cfe0ae660 100644 --- a/projects/aca-shared/store/src/actions/router.actions.ts +++ b/projects/aca-shared/store/src/actions/router.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/search.actions.ts b/projects/aca-shared/store/src/actions/search.actions.ts index 0f9fbf5f6..19449af0e 100644 --- a/projects/aca-shared/store/src/actions/search.actions.ts +++ b/projects/aca-shared/store/src/actions/search.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/snackbar.actions.ts b/projects/aca-shared/store/src/actions/snackbar.actions.ts index 4a65997af..b9eb5ec74 100644 --- a/projects/aca-shared/store/src/actions/snackbar.actions.ts +++ b/projects/aca-shared/store/src/actions/snackbar.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/template.actions.ts b/projects/aca-shared/store/src/actions/template.actions.ts new file mode 100644 index 000000000..156d94348 --- /dev/null +++ b/projects/aca-shared/store/src/actions/template.actions.ts @@ -0,0 +1,58 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Action } from '@ngrx/store'; +import { Node } from '@alfresco/js-api'; + +export enum TemplateActionTypes { + FileFromTemplate = 'FILE_FROM_TEMPLATE', + FolderFromTemplate = 'FOLDER_FROM_TEMPLATE', + CreateFromTemplate = 'CREATE_FROM_TEMPLATE', + CreateFromTemplateSuccess = 'CREATE_FROM_TEMPLATE_SUCCESS' +} + +export class FileFromTemplate implements Action { + readonly type = TemplateActionTypes.FileFromTemplate; + + constructor() {} +} + +export class FolderFromTemplate implements Action { + readonly type = TemplateActionTypes.FolderFromTemplate; + + constructor() {} +} + +export class CreateFromTemplate implements Action { + readonly type = TemplateActionTypes.CreateFromTemplate; + + constructor(public payload: Node) {} +} + +export class CreateFromTemplateSuccess implements Action { + readonly type = TemplateActionTypes.CreateFromTemplateSuccess; + + constructor(public node: Node) {} +} diff --git a/projects/aca-shared/store/src/actions/upload.actions.ts b/projects/aca-shared/store/src/actions/upload.actions.ts index 6d8780b83..4293e40b1 100644 --- a/projects/aca-shared/store/src/actions/upload.actions.ts +++ b/projects/aca-shared/store/src/actions/upload.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/actions/viewer.actions.ts b/projects/aca-shared/store/src/actions/viewer.actions.ts index 6b97ee3ed..6557211bd 100644 --- a/projects/aca-shared/store/src/actions/viewer.actions.ts +++ b/projects/aca-shared/store/src/actions/viewer.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/effects/dialog.effects.ts b/projects/aca-shared/store/src/effects/dialog.effects.ts index 64ef99ef7..f3c5ba48a 100644 --- a/projects/aca-shared/store/src/effects/dialog.effects.ts +++ b/projects/aca-shared/store/src/effects/dialog.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/effects/router.effects.ts b/projects/aca-shared/store/src/effects/router.effects.ts index f39f36985..fd29fb03f 100644 --- a/projects/aca-shared/store/src/effects/router.effects.ts +++ b/projects/aca-shared/store/src/effects/router.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/effects/snackbar.effects.ts b/projects/aca-shared/store/src/effects/snackbar.effects.ts index e81fd42cf..7e7c66144 100644 --- a/projects/aca-shared/store/src/effects/snackbar.effects.ts +++ b/projects/aca-shared/store/src/effects/snackbar.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/models/delete-status.model.ts b/projects/aca-shared/store/src/models/delete-status.model.ts index a2366f8f5..26605d78d 100644 --- a/projects/aca-shared/store/src/models/delete-status.model.ts +++ b/projects/aca-shared/store/src/models/delete-status.model.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/models/deleted-node-info.model.ts b/projects/aca-shared/store/src/models/deleted-node-info.model.ts index 72c15ad0f..fdfe28a2e 100644 --- a/projects/aca-shared/store/src/models/deleted-node-info.model.ts +++ b/projects/aca-shared/store/src/models/deleted-node-info.model.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/models/node-info.model.ts b/projects/aca-shared/store/src/models/node-info.model.ts index cf8b9d5fb..c55d0c2f4 100644 --- a/projects/aca-shared/store/src/models/node-info.model.ts +++ b/projects/aca-shared/store/src/models/node-info.model.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/models/search-option.model.ts b/projects/aca-shared/store/src/models/search-option.model.ts index 3882bde40..c1b507d94 100644 --- a/projects/aca-shared/store/src/models/search-option.model.ts +++ b/projects/aca-shared/store/src/models/search-option.model.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/public_api.ts b/projects/aca-shared/store/src/public_api.ts index c7695c5b9..3b6ce971a 100644 --- a/projects/aca-shared/store/src/public_api.ts +++ b/projects/aca-shared/store/src/public_api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -32,6 +32,8 @@ export * from './actions/snackbar.actions'; export * from './actions/upload.actions'; export * from './actions/viewer.actions'; export * from './actions/metadata-aspect.actions'; +export * from './actions/template.actions'; +export * from './actions/contextmenu.actions'; export * from './effects/dialog.effects'; export * from './effects/router.effects'; diff --git a/projects/aca-shared/store/src/selectors/app.selectors.ts b/projects/aca-shared/store/src/selectors/app.selectors.ts index 378ca20d4..4ded19b5a 100644 --- a/projects/aca-shared/store/src/selectors/app.selectors.ts +++ b/projects/aca-shared/store/src/selectors/app.selectors.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/states/app.state.ts b/projects/aca-shared/store/src/states/app.state.ts index a0509c1ff..0f1d5feaf 100644 --- a/projects/aca-shared/store/src/states/app.state.ts +++ b/projects/aca-shared/store/src/states/app.state.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/store/src/store.module.ts b/projects/aca-shared/store/src/store.module.ts index 9e4925069..aabdac4e0 100644 --- a/projects/aca-shared/store/src/store.module.ts +++ b/projects/aca-shared/store/src/store.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/aca-shared/test.ts b/projects/aca-shared/test.ts index b310a400a..ec87916d8 100644 --- a/projects/aca-shared/test.ts +++ b/projects/aca-shared/test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/assets/aos.plugin.json b/projects/adf-office-services-ext/assets/aos.plugin.json index 4a6b2f053..07ed542a8 100644 --- a/projects/adf-office-services-ext/assets/aos.plugin.json +++ b/projects/adf-office-services-ext/assets/aos.plugin.json @@ -1,7 +1,7 @@ { "$schema": "../../../extension.schema.json", "$id": "9a635542-d87a-4558-ae64-ffa199d1a364", - "$version": "0.0.9", + "$version": "0.0.10", "$name": "keensoft.aos.plugin", "$description": "Extension that provides Office Edit Online Action", "$vendor": "Keensoft", diff --git a/projects/adf-office-services-ext/package.json b/projects/adf-office-services-ext/package.json index a428a7fa8..99bdc4e8a 100644 --- a/projects/adf-office-services-ext/package.json +++ b/projects/adf-office-services-ext/package.json @@ -1,6 +1,6 @@ { "name": "@alfresco/adf-office-services-ext", - "version": "0.0.9", + "version": "0.0.10", "license": "Apache-2.0", "homepage": "https://github.com/Alfresco/alfresco-content-app", "keywords": ["Alfresco", "ADF", "ACA", "Content Application"], diff --git a/projects/adf-office-services-ext/src/lib/actions/aos.actions.ts b/projects/adf-office-services-ext/src/lib/actions/aos.actions.ts index b943dfe0e..545d8eeee 100755 --- a/projects/adf-office-services-ext/src/lib/actions/aos.actions.ts +++ b/projects/adf-office-services-ext/src/lib/actions/aos.actions.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/lib/aos-extension.module.ts b/projects/adf-office-services-ext/src/lib/aos-extension.module.ts index bf456c9a2..b5a6c512f 100644 --- a/projects/adf-office-services-ext/src/lib/aos-extension.module.ts +++ b/projects/adf-office-services-ext/src/lib/aos-extension.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/lib/aos-extension.service.ts b/projects/adf-office-services-ext/src/lib/aos-extension.service.ts index 7766efd8e..dbc75f64d 100644 --- a/projects/adf-office-services-ext/src/lib/aos-extension.service.ts +++ b/projects/adf-office-services-ext/src/lib/aos-extension.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -44,7 +44,7 @@ export class AosEditOnlineService { ) {} onActionEditOnlineAos(node: MinimalNodeEntryEntity): void { - if (node && node.isFile && node.properties) { + if (node && this.isFile(node) && node.properties) { if (node.isLocked) { // const checkedOut = node.aspectNames.find( // (aspect: string) => aspect === 'cm:checkedOut' @@ -92,9 +92,9 @@ export class AosEditOnlineService { private triggerEditOnlineAos(node: MinimalNodeEntryEntity): void { const aosHost = this.appConfigService.get('aosHost'); - const url = `${aosHost}/_aos_nodeid/${node.id}/${encodeURIComponent( - node.name - )}`; + const url = `${aosHost}/_aos_nodeid/${this.getNodeId( + node + )}/${encodeURIComponent(node.name)}`; const fileExtension = getFileExtension(node.name); const protocolHandler = this.getProtocolForFileExtension(fileExtension); @@ -134,4 +134,14 @@ export class AosEditOnlineService { } }, 500); } + + private isFile(node: MinimalNodeEntryEntity): boolean { + const implicitFile = (node).nodeId || (node).guid; + + return !!implicitFile || node.isFile; + } + + private getNodeId(node: MinimalNodeEntryEntity): string { + return (node).nodeId || (node).guid || node.id; + } } diff --git a/projects/adf-office-services-ext/src/lib/effects/aos.effects.ts b/projects/adf-office-services-ext/src/lib/effects/aos.effects.ts index 643e008c9..6b009377b 100755 --- a/projects/adf-office-services-ext/src/lib/effects/aos.effects.ts +++ b/projects/adf-office-services-ext/src/lib/effects/aos.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/lib/evaluators.spec.ts b/projects/adf-office-services-ext/src/lib/evaluators.spec.ts index 1bca7a5db..4d45795fa 100644 --- a/projects/adf-office-services-ext/src/lib/evaluators.spec.ts +++ b/projects/adf-office-services-ext/src/lib/evaluators.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/lib/evaluators.ts b/projects/adf-office-services-ext/src/lib/evaluators.ts index 0ff610367..18c626143 100644 --- a/projects/adf-office-services-ext/src/lib/evaluators.ts +++ b/projects/adf-office-services-ext/src/lib/evaluators.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -53,19 +53,6 @@ export function canOpenWithOffice( return false; } - // workaround for Shared files - if ( - context.navigation && - context.navigation.url && - context.navigation.url.startsWith('/shared') - ) { - if (file.entry.hasOwnProperty('allowableOperationsOnTarget')) { - return context.permissions.check(file, ['update'], { - target: 'allowableOperationsOnTarget' - }); - } - } - if (!file.entry.properties) { return false; } @@ -107,5 +94,18 @@ export function canOpenWithOffice( return false; } + // workaround for Shared files + if ( + context.navigation && + context.navigation.url && + context.navigation.url.startsWith('/shared') + ) { + if (file.entry.hasOwnProperty('allowableOperationsOnTarget')) { + return context.permissions.check(file, ['update'], { + target: 'allowableOperationsOnTarget' + }); + } + } + return context.permissions.check(file, ['update']); } diff --git a/projects/adf-office-services-ext/src/lib/utils.spec.ts b/projects/adf-office-services-ext/src/lib/utils.spec.ts index d2f5c54bc..d11bfa753 100644 --- a/projects/adf-office-services-ext/src/lib/utils.spec.ts +++ b/projects/adf-office-services-ext/src/lib/utils.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/lib/utils.ts b/projects/adf-office-services-ext/src/lib/utils.ts index 6aac4112f..5f5837777 100644 --- a/projects/adf-office-services-ext/src/lib/utils.ts +++ b/projects/adf-office-services-ext/src/lib/utils.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/public_api.ts b/projects/adf-office-services-ext/src/public_api.ts index 8f6cdddcb..c91e4788c 100644 --- a/projects/adf-office-services-ext/src/public_api.ts +++ b/projects/adf-office-services-ext/src/public_api.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/projects/adf-office-services-ext/src/test.ts b/projects/adf-office-services-ext/src/test.ts index b310a400a..ec87916d8 100644 --- a/projects/adf-office-services-ext/src/test.ts +++ b/projects/adf-office-services-ext/src/test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/protractor.conf.js b/protractor.conf.js index 5b4226e30..9a233b22e 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -52,7 +52,7 @@ exports.config = { './e2e/suites/pagination/*.test.ts', './e2e/suites/search/*.test.ts', './e2e/suites/actions-available/**/*.test.ts', - './e2e/suites/actions/*.test.ts', + './e2e/suites/actions/**/*.test.ts', './e2e/suites/viewer/*.test.ts', './e2e/suites/info-drawer/*.test.ts', './e2e/suites/extensions/*.test.ts' @@ -69,7 +69,9 @@ exports.config = { addRemoveContent: [ './e2e/suites/actions/new-menu.test.ts', './e2e/suites/actions/create-folder.test.ts', + './e2e/suites/actions/create-folder-from-template.test.ts', './e2e/suites/actions/create-library.test.ts', + './e2e/suites/actions/create-file-from-template.test.ts', './e2e/suites/actions/upload-file.test.ts', './e2e/suites/actions/upload-new-version.test.ts', './e2e/suites/actions/delete-undo-delete.test.ts', diff --git a/scripts/install-local-adf.sh b/scripts/install-local-adf.sh new file mode 100755 index 000000000..e1388b21e --- /dev/null +++ b/scripts/install-local-adf.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cd alfresco-ng2-components +npm install +echo "== install ADF libs ==" +./scripts/build/build-core.sh +./scripts/build/build-content-services.sh +./scripts/build/build-extensions.sh +cd .. +echo "== copy ADF libs ==" +rm -rf node_modules/@alfresco/adf-content-services +rm -rf node_modules/@alfresco/adf-core +rm -rf node_modules/@alfresco/adf-extensions +mkdir -p node_modules/@alfresco/adf-content-services +mkdir -p node_modules/@alfresco/adf-core +mkdir -p node_modules/@alfresco/adf-extensions +cp -rf alfresco-ng2-components/lib/dist/content-services/* node_modules/@alfresco/adf-content-services +cp -rf alfresco-ng2-components/lib/dist/core/* node_modules/@alfresco/adf-core +cp -rf alfresco-ng2-components/lib/dist/extensions/* node_modules/@alfresco/adf-extensions + +LOCAL=LOCAL +echo "== Rename local ADF libs version with attaching _$LOCAL ===" +CORE_VERSION=$(node -p "require('./node_modules/@alfresco/adf-core/package.json').version") +echo "CORE_VERSION $CORE_VERSION" +sed -i'' -e "s#\"version\": \"$CORE_VERSION\"#\"version\": \"${CORE_VERSION}_$LOCAL\"#g" ./node_modules/@alfresco/adf-core/package.json +CONTENT_VERSION=$(node -p "require('./node_modules/@alfresco/adf-content-services/package.json').version") +sed -i'' -e "s#\"version\": \"$CONTENT_VERSION#\"version\": \"${CONTENT_VERSION}_$LOCAL#g" ./node_modules/@alfresco/adf-content-services/package.json +EXT_VERSION=$(node -p "require('./node_modules/@alfresco/adf-extensions/package.json').version") +sed -i'' -e "s#\"version\": \"$EXT_VERSION#\"version\": \"${EXT_VERSION}_$LOCAL#g" ./node_modules/@alfresco/adf-extensions/package.json diff --git a/scripts/install-local-js-api.sh b/scripts/install-local-js-api.sh new file mode 100755 index 000000000..1a5885ea2 --- /dev/null +++ b/scripts/install-local-js-api.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +rm -rf node_modules +./alfresco-js-api/scripts/build.sh +npm install +rm -rf node_modules/@alfresco/js-api +mkdir -p node_modules/@alfresco/js-api +cp -rf alfresco-js-api/dist/package/* node_modules/@alfresco/js-api + +LOCAL=LOCAL +echo "== Rename local JS API version with attaching _$LOCAL ===" +VERSION=$(node -p "require('./node_modules/@alfresco/js-api/package.json').version") +sed -i'' -e "s#\"version\": \"$VERSION\"#\"version\": \"${VERSION}_$LOCAL\"#g" ./node_modules/@alfresco/js-api/package.json diff --git a/src/app.config.json b/src/app.config.json index 2b0259620..fb77dca77 100644 --- a/src/app.config.json +++ b/src/app.config.json @@ -1,4 +1,5 @@ { + "$schema": "../node_modules/@alfresco/adf-core/app.config.schema.json", "ecmHost": "{protocol}//{hostname}{:port}", "aosHost": "{protocol}//{hostname}{:port}/alfresco/aos", "baseShareUrl": "{protocol}//{hostname}{:port}/#/preview/s", @@ -18,7 +19,7 @@ }, "application": { "name": "Alfresco Content Application", - "version": "1.9.0", + "version": "1.10.0", "logo": "assets/images/alfresco-logo-flower.svg", "copyright": "APP.COPYRIGHT" }, @@ -279,18 +280,22 @@ "expanded": true, "fields": [ { + "mincount": 1, "field": "content.mimetype", "label": "SEARCH.FACET_FIELDS.FILE_TYPE" }, { + "mincount": 1, "field": "creator", "label": "SEARCH.FACET_FIELDS.CREATOR" }, { + "mincount": 1, "field": "modifier", "label": "SEARCH.FACET_FIELDS.MODIFIER" }, { + "mincount": 1, "field": "SITE", "label": "SEARCH.FACET_FIELDS.LOCATION" } diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 11c2e77d7..339dc0170 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 71a3bd2b4..ba7612234 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ec362240d..3bbeeb1ed 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -76,7 +76,7 @@ import { AppNodeVersionModule } from './components/node-version/node-version.mod import { FavoritesComponent } from './components/favorites/favorites.component'; import { RecentFilesComponent } from './components/recent-files/recent-files.component'; import { SharedFilesComponent } from './components/shared-files/shared-files.component'; - +import { CreateFromTemplateDialogComponent } from './dialogs/node-template/create-from-template.dialog'; import { environment } from '../environments/environment'; import { registerLocaleData } from '@angular/common'; @@ -158,7 +158,8 @@ registerLocaleData(localeSv); NodeVersionsDialogComponent, FavoritesComponent, RecentFilesComponent, - SharedFilesComponent + SharedFilesComponent, + CreateFromTemplateDialogComponent ], providers: [ { provide: RouteReuseStrategy, useClass: AppRouteReuseStrategy }, @@ -175,7 +176,8 @@ registerLocaleData(localeSv); entryComponents: [ NodeVersionsDialogComponent, NodeVersionUploadDialogComponent, - LibraryDialogComponent + LibraryDialogComponent, + CreateFromTemplateDialogComponent ], bootstrap: [AppComponent] }) diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 45f8d7818..a9a3ae65a 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -35,7 +35,7 @@ import { AppSharedRuleGuard, GenericErrorComponent } from '@alfresco/aca-shared'; -import { AuthGuardEcm, AuthGuard } from '@alfresco/adf-core'; +import { AuthGuardEcm } from '@alfresco/adf-core'; import { FavoritesComponent } from './components/favorites/favorites.component'; import { RecentFilesComponent } from './components/recent-files/recent-files.component'; import { SharedFilesComponent } from './components/shared-files/shared-files.component'; @@ -76,7 +76,7 @@ export const APP_ROUTES: Routes = [ { path: '', component: AppLayoutComponent, - canActivate: [AuthGuard], + canActivate: [AuthGuardEcm], children: [ { path: '', diff --git a/src/app/components/about/about.component.spec.ts b/src/app/components/about/about.component.spec.ts index 41f8c5b1c..8b94a7361 100644 --- a/src/app/components/about/about.component.spec.ts +++ b/src/app/components/about/about.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/about.component.ts b/src/app/components/about/about.component.ts index 9cf1890a5..75d73e8ef 100644 --- a/src/app/components/about/about.component.ts +++ b/src/app/components/about/about.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/about.module.ts b/src/app/components/about/about.module.ts index 2af7d5087..b5b80f050 100644 --- a/src/app/components/about/about.module.ts +++ b/src/app/components/about/about.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/extension-list/extension-list.component.ts b/src/app/components/about/extension-list/extension-list.component.ts index b3afc0488..ac74173e8 100644 --- a/src/app/components/about/extension-list/extension-list.component.ts +++ b/src/app/components/about/extension-list/extension-list.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/license-list/license-list.component.ts b/src/app/components/about/license-list/license-list.component.ts index cf5482f03..5282a34de 100644 --- a/src/app/components/about/license-list/license-list.component.ts +++ b/src/app/components/about/license-list/license-list.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/module-list/module-list.component.ts b/src/app/components/about/module-list/module-list.component.ts index 7b14da89b..3db1b7c30 100644 --- a/src/app/components/about/module-list/module-list.component.ts +++ b/src/app/components/about/module-list/module-list.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/package-list/package-list.component.ts b/src/app/components/about/package-list/package-list.component.ts index 206e48969..a499258ab 100644 --- a/src/app/components/about/package-list/package-list.component.ts +++ b/src/app/components/about/package-list/package-list.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/about/status-list/status-list.component.ts b/src/app/components/about/status-list/status-list.component.ts index d8bb86c4a..f2c7b9982 100644 --- a/src/app/components/about/status-list/status-list.component.ts +++ b/src/app/components/about/status-list/status-list.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/common/common.module.ts b/src/app/components/common/common.module.ts index 17ac4f12f..b280463e6 100644 --- a/src/app/components/common/common.module.ts +++ b/src/app/components/common/common.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -30,6 +30,8 @@ import { NgModule } from '@angular/core'; import { GenericErrorModule } from '@alfresco/aca-shared'; import { LocationLinkComponent } from './location-link/location-link.component'; import { ToggleSharedComponent } from './toggle-shared/toggle-shared.component'; +import { LanguagePickerComponent } from './language-picker/language-picker.component'; +import { LogoutComponent } from './logout/logout.component'; @NgModule({ imports: [ @@ -38,13 +40,25 @@ import { ToggleSharedComponent } from './toggle-shared/toggle-shared.component'; ExtensionsModule, GenericErrorModule ], - declarations: [LocationLinkComponent, ToggleSharedComponent], + declarations: [ + LocationLinkComponent, + ToggleSharedComponent, + LanguagePickerComponent, + LogoutComponent + ], exports: [ ExtensionsModule, LocationLinkComponent, GenericErrorModule, - ToggleSharedComponent + ToggleSharedComponent, + LanguagePickerComponent, + LogoutComponent ], - entryComponents: [LocationLinkComponent, ToggleSharedComponent] + entryComponents: [ + LocationLinkComponent, + ToggleSharedComponent, + LanguagePickerComponent, + LogoutComponent + ] }) export class AppCommonModule {} diff --git a/src/app/components/common/language-picker/language-picker.component.ts b/src/app/components/common/language-picker/language-picker.component.ts new file mode 100644 index 000000000..0a73c8a7a --- /dev/null +++ b/src/app/components/common/language-picker/language-picker.component.ts @@ -0,0 +1,39 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Component } from '@angular/core'; + +@Component({ + selector: 'aca-language-picker', + template: ` + + + + + ` +}) +export class LanguagePickerComponent {} diff --git a/src/app/components/common/location-link/location-link.component.spec.ts b/src/app/components/common/location-link/location-link.component.spec.ts index c70da479a..033da33c1 100644 --- a/src/app/components/common/location-link/location-link.component.spec.ts +++ b/src/app/components/common/location-link/location-link.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/common/location-link/location-link.component.ts b/src/app/components/common/location-link/location-link.component.ts index 147dca68e..20b18122b 100644 --- a/src/app/components/common/location-link/location-link.component.ts +++ b/src/app/components/common/location-link/location-link.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/common/logout/logout.component.spec.ts b/src/app/components/common/logout/logout.component.spec.ts new file mode 100644 index 000000000..25238020c --- /dev/null +++ b/src/app/components/common/logout/logout.component.spec.ts @@ -0,0 +1,70 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { + TranslateModule, + TranslateLoader, + TranslateFakeLoader +} from '@ngx-translate/core'; +import { LogoutComponent } from './logout.component'; +import { Store } from '@ngrx/store'; +import { SetSelectedNodesAction } from '@alfresco/aca-shared/store'; + +describe('LogoutComponent', () => { + let fixture: ComponentFixture; + let component: LogoutComponent; + let store; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [ + TranslateModule.forRoot({ + loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } + }) + ], + declarations: [LogoutComponent], + providers: [ + { + provide: Store, + useValue: { + dispatch: jasmine.createSpy('dispatch') + } + } + ] + }); + + store = TestBed.get(Store); + fixture = TestBed.createComponent(LogoutComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should reset selected nodes from store', () => { + component.onLogoutEvent(); + + expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([])); + }); +}); diff --git a/src/app/components/common/logout/logout.component.ts b/src/app/components/common/logout/logout.component.ts new file mode 100644 index 000000000..1c80efd71 --- /dev/null +++ b/src/app/components/common/logout/logout.component.ts @@ -0,0 +1,44 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Component } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { AppStore, SetSelectedNodesAction } from '@alfresco/aca-shared/store'; + +@Component({ + selector: 'aca-logout', + template: ` + + ` +}) +export class LogoutComponent { + constructor(private store: Store) {} + + onLogoutEvent() { + this.store.dispatch(new SetSelectedNodesAction([])); + } +} diff --git a/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts b/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts index 23196d2df..ffb28dd00 100644 --- a/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts +++ b/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/common/toggle-shared/toggle-shared.component.ts b/src/app/components/common/toggle-shared/toggle-shared.component.ts index 648c8b02c..dbb5769f6 100644 --- a/src/app/components/common/toggle-shared/toggle-shared.component.ts +++ b/src/app/components/common/toggle-shared/toggle-shared.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu-item.component.spec.ts b/src/app/components/context-menu/context-menu-item.component.spec.ts index 6d12244da..d38ee2f74 100644 --- a/src/app/components/context-menu/context-menu-item.component.spec.ts +++ b/src/app/components/context-menu/context-menu-item.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu-item.component.ts b/src/app/components/context-menu/context-menu-item.component.ts index f36986fc8..b01b06307 100644 --- a/src/app/components/context-menu/context-menu-item.component.ts +++ b/src/app/components/context-menu/context-menu-item.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu-outside-event.directive.spec.ts b/src/app/components/context-menu/context-menu-outside-event.directive.spec.ts index 59bb3ff1f..834d2b1f6 100644 --- a/src/app/components/context-menu/context-menu-outside-event.directive.spec.ts +++ b/src/app/components/context-menu/context-menu-outside-event.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu-outside-event.directive.ts b/src/app/components/context-menu/context-menu-outside-event.directive.ts index dafd86e75..d432295f6 100644 --- a/src/app/components/context-menu/context-menu-outside-event.directive.ts +++ b/src/app/components/context-menu/context-menu-outside-event.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu-overlay.ts b/src/app/components/context-menu/context-menu-overlay.ts index 2e9fc4705..84327437b 100644 --- a/src/app/components/context-menu/context-menu-overlay.ts +++ b/src/app/components/context-menu/context-menu-overlay.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu.component.spec.ts b/src/app/components/context-menu/context-menu.component.spec.ts index dab3d84a9..7fef437e5 100644 --- a/src/app/components/context-menu/context-menu.component.spec.ts +++ b/src/app/components/context-menu/context-menu.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu.component.ts b/src/app/components/context-menu/context-menu.component.ts index f72046871..9de503f9f 100644 --- a/src/app/components/context-menu/context-menu.component.ts +++ b/src/app/components/context-menu/context-menu.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu.module.ts b/src/app/components/context-menu/context-menu.module.ts index a6f298bd9..07d7e2e71 100644 --- a/src/app/components/context-menu/context-menu.module.ts +++ b/src/app/components/context-menu/context-menu.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -35,7 +35,7 @@ import { AppCommonModule } from '../common/common.module'; import { ContextMenuItemComponent } from './context-menu-item.component'; import { OutsideEventDirective } from './context-menu-outside-event.directive'; import { ContextMenuComponent } from './context-menu.component'; -import { ContextActionsDirective } from './context-menu.directive'; +import { ContextActionsModule } from '@alfresco/aca-shared'; @NgModule({ imports: [ @@ -46,19 +46,19 @@ import { ContextActionsDirective } from './context-menu.directive'; CoreExtensionsModule.forChild(), CoreModule.forChild(), AppCommonModule, - ExtensionsModule + ExtensionsModule, + ContextActionsModule ], declarations: [ - ContextActionsDirective, ContextMenuComponent, ContextMenuItemComponent, OutsideEventDirective ], exports: [ OutsideEventDirective, - ContextActionsDirective, ContextMenuComponent, - ContextMenuItemComponent + ContextMenuItemComponent, + ContextActionsModule ], entryComponents: [ContextMenuComponent] }) diff --git a/src/app/components/context-menu/context-menu.service.spec.ts b/src/app/components/context-menu/context-menu.service.spec.ts index db0c30fb3..00730544b 100644 --- a/src/app/components/context-menu/context-menu.service.spec.ts +++ b/src/app/components/context-menu/context-menu.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/context-menu.service.ts b/src/app/components/context-menu/context-menu.service.ts index 4787e43e9..204661ca2 100644 --- a/src/app/components/context-menu/context-menu.service.ts +++ b/src/app/components/context-menu/context-menu.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/direction.token.ts b/src/app/components/context-menu/direction.token.ts index 07eca2e5c..4186c92cb 100644 --- a/src/app/components/context-menu/direction.token.ts +++ b/src/app/components/context-menu/direction.token.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/context-menu/interfaces.ts b/src/app/components/context-menu/interfaces.ts index e28b55216..139574c1f 100644 --- a/src/app/components/context-menu/interfaces.ts +++ b/src/app/components/context-menu/interfaces.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/create-menu/create-menu.component.spec.ts b/src/app/components/create-menu/create-menu.component.spec.ts index 0c426677c..f3a542f3e 100644 --- a/src/app/components/create-menu/create-menu.component.spec.ts +++ b/src/app/components/create-menu/create-menu.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/create-menu/create-menu.component.ts b/src/app/components/create-menu/create-menu.component.ts index 158c95331..019b516d2 100644 --- a/src/app/components/create-menu/create-menu.component.ts +++ b/src/app/components/create-menu/create-menu.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/create-menu/create-menu.module.ts b/src/app/components/create-menu/create-menu.module.ts index 841b80c29..aec531ad8 100644 --- a/src/app/components/create-menu/create-menu.module.ts +++ b/src/app/components/create-menu/create-menu.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/current-user/current-user.component.html b/src/app/components/current-user/current-user.component.html index a823127cb..87092e647 100644 --- a/src/app/components/current-user/current-user.component.html +++ b/src/app/components/current-user/current-user.component.html @@ -13,21 +13,10 @@ - - - - + + - - - - diff --git a/src/app/components/current-user/current-user.component.spec.ts b/src/app/components/current-user/current-user.component.spec.ts index cfb33145b..56528415d 100644 --- a/src/app/components/current-user/current-user.component.spec.ts +++ b/src/app/components/current-user/current-user.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -24,9 +24,91 @@ */ import { CurrentUserComponent } from './current-user.component'; +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { AppTestingModule } from '../../testing/app-testing.module'; +import { AppExtensionService } from '../../extensions/extension.service'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { + AppState, + SetUserProfileAction, + SetLanguagePickerAction +} from '@alfresco/aca-shared/store'; describe('CurrentUserComponent', () => { - it('should be defined', () => { - expect(CurrentUserComponent).toBeDefined(); + let fixture: ComponentFixture; + let component: CurrentUserComponent; + let appExtensionService; + let store: Store; + const person = { + entry: { + id: 'user-id', + firstName: 'Test', + lastName: 'User', + email: 'user@email.com', + enabled: true, + isAdmin: false, + userName: 'user-name' + } + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [AppTestingModule], + declarations: [CurrentUserComponent], + providers: [AppExtensionService], + schemas: [NO_ERRORS_SCHEMA] + }); + + fixture = TestBed.createComponent(CurrentUserComponent); + appExtensionService = TestBed.get(AppExtensionService); + store = TestBed.get(Store); + component = fixture.componentInstance; + }); + + it('should get profile data', done => { + const expectedProfile = { + firstName: 'Test', + lastName: 'User', + userName: 'Test User', + isAdmin: true, + id: 'user-id', + groups: [] + }; + + fixture.detectChanges(); + + store.dispatch( + new SetUserProfileAction({ person: person.entry, groups: [] }) + ); + + component.profile$.subscribe((profile: any) => { + expect(profile).toEqual(jasmine.objectContaining(expectedProfile)); + done(); + }); + }); + + it('should set language picker state', done => { + fixture.detectChanges(); + + store.dispatch(new SetLanguagePickerAction(true)); + + component.languagePicker$.subscribe((languagePicker: boolean) => { + expect(languagePicker).toBe(true); + done(); + }); + }); + + it('should set menu actions', () => { + const actions = [ + { + id: 'action-id' + } + ]; + spyOn(appExtensionService, 'getUserActions').and.returnValue(actions); + + fixture.detectChanges(); + + expect(component.actions).toBe(actions); }); }); diff --git a/src/app/components/current-user/current-user.component.ts b/src/app/components/current-user/current-user.component.ts index 8016bc6a6..0eb31b7c5 100644 --- a/src/app/components/current-user/current-user.component.ts +++ b/src/app/components/current-user/current-user.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,17 +23,16 @@ * along with Alfresco. If not, see . */ -import { Component, ViewEncapsulation } from '@angular/core'; +import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; -import { ProfileState } from '@alfresco/adf-extensions'; +import { ProfileState, ContentActionRef } from '@alfresco/adf-extensions'; import { AppStore, - SetSelectedNodesAction, getUserProfile, getLanguagePickerState } from '@alfresco/aca-shared/store'; -import { AppService } from '@alfresco/aca-shared'; +import { AppExtensionService } from '../../extensions/extension.service'; @Component({ selector: 'aca-current-user', @@ -41,20 +40,23 @@ import { AppService } from '@alfresco/aca-shared'; encapsulation: ViewEncapsulation.None, host: { class: 'aca-current-user' } }) -export class CurrentUserComponent { +export class CurrentUserComponent implements OnInit { profile$: Observable; languagePicker$: Observable; + actions: Array = []; - get showLogout(): boolean { - return !this.appService.withCredentials; - } + constructor( + private store: Store, + private extensions: AppExtensionService + ) {} - constructor(private store: Store, private appService: AppService) { + ngOnInit() { this.profile$ = this.store.select(getUserProfile); - this.languagePicker$ = store.select(getLanguagePickerState); + this.languagePicker$ = this.store.select(getLanguagePickerState); + this.actions = this.extensions.getUserActions(); } - onLogoutEvent() { - this.store.dispatch(new SetSelectedNodesAction([])); + trackByActionId(_: number, action: ContentActionRef) { + return action.id; } } diff --git a/src/app/components/current-user/current-user.module.ts b/src/app/components/current-user/current-user.module.ts index 2fa14bc3b..daae25067 100644 --- a/src/app/components/current-user/current-user.module.ts +++ b/src/app/components/current-user/current-user.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -26,12 +26,19 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CoreModule } from '@alfresco/adf-core'; +import { ExtensionsModule } from '@alfresco/adf-extensions'; import { CurrentUserComponent } from './current-user.component'; +import { UserMenuItemComponent } from './user-menu-item.component'; import { RouterModule } from '@angular/router'; @NgModule({ - imports: [CommonModule, CoreModule.forChild(), RouterModule], - declarations: [CurrentUserComponent], - exports: [CurrentUserComponent] + imports: [ + CommonModule, + CoreModule.forChild(), + RouterModule, + ExtensionsModule + ], + declarations: [CurrentUserComponent, UserMenuItemComponent], + exports: [CurrentUserComponent, UserMenuItemComponent] }) export class AppCurrentUserModule {} diff --git a/src/app/components/current-user/user-menu-item.component.html b/src/app/components/current-user/user-menu-item.component.html new file mode 100644 index 000000000..a6209b143 --- /dev/null +++ b/src/app/components/current-user/user-menu-item.component.html @@ -0,0 +1,36 @@ + diff --git a/src/app/components/current-user/user-menu-item.component.spec.ts b/src/app/components/current-user/user-menu-item.component.spec.ts new file mode 100644 index 000000000..e27337a85 --- /dev/null +++ b/src/app/components/current-user/user-menu-item.component.spec.ts @@ -0,0 +1,126 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { AppTestingModule } from '../../testing/app-testing.module'; +import { AppExtensionService } from '../../extensions/extension.service'; +import { UserMenuItemComponent } from './user-menu-item.component'; +import { + TranslateModule, + TranslateLoader, + TranslateFakeLoader +} from '@ngx-translate/core'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ContentActionRef } from '@alfresco/adf-extensions'; + +describe('UserMenuItemComponent', () => { + let fixture: ComponentFixture; + let component: UserMenuItemComponent; + let appExtensionService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [ + AppTestingModule, + TranslateModule.forRoot({ + loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } + }) + ], + declarations: [UserMenuItemComponent], + providers: [AppExtensionService], + schemas: [NO_ERRORS_SCHEMA] + }); + + fixture = TestBed.createComponent(UserMenuItemComponent); + appExtensionService = TestBed.get(AppExtensionService); + component = fixture.componentInstance; + }); + + afterEach(() => { + fixture.destroy(); + }); + + it('should render button action', () => { + component.actionRef = { + id: 'action-button', + title: 'Test Button', + actions: { + click: 'TEST_EVENT' + } + } as ContentActionRef; + fixture.detectChanges(); + + const buttonElement = fixture.nativeElement.querySelector('#action-button'); + expect(buttonElement).not.toBe(null); + }); + + it('should render menu action', () => { + component.actionRef = { + type: 'menu', + id: 'action-menu', + title: 'Test Button', + actions: { + click: 'TEST_EVENT' + } + } as ContentActionRef; + fixture.detectChanges(); + + const menuElement = fixture.nativeElement.querySelector('#action-menu'); + expect(menuElement).not.toBe(null); + }); + + it('should render custom action', () => { + component.actionRef = { + type: 'custom', + id: 'action-custom', + component: 'custom-component' + } as ContentActionRef; + fixture.detectChanges(); + + const componentElement = fixture.nativeElement.querySelector( + '#custom-component' + ); + expect(componentElement).not.toBe(null); + }); + + it('should run defined action', () => { + spyOn(appExtensionService, 'runActionById'); + + component.actionRef = { + id: 'action-button', + title: 'Test Button', + actions: { + click: 'TEST_EVENT' + } + } as ContentActionRef; + fixture.detectChanges(); + + const buttonElement = fixture.nativeElement.querySelector('#action-button'); + buttonElement.dispatchEvent(new MouseEvent('click')); + expect(appExtensionService.runActionById).toHaveBeenCalledWith( + 'TEST_EVENT' + ); + }); +}); diff --git a/src/app/components/current-user/user-menu-item.component.ts b/src/app/components/current-user/user-menu-item.component.ts new file mode 100644 index 000000000..4ab52944e --- /dev/null +++ b/src/app/components/current-user/user-menu-item.component.ts @@ -0,0 +1,58 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Component, Input, ViewEncapsulation } from '@angular/core'; +import { ContentActionRef } from '@alfresco/adf-extensions'; +import { AppExtensionService } from '../../extensions/extension.service'; + +@Component({ + selector: 'app-user-menu-item', + templateUrl: 'user-menu-item.component.html', + encapsulation: ViewEncapsulation.None, + host: { class: 'app-user-menu-item' } +}) +export class UserMenuItemComponent { + @Input() + actionRef: ContentActionRef; + + constructor(private extensions: AppExtensionService) {} + + runAction() { + if (this.hasClickAction(this.actionRef)) { + this.extensions.runActionById(this.actionRef.actions.click); + } + } + + private hasClickAction(actionRef: ContentActionRef): boolean { + if (actionRef && actionRef.actions && actionRef.actions.click) { + return true; + } + return false; + } + + trackById(_: number, obj: { id: string }) { + return obj.id; + } +} diff --git a/src/app/components/dl-custom-components/document-list-custom-components.module.ts b/src/app/components/dl-custom-components/document-list-custom-components.module.ts index 60fa315af..12058e56a 100644 --- a/src/app/components/dl-custom-components/document-list-custom-components.module.ts +++ b/src/app/components/dl-custom-components/document-list-custom-components.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -26,7 +26,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { CustomNameColumnComponent } from './name-column/name-column.component'; -import { LockByComponent } from './locked-by/locked-by.component'; +import { LockedByModule } from '@alfresco/aca-shared'; import { ContentModule } from '@alfresco/adf-content-services'; import { MaterialModule } from '../../material.module'; import { CoreModule } from '@alfresco/adf-core'; @@ -36,10 +36,11 @@ import { CoreModule } from '@alfresco/adf-core'; BrowserModule, CoreModule.forChild(), ContentModule.forChild(), - MaterialModule + MaterialModule, + LockedByModule ], - declarations: [CustomNameColumnComponent, LockByComponent], - exports: [CustomNameColumnComponent, LockByComponent], - entryComponents: [CustomNameColumnComponent, LockByComponent] + declarations: [CustomNameColumnComponent], + exports: [CustomNameColumnComponent], + entryComponents: [CustomNameColumnComponent] }) export class DocumentListCustomComponentsModule {} diff --git a/src/app/components/dl-custom-components/name-column/name-column.component.html b/src/app/components/dl-custom-components/name-column/name-column.component.html index 6d9a13f8d..0211f5288 100644 --- a/src/app/components/dl-custom-components/name-column/name-column.component.html +++ b/src/app/components/dl-custom-components/name-column/name-column.component.html @@ -17,7 +17,7 @@ " class="adf-datatable-cell-value" title="{{ node | adfNodeNameTooltip }}" - (click)="onClick()" + (click)="onLinkClick($event)" > {{ displayText$ | async }} diff --git a/src/app/components/dl-custom-components/name-column/name-column.component.spec.ts b/src/app/components/dl-custom-components/name-column/name-column.component.spec.ts index 166831681..44ef7705d 100644 --- a/src/app/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/src/app/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -105,4 +105,21 @@ describe('CustomNameColumnComponent', () => { fixture.debugElement.nativeElement.querySelector('aca-locked-by') ).not.toBe(null); }); + + it('should call parent component onClick method', () => { + const event = new MouseEvent('click'); + spyOn(component, 'onClick'); + + component.onLinkClick(event); + + expect(component.onClick).toHaveBeenCalled(); + }); + + it('should prevent event propagation', () => { + const event = new MouseEvent('click'); + spyOn(event, 'stopPropagation'); + + component.onLinkClick(event); + expect(event.stopPropagation).toHaveBeenCalled(); + }); }); diff --git a/src/app/components/dl-custom-components/name-column/name-column.component.ts b/src/app/components/dl-custom-components/name-column/name-column.component.ts index 3a34def4d..e23ce9723 100644 --- a/src/app/components/dl-custom-components/name-column/name-column.component.ts +++ b/src/app/components/dl-custom-components/name-column/name-column.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -37,7 +37,7 @@ import { Actions, ofType } from '@ngrx/effects'; import { Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; import { NodeActionTypes } from '@alfresco/aca-shared/store'; -import { isLocked } from '../../../utils/node.utils'; +import { isLocked } from '@alfresco/aca-shared'; @Component({ selector: 'aca-custom-name-column', @@ -94,6 +94,11 @@ export class CustomNameColumnComponent extends NameColumnComponent }); } + onLinkClick(event: Event) { + event.stopPropagation(); + this.onClick(); + } + ngOnDestroy() { super.ngOnDestroy(); diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.html b/src/app/components/favorite-libraries/favorite-libraries.component.html index 0e986ca6c..71e1257b7 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.html +++ b/src/app/components/favorite-libraries/favorite-libraries.component.html @@ -79,6 +79,7 @@ { this.list = null; diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html index 27148c698..009cb074f 100644 --- a/src/app/components/favorites/favorites.component.html +++ b/src/app/components/favorites/favorites.component.html @@ -20,6 +20,7 @@ selectionMode="multiple" [navigate]="false" [sorting]="['modifiedAt', 'desc']" + [imageResolver]="imageResolver" (node-dblclick)="onNodeDoubleClick($event.detail?.node)" (name-click)="onNodeDoubleClick($event.detail?.node)" > diff --git a/src/app/components/favorites/favorites.component.spec.ts b/src/app/components/favorites/favorites.component.spec.ts index 20298cbe5..c7808a305 100644 --- a/src/app/components/favorites/favorites.component.spec.ts +++ b/src/app/components/favorites/favorites.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/favorites/favorites.component.ts b/src/app/components/favorites/favorites.component.ts index 591f6e4b4..2f8428bfc 100644 --- a/src/app/components/favorites/favorites.component.ts +++ b/src/app/components/favorites/favorites.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/files/files.component.spec.ts b/src/app/components/files/files.component.spec.ts index 8a0800ec7..9c07df790 100644 --- a/src/app/components/files/files.component.spec.ts +++ b/src/app/components/files/files.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/files/files.component.ts b/src/app/components/files/files.component.ts index 59b2c8d85..2c5728fd8 100644 --- a/src/app/components/files/files.component.ts +++ b/src/app/components/files/files.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/header/header.component.spec.ts b/src/app/components/header/header.component.spec.ts index 67c6e71ce..79547edda 100644 --- a/src/app/components/header/header.component.spec.ts +++ b/src/app/components/header/header.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/header/header.component.ts b/src/app/components/header/header.component.ts index 5d08c243c..4f8b8c3bd 100644 --- a/src/app/components/header/header.component.ts +++ b/src/app/components/header/header.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/header/header.module.ts b/src/app/components/header/header.module.ts index ebb368710..ea81301fb 100644 --- a/src/app/components/header/header.module.ts +++ b/src/app/components/header/header.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts index 35a502ff1..88211e7a2 100644 --- a/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts +++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts index aef6adb6e..4a42d4f8f 100644 --- a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts +++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -25,8 +25,7 @@ import { Component, Input } from '@angular/core'; import { MinimalNodeEntryEntity } from '@alfresco/js-api'; -import { NodePermissionService } from '@alfresco/aca-shared'; -import { isLocked } from '../../../utils/node.utils'; +import { NodePermissionService, isLocked } from '@alfresco/aca-shared'; @Component({ selector: 'app-comments-tab', diff --git a/src/app/components/info-drawer/info-drawer.component.html b/src/app/components/info-drawer/info-drawer.component.html index 8cf1471d7..9a57ca301 100644 --- a/src/app/components/info-drawer/info-drawer.component.html +++ b/src/app/components/info-drawer/info-drawer.component.html @@ -2,7 +2,11 @@ - + { expect(component.displayNode).toBe(response); expect(contentApiService.getNodeInfo).toHaveBeenCalled(); })); + + it('should dispatch close panel on Esc keyboard event', () => { + const event = new KeyboardEvent('keydown', { + code: 'Escape', + key: 'Escape', + keyCode: 27 + } as KeyboardEventInit); + + fixture.detectChanges(); + + fixture.debugElement.nativeElement.dispatchEvent(event); + + expect(storeMock.dispatch).toHaveBeenCalledWith( + new ToggleInfoDrawerAction() + ); + }); }); diff --git a/src/app/components/info-drawer/info-drawer.component.ts b/src/app/components/info-drawer/info-drawer.component.ts index 447080b89..97b24d35e 100644 --- a/src/app/components/info-drawer/info-drawer.component.ts +++ b/src/app/components/info-drawer/info-drawer.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,7 +23,14 @@ * along with Alfresco. If not, see . */ -import { Component, Input, OnChanges, OnInit, OnDestroy } from '@angular/core'; +import { + Component, + HostListener, + Input, + OnChanges, + OnInit, + OnDestroy +} from '@angular/core'; import { MinimalNodeEntity, MinimalNodeEntryEntity, @@ -33,7 +40,10 @@ import { ContentApiService } from '@alfresco/aca-shared'; import { AppExtensionService } from '../../extensions/extension.service'; import { SidebarTabRef } from '@alfresco/adf-extensions'; import { Store } from '@ngrx/store'; -import { SetInfoDrawerStateAction } from '@alfresco/aca-shared/store'; +import { + SetInfoDrawerStateAction, + ToggleInfoDrawerAction +} from '@alfresco/aca-shared/store'; @Component({ selector: 'aca-info-drawer', @@ -49,6 +59,11 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy { displayNode: MinimalNodeEntryEntity | SiteEntry; tabs: Array = []; + @HostListener('keydown.escape', ['$event']) + onEscapeKeyboardEvent(event: KeyboardEvent): void { + this.close(); + } + constructor( private store: Store, private contentApi: ContentApiService, @@ -76,6 +91,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy { } } + private close() { + this.store.dispatch(new ToggleInfoDrawerAction()); + } + private loadNodeInfo(nodeId: string) { if (nodeId) { this.isLoading = true; diff --git a/src/app/components/info-drawer/info.drawer.module.ts b/src/app/components/info-drawer/info.drawer.module.ts index 9ec8afd25..ee16822ce 100644 --- a/src/app/components/info-drawer/info.drawer.module.ts +++ b/src/app/components/info-drawer/info.drawer.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -39,6 +39,7 @@ import { MetadataTabComponent } from './metadata-tab/metadata-tab.component'; import { LibraryMetadataTabComponent } from './library-metadata-tab/library-metadata-tab.component'; import { LibraryMetadataFormComponent } from './library-metadata-tab/library-metadata-form.component'; import { VersionsTabComponent } from './versions-tab/versions-tab.component'; +import { A11yModule } from '@angular/cdk/a11y'; export function components() { return [ @@ -59,7 +60,8 @@ export function components() { ExtensionsModule, ContentMetadataModule, VersionManagerModule, - DirectivesModule + DirectivesModule, + A11yModule ], declarations: [...components()], exports: [...components()], diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts index a35a7c1c5..63bf29e79 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts index f9eb73ea1..70b8d2016 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts index 0ee61c28b..a783b9a72 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts index 6676e2dc8..0a514cbb6 100644 --- a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts +++ b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts index f82ef5bc8..33fc05e35 100644 --- a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts +++ b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -31,11 +31,10 @@ import { OnDestroy } from '@angular/core'; import { MinimalNodeEntryEntity } from '@alfresco/js-api'; -import { NodePermissionService } from '@alfresco/aca-shared'; +import { NodePermissionService, isLocked } from '@alfresco/aca-shared'; import { AppStore, infoDrawerMetadataAspect } from '@alfresco/aca-shared/store'; import { AppExtensionService } from '../../../extensions/extension.service'; import { AppConfigService, NotificationService } from '@alfresco/adf-core'; -import { isLocked } from '../../../utils/node.utils'; import { Observable, Subject } from 'rxjs'; import { Store } from '@ngrx/store'; import { ContentMetadataService } from '@alfresco/adf-content-services'; diff --git a/src/app/components/info-drawer/versions-tab/versions-tab.component.spec.ts b/src/app/components/info-drawer/versions-tab/versions-tab.component.spec.ts index f883619ac..3048c6ae3 100644 --- a/src/app/components/info-drawer/versions-tab/versions-tab.component.spec.ts +++ b/src/app/components/info-drawer/versions-tab/versions-tab.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/info-drawer/versions-tab/versions-tab.component.ts b/src/app/components/info-drawer/versions-tab/versions-tab.component.ts index f75912f41..0ecc02c95 100644 --- a/src/app/components/info-drawer/versions-tab/versions-tab.component.ts +++ b/src/app/components/info-drawer/versions-tab/versions-tab.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/layout/app-layout/app-layout.component.spec.ts b/src/app/components/layout/app-layout/app-layout.component.spec.ts index 9ed6baa1b..a8e326030 100644 --- a/src/app/components/layout/app-layout/app-layout.component.spec.ts +++ b/src/app/components/layout/app-layout/app-layout.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/layout/app-layout/app-layout.component.ts b/src/app/components/layout/app-layout/app-layout.component.ts index 3dbe0b332..3ebd604fd 100644 --- a/src/app/components/layout/app-layout/app-layout.component.ts +++ b/src/app/components/layout/app-layout/app-layout.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -70,7 +70,7 @@ export class AppLayoutComponent implements OnInit, OnDestroy { direction: Directionality; private minimizeConditions: string[] = ['search']; - private hideConditions: string[] = ['preview']; + private hideConditions: string[] = ['/preview/']; constructor( protected store: Store, diff --git a/src/app/components/layout/layout.module.ts b/src/app/components/layout/layout.module.ts index b543026b9..5bb1275a5 100644 --- a/src/app/components/layout/layout.module.ts +++ b/src/app/components/layout/layout.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/libraries/libraries.component.spec.ts b/src/app/components/libraries/libraries.component.spec.ts index fe71fcdc3..f11fa2108 100644 --- a/src/app/components/libraries/libraries.component.spec.ts +++ b/src/app/components/libraries/libraries.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/libraries/libraries.component.ts b/src/app/components/libraries/libraries.component.ts index a5747ddb1..d36e4353b 100644 --- a/src/app/components/libraries/libraries.component.ts +++ b/src/app/components/libraries/libraries.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/login/login.component.ts b/src/app/components/login/login.component.ts index fed1ff9ee..0b18a4742 100644 --- a/src/app/components/login/login.component.ts +++ b/src/app/components/login/login.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/login/login.module.ts b/src/app/components/login/login.module.ts index 2bb32f0e6..a5ed6f199 100644 --- a/src/app/components/login/login.module.ts +++ b/src/app/components/login/login.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/node-version/node-version-form.component.spec.ts b/src/app/components/node-version/node-version-form.component.spec.ts index 2440c3ac5..e18a1e2ee 100644 --- a/src/app/components/node-version/node-version-form.component.spec.ts +++ b/src/app/components/node-version/node-version-form.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/node-version/node-version-form.component.ts b/src/app/components/node-version/node-version-form.component.ts index 9406b3255..1845a46f7 100644 --- a/src/app/components/node-version/node-version-form.component.ts +++ b/src/app/components/node-version/node-version-form.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/node-version/node-version.module.ts b/src/app/components/node-version/node-version.module.ts index f064c8f8c..6213f12c3 100644 --- a/src/app/components/node-version/node-version.module.ts +++ b/src/app/components/node-version/node-version.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/page.component.spec.ts b/src/app/components/page.component.spec.ts index b07b211f2..fd690f498 100644 --- a/src/app/components/page.component.spec.ts +++ b/src/app/components/page.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -23,21 +23,55 @@ * along with Alfresco. If not, see . */ +import { TestBed, ComponentFixture } from '@angular/core/testing'; import { PageComponent } from './page.component'; +import { + ReloadDocumentListAction, + SetSelectedNodesAction, + SetInfoDrawerStateAction, + AppState, + AppStore +} from '@alfresco/aca-shared/store'; +import { MinimalNodeEntity } from '@alfresco/js-api'; +import { ContentManagementService } from '../services/content-management.service'; +import { EffectsModule } from '@ngrx/effects'; +import { ViewerEffects } from '../store/effects'; +import { Store } from '@ngrx/store'; +import { AppExtensionService } from '../extensions/extension.service'; +import { AppTestingModule } from '../testing/app-testing.module'; +import { Component } from '@angular/core'; -class TestClass extends PageComponent { +@Component({ + selector: 'aca-test', + template: '' +}) +class TestComponent extends PageComponent { node: any; - constructor() { - super(null, null, null); + constructor( + store: Store, + extensions: AppExtensionService, + content: ContentManagementService + ) { + super(store, extensions, content); } } describe('PageComponent', () => { - let component: TestClass; + let component: TestComponent; + let store: Store; + let fixture: ComponentFixture; beforeEach(() => { - component = new TestClass(); + TestBed.configureTestingModule({ + imports: [AppTestingModule, EffectsModule.forRoot([ViewerEffects])], + declarations: [TestComponent], + providers: [ContentManagementService, AppExtensionService] + }); + + store = TestBed.get(Store); + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; }); describe('getParentNodeId()', () => { @@ -53,4 +87,79 @@ describe('PageComponent', () => { expect(component.getParentNodeId()).toBe(null); }); }); + + describe('Info Drawer state', () => { + const locationHref = location.href; + + afterEach(() => { + window.history.pushState({}, null, locationHref); + }); + + it('should open info drawer on action event', done => { + window.history.pushState({}, null, `${locationHref}#test`); + fixture.detectChanges(); + + fixture.whenStable().then(() => { + component.infoDrawerOpened$.subscribe(state => { + expect(state).toBe(true); + done(); + }); + }); + + store.dispatch(new SetInfoDrawerStateAction(true)); + }); + + it('should not open info drawer if viewer outlet is active', done => { + window.history.pushState({}, null, `${locationHref}#test(viewer:view)`); + fixture.detectChanges(); + + fixture.whenStable().then(() => { + component.infoDrawerOpened$.subscribe(state => { + expect(state).toBe(false); + done(); + }); + }); + + store.dispatch(new SetInfoDrawerStateAction(true)); + }); + }); + + describe('Reload', () => { + const locationHref = location.href; + + afterEach(() => { + window.history.pushState({}, null, locationHref); + }); + + it('should not reload if url contains viewer outlet', () => { + window.history.pushState({}, null, `${locationHref}#test(viewer:view)`); + spyOn(store, 'dispatch'); + + component.reload(); + expect(store.dispatch).not.toHaveBeenCalled(); + }); + + it('should reload if url does not contain viewer outlet', () => { + spyOn(store, 'dispatch'); + + component.reload(); + expect(store.dispatch).toHaveBeenCalledWith( + new ReloadDocumentListAction() + ); + }); + + it('should set selection after reload if node is passed', () => { + const node = { + entry: { + id: 'node-id' + } + } as MinimalNodeEntity; + spyOn(store, 'dispatch'); + + component.reload(node); + expect(store.dispatch['calls'].mostRecent().args[0]).toEqual( + new SetSelectedNodesAction([node]) + ); + }); + }); }); diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index 2dc13c691..3c76019d0 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -32,7 +32,7 @@ import { OnDestroy, OnInit, ViewChild } from '@angular/core'; import { Store } from '@ngrx/store'; import { MinimalNodeEntity, MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Observable, Subject, Subscription } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; +import { takeUntil, map } from 'rxjs/operators'; import { AppExtensionService } from '../extensions/extension.service'; import { ContentManagementService } from '../services/content-management.service'; import { @@ -47,7 +47,7 @@ import { ViewNodeExtras, SetSelectedNodesAction } from '@alfresco/aca-shared/store'; -import { isLocked, isLibrary } from '../utils/node.utils'; +import { isLocked, isLibrary } from '@alfresco/aca-shared'; export abstract class PageComponent implements OnInit, OnDestroy { onDestroy$: Subject = new Subject(); @@ -76,7 +76,12 @@ export abstract class PageComponent implements OnInit, OnDestroy { ngOnInit() { this.sharedPreviewUrl$ = this.store.select(getSharedUrl); - this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened); + this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened).pipe( + map(infoDrawerState => { + return !this.isOutletPreviewUrl() && infoDrawerState; + }) + ); + this.documentDisplayMode$ = this.store.select(getDocumentDisplayMode); this.store @@ -133,6 +138,10 @@ export abstract class PageComponent implements OnInit, OnDestroy { } reload(selectedNode?: MinimalNodeEntity): void { + if (this.isOutletPreviewUrl()) { + return; + } + this.store.dispatch(new ReloadDocumentListAction()); if (selectedNode) { this.store.dispatch(new SetSelectedNodesAction([selectedNode])); @@ -146,4 +155,8 @@ export abstract class PageComponent implements OnInit, OnDestroy { trackById(_: number, obj: { id: string }) { return obj.id; } + + private isOutletPreviewUrl(): boolean { + return location.href.includes('viewer:view'); + } } diff --git a/src/app/components/permissions/permission-dialog/node-permissions.dialog.html b/src/app/components/permissions/permission-dialog/node-permissions.dialog.html index dcd7a180c..c4ad08e2e 100644 --- a/src/app/components/permissions/permission-dialog/node-permissions.dialog.html +++ b/src/app/components/permissions/permission-dialog/node-permissions.dialog.html @@ -1,4 +1,6 @@ -
{{'PERMISSIONS.DIALOG.TITLE' | translate}}
+
+ {{'PERMISSIONS.DIALOG.TITLE' | translate}} +
diff --git a/src/app/components/permissions/permission-dialog/node-permissions.dialog.spec.ts b/src/app/components/permissions/permission-dialog/node-permissions.dialog.spec.ts index 9b9aa947a..5aef3d242 100644 --- a/src/app/components/permissions/permission-dialog/node-permissions.dialog.spec.ts +++ b/src/app/components/permissions/permission-dialog/node-permissions.dialog.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts b/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts index 21964cf2e..077194161 100644 --- a/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts +++ b/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/permissions/permission-manager/permission-manager.component.spec.ts b/src/app/components/permissions/permission-manager/permission-manager.component.spec.ts index 14b7bb219..40456104e 100644 --- a/src/app/components/permissions/permission-manager/permission-manager.component.spec.ts +++ b/src/app/components/permissions/permission-manager/permission-manager.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/permissions/permission-manager/permission-manager.component.ts b/src/app/components/permissions/permission-manager/permission-manager.component.ts index 90586a6cf..081d2121f 100644 --- a/src/app/components/permissions/permission-manager/permission-manager.component.ts +++ b/src/app/components/permissions/permission-manager/permission-manager.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/permissions/permissions.module.ts b/src/app/components/permissions/permissions.module.ts index 75b524cea..31582718f 100644 --- a/src/app/components/permissions/permissions.module.ts +++ b/src/app/components/permissions/permissions.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/preview/preview.component.spec.ts b/src/app/components/preview/preview.component.spec.ts index ccff15fba..3ea20c9c7 100644 --- a/src/app/components/preview/preview.component.spec.ts +++ b/src/app/components/preview/preview.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/preview/preview.component.ts b/src/app/components/preview/preview.component.ts index e0211aa4b..c5229741a 100644 --- a/src/app/components/preview/preview.component.ts +++ b/src/app/components/preview/preview.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/preview/preview.module.ts b/src/app/components/preview/preview.module.ts index de14caae6..80f879c53 100644 --- a/src/app/components/preview/preview.module.ts +++ b/src/app/components/preview/preview.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/recent-files/recent-files.component.spec.ts b/src/app/components/recent-files/recent-files.component.spec.ts index 71ae7ad17..5b3f5b043 100644 --- a/src/app/components/recent-files/recent-files.component.spec.ts +++ b/src/app/components/recent-files/recent-files.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/recent-files/recent-files.component.ts b/src/app/components/recent-files/recent-files.component.ts index 9033c053e..0607edd55 100644 --- a/src/app/components/recent-files/recent-files.component.ts +++ b/src/app/components/recent-files/recent-files.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-input-control/search-input-control.component.spec.ts b/src/app/components/search/search-input-control/search-input-control.component.spec.ts index 5cf07287f..5c305ec13 100644 --- a/src/app/components/search/search-input-control/search-input-control.component.spec.ts +++ b/src/app/components/search/search-input-control/search-input-control.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-input-control/search-input-control.component.ts b/src/app/components/search/search-input-control/search-input-control.component.ts index 41d451912..65286d627 100644 --- a/src/app/components/search/search-input-control/search-input-control.component.ts +++ b/src/app/components/search/search-input-control/search-input-control.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-input.module.ts b/src/app/components/search/search-input.module.ts index a1da93eb4..7ffe74145 100644 --- a/src/app/components/search/search-input.module.ts +++ b/src/app/components/search/search-input.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-input/search-input.component.spec.ts b/src/app/components/search/search-input/search-input.component.spec.ts index 184ce28f5..7639bb38f 100644 --- a/src/app/components/search/search-input/search-input.component.spec.ts +++ b/src/app/components/search/search-input/search-input.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-input/search-input.component.ts b/src/app/components/search/search-input/search-input.component.ts index bb9b0c71e..89b5f3323 100644 --- a/src/app/components/search/search-input/search-input.component.ts +++ b/src/app/components/search/search-input/search-input.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.spec.ts b/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.spec.ts index dc39ffd61..7fa15a839 100644 --- a/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.spec.ts +++ b/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.ts b/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.ts index 6e321419f..da852a5f7 100644 --- a/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.ts +++ b/src/app/components/search/search-libraries-results/search-libraries-query-builder.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-libraries-results/search-libraries-results.component.spec.ts b/src/app/components/search/search-libraries-results/search-libraries-results.component.spec.ts index 06d1fb337..669bff593 100644 --- a/src/app/components/search/search-libraries-results/search-libraries-results.component.spec.ts +++ b/src/app/components/search/search-libraries-results/search-libraries-results.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-libraries-results/search-libraries-results.component.ts b/src/app/components/search/search-libraries-results/search-libraries-results.component.ts index 691591dd7..9169cfaab 100644 --- a/src/app/components/search/search-libraries-results/search-libraries-results.component.ts +++ b/src/app/components/search/search-libraries-results/search-libraries-results.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-results-row/search-results-row.component.ts b/src/app/components/search/search-results-row/search-results-row.component.ts index 4a9612ce6..d0540a216 100644 --- a/src/app/components/search/search-results-row/search-results-row.component.ts +++ b/src/app/components/search/search-results-row/search-results-row.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-results-row/search-results-row.components.spec.ts b/src/app/components/search/search-results-row/search-results-row.components.spec.ts index e342316f0..0798cd597 100644 --- a/src/app/components/search/search-results-row/search-results-row.components.spec.ts +++ b/src/app/components/search/search-results-row/search-results-row.components.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-results.module.ts b/src/app/components/search/search-results.module.ts index b669a5610..db43d59fd 100644 --- a/src/app/components/search/search-results.module.ts +++ b/src/app/components/search/search-results.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-results/search-results.component.html b/src/app/components/search/search-results/search-results.component.html index 01befdeb4..af905470b 100644 --- a/src/app/components/search/search-results/search-results.component.html +++ b/src/app/components/search/search-results/search-results.component.html @@ -69,6 +69,7 @@ [selectionMode]="'multiple'" [sortingMode]="'server'" [sorting]="sorting" + [imageResolver]="imageResolver" [node]="data" (node-dblclick)="onNodeDoubleClick($event.detail?.node)" > diff --git a/src/app/components/search/search-results/search-results.component.spec.ts b/src/app/components/search/search-results/search-results.component.spec.ts index 209a63886..43f653602 100644 --- a/src/app/components/search/search-results/search-results.component.spec.ts +++ b/src/app/components/search/search-results/search-results.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/search/search-results/search-results.component.ts b/src/app/components/search/search-results/search-results.component.ts index 889a6af8e..4eb11baa5 100644 --- a/src/app/components/search/search-results/search-results.component.ts +++ b/src/app/components/search/search-results/search-results.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/settings/settings.component.spec.ts b/src/app/components/settings/settings.component.spec.ts index 4db4644d6..8baf89d4d 100644 --- a/src/app/components/settings/settings.component.spec.ts +++ b/src/app/components/settings/settings.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/settings/settings.component.ts b/src/app/components/settings/settings.component.ts index 157b03ca9..1c98dd5f1 100644 --- a/src/app/components/settings/settings.component.ts +++ b/src/app/components/settings/settings.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/settings/settings.module.ts b/src/app/components/settings/settings.module.ts index 5582bcc56..410e0338b 100644 --- a/src/app/components/settings/settings.module.ts +++ b/src/app/components/settings/settings.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/shared-files/shared-files.component.html b/src/app/components/shared-files/shared-files.component.html index 3ee06f402..d70a9e4b1 100644 --- a/src/app/components/shared-files/shared-files.component.html +++ b/src/app/components/shared-files/shared-files.component.html @@ -19,6 +19,7 @@ currentFolderId="-sharedlinks-" selectionMode="multiple" [sorting]="['modifiedAt', 'desc']" + [imageResolver]="imageResolver" (node-dblclick)="preview($event.detail?.node)" (name-click)="preview($event.detail?.node)" > diff --git a/src/app/components/shared-files/shared-files.component.spec.ts b/src/app/components/shared-files/shared-files.component.spec.ts index fc9857006..d02971922 100644 --- a/src/app/components/shared-files/shared-files.component.spec.ts +++ b/src/app/components/shared-files/shared-files.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/shared-files/shared-files.component.ts b/src/app/components/shared-files/shared-files.component.ts index 668a64c72..51dff8529 100644 --- a/src/app/components/shared-files/shared-files.component.ts +++ b/src/app/components/shared-files/shared-files.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/shared-link-view/shared-link-view.component.spec.ts b/src/app/components/shared-link-view/shared-link-view.component.spec.ts index 6b622c51c..c530854a7 100644 --- a/src/app/components/shared-link-view/shared-link-view.component.spec.ts +++ b/src/app/components/shared-link-view/shared-link-view.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/shared-link-view/shared-link-view.component.ts b/src/app/components/shared-link-view/shared-link-view.component.ts index f7c4edec1..4f3ce2cae 100644 --- a/src/app/components/shared-link-view/shared-link-view.component.ts +++ b/src/app/components/shared-link-view/shared-link-view.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/shared-link-view/shared-link-view.module.ts b/src/app/components/shared-link-view/shared-link-view.module.ts index 78b18a981..6c4b28bd9 100644 --- a/src/app/components/shared-link-view/shared-link-view.module.ts +++ b/src/app/components/shared-link-view/shared-link-view.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/components/button-menu.component.spec.ts b/src/app/components/sidenav/components/button-menu.component.spec.ts index 86480e5c1..514d7bfca 100644 --- a/src/app/components/sidenav/components/button-menu.component.spec.ts +++ b/src/app/components/sidenav/components/button-menu.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/components/button-menu.component.ts b/src/app/components/sidenav/components/button-menu.component.ts index d7e2d7879..64579f787 100644 --- a/src/app/components/sidenav/components/button-menu.component.ts +++ b/src/app/components/sidenav/components/button-menu.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/components/expand-menu.component.spec.ts b/src/app/components/sidenav/components/expand-menu.component.spec.ts index 495207bdd..85740dfd7 100644 --- a/src/app/components/sidenav/components/expand-menu.component.spec.ts +++ b/src/app/components/sidenav/components/expand-menu.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/components/expand-menu.component.ts b/src/app/components/sidenav/components/expand-menu.component.ts index e416a41da..3eac9d13e 100644 --- a/src/app/components/sidenav/components/expand-menu.component.ts +++ b/src/app/components/sidenav/components/expand-menu.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/action.directive.spec.ts b/src/app/components/sidenav/directives/action.directive.spec.ts index 344089ac6..a8e5b7466 100644 --- a/src/app/components/sidenav/directives/action.directive.spec.ts +++ b/src/app/components/sidenav/directives/action.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/action.directive.ts b/src/app/components/sidenav/directives/action.directive.ts index 7ca148891..b6d4ef4f3 100644 --- a/src/app/components/sidenav/directives/action.directive.ts +++ b/src/app/components/sidenav/directives/action.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/active-link.directive.spec.ts b/src/app/components/sidenav/directives/active-link.directive.spec.ts index ae264c351..e306cc18b 100644 --- a/src/app/components/sidenav/directives/active-link.directive.spec.ts +++ b/src/app/components/sidenav/directives/active-link.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/active-link.directive.ts b/src/app/components/sidenav/directives/active-link.directive.ts index fd2f7c547..df00ee6e4 100644 --- a/src/app/components/sidenav/directives/active-link.directive.ts +++ b/src/app/components/sidenav/directives/active-link.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/collapsed-template.directive.ts b/src/app/components/sidenav/directives/collapsed-template.directive.ts index 10798f654..40c43f7f8 100755 --- a/src/app/components/sidenav/directives/collapsed-template.directive.ts +++ b/src/app/components/sidenav/directives/collapsed-template.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/expanded-template.directive.ts b/src/app/components/sidenav/directives/expanded-template.directive.ts index 347e774ac..07de1b7e1 100755 --- a/src/app/components/sidenav/directives/expanded-template.directive.ts +++ b/src/app/components/sidenav/directives/expanded-template.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/expansion-panel.directive.spec.ts b/src/app/components/sidenav/directives/expansion-panel.directive.spec.ts index 06376cd82..f3e660e9e 100644 --- a/src/app/components/sidenav/directives/expansion-panel.directive.spec.ts +++ b/src/app/components/sidenav/directives/expansion-panel.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/expansion-panel.directive.ts b/src/app/components/sidenav/directives/expansion-panel.directive.ts index 693d13113..68c7371de 100644 --- a/src/app/components/sidenav/directives/expansion-panel.directive.ts +++ b/src/app/components/sidenav/directives/expansion-panel.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/menu-panel.directive.spec.ts b/src/app/components/sidenav/directives/menu-panel.directive.spec.ts index 0a9f3c94e..f939a4b42 100644 --- a/src/app/components/sidenav/directives/menu-panel.directive.spec.ts +++ b/src/app/components/sidenav/directives/menu-panel.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/directives/menu-panel.directive.ts b/src/app/components/sidenav/directives/menu-panel.directive.ts index 956297cac..612a30eb3 100644 --- a/src/app/components/sidenav/directives/menu-panel.directive.ts +++ b/src/app/components/sidenav/directives/menu-panel.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/sidenav.component.spec.ts b/src/app/components/sidenav/sidenav.component.spec.ts index fa324608c..f1e5ff6a3 100644 --- a/src/app/components/sidenav/sidenav.component.spec.ts +++ b/src/app/components/sidenav/sidenav.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/sidenav.component.ts b/src/app/components/sidenav/sidenav.component.ts index 83179b534..4ebbcb8aa 100755 --- a/src/app/components/sidenav/sidenav.component.ts +++ b/src/app/components/sidenav/sidenav.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/sidenav/sidenav.module.ts b/src/app/components/sidenav/sidenav.module.ts index 79f0d9f42..f351794df 100644 --- a/src/app/components/sidenav/sidenav.module.ts +++ b/src/app/components/sidenav/sidenav.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/document-display-mode/document-display-mode.component.spec.ts b/src/app/components/toolbar/document-display-mode/document-display-mode.component.spec.ts index 46d0196a8..62af29ce2 100644 --- a/src/app/components/toolbar/document-display-mode/document-display-mode.component.spec.ts +++ b/src/app/components/toolbar/document-display-mode/document-display-mode.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts b/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts index 9af78ebe5..e1b255d63 100644 --- a/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts +++ b/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts index 0f089ca92..0eec762ed 100644 --- a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts +++ b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts index bead7cbde..8e3f7c3e0 100644 --- a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts +++ b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.spec.ts b/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.spec.ts index b7591f5a9..15c12b9ef 100644 --- a/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.spec.ts +++ b/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts b/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts index d2c0d734f..e006af92d 100644 --- a/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts +++ b/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.spec.ts b/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.spec.ts index b4c6c3d78..2876d39d5 100644 --- a/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.spec.ts +++ b/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts b/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts index 5c5bc1c4c..6b4f7380c 100644 --- a/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts +++ b/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.spec.ts b/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.spec.ts index 724e88854..965449c97 100644 --- a/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.spec.ts +++ b/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts b/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts index 91022798b..90170d82d 100644 --- a/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts +++ b/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts b/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts index bebc91a70..87d0cf6bf 100644 --- a/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts +++ b/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts b/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts index dc97f49b4..4459fd219 100644 --- a/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts +++ b/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts b/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts index a0c9c9c10..2fb8c7d1b 100644 --- a/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts +++ b/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toolbar-action/toolbar-action.component.spec.ts b/src/app/components/toolbar/toolbar-action/toolbar-action.component.spec.ts index cd8b21048..c9c6c5854 100644 --- a/src/app/components/toolbar/toolbar-action/toolbar-action.component.spec.ts +++ b/src/app/components/toolbar/toolbar-action/toolbar-action.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toolbar-action/toolbar-action.component.ts b/src/app/components/toolbar/toolbar-action/toolbar-action.component.ts index 2552b1752..5df7da924 100644 --- a/src/app/components/toolbar/toolbar-action/toolbar-action.component.ts +++ b/src/app/components/toolbar/toolbar-action/toolbar-action.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toolbar-button/toolbar-button.component.spec.ts b/src/app/components/toolbar/toolbar-button/toolbar-button.component.spec.ts index 5bf874db9..c4cd11895 100644 --- a/src/app/components/toolbar/toolbar-button/toolbar-button.component.spec.ts +++ b/src/app/components/toolbar/toolbar-button/toolbar-button.component.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toolbar-button/toolbar-button.component.ts b/src/app/components/toolbar/toolbar-button/toolbar-button.component.ts index 4c113db96..2f2585173 100644 --- a/src/app/components/toolbar/toolbar-button/toolbar-button.component.ts +++ b/src/app/components/toolbar/toolbar-button/toolbar-button.component.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.html b/src/app/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.html index 0e043883a..9ffd5e6fd 100644 --- a/src/app/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.html +++ b/src/app/components/toolbar/toolbar-menu-item/toolbar-menu-item.component.html @@ -30,6 +30,7 @@ + + diff --git a/src/app/dialogs/node-template/create-from-template.dialog.scss b/src/app/dialogs/node-template/create-from-template.dialog.scss new file mode 100644 index 000000000..7cbbb2947 --- /dev/null +++ b/src/app/dialogs/node-template/create-from-template.dialog.scss @@ -0,0 +1,64 @@ +@mixin app-create-from-template-theme($theme) { + $primary: map-get($theme, primary); + $accent: map-get($theme, accent); + $foreground: map-get($theme, foreground); + $background: map-get($theme, background); + + .aca-create-from-template-dialog { + ng-component { + overflow: visible; + } + + .mat-dialog-title { + margin-left: 24px; + margin-right: 24px; + font-size: 20px; + font-style: normal; + font-stretch: normal; + line-height: 1.6; + letter-spacing: -0.5px; + color: mat-color($foreground, text, 0.87); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + + .bold { + font-weight: 600; + } + } + + .mat-form-field { + margin-bottom: 20px; + } + + .mat-dialog-container { + padding-left: 0; + padding-right: 0; + } + + .mat-dialog-content { + margin: 0 2px; + overflow: hidden; + } + + .mat-dialog-actions { + padding: 8px 22px; + display: flex; + justify-content: flex-end; + color: mat-color($foreground, secondary-text); + + button { + text-transform: uppercase; + font-weight: normal; + } + + .create[disabled] { + opacity: 0.6; + } + + .create:enabled { + color: mat-color($accent); + } + } + } +} diff --git a/src/app/dialogs/node-template/create-from-template.dialog.spec.ts b/src/app/dialogs/node-template/create-from-template.dialog.spec.ts new file mode 100644 index 000000000..cf710cadb --- /dev/null +++ b/src/app/dialogs/node-template/create-from-template.dialog.spec.ts @@ -0,0 +1,181 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { CreateFromTemplateDialogComponent } from './create-from-template.dialog'; +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { AppTestingModule } from '../../testing/app-testing.module'; +import { CoreModule, TranslationMock } from '@alfresco/adf-core'; +import { + MatDialogModule, + MAT_DIALOG_DATA, + MatDialogRef +} from '@angular/material/dialog'; +import { Store } from '@ngrx/store'; +import { CreateFromTemplate } from '@alfresco/aca-shared/store'; +import { Node } from '@alfresco/js-api'; + +function text(length: number) { + return new Array(length) + .fill( + Math.random() + .toString() + .substring(2, 3) + ) + .join(''); +} + +describe('CreateFileFromTemplateDialogComponent', () => { + let fixture: ComponentFixture; + let component: CreateFromTemplateDialogComponent; + let store; + + const data = { + id: 'node-id', + name: 'node-name', + isFolder: false, + isFile: true, + properties: { + 'cm:title': 'node-title', + 'cm:description': '' + } + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CoreModule.forRoot(), AppTestingModule, MatDialogModule], + declarations: [CreateFromTemplateDialogComponent], + providers: [ + { + provide: MatDialogRef, + useValue: { + close: jasmine.createSpy('close') + } + }, + { + provide: TranslationMock, + useValue: { + instant: jasmine.createSpy('instant') + } + }, + { + provide: Store, + useValue: { + dispatch: jasmine.createSpy('dispatch') + } + }, + { provide: MAT_DIALOG_DATA, useValue: {} } + ] + }); + + fixture = TestBed.createComponent(CreateFromTemplateDialogComponent); + store = TestBed.get(Store); + component = fixture.componentInstance; + component.data = data as Node; + }); + + it('should populate form with provided dialog data', () => { + fixture.detectChanges(); + + expect(component.form.controls.name.value).toBe(data.name); + expect(component.form.controls.title.value).toBe( + data.properties['cm:title'] + ); + expect(component.form.controls.description.value).toBe( + data.properties['cm:description'] + ); + }); + + it('should invalidate form if required `name` field is invalid', () => { + fixture.detectChanges(); + + component.form.controls.name.setValue(''); + fixture.detectChanges(); + + expect(component.form.invalid).toBe(true); + }); + + it('should invalidate form if required `name` field has `only spaces`', () => { + fixture.detectChanges(); + + component.form.controls.name.setValue(' '); + fixture.detectChanges(); + + expect(component.form.invalid).toBe(true); + }); + + it('should invalidate form if required `name` field has `ending dot`', () => { + fixture.detectChanges(); + + component.form.controls.name.setValue('something.'); + fixture.detectChanges(); + + expect(component.form.invalid).toBe(true); + }); + + it('should invalidate form if `title` text length is long', () => { + fixture.detectChanges(); + + component.form.controls.title.setValue(text(260)); + fixture.detectChanges(); + + expect(component.form.invalid).toBe(true); + }); + + it('should invalidate form if `description` text length is long', () => { + fixture.detectChanges(); + + component.form.controls.description.setValue(text(520)); + fixture.detectChanges(); + + expect(component.form.invalid).toBe(true); + }); + + it('should create node from template with form values', () => { + const newNode = { + id: 'node-id', + name: 'new-node-name', + isFolder: false, + isFile: true, + properties: { + 'cm:title': 'new-node-title', + 'cm:description': 'new-node-description' + } + } as Node; + + fixture.detectChanges(); + + component.form.controls.name.setValue('new-node-name'); + component.form.controls.title.setValue('new-node-title'); + component.form.controls.description.setValue('new-node-description'); + + fixture.detectChanges(); + + component.onSubmit(); + + expect(store.dispatch['calls'].mostRecent().args[0]).toEqual( + new CreateFromTemplate(newNode) + ); + }); +}); diff --git a/src/app/dialogs/node-template/create-from-template.dialog.ts b/src/app/dialogs/node-template/create-from-template.dialog.ts new file mode 100644 index 000000000..1caf9a64d --- /dev/null +++ b/src/app/dialogs/node-template/create-from-template.dialog.ts @@ -0,0 +1,150 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Component, ViewEncapsulation, Inject, OnInit } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { Node } from '@alfresco/js-api'; +import { + FormBuilder, + FormGroup, + Validators, + FormControl, + ValidationErrors +} from '@angular/forms'; +import { Store } from '@ngrx/store'; +import { AppStore, CreateFromTemplate } from '@alfresco/aca-shared/store'; +import { TranslationService } from '@alfresco/adf-core'; + +@Component({ + templateUrl: './create-from-template.dialog.html', + encapsulation: ViewEncapsulation.None, + styleUrls: ['./create-from-template.dialog.scss'] +}) +export class CreateFromTemplateDialogComponent implements OnInit { + public form: FormGroup; + + constructor( + private translationService: TranslationService, + private store: Store, + private formBuilder: FormBuilder, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: Node + ) {} + + ngOnInit() { + this.form = this.formBuilder.group({ + name: [ + this.data.name, + [ + Validators.required, + this.forbidEndingDot, + this.forbidOnlySpaces, + this.forbidSpecialCharacters + ] + ], + title: [ + this.data.properties ? this.data.properties['cm:title'] : '', + Validators.maxLength(256) + ], + description: [ + this.data.properties ? this.data.properties['cm:description'] : '', + Validators.maxLength(512) + ] + }); + } + + onSubmit() { + const update = { + name: this.form.value.name.trim(), + properties: { + 'cm:title': this.form.value.title, + 'cm:description': this.form.value.description + } + }; + const data: Node = Object.assign({}, this.data, update); + this.store.dispatch(new CreateFromTemplate(data)); + } + + title(): string { + if (this.data.isFolder) { + return this.translationService.instant( + 'NODE_FROM_TEMPLATE.FOLDER_DIALOG_TITLE', + { template: this.data.name } + ); + } + + return this.translationService.instant( + 'NODE_FROM_TEMPLATE.FILE_DIALOG_TITLE', + { template: this.data.name } + ); + } + + close() { + this.dialogRef.close(); + } + + private forbidSpecialCharacters({ + value + }: FormControl): ValidationErrors | null { + const specialCharacters: RegExp = /([\*\"\<\>\\\/\?\:\|])/; + const isValid: boolean = !specialCharacters.test(value); + + return isValid + ? null + : { + message: `NODE_FROM_TEMPLATE.FORM.ERRORS.SPECIAL_CHARACTERS` + }; + } + + private forbidEndingDot({ value }: FormControl): ValidationErrors | null { + const isValid: boolean = + (value || '') + .trim() + .split('') + .pop() !== '.'; + + return isValid + ? null + : { + message: `NODE_FROM_TEMPLATE.FORM.ERRORS.ENDING_DOT` + }; + } + + private forbidOnlySpaces({ value }: FormControl): ValidationErrors | null { + if (value.length) { + const isValid: boolean = !!(value || '').trim(); + + return isValid + ? null + : { + message: `NODE_FROM_TEMPLATE.FORM.ERRORS.ONLY_SPACES` + }; + } else { + return { + message: `NODE_FROM_TEMPLATE.FORM.ERRORS.REQUIRED` + }; + } + } +} diff --git a/src/app/dialogs/node-version-upload/node-version-upload.dialog.spec.ts b/src/app/dialogs/node-version-upload/node-version-upload.dialog.spec.ts index 37434a6e8..b826c073b 100644 --- a/src/app/dialogs/node-version-upload/node-version-upload.dialog.spec.ts +++ b/src/app/dialogs/node-version-upload/node-version-upload.dialog.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/dialogs/node-version-upload/node-version-upload.dialog.ts b/src/app/dialogs/node-version-upload/node-version-upload.dialog.ts index 1d786f4d5..902ef3cfe 100644 --- a/src/app/dialogs/node-version-upload/node-version-upload.dialog.ts +++ b/src/app/dialogs/node-version-upload/node-version-upload.dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/dialogs/node-versions/node-versions.dialog.spec.ts b/src/app/dialogs/node-versions/node-versions.dialog.spec.ts index 68ec957bb..be717614c 100644 --- a/src/app/dialogs/node-versions/node-versions.dialog.spec.ts +++ b/src/app/dialogs/node-versions/node-versions.dialog.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/dialogs/node-versions/node-versions.dialog.ts b/src/app/dialogs/node-versions/node-versions.dialog.ts index d88292520..6966e5de8 100644 --- a/src/app/dialogs/node-versions/node-versions.dialog.ts +++ b/src/app/dialogs/node-versions/node-versions.dialog.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/directives.module.ts b/src/app/directives/directives.module.ts index bf96e9d46..e55a3028d 100644 --- a/src/app/directives/directives.module.ts +++ b/src/app/directives/directives.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/document-list.directive.spec.ts b/src/app/directives/document-list.directive.spec.ts index 1eaa5b745..8588a018c 100644 --- a/src/app/directives/document-list.directive.spec.ts +++ b/src/app/directives/document-list.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/document-list.directive.ts b/src/app/directives/document-list.directive.ts index 771172ca0..d09f4c3fe 100644 --- a/src/app/directives/document-list.directive.ts +++ b/src/app/directives/document-list.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/library-favorite.directive.spec.ts b/src/app/directives/library-favorite.directive.spec.ts index af5eb3d92..899ed202c 100644 --- a/src/app/directives/library-favorite.directive.spec.ts +++ b/src/app/directives/library-favorite.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/library-favorite.directive.ts b/src/app/directives/library-favorite.directive.ts index aed611598..53cafe785 100644 --- a/src/app/directives/library-favorite.directive.ts +++ b/src/app/directives/library-favorite.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/library-membership.directive.spec.ts b/src/app/directives/library-membership.directive.spec.ts index f09523a06..e2ac46651 100644 --- a/src/app/directives/library-membership.directive.spec.ts +++ b/src/app/directives/library-membership.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/library-membership.directive.ts b/src/app/directives/library-membership.directive.ts index 3ab0e6f6a..e638826a2 100644 --- a/src/app/directives/library-membership.directive.ts +++ b/src/app/directives/library-membership.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/lock-node.directive.spec.ts b/src/app/directives/lock-node.directive.spec.ts index c4e11bc39..74addbac5 100644 --- a/src/app/directives/lock-node.directive.spec.ts +++ b/src/app/directives/lock-node.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/lock-node.directive.ts b/src/app/directives/lock-node.directive.ts index 5b0f2019e..15e701e5a 100644 --- a/src/app/directives/lock-node.directive.ts +++ b/src/app/directives/lock-node.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -32,7 +32,7 @@ import { } from '@angular/core'; import { NodeEntry, NodeBodyLock, SharedLinkEntry } from '@alfresco/js-api'; import { AlfrescoApiService } from '@alfresco/adf-core'; -import { isLocked } from '../utils/node.utils'; +import { isLocked } from '@alfresco/aca-shared'; @Directive({ selector: '[acaLockNode]', diff --git a/src/app/directives/pagination.directive.spec.ts b/src/app/directives/pagination.directive.spec.ts index 8f7523bbc..bcb81d775 100644 --- a/src/app/directives/pagination.directive.spec.ts +++ b/src/app/directives/pagination.directive.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/directives/pagination.directive.ts b/src/app/directives/pagination.directive.ts index f8321a7d2..e8cafb0f2 100644 --- a/src/app/directives/pagination.directive.ts +++ b/src/app/directives/pagination.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/extensions.module.ts b/src/app/extensions.module.ts index b6b042b74..4a46719a7 100644 --- a/src/app/extensions.module.ts +++ b/src/app/extensions.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/extensions/core.extensions.module.ts b/src/app/extensions/core.extensions.module.ts index 60d317cc2..a29e51ecf 100644 --- a/src/app/extensions/core.extensions.module.ts +++ b/src/app/extensions/core.extensions.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -51,6 +51,8 @@ import { } from '@alfresco/adf-content-services'; import { ToggleSharedComponent } from '../components/common/toggle-shared/toggle-shared.component'; import { ViewNodeComponent } from '../components/toolbar/view-node/view-node.component'; +import { LanguagePickerComponent } from '../components/common/language-picker/language-picker.component'; +import { LogoutComponent } from '../components/common/logout/logout.component'; export function setupExtensions(service: AppExtensionService): Function { return () => service.load(); @@ -101,7 +103,9 @@ export class CoreExtensionsModule { 'app.columns.trashcanName': TrashcanNameColumnComponent, 'app.columns.location': LocationLinkComponent, 'app.toolbar.toggleEditOffline': ToggleEditOfflineComponent, - 'app.toolbar.viewNode': ViewNodeComponent + 'app.toolbar.viewNode': ViewNodeComponent, + 'app.languagePicker': LanguagePickerComponent, + 'app.logout': LogoutComponent }); extensions.setAuthGuards({ @@ -166,7 +170,9 @@ export class CoreExtensionsModule { 'app.navigation.isSharedFileViewer': rules.isSharedFileViewer, 'repository.isQuickShareEnabled': rules.hasQuickShareEnabled, - 'user.isAdmin': rules.isAdmin + 'user.isAdmin': rules.isAdmin, + 'app.canShowLanguagePicker': rules.canShowLanguagePicker, + 'app.canShowLogout': rules.canShowLogout }); } } diff --git a/src/app/extensions/extension.service.spec.ts b/src/app/extensions/extension.service.spec.ts index 33748a2dc..54eca8072 100644 --- a/src/app/extensions/extension.service.spec.ts +++ b/src/app/extensions/extension.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -39,18 +39,21 @@ import { ExtensionConfig, ComponentRegisterService } from '@alfresco/adf-extensions'; +import { AppConfigService } from '@alfresco/adf-core'; describe('AppExtensionService', () => { let service: AppExtensionService; let store: Store; let extensions: ExtensionService; let components: ComponentRegisterService; + let appConfigService: AppConfigService; beforeEach(() => { TestBed.configureTestingModule({ imports: [AppTestingModule] }); + appConfigService = TestBed.get(AppConfigService); store = TestBed.get(Store); service = TestBed.get(AppExtensionService); extensions = TestBed.get(ExtensionService); @@ -784,4 +787,114 @@ describe('AppExtensionService', () => { expect(service.getSharedLinkViewerToolbarActions()).toEqual(actions); }); }); + + describe('withCredentials', () => { + it('should set `withCredentials` to true from app configuration', () => { + appConfigService.config = { + auth: { withCredentials: true } + }; + applyConfig({ + $id: 'test', + $name: 'test', + $version: '1.0.0', + $license: 'MIT', + $vendor: 'Good company', + $runtime: '1.5.0' + }); + + expect(service.withCredentials).toBe(true); + }); + + it('should set `withCredentials` to false from app configuration', () => { + appConfigService.config = { + auth: { withCredentials: false } + }; + applyConfig({ + $id: 'test', + $name: 'test', + $version: '1.0.0', + $license: 'MIT', + $vendor: 'Good company', + $runtime: '1.5.0' + }); + + expect(service.withCredentials).toBe(false); + }); + + it('should set `withCredentials` to false as default value if no app configuration', () => { + appConfigService.config = {}; + applyConfig({ + $id: 'test', + $name: 'test', + $version: '1.0.0', + $license: 'MIT', + $vendor: 'Good company', + $runtime: '1.5.0' + }); + + expect(service.withCredentials).toBe(false); + }); + }); + + describe('userActions', () => { + it('should load user actions from the config', () => { + applyConfig({ + $id: 'test', + $name: 'test', + $version: '1.0.0', + $license: 'MIT', + $vendor: 'Good company', + $runtime: '1.5.0', + features: { + userActions: [ + { + id: 'aca:toolbar/separator-1', + order: 1, + type: ContentActionType.separator, + title: 'action1' + }, + { + id: 'aca:toolbar/separator-2', + order: 2, + type: ContentActionType.separator, + title: 'action2' + } + ] + } + }); + + expect(service.userActions.length).toBe(2); + }); + + it('should sort user actions by order', () => { + applyConfig({ + $id: 'test', + $name: 'test', + $version: '1.0.0', + $license: 'MIT', + $vendor: 'Good company', + $runtime: '1.5.0', + features: { + userActions: [ + { + id: 'aca:toolbar/separator-2', + order: 2, + type: ContentActionType.separator, + title: 'action2' + }, + { + id: 'aca:toolbar/separator-1', + order: 1, + type: ContentActionType.separator, + title: 'action1' + } + ] + } + }); + + expect(service.userActions.length).toBe(2); + expect(service.userActions[0].id).toBe('aca:toolbar/separator-1'); + expect(service.userActions[1].id).toBe('aca:toolbar/separator-2'); + }); + }); }); diff --git a/src/app/extensions/extension.service.ts b/src/app/extensions/extension.service.ts index 89937256c..5847e2ef9 100644 --- a/src/app/extensions/extension.service.ts +++ b/src/app/extensions/extension.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -28,7 +28,11 @@ import { Store } from '@ngrx/store'; import { Route } from '@angular/router'; import { MatIconRegistry } from '@angular/material/icon'; import { DomSanitizer } from '@angular/platform-browser'; -import { AppStore, getRuleContext } from '@alfresco/aca-shared/store'; +import { + AppStore, + getRuleContext, + getLanguagePickerState +} from '@alfresco/aca-shared/store'; import { NodePermissionService } from '@alfresco/aca-shared'; import { SelectionState, @@ -78,6 +82,7 @@ export class AppExtensionService implements RuleContext { sidebar: Array = []; contentMetadata: any; viewerRules: ViewerRules = {}; + userActions: Array = []; documentListPresets: { files: Array; @@ -103,6 +108,8 @@ export class AppExtensionService implements RuleContext { navigation: NavigationState; profile: ProfileState; repository: RepositoryInfo; + withCredentials: boolean; + languagePicker: boolean; references$: Observable; @@ -124,6 +131,10 @@ export class AppExtensionService implements RuleContext { this.profile = result.profile; this.repository = result.repository; }); + + this.store.select(getLanguagePickerState).subscribe(result => { + this.languagePicker = result; + }); } async load() { @@ -170,6 +181,10 @@ export class AppExtensionService implements RuleContext { config, 'features.sidebar' ); + this.userActions = this.loader.getContentActions( + config, + 'features.userActions' + ); this.contentMetadata = this.loadContentMetadata(config); this.documentListPresets = { @@ -186,6 +201,11 @@ export class AppExtensionService implements RuleContext { searchLibraries: this.getDocumentListPreset(config, 'search-libraries') }; + this.withCredentials = this.appConfig.get( + 'auth.withCredentials', + false + ); + if (config.features && config.features.viewer) { this.viewerRules = (config.features.viewer['rules'] || {}); } @@ -473,6 +493,12 @@ export class AppExtensionService implements RuleContext { return this.getAllowedActions(this.contextMenuActions); } + getUserActions(): Array { + return this.userActions + .filter(action => this.filterVisible(action)) + .sort(sortByOrder); + } + copyAction(action: ContentActionRef): ContentActionRef { return { ...action, diff --git a/src/app/extensions/viewer.rules.ts b/src/app/extensions/viewer.rules.ts index 500ce6585..401c47124 100644 --- a/src/app/extensions/viewer.rules.ts +++ b/src/app/extensions/viewer.rules.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/material.module.ts b/src/app/material.module.ts index 2caa53326..2f5d2b07e 100644 --- a/src/app/material.module.ts +++ b/src/app/material.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/services/content-management.service.spec.ts b/src/app/services/content-management.service.spec.ts index cc30f14ed..7dc25404c 100644 --- a/src/app/services/content-management.service.spec.ts +++ b/src/app/services/content-management.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/services/content-management.service.ts b/src/app/services/content-management.service.ts index a76aec2b8..1215373f8 100644 --- a/src/app/services/content-management.service.ts +++ b/src/app/services/content-management.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/services/node-actions.service.spec.ts b/src/app/services/node-actions.service.spec.ts index 17518dc61..cfc299d75 100644 --- a/src/app/services/node-actions.service.spec.ts +++ b/src/app/services/node-actions.service.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/services/node-actions.service.ts b/src/app/services/node-actions.service.ts index ada1b3937..4bd736286 100644 --- a/src/app/services/node-actions.service.ts +++ b/src/app/services/node-actions.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/services/node-template.service.spec.ts b/src/app/services/node-template.service.spec.ts new file mode 100644 index 000000000..7233c6941 --- /dev/null +++ b/src/app/services/node-template.service.spec.ts @@ -0,0 +1,332 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { EffectsModule } from '@ngrx/effects'; +import { AppStore, SnackbarErrorAction } from '@alfresco/aca-shared/store'; +import { TemplateEffects } from '../store/effects/template.effects'; +import { AppTestingModule } from '../testing/app-testing.module'; +import { Store } from '@ngrx/store'; +import { MatDialog } from '@angular/material/dialog'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core'; +import { NodeTemplateService } from './node-template.service'; +import { of } from 'rxjs'; + +describe('NodeTemplateService', () => { + let dialog: MatDialog; + let store: Store; + let alfrescoApiService: AlfrescoApiService; + let nodeTemplateService: NodeTemplateService; + const fileTemplateConfig = { + relativePath: 'relative-path/parent-file-templates', + selectionType: 'file' + }; + const folderTemplateConfig = { + relativePath: 'relative-path/parent-folder-templates', + selectionType: 'folder' + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [AppTestingModule, EffectsModule.forRoot([TemplateEffects])], + providers: [ + NodeTemplateService, + { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock } + ] + }); + + store = TestBed.get(Store); + alfrescoApiService = TestBed.get(AlfrescoApiService); + dialog = TestBed.get(MatDialog); + nodeTemplateService = TestBed.get(NodeTemplateService); + }); + + it('should open dialog with parent node `id` as data property', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'parent-node-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + expect(dialog.open['calls'].argsFor(0)[1].data).toEqual( + jasmine.objectContaining({ currentFolderId: 'parent-node-id' }) + ); + }); + + it('should remove parents for templates node breadcrumb path', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue( + of({ + id: 'parent-node-id', + path: { + elements: [], + name: '/Company Home/Data Dictionary' + } + }) + ); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + const breadcrumb = dialog.open['calls'] + .argsFor(0)[1] + .data.breadcrumbTransform({ + name: 'Node Templates', + path: { + elements: [{ name: 'Company Home' }, { name: 'Data Dictionary' }], + name: '/Company Home/Data Dictionary' + } + }); + + expect(breadcrumb.path.elements).toEqual([]); + }); + + it('should raise an error when getNodeInfo fails', fakeAsync(() => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue( + Promise.reject({ + message: `{ "error": { "statusCode": 404 } } ` + }) + ); + spyOn(store, 'dispatch'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + tick(); + + expect(store.dispatch).toHaveBeenCalledWith( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.GENERIC') + ); + })); + + it('should return true if row is not a `link` nodeType', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue( + of({ + id: 'templates-folder-id', + path: { + elements: [], + name: '/Company Home/Data Dictionary' + } + }) + ); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + expect( + dialog.open['calls'].argsFor(0)[1].data.rowFilter({ + node: { entry: { nodeType: 'text' } } + }) + ).toBe(true); + }); + + it('should return false if row is a `filelink` nodeType', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue( + of({ + id: 'templates-folder-id', + path: { + elements: [], + name: '/Company Home/Data Dictionary' + } + }) + ); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + expect( + dialog.open['calls'].argsFor(0)[1].data.rowFilter({ + node: { entry: { nodeType: 'app:filelink' } } + }) + ).toBe(false); + }); + + it('should return false if row is a `folderlink` nodeType', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue( + of({ + id: 'templates-folder-id', + path: { + elements: [], + name: '/Company Home/Data Dictionary' + } + }) + ); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + expect( + dialog.open['calls'].argsFor(0)[1].data.rowFilter({ + node: { entry: { nodeType: 'app:folderlink' } } + }) + ).toBe(false); + }); + + describe('File templates', () => { + it('should return false if selected node is not a file', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + const isSelectionValid = dialog.open['calls'] + .argsFor(0)[1] + .data.isSelectionValid({ + name: 'some-folder-template', + isFile: false, + isFolder: true + }); + + expect(isSelectionValid).toBe(false); + }); + + it('should return true if selected node is a template file', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + const isSelectionValid = dialog.open['calls'] + .argsFor(0)[1] + .data.isSelectionValid({ + name: 'some-file-template', + isFile: true, + isFolder: false + }); + + expect(isSelectionValid).toBe(true); + }); + + it('should set dialog title for file templates', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(fileTemplateConfig); + + const title = dialog.open['calls'].argsFor(0)[1].data.title; + + expect(title).toBe('NODE_SELECTOR.SELECT_FILE_TEMPLATE_TITLE'); + }); + }); + + describe('Folder templates', () => { + it('should return false if selected node is not a folder', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(folderTemplateConfig); + + const isSelectionValid = dialog.open['calls'] + .argsFor(0)[1] + .data.isSelectionValid({ + name: 'some-file-template', + isFile: true, + isFolder: false + }); + + expect(isSelectionValid).toBe(false); + }); + + it('should return false if current node is the parent folder', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(folderTemplateConfig); + + const isSelectionValid = dialog.open['calls'] + .argsFor(0)[1] + .data.isSelectionValid({ + name: 'parent-folder-templates', + isFile: false, + isFolder: true + }); + + expect(isSelectionValid).toBe(false); + }); + + it('should return true if selected node is a folder template', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(folderTemplateConfig); + + const isSelectionValid = dialog.open['calls'] + .argsFor(0)[1] + .data.isSelectionValid({ + name: 'some-folder-template', + isFile: false, + isFolder: true + }); + + expect(isSelectionValid).toBe(true); + }); + + it('should set dialog title for folder templates', () => { + spyOn( + alfrescoApiService.getInstance().nodes, + 'getNodeInfo' + ).and.returnValue(of({ id: 'templates-folder-id' })); + spyOn(dialog, 'open'); + + nodeTemplateService.selectTemplateDialog(folderTemplateConfig); + + const title = dialog.open['calls'].argsFor(0)[1].data.title; + + expect(title).toBe('NODE_SELECTOR.SELECT_FOLDER_TEMPLATE_TITLE'); + }); + }); +}); diff --git a/src/app/services/node-template.service.ts b/src/app/services/node-template.service.ts new file mode 100644 index 000000000..8633d5093 --- /dev/null +++ b/src/app/services/node-template.service.ts @@ -0,0 +1,170 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Injectable } from '@angular/core'; +import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material'; +import { CreateFromTemplateDialogComponent } from '../dialogs/node-template/create-from-template.dialog'; +import { Subject, from, of } from 'rxjs'; +import { Node, MinimalNode, MinimalNodeEntryEntity } from '@alfresco/js-api'; +import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; +import { switchMap, catchError } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { AppStore, SnackbarErrorAction } from '@alfresco/aca-shared/store'; +import { + ContentNodeSelectorComponent, + ContentNodeSelectorComponentData, + ShareDataRow +} from '@alfresco/adf-content-services'; + +export interface TemplateDialogConfig { + relativePath: string; + selectionType: string; +} + +@Injectable({ + providedIn: 'root' +}) +export class NodeTemplateService { + private currentTemplateConfig: TemplateDialogConfig = null; + + constructor( + private store: Store, + private alfrescoApiService: AlfrescoApiService, + private translation: TranslationService, + public dialog: MatDialog + ) {} + + selectTemplateDialog(config: TemplateDialogConfig): Subject { + this.currentTemplateConfig = config; + + const select = new Subject(); + select.subscribe({ + complete: this.close.bind(this) + }); + + const data: ContentNodeSelectorComponentData = { + title: this.title(config.selectionType), + actionName: 'NEXT', + dropdownHideMyFiles: true, + currentFolderId: null, + dropdownSiteList: null, + breadcrumbTransform: this.transformNode.bind(this), + select, + showSearch: false, + showDropdownSiteList: false, + isSelectionValid: this.isSelectionValid.bind(this), + rowFilter: this.rowFilter.bind(this) + }; + + from( + this.alfrescoApiService.getInstance().nodes.getNodeInfo('-root-', { + relativePath: config.relativePath + }) + ) + .pipe( + switchMap(node => { + data.currentFolderId = node.id; + return this.dialog + .open(ContentNodeSelectorComponent, { + data, + panelClass: [ + 'adf-content-node-selector-dialog', + 'aca-template-node-selector-dialog' + ], + width: '630px' + }) + .afterClosed(); + }), + catchError(error => { + this.store.dispatch( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.GENERIC') + ); + return of(error); + }) + ) + .subscribe({ next: () => select.complete() }); + + return select; + } + + createTemplateDialog( + node: Node + ): MatDialogRef { + return this.dialog.open(CreateFromTemplateDialogComponent, { + data: node, + panelClass: 'aca-create-from-template-dialog', + width: '630px' + }); + } + + private transformNode(node: MinimalNode): MinimalNode { + if (node && node.path && node.path && node.path.elements instanceof Array) { + let { + path: { elements: elementsPath = [] } + } = node; + elementsPath = elementsPath.filter( + path => path.name !== 'Company Home' && path.name !== 'Data Dictionary' + ); + node.path.elements = elementsPath; + } + + return node; + } + + private isSelectionValid(node: Node): boolean { + if (node.name === this.currentTemplateConfig.relativePath.split('/')[1]) { + return false; + } + + if (this.currentTemplateConfig.selectionType === 'folder') { + return node.isFolder; + } + + return node.isFile; + } + + private close() { + this.dialog.closeAll(); + } + + private title(selectionType: string) { + if (selectionType === 'file') { + return this.translation.instant( + 'NODE_SELECTOR.SELECT_FILE_TEMPLATE_TITLE' + ); + } + + return this.translation.instant( + 'NODE_SELECTOR.SELECT_FOLDER_TEMPLATE_TITLE' + ); + } + + private rowFilter(row: ShareDataRow): boolean { + const node: MinimalNodeEntryEntity = row.node.entry; + return ( + node.nodeType !== 'app:filelink' && node.nodeType !== 'app:folderlink' + ); + } +} diff --git a/src/app/store/app-store.module.ts b/src/app/store/app-store.module.ts index 4ea9aae32..8286fe668 100644 --- a/src/app/store/app-store.module.ts +++ b/src/app/store/app-store.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -39,7 +39,9 @@ import { SearchEffects, LibraryEffects, UploadEffects, - FavoriteEffects + FavoriteEffects, + TemplateEffects, + ContextMenuEffects } from './effects'; import { INITIAL_STATE } from './initial-state'; @@ -56,7 +58,9 @@ import { INITIAL_STATE } from './initial-state'; SearchEffects, LibraryEffects, UploadEffects, - FavoriteEffects + FavoriteEffects, + TemplateEffects, + ContextMenuEffects ]), !environment.production ? StoreDevtoolsModule.instrument({ maxAge: 25 }) diff --git a/src/app/store/effects.ts b/src/app/store/effects.ts index 29bee5773..12f7862fd 100644 --- a/src/app/store/effects.ts +++ b/src/app/store/effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -32,3 +32,5 @@ export * from './effects/search.effects'; export * from './effects/library.effects'; export * from './effects/upload.effects'; export * from './effects/upload.effects'; +export * from './effects/template.effects'; +export * from './effects/contextmenu.effects'; diff --git a/src/app/store/effects/app.effects.ts b/src/app/store/effects/app.effects.ts index 3dfabc816..70f263ea5 100644 --- a/src/app/store/effects/app.effects.ts +++ b/src/app/store/effects/app.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/contextmenu.effects.spec.ts b/src/app/store/effects/contextmenu.effects.spec.ts new file mode 100644 index 000000000..0e992efad --- /dev/null +++ b/src/app/store/effects/contextmenu.effects.spec.ts @@ -0,0 +1,65 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { TestBed } from '@angular/core/testing'; +import { AppTestingModule } from '../../testing/app-testing.module'; +import { ContextMenuEffects } from './contextmenu.effects'; +import { EffectsModule } from '@ngrx/effects'; +import { Store } from '@ngrx/store'; +import { ContextMenu } from '@alfresco/aca-shared/store'; +import { ContextMenuService } from '../../components/context-menu/context-menu.service'; + +describe('ContextMenuEffects', () => { + let store: Store; + let contextMenuService: ContextMenuService; + const overlayRefMock = { + close: jasmine.createSpy('close') + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [AppTestingModule, EffectsModule.forRoot([ContextMenuEffects])], + providers: [ContextMenuService] + }); + + store = TestBed.get(Store); + contextMenuService = TestBed.get(ContextMenuService); + + spyOn(contextMenuService, 'open').and.returnValue(overlayRefMock); + }); + + it('should open dialog', () => { + store.dispatch(new ContextMenu(new MouseEvent('click'))); + expect(contextMenuService.open).toHaveBeenCalled(); + }); + + it('should close dialog reference if previously was opened', () => { + store.dispatch(new ContextMenu(new MouseEvent('click'))); + expect(contextMenuService.open).toHaveBeenCalled(); + + store.dispatch(new ContextMenu(new MouseEvent('click'))); + expect(overlayRefMock.close).toHaveBeenCalled(); + }); +}); diff --git a/src/app/store/effects/contextmenu.effects.ts b/src/app/store/effects/contextmenu.effects.ts new file mode 100644 index 000000000..0934262ba --- /dev/null +++ b/src/app/store/effects/contextmenu.effects.ts @@ -0,0 +1,61 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { + ContextMenuActionTypes, + ContextMenu +} from '@alfresco/aca-shared/store'; +import { Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { map } from 'rxjs/operators'; +import { ContextMenuOverlayRef } from '../../components/context-menu/context-menu-overlay'; +import { ContextMenuService } from '../../components/context-menu/context-menu.service'; + +@Injectable() +export class ContextMenuEffects { + private overlayRef: ContextMenuOverlayRef = null; + + constructor( + private contextMenuService: ContextMenuService, + private actions$: Actions + ) {} + + @Effect({ dispatch: false }) + contextMenu$ = this.actions$.pipe( + ofType(ContextMenuActionTypes.ContextMenu), + map(action => { + if (this.overlayRef) { + this.overlayRef.close(); + } + + this.overlayRef = this.contextMenuService.open({ + source: action.event, + hasBackdrop: false, + backdropClass: 'cdk-overlay-transparent-backdrop', + panelClass: 'cdk-overlay-pane' + }); + }) + ); +} diff --git a/src/app/store/effects/download.effects.ts b/src/app/store/effects/download.effects.ts index 3a53e5448..a69e2caf0 100644 --- a/src/app/store/effects/download.effects.ts +++ b/src/app/store/effects/download.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/favorite.effects.ts b/src/app/store/effects/favorite.effects.ts index 2b57eed91..5533fbdeb 100644 --- a/src/app/store/effects/favorite.effects.ts +++ b/src/app/store/effects/favorite.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/library.effects.ts b/src/app/store/effects/library.effects.ts index c496cd3bf..22c17dd8d 100644 --- a/src/app/store/effects/library.effects.ts +++ b/src/app/store/effects/library.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/node.effects.spec.ts b/src/app/store/effects/node.effects.spec.ts index cab0701c6..dcca6b420 100644 --- a/src/app/store/effects/node.effects.spec.ts +++ b/src/app/store/effects/node.effects.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/node.effects.ts b/src/app/store/effects/node.effects.ts index dd90baf39..e96b5e7b8 100644 --- a/src/app/store/effects/node.effects.ts +++ b/src/app/store/effects/node.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/search.effects.spec.ts b/src/app/store/effects/search.effects.spec.ts index 4667cf0bd..5f81553dd 100644 --- a/src/app/store/effects/search.effects.spec.ts +++ b/src/app/store/effects/search.effects.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/search.effects.ts b/src/app/store/effects/search.effects.ts index 477f73eeb..206b77de4 100644 --- a/src/app/store/effects/search.effects.ts +++ b/src/app/store/effects/search.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/template.effects.spec.ts b/src/app/store/effects/template.effects.spec.ts new file mode 100644 index 000000000..e0d522d00 --- /dev/null +++ b/src/app/store/effects/template.effects.spec.ts @@ -0,0 +1,231 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { AppTestingModule } from '../../testing/app-testing.module'; +import { TemplateEffects } from './template.effects'; +import { EffectsModule } from '@ngrx/effects'; +import { Store } from '@ngrx/store'; +import { + CreateFromTemplate, + CreateFromTemplateSuccess, + FileFromTemplate, + FolderFromTemplate, + SnackbarErrorAction +} from '@alfresco/aca-shared/store'; +import { NodeTemplateService } from '../../services/node-template.service'; +import { of } from 'rxjs'; +import { AlfrescoApiServiceMock, AlfrescoApiService } from '@alfresco/adf-core'; +import { ContentManagementService } from '../../services/content-management.service'; +import { Node, NodeEntry } from '@alfresco/js-api'; +import { MatDialog } from '@angular/material/dialog'; + +describe('TemplateEffects', () => { + let store: Store; + let nodeTemplateService: NodeTemplateService; + let alfrescoApiService: AlfrescoApiService; + let contentManagementService: ContentManagementService; + let copyNodeSpy; + let updateNodeSpy; + let matDialog: MatDialog; + const node: Node = { + name: 'node-name', + id: 'node-id', + nodeType: 'cm:content', + isFolder: false, + isFile: true, + modifiedAt: null, + modifiedByUser: null, + createdAt: null, + createdByUser: null, + properties: { + 'cm:title': 'title', + 'cm:description': 'description' + } + }; + const fileTemplateConfig = { + relativePath: 'Data Dictionary/Node Templates', + selectionType: 'file' + }; + + const folderTemplateConfig = { + relativePath: 'Data Dictionary/Space Templates', + selectionType: 'folder' + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [AppTestingModule, EffectsModule.forRoot([TemplateEffects])], + providers: [ + NodeTemplateService, + { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, + { + provide: MatDialog, + useValue: { + closeAll: jasmine.createSpy('closeAll') + } + } + ] + }); + + store = TestBed.get(Store); + nodeTemplateService = TestBed.get(NodeTemplateService); + alfrescoApiService = TestBed.get(AlfrescoApiService); + contentManagementService = TestBed.get(ContentManagementService); + matDialog = TestBed.get(MatDialog); + + spyOn(store, 'dispatch').and.callThrough(); + spyOn(contentManagementService.reload, 'next'); + spyOn(store, 'select').and.returnValue(of({ id: 'parent-id' })); + spyOn(nodeTemplateService, 'selectTemplateDialog').and.returnValue( + of([{ id: 'template-id' }]) + ); + + copyNodeSpy = spyOn(alfrescoApiService.getInstance().nodes, 'copyNode'); + updateNodeSpy = spyOn(alfrescoApiService.getInstance().nodes, 'updateNode'); + }); + + afterEach(() => { + copyNodeSpy.calls.reset(); + updateNodeSpy.calls.reset(); + }); + + it('should open dialog to select template files', fakeAsync(() => { + spyOn(nodeTemplateService, 'createTemplateDialog').and.returnValue({ + afterClosed: () => of(node) + }); + + store.dispatch(new FileFromTemplate()); + tick(); + + expect(nodeTemplateService.selectTemplateDialog).toHaveBeenCalledWith( + fileTemplateConfig + ); + })); + + it('should open dialog to select template folders', fakeAsync(() => { + spyOn(nodeTemplateService, 'createTemplateDialog').and.returnValue({ + afterClosed: () => of(node) + }); + + store.dispatch(new FolderFromTemplate()); + tick(); + + expect(nodeTemplateService.selectTemplateDialog).toHaveBeenCalledWith( + folderTemplateConfig + ); + })); + + it('should create node from template successful', fakeAsync(() => { + copyNodeSpy.and.returnValue( + of({ entry: { id: 'node-id', properties: {} } }) + ); + updateNodeSpy.and.returnValue(of({ entry: node })); + + store.dispatch(new CreateFromTemplate(node)); + tick(); + + expect(store.dispatch['calls'].mostRecent().args[0]).toEqual( + new CreateFromTemplateSuccess(node) + ); + })); + + it('should raise generic error when copyNode api fails', fakeAsync(() => { + copyNodeSpy.and.returnValue( + Promise.reject({ + message: `{ "error": { "statusCode": 404 } } ` + }) + ); + + store.dispatch(new CreateFromTemplate(node)); + tick(); + + expect(store.dispatch['calls'].mostRecent().args[0]).not.toEqual( + new CreateFromTemplateSuccess(node) + ); + expect(store.dispatch['calls'].argsFor(1)[0]).toEqual( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.GENERIC') + ); + })); + + it('should raise name conflict error when copyNode api returns 409', fakeAsync(() => { + copyNodeSpy.and.returnValue( + Promise.reject({ + message: `{ "error": { "statusCode": 409 } } ` + }) + ); + + store.dispatch(new CreateFromTemplate(node)); + tick(); + + expect(store.dispatch['calls'].mostRecent().args[0]).not.toEqual( + new CreateFromTemplateSuccess(node) + ); + expect(store.dispatch['calls'].argsFor(1)[0]).toEqual( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.CONFLICT') + ); + })); + + it('should resolve error with current node value when updateNode api fails', fakeAsync(() => { + const test_node = { + entry: { + id: 'test-node-id', + properties: { + 'cm:title': 'test-node-title', + 'cm:description': 'test-node-description' + } + } + } as NodeEntry; + copyNodeSpy.and.returnValue(of(test_node)); + + updateNodeSpy.and.returnValue( + Promise.reject({ + message: `{ "error": { "statusCode": 404 } } ` + }) + ); + + store.dispatch(new CreateFromTemplate(test_node.entry)); + tick(); + + expect(store.dispatch['calls'].mostRecent().args[0]).toEqual( + new CreateFromTemplateSuccess(test_node.entry) + ); + })); + + it('should close dialog on create template success', fakeAsync(() => { + store.dispatch(new CreateFromTemplateSuccess({} as Node)); + tick(); + expect(matDialog.closeAll).toHaveBeenCalled(); + })); + + it('should should reload content on create template success', fakeAsync(() => { + const test_node = { id: 'test-node-id' } as Node; + store.dispatch(new CreateFromTemplateSuccess(test_node)); + tick(); + expect(contentManagementService.reload.next).toHaveBeenCalledWith( + test_node + ); + })); +}); diff --git a/src/app/store/effects/template.effects.ts b/src/app/store/effects/template.effects.ts new file mode 100644 index 000000000..ab6a778de --- /dev/null +++ b/src/app/store/effects/template.effects.ts @@ -0,0 +1,174 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 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 . + */ + +import { Effect, Actions, ofType } from '@ngrx/effects'; +import { Injectable } from '@angular/core'; +import { map, switchMap, debounceTime, take, catchError } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { + FileFromTemplate, + FolderFromTemplate, + CreateFromTemplate, + CreateFromTemplateSuccess, + TemplateActionTypes, + getCurrentFolder, + AppStore, + SnackbarErrorAction +} from '@alfresco/aca-shared/store'; +import { + NodeTemplateService, + TemplateDialogConfig +} from '../../services/node-template.service'; +import { AlfrescoApiService } from '@alfresco/adf-core'; +import { ContentManagementService } from '../../services/content-management.service'; +import { from, Observable, of } from 'rxjs'; +import { NodeEntry, NodeBodyUpdate, Node } from '@alfresco/js-api'; +import { MatDialog } from '@angular/material/dialog'; + +@Injectable() +export class TemplateEffects { + constructor( + private matDialog: MatDialog, + private content: ContentManagementService, + private store: Store, + private apiService: AlfrescoApiService, + private actions$: Actions, + private nodeTemplateService: NodeTemplateService + ) {} + + @Effect({ dispatch: false }) + fileFromTemplate$ = this.actions$.pipe( + ofType(TemplateActionTypes.FileFromTemplate), + map(() => { + this.openDialog({ + relativePath: 'Data Dictionary/Node Templates', + selectionType: 'file' + }); + }) + ); + + @Effect({ dispatch: false }) + folderFromTemplate$ = this.actions$.pipe( + ofType(TemplateActionTypes.FolderFromTemplate), + map(() => + this.openDialog({ + relativePath: 'Data Dictionary/Space Templates', + selectionType: 'folder' + }) + ) + ); + + @Effect({ dispatch: false }) + createFromTemplate$ = this.actions$.pipe( + ofType(TemplateActionTypes.CreateFromTemplate), + map(action => { + this.store + .select(getCurrentFolder) + .pipe( + switchMap(folder => { + return this.copyNode(action.payload, folder.id); + }), + take(1) + ) + .subscribe((node: NodeEntry | null) => { + if (node) { + this.store.dispatch(new CreateFromTemplateSuccess(node.entry)); + } + }); + }) + ); + + @Effect({ dispatch: false }) + createFromTemplateSuccess$ = this.actions$.pipe( + ofType( + TemplateActionTypes.CreateFromTemplateSuccess + ), + map(payload => { + this.matDialog.closeAll(); + this.content.reload.next(payload.node); + }) + ); + + private openDialog(config: TemplateDialogConfig) { + this.nodeTemplateService + .selectTemplateDialog(config) + .pipe(debounceTime(300)) + .subscribe(([node]) => + this.nodeTemplateService.createTemplateDialog(node) + ); + } + + private copyNode(source: Node, parentId: string): Observable { + return from( + this.apiService.getInstance().nodes.copyNode(source.id, { + targetParentId: parentId, + name: source.name + }) + ).pipe( + switchMap(node => + this.updateNode(node, { + properties: { + 'cm:title': source.properties['cm:title'], + 'cm:description': source.properties['cm:description'] + } + }) + ), + catchError(error => { + return this.handleError(error); + }) + ); + } + + private updateNode( + node: NodeEntry, + update: NodeBodyUpdate + ): Observable { + return from( + this.apiService.getInstance().nodes.updateNode(node.entry.id, update) + ).pipe(catchError(() => of(node))); + } + + private handleError(error: Error): Observable { + let statusCode: number; + + try { + statusCode = JSON.parse(error.message).error.statusCode; + } catch (e) { + statusCode = null; + } + + if (statusCode !== 409) { + this.store.dispatch( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.GENERIC') + ); + } else { + this.store.dispatch( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.CONFLICT') + ); + } + + return of(null); + } +} diff --git a/src/app/store/effects/upload.effects.spec.ts b/src/app/store/effects/upload.effects.spec.ts index 5b5a3912b..488578d2b 100644 --- a/src/app/store/effects/upload.effects.spec.ts +++ b/src/app/store/effects/upload.effects.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/upload.effects.ts b/src/app/store/effects/upload.effects.ts index ce9bf61df..da4b1f72f 100644 --- a/src/app/store/effects/upload.effects.ts +++ b/src/app/store/effects/upload.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/viewer.effects.spec.ts b/src/app/store/effects/viewer.effects.spec.ts index 72f890ec6..2ec2c8477 100644 --- a/src/app/store/effects/viewer.effects.spec.ts +++ b/src/app/store/effects/viewer.effects.spec.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/effects/viewer.effects.ts b/src/app/store/effects/viewer.effects.ts index 192b327d5..f3204f1ba 100644 --- a/src/app/store/effects/viewer.effects.ts +++ b/src/app/store/effects/viewer.effects.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/initial-state.ts b/src/app/store/initial-state.ts index 9a54f7fb9..4db70e686 100644 --- a/src/app/store/initial-state.ts +++ b/src/app/store/initial-state.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/store/reducers/app.reducer.ts b/src/app/store/reducers/app.reducer.ts index 2a6b4ef05..d423b363c 100644 --- a/src/app/store/reducers/app.reducer.ts +++ b/src/app/store/reducers/app.reducer.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/testing/app-testing.module.ts b/src/app/testing/app-testing.module.ts index 3e8bf6b0f..8017bb34d 100644 --- a/src/app/testing/app-testing.module.ts +++ b/src/app/testing/app-testing.module.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/testing/translate-pipe.directive.ts b/src/app/testing/translate-pipe.directive.ts index 33c28c2b0..473511450 100644 --- a/src/app/testing/translate-pipe.directive.ts +++ b/src/app/testing/translate-pipe.directive.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/testing/translation.service.ts b/src/app/testing/translation.service.ts index ca9e41682..65efae2a0 100644 --- a/src/app/testing/translation.service.ts +++ b/src/app/testing/translation.service.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/app/ui/custom-theme.scss b/src/app/ui/custom-theme.scss index db39d309c..fa20674ca 100644 --- a/src/app/ui/custom-theme.scss +++ b/src/app/ui/custom-theme.scss @@ -10,6 +10,7 @@ @import '../dialogs/node-versions/node-versions.dialog.theme'; @import '../components/create-menu/create-menu.component.scss'; @import '../components/layout/layout.theme.scss'; +@import '../dialogs/node-template/create-from-template.dialog.scss'; @import './overrides/adf-style-fixes.theme'; @@ -67,6 +68,7 @@ $warn: map-get($custom-theme, warn); @include sidenav-component-theme($theme); @include aca-current-user-theme($theme); @include aca-context-menu-theme($theme); + @include app-create-from-template-theme($theme); @include app-create-menu-theme($theme); @include adf-style-fixes($theme); diff --git a/src/app/ui/overrides/adf-style-fixes.theme.scss b/src/app/ui/overrides/adf-style-fixes.theme.scss index 52383281a..b4229859d 100644 --- a/src/app/ui/overrides/adf-style-fixes.theme.scss +++ b/src/app/ui/overrides/adf-style-fixes.theme.scss @@ -13,4 +13,8 @@ display: none; } } + + adf-share-dialog .mat-form-field-label-wrapper label { + display: none !important; + } } diff --git a/src/assets/app.extensions.json b/src/assets/app.extensions.json index 8a8c989b9..8c4301175 100644 --- a/src/assets/app.extensions.json +++ b/src/assets/app.extensions.json @@ -102,6 +102,39 @@ "actions": { "click": "CREATE_LIBRARY" } + }, + { + "id": "app.create.separator.2", + "type": "separator", + "order": 650 + }, + { + "id": "app.create.fileFromTemplate", + "order": 700, + "icon": "description", + "title": "APP.NEW_MENU.MENU_ITEMS.FILE_TEMPLATE", + "description": "APP.NEW_MENU.MENU_ITEMS.FILE_TEMPLATE", + "description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FILE_NOT_ALLOWED", + "actions": { + "click": "FILE_FROM_TEMPLATE" + }, + "rules": { + "enabled": "app.navigation.folder.canUpload" + } + }, + { + "id": "app.create.folderFromTemplate", + "order": 800, + "icon": "create_new_folder", + "title": "APP.NEW_MENU.MENU_ITEMS.FOLDER_TEMPLATE", + "description": "APP.NEW_MENU.MENU_ITEMS.FOLDER_TEMPLATE", + "description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED", + "actions": { + "click": "FOLDER_FROM_TEMPLATE" + }, + "rules": { + "enabled": "app.navigation.folder.canUpload" + } } ], "navbar": [ diff --git a/src/assets/i18n/ar.json b/src/assets/i18n/ar.json index b5e876dde..76b5182dc 100644 --- a/src/assets/i18n/ar.json +++ b/src/assets/i18n/ar.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "حقوق الطبع والنشر © 2017 - 2019 Alfresco Software, Inc. جميع الحقوق محفوظة.", + "COPYRIGHT": "حقوق الطبع والنشر © 2017 - 2020 Alfresco Software, Inc. جميع الحقوق محفوظة.", "ABOUT": { "VERSION": "الإصدار:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "إنشاء مجلد", "UPLOAD_FILE": "تحميل ملف", "UPLOAD_FOLDER": "تحميل مجلد", - "CREATE_LIBRARY": "إنشاء مكتبة" + "CREATE_LIBRARY": "إنشاء مكتبة", + "FILE_TEMPLATE": "إنشاء ملف من قالب", + "FOLDER_TEMPLATE": "إنشاء مجلد من قالب" }, "TOOLTIPS": { "CREATE_FOLDER": "إنشاء مجلد جديد", "CREATE_FOLDER_NOT_ALLOWED": "يتعذر إنشاء مجلدات أثناء عرض العناصر الحالية", + "CREATE_FILE_NOT_ALLOWED": "لا يمكن إنشاء الملفات أثناء عرض العناصر الحالية", "UPLOAD_FILES": "تحديد ملفات لتحميلها", "UPLOAD_FILES_NOT_ALLOWED": "يتعذر تحميل الملفات أثناء عرض العناصر الحالية", "UPLOAD_FOLDERS": "تحديد مجلدات لتحميلها", @@ -355,7 +358,31 @@ "COPY_ITEMS": "نسخ {{ number }} عناصر إلى...", "MOVE_ITEM": "نقل '{{ name }}' إلى...", "MOVE_ITEMS": "نقل {{ number }} عناصر إلى...", - "SEARCH": "بحث" + "SEARCH": "بحث", + "NEXT": "التالي", + "SELECT_FILE_TEMPLATE_TITLE": "تحديد قالب مستند", + "SELECT_FOLDER_TEMPLATE_TITLE": "تحديد قالب مجلد" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "إلغاء", + "CREATE": "إنشاء", + "FOLDER_DIALOG_TITLE": "إنشاء مجلد جديد من '{{ template }}'", + "FILE_DIALOG_TITLE": "إنشاء مجلد جديد من '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "الاسم", + "TITLE": "العنوان", + "DESCRIPTION": "الوصف" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "استخدم 512 حرفًا أو أقل للوصف", + "TITLE_TOO_LONG": "استخدم 256 أو أقل للعنوان", + "REQUIRED": "الاسم مطلوب", + "SPECIAL_CHARACTERS": "لا يمكن أن يحتوي الاسم على هذه الرموز * \" < > \\ / ? : |", + "ENDING_DOT": "لا يمكن أن ينتهي الاسم بنقطة .", + "ONLY_SPACES": "لا يمكن أن يحتوي الاسم على مسافات فقط" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "ملف مؤمن" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/cs.json b/src/assets/i18n/cs.json index a6f20733d..e3e349c79 100644 --- a/src/assets/i18n/cs.json +++ b/src/assets/i18n/cs.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Všechna práva vyhrazena.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Všechna práva vyhrazena.", "ABOUT": { "VERSION": "Verze:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Vytvořit složku", "UPLOAD_FILE": "Odeslat soubor", "UPLOAD_FOLDER": "Odeslat složku", - "CREATE_LIBRARY": "Vytvořit knihovnu" + "CREATE_LIBRARY": "Vytvořit knihovnu", + "FILE_TEMPLATE": "Vytvořit soubor ze šablony", + "FOLDER_TEMPLATE": "Vytvořit složku ze šablony" }, "TOOLTIPS": { "CREATE_FOLDER": "Vytvořit novou složku", "CREATE_FOLDER_NOT_ALLOWED": "Během prohlížení současných položek není vytvoření složky možné", + "CREATE_FILE_NOT_ALLOWED": "Soubory nelze vytvářet během prohlížení aktuálních položek.", "UPLOAD_FILES": "Vyberte soubory, které chcete odeslat", "UPLOAD_FILES_NOT_ALLOWED": "Během prohlížení současných položek není odeslání souborů možné", "UPLOAD_FOLDERS": "Vyberte složky, které chcete odeslat", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Zkopírovat položky ({{ number }}) do...", "MOVE_ITEM": "Přesunout položku '{{ name }}' do...", "MOVE_ITEMS": "Přesunout položky ({{ number }}) do...", - "SEARCH": "Hledat" + "SEARCH": "Hledat", + "NEXT": "Další", + "SELECT_FILE_TEMPLATE_TITLE": "Výběr šablony dokumentu", + "SELECT_FOLDER_TEMPLATE_TITLE": "Výběr šablony složky" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Zrušit", + "CREATE": "Vytvořit", + "FOLDER_DIALOG_TITLE": "Vytvořit novou složku ze šablony '{{ template }}'", + "FILE_DIALOG_TITLE": "Vytvořit nový dokument ze šablony '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Název", + "TITLE": "Označení", + "DESCRIPTION": "Popis" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Popis může obsahovat maximálně 512 znaků", + "TITLE_TOO_LONG": "Označení může obsahovat maximálně 256 znaků", + "REQUIRED": "Název je povinný", + "SPECIAL_CHARACTERS": "Název nemůže obsahovat tyto znaky: * \" < > \\ / ? : |", + "ENDING_DOT": "Název nemůže končit tečkou.", + "ONLY_SPACES": "Název nemůže obsahovat pouze mezery." + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "uzamčený soubor" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/da.json b/src/assets/i18n/da.json index fe98e639e..39e69518f 100644 --- a/src/assets/i18n/da.json +++ b/src/assets/i18n/da.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Alle rettigheder forbeholdes.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Alle rettigheder forbeholdes.", "ABOUT": { "VERSION": "Version:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Opret mappe", "UPLOAD_FILE": "Upload fil", "UPLOAD_FOLDER": "Upload mappe", - "CREATE_LIBRARY": "Opret bibliotek" + "CREATE_LIBRARY": "Opret bibliotek", + "FILE_TEMPLATE": "Opret fil fra skabelon", + "FOLDER_TEMPLATE": "Opret mappe fra skabelon" }, "TOOLTIPS": { "CREATE_FOLDER": "Opret ny mappe", "CREATE_FOLDER_NOT_ALLOWED": "Der kan ikke oprettes mapper, mens du får vist de aktuelle elementer", + "CREATE_FILE_NOT_ALLOWED": "Filer kan ikke oprettes, samtidig med at de aktuelle elementer vises", "UPLOAD_FILES": "Vælg de filer, du vil uploade", "UPLOAD_FILES_NOT_ALLOWED": "Der kan ikke uploades filer, mens du får vist de aktuelle elementer", "UPLOAD_FOLDERS": "Vælg de mapper, du vil uploade", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Kopiér {{ number }} elementer til...", "MOVE_ITEM": "Flyt '{{ name }}' til...", "MOVE_ITEMS": "Flyt {{ number }} elementer til...", - "SEARCH": "Søg" + "SEARCH": "Søg", + "NEXT": "Næste", + "SELECT_FILE_TEMPLATE_TITLE": "Vælg en dokumentskabelon", + "SELECT_FOLDER_TEMPLATE_TITLE": "Vælg en mappeskabelon" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Annuller", + "CREATE": "Opret", + "FOLDER_DIALOG_TITLE": "Opret en ny mappe fra '{{ template }}'", + "FILE_DIALOG_TITLE": "Opret et nyt dokument fra '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Navn", + "TITLE": "Titel", + "DESCRIPTION": "Beskrivelse" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Beskrivelsen må ikke være på mere end 512 tegn", + "TITLE_TOO_LONG": "Titlen må ikke være på mere end 256 tegn", + "REQUIRED": "Et navn er påkrævet", + "SPECIAL_CHARACTERS": "Navnet må ikke indeholde følgende tegn: * \" < > \\ / ? : |", + "ENDING_DOT": "Navnet må ikke slutte med et punktum (.)", + "ONLY_SPACES": "Navnet skal indeholde andet end mellemrum" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "låst fil" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 798a1a2f6..0bbbbd36c 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Alle Rechte vorbehalten.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Alle Rechte vorbehalten.", "ABOUT": { "VERSION": "Version:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Ordner erstellen", "UPLOAD_FILE": "Datei hochladen", "UPLOAD_FOLDER": "Ordner hochladen", - "CREATE_LIBRARY": "Bibliothek erstellen" + "CREATE_LIBRARY": "Bibliothek erstellen", + "FILE_TEMPLATE": "Datei aus Vorlage erstellen", + "FOLDER_TEMPLATE": "Ordner aus Vorlage erstellen" }, "TOOLTIPS": { "CREATE_FOLDER": "Neuen Ordner erstellen", "CREATE_FOLDER_NOT_ALLOWED": "Ordner können nicht erstellt werden, während die aktuellen Elemente angezeigt werden", + "CREATE_FILE_NOT_ALLOWED": "Dateien können nicht erstellt werden, während aktuelle Elemente angezeigt werden", "UPLOAD_FILES": "Dateien zum Hochladen auswählen", "UPLOAD_FILES_NOT_ALLOWED": "Dateien können nicht hochgeladen werden, während die aktuellen Elemente angezeigt werden", "UPLOAD_FOLDERS": "Ordner zum Hochladen auswählen", @@ -355,7 +358,31 @@ "COPY_ITEMS": "{{ number }} Elemente kopieren nach...", "MOVE_ITEM": "'{{ name }}' verschieben nach...", "MOVE_ITEMS": "{{ number }} Elemente verschieben nach...", - "SEARCH": "Suchen" + "SEARCH": "Suchen", + "NEXT": "Weiter", + "SELECT_FILE_TEMPLATE_TITLE": "Wählen Sie eine Dokumentvorlage aus", + "SELECT_FOLDER_TEMPLATE_TITLE": "Wählen Sie eine Ordnervorlage aus" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Abbrechen", + "CREATE": "Erstellen", + "FOLDER_DIALOG_TITLE": "Neuen Ordner aus Vorlage '{{ template }}' erstellen", + "FILE_DIALOG_TITLE": "Neues Dokument aus Vorlage '{{ template }}' erstellen", + "FORM": { + "PLACEHOLDER": { + "NAME": "Name", + "TITLE": "Titel", + "DESCRIPTION": "Beschreibung" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Die Beschreibung darf höchstens 512 Zeichen lang sein", + "TITLE_TOO_LONG": "Der Titel darf höchstens 256 Zeichen lang sein", + "REQUIRED": "Name ist erforderlich", + "SPECIAL_CHARACTERS": "Name darf die folgenden Zeichen nicht enthalten: * \" < > \\ / ? : |", + "ENDING_DOT": "Name darf nicht mit einem Punkt enden", + "ONLY_SPACES": "Name darf keine Leerzeichen enthalten" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "gesperrte Datei" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index ec473ac55..cfcd50a6a 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. All rights reserved.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. All rights reserved.", "ABOUT": { "VERSION": "Version:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Create Folder", "UPLOAD_FILE": "Upload File", "UPLOAD_FOLDER": "Upload Folder", - "CREATE_LIBRARY": "Create Library" + "CREATE_LIBRARY": "Create Library", + "FILE_TEMPLATE": "Create file from template", + "FOLDER_TEMPLATE": "Create folder from template" }, "TOOLTIPS": { "CREATE_FOLDER": "Create new folder", "CREATE_FOLDER_NOT_ALLOWED": "Folders cannot be created whilst viewing the current items", + "CREATE_FILE_NOT_ALLOWED": "Files cannot be created whilst viewing the current items", "UPLOAD_FILES": "Select files to upload", "UPLOAD_FILES_NOT_ALLOWED": "Files cannot be uploaded whilst viewing the current items", "UPLOAD_FOLDERS": "Select folders to upload", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Copy {{ number }} items to...", "MOVE_ITEM": "Move '{{ name }}' to...", "MOVE_ITEMS": "Move {{ number }} items to...", - "SEARCH": "Search" + "SEARCH": "Search", + "NEXT": "Next", + "SELECT_FILE_TEMPLATE_TITLE": "Select a document template", + "SELECT_FOLDER_TEMPLATE_TITLE": "Select a folder template" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "CANCEL", + "CREATE": "Create", + "FOLDER_DIALOG_TITLE": "Create new folder from '{{ template }}'", + "FILE_DIALOG_TITLE": "Create new document from '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Name", + "TITLE": "Title", + "DESCRIPTION": "Description" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Use 512 characters or less for description", + "TITLE_TOO_LONG": "Use 256 characters or less for title", + "REQUIRED": "Name is required", + "SPECIAL_CHARACTERS": "Name can't contain these characters * \" < > \\ / ? : |", + "ENDING_DOT": "Name can't end with a period .", + "ONLY_SPACES": "Name can't contain only spaces" + } + } }, "PERMISSIONS": { "DIALOG": { diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 9a2267db4..c59921140 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Todos los derechos reservados.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Todos los derechos reservados.", "ABOUT": { "VERSION": "Versión:", "PLUGINS": { @@ -15,12 +15,12 @@ }, "LICENSE": { "TITLE": "Licencia", - "PROPERTY": "Propiedad", + "PROPERTY": "Propiedades", "VALUE": "Valor" }, "STATUS": { "TITLE": "Estado", - "PROPERTY": "Propiedad", + "PROPERTY": "Propiedades", "VALUE": "Valor" }, "MODULES": { @@ -57,13 +57,16 @@ "CREATE_FOLDER": "Crear carpeta", "UPLOAD_FILE": "Añadir fichero", "UPLOAD_FOLDER": "Cargar carpeta", - "CREATE_LIBRARY": "Crear biblioteca" + "CREATE_LIBRARY": "Crear biblioteca", + "FILE_TEMPLATE": "Crear fichero a partir de plantilla", + "FOLDER_TEMPLATE": "Crear carpeta a partir de plantilla" }, "TOOLTIPS": { "CREATE_FOLDER": "Crear nueva carpeta", "CREATE_FOLDER_NOT_ALLOWED": "No se pueden crear carpetas mientras se visualizan los elementos actuales", + "CREATE_FILE_NOT_ALLOWED": "No es posible crear los ficheros mientras se muestran los elementos actuales", "UPLOAD_FILES": "Seleccionar ficheros para cargar", - "UPLOAD_FILES_NOT_ALLOWED": "No se pueden crear ficheros mientras se visualizan los elementos actuales", + "UPLOAD_FILES_NOT_ALLOWED": "No se pueden cargar ficheros mientras se visualizan elementos actuales", "UPLOAD_FOLDERS": "Seleccionar carpetas para cargar", "UPLOAD_FOLDERS_NOT_ALLOWED": "No se pueden cargar carpetas mientras se visualizan los elementos actuales", "CREATE_LIBRARY": "Crear una nueva biblioteca de ficheros" @@ -309,8 +312,8 @@ "NODE_DELETION": { "SINGULAR": "{{ name }} eliminado", "PLURAL": "Se han eliminado {{ number }} elementos", - "PARTIAL_SINGULAR": "Se ha eliminado {{ success }} elemento, {{ failed }} no se ha podido eliminar", - "PARTIAL_PLURAL": "Se han eliminado {{ success }} elementos, {{ failed }} no se han podido eliminar" + "PARTIAL_SINGULAR": "Se ha eliminado el elemento {{ success }}, {{ failed }} no se ha podido eliminar", + "PARTIAL_PLURAL": "Se han eliminado los elementos {{ success }}, {{ failed }} no se han podido eliminar" }, "NODE_COPY": { "SINGULAR": "Se ha copiado {{ success }} elemento", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Copiar {{ number }} elementos a...", "MOVE_ITEM": "Mover '{{ name }}' a...", "MOVE_ITEMS": "Mover {{ number }} elementos a...", - "SEARCH": "Buscar" + "SEARCH": "Buscar", + "NEXT": "Siguiente", + "SELECT_FILE_TEMPLATE_TITLE": "Seleccione una plantilla de documento", + "SELECT_FOLDER_TEMPLATE_TITLE": "Seleccione una plantilla de carpeta" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Cancelar", + "CREATE": "Crear", + "FOLDER_DIALOG_TITLE": "Crear nueva carpeta a partir de '{{ template }}'", + "FILE_DIALOG_TITLE": "Crear nuevo documento a partir de '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Nombre", + "TITLE": "Título", + "DESCRIPTION": "Descripción" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Utilice como máximo 512 caracteres para la descripción", + "TITLE_TOO_LONG": "Utilice como máximo 256 caracteres para el título", + "REQUIRED": "Se requiere el nombre", + "SPECIAL_CHARACTERS": "El nombre no puede contener estos caracteres * \" < > \\ / ? : |", + "ENDING_DOT": "El nombre no puede terminar en punto .", + "ONLY_SPACES": "El nombre no puede contener solo espacios" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -367,7 +394,7 @@ } }, "SHARED_LINK": { - "UNSHARE_PERMISSION_ERROR": "No tiene acceso para dejar de compartir este fichero" + "UNSHARE_PERMISSION_ERROR": "No tiene permiso para dejar de compartir este fichero" }, "VERSION": { "DIALOG_ADF": { @@ -503,7 +530,7 @@ "ADF_VERSION_LIST": { "ACTIONS": { "UPLOAD": { - "TOOLTIP": "Cargue nueva versión" + "TOOLTIP": "Cargar nueva versión" } } }, @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "fichero bloqueado" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/fi.json b/src/assets/i18n/fi.json index 30924fc7f..32d875447 100644 --- a/src/assets/i18n/fi.json +++ b/src/assets/i18n/fi.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Kaikki oikeudet pidätetään.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Kaikki oikeudet pidätetään.", "ABOUT": { "VERSION": "Versio:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Luo kansio", "UPLOAD_FILE": "Lataa tiedosto", "UPLOAD_FOLDER": "Lataa kansio", - "CREATE_LIBRARY": "Luo kirjasto" + "CREATE_LIBRARY": "Luo kirjasto", + "FILE_TEMPLATE": "Luo tiedosto mallista", + "FOLDER_TEMPLATE": "Luo kansio mallista" }, "TOOLTIPS": { "CREATE_FOLDER": "Luo uusi kansio", "CREATE_FOLDER_NOT_ALLOWED": "Kansioita ei voi luoda, kun tarkastelet nykyisiä kohteita", + "CREATE_FILE_NOT_ALLOWED": "Tiedostoja ei voi luoda, kun tarkastelet nykyisiä kohteita", "UPLOAD_FILES": "Valitse ladattavat tiedostot", "UPLOAD_FILES_NOT_ALLOWED": "Tiedostoja ei voi ladata, kun tarkastelet nykyisiä kohteita", "UPLOAD_FOLDERS": "Valitse ladattavat kansiot", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Kopioi {{ number }} kohdetta kohteeseen...", "MOVE_ITEM": "Siirrä '{{ name }}' kohteeseen...", "MOVE_ITEMS": "Siirrä {{ number }} kohdetta kohteeseen...", - "SEARCH": "Hae" + "SEARCH": "Hae", + "NEXT": "Seuraava", + "SELECT_FILE_TEMPLATE_TITLE": "Valitse asiakirjamalli", + "SELECT_FOLDER_TEMPLATE_TITLE": "Valitse kansiomalli" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Peruuta", + "CREATE": "Luo", + "FOLDER_DIALOG_TITLE": "Luo uusi kansio mallista '{{ template }}'", + "FILE_DIALOG_TITLE": "Luo uusi asiakirja mallista '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Nimi", + "TITLE": "Otsikko", + "DESCRIPTION": "Kuvaus" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Kuvauksessa voi olla enintään 512 merkkiä", + "TITLE_TOO_LONG": "Otsikossa voi olla enintään 256 merkkiä", + "REQUIRED": "Nimi on pakollinen", + "SPECIAL_CHARACTERS": "Nimessä ei saa olla näitä merkkejä: * \" < > \\ / ? : |", + "ENDING_DOT": "Nimi ei voi päättyä pisteeseen (.)", + "ONLY_SPACES": "Nimi ei voi koostua vain välilyönneistä" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "tiedosto lukittu" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index 29b02fcf2..eb59e676f 100644 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Tous droits réservés.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Tous droits réservés.", "ABOUT": { "VERSION": "Version :", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Créer un dossier", "UPLOAD_FILE": "Importer le fichier", "UPLOAD_FOLDER": "Importer le dossier", - "CREATE_LIBRARY": "Créer une Bibliothèque" + "CREATE_LIBRARY": "Créer une Bibliothèque", + "FILE_TEMPLATE": "Créer un fichier à partir d'un modèle", + "FOLDER_TEMPLATE": "Créer un dossier à partir d'un modèle" }, "TOOLTIPS": { "CREATE_FOLDER": "Créer un nouveau filtre", "CREATE_FOLDER_NOT_ALLOWED": "Impossible de créer des dossiers pendant l'affichage des éléments actuels.", + "CREATE_FILE_NOT_ALLOWED": "Impossible de créer des fichiers tout en visualisant les éléments actuels", "UPLOAD_FILES": "Sélectionner les fichiers à ajouter", "UPLOAD_FILES_NOT_ALLOWED": "Impossible de charger les fichiers pendant l'affichage des éléments actuels", "UPLOAD_FOLDERS": "Sélectionner les fichiers à ajouter", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Copier {{ number }} éléments vers...", "MOVE_ITEM": "Déplacer '{{ name }}' vers...", "MOVE_ITEMS": "Déplacer {{ number }} éléments vers...", - "SEARCH": "Rechercher" + "SEARCH": "Rechercher", + "NEXT": "Suivant", + "SELECT_FILE_TEMPLATE_TITLE": "Sélectionner un modèle de document", + "SELECT_FOLDER_TEMPLATE_TITLE": "Sélectionner un modèle de dossier" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Annuler", + "CREATE": "Créer", + "FOLDER_DIALOG_TITLE": "Créer un nouveau dossier à partir de '{{ template }}'", + "FILE_DIALOG_TITLE": "Créer un nouveau document à partir de '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Nom", + "TITLE": "Titre", + "DESCRIPTION": "Description" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "La description doit contenir 512 caractères maximum", + "TITLE_TOO_LONG": "Le titre doit contenir 256 caractères maximum", + "REQUIRED": "Un nom est requis", + "SPECIAL_CHARACTERS": "Le nom ne peut pas contenir les caractères * \" < > \\ / ? : |", + "ENDING_DOT": "Le nom ne peut pas se terminer par un point .", + "ONLY_SPACES": "Le nom ne peut pas contenir que des espaces" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "fichier verrouillé" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/it.json b/src/assets/i18n/it.json index f2078249b..40d7ce4c8 100644 --- a/src/assets/i18n/it.json +++ b/src/assets/i18n/it.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Tutti i diritti riservati.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Tutti i diritti riservati.", "ABOUT": { "VERSION": "Versione:", "PLUGINS": { @@ -8,7 +8,7 @@ "ID": "ID", "NAME": "Nome", "VERSION": "Versione", - "VENDOR": "Venditore", + "VENDOR": "Fornitore", "LICENSE": "Licenza", "RUNTIME": "Runtime", "DESCRIPTION": "Descrizione" @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Crea cartella", "UPLOAD_FILE": "Carica file", "UPLOAD_FOLDER": "Carica cartella", - "CREATE_LIBRARY": "Crea libreria" + "CREATE_LIBRARY": "Crea libreria", + "FILE_TEMPLATE": "Crea file da modello", + "FOLDER_TEMPLATE": "Crea cartella da modello" }, "TOOLTIPS": { "CREATE_FOLDER": "Crea nuova cartella", "CREATE_FOLDER_NOT_ALLOWED": "Impossibile creare cartelle durante la visualizzazione degli elementi correnti", + "CREATE_FILE_NOT_ALLOWED": "I file non possono essere creati durante la visualizzazione degli elementi correnti", "UPLOAD_FILES": "Seleziona file da caricare", "UPLOAD_FILES_NOT_ALLOWED": "Impossibile caricare file durante la visualizzazione degli elementi correnti", "UPLOAD_FOLDERS": "Seleziona cartelle da caricare", @@ -103,9 +106,9 @@ } }, "FAVORITE_LIBRARIES": { - "TITLE": "Raccolte preferite", + "TITLE": "Raccolte preferite", "SIDENAV_LINK": { - "LABEL": "Raccolte preferite", + "LABEL": "Raccolte preferite", "TOOLTIP": "Accedi alle raccolte preferite" } } @@ -201,7 +204,7 @@ "UNSHARE": "Rimuovi condivisione", "DETAILS": "Visualizza dettagli", "VERSIONS": "Gestione versioni", - "UPLOAD_VERSION": "Carica la nuova versione", + "UPLOAD_VERSION": "Caricare la nuova versione", "TOGGLE-SIDENAV": "Attiva/disattiva barra di navigazione laterale", "SHARE": "Condividi", "SHARE_EDIT": "Impostazioni di collegamento condiviso", @@ -280,13 +283,13 @@ "JOIN_REQUEST_FAILED": "Impossibile partecipare alla raccolta", "JOIN_CANCEL_FAILED": "Impossibile annullare la richiesta di partecipazione", "LEAVE_LIBRARY_FAILED": "Impossibile uscire dalla raccolta", - "INVALID_SENDER_EMAIL": "L'indirizzo e-mail deve essere valido prima della richiesta di accesso.", - "INVALID_RECEIVER_EMAIL": "Indirizzo e-mail del destinatario non valido. Contattare l'IT." + "INVALID_SENDER_EMAIL": "L'indirizzo email deve essere valido prima della richiesta di accesso.", + "INVALID_RECEIVER_EMAIL": "Indirizzo email del destinatario non valido. Contattare l'IT." }, "UPLOAD": { "ERROR": { "GENERIC": "Caricamento non riuscito. Se il problema persiste, contattare l'IT", - "CONFLICT": "Nuova versione non caricata. Esiste già un file con lo stesso nome.", + "CONFLICT": "Nuova versione non caricata. Esiste già un fil con lo stesso nome.", "500": "Errore interno del server. Riprovare o contattare il supporto IT [500]", "504": "Timeout del server. Riprovare o contattare il supporto IT [504]", "403": "Autorizzazioni insufficienti per caricare in questa posizione [403]", @@ -297,7 +300,7 @@ "TRASH": { "NODES_PURGE": { "PLURAL": "{{ number }} elementi eliminati", - "SINGULAR": "{{ name }} eliminato", + "SINGULAR": "Elemento {{ name }} eliminato", "PARTIAL_SINGULAR": "Elemento {{ name }} eliminato. Impossibile eliminare l'elemento {{ failed }}.", "PARTIAL_PLURAL": "{{ number }} elementi eliminati, impossibile eliminare {{ failed }}" }, @@ -308,7 +311,7 @@ }, "NODE_DELETION": { "SINGULAR": "{{ name }} eliminato", - "PLURAL": "Eliminati {{ number }} elementi", + "PLURAL": "{{ number }} elementi eliminati", "PARTIAL_SINGULAR": "Elemento {{ success }} eliminato, impossibile eliminare {{ failed }}", "PARTIAL_PLURAL": "Elementi {{ success }} eliminati, impossibile eliminare {{ failed }}" }, @@ -345,7 +348,7 @@ "TABS": { "PROPERTIES": "Proprietà", "LIBRARY_PROPERTIES": "Informazioni su", - "VERSIONS": "Versioni", + "VERSIONS": "Versione", "COMMENTS": "Commenti" } } @@ -355,7 +358,31 @@ "COPY_ITEMS": "Copia {{ number }} elementi in...", "MOVE_ITEM": "Sposta '{{ name }}' in...", "MOVE_ITEMS": "Sposta {{ number }} elementi in...", - "SEARCH": "Cerca" + "SEARCH": "Cerca", + "NEXT": "Successivo", + "SELECT_FILE_TEMPLATE_TITLE": "Selezionare un modello di documento", + "SELECT_FOLDER_TEMPLATE_TITLE": "Selezionare un modello di cartella" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Annulla", + "CREATE": "Crea", + "FOLDER_DIALOG_TITLE": "Creazione nuova cartella da '{{ template }}'", + "FILE_DIALOG_TITLE": "Creazione nuovo documento da '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Nome", + "TITLE": "Titolo", + "DESCRIPTION": "Descrizione" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Utilizzare 512 o meno per la descrizione", + "TITLE_TOO_LONG": "Utilizzare 256 caratteri o meno per il titolo", + "REQUIRED": "Nome obbligatorio", + "SPECIAL_CHARACTERS": "Il nome non può contenere questi caratteri * \" < > \\ / ? : |", + "ENDING_DOT": "Il nome non può terminare con un punto.", + "ONLY_SPACES": "Il nome non può contenere solo spazi" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -367,7 +394,7 @@ } }, "SHARED_LINK": { - "UNSHARE_PERMISSION_ERROR": "Non si dispone dei permessi per rimuovere la condivisione di questo file" + "UNSHARE_PERMISSION_ERROR": "Non hai il permesso per rimuovere la condivisione di questo file" }, "VERSION": { "DIALOG_ADF": { @@ -375,7 +402,7 @@ "CLOSE": "Chiudi" }, "DIALOG": { - "TITLE": "Carica la nuova versione", + "TITLE": "Utilizza nuova versione", "CANCEL": "Annulla", "UPLOAD": "Carica" }, @@ -503,7 +530,7 @@ "ADF_VERSION_LIST": { "ACTIONS": { "UPLOAD": { - "TOOLTIP": "Carica la nuova versione" + "TOOLTIP": "Caricare la nuova versione" } } }, @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "File bloccato" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/ja.json b/src/assets/i18n/ja.json index a06a48857..e0cb34fcb 100644 --- a/src/assets/i18n/ja.json +++ b/src/assets/i18n/ja.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc。 All rights reserved。", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc。 All rights reserved。", "ABOUT": { "VERSION": "バージョン:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "フォルダの作成", "UPLOAD_FILE": "ファイルのアップロード", "UPLOAD_FOLDER": "フォルダのアップロード", - "CREATE_LIBRARY": "ライブラリの作成" + "CREATE_LIBRARY": "ライブラリの作成", + "FILE_TEMPLATE": "テンプレートからファイルを作成", + "FOLDER_TEMPLATE": "テンプレートからフォルダを作成" }, "TOOLTIPS": { "CREATE_FOLDER": "新しいフォルダを作成します", "CREATE_FOLDER_NOT_ALLOWED": "現在のアイテムを表示している間はフォルダを作成できません", + "CREATE_FILE_NOT_ALLOWED": "現在のアイテムを表示している間はファイルを作成できません", "UPLOAD_FILES": "アップロードするファイルを選択します", "UPLOAD_FILES_NOT_ALLOWED": "現在のアイテムを表示している間はファイルをアップロードできません", "UPLOAD_FOLDERS": "アップロードするフォルダを選択します", @@ -355,7 +358,31 @@ "COPY_ITEMS": "{{ number }} 件のアイテムのコピー先...", "MOVE_ITEM": "'{{ name }}' の移動先...", "MOVE_ITEMS": "{{ number }} 件のアイテムの移動先...", - "SEARCH": "検索" + "SEARCH": "検索", + "NEXT": "次へ", + "SELECT_FILE_TEMPLATE_TITLE": "文書テンプレートを選択してください", + "SELECT_FOLDER_TEMPLATE_TITLE": "フォルダテンプレートを選択してください" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "キャンセル", + "CREATE": "作成", + "FOLDER_DIALOG_TITLE": "'{{ template }}' から新規フォルダを作成します", + "FILE_DIALOG_TITLE": "'{{ template }}' から新規文書を作成します", + "FORM": { + "PLACEHOLDER": { + "NAME": "名前", + "TITLE": "タイトル", + "DESCRIPTION": "説明" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "説明は 512 文字以内で入力してください", + "TITLE_TOO_LONG": "タイトルは 256 文字以内で入力してください", + "REQUIRED": "名前を指定してください", + "SPECIAL_CHARACTERS": "名前に次の文字を含めることはできません。 * \" < > \\ / ? : |", + "ENDING_DOT": "名前の末尾にピリオド (.) を付けることはできません。", + "ONLY_SPACES": "名前にスペースだけを含めることはできません" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "ロックされているファイル" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/nb.json b/src/assets/i18n/nb.json index 8e537a7cf..eb8725183 100644 --- a/src/assets/i18n/nb.json +++ b/src/assets/i18n/nb.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Med enerett.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Med enerett.", "ABOUT": { "VERSION": "Versjon:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Opprett mappe", "UPLOAD_FILE": "Last opp fil", "UPLOAD_FOLDER": "Last opp mappe", - "CREATE_LIBRARY": "Opprett bibliotek" + "CREATE_LIBRARY": "Opprett bibliotek", + "FILE_TEMPLATE": "Opprett fil fra mal", + "FOLDER_TEMPLATE": "Opprett mappe fra mal" }, "TOOLTIPS": { "CREATE_FOLDER": "Opprett ny mappe", "CREATE_FOLDER_NOT_ALLOWED": "Mapper kan ikke opprettes mens du viser de gjeldende elementene", + "CREATE_FILE_NOT_ALLOWED": "Filer kan ikke opprettes mens du viser de gjeldende elementene", "UPLOAD_FILES": "Velg filene som skal lastes opp", "UPLOAD_FILES_NOT_ALLOWED": "Filer kan ikke lastes opp mens du viser de gjeldende elementene", "UPLOAD_FOLDERS": "Velg mappene som skal lastes opp", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Kopier {{ number }} elementer til...", "MOVE_ITEM": "Flytt {{ name }}'til...", "MOVE_ITEMS": "Flytt {{ number }} elementer til...", - "SEARCH": "Søk" + "SEARCH": "Søk", + "NEXT": "Neste", + "SELECT_FILE_TEMPLATE_TITLE": "Velg en dokumentmal", + "SELECT_FOLDER_TEMPLATE_TITLE": "Velg en mappemal" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Avbryt", + "CREATE": "Opprett", + "FOLDER_DIALOG_TITLE": "Opprett ny mappe fra '{{ template }}'", + "FILE_DIALOG_TITLE": "Opprett nytt dokument fra '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Navn", + "TITLE": "Tittel", + "DESCRIPTION": "Beskrivelse" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Bruk 512 tegn eller mindre i beskrivelsen", + "TITLE_TOO_LONG": "Bruk 256 tegn eller mindre i tittelen", + "REQUIRED": "Navn må oppgis", + "SPECIAL_CHARACTERS": "Navnet kan ikke inneholde tegnene * \" < > \\ / ? : |", + "ENDING_DOT": "Navnet kan ikke ende med et punktum .", + "ONLY_SPACES": "Navnet kan ikke kun bestå av mellomrom" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "låst fil" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/nl.json b/src/assets/i18n/nl.json index 2a0ed49eb..fee220471 100644 --- a/src/assets/i18n/nl.json +++ b/src/assets/i18n/nl.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Alle rechten voorbehouden.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Alle rechten voorbehouden.", "ABOUT": { "VERSION": "Versie:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Map maken", "UPLOAD_FILE": "Bestand uploaden", "UPLOAD_FOLDER": "Map uploaden", - "CREATE_LIBRARY": "Bibliotheek maken" + "CREATE_LIBRARY": "Bibliotheek maken", + "FILE_TEMPLATE": "Bestand maken op basis van sjabloon", + "FOLDER_TEMPLATE": "Map maken op basis van sjabloon" }, "TOOLTIPS": { "CREATE_FOLDER": "Nieuwe map maken", "CREATE_FOLDER_NOT_ALLOWED": "Mappen kunnen niet worden gemaakt terwijl de huidige items worden weergegeven", + "CREATE_FILE_NOT_ALLOWED": "Bestanden kunnen niet worden gemaakt terwijl de huidige items worden weergegeven", "UPLOAD_FILES": "Bestanden selecteren om te uploaden", "UPLOAD_FILES_NOT_ALLOWED": "Bestanden kunnen niet worden geüpload terwijl de huidige items worden weergegeven", "UPLOAD_FOLDERS": "Mappen selecteren om te uploaden", @@ -355,7 +358,31 @@ "COPY_ITEMS": "{{ number }} items kopiëren naar...", "MOVE_ITEM": "'{{ name }}' verplaatsen naar...", "MOVE_ITEMS": "{{ number }} items verplaatsen naar...", - "SEARCH": "Zoeken" + "SEARCH": "Zoeken", + "NEXT": "Volgende", + "SELECT_FILE_TEMPLATE_TITLE": "Een documentsjabloon selecteren", + "SELECT_FOLDER_TEMPLATE_TITLE": "Een mapsjabloon selecteren" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Annuleren", + "CREATE": "Maken", + "FOLDER_DIALOG_TITLE": "Nieuwe map maken op basis van '{{ template }}'", + "FILE_DIALOG_TITLE": "Nieuw document maken op basis van '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Naam", + "TITLE": "Titel", + "DESCRIPTION": "Beschrijving" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Gebruik 512 tekens of minder voor de beschrijving", + "TITLE_TOO_LONG": "Gebruik 256 tekens of minder voor de titel", + "REQUIRED": "Naam is vereist", + "SPECIAL_CHARACTERS": "Naam mag de volgende tekens niet bevatten: * \" < > \\ / ? : |", + "ENDING_DOT": "Naam mag niet eindigen met een punt.", + "ONLY_SPACES": "Naam mag niet alleen uit spaties bestaan" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "Vergrendeld bestand" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/pl.json b/src/assets/i18n/pl.json index 11daa02fa..e79ef626b 100644 --- a/src/assets/i18n/pl.json +++ b/src/assets/i18n/pl.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Wszelkie prawa zastrzeżone.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Wszelkie prawa zastrzeżone.", "ABOUT": { "VERSION": "Wersja:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Utwórz Folder", "UPLOAD_FILE": "Prześlij plik", "UPLOAD_FOLDER": "Prześlij folder", - "CREATE_LIBRARY": "Utwórz bibliotekę" + "CREATE_LIBRARY": "Utwórz bibliotekę", + "FILE_TEMPLATE": "Stwórz plik w oparciu o szablon", + "FOLDER_TEMPLATE": "Stwórz folder w oparciu o szablon" }, "TOOLTIPS": { "CREATE_FOLDER": "Utwórz nowy folder", "CREATE_FOLDER_NOT_ALLOWED": "Nie można tworzyć folderów podczas przeglądania bieżących elementów", + "CREATE_FILE_NOT_ALLOWED": "Pliki nie mogą zostać utworzone podczas oglądania aktualnych elementów.", "UPLOAD_FILES": "Wybierz pliki do przesłania", "UPLOAD_FILES_NOT_ALLOWED": "Nie można przesyłać plików podczas przeglądania bieżących elementów", "UPLOAD_FOLDERS": "Wybierz foldery do przesłania", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Kopiowanie {{ number }} elementów do...", "MOVE_ITEM": "Przenieś '{{ name }}' do...", "MOVE_ITEMS": "Przenoszenie {{ number }} elementów do...", - "SEARCH": "Szukaj" + "SEARCH": "Szukaj", + "NEXT": "Następny", + "SELECT_FILE_TEMPLATE_TITLE": "Wybierz szablon dokumentu", + "SELECT_FOLDER_TEMPLATE_TITLE": "Wybierz szablon folderu" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Anuluj", + "CREATE": "Utwórz", + "FOLDER_DIALOG_TITLE": "Utwórz nowy folder w oparciu o '{{ szablon }}'", + "FILE_DIALOG_TITLE": "Utwórz nowy dokument w oparciu o '{{ szablon }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Nazwa", + "TITLE": "Tytuł", + "DESCRIPTION": "Opis" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "W opisie można użyć maksymalnie 512 znaków", + "TITLE_TOO_LONG": "W tytule można użyć maksymalnie 256 znaków", + "REQUIRED": "Nazwa jest wymagana", + "SPECIAL_CHARACTERS": "Nazwa nie może zawierać następujących znaków: * \" < > \\ / ? : |", + "ENDING_DOT": "Nazwa nie może kończyć się kropką (.)", + "ONLY_SPACES": "Nazwa nie może zawierać spacji" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "zablokowany plik" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/pt-BR.json b/src/assets/i18n/pt-BR.json index b90beadb0..d7e6d09f8 100644 --- a/src/assets/i18n/pt-BR.json +++ b/src/assets/i18n/pt-BR.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Todos os direitos reservados.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Todos os direitos reservados.", "ABOUT": { "VERSION": "Versão:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Criar pasta", "UPLOAD_FILE": "Carregar arquivo", "UPLOAD_FOLDER": "Carregar pasta", - "CREATE_LIBRARY": "Criar biblioteca" + "CREATE_LIBRARY": "Criar biblioteca", + "FILE_TEMPLATE": "Criar arquivo a partir do modelo", + "FOLDER_TEMPLATE": "Criar pasta a partir do modelo" }, "TOOLTIPS": { "CREATE_FOLDER": "Criar nova pasta", "CREATE_FOLDER_NOT_ALLOWED": "Não é possível criar pastas durante a visualização dos itens atuais", + "CREATE_FILE_NOT_ALLOWED": "Os arquivos não podem ser criados enquanto os itens atuais estiverem sendo visualizados", "UPLOAD_FILES": "Selecionar arquivos para carregar", "UPLOAD_FILES_NOT_ALLOWED": "Não é possível carregar arquivos durante a visualização dos itens atuais", "UPLOAD_FOLDERS": "Selecionar pastas para carregar", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Copiar {{ number }} itens para...", "MOVE_ITEM": "Mover '{{ name }}' para...", "MOVE_ITEMS": "Mover {{ number }} itens para...", - "SEARCH": "Pesquisar" + "SEARCH": "Pesquisar", + "NEXT": "Próximo", + "SELECT_FILE_TEMPLATE_TITLE": "Selecionar um modelo de documento", + "SELECT_FOLDER_TEMPLATE_TITLE": "Selecionar um modelo de pasta" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Cancelar", + "CREATE": "Criar", + "FOLDER_DIALOG_TITLE": "Criar nova pasta a partir de '{{ template }}'", + "FILE_DIALOG_TITLE": "Criar novo documento a partir de '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Nome", + "TITLE": "Título", + "DESCRIPTION": "Descrição" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Use 512 caracteres ou menos para a descrição", + "TITLE_TOO_LONG": "Use 256 caracteres ou menos para o título", + "REQUIRED": "Nome é obrigatório", + "SPECIAL_CHARACTERS": "O nome não pode ter estes caracteres * \" < > \\ / ? : |", + "ENDING_DOT": "O nome não pode terminar com um ponto final .", + "ONLY_SPACES": "O nome não pode ter apenas espaços" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "arquivo bloqueado" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/ru.json b/src/assets/i18n/ru.json index 82ff91604..eb4826585 100644 --- a/src/assets/i18n/ru.json +++ b/src/assets/i18n/ru.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Все права защищены.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Все права защищены.", "ABOUT": { "VERSION": "Версия:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Создать папку", "UPLOAD_FILE": "Загрузить файл", "UPLOAD_FOLDER": "Загрузить папку", - "CREATE_LIBRARY": "Создание библиотеки" + "CREATE_LIBRARY": "Создание библиотеки", + "FILE_TEMPLATE": "Создать файл из шаблона", + "FOLDER_TEMPLATE": "Создать папку из шаблона" }, "TOOLTIPS": { "CREATE_FOLDER": "Создать новую папку", "CREATE_FOLDER_NOT_ALLOWED": "Невозможно создать папки во время просмотра текущих элементов", + "CREATE_FILE_NOT_ALLOWED": "Файлы нельзя создать во время просмотра текущих элементов", "UPLOAD_FILES": "Выберите файлы, которые необходимо загрузить", "UPLOAD_FILES_NOT_ALLOWED": "Невозможно загрузить файлы во время просмотра текущих элементов", "UPLOAD_FOLDERS": "Выберите папки, которые необходимо загрузить", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Скопировать элементы {{ number }} в...", "MOVE_ITEM": "Переместить '{{ name }}' в...", "MOVE_ITEMS": "Переместить элементы {{ number }} в...", - "SEARCH": "Поиск" + "SEARCH": "Поиск", + "NEXT": "Далее", + "SELECT_FILE_TEMPLATE_TITLE": "Выберите шаблон документа", + "SELECT_FOLDER_TEMPLATE_TITLE": "Выберите шаблон папки" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Отмена", + "CREATE": "Создать", + "FOLDER_DIALOG_TITLE": "Создать новую папку из '{{ шаблона }}'", + "FILE_DIALOG_TITLE": "Создать новый документ из '{{ шаблона }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Имя", + "TITLE": "Название", + "DESCRIPTION": "Описание" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Описание должно содержать не более 512 символов", + "TITLE_TOO_LONG": "Название должно содержать не более 256 символов", + "REQUIRED": "Необходимо указать имя", + "SPECIAL_CHARACTERS": "Имя не может содержать символы * \" < > \\ / ? : |", + "ENDING_DOT": "Имя не может заканчиваться точкой .", + "ONLY_SPACES": "Имя не может содержать только пробелы" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "заблокированный файл" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/sv.json b/src/assets/i18n/sv.json index bd37a7457..60f418f84 100644 --- a/src/assets/i18n/sv.json +++ b/src/assets/i18n/sv.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc. Alla rättigheter förbehålls.", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc. Alla rättigheter förbehålls.", "ABOUT": { "VERSION": "Version:", "PLUGINS": { @@ -45,7 +45,7 @@ "INVALID-VALUE-FORMAT": "Ogiltigt värdeformat", "REQUIRED-FIELD": "Det här fältet krävs", "RESET": "Återställ", - "APPLY": "Använd" + "APPLY": "Tillämpa" }, "PREVIEW": { "TITLE": "Förhandsgranskning" @@ -57,11 +57,14 @@ "CREATE_FOLDER": "Skapa mapp", "UPLOAD_FILE": "Ladda upp fil", "UPLOAD_FOLDER": "Ladda upp mapp", - "CREATE_LIBRARY": "Skapa bibliotek" + "CREATE_LIBRARY": "Skapa bibliotek", + "FILE_TEMPLATE": "Skapa fil från mall", + "FOLDER_TEMPLATE": "Skapa mapp från mall" }, "TOOLTIPS": { "CREATE_FOLDER": "Skapa ny mapp", "CREATE_FOLDER_NOT_ALLOWED": "Mappar kan inte skapas när man visar de aktuella objekten", + "CREATE_FILE_NOT_ALLOWED": "Filerna kan inte skapas när aktuella objekt visas", "UPLOAD_FILES": "Välj filer att ladda upp", "UPLOAD_FILES_NOT_ALLOWED": "Filer kan inte laddas upp när man visar de aktuella objekten", "UPLOAD_FOLDERS": "Välj mappar att ladda upp", @@ -355,7 +358,31 @@ "COPY_ITEMS": "Kopiera {{ number }} objekt till...", "MOVE_ITEM": "Flytta '{{ name }}' till...", "MOVE_ITEMS": "Flytta {{ number }} objekt till...", - "SEARCH": "Sök" + "SEARCH": "Sök", + "NEXT": "Nästa", + "SELECT_FILE_TEMPLATE_TITLE": "Välj en dokumentmall", + "SELECT_FOLDER_TEMPLATE_TITLE": "Välj en mappmall" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "Avbryt", + "CREATE": "Skapa", + "FOLDER_DIALOG_TITLE": "Skapa ny mapp från '{{ template }}'", + "FILE_DIALOG_TITLE": "Skapa nytt dokument från '{{ template }}'", + "FORM": { + "PLACEHOLDER": { + "NAME": "Namn", + "TITLE": "Titel", + "DESCRIPTION": "Beskrivning" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "Använd 512 tecken eller färre till beskrivningen", + "TITLE_TOO_LONG": "Använd 256 tecken eller färre till titeln", + "REQUIRED": "Namn krävs", + "SPECIAL_CHARACTERS": "Namnet kan inte innehålla dessa tecken * \" < > \\ / ? : |", + "ENDING_DOT": "Namnet kan inte sluta med en punkt .", + "ONLY_SPACES": "Namnet kan inte innehålla endast mellanslag" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "låst fil" } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/zh-CN.json b/src/assets/i18n/zh-CN.json index 3e659188a..b9fe83f25 100644 --- a/src/assets/i18n/zh-CN.json +++ b/src/assets/i18n/zh-CN.json @@ -1,6 +1,6 @@ { "APP": { - "COPYRIGHT": "© 2017 - 2019 Alfresco Software, Inc。保留所有权利。", + "COPYRIGHT": "© 2017 - 2020 Alfresco Software, Inc。保留所有权利。", "ABOUT": { "VERSION": "版本:", "PLUGINS": { @@ -57,11 +57,14 @@ "CREATE_FOLDER": "创建文件夹", "UPLOAD_FILE": "上传文件", "UPLOAD_FOLDER": "上传文件夹", - "CREATE_LIBRARY": "创建库" + "CREATE_LIBRARY": "创建库", + "FILE_TEMPLATE": "从模板创建文件", + "FOLDER_TEMPLATE": "从模板创建文件夹" }, "TOOLTIPS": { "CREATE_FOLDER": "新建文件夹", "CREATE_FOLDER_NOT_ALLOWED": "查看当前项目时无法创建文件夹", + "CREATE_FILE_NOT_ALLOWED": "查看当前项目时无法创建文件", "UPLOAD_FILES": "选择要上传的文件", "UPLOAD_FILES_NOT_ALLOWED": "查看当前项目时无法上传文件", "UPLOAD_FOLDERS": "选择要上传的文件夹", @@ -355,7 +358,31 @@ "COPY_ITEMS": "将 {{ number }} 个项目复制到...", "MOVE_ITEM": "将 '{{ name }}' 移动到...", "MOVE_ITEMS": "将 {{ number }} 个项目移动到...", - "SEARCH": "搜索" + "SEARCH": "搜索", + "NEXT": "下一个", + "SELECT_FILE_TEMPLATE_TITLE": "选择一个文档模板", + "SELECT_FOLDER_TEMPLATE_TITLE": "选择一个文件夹模板" + }, + "NODE_FROM_TEMPLATE": { + "CANCEL": "取消", + "CREATE": "创建", + "FOLDER_DIALOG_TITLE": "从 '{{ template }}' 创建新文件夹", + "FILE_DIALOG_TITLE": "从 '{{ template }}' 创建新文档", + "FORM": { + "PLACEHOLDER": { + "NAME": "名称", + "TITLE": "标题", + "DESCRIPTION": "说明" + }, + "ERRORS": { + "DESCRIPTION_TOO_LONG": "对描述使用 512 个字符或更少字符", + "TITLE_TOO_LONG": "对标题使用 256 个字符或更少字符", + "REQUIRED": "需要名称", + "SPECIAL_CHARACTERS": "名称不能包含字符 * \" < > \\ / ? : |", + "ENDING_DOT": "名称不能以句号 . 结尾", + "ONLY_SPACES": "名称不能仅包含空格" + } + } }, "PERMISSIONS": { "DIALOG": { @@ -519,4 +546,4 @@ "BASELINE-LOCK-24PX": "已锁定文件" } } -} +} \ No newline at end of file diff --git a/src/assets/plugins/app.header.json b/src/assets/plugins/app.header.json index 8e582c131..5ad36ae22 100644 --- a/src/assets/plugins/app.header.json +++ b/src/assets/plugins/app.header.json @@ -22,6 +22,26 @@ ], "features": { + "userActions": [ + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker", + "rules": { + "visible": "app.canShowLanguagePicker" + } + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } + } + ], "header": [ { "id": "app.header.more", diff --git a/src/environments/environment.e2e.ts b/src/environments/environment.e2e.ts index 8b54e09ef..bfb5fce27 100644 --- a/src/environments/environment.e2e.ts +++ b/src/environments/environment.e2e.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index e527b9d9b..89baf01f1 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/environments/environment.ts b/src/environments/environment.ts index dfcb40b14..7e46f647e 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/src/main.ts b/src/main.ts index c5732e1b8..dc1b0fb09 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -35,5 +35,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) +platformBrowserDynamic() + .bootstrapModule(AppModule) .catch(err => console.log(err)); diff --git a/src/polyfills.ts b/src/polyfills.ts index be4a58484..dfa3a1bf5 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -65,12 +65,9 @@ /** IE10 and IE11 requires the following for the Reflect API. */ // import 'core-js/es6/reflect'; - /** Evergreen browsers require these. **/ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. - - /** * Web Animations `@angular/platform-browser/animations` * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. @@ -83,11 +80,11 @@ * user can disable parts of macroTask/DomEvents patch by setting following flags */ - // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame - // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick - // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames +// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame +// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick +// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames - /* +/* * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js * with the following flag, it will bypass `zone.js` patch for IE/Edge */ @@ -96,8 +93,7 @@ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - +import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS diff --git a/src/test.ts b/src/test.ts index fa4dd2c73..29f91c2a2 100644 --- a/src/test.ts +++ b/src/test.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 @@ -42,7 +42,7 @@ declare const __karma__: any; declare const require: any; // Prevent Karma from running prematurely. -__karma__.loaded = function () {}; +__karma__.loaded = function() {}; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( diff --git a/src/typings.d.ts b/src/typings.d.ts index 2431fdbd8..8d49f37f9 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -2,7 +2,7 @@ * @license * Alfresco Example Content Application * - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 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 diff --git a/start-sso.sh b/start-sso.sh deleted file mode 100755 index dd5054dd3..000000000 --- a/start-sso.sh +++ /dev/null @@ -1,18 +0,0 @@ -export HOST_IP=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) -export APP_URL="http://${HOST_IP}:8080" - -export APP_CONFIG_AUTH_TYPE="OAUTH" -export APP_CONFIG_OAUTH2_HOST="http://${HOST_IP}:8085/auth/realms/alfresco" -export APP_CONFIG_OAUTH2_CLIENTID="alfresco" -export APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI="${APP_URL}/assets/silent-refresh.html" -export APP_CONFIG_OAUTH2_REDIRECT_LOGIN="/" -export APP_CONFIG_OAUTH2_REDIRECT_LOGOUT="/logout" - -docker-compose -f docker-compose-keycloak.yml up -d --build - -echo "Waiting for the app..." -npm run wait:app - -echo "HOST_IP: ${HOST_IP}" -echo "Realm: ${APP_CONFIG_OAUTH2_HOST}" -echo "Content Workspace: ${APP_URL}" diff --git a/start.sh b/start.sh new file mode 100755 index 000000000..de073be42 --- /dev/null +++ b/start.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash + +show_help() { + echo "Usage: ./start.sh" + echo "" + echo "-k or --keycloak if you want to use keycloak as identity provider" + echo "-d or --down delete all container" + echo "-hi or --host-ip set the host ip" + echo "-hp or --host-port set the host port. Default 8080" + echo "-w or --wait wait for backend. Default true" + echo "-aca. Only redeploy ACA and skip the other docker compose services" + echo "-h or --help" +} + +set_keycloak(){ + KEYCLOAK="true" +} + +down(){ + docker-compose down + exit 0 +} + +set_host_ip(){ + SET_HOST_IP=$1 +} + +set_host_port(){ + HOST_PORT=$1 +} + +set_wait(){ + WAIT=$1 +} + +redeploy_aca(){ + REDEPLOY_ACA="true" +} + +# Defaults +WAIT="true" +SET_HOST_IP="" +HOST_PORT="8080" +KEYCLOAK="false" +AIMS_PROPS="" +REDEPLOY_ACA="false" + +while [[ $1 == -* ]]; do + case "$1" in + -h|--help|-\?) show_help; exit 0;; + -k|--keycloak) set_keycloak; shift;; + -d|--down) down; shift;; + -aca) redeploy_aca; shift;; + -w|--wait) set_wait $2; shift 2;; + -hi|--host-ip) set_host_ip $2; shift 2;; + -hp|--host-port) set_host_port $2; shift 2;; + -*) echo "invalid option: $1" 1>&2; show_help; exit 1;; + esac +done + +if [ -n "${SET_HOST_IP}" ];then + export HOST_IP=${SET_HOST_IP} +else + echo "No HOST_IP set, try to figure out on its own ..." + export HOST_IP=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) +fi +echo "HOST_IP: ${HOST_IP}" + +URL_FRAGMENT="content-app" +export APP_URL="http://${HOST_IP}:${HOST_PORT}/${URL_FRAGMENT}" +echo "Content Workspace: ${APP_URL}" + +if [[ $KEYCLOAK == "true" ]]; then + export APP_CONFIG_AUTH_TYPE="OAUTH" + export APP_CONFIG_OAUTH2_HOST="http://${HOST_IP}:8085/auth/realms/alfresco" + echo "Realm: ${APP_CONFIG_OAUTH2_HOST}" + export APP_CONFIG_OAUTH2_CLIENTID="alfresco" + export APP_CONFIG_OAUTH2_IMPLICIT_FLOW=true + export APP_CONFIG_OAUTH2_SILENT_LOGIN=true + export APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI="${APP_URL}/assets/silent-refresh.html" + export APP_CONFIG_OAUTH2_REDIRECT_LOGIN="${APP_URL}/" + export APP_CONFIG_OAUTH2_REDIRECT_LOGOUT="/$URL_FRAGMENT/logout" + # export APP_BASE_SHARE_URL="${APP_URL}#/preview/s" + + AIMS_PROPS="-Dauthentication.chain=identity-service1:identity-service,alfrescoNtlm1:alfrescoNtlm" +fi + +export AIMS_PROPS=${AIMS_PROPS} + +if [[ $REDEPLOY_ACA == "true" ]]; then + echo "Redeploy content-app" + docker-compose up --detach --build content-app +else + echo "Start docker compose" + docker-compose up -d --build +fi + +if [[ $WAIT == "true" ]]; then + echo "http://${HOST_IP:-localhost}:${HOST_PORT:-8080}/$URL_FRAGMENT/" + echo "Waiting for the app ..." + HOST_IP=$HOST_IP HOST_PORT=$HOST_PORT npm run wait:app + if [ $? == 1 ]; then + echo "Waiting failed -> exit 1" + exit 1 + fi +fi diff --git a/update-submodules.sh b/update-submodules.sh new file mode 100755 index 000000000..a0335e740 --- /dev/null +++ b/update-submodules.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +git pull +git submodule sync --recursive +git submodule update --init --recursive +# Go through all of the submodules switching them to their branches and updating them + +echo +echo "Updating alfresco-js-api ..." +echo -------------------------- +cd alfresco-js-api && git checkout master && git pull +cd .. + +echo +echo "Updating alfresco-ng2-components ..." +echo -------------------------- +cd alfresco-ng2-components && git checkout master && git pull +cd ..