Merge pull request #615 from Alfresco/development

1.4.0
This commit is contained in:
Denys Vuika
2018-09-06 16:07:19 +01:00
committed by GitHub
323 changed files with 28839 additions and 11770 deletions
-97
View File
@@ -1,97 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "alfresco-content-app"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon-96x96.png",
"app.config.json",
"versions.json",
{
"glob": "**/*",
"input": "../node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "./assets/prebuilt-themes"
},
{
"glob": "**/*",
"input": "../node_modules/@alfresco/adf-core/bundles/assets",
"output": "./assets/"
},
{
"glob": "**/*",
"input": "../node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "./assets/"
},
{ "glob": "pdf.worker.js", "input": "../node_modules/pdfjs-dist/build", "output": "./" }
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "aca",
"styles": [
"./assets/fonts/material-icons/material-icons.css",
"./assets/fonts/muli/muli.css",
"styles.scss"
],
"scripts": [
"../node_modules/pdfjs-dist/build/pdf.js",
"../node_modules/pdfjs-dist/lib/shared/compatibility.js",
"../node_modules/pdfjs-dist/web/pdf_viewer.js",
"../node_modules/moment/min/moment.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
},
"stylePreprocessorOptions": {
"includePaths": [
"app/ui"
]
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {},
"serve": {
"proxyConfig": "proxy.conf.js",
"port": 4200,
"host": "0.0.0.0"
}
}
}
+14 -5
View File
@@ -15,10 +15,19 @@ before_script:
# Disable services enabled by default # Disable services enabled by default
- sudo /etc/init.d/postgresql stop - sudo /etc/init.d/postgresql stop
install: before_install:
- npm install -g npm@latest - npm install -g npm@latest
- npm ci - export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3 # give xvfb some time to start
script: jobs:
# - docker-compose stop include:
- npm run build && npm run e2e:docker - stage: test
script: npm run lint && npm run spellcheck
- stage: test
script:
- npm run test:ci
- bash <(curl -s https://codecov.io/bash) -X gcov
- stage: e2e
script: npm run build && npm run e2e:docker
+1 -3
View File
@@ -1,6 +1,4 @@
{ {
"javascript.preferences.quoteStyle": "single", "javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single", "typescript.preferences.quoteStyle": "single"
"javascript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.importModuleSpecifier": "relative"
} }
+2 -2
View File
@@ -1,9 +1,9 @@
FROM nginx:alpine FROM nginx:stable-alpine
LABEL version="1.3" LABEL version="1.3"
LABEL maintainer="Denys Vuika <denys.vuika@alfresco.com>" LABEL maintainer="Denys Vuika <denys.vuika@alfresco.com>"
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
COPY dist/ . COPY dist/app/ .
+13 -5
View File
@@ -1,6 +1,6 @@
<p align="left"> <img title="Alfresco" src="alfresco.png" alt="Alfresco - make business flow"></p> <p align="left"> <img title="Alfresco" src="alfresco.png" alt="Alfresco - make business flow"></p>
# Alfresco Example Content Application # Example Content Application
## Introduction ## Introduction
@@ -24,11 +24,19 @@ To get help on Angular CLI use ng help or read the [Angular CLI README](https://
Isuses can be raised in GitHub or in the Alfresco JIRA project. Isuses can be raised in GitHub or in the Alfresco JIRA project.
Please include a clear description, steps to reproduce and screenshots where appropriate.All issues will be reviewed; bugs will be categorized if reproducible and enhancement/feature suggestions will be considered against existing priorities if the use case serves a general-purpose need. Please include a clear description, steps to reproduce and screenshots where appropriate.All issues will be reviewed; bugs will be categorized if reproducible and enhancement/feature suggestions will be considered against existing priorities if the use case serves a general-purpose need.
#### High level features planned for Q3 2018 (July - September) #### Features added in the latest release
* Library Management - create, find, join and manage file libraries. * Application Extensibility - first phase of extensibilty, see [Documentation](https://alfresco.github.io/alfresco-content-app/#/extending) for details.
* Commenting - View and add comments to files and folders * Sharing Files - activate and deactivate shared file links.
* Sharing Files - activate and deactivate shared file both manually and automatically. * Commenting - View and add comments to files and folders.
* Permissions - update file and folder permissions. * Permissions - update file and folder permissions.
* Print - print action from the file viewer
* Improved UX - single click to open folders and files, and right click actions menu
Please refer to the [release notes](https://github.com/Alfresco/alfresco-content-app/releases) for details of all changes.
#### High level features planned for H2 2018 (July - December)
* Library Management - create, find, join and manage file libraries.
* Sharing Files - add an expiry date to a sharable link.
* Application Extensibility - Extension framework to provide simple ways to extend the application. * Application Extensibility - Extension framework to provide simple ways to extend the application.
### Want to help? ### Want to help?
+299
View File
@@ -0,0 +1,299 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/app",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"stylePreprocessorOptions": {
"includePaths": [
"src/app/ui"
]
},
"assets": [
"src/assets",
"src/favicon-96x96.png",
"src/app.config.json",
"src/versions.json",
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "/assets/prebuilt-themes"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/bundles/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "/assets"
},
{
"glob": "pdf.worker.min.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
},
{
"glob": "**/*",
"input": "node_modules/monaco-editor/min",
"output": "./assets/monaco"
},
{
"glob": "**/*.js",
"input": "node_modules/@ngstack/code-editor/workers",
"output": "./assets/workers"
}
],
"styles": [
"src/assets/fonts/material-icons/material-icons.css",
"src/assets/fonts/muli/muli.css",
"src/styles.scss"
],
"scripts": [
"node_modules/pdfjs-dist/build/pdf.js",
"node_modules/pdfjs-dist/lib/shared/compatibility.js",
"node_modules/pdfjs-dist/web/pdf_viewer.js",
"node_modules/moment/min/moment.min.js"
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build",
"port": 4200,
"host": "0.0.0.0",
"proxyConfig": "proxy.conf.js"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"sourceMap": true,
"polyfills": "src/polyfills.ts",
"stylePreprocessorOptions": {
"includePaths": [
"src/app/ui"
]
},
"tsConfig": "src/tsconfig.spec.json",
"scripts": [
"node_modules/pdfjs-dist/build/pdf.js",
"node_modules/pdfjs-dist/lib/shared/compatibility.js",
"node_modules/pdfjs-dist/web/pdf_viewer.js",
"node_modules/moment/min/moment.min.js"
],
"styles": [
"src/assets/fonts/material-icons/material-icons.css",
"src/assets/fonts/muli/muli.css",
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon-96x96.png",
"src/app.config.json",
"src/versions.json",
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "/assets/prebuilt-themes"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/bundles/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "/assets"
},
{
"glob": "pdf.worker.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"app-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"devServerTarget": "app:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"aca-dev-tools": {
"root": "projects/aca-dev-tools",
"sourceRoot": "projects/aca-dev-tools/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/aca-dev-tools/tsconfig.lib.json",
"project": "projects/aca-dev-tools/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/aca-dev-tools/ng-package.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/aca-dev-tools/src/test.ts",
"tsConfig": "projects/aca-dev-tools/tsconfig.spec.json",
"karmaConfig": "projects/aca-dev-tools/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/aca-dev-tools/tsconfig.lib.json",
"projects/aca-dev-tools/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"adf-extensions": {
"root": "projects/adf-extensions",
"sourceRoot": "projects/adf-extensions/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/adf-extensions/tsconfig.lib.json",
"project": "projects/adf-extensions/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/adf-extensions/ng-package.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/adf-extensions/src/test.ts",
"tsConfig": "projects/adf-extensions/tsconfig.spec.json",
"karmaConfig": "projects/adf-extensions/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/adf-extensions/tsconfig.lib.json",
"projects/adf-extensions/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "app",
"schematics": {
"@schematics/angular:component": {
"prefix": "aca",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "aca"
}
}
}
+15 -3
View File
@@ -3,6 +3,7 @@
"language": "en", "language": "en",
"words": [ "words": [
"succes", "succes",
"sharedlinks",
"ngrx", "ngrx",
"ngstack", "ngstack",
@@ -21,8 +22,14 @@
"promisify", "promisify",
"xdescribe", "xdescribe",
"unfavorite", "unfavorite",
"Snackbar",
"devtools", "devtools",
"gitter",
"jira",
"markdownlint",
"uploader",
"nginx",
"docx",
"SOLR",
"unshare", "unshare",
"validators", "validators",
@@ -36,9 +43,14 @@
"tooltip", "tooltip",
"tooltips", "tooltips",
"unindent", "unindent",
"exif" "exif",
"cardview",
"webm",
"keycodes"
], ],
"dictionaries": [ "dictionaries": [
"html" "html",
"en-gb",
"en_US"
] ]
} }
+2 -2
View File
@@ -35,7 +35,7 @@ services:
networks: networks:
- internal - internal
ports: ports:
- 8081:8080 - 8083:8080
postgres: postgres:
image: postgres:10.1 image: postgres:10.1
@@ -81,7 +81,7 @@ services:
# - ./nginx.conf:/etc/nginx/conf.d/default.conf # - ./nginx.conf:/etc/nginx/conf.d/default.conf
proxy: proxy:
image: nginx image: nginx:stable-alpine
depends_on: depends_on:
- content-app - content-app
volumes: volumes:
+2 -2
View File
@@ -35,7 +35,7 @@ services:
networks: networks:
- internal - internal
ports: ports:
- 8081:8080 - 8083:8080
postgres: postgres:
image: postgres:10.1 image: postgres:10.1
@@ -68,7 +68,7 @@ services:
- 8983:8983 #Browser port - 8983:8983 #Browser port
content-app: content-app:
image: alfresco/alfresco-content-app:master image: alfresco/alfresco-content-app:master-latest
depends_on: depends_on:
- alfresco - alfresco
networks: networks:
+38 -19
View File
@@ -1,5 +1,7 @@
# Alfresco Example Content Application # Alfresco Example Content Application
<!-- markdownlint-disable MD033 -->
## Introduction ## Introduction
The Alfresco Content Application is an example application built using The Alfresco Content Application is an example application built using
@@ -15,11 +17,11 @@ with a simple and easy to use interface for working with files stored in the Alf
### Prerequisites ### Prerequisites
This application uses the latest releases from Alfresco: This application was created based on the latest releases from Alfresco:
- [Alfresco ADF (2.4.0)](https://community.alfresco.com/community/application-development-framework/pages/get-started) - [Alfresco ADF (2.5.0)](https://community.alfresco.com/community/application-development-framework/pages/get-started)
- [Alfresco Content Services (5.2.3)](https://www.alfresco.com/platform/content-services-ecm) - [Alfresco Content Services (6.0.0)](https://www.alfresco.com/platform/content-services-ecm)
or [Alfresco Community Edition (201802 EA)](https://www.alfresco.com/products/community/download) or [Alfresco Community Edition (6.0 - General Release: 201806)](https://www.alfresco.com/products/community/download)
<p class="warning"> <p class="warning">
You also need <a href="https://nodejs.org/en/" target="_blank">node.js</a> (LTS) installed to build it locally from source code. You also need <a href="https://nodejs.org/en/" target="_blank">node.js</a> (LTS) installed to build it locally from source code.
@@ -190,8 +192,9 @@ For more information on the [SearchComponent](https://github.com/Alfresco/alfres
#### Actions and the Actions Toolbar #### Actions and the Actions Toolbar
All the views incorporate the [toolbar](https://alfresco.github.io/adf-component-catalog/components/ToolbarComponent.html) All the views incorporate the [toolbar](https://alfresco.github.io/adf-component-catalog/components/ToolbarComponent.html)
component from the Alfresco Application Development Framework; component from the Alfresco Application Development Framework.
apart from the Trash view they all display the following actions when the current user has the necessary permissions,
Actions are displayed in the toolbar when item(s) are selected, or a right click is performed; apart from the Trash view they all display the following actions when the current user has the necessary permissions,
actions are automatically hidden when the user does not have permission. actions are automatically hidden when the user does not have permission.
<table> <table>
@@ -242,6 +245,15 @@ actions are automatically hidden when the user does not have permission.
once the move action has completed the user is notified and can undo the action (which moves the items back to the original location). once the move action has completed the user is notified and can undo the action (which moves the items back to the original location).
</td> </td>
</tr> </tr>
<tr>
<td>Share</td>
<td>
Create and copy a link to a file that can be shared, the links are accessible without granting permissions to the file, and do not require users to login to the application.
</td>
<td>
Not applicable.
</td>
</tr>
<tr> <tr>
<td>Delete</td> <td>Delete</td>
<td colspan="2"> <td colspan="2">
@@ -257,11 +269,20 @@ actions are automatically hidden when the user does not have permission.
</td> </td>
<td>Not applicable</td> <td>Not applicable</td>
</tr> </tr>
<tr>
<td>Permissions</td>
<td>
Permissions on a file can be adjusted as required in a number of ways; disable inheritance from the parent folder, change a user or groups role and grant users/groups access.
</td>
<td>Not available</td>
</tr>
</tbody> </tbody>
</table> </table>
Besides the actions available in the toolbar users can single click an item to select it, Besides the actions available in the toolbar users can
or double click on a file to view it, and a folder to open it. * single click on a file to view it, and a folder to open it
* single click an item to select it
* double click on a file to view it, and a folder to open it
### File Viewer ### File Viewer
@@ -287,7 +308,7 @@ The Header & Toolbar section of the viewer contains a number of features that re
The File Viewer consists of four separate views that handle displaying the content based on four types of content, covering various [file/mime](https://alfresco.github.io/adf-component-catalog/components/ViewerComponent.html#supported-file-formats) types: The File Viewer consists of four separate views that handle displaying the content based on four types of content, covering various [file/mime](https://alfresco.github.io/adf-component-catalog/components/ViewerComponent.html#supported-file-formats) types:
- Document View: PDFs are displayed in the application File Viewer, for other document types (DOCX etc) then a PDF rendition is automatically retrieved. - Document View: PDF files are displayed in the application File Viewer, for other document types (DOCX etc) then a PDF rendition is automatically retrieved.
- Image View: JPEG, PNG, GIF, BMP and SVG images are natively displayed in the application File Viewer. - Image View: JPEG, PNG, GIF, BMP and SVG images are natively displayed in the application File Viewer.
- Media View: MP4, MP3, WAV, OGG and WEBM files are played natively application File Viewer. The File Viewer will download, by default, 50MB of the content at a time to ensure a smooth playback of the content. - Media View: MP4, MP3, WAV, OGG and WEBM files are played natively application File Viewer. The File Viewer will download, by default, 50MB of the content at a time to ensure a smooth playback of the content.
- Text View: TXT, XML, JS, HTML, JSON and TS files are natively displayed as text in the application File Viewer. - Text View: TXT, XML, JS, HTML, JSON and TS files are natively displayed as text in the application File Viewer.
@@ -306,14 +327,16 @@ At the bottom of the content the Viewer Controls allow users to interact with th
- Jump to page number - Jump to page number
- Zoom in/out - Zoom in/out
- Fit to page - Fit to page
- Print
- Image View: - Image View:
- Zoom in/out - Zoom in/out
- Rotate left/right (does not alter content in the repository) - Rotate left/right (does not alter content in the repository)
- Reset image - Reset image
- Print
- Media View: - Media View:
- Play/pause - Play/pause
- Timeline position - Timeline position
- Audio mute/unmute - Toggle audio
- Audio volume - Audio volume
- Full screen - Full screen
@@ -329,16 +352,11 @@ The Properties tab displays the node's metadata info by using the [ContentMetada
![](images/content-metadata.png) ![](images/content-metadata.png)
For more information, please check also the ADF's [ContentMetadataComponent](https://alfresco.github.io/adf-component-catalog/components/ContentMetadataComponent.html). For more information, please check also the [ContentMetadataComponent](https://alfresco.github.io/adf-component-catalog/components/ContentMetadataComponent.html).
#### Versions tab #### Comments tab
The Versions tab displays info about the node's versions and allows users to [manage versions](#version-manager), according to their permissions. Only the file nodes have version data available. The Comments tab displays all comments made on the selected node in the respoistory by using the [CommentsComponent](https://alfresco.github.io/adf-component-catalog/components/CommentsComponent.html). Users can post new comments that will be displayed immediately.
![Version Manager Tab](images/version-manager-tab.png)
It uses the [VersionManagerComponent](https://alfresco.github.io/adf-component-catalog/components/VersionManagerComponent.html) from ADF framework.
Managing versions of a file can be possible also by accessing the 'Manage Versions' option from the 'More actions' menu.
### Version Manager ### Version Manager
@@ -357,7 +375,8 @@ There are 2 ways users can access the Version Manager:
#### Upload new version #### Upload new version
A new version for the selected file can be added by using this button. Users can upload a new file version using a file that is does not have the same name, or mimetype as the current version, whilst allowing the user to choose the type of version (minor or major) and inputting supporting comments. A new version for the selected file can be added by using this button. Users can upload a new file version using a file that is does not have the same name, or mime type as the current version, whilst allowing the user to choose the type of version (minor or major) and inputting supporting comments.
Please also check the [UploadVersionButtonComponent](https://alfresco.github.io/adf-component-catalog/components/UploadVersionButtonComponent.html). Please also check the [UploadVersionButtonComponent](https://alfresco.github.io/adf-component-catalog/components/UploadVersionButtonComponent.html).
#### Actions Menu #### Actions Menu
+1569
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -1,3 +1,7 @@
---
title: Getting Started
---
# Getting Started # Getting Started
## Prerequisites ## Prerequisites
@@ -478,7 +482,7 @@ In the `app.config.json` define a link entry which will point to the custom page
{ {
"icon": "work", "icon": "work",
"label": "Link", "label": "Link",
"title": "My custome link", "title": "My custom link",
"route": { "route": {
"url": "/custom-route" "url": "/custom-route"
} }
+4
View File
@@ -1,3 +1,7 @@
---
title: Get Help
---
# Where to get help # Where to get help
There are several ways to get help with building applications using the Alfresco Application Development Framework: There are several ways to get help with building applications using the Alfresco Application Development Framework:
+5
View File
@@ -11,6 +11,7 @@
<body> <body>
<div id="app"></div> <div id="app"></div>
<script src="https://unpkg.com/docute@3/dist/docute.js"></script> <script src="https://unpkg.com/docute@3/dist/docute.js"></script>
<script src="https://unpkg.com/prismjs/components/prism-typescript.js"></script>
<script> <script>
docute.init({ docute.init({
nav: [ nav: [
@@ -22,6 +23,10 @@
title: 'Getting Started', title: 'Getting Started',
path: 'getting-started' path: 'getting-started'
}, },
{
title: 'Extending',
path: 'extending'
},
{ {
title: 'Get Help', title: 'Get Help',
path: 'help' path: 'help'
+3
View File
@@ -27,6 +27,9 @@ export * from './login/login';
export * from './header/header'; export * from './header/header';
export * from './header/user-info'; export * from './header/user-info';
export * from './data-table/data-table'; export * from './data-table/data-table';
export * from './dialog/confirm-dialog';
export * from './dialog/create-edit-folder-dialog';
export * from './pagination/pagination'; export * from './pagination/pagination';
export * from './sidenav/sidenav'; export * from './sidenav/sidenav';
export * from './toolbar/toolbar'; export * from './toolbar/toolbar';
export * from './viewer/viewer';
+44 -23
View File
@@ -43,7 +43,8 @@ export class DataTable extends Component {
row: '.adf-datatable-row[role]', row: '.adf-datatable-row[role]',
selectedRow: '.adf-datatable-row.is-selected', selectedRow: '.adf-datatable-row.is-selected',
cell: '.adf-data-table-cell', cell: '.adf-data-table-cell',
locationLink: 'aca-location-link', locationLink: '.aca-location-link',
linkCell: '.adf-location-cell',
selectedIcon: '.mat-icon', selectedIcon: '.mat-icon',
@@ -59,6 +60,7 @@ export class DataTable extends Component {
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body)); body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
cell = by.css(DataTable.selectors.cell); cell = by.css(DataTable.selectors.cell);
locationLink = by.css(DataTable.selectors.locationLink); locationLink = by.css(DataTable.selectors.locationLink);
linkCell: ElementFinder = this.component.element(by.css(DataTable.selectors.linkCell));
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer)); emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop)); emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle)); emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
@@ -123,6 +125,10 @@ export class DataTable extends Component {
return this.body.all(by.css(DataTable.selectors.row)); return this.body.all(by.css(DataTable.selectors.row));
} }
countRows(): promise.Promise<number> {
return this.getRows().count();
}
getSelectedRows(): ElementArrayFinder { getSelectedRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.selectedRow)); return this.body.all(by.css(DataTable.selectors.selectedRow));
} }
@@ -135,37 +141,41 @@ export class DataTable extends Component {
return this.getRows().get(nth - 1); return this.getRows().get(nth - 1);
} }
getRowName(name: string): ElementFinder { getRowByName(name: string): ElementFinder {
return this.body.element(by.cssContainingText(`.adf-data-table-cell span`, name)); return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
}
getRowFirstCell(name: string) {
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(0);
}
getRowNameCell(name: string) {
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(1);
}
getRowNameCellText(name: string) {
return this.getRowNameCell(name).$('span');
} }
getItemNameTooltip(name: string): promise.Promise<string> { getItemNameTooltip(name: string): promise.Promise<string> {
return this.getRowName(name).getAttribute('title'); return this.getRowNameCellText(name).getAttribute('title');
}
countRows(): promise.Promise<number> {
return this.getRows().count();
} }
hasCheckMarkIcon(itemName: string) { hasCheckMarkIcon(itemName: string) {
return this.getRowName(itemName).element(by.xpath(`./ancestor::div[contains(@class, 'adf-datatable-row')]`)) return this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent();
.element(by.css(DataTable.selectors.selectedIcon)).isPresent();
} }
// Navigation/selection methods // Navigation/selection methods
doubleClickOnItemName(name: string): promise.Promise<any> { doubleClickOnRowByName(name: string): promise.Promise<any> {
const dblClick = browser.actions() const item = this.getRowFirstCell(name);
.mouseMove(this.getRowName(name)) return Utils.waitUntilElementClickable(item)
.click() .then(() => browser.actions().mouseMove(item).click().click().perform());
.click();
return dblClick.perform();
} }
clickOnItemName(name: string): promise.Promise<any> { selectItem(name: string): promise.Promise<any> {
const item = this.getRowName(name); const item = this.getRowFirstCell(name);
return Utils.waitUntilElementClickable(item) return Utils.waitUntilElementClickable(item)
.then(() => this.getRowName(name).click()); .then(() => item.click());
} }
selectMultipleItems(names: string[]): promise.Promise<void> { selectMultipleItems(names: string[]): promise.Promise<void> {
@@ -173,7 +183,7 @@ export class DataTable extends Component {
.then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform()) .then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform())
.then(() => { .then(() => {
names.forEach(name => { names.forEach(name => {
this.clickOnItemName(name); this.selectItem(name);
}); });
}) })
.then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()); .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform());
@@ -187,14 +197,25 @@ export class DataTable extends Component {
} }
getItemLocation(name: string) { getItemLocation(name: string) {
return this.getRowName(name).element(by.xpath(`./ancestor::div[contains(@class, 'adf-datatable-row')]`)) return this.getRowByName(name).element(this.locationLink);
.element(this.locationLink);
} }
getItemLocationTooltip(name: string): promise.Promise<string> { getItemLocationTooltip(name: string): promise.Promise<string> {
return this.getItemLocation(name).$('a').getAttribute('title'); return this.getItemLocation(name).$('a').getAttribute('title');
} }
getItemLocationTileAttr(name: string) {
const location = this.getItemLocation(name).$('a');
const condition = () => location.getAttribute('title').then((value) => value && value.length > 0);
browser.actions()
.mouseMove(location)
.perform();
browser.wait(condition, BROWSER_WAIT_TIMEOUT);
return location.getAttribute('title');
}
clickItemLocation(name: string) { clickItemLocation(name: string) {
return this.getItemLocation(name).click(); return this.getItemLocation(name).click();
} }
+69
View File
@@ -0,0 +1,69 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
export class ConfirmDialog extends Component {
private static selectors = {
root: 'adf-confirm-dialog',
title: '.mat-dialog-title',
content: '.mat-dialog-content',
delete: 'adf-confirm-accept',
keep: 'adf-confirm-cancel'
};
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
deleteButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.delete));
keepButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.keep));
constructor(ancestor?: ElementFinder) {
super(ConfirmDialog.selectors.root, ancestor);
}
async waitForDialogToClose() {
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async getTitle() {
return await this.title.getText();
}
async getText() {
return await this.content.getText();
}
async clickDelete() {
await this.deleteButton.click();
}
async clickKeep() {
await this.keepButton.click();
await this.waitForDialogToClose();
}
}
+23 -2
View File
@@ -26,17 +26,38 @@
import { ElementFinder, by } from 'protractor'; import { ElementFinder, by } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { UserInfo } from './user-info'; import { UserInfo } from './user-info';
import { protractor } from 'protractor';
import { Utils } from '../../utilities/utils';
export class Header extends Component { export class Header extends Component {
private locators = { private locators = {
logoLink: by.css('.app-menu__title'), logoLink: by.css('.app-menu__title'),
userInfo: by.css('aca-current-user') userInfo: by.css('aca-current-user'),
searchButton: by.css('#adf-search-button'),
searchBar: by.css('#adf-control-input')
}; };
logoLink: ElementFinder = this.component.element(this.locators.logoLink); logoLink: ElementFinder = this.component.element(this.locators.logoLink);
userInfo: UserInfo = new UserInfo(this.component); userInfo: UserInfo = new UserInfo(this.component);
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
searchBar: ElementFinder = this.component.element(this.locators.searchBar);
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super('aca-header', ancestor); super('adf-layout-header', ancestor);
}
searchForText(text: string) {
return this.searchBar.clear()
.then(() => this.searchBar.sendKeys(text))
.then(() => this.searchBar.sendKeys(protractor.Key.ENTER));
}
async waitForSearchButton() {
return await Utils.waitUntilElementClickable(this.searchButton);
}
async waitForSearchBar() {
return await Utils.waitUntilElementClickable(this.searchBar);
} }
} }
+95
View File
@@ -0,0 +1,95 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
export class InfoDrawer extends Component {
private static selectors = {
root: 'aca-info-drawer',
header: '.adf-info-drawer-layout-header',
content: '.adf-info-drawer-layout-content',
tabs: '.adf-info-drawer-tabs',
tabLabel: '.mat-tab-label-content',
tabActiveLabel: '.mat-tab-label-active',
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
};
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent));
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
constructor(ancestor?: ElementFinder) {
super(InfoDrawer.selectors.root, ancestor);
}
async waitForInfoDrawerToOpen() {
return browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
}
async isEmpty() {
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
return false;
}
return true;
}
getTabByTitle(title: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title));
}
async isTabPresent(title: string) {
return await this.getTabByTitle(title).isPresent();
}
async isTabDisplayed(title: string) {
return await this.getTabByTitle(title).isDisplayed();
}
async getTabTitle(index: number) {
return await this.tabLabelsList.get(index - 1).getAttribute('innerText');
}
async clickTab(title: string) {
return await this.getTabByTitle(title).click();
}
async getComponentIdOfTab(title: string) {
return await this.tabActiveContent.getAttribute('data-automation-id');
}
}
+4 -4
View File
@@ -32,20 +32,20 @@ export class Menu extends Component {
root: '.mat-menu-panel', root: '.mat-menu-panel',
item: '.mat-menu-item', item: '.mat-menu-item',
icon: '.mat-icon', icon: '.mat-icon',
uploadFiles: 'input[id="upload-multiple-files"]' uploadFiles: 'app-upload-files'
}; };
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item)); items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop')); backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop'));
uploadFiles: ElementFinder = this.component.element(by.css(Menu.selectors.uploadFiles)); uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor); super(Menu.selectors.root, ancestor);
} }
waitForMenuToOpen() { waitForMenuToOpen() {
return browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT) return browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT)
.then(() => browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT)) .then(() => browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT))
.then(() => browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT)); .then(() => browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT));
} }
+20 -11
View File
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, promise, protractor, browser } from 'protractor';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
@@ -40,25 +40,34 @@ export class ToolbarActions extends Component {
super(ToolbarActions.selectors.root, ancestor); super(ToolbarActions.selectors.root, ancestor);
} }
isEmpty(): promise.Promise<boolean> { async isEmpty() {
return this.buttons.count().then(count => (count === 0)); return await this.buttons.count() === 0;
} }
isButtonPresent(title: string): promise.Promise<boolean> { async isButtonPresent(title: string) {
return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent(); return await this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent();
} }
getButtonByLabel(label: string): ElementFinder { getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label)); return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label));
} }
getButtonByTitleAttribute(title: string): ElementFinder { getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)); return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`));
} }
openMoreMenu() { async openMoreMenu() {
return this.getButtonByTitleAttribute('More actions').click() await this.getButtonByTitleAttribute('More actions').click();
.then(() => this.menu.waitForMenuToOpen()) await this.menu.waitForMenuToOpen();
.then(() => this.menu); return this.menu;
} }
async closeMoreMenu() {
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
} }
+101
View File
@@ -0,0 +1,101 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { ToolbarActions } from '../toolbar/toolbar-actions';
export class Viewer extends Component {
private static selectors = {
root: 'adf-viewer',
layout: '.adf-viewer-layout-content',
contentContainer: '.adf-viewer-content-container',
closeBtn: '.adf-viewer-close-button',
fileTitle: '.adf-viewer__file-title',
viewerExtensionContent: 'app-preview-extension'
};
viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout));
viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer));
closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn));
fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle));
viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent));
toolbar = new ToolbarActions(this.component);
constructor(ancestor?: ElementFinder) {
super(Viewer.selectors.root, ancestor);
}
async waitForViewerToOpen() {
return await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT)
.catch(err => err);
}
async isViewerOpened() {
return await browser.isElementPresent(this.viewerLayout);
}
async isViewerContentDisplayed() {
return await browser.isElementPresent(this.viewerContainer);
}
async isViewerToolbarDisplayed() {
return await browser.isElementPresent(this.toolbar.component);
}
async isCloseButtonDisplayed() {
return await browser.isElementPresent(this.closeButton);
}
async isFileTitleDisplayed() {
return await browser.isElementPresent(this.fileTitle);
}
async clickClose() {
return await this.closeButton.click();
}
async getCloseButtonTooltip() {
return await this.toolbar.getButtonTooltip(this.closeButton);
}
async getFileTitle() {
return await this.fileTitle.getText();
}
async isCustomContentPresent() {
return await browser.isElementPresent(this.viewerExtensionContent);
}
async getComponentIdOfView() {
if (await this.isCustomContentPresent()) {
return await this.viewerExtensionContent.getAttribute('data-automation-id');
}
}
}
+24 -2
View File
@@ -26,10 +26,10 @@
export const BROWSER_RESOLUTION_WIDTH = 1200; export const BROWSER_RESOLUTION_WIDTH = 1200;
export const BROWSER_RESOLUTION_HEIGHT = 800; export const BROWSER_RESOLUTION_HEIGHT = 800;
export const BROWSER_WAIT_TIMEOUT = 30000; export const BROWSER_WAIT_TIMEOUT = 10000;
// Application configs // Application configs
export const APP_HOST = 'http://localhost:3000'; export const APP_HOST = 'http://localhost:4000';
// Repository configs // Repository configs
export const REPO_API_HOST = 'http://localhost:8080'; export const REPO_API_HOST = 'http://localhost:8080';
@@ -40,6 +40,8 @@ export const ADMIN_USERNAME = 'admin';
export const ADMIN_PASSWORD = 'admin'; export const ADMIN_PASSWORD = 'admin';
export const ADMIN_FULL_NAME = 'Administrator'; export const ADMIN_FULL_NAME = 'Administrator';
export const E2E_ROOT_PATH = __dirname;
// Application Routes // Application Routes
export const APP_ROUTES = { export const APP_ROUTES = {
FAVORITES: '/favorites', FAVORITES: '/favorites',
@@ -62,6 +64,12 @@ export const SIDEBAR_LABELS = {
TRASH: 'Trash' TRASH: 'Trash'
}; };
// Page titles
export const PAGE_TITLES = {
VIEWER: 'Preview',
SEARCH: 'Search Results'
};
// Site visibility // Site visibility
export const SITE_VISIBILITY = { export const SITE_VISIBILITY = {
PUBLIC: 'PUBLIC', PUBLIC: 'PUBLIC',
@@ -76,3 +84,17 @@ export const SITE_ROLES = {
SITE_CONTRIBUTOR: 'SiteContributor', SITE_CONTRIBUTOR: 'SiteContributor',
SITE_MANAGER: 'SiteManager' SITE_MANAGER: 'SiteManager'
}; };
export const FILES = {
docxFile: 'file-docx.docx',
xlsxFile: 'file-xlsx.xlsx',
pdfFile: 'file-pdf.pdf',
unsupportedFile: 'file_unsupported.3DS'
};
export const EXTENSIBILITY_CONFIGS = {
DEFAULT_EXTENSIONS_CONFIG: 'extensions-default.json',
INFO_DRAWER: 'info-drawer-ext.json',
INFO_DRAWER_EMPTY: 'info-drawer-no-tabs-ext.json',
VIEWER: 'viewer-ext.json'
};
+6 -3
View File
@@ -34,9 +34,9 @@ export abstract class Page {
layout: by.css('app-layout'), layout: by.css('app-layout'),
overlay: by.css('.cdk-overlay-container'), overlay: by.css('.cdk-overlay-container'),
dialogContainer: by.css('.mat-dialog-container'), dialogContainer: by.css('.mat-dialog-container'),
snackBarContainer: '.cdk-overlay-pane snack-bar-container.mat-snack-bar-container', snackBarContainer: '.cdk-overlay-pane .mat-snack-bar-container',
snackBar: 'simple-snack-bar', snackBar: '.mat-simple-snackbar',
snackBarAction: 'button.mat-simple-snackbar-action' snackBarAction: '.mat-simple-snackbar-action button'
}; };
public app: ElementFinder = element(this.locators.app); public app: ElementFinder = element(this.locators.app);
@@ -103,8 +103,11 @@ export abstract class Page {
} }
clickSnackBarAction() { clickSnackBarAction() {
return this.waitForSnackBarToAppear()
.then(() => {
return browser.executeScript(function (elem) { return browser.executeScript(function (elem) {
elem.click(); elem.click();
}, this.snackBarAction); }, this.snackBarAction);
});
} }
} }
@@ -0,0 +1,766 @@
{
"$schema": "../../extension.schema.json",
"$name": "app",
"$version": "1.0.0",
"$references": [
"plugin1.json",
"plugin2.json",
"dev.tools.json"
],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.selection.canRemoveFavorite" }
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.navigation.isRecentFiles" },
{ "type": "rule", "value": "app.navigation.isSharedFiles" },
{ "type": "rule", "value": "app.navigation.isSearchResults" }
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.favorite.canRemove",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
}
],
"features": {
"create": [
{
"id": "app.create.folder",
"order": 100,
"icon": "create_new_folder",
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
"actions": {
"click": "CREATE_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canCreate"
}
},
{
"id": "app.create.uploadFile",
"order": 200,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FILES"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.uploadFolder",
"order": 300,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
}
],
"navbar": [
{
"id": "app.navbar.primary",
"items": [
{
"id": "app.navbar.personalFiles",
"order": 100,
"icon": "folder",
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
"route": "personal-files"
},
{
"id": "app.navbar.libraries",
"order": 200,
"icon": "group_work",
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
"route": "libraries"
}
]
},
{
"id": "app.navbar.secondary",
"items": [
{
"id": "app.navbar.shared",
"order": 100,
"icon": "people",
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
"route": "shared"
},
{
"id": "app.navbar.recentFiles",
"order": 200,
"icon": "schedule",
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
"route": "recent-files"
},
{
"id": "app.navbar.favorites",
"order": 300,
"icon": "star",
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
"route": "favorites"
},
{
"id": "app.navbar.trashcan",
"order": 400,
"icon": "delete",
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
"route": "trashcan"
}
]
}
],
"toolbar": [
{
"id": "app.toolbar.preview",
"order": 100,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.toolbar.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.toolbar.purgeDeletedNodes",
"order": 400,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.restoreDeletedNodes",
"order": 500,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.createLibrary",
"order": 600,
"title": "Create Library",
"icon": "create_new_folder",
"actions": {
"click": "CREATE_LIBRARY"
},
"rules": {
"visible": "app.navigation.isLibraries"
}
},
{
"id": "app.toolbar.info",
"type": "custom",
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{
"id": "app.toolbar.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "app.toolbar.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 100,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.favorite.add",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.toolbar.favorite.remove",
"order": 300,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.toolbar.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.toolbar.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"order": 600,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.toolbar.unshare",
"order": 700,
"title": "APP.ACTIONS.UNSHARE",
"icon": "stop_screen_share",
"actions": {
"click": "UNSHARE_NODES"
},
"rules": {
"visible": "app.selection.canUnshare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.deleteLibrary",
"order": 900,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.selection.library"
}
},
{
"id": "app.toolbar.versions",
"order": 1000,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.toolbar.permissions",
"order": 1100,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
]
}
],
"contextMenu": [
{
"id": "app.context.menu.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.context.menu.preview",
"order": 200,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"title": "APP.ACTIONS.SHARE",
"order": 400,
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
"order": 500,
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.context.menu.favorite.remove",
"title": "APP.ACTIONS.FAVORITE",
"order": 600,
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.context.menu.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 501,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.context.menu.move",
"title": "APP.ACTIONS.MOVE",
"order": 800,
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.delete",
"title": "APP.ACTIONS.DELETE",
"order": 900,
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
"order": 1000,
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"order": 1100,
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
},
{
"id": "app.context.menu.purgeDeletedNodes",
"order": 1200,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.context.menu.restoreDeletedNodes",
"order": 1300,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
}
],
"viewer": {
"toolbar": [
{
"id": "app.viewer.favorite.add",
"order": 100,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.viewer.favorite.remove",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.viewer.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.delete",
"order": 600,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.versions",
"order": 700,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.viewer.permissions",
"order": 800,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
],
"content": [
{
"id": "app.viewer.pdf",
"disabled": true,
"fileExtension": "pdf",
"component": "app.components.tabs.metadata"
},
{
"id": "app.viewer.docx",
"disabled": true,
"fileExtension": "docx",
"component": "app.components.tabs.comments"
}
]
},
"sidebar": [
{
"id": "app.sidebar.properties",
"order": 100,
"title": "APP.INFO_DRAWER.TABS.PROPERTIES",
"component": "app.components.tabs.metadata"
},
{
"id": "app.sidebar.comments",
"order": 200,
"title": "APP.INFO_DRAWER.TABS.COMMENTS",
"component": "app.components.tabs.comments"
},
{
"id": "app.sidebar.versions",
"order": 300,
"disabled": true,
"title": "APP.INFO_DRAWER.TABS.VERSIONS",
"component": "app.components.tabs.versions"
}
]
}
}
@@ -0,0 +1,773 @@
{
"$schema": "../../extension.schema.json",
"$name": "app",
"$version": "1.0.0",
"$references": [
"plugin1.json",
"plugin2.json",
"dev.tools.json"
],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.selection.canRemoveFavorite" }
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.navigation.isRecentFiles" },
{ "type": "rule", "value": "app.navigation.isSharedFiles" },
{ "type": "rule", "value": "app.navigation.isSearchResults" }
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.favorite.canRemove",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
}
],
"features": {
"create": [
{
"id": "app.create.folder",
"order": 100,
"icon": "create_new_folder",
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
"actions": {
"click": "CREATE_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canCreate"
}
},
{
"id": "app.create.uploadFile",
"order": 200,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FILES"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.uploadFolder",
"order": 300,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
}
],
"navbar": [
{
"id": "app.navbar.primary",
"items": [
{
"id": "app.navbar.personalFiles",
"order": 100,
"icon": "folder",
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
"route": "personal-files"
},
{
"id": "app.navbar.libraries",
"order": 200,
"icon": "group_work",
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
"route": "libraries"
}
]
},
{
"id": "app.navbar.secondary",
"items": [
{
"id": "app.navbar.shared",
"order": 100,
"icon": "people",
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
"route": "shared"
},
{
"id": "app.navbar.recentFiles",
"order": 200,
"icon": "schedule",
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
"route": "recent-files"
},
{
"id": "app.navbar.favorites",
"order": 300,
"icon": "star",
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
"route": "favorites"
},
{
"id": "app.navbar.trashcan",
"order": 400,
"icon": "delete",
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
"route": "trashcan"
}
]
}
],
"toolbar": [
{
"id": "app.toolbar.preview",
"order": 100,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.toolbar.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.toolbar.purgeDeletedNodes",
"order": 400,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.restoreDeletedNodes",
"order": 500,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.createLibrary",
"order": 600,
"title": "Create Library",
"icon": "create_new_folder",
"actions": {
"click": "CREATE_LIBRARY"
},
"rules": {
"visible": "app.navigation.isLibraries"
}
},
{
"id": "app.toolbar.info",
"type": "custom",
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{
"id": "app.toolbar.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "app.toolbar.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 100,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.favorite.add",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.toolbar.favorite.remove",
"order": 300,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.toolbar.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.toolbar.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"order": 600,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.toolbar.unshare",
"order": 700,
"title": "APP.ACTIONS.UNSHARE",
"icon": "stop_screen_share",
"actions": {
"click": "UNSHARE_NODES"
},
"rules": {
"visible": "app.selection.canUnshare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.deleteLibrary",
"order": 900,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.selection.library"
}
},
{
"id": "app.toolbar.versions",
"order": 1000,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.toolbar.permissions",
"order": 1100,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
]
}
],
"contextMenu": [
{
"id": "app.context.menu.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.context.menu.preview",
"order": 200,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"title": "APP.ACTIONS.SHARE",
"order": 400,
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
"order": 500,
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.context.menu.favorite.remove",
"title": "APP.ACTIONS.FAVORITE",
"order": 600,
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.context.menu.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 501,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.context.menu.move",
"title": "APP.ACTIONS.MOVE",
"order": 800,
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.delete",
"title": "APP.ACTIONS.DELETE",
"order": 900,
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
"order": 1000,
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"order": 1100,
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
},
{
"id": "app.context.menu.purgeDeletedNodes",
"order": 1200,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.context.menu.restoreDeletedNodes",
"order": 1300,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
}
],
"viewer": {
"toolbar": [
{
"id": "app.viewer.favorite.add",
"order": 100,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.viewer.favorite.remove",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.viewer.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.delete",
"order": 600,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.versions",
"order": 700,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.viewer.permissions",
"order": 800,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
],
"content": [
{
"id": "app.viewer.pdf",
"disabled": true,
"fileExtension": "pdf",
"component": "app.components.tabs.metadata"
},
{
"id": "app.viewer.docx",
"disabled": true,
"fileExtension": "docx",
"component": "app.components.tabs.comments"
}
]
},
"sidebar": [
{
"id": "app.sidebar.properties",
"order": 1,
"title": "MY PROPERTIES",
"component": "app.components.tabs.metadata"
},
{
"id": "app.sidebar.custom",
"order": 2,
"icon": "mood",
"title": "MY CUSTOM TITLE",
"component": "app.toolbar.toggleFavorite"
},
{
"id": "app.sidebar.no_title",
"order": 3,
"icon": "check_circle",
"component": "app.components.tabs.metadata"
},
{
"id": "app.sidebar.comments",
"order": 4,
"disabled": true,
"title": "APP.INFO_DRAWER.TABS.COMMENTS",
"component": "app.components.tabs.comments"
}
]
}
}
@@ -0,0 +1,745 @@
{
"$schema": "../../extension.schema.json",
"$name": "app",
"$version": "1.0.0",
"$references": [
"plugin1.json",
"plugin2.json",
"dev.tools.json"
],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.selection.canRemoveFavorite" }
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.navigation.isRecentFiles" },
{ "type": "rule", "value": "app.navigation.isSharedFiles" },
{ "type": "rule", "value": "app.navigation.isSearchResults" }
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.favorite.canRemove",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
}
],
"features": {
"create": [
{
"id": "app.create.folder",
"order": 100,
"icon": "create_new_folder",
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
"actions": {
"click": "CREATE_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canCreate"
}
},
{
"id": "app.create.uploadFile",
"order": 200,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FILES"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.uploadFolder",
"order": 300,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
}
],
"navbar": [
{
"id": "app.navbar.primary",
"items": [
{
"id": "app.navbar.personalFiles",
"order": 100,
"icon": "folder",
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
"route": "personal-files"
},
{
"id": "app.navbar.libraries",
"order": 200,
"icon": "group_work",
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
"route": "libraries"
}
]
},
{
"id": "app.navbar.secondary",
"items": [
{
"id": "app.navbar.shared",
"order": 100,
"icon": "people",
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
"route": "shared"
},
{
"id": "app.navbar.recentFiles",
"order": 200,
"icon": "schedule",
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
"route": "recent-files"
},
{
"id": "app.navbar.favorites",
"order": 300,
"icon": "star",
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
"route": "favorites"
},
{
"id": "app.navbar.trashcan",
"order": 400,
"icon": "delete",
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
"route": "trashcan"
}
]
}
],
"toolbar": [
{
"id": "app.toolbar.preview",
"order": 100,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.toolbar.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.toolbar.purgeDeletedNodes",
"order": 400,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.restoreDeletedNodes",
"order": 500,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.createLibrary",
"order": 600,
"title": "Create Library",
"icon": "create_new_folder",
"actions": {
"click": "CREATE_LIBRARY"
},
"rules": {
"visible": "app.navigation.isLibraries"
}
},
{
"id": "app.toolbar.info",
"type": "custom",
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{
"id": "app.toolbar.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "app.toolbar.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 100,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.favorite.add",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.toolbar.favorite.remove",
"order": 300,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.toolbar.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.toolbar.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"order": 600,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.toolbar.unshare",
"order": 700,
"title": "APP.ACTIONS.UNSHARE",
"icon": "stop_screen_share",
"actions": {
"click": "UNSHARE_NODES"
},
"rules": {
"visible": "app.selection.canUnshare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.deleteLibrary",
"order": 900,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.selection.library"
}
},
{
"id": "app.toolbar.versions",
"order": 1000,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.toolbar.permissions",
"order": 1100,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
]
}
],
"contextMenu": [
{
"id": "app.context.menu.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.context.menu.preview",
"order": 200,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"title": "APP.ACTIONS.SHARE",
"order": 400,
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
"order": 500,
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.context.menu.favorite.remove",
"title": "APP.ACTIONS.FAVORITE",
"order": 600,
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.context.menu.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 501,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.context.menu.move",
"title": "APP.ACTIONS.MOVE",
"order": 800,
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.delete",
"title": "APP.ACTIONS.DELETE",
"order": 900,
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
"order": 1000,
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"order": 1100,
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
},
{
"id": "app.context.menu.purgeDeletedNodes",
"order": 1200,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.context.menu.restoreDeletedNodes",
"order": 1300,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
}
],
"viewer": {
"toolbar": [
{
"id": "app.viewer.favorite.add",
"order": 100,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.viewer.favorite.remove",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.viewer.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.delete",
"order": 600,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.versions",
"order": 700,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.viewer.permissions",
"order": 800,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
],
"content": [
{
"id": "app.viewer.pdf",
"disabled": true,
"fileExtension": "pdf",
"component": "app.components.tabs.metadata"
},
{
"id": "app.viewer.docx",
"disabled": true,
"fileExtension": "docx",
"component": "app.components.tabs.comments"
}
]
}
}
}
@@ -0,0 +1,764 @@
{
"$schema": "../../extension.schema.json",
"$name": "app",
"$version": "1.0.0",
"$references": [
"plugin1.json",
"plugin2.json",
"dev.tools.json"
],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.selection.canRemoveFavorite" }
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.navigation.isRecentFiles" },
{ "type": "rule", "value": "app.navigation.isSharedFiles" },
{ "type": "rule", "value": "app.navigation.isSearchResults" }
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.favorite.canRemove",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
}
],
"features": {
"create": [
{
"id": "app.create.folder",
"order": 100,
"icon": "create_new_folder",
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
"actions": {
"click": "CREATE_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canCreate"
}
},
{
"id": "app.create.uploadFile",
"order": 200,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FILES"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.uploadFolder",
"order": 300,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
}
],
"navbar": [
{
"id": "app.navbar.primary",
"items": [
{
"id": "app.navbar.personalFiles",
"order": 100,
"icon": "folder",
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
"route": "personal-files"
},
{
"id": "app.navbar.libraries",
"order": 200,
"icon": "group_work",
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
"route": "libraries"
}
]
},
{
"id": "app.navbar.secondary",
"items": [
{
"id": "app.navbar.shared",
"order": 100,
"icon": "people",
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
"route": "shared"
},
{
"id": "app.navbar.recentFiles",
"order": 200,
"icon": "schedule",
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
"route": "recent-files"
},
{
"id": "app.navbar.favorites",
"order": 300,
"icon": "star",
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
"route": "favorites"
},
{
"id": "app.navbar.trashcan",
"order": 400,
"icon": "delete",
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
"route": "trashcan"
}
]
}
],
"toolbar": [
{
"id": "app.toolbar.preview",
"order": 100,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.toolbar.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.toolbar.purgeDeletedNodes",
"order": 400,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.restoreDeletedNodes",
"order": 500,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.createLibrary",
"order": 600,
"title": "Create Library",
"icon": "create_new_folder",
"actions": {
"click": "CREATE_LIBRARY"
},
"rules": {
"visible": "app.navigation.isLibraries"
}
},
{
"id": "app.toolbar.info",
"type": "custom",
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{
"id": "app.toolbar.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "app.toolbar.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 100,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.favorite.add",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.toolbar.favorite.remove",
"order": 300,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.toolbar.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.toolbar.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"order": 600,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.toolbar.unshare",
"order": 700,
"title": "APP.ACTIONS.UNSHARE",
"icon": "stop_screen_share",
"actions": {
"click": "UNSHARE_NODES"
},
"rules": {
"visible": "app.selection.canUnshare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.deleteLibrary",
"order": 900,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.selection.library"
}
},
{
"id": "app.toolbar.versions",
"order": 1000,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.toolbar.permissions",
"order": 1100,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
]
}
],
"contextMenu": [
{
"id": "app.context.menu.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.context.menu.preview",
"order": 200,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"title": "APP.ACTIONS.SHARE",
"order": 400,
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
"order": 500,
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.context.menu.favorite.remove",
"title": "APP.ACTIONS.FAVORITE",
"order": 600,
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.context.menu.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 501,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.context.menu.move",
"title": "APP.ACTIONS.MOVE",
"order": 800,
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.delete",
"title": "APP.ACTIONS.DELETE",
"order": 900,
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
"order": 1000,
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"order": 1100,
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
},
{
"id": "app.context.menu.purgeDeletedNodes",
"order": 1200,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.context.menu.restoreDeletedNodes",
"order": 1300,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
}
],
"viewer": {
"toolbar": [
{
"id": "app.viewer.favorite.add",
"order": 100,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.viewer.favorite.remove",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.viewer.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.delete",
"order": 600,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.versions",
"order": 700,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.viewer.permissions",
"order": 800,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
],
"content": [
{
"id": "app.viewer.pdf",
"fileExtension": "pdf",
"component": "app.components.tabs.metadata"
},
{
"id": "app.viewer.docx",
"fileExtension": "docx",
"component": "app.components.tabs.comments"
}
]
},
"sidebar": [
{
"id": "app.sidebar.properties",
"order": 100,
"title": "APP.INFO_DRAWER.TABS.PROPERTIES",
"component": "app.components.tabs.metadata"
},
{
"id": "app.sidebar.comments",
"order": 200,
"title": "APP.INFO_DRAWER.TABS.COMMENTS",
"component": "app.components.tabs.comments"
},
{
"id": "app.sidebar.versions",
"order": 300,
"disabled": true,
"title": "APP.INFO_DRAWER.TABS.VERSIONS",
"component": "app.components.tabs.versions"
}
]
}
}
Binary file not shown.
+198
View File
@@ -0,0 +1,198 @@
%PDF-1.3
%âãÏÓ
1 0 obj
<<
/Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R
>>
endobj
2 0 obj
<<
/Type /Outlines
/Count 0
>>
endobj
3 0 obj
<<
/Type /Pages
/Count 2
/Kids [ 4 0 R 6 0 R ]
>>
endobj
4 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources <<
/Font <<
/F1 9 0 R
>>
/ProcSet 8 0 R
>>
/MediaBox [0 0 612.0000 792.0000]
/Contents 5 0 R
>>
endobj
5 0 obj
<< /Length 1074 >>
stream
2 J
BT
0 0 0 rg
/F1 0027 Tf
57.3750 722.2800 Td
( A Simple PDF File ) Tj
ET
BT
/F1 0010 Tf
69.2500 688.6080 Td
( This is a small demonstration .pdf file - ) Tj
ET
BT
/F1 0010 Tf
69.2500 664.7040 Td
( just for use in the Virtual Mechanics tutorials. More text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 652.7520 Td
( text. And more text. And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 628.8480 Td
( And more text. And more text. And more text. And more text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 616.8960 Td
( text. And more text. Boring, zzzzz. And more text. And more text. And ) Tj
ET
BT
/F1 0010 Tf
69.2500 604.9440 Td
( more text. And more text. And more text. And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 592.9920 Td
( And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 569.0880 Td
( And more text. And more text. And more text. And more text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 557.1360 Td
( text. And more text. And more text. Even more. Continued on page 2 ...) Tj
ET
endstream
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources <<
/Font <<
/F1 9 0 R
>>
/ProcSet 8 0 R
>>
/MediaBox [0 0 612.0000 792.0000]
/Contents 7 0 R
>>
endobj
7 0 obj
<< /Length 676 >>
stream
2 J
BT
0 0 0 rg
/F1 0027 Tf
57.3750 722.2800 Td
( Simple PDF File 2 ) Tj
ET
BT
/F1 0010 Tf
69.2500 688.6080 Td
( ...continued from page 1. Yet more text. And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 676.6560 Td
( And more text. And more text. And more text. And more text. And more ) Tj
ET
BT
/F1 0010 Tf
69.2500 664.7040 Td
( text. Oh, how boring typing this stuff. But not as boring as watching ) Tj
ET
BT
/F1 0010 Tf
69.2500 652.7520 Td
( paint dry. And more text. And more text. And more text. And more text. ) Tj
ET
BT
/F1 0010 Tf
69.2500 640.8000 Td
( Boring. More, a little more text. The end, and just as well. ) Tj
ET
endstream
endobj
8 0 obj
[/PDF /Text]
endobj
9 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
>>
endobj
10 0 obj
<<
/Creator (Rave \(http://www.nevrona.com/rave\))
/Producer (Nevrona Designs)
/CreationDate (D:20060301072826)
>>
endobj
xref
0 11
0000000000 65535 f
0000000019 00000 n
0000000093 00000 n
0000000147 00000 n
0000000222 00000 n
0000000390 00000 n
0000001522 00000 n
0000001690 00000 n
0000002423 00000 n
0000002456 00000 n
0000002574 00000 n
trailer
<<
/Size 11
/Root 1 0 R
/Info 10 0 R
>>
startxref
2714
%%EOF
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
+78 -66
View File
@@ -55,7 +55,7 @@ describe('Create folder', () => {
const { dataTable } = personalFilesPage; const { dataTable } = personalFilesPage;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)) .then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
.then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`)) .then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) .then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
@@ -64,16 +64,6 @@ describe('Create folder', () => {
.then(done); .then(done);
}); });
beforeEach(done => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
});
afterAll(done => { afterAll(done => {
Promise Promise
.all([ .all([
@@ -84,8 +74,19 @@ describe('Create folder', () => {
.then(done); .then(done);
}); });
it('option is enabled when having enough permissions', () => { describe('on Personal Files', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) beforeEach(done => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
});
it('option is enabled when having enough permissions - [C216339]', () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openNewMenu()) .then(() => personalFilesPage.sidenav.openNewMenu())
.then(menu => { .then(menu => {
const isEnabled = menu.getItemByLabel('Create folder').isEnabled(); const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
@@ -93,8 +94,8 @@ describe('Create folder', () => {
}); });
}); });
it('creates new folder with name', () => { it('creates new folder with name - [C216341]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName(folderName1)) .then(() => createDialog.enterName(folderName1))
@@ -102,13 +103,13 @@ describe('Create folder', () => {
.then(() => createDialog.waitForDialogToClose()) .then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
const isPresent = dataTable.getRowName(folderName1).isPresent(); const isPresent = dataTable.getRowByName(folderName1).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}); });
}); });
it('creates new folder with name and description', () => { it('creates new folder with name and description - [C216340]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName(folderName2)) .then(() => createDialog.enterName(folderName2))
@@ -116,13 +117,13 @@ describe('Create folder', () => {
.then(() => createDialog.clickCreate()) .then(() => createDialog.clickCreate())
.then(() => createDialog.waitForDialogToClose()) .then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(dataTable.getRowName(folderName2).isPresent()).toBe(true, 'Folder not displayed')) .then(() => expect(dataTable.getRowByName(folderName2).isPresent()).toBe(true, 'Folder not displayed'))
.then(() => apis.user.nodes.getNodeDescription(folderName2, parent)) .then(() => apis.user.nodes.getNodeDescription(folderName2, parent))
.then(desc => expect(desc).toEqual(folderDescription)); .then(desc => expect(desc).toEqual(folderDescription));
}); });
it('enabled option tooltip', () => { it('enabled option tooltip - [C216342]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openNewMenu()) .then(() => personalFilesPage.sidenav.openNewMenu())
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() .then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
.then(() => menu)) .then(() => menu))
@@ -131,36 +132,8 @@ describe('Create folder', () => {
}); });
}); });
it('option is disabled when not enough permissions', () => { it('dialog UI elements - [C216345]', () => {
const fileLibrariesPage = new BrowsingPage(); personalFilesPage.dataTable.doubleClickOnRowByName(parent)
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
.then(() => fileLibrariesPage.sidenav.openNewMenu())
.then(menu => {
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(false, 'Create folder is not disabled');
});
});
it('disabled option tooltip', () => {
const fileLibrariesPage = new BrowsingPage();
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
.then(() => fileLibrariesPage.sidenav.openNewMenu())
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
.then(() => menu))
.then(menu => {
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`You can't create a folder here`);
});
});
it('dialog UI elements', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => { .then(() => {
@@ -178,8 +151,8 @@ describe('Create folder', () => {
}); });
}); });
it('with empty folder name', () => { it('with empty folder name - [C216346]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.deleteNameWithBackspace()) .then(() => createDialog.deleteNameWithBackspace())
@@ -192,8 +165,8 @@ describe('Create folder', () => {
}); });
}); });
it('with folder name ending with a dot "."', () => { it('with folder name ending with a dot "." - [C216348]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName('folder-name.')) .then(() => createDialog.enterName('folder-name.'))
@@ -206,10 +179,10 @@ describe('Create folder', () => {
}); });
}); });
it('with folder name containing special characters', () => { it('with folder name containing special characters - [C216347]', () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => namesWithSpecialChars.forEach(name => { .then(() => namesWithSpecialChars.forEach(name => {
@@ -223,8 +196,8 @@ describe('Create folder', () => {
})); }));
}); });
it('with folder name containing only spaces', () => { it('with folder name containing only spaces - [C280406]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName(' ')) .then(() => createDialog.enterName(' '))
@@ -237,8 +210,8 @@ describe('Create folder', () => {
}); });
}); });
it('cancel folder creation', () => { it('cancel folder creation - [C216349]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName('test')) .then(() => createDialog.enterName('test'))
@@ -249,8 +222,8 @@ describe('Create folder', () => {
}); });
}); });
it('duplicate folder name', () => { it('duplicate folder name - [C216350]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName(duplicateFolderName)) .then(() => createDialog.enterName(duplicateFolderName))
@@ -262,8 +235,8 @@ describe('Create folder', () => {
}); });
}); });
it('trim ending spaces from folder name', () => { it('trim ending spaces from folder name - [C216351]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(parent) personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog()) .then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen()) .then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName(nameWithSpaces)) .then(() => createDialog.enterName(nameWithSpaces))
@@ -271,8 +244,47 @@ describe('Create folder', () => {
.then(() => createDialog.waitForDialogToClose()) .then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
const isPresent = dataTable.getRowName(nameWithSpaces.trim()).isPresent(); const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}); });
}); });
});
describe('on File Libraries', () => {
const fileLibrariesPage = new BrowsingPage();
beforeEach(done => {
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
});
it('option is disabled when not enough permissions - [C280397]', () => {
fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName)
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1))
.then(() => fileLibrariesPage.sidenav.openNewMenu())
.then(menu => {
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(false, 'Create folder is not disabled');
});
});
it('disabled option tooltip - [C280398]', () => {
fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName)
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1))
.then(() => fileLibrariesPage.sidenav.openNewMenu())
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
.then(() => menu))
.then(menu => {
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`);
});
});
});
xit('');
}); });
@@ -29,7 +29,7 @@ import { SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
describe('Delete content', () => { describe('Delete and undo delete', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const apis = { const apis = {
@@ -43,7 +43,7 @@ describe('Delete content', () => {
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
afterAll(done => { afterAll(done => {
@@ -62,15 +62,15 @@ describe('Delete content', () => {
const fileLocked1 = `fileLocked-${Utils.random()}.txt`; let fileLocked1Id; const fileLocked1 = `fileLocked-${Utils.random()}.txt`; let fileLocked1Id;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFile(file1).then(resp => file1Id = resp.data.entry.id) apis.user.nodes.createFile(file1).then(resp => file1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file2).then(resp => file2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file2).then(resp => file2Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(file3, folder1Id)) .then(() => apis.user.nodes.createFile(file3, folder1Id))
.then(() => apis.user.nodes.createFile(file4, folder2Id).then(resp => file4Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file4, folder2Id).then(resp => file4Id = resp.entry.id))
.then(() => apis.user.nodes.lockFile(file4Id)) .then(() => apis.user.nodes.lockFile(file4Id))
.then(() => apis.user.nodes.createFile(fileLocked1).then(resp => fileLocked1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(fileLocked1).then(resp => fileLocked1Id = resp.entry.id))
.then(() => apis.user.nodes.lockFile(fileLocked1Id)) .then(() => apis.user.nodes.lockFile(fileLocked1Id))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -94,30 +94,31 @@ describe('Delete content', () => {
.then(() => apis.user.nodes.unlockFile(fileLocked1Id)) .then(() => apis.user.nodes.unlockFile(fileLocked1Id))
.then(() => apis.user.nodes.deleteNodesById([file1Id, file2Id, folder1Id, folder2Id, fileLocked1Id])) .then(() => apis.user.nodes.deleteNodesById([file1Id, file2Id, folder1Id, folder2Id, fileLocked1Id]))
]) ])
.then(() => apis.user.search.waitForApi(username, {expect: 0}))
.then(done); .then(done);
}); });
it('delete a file and check notification', () => { it('delete a file and check notification - [C217125]', () => {
let items: number; let items: number;
page.dataTable.countRows().then(number => { items = number; }); page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(file1) dataTable.selectItem(file1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`${file1} deleted`); expect(message).toContain(`${file1} deleted`);
expect(dataTable.getRowName(file1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowName(file1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => expect(dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item is not in trash'))
.then(() => apis.user.trashcan.restore(file1Id)); .then(() => apis.user.trashcan.restore(file1Id));
}); });
it('delete multiple files and check notification', () => { it('delete multiple files and check notification - [C280502]', () => {
let items: number; let items: number;
page.dataTable.countRows().then(number => { items = number; }); page.dataTable.countRows().then(number => { items = number; });
@@ -127,59 +128,59 @@ describe('Delete content', () => {
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowName(file1).isPresent()).toBe(false, `${file1} was not removed from list`); expect(dataTable.getRowByName(file1).isPresent()).toBe(false, `${file1} was not removed from list`);
expect(dataTable.getRowName(file2).isPresent()).toBe(false, `${file2} was not removed from list`); expect(dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} was not removed from list`);
items = items - 2; items = items - 2;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(file1).isPresent()).toBe(true, `${file1} is not in trash`); expect(dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} is not in trash`);
expect(dataTable.getRowName(file2).isPresent()).toBe(true, `${file2} is not in trash`); expect(dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} is not in trash`);
}) })
.then(() => apis.user.trashcan.restore(file1Id)) .then(() => apis.user.trashcan.restore(file1Id))
.then(() => apis.user.trashcan.restore(file2Id)); .then(() => apis.user.trashcan.restore(file2Id));
}); });
it('delete a folder with content', () => { it('delete a folder with content - [C217126]', () => {
let items: number; let items: number;
page.dataTable.countRows().then(number => { items = number; }); page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(folder1) dataTable.selectItem(folder1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => { .then(() => {
expect(dataTable.getRowName(folder1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(folder1).isPresent()).toBe(true, 'Item is not in trash'); expect(dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item is not in trash');
expect(dataTable.getRowName(file3).isPresent()).toBe(false, 'Item is in trash'); expect(dataTable.getRowByName(file3).isPresent()).toBe(false, 'Item is in trash');
}) })
.then(() => apis.user.trashcan.restore(folder1Id)); .then(() => apis.user.trashcan.restore(folder1Id));
}); });
it('delete a folder containing locked files', () => { it('delete a folder containing locked files - [C217127]', () => {
dataTable.clickOnItemName(folder2) dataTable.selectItem(folder2)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`${folder2} couldn't be deleted`); expect(message).toContain(`${folder2} couldn't be deleted`);
expect(dataTable.getRowName(folder2).isPresent()).toBe(true, 'Item was removed from list'); expect(dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item was removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(folder2).isPresent()).toBe(false, 'Item is in trash'); expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item is in trash');
expect(dataTable.getRowName(file4).isPresent()).toBe(false, 'Item is in trash'); expect(dataTable.getRowByName(file4).isPresent()).toBe(false, 'Item is in trash');
}); });
}); });
it('notification on multiple items deletion - some items fail to delete', () => { it('notification on multiple items deletion - some items fail to delete - [C217129]', () => {
dataTable.selectMultipleItems([file1, folder2]) dataTable.selectMultipleItems([file1, folder2])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
@@ -189,27 +190,97 @@ describe('Delete content', () => {
.then(() => apis.user.trashcan.restore(file1Id)); .then(() => apis.user.trashcan.restore(file1Id));
}); });
// TODO: needs to operate on two folders containing locked items it('notification on multiple items deletion - all items fail to delete - [C217130]', () => {
xit('Notification on multiple items deletion - all items fail to delete', () => {
dataTable.selectMultipleItems([fileLocked1, folder2]) dataTable.selectMultipleItems([fileLocked1, folder2])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => expect(message).toEqual(`2 items couldn't be deleted`)); .then(message => expect(message).toEqual(`2 items couldn't be deleted`));
}); });
it('successful delete notification shows Undo action - [C217131]', () => {
dataTable.selectItem(file1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => {
expect(message).toContain(`Undo`);
})
.then(() => apis.user.trashcan.restore(file1Id));
});
it('unsuccessful delete notification does not show Undo action - [C217134]', () => {
dataTable.selectItem(folder2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => {
expect(message).not.toContain(`Undo`);
});
});
it('undo delete of file - [C217132]', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectItem(file1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
it('undo delete of folder with content - [C280503]', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectItem(folder1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
})
.then(() => dataTable.doubleClickOnRowByName(folder1))
.then(() => {
expect(dataTable.getRowByName(file3).isPresent()).toBe(true, 'file from folder not restored');
});
});
it('undo delete of multiple files - [C280504]', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectMultipleItems([file1, file2])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowByName(file1).isPresent()).toBe(true, `${file1} was not removed from list`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(true, `${file2} was not removed from list`);
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
}); });
describe('on Shared Files', () => { describe('on Shared Files', () => {
const sharedFile1 = `sharedFile1-${Utils.random()}.txt`; let sharedFile1Id; const sharedFile1 = `sharedFile1-${Utils.random()}.txt`; let sharedFile1Id;
const sharedFile2 = `sharedFile2-${Utils.random()}.txt`; let sharedFile2Id; const sharedFile2 = `sharedFile2-${Utils.random()}.txt`; let sharedFile2Id;
const sharedFile3 = `sharedFile3-${Utils.random()}.txt`; let sharedFile3Id; const sharedFile3 = `sharedFile3-${Utils.random()}.txt`; let sharedFile3Id;
const sharedFile4 = `sharedFile4-${Utils.random()}.txt`; let sharedFile4Id;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFile(sharedFile1).then(resp => sharedFile1Id = resp.data.entry.id) apis.user.nodes.createFile(sharedFile1).then(resp => sharedFile1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(sharedFile2).then(resp => sharedFile2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(sharedFile2).then(resp => sharedFile2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(sharedFile3).then(resp => sharedFile3Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(sharedFile3).then(resp => sharedFile3Id = resp.entry.id))
.then(() => apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id])) .then(() => apis.user.nodes.createFile(sharedFile4).then(resp => sharedFile4Id = resp.entry.id))
.then(() => apis.user.shared.waitForApi({ expect: 3 })) .then(() => apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id]))
.then(() => apis.user.shared.waitForApi({ expect: 4 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
@@ -228,44 +299,80 @@ describe('Delete content', () => {
afterAll(done => { afterAll(done => {
Promise.all([ Promise.all([
logoutPage.load(), logoutPage.load(),
apis.user.nodes.deleteNodesById([sharedFile1Id, sharedFile2Id, sharedFile3Id]) apis.user.nodes.deleteNodesById([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id])
]) ])
.then(() => apis.user.search.waitForApi(username, {expect: 0}))
.then(done); .then(done);
}); });
it('delete a file and check notification', () => { it('delete a file and check notification - [C280316]', () => {
dataTable.clickOnItemName(sharedFile1) dataTable.selectItem(sharedFile1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`${sharedFile1} deleted`); expect(message).toContain(`${sharedFile1} deleted`);
expect(dataTable.getRowName(sharedFile1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(sharedFile1).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowName(sharedFile1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => expect(dataTable.getRowByName(sharedFile1).isPresent()).toBe(true, 'Item is not in trash'))
.then(() => apis.user.trashcan.restore(sharedFile1Id)); .then(() => apis.user.trashcan.restore(sharedFile1Id))
.then(() => apis.user.shared.shareFilesByIds([ sharedFile1Id ]))
.then(() => apis.user.shared.waitForApi({ expect: 4 }));
}); });
it('delete multiple files and check notification', () => { it('delete multiple files and check notification - [C280513]', () => {
dataTable.selectMultipleItems([sharedFile2, sharedFile3]) dataTable.selectMultipleItems([sharedFile2, sharedFile3])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowName(sharedFile2).isPresent()).toBe(false, `${sharedFile2} was not removed from list`); expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, `${sharedFile2} was not removed from list`);
expect(dataTable.getRowName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not removed from list`); expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not removed from list`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(sharedFile2).isPresent()).toBe(true, `${sharedFile2} is not in trash`); expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(true, `${sharedFile2} is not in trash`);
expect(dataTable.getRowName(sharedFile3).isPresent()).toBe(true, `${sharedFile3} is not in trash`); expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(true, `${sharedFile3} is not in trash`);
}) })
.then(() => apis.user.trashcan.restore(sharedFile2Id)) .then(() => apis.user.trashcan.restore(sharedFile2Id))
.then(() => apis.user.trashcan.restore(sharedFile3Id)); .then(() => apis.user.trashcan.restore(sharedFile3Id))
.then(() => apis.user.shared.shareFilesByIds([ sharedFile2Id, sharedFile3Id ]))
.then(() => apis.user.shared.waitForApi({ expect: 4 }));
});
it('successful delete notification shows Undo action - [C280323]', () => {
dataTable.selectItem(sharedFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).toContain(`Undo`))
.then(() => apis.user.trashcan.restore(sharedFile1Id));
});
it('undo delete of file - [C280324]', () => {
dataTable.selectItem(sharedFile2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowByName(sharedFile2).isPresent()).toBe(false, 'Item was not restored'));
});
it('undo delete of multiple files - [C280514]', () => {
dataTable.selectMultipleItems([sharedFile3, sharedFile4])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => {
expect(dataTable.getRowByName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not restored`);
expect(dataTable.getRowByName(sharedFile4).isPresent()).toBe(false, `${sharedFile4} was not restored`);
});
}); });
}); });
@@ -279,15 +386,15 @@ describe('Delete content', () => {
const favoriteFileLocked1 = `favFileLocked-${Utils.random()}.txt`; let favoriteFileLocked1Id; const favoriteFileLocked1 = `favFileLocked-${Utils.random()}.txt`; let favoriteFileLocked1Id;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFile(favoriteFile1).then(resp => favoriteFile1Id = resp.data.entry.id) apis.user.nodes.createFile(favoriteFile1).then(resp => favoriteFile1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(favoriteFile2).then(resp => favoriteFile2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(favoriteFile2).then(resp => favoriteFile2Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder(favoriteFolder1).then(resp => favoriteFolder1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(favoriteFolder1).then(resp => favoriteFolder1Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder(favoriteFolder2).then(resp => favoriteFolder2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(favoriteFolder2).then(resp => favoriteFolder2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(favoriteFile3, favoriteFolder1Id)) .then(() => apis.user.nodes.createFile(favoriteFile3, favoriteFolder1Id))
.then(() => apis.user.nodes.createFile(favoriteFile4, favoriteFolder2Id).then(resp => favoriteFile4Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(favoriteFile4, favoriteFolder2Id).then(resp => favoriteFile4Id = resp.entry.id))
.then(() => apis.user.nodes.lockFile(favoriteFile4Id)) .then(() => apis.user.nodes.lockFile(favoriteFile4Id))
.then(() => apis.user.nodes.createFile(favoriteFileLocked1).then(resp => favoriteFileLocked1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(favoriteFileLocked1).then(resp => favoriteFileLocked1Id = resp.entry.id))
.then(() => apis.user.nodes.lockFile(favoriteFileLocked1Id)) .then(() => apis.user.nodes.lockFile(favoriteFileLocked1Id))
.then(() => apis.user.favorites.addFavoritesByIds('file', [favoriteFile1Id, favoriteFile2Id, favoriteFileLocked1Id])) .then(() => apis.user.favorites.addFavoritesByIds('file', [favoriteFile1Id, favoriteFile2Id, favoriteFileLocked1Id]))
@@ -317,30 +424,31 @@ describe('Delete content', () => {
favoriteFile1Id, favoriteFile2Id, favoriteFolder1Id, favoriteFolder2Id, favoriteFileLocked1Id favoriteFile1Id, favoriteFile2Id, favoriteFolder1Id, favoriteFolder2Id, favoriteFileLocked1Id
])) ]))
]) ])
.then(() => apis.user.search.waitForApi(username, {expect: 0}))
.then(done); .then(done);
}); });
it('delete a file and check notification', () => { it('delete a file and check notification - [C280516]', () => {
let items: number; let items: number;
page.dataTable.countRows().then(number => { items = number; }); page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(favoriteFile1) dataTable.selectItem(favoriteFile1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`${favoriteFile1} deleted`); expect(message).toContain(`${favoriteFile1} deleted`);
expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item is not in trash'))
.then(() => apis.user.trashcan.restore(favoriteFile1Id)); .then(() => apis.user.trashcan.restore(favoriteFile1Id));
}); });
it('delete multiple files and check notification', () => { it('delete multiple files and check notification - [C280517]', () => {
let items: number; let items: number;
page.dataTable.countRows().then(number => { items = number; }); page.dataTable.countRows().then(number => { items = number; });
@@ -350,58 +458,58 @@ describe('Delete content', () => {
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(false, `${favoriteFile1} was not removed from list`); expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(false, `${favoriteFile1} was not removed from list`);
expect(dataTable.getRowName(favoriteFile2).isPresent()).toBe(false, `${favoriteFile2} was not removed from list`); expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(false, `${favoriteFile2} was not removed from list`);
items = items - 2; items = items - 2;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} is not in trash`); expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} is not in trash`);
expect(dataTable.getRowName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} is not in trash`); expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} is not in trash`);
}) })
.then(() => apis.user.trashcan.restore(favoriteFile1Id)) .then(() => apis.user.trashcan.restore(favoriteFile1Id))
.then(() => apis.user.trashcan.restore(favoriteFile2Id)); .then(() => apis.user.trashcan.restore(favoriteFile2Id));
}); });
it('delete a folder with content', () => { it('delete a folder with content - [C280518]', () => {
let items: number; let items: number;
page.dataTable.countRows().then(number => { items = number; }); page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(favoriteFolder1) dataTable.selectItem(favoriteFolder1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => { .then(() => {
expect(dataTable.getRowName(favoriteFolder1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(false, 'Item was not removed from list');
items--; items--;
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`); expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(favoriteFolder1).isPresent()).toBe(true, 'Item is not in trash'); expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item is not in trash');
expect(dataTable.getRowName(favoriteFile3).isPresent()).toBe(false, 'Item is in trash'); expect(dataTable.getRowByName(favoriteFile3).isPresent()).toBe(false, 'Item is in trash');
}) })
.then(() => apis.user.trashcan.restore(favoriteFolder1Id)); .then(() => apis.user.trashcan.restore(favoriteFolder1Id));
}); });
it('delete a folder containing locked files', () => { it('delete a folder containing locked files - [C280519]', () => {
dataTable.clickOnItemName(favoriteFolder2) dataTable.selectItem(favoriteFolder2)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`${favoriteFolder2} couldn't be deleted`); expect(message).toContain(`${favoriteFolder2} couldn't be deleted`);
expect(dataTable.getRowName(favoriteFolder2).isPresent()).toBe(true, 'Item was removed from list'); expect(dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(true, 'Item was removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(favoriteFolder2).isPresent()).toBe(false, 'Item is in trash'); expect(dataTable.getRowByName(favoriteFolder2).isPresent()).toBe(false, 'Item is in trash');
expect(dataTable.getRowName(favoriteFile4).isPresent()).toBe(false, 'Item is in trash'); expect(dataTable.getRowByName(favoriteFile4).isPresent()).toBe(false, 'Item is in trash');
}); });
}); });
it('notification on multiple items deletion - some items fail to delete', () => { it('notification on multiple items deletion - some items fail to delete - [C280520]', () => {
dataTable.selectMultipleItems([favoriteFile1, favoriteFolder2]) dataTable.selectMultipleItems([favoriteFile1, favoriteFolder2])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
@@ -413,7 +521,7 @@ describe('Delete content', () => {
.then(() => apis.user.trashcan.restore(favoriteFile1Id)); .then(() => apis.user.trashcan.restore(favoriteFile1Id));
}); });
it('Notification on multiple items deletion - all items fail to delete', () => { it('notification on multiple items deletion - all items fail to delete - [C280521]', () => {
dataTable.selectMultipleItems([favoriteFileLocked1, favoriteFolder2]) dataTable.selectMultipleItems([favoriteFileLocked1, favoriteFolder2])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
@@ -422,18 +530,84 @@ describe('Delete content', () => {
expect(message).toEqual(`2 items couldn't be deleted`); expect(message).toEqual(`2 items couldn't be deleted`);
}); });
}); });
it('successful delete notification shows Undo action - [C280522]', () => {
dataTable.selectItem(favoriteFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).toContain(`Undo`))
.then(() => apis.user.trashcan.restore(favoriteFile1Id));
}); });
describe('on Recent Files', () => { it('unsuccessful delete notification does not show Undo action - [C280523]', () => {
dataTable.selectItem(favoriteFolder2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).not.toContain(`Undo`));
});
it('undo delete of file - [C280524]', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectItem(favoriteFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
it('undo delete of folder with content - [C280526]', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectItem(favoriteFolder1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowByName(favoriteFolder1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
})
.then(() => dataTable.doubleClickOnRowByName(favoriteFolder1))
.then(() => expect(dataTable.getRowByName(favoriteFile3).isPresent()).toBe(true, 'file from folder not restored'));
});
it('undo delete of multiple files - [C280525]', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectMultipleItems([favoriteFile1, favoriteFile2])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowByName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} was not removed from list`);
expect(dataTable.getRowByName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} was not removed from list`);
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
});
// TODO: try to change search.waitForApi to wait for exact number of items
xdescribe('on Recent Files', () => {
const recentFile1 = `recentFile1-${Utils.random()}.txt`; let recentFile1Id; const recentFile1 = `recentFile1-${Utils.random()}.txt`; let recentFile1Id;
const recentFile2 = `recentFile2-${Utils.random()}.txt`; let recentFile2Id; const recentFile2 = `recentFile2-${Utils.random()}.txt`; let recentFile2Id;
const recentFile3 = `recentFile3-${Utils.random()}.txt`; let recentFile3Id; const recentFile3 = `recentFile3-${Utils.random()}.txt`; let recentFile3Id;
const recentFile4 = `recentFile4-${Utils.random()}.txt`; let recentFile4Id;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFile(recentFile1).then(resp => recentFile1Id = resp.data.entry.id) apis.user.nodes.createFile(recentFile1).then(resp => recentFile1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(recentFile2).then(resp => recentFile2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(recentFile2).then(resp => recentFile2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(recentFile3).then(resp => recentFile3Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(recentFile3).then(resp => recentFile3Id = resp.entry.id))
.then(() => apis.user.search.waitForApi(username, { expect: 3 })) .then(() => apis.user.nodes.createFile(recentFile4).then(resp => recentFile4Id = resp.entry.id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -461,44 +635,86 @@ describe('Delete content', () => {
afterAll(done => { afterAll(done => {
Promise.all([ Promise.all([
logoutPage.load(), logoutPage.load(),
apis.user.nodes.deleteNodesById([recentFile1Id, recentFile2Id, recentFile3Id]) apis.user.nodes.deleteNodesById([recentFile1Id, recentFile2Id, recentFile3Id, recentFile4Id])
]) ])
.then(done); .then(done);
}); });
xit('delete a file and check notification', () => { it('delete a file and check notification - [C280528]', () => {
dataTable.clickOnItemName(recentFile1) dataTable.selectItem(recentFile1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`${recentFile1} deleted`); expect(message).toContain(`${recentFile1} deleted`);
expect(dataTable.getRowName(recentFile1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(recentFile1).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowName(recentFile1).isPresent()).toBe(true, 'Item is not in trash')) .then(() => expect(dataTable.getRowByName(recentFile1).isPresent()).toBe(true, 'Item is not in trash'))
.then(() => apis.user.trashcan.restore(recentFile1Id)); .then(() => apis.user.trashcan.restore(recentFile1Id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }));
}); });
xit('delete multiple files and check notification', () => { it('delete multiple files and check notification - [C280529]', () => {
dataTable.selectMultipleItems([recentFile2, recentFile3]) dataTable.selectMultipleItems([recentFile2, recentFile3])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete')) .then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(message => { .then(message => {
expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Deleted 2 items`);
expect(dataTable.getRowName(recentFile2).isPresent()).toBe(false, `${recentFile2} was not removed from list`); expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(false, `${recentFile2} was not removed from list`);
expect(dataTable.getRowName(recentFile3).isPresent()).toBe(false, `${recentFile3} was not removed from list`); expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} was not removed from list`);
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => { .then(() => {
expect(dataTable.getRowName(recentFile2).isPresent()).toBe(true, `${recentFile2} is not in trash`); expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(true, `${recentFile2} is not in trash`);
expect(dataTable.getRowName(recentFile3).isPresent()).toBe(true, `${recentFile3} is not in trash`); expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(true, `${recentFile3} is not in trash`);
}) })
.then(() => apis.user.trashcan.restore(recentFile2Id)) .then(() => apis.user.trashcan.restore(recentFile2Id))
.then(() => apis.user.trashcan.restore(recentFile3Id)); .then(() => apis.user.trashcan.restore(recentFile3Id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }));
});
it('successful delete notification shows Undo action - [C280534]', () => {
dataTable.selectItem(recentFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).toContain(`Undo`))
.then(() => apis.user.trashcan.restore(recentFile1Id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }));
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
it('undo delete of file - [C280536]', () => {
dataTable.selectItem(recentFile2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowByName(recentFile2).isPresent()).toBe(false, 'Item is in Trash'));
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
it('undo delete of multiple files - [C280537]', () => {
dataTable.selectMultipleItems([recentFile3, recentFile4])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => {
expect(dataTable.getRowByName(recentFile3).isPresent()).toBe(false, `${recentFile3} is in Trash`);
expect(dataTable.getRowByName(recentFile4).isPresent()).toBe(false, `${recentFile4} is in Trash`);
});
}); });
}); });
}); });
+21 -21
View File
@@ -58,13 +58,13 @@ describe('Edit folder', () => {
const editButton = personalFilesPage.toolbar.actions.getButtonByTitleAttribute('Edit'); const editButton = personalFilesPage.toolbar.actions.getButtonByTitleAttribute('Edit');
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)) .then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`)) .then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) .then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.user.nodes.createFolder( parent )) .then(() => apis.user.nodes.createFolder( parent ))
.then(resp => apis.user.nodes.createFolder( folderName, resp.data.entry.id, '', folderDescription )) .then(resp => apis.user.nodes.createFolder( folderName, resp.entry.id, '', folderDescription ))
.then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent)) .then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -74,7 +74,7 @@ describe('Edit folder', () => {
beforeEach(done => { beforeEach(done => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(parent)) .then(() => dataTable.doubleClickOnRowByName(parent))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(done); .then(done);
}); });
@@ -93,8 +93,8 @@ describe('Edit folder', () => {
.then(done); .then(done);
}); });
it('dialog UI defaults', () => { it('dialog UI defaults - [C216331]', () => {
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => { .then(() => {
expect(editDialog.getTitle()).toEqual('Edit folder'); expect(editDialog.getTitle()).toEqual('Edit folder');
@@ -105,8 +105,8 @@ describe('Edit folder', () => {
}); });
}); });
it('properties are modified when pressing OK', () => { it('properties are modified when pressing OK - [C216335]', () => {
dataTable.clickOnItemName(folderNameToEdit) dataTable.selectItem(folderNameToEdit)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => editDialog.waitForDialogToOpen()) .then(() => editDialog.waitForDialogToOpen())
.then(() => editDialog.enterDescription(folderDescriptionEdited)) .then(() => editDialog.enterDescription(folderDescriptionEdited))
@@ -114,13 +114,13 @@ describe('Edit folder', () => {
.then(() => editDialog.clickUpdate()) .then(() => editDialog.clickUpdate())
.then(() => editDialog.waitForDialogToClose()) .then(() => editDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(dataTable.getRowName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed')) .then(() => expect(dataTable.getRowByName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed'))
.then(() => apis.user.nodes.getNodeDescription(folderNameEdited, parent)) .then(() => apis.user.nodes.getNodeDescription(folderNameEdited, parent))
.then(desc => expect(desc).toEqual(folderDescriptionEdited)); .then(desc => expect(desc).toEqual(folderDescriptionEdited));
}); });
it('with empty folder name', () => { it('with empty folder name - [C216332]', () => {
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => editDialog.deleteNameWithBackspace()) .then(() => editDialog.deleteNameWithBackspace())
.then(() => { .then(() => {
@@ -129,10 +129,10 @@ describe('Edit folder', () => {
}); });
}); });
it('with name with special characters', () => { it('with name with special characters - [C216333]', () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ]; const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => namesWithSpecialChars.forEach(name => { .then(() => namesWithSpecialChars.forEach(name => {
editDialog.enterName(name); editDialog.enterName(name);
@@ -142,8 +142,8 @@ describe('Edit folder', () => {
})); }));
}); });
it('with name ending with a dot', () => { it('with name ending with a dot - [C216334]', () => {
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => editDialog.nameInput.sendKeys('.')) .then(() => editDialog.nameInput.sendKeys('.'))
.then(() => { .then(() => {
@@ -152,8 +152,8 @@ describe('Edit folder', () => {
}); });
}); });
it('Cancel button', () => { it('Cancel button - [C216336]', () => {
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => editDialog.clickCancel()) .then(() => editDialog.clickCancel())
.then(() => { .then(() => {
@@ -161,8 +161,8 @@ describe('Edit folder', () => {
}); });
}); });
it('with duplicate folder name', () => { it('with duplicate folder name - [C216337]', () => {
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => editDialog.enterName(duplicateFolderName)) .then(() => editDialog.enterName(duplicateFolderName))
.then(() => editDialog.clickUpdate()) .then(() => editDialog.clickUpdate())
@@ -173,15 +173,15 @@ describe('Edit folder', () => {
}); });
}); });
it('trim ending spaces', () => { it('trim ending spaces - [C216338]', () => {
dataTable.clickOnItemName(folderName) dataTable.selectItem(folderName)
.then(() => editButton.click()) .then(() => editButton.click())
.then(() => editDialog.nameInput.sendKeys(' ')) .then(() => editDialog.nameInput.sendKeys(' '))
.then(() => editDialog.clickUpdate()) .then(() => editDialog.clickUpdate())
.then(() => editDialog.waitForDialogToClose()) .then(() => editDialog.waitForDialogToClose())
.then(() => { .then(() => {
expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears'); expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(dataTable.getRowName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view'); expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
}); });
}); });
}); });
+171 -49
View File
@@ -24,7 +24,7 @@
*/ */
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SIDEBAR_LABELS } from '../../configs'; import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
import { browser } from 'protractor'; import { browser } from 'protractor';
@@ -37,8 +37,14 @@ describe('Mark items as favorites', () => {
const file3Fav = `file-${Utils.random()}.txt`; const file3Fav = `file-${Utils.random()}.txt`;
const file4Fav = `file-${Utils.random()}.txt`; const file4Fav = `file-${Utils.random()}.txt`;
const folder1 = `folder-${Utils.random()}`; const folder1 = `folder-${Utils.random()}`;
const siteName = `site-public-${Utils.random()}`;
const fileSiteNotFav1 = `file-site${Utils.random()}.txt`;
const fileSiteNotFav2 = `file-site${Utils.random()}.txt`;
const folderSite = `folder-${Utils.random()}`;
const fileSiteFav1 = `file-${Utils.random()}.txt`;
const fileSiteFav2 = `file-${Utils.random()}.txt`;
let file1Id, file2Id, file3Id, file4Id, folder1Id; let file1Id, file2Id, file3Id, file4Id, folder1Id, fileSiteNotFav1Id, fileSiteNotFav2Id, folderSiteId, fileSiteFav1Id, fileSiteFav2Id;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
@@ -51,23 +57,27 @@ describe('Mark items as favorites', () => {
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFile( file1NotFav ).then(resp => file1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile( file1NotFav ).then(resp => file1Id = resp.entry.id))
.then(() => apis.user.nodes.createFile( file2NotFav ).then(resp => file2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile( file2NotFav ).then(resp => file2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile( file3Fav ).then(resp => file3Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile( file3Fav ).then(resp => file3Id = resp.entry.id))
.then(() => apis.user.nodes.createFile( file4Fav ).then(resp => file4Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile( file4Fav ).then(resp => file4Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder( folder1 ).then(resp => folder1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder( folder1 ).then(resp => folder1Id = resp.entry.id))
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) .then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)) .then(() => apis.user.favorites.addFavoriteById('file', file4Id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }))
.then(() => apis.user.favorites.waitForApi({ expect: 2 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
}); });
afterAll(done => { afterAll(done => {
Promise.all([ Promise.all([
apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id ]), apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id]),
apis.user.sites.deleteSite(siteName),
logoutPage.load() logoutPage.load()
]) ])
.then(done); .then(done);
@@ -82,31 +92,30 @@ describe('Mark items as favorites', () => {
.then(done); .then(done);
}); });
afterEach(done => { beforeEach(done => {
// browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); toolbar.actions.closeMoreMenu().then(done);
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
}); });
it('Favorite action has empty star icon for an item not marked as favorite', () => { it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', () => {
dataTable.clickOnItemName(file1NotFav) dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border')); .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border'));
}); });
it('Favorite action has empty star icon for multiple selection of items when some are not favorite', () => { it('Favorite action has empty star icon for multiple selection of items when some are not favorite - [C217187]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border')); .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border'));
}); });
it('Favorite action has full star icon for items marked as favorite', () => { it('Favorite action has full star icon for items marked as favorite - [C217188]', () => {
dataTable.clickOnItemName(file3Fav) dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star')); .then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star'));
}); });
it('favorite a file', () => { it('favorite a file - [C217189]', () => {
dataTable.clickOnItemName(file1NotFav) dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) .then(() => apis.user.favorites.waitForApi({ expect: 3 }))
@@ -116,8 +125,8 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); .then(() => apis.user.favorites.removeFavoriteById(file1Id));
}); });
it('favorite a folder', () => { it('favorite a folder - [C280390]', () => {
dataTable.clickOnItemName(folder1) dataTable.selectItem(folder1)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) .then(() => apis.user.favorites.waitForApi({ expect: 3 }))
@@ -127,8 +136,8 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(folder1Id)); .then(() => apis.user.favorites.removeFavoriteById(folder1Id));
}); });
it('unfavorite an item', () => { it('unfavorite an item - [C217190]', () => {
dataTable.clickOnItemName(file3Fav) dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) .then(() => apis.user.favorites.waitForApi({ expect: 1 }))
@@ -138,7 +147,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); .then(() => apis.user.favorites.addFavoriteById('file', file3Id));
}); });
it('favorite multiple items - all unfavorite', () => { it('favorite multiple items - all unfavorite - [C217192]', () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) dataTable.selectMultipleItems([ file1NotFav, file2NotFav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -156,7 +165,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file2Id)); .then(() => apis.user.favorites.removeFavoriteById(file2Id));
}); });
it('favorite multiple items - some favorite and some unfavorite', () => { it('favorite multiple items - some favorite and some unfavorite - [C217194]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -173,7 +182,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); .then(() => apis.user.favorites.removeFavoriteById(file1Id));
}); });
it('unfavorite multiple items', () => { it('unfavorite multiple items - [C217193]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -199,13 +208,12 @@ describe('Mark items as favorites', () => {
.then(done); .then(done);
}); });
afterEach(done => { beforeEach(done => {
// browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); toolbar.actions.closeMoreMenu().then(done);
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
}); });
it('favorite a file', () => { it('favorite a file - [C280352]', () => {
dataTable.clickOnItemName(file1NotFav) dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) .then(() => apis.user.favorites.waitForApi({ expect: 3 }))
@@ -215,8 +223,8 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); .then(() => apis.user.favorites.removeFavoriteById(file1Id));
}); });
it('unfavorite an item', () => { it('unfavorite an item - [C280353]', () => {
dataTable.clickOnItemName(file3Fav) dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) .then(() => apis.user.favorites.waitForApi({ expect: 1 }))
@@ -226,7 +234,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); .then(() => apis.user.favorites.addFavoriteById('file', file3Id));
}); });
it('favorite multiple items - all unfavorite', () => { it('favorite multiple items - all unfavorite - [C280355]', () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) dataTable.selectMultipleItems([ file1NotFav, file2NotFav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -244,7 +252,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file2Id)); .then(() => apis.user.favorites.removeFavoriteById(file2Id));
}); });
it('favorite multiple items - some favorite and some unfavorite', () => { it('favorite multiple items - some favorite and some unfavorite - [C280357]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -261,7 +269,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); .then(() => apis.user.favorites.removeFavoriteById(file1Id));
}); });
it('unfavorite multiple items', () => { it('unfavorite multiple items - [C280356]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -294,8 +302,8 @@ describe('Mark items as favorites', () => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
}); });
it('favorite a file', () => { it('favorite a file - [C280362]', () => {
dataTable.clickOnItemName(file1NotFav) dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 })) .then(() => apis.user.favorites.waitForApi({ expect: 3 }))
@@ -305,8 +313,8 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); .then(() => apis.user.favorites.removeFavoriteById(file1Id));
}); });
it('unfavorite an item', () => { it('unfavorite an item - [C280363]', () => {
dataTable.clickOnItemName(file3Fav) dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) .then(() => apis.user.favorites.waitForApi({ expect: 1 }))
@@ -316,7 +324,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); .then(() => apis.user.favorites.addFavoriteById('file', file3Id));
}); });
it('favorite multiple items - all unfavorite', () => { it('favorite multiple items - all unfavorite - [C280365]', () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]) dataTable.selectMultipleItems([ file1NotFav, file2NotFav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -334,7 +342,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file2Id)); .then(() => apis.user.favorites.removeFavoriteById(file2Id));
}); });
it('favorite multiple items - some favorite and some unfavorite', () => { it('favorite multiple items - some favorite and some unfavorite - [C280367]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ]) dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -351,7 +359,7 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.removeFavoriteById(file1Id)); .then(() => apis.user.favorites.removeFavoriteById(file1Id));
}); });
it('unfavorite multiple items', () => { it('unfavorite multiple items - [C280366]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -381,21 +389,21 @@ describe('Mark items as favorites', () => {
page.refresh().then(done); page.refresh().then(done);
}); });
it('unfavorite an item', () => { it('unfavorite an item - [C280368]', () => {
dataTable.clickOnItemName(file3Fav) dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 })) .then(() => apis.user.favorites.waitForApi({ expect: 1 }))
.then(() => apis.user.favorites.isFavorite(file3Id)) .then(() => apis.user.favorites.isFavorite(file3Id))
.then(isFavorite => { .then(isFavorite => {
expect(isFavorite).toBe(false, 'item is marked as favorite'); expect(isFavorite).toBe(false, 'item is marked as favorite');
expect(dataTable.getRowName(file3Fav).isPresent()).toBe(false, 'item still displayed'); expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed');
}) })
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)); .then(() => apis.user.favorites.addFavoriteById('file', file3Id));
}); });
it('unfavorite multiple items', () => { it('unfavorite multiple items - [C280374]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ]) dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu()) .then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite')) .then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
@@ -403,17 +411,131 @@ describe('Mark items as favorites', () => {
.then(() => apis.user.favorites.isFavorite(file3Id)) .then(() => apis.user.favorites.isFavorite(file3Id))
.then(resp => { .then(resp => {
expect(resp).toBe(false, 'file3 marked as favorite'); expect(resp).toBe(false, 'file3 marked as favorite');
expect(dataTable.getRowName(file3Fav).isPresent()).toBe(false, 'file3 still displayed'); expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed');
}) })
.then(() => apis.user.favorites.isFavorite(file4Id)) .then(() => apis.user.favorites.isFavorite(file4Id))
.then(resp => { .then(resp => {
expect(resp).toBe(false, 'file4 marked as favorite'); expect(resp).toBe(false, 'file4 marked as favorite');
expect(dataTable.getRowName(file4Fav).isPresent()).toBe(false, 'file4 still displayed'); expect(dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed');
}) })
.then(() => apis.user.favorites.addFavoriteById('file', file3Id)) .then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.then(() => apis.user.favorites.addFavoriteById('file', file4Id)); .then(() => apis.user.favorites.addFavoriteById('file', file4Id));
}); });
it('Favorite action has full star icon for items marked as favorite - [C280371]', () => {
dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star'));
});
}); });
describe ('on File Libraries', () => {
const fileLibrariesPage = new BrowsingPage();
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = (await apis.user.sites.getDocLibId(siteName));
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id;
fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id;
fileSiteNotFav2Id = (await apis.user.nodes.createFile(fileSiteNotFav2, folderSiteId)).entry.id;
fileSiteFav2Id = (await apis.user.nodes.createFile(fileSiteFav2, folderSiteId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
done();
});
beforeEach(async (done) => {
await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await fileLibrariesPage.dataTable.waitForHeader();
await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
await fileLibrariesPage.dataTable.waitForHeader();
await toolbar.actions.closeMoreMenu();
done();
});
afterEach(async (done) => {
await browser.refresh();
done();
});
it('Favorite a folder - [C280391]', async () => {
await dataTable.selectItem(folderSite);
await toolbar.actions.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFavorite = await apis.user.favorites.isFavorite(folderSiteId);
expect(isFavorite).toBe(true, `${folderSite} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(folderSiteId);
});
it('Favorite a file - [C280342]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectItem(fileSiteNotFav1);
await toolbar.actions.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFavorite = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
expect(isFavorite).toBe(true, `${fileSiteNotFav1} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
});
it('Unfavorite an item - [C280343]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectItem(fileSiteFav1);
await toolbar.actions.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFavorite = await apis.user.favorites.isFavorite(fileSiteFav1Id);
expect(isFavorite).toBe(false, `${fileSiteFav1} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
});
it('Favorite multiple items - all unfavorite - [C280345]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteNotFav2 ]);
await toolbar.actions.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const listItems1 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteNotFav1Id),
apis.user.favorites.isFavorite(fileSiteNotFav2Id)
]);
expect(listItems1[0]).toBe(true, 'item not marked as favorite');
expect(listItems1[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
await apis.user.favorites.removeFavoriteById(fileSiteNotFav2Id);
});
it('Unfavorite multiple items - [C280346]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteFav1, fileSiteFav2 ]);
await toolbar.actions.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite');
const listItems2 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteFav1Id),
apis.user.favorites.isFavorite(fileSiteFav2Id)
]);
expect(listItems2[0]).toBe(false, 'item marked as favorite');
expect(listItems2[1]).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
});
it('Favorite multiple items - some favorite and some unfavorite - [C280347]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteFav1 ]);
await toolbar.actions.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const listItems3 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteNotFav1Id),
apis.user.favorites.isFavorite(fileSiteFav1)
]);
expect(listItems3[0]).toBe(true, 'item not marked as favorite');
expect(listItems3[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
});
});
}); });
+76 -56
View File
@@ -23,7 +23,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { ConfirmDialog } from './../../components/components';
import { SIDEBAR_LABELS } from '../../configs'; import { SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
@@ -31,12 +33,13 @@ import { Utils } from '../../utilities/utils';
describe('Permanently delete from Trash', () => { describe('Permanently delete from Trash', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const file1 = `file-${Utils.random()}.txt`; const file1 = `file1-${Utils.random()}.txt`;
const file2 = `file-${Utils.random()}.txt`; const file2 = `file2-${Utils.random()}.txt`;
const file3 = `file3-${Utils.random()}.txt`;
let filesIds; let filesIds;
const folder1 = `folder-${Utils.random()}`; const folder1 = `folder1-${Utils.random()}`;
const folder2 = `folder-${Utils.random()}`; const folder2 = `folder2-${Utils.random()}`;
let foldersIds; let foldersIds;
const apis = { const apis = {
@@ -49,74 +52,91 @@ describe('Permanently delete from Trash', () => {
const trashPage = new BrowsingPage(); const trashPage = new BrowsingPage();
const { dataTable, toolbar } = trashPage; const { dataTable, toolbar } = trashPage;
beforeAll(done => { const confirmDialog = new ConfirmDialog();
apis.admin.people.createUser(username)
.then(() => apis.user.nodes.createFiles([ file1, file2 ]))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => apis.user.nodes.deleteNodesById(filesIds, false)) beforeAll(async (done) => {
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false)) await apis.admin.people.createUser({ username });
filesIds = (await apis.user.nodes.createFiles([ file1, file2, file3 ])).list.entries.map(entries => entries.entry.id);
foldersIds = (await apis.user.nodes.createFolders([ folder1, folder2 ])).list.entries.map(entries => entries.entry.id);
await apis.user.nodes.deleteNodesById(filesIds, false);
await apis.user.nodes.deleteNodesById(foldersIds, false);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.trashcan.emptyTrash(), apis.user.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('delete file [C217094] [C217091] [C217092]', () => { it('delete file - [C217091]', async () => {
dataTable.clickOnItemName(file1) await dataTable.selectItem(file1);
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click();
.then(() => trashPage.waitForDialog()) await trashPage.waitForDialog();
.then(() => trashPage.getDialogActionByLabel('Delete')) await trashPage.getDialogActionByLabel('Delete').click();
.then((elm) => elm.click()) await trashPage.waitForDialogToClose();
.then(() => trashPage.waitForDialogToClose()) const text = await trashPage.getSnackBarMessage();
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toEqual(`${file1} deleted`); expect(text).toEqual(`${file1} deleted`);
expect(dataTable.getRowName(file1).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted');
});
}); });
it('delete folder [C217091] [C217092]', () => { it('delete folder - [C280416]', async () => {
dataTable.clickOnItemName(folder1) await dataTable.selectItem(folder1);
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click();
.then(() => trashPage.waitForDialog()) await trashPage.waitForDialog();
.then(() => trashPage.getDialogActionByLabel('Delete')) await trashPage.getDialogActionByLabel('Delete').click();
.then((elm) => elm.click()) await trashPage.waitForDialogToClose();
.then(() => trashPage.waitForDialogToClose()) const text = await trashPage.getSnackBarMessage();
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toEqual(`${folder1} deleted`); expect(text).toEqual(`${folder1} deleted`);
expect(dataTable.getRowName(folder1).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted');
});
}); });
it('delete multiple items [C217093]', () => { it('delete multiple items - [C280417]', async () => {
dataTable.selectMultipleItems([ file2, folder2 ]) await dataTable.selectMultipleItems([ file2, folder2 ]);
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click()) await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click();
.then(() => trashPage.waitForDialog()) await trashPage.waitForDialog();
.then(() => trashPage.getDialogActionByLabel('Delete')) await trashPage.getDialogActionByLabel('Delete').click();
.then((elm) => elm.click()) await trashPage.waitForDialogToClose();
.then(() => trashPage.waitForDialogToClose()) const text = await trashPage.getSnackBarMessage();
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toEqual(`2 items deleted`); expect(text).toEqual(`2 items deleted`);
expect(dataTable.getRowName(file2).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted');
expect(dataTable.getRowName(folder2).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('Confirmation dialog UI - [C269113]', async () => {
await dataTable.selectItem(file3);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog();
expect(await confirmDialog.getTitle()).toContain('Delete from trash');
expect(await confirmDialog.getText()).toContain('This will permanently remove the selected item(s)');
expect(await confirmDialog.deleteButton.isEnabled()).toBe(true, 'DELETE button is not enabled');
expect(await confirmDialog.keepButton.isEnabled()).toBe(true, 'KEEP button is not enabled');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
});
it('"Keep" action cancels the deletion - [C269115]', async () => {
await dataTable.selectItem(file3);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog();
expect(await confirmDialog.keepButton.isEnabled()).toBe(true, 'KEEP button is not enabled');
await confirmDialog.clickKeep();
expect(dataTable.getRowByName(file3).isPresent()).toBe(true, 'Item was deleted');
}); });
}); });
+38 -38
View File
@@ -43,7 +43,7 @@ describe('Restore from Trash', () => {
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
}); });
@@ -63,8 +63,8 @@ describe('Restore from Trash', () => {
const folder = `folder-${Utils.random()}`; let folderId; const folder = `folder-${Utils.random()}`; let folderId;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFile(file).then(resp => fileId = resp.data.entry.id) apis.user.nodes.createFile(file).then(resp => fileId = resp.entry.id)
.then(() => apis.user.nodes.createFolder(folder).then(resp => folderId = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder).then(resp => folderId = resp.entry.id))
.then(() => apis.user.nodes.deleteNodesById([ fileId, folderId ], false)) .then(() => apis.user.nodes.deleteNodesById([ fileId, folderId ], false))
.then(done); .then(done);
}); });
@@ -79,64 +79,64 @@ describe('Restore from Trash', () => {
apis.user.trashcan.emptyTrash().then(done); apis.user.trashcan.emptyTrash().then(done);
}); });
it('restore file', () => { it('restore file - [C217177]', () => {
dataTable.clickOnItemName(file) dataTable.selectItem(file)
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(text => { .then(text => {
expect(text).toContain(`${file} restored`); expect(text).toContain(`${file} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowName(file).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => { .then(() => {
expect(page.dataTable.getRowName(file).isPresent()).toBe(true, 'Item not displayed in list'); expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
}) })
.then(() => apis.user.nodes.deleteNodeById(fileId, false)); .then(() => apis.user.nodes.deleteNodeById(fileId, false));
}); });
it('restore folder', () => { it('restore folder - [C280438]', () => {
dataTable.clickOnItemName(folder) dataTable.selectItem(folder)
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(text => { .then(text => {
expect(text).toContain(`${folder} restored`); expect(text).toContain(`${folder} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowName(folder).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => { .then(() => {
expect(page.dataTable.getRowName(folder).isPresent()).toBe(true, 'Item not displayed in list'); expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
}) })
.then(() => apis.user.nodes.deleteNodeById(folderId, false)); .then(() => apis.user.nodes.deleteNodeById(folderId, false));
}); });
it('restore multiple items', () => { it('restore multiple items - [C217182]', () => {
dataTable.selectMultipleItems([ file, folder ]) dataTable.selectMultipleItems([ file, folder ])
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(text => { .then(text => {
expect(text).toContain(`Restore successful`); expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`); expect(text).not.toContain(`View`);
expect(dataTable.getRowName(file).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list');
expect(dataTable.getRowName(folder).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => { .then(() => {
expect(page.dataTable.getRowName(file).isPresent()).toBe(true, 'Item not displayed in list'); expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
expect(page.dataTable.getRowName(folder).isPresent()).toBe(true, 'Item not displayed in list'); expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
}) })
.then(() => apis.user.nodes.deleteNodesById([ fileId, folderId ], false)); .then(() => apis.user.nodes.deleteNodesById([ fileId, folderId ], false));
}); });
it('View from notification', () => { it('View from notification - [C217181]', () => {
dataTable.clickOnItemName(file) dataTable.selectItem(file)
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.clickSnackBarAction()) .then(() => page.clickSnackBarAction())
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
@@ -157,13 +157,13 @@ describe('Restore from Trash', () => {
const folder2 = `folder-${Utils.random()}`; let folder2Id; const folder2 = `folder-${Utils.random()}`; let folder2Id;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.data.entry.id) apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id1 = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id1 = resp.entry.id))
.then(() => apis.user.nodes.deleteNodeById(file1Id1, false)) .then(() => apis.user.nodes.deleteNodeById(file1Id1, false))
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id2 = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id2 = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => file2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => file2Id = resp.entry.id))
.then(() => apis.user.nodes.deleteNodeById(file2Id, false)) .then(() => apis.user.nodes.deleteNodeById(file2Id, false))
.then(() => apis.user.nodes.deleteNodeById(folder2Id, false)) .then(() => apis.user.nodes.deleteNodeById(folder2Id, false))
@@ -184,17 +184,17 @@ describe('Restore from Trash', () => {
.then(done); .then(done);
}); });
it('Restore a file when another file with same name exists on the restore location', () => { it('Restore a file when another file with same name exists on the restore location - [C217178]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.clickOnItemName(file1)) .then(() => dataTable.selectItem(file1))
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(text => expect(text).toEqual(`Can't restore, ${file1} already exists`)); .then(text => expect(text).toEqual(`Can't restore, ${file1} already exists`));
}); });
it('Restore a file when original location no longer exists', () => { it('Restore a file when original location no longer exists - [C217179]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.clickOnItemName(file2)) .then(() => dataTable.selectItem(file2))
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(text => expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`)); .then(text => expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`));
@@ -215,19 +215,19 @@ describe('Restore from Trash', () => {
const file5 = `file5-${Utils.random()}.txt`; let file5Id; const file5 = `file5-${Utils.random()}.txt`; let file5Id;
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.data.entry.id) apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => file2Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => file2Id = resp.entry.id))
.then(() => apis.user.nodes.deleteNodeById(file1Id, false)) .then(() => apis.user.nodes.deleteNodeById(file1Id, false))
.then(() => apis.user.nodes.deleteNodeById(folder1Id, false)) .then(() => apis.user.nodes.deleteNodeById(folder1Id, false))
.then(() => apis.user.nodes.deleteNodeById(file2Id, false)) .then(() => apis.user.nodes.deleteNodeById(file2Id, false))
.then(() => apis.user.nodes.createFolder(folder3).then(resp => folder3Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder3).then(resp => folder3Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(file3, folder3Id).then(resp => file3Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file3, folder3Id).then(resp => file3Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(file4, folder3Id).then(resp => file4Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file4, folder3Id).then(resp => file4Id = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folder4).then(resp => folder4Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder4).then(resp => folder4Id = resp.entry.id))
.then(() => apis.user.nodes.createFile(file5, folder4Id).then(resp => file5Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFile(file5, folder4Id).then(resp => file5Id = resp.entry.id))
.then(() => apis.user.nodes.deleteNodeById(file3Id, false)) .then(() => apis.user.nodes.deleteNodeById(file3Id, false))
.then(() => apis.user.nodes.deleteNodeById(file4Id, false)) .then(() => apis.user.nodes.deleteNodeById(file4Id, false))
.then(() => apis.user.nodes.deleteNodeById(folder3Id, false)) .then(() => apis.user.nodes.deleteNodeById(folder3Id, false))
@@ -251,14 +251,14 @@ describe('Restore from Trash', () => {
.then(done); .then(done);
}); });
it('one failure', () => { it('one failure - [C217183]', () => {
dataTable.selectMultipleItems([ file1, file2 ]) dataTable.selectMultipleItems([ file1, file2 ])
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
.then(text => expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`)); .then(text => expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`));
}); });
it('multiple failures', () => { it('multiple failures - [C217184]', () => {
dataTable.selectMultipleItems([ file3, file4, file5 ]) dataTable.selectMultipleItems([ file3, file4, file5 ])
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) .then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => page.getSnackBarMessage()) .then(() => page.getSnackBarMessage())
@@ -65,506 +65,433 @@ describe('Toolbar actions - multiple selection : ', () => {
const { dataTable } = page; const { dataTable } = page;
const { toolbar } = page; const { toolbar } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser(user1) await apis.admin.people.createUser({ username: user1 });
.then(() => apis.user.nodes.createFiles([ file1 ]).then(resp => file1Id = resp.data.entry.id)) file1Id = (await apis.user.nodes.createFiles([ file1 ])).entry.id;
.then(() => apis.user.nodes.createFiles([ file2 ]).then(resp => file2Id = resp.data.entry.id)) file2Id = (await apis.user.nodes.createFiles([ file2 ])).entry.id;
.then(() => apis.user.nodes.createFolders([ folder1 ]).then(resp => folder1Id = resp.data.entry.id)) folder1Id = (await apis.user.nodes.createFolders([ folder1 ])).entry.id;
.then(() => apis.user.nodes.createFolders([ folder2 ]).then(resp => folder2Id = resp.data.entry.id)) folder2Id = (await apis.user.nodes.createFolders([ folder2 ])).entry.id;
.then(() => apis.user.nodes.createFiles([ fileForDelete1 ]).then(resp => fileForDelete1Id = resp.data.entry.id)) fileForDelete1Id = (await apis.user.nodes.createFiles([ fileForDelete1 ])).entry.id;
.then(() => apis.user.nodes.createFiles([ fileForDelete2 ]).then(resp => fileForDelete2Id = resp.data.entry.id)) fileForDelete2Id = (await apis.user.nodes.createFiles([ fileForDelete2 ])).entry.id;
.then(() => apis.user.nodes.createFolders([ folderForDelete1 ]).then(resp => folderForDelete1Id = resp.data.entry.id)) folderForDelete1Id = (await apis.user.nodes.createFolders([ folderForDelete1 ])).entry.id;
.then(() => apis.user.nodes.createFolders([ folderForDelete2 ]).then(resp => folderForDelete2Id = resp.data.entry.id)) folderForDelete2Id = (await apis.user.nodes.createFolders([ folderForDelete2 ])).entry.id;
.then(() => apis.user.shared.shareFilesByIds([ file1Id, file2Id ])) await apis.user.shared.shareFilesByIds([ file1Id, file2Id ]);
await apis.user.shared.waitForApi({ expect: 2 });
.then(() => apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ])) await apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ]);
.then(() => apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ])) await apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ]);
await apis.user.favorites.waitForApi({ expect: 4 });
.then(() => apis.user.nodes.deleteNodesById([ await apis.user.nodes.deleteNodesById([ fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id ], false);
fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id
], false))
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.user.nodes.deleteNodesById([ file1Id, file2Id, folder1Id, folder2Id ]), apis.user.nodes.deleteNodesById([ file1Id, file2Id, folder1Id, folder2Id ]),
apis.user.trashcan.emptyTrash(), apis.user.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
xit(''); xit('');
describe('Personal Files', () => { describe('Personal Files', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user1).then(done); await loginPage.loginWith(user1);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('unselect selected items - single click', () => { it('Unselect items with single click - [C280458]', async () => {
dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]) await dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]);
.then(() => expect(dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number')) expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
.then(() => dataTable.clickOnItemName(file1)) await dataTable.selectItem(file1);
.then(() => expect(dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number')) expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number');
.then(() => dataTable.clearSelection());
});
it('unselect selected items - CMD+click', () => {
dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ])
.then(() => expect(dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number'))
.then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform())
.then(() => dataTable.clickOnItemName(file1))
.then(() => dataTable.clickOnItemName(file2))
.then(() => browser.actions().sendKeys(protractor.Key.NULL).perform())
.then(() => expect(dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number'))
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1, folder2])
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
});
it('should not display View action when multiple entries selected', async () => {
await dataTable.selectMultipleItems([folder1, file1, folder2]);
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'Action is displayed');
});
it('should display View action when one file is selected', async () => {
await dataTable.selectMultipleItems([file1]);
expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'Action is not displayed');
});
it('should not display View action when only folders selected', async () => {
await dataTable.selectMultipleItems([folder1, folder2]);
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'Action is displayed');
});
it('should display Download action for selected items', async () => {
await dataTable.selectMultipleItems([folder1, file1, folder2]);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Action is not displayed');
});
it('should not display Download action for empty selection', async () => {
await dataTable.selectMultipleItems([folder1, file1, folder2]);
await dataTable.clearSelection(); await dataTable.clearSelection();
expect(toolbar.actions.isButtonPresent('Download')).toBe(false, 'Action is displayed');
}); });
it('should display Edit action when single folder selected', async () => { it('Select / unselect selected items by CMD+click - [C217110]', async () => {
await dataTable.selectMultipleItems([folder1]); await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Action is not displayed'); await dataTable.selectItem(file1);
await dataTable.selectItem(file2);
await dataTable.selectItem(folder1);
await dataTable.selectItem(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.selectItem(file1);
await dataTable.selectItem(file2);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number');
await dataTable.clearSelection();
}); });
it('should not display Edit action when multiple folders selected', async () => { it('correct actions appear when multiple files are selected - [C217112]', async () => {
await dataTable.selectMultipleItems([folder1, file1, folder2]);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Action is displayed');
});
it('should not display Edit action if no folders selected', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Action is displayed'); expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
}); });
it('correct actions appear when both files and folders are selected', () => { it('correct actions appear when multiple folders are selected - [C280459]', async () => {
dataTable.selectMultipleItems([file1, file2, folder1, folder2]) await dataTable.selectMultipleItems([folder1, folder2]);
.then(() => toolbar.actions.openMoreMenu()) expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
.then(menu => { expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`); const menu = await toolbar.actions.openMoreMenu();
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
}) expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
// .then(() => browser.$('body').click()) expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform()) await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
.then(() => dataTable.clearSelection()); await dataTable.clearSelection();
});
it('correct actions appear when both files and folders are selected - [C280460]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await dataTable.clearSelection();
}); });
}); });
describe('File Libraries', () => { describe('File Libraries', () => {
beforeAll(done => { beforeAll(async (done) => {
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC) await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
.then(() => apis.admin.people.createUser(user2)) await apis.admin.people.createUser({ username: user2 });
.then(() => apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER)) await apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER);
.then(() => apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER)) await apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER);
.then(() => apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`)) await apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`);
.then(() => apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`)) await apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => dataTable.doubleClickOnItemName(siteName)) await dataTable.doubleClickOnRowByName(siteName);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
apis.admin.sites.deleteSite(siteName).then(done); await apis.admin.sites.deleteSite(siteName);
done();
}); });
xit(''); xit('');
describe('user is Manager', () => { describe('user is Manager', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user1).then(done); await loginPage.loginWith(user1);
done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('correct actions appear when multiple files are selected', () => { it('correct actions appear when multiple files are selected - [C280461]', async () => {
dataTable.selectMultipleItems([file1Admin, file2Admin]) await dataTable.selectMultipleItems([file1Admin, file2Admin]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when multiple folders are selected', () => { it('correct actions appear when multiple folders are selected - [C280462]', async () => {
dataTable.selectMultipleItems([folder1Admin, folder2Admin]) await dataTable.selectMultipleItems([folder1Admin, folder2Admin]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when both files and folders are selected', () => { it('correct actions appear when both files and folders are selected - [C280463]', async () => {
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]) await dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
}); });
describe('user is Consumer', () => { describe('user is Consumer', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user2).then(done); await loginPage.loginWith(user2);
done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('correct actions appear when multiple files are selected', () => { it('correct actions appear when multiple files are selected - [C280464]', async () => {
dataTable.selectMultipleItems([file1Admin, file2Admin]) await dataTable.selectMultipleItems([file1Admin, file2Admin]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when multiple folders are selected', () => { it('correct actions appear when multiple folders are selected - [C280465]', async () => {
dataTable.selectMultipleItems([folder1Admin, folder2Admin]) await dataTable.selectMultipleItems([folder1Admin, folder2Admin]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when both files and folders are selected', () => { it('correct actions appear when both files and folders are selected - [C280466]', async () => {
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]) await dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
}); });
}); });
describe('Shared Files', () => { describe('Shared Files', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user1).then(done); await loginPage.loginWith(user1);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('correct actions appear when multiple files are selected', () => { it('correct actions appear when multiple files are selected - [C280467]', async () => {
dataTable.selectMultipleItems([file1, file2]) await dataTable.selectMultipleItems([file1, file2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
}); });
describe('Recent Files', () => { describe('Recent Files', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user1).then(done); await loginPage.loginWith(user1);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('correct actions appear when multiple files are selected', () => { it('correct actions appear when multiple files are selected - [C280468]', async () => {
dataTable.selectMultipleItems([file1, file2]) await dataTable.selectMultipleItems([file1, file2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
}); });
describe('Favorites', () => { describe('Favorites', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user1).then(done); await loginPage.loginWith(user1);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('correct actions appear when multiple files are selected', () => { it('correct actions appear when multiple files are selected - [C280469]', async () => {
dataTable.selectMultipleItems([file1, file2]) await dataTable.selectMultipleItems([file1, file2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when multiple folders are selected', () => { it('correct actions appear when multiple folders are selected - [C280470]', async () => {
dataTable.selectMultipleItems([folder1, folder2]) await dataTable.selectMultipleItems([folder1, folder2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when both files and folders are selected', () => { it('correct actions appear when both files and folders are selected - [C280471]', async () => {
dataTable.selectMultipleItems([file1, file2, folder1, folder2]) await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); const menu = await toolbar.actions.openMoreMenu();
}) expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
.then(() => toolbar.actions.openMoreMenu()) expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
.then(menu => { expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`); await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`); await dataTable.clearSelection();
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
.then(() => dataTable.clearSelection());
}); });
}); });
// [C217090]
describe('Trash', () => { describe('Trash', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(user1).then(done); await loginPage.loginWith(user1);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('correct actions appear when multiple files are selected', () => { it('correct actions appear when multiple files are selected - [C280472]', async () => {
dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]) await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('Permanently delete'))
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, 'Permanently delete is displayed for selected files'); .toBe(true, 'Permanently delete is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
}) await dataTable.clearSelection();
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when multiple folders are selected', () => { it('correct actions appear when multiple folders are selected - [C280473]', async () => {
dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]) await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('Permanently delete'))
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, 'Permanently delete is displayed for selected files'); .toBe(true, 'Permanently delete is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
}) await dataTable.clearSelection();
.then(() => dataTable.clearSelection());
}); });
it('correct actions appear when both files and folders are selected', () => { it('correct actions appear when both files and folders are selected - [C280474]', async () => {
dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]) await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]);
.then(() => { expect(await toolbar.actions.isButtonPresent('Permanently delete'))
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, 'Permanently delete is displayed for selected files'); .toBe(true, 'Permanently delete is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files'); expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
}) await dataTable.clearSelection();
.then(() => dataTable.clearSelection());
}); });
}); });
}); });
File diff suppressed because it is too large Load Diff
-423
View File
@@ -1,423 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Undo delete content', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
beforeAll(done => {
apis.admin.people.createUser(username).then(done);
});
afterAll(done => {
apis.admin.trashcan.emptyTrash().then(done);
});
xit('');
describe('on Personal Files', () => {
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`; let file2Id;
const file3 = `file3-${Utils.random()}.txt`; let file3Id;
const file4 = `file4-${Utils.random()}.txt`;
const folder1 = `folder1-${Utils.random()}`; let folder1Id;
const folder2 = `folder2-${Utils.random()}`; let folder2Id;
const fileLocked2 = `fileLocked2-${Utils.random()}.txt`; let fileLocked2Id;
beforeAll(done => {
apis.user.nodes.createFile(file1).then(resp => file1Id = resp.data.entry.id)
.then(() => apis.user.nodes.createFile(file2).then(resp => file2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(file3).then(resp => file3Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(file4, folder1Id))
.then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(fileLocked2, folder2Id).then(resp => fileLocked2Id = resp.data.entry.id))
.then(() => apis.user.nodes.lockFile(fileLocked2Id))
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
page.refresh().then(done);
});
afterAll(done => {
Promise.all([
logoutPage.load(),
apis.user.nodes.unlockFile(fileLocked2Id)
.then(() => apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, folder1Id, folder2Id]))
])
.then(done);
});
it('Successful delete notification shows Undo action', () => {
dataTable.clickOnItemName(file1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => {
expect(message).toContain(`Undo`);
})
.then(() => apis.user.trashcan.restore(file1Id));
});
it('Unsuccessful delete notification does not show Undo action', () => {
dataTable.clickOnItemName(folder2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => {
expect(message).not.toContain(`Undo`);
});
});
it('Undo delete of file', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(file1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowName(file1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
it('Undo delete of folder with content', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(folder1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowName(folder1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
})
.then(() => dataTable.doubleClickOnItemName(folder1))
.then(() => {
expect(dataTable.getRowName(file4).isPresent()).toBe(true, 'file from folder not restored');
});
});
it('undo delete of multiple files', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectMultipleItems([file2, file3])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowName(file2).isPresent()).toBe(true, `${file2} was not removed from list`);
expect(dataTable.getRowName(file3).isPresent()).toBe(true, `${file3} was not removed from list`);
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
});
describe('on Shared Files', () => {
const sharedFile1 = `sharedFile1-${Utils.random()}`; let sharedFile1Id;
const sharedFile2 = `sharedFile2-${Utils.random()}`; let sharedFile2Id;
const sharedFile3 = `sharedFile3-${Utils.random()}`; let sharedFile3Id;
const sharedFile4 = `sharedFile4-${Utils.random()}`; let sharedFile4Id;
beforeAll(done => {
apis.user.nodes.createFile(sharedFile1).then(resp => sharedFile1Id = resp.data.entry.id)
.then(() => apis.user.nodes.createFile(sharedFile2).then(resp => sharedFile2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(sharedFile3).then(resp => sharedFile3Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(sharedFile4).then(resp => sharedFile4Id = resp.data.entry.id))
.then(() => apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id]))
.then(() => apis.user.shared.waitForApi({ expect: 4 }))
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
page.refresh().then(done);
});
afterAll(done => {
Promise.all([
logoutPage.load(),
apis.user.nodes.deleteNodesById([sharedFile2Id, sharedFile3Id, sharedFile4Id])
])
.then(done);
});
it('Successful delete notification shows Undo action', () => {
dataTable.clickOnItemName(sharedFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).toContain(`Undo`));
});
it('Undo delete of file', () => {
dataTable.clickOnItemName(sharedFile2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowName(sharedFile2).isPresent()).toBe(false, 'Item was not restored'));
});
it('undo delete of multiple files', () => {
dataTable.selectMultipleItems([sharedFile3, sharedFile4])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => {
expect(dataTable.getRowName(sharedFile3).isPresent()).toBe(false, `${sharedFile3} was not restored`);
expect(dataTable.getRowName(sharedFile4).isPresent()).toBe(false, `${sharedFile4} was not restored`);
});
});
});
describe('on Favorites', () => {
const favoriteFile1 = `favFile1-${Utils.random()}.txt`; let favoriteFile1Id;
const favoriteFile2 = `favFile2-${Utils.random()}.txt`; let favoriteFile2Id;
const favoriteFile4 = `favFile4-${Utils.random()}.txt`;
const favoriteFileLocked2 = `favFileLocked2-${Utils.random()}.txt`; let favoriteFileLocked2Id;
const favoriteFolder1 = `favFolder1-${Utils.random()}`; let favoriteFolder1Id;
const favoriteFolder2 = `favFolder2-${Utils.random()}`; let favoriteFolder2Id;
beforeAll(done => {
apis.user.nodes.createFile(favoriteFile1).then(resp => favoriteFile1Id = resp.data.entry.id)
.then(() => apis.user.nodes.createFile(favoriteFile2).then(resp => favoriteFile2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFolder(favoriteFolder1).then(resp => favoriteFolder1Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(favoriteFile4, favoriteFolder1Id))
.then(() => apis.user.nodes.createFolder(favoriteFolder2).then(resp => favoriteFolder2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(favoriteFileLocked2, favoriteFolder2Id)
.then(resp => favoriteFileLocked2Id = resp.data.entry.id))
.then(() => apis.user.nodes.lockFile(favoriteFileLocked2Id))
.then(() => apis.user.favorites.addFavoritesByIds('file', [favoriteFile1Id, favoriteFile2Id]))
.then(() => apis.user.favorites.addFavoritesByIds('folder', [favoriteFolder1Id, favoriteFolder2Id]))
.then(() => apis.user.favorites.waitForApi({ expect: 4 }))
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
page.refresh().then(done);
});
afterAll(done => {
Promise.all([
logoutPage.load(),
apis.user.nodes.unlockFile(favoriteFileLocked2Id)
.then(() => apis.user.nodes.deleteNodesById([favoriteFile1Id, favoriteFile2Id, favoriteFolder1Id, favoriteFolder2Id]))
])
.then(done);
});
it('Successful delete notification shows Undo action', () => {
dataTable.clickOnItemName(favoriteFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).toContain(`Undo`))
.then(() => apis.user.trashcan.restore(favoriteFile1Id));
});
it('Unsuccessful delete notification does not show Undo action', () => {
dataTable.clickOnItemName(favoriteFolder2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).not.toContain(`Undo`));
});
it('Undo delete of file', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(favoriteFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
it('Undo delete of folder with content', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.clickOnItemName(favoriteFolder1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowName(favoriteFolder1).isPresent()).toBe(true, 'Item was not restored');
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
})
.then(() => dataTable.doubleClickOnItemName(favoriteFolder1))
.then(() => expect(dataTable.getRowName(favoriteFile4).isPresent()).toBe(true, 'file from folder not restored'));
});
it('undo delete of multiple files', () => {
let items: number;
page.dataTable.countRows().then(number => { items = number; });
dataTable.selectMultipleItems([favoriteFile1, favoriteFile2])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => {
expect(dataTable.getRowName(favoriteFile1).isPresent()).toBe(true, `${favoriteFile1} was not removed from list`);
expect(dataTable.getRowName(favoriteFile2).isPresent()).toBe(true, `${favoriteFile2} was not removed from list`);
expect(page.pagination.range.getText()).toContain(`1-${items} of ${items}`);
});
});
});
describe('on Recent Files', () => {
const recentFile1 = `recentFile1-${Utils.random()}.txt`; let recentFile1Id;
const recentFile2 = `recentFile2-${Utils.random()}.txt`; let recentFile2Id;
const recentFile3 = `recentFile3-${Utils.random()}.txt`; let recentFile3Id;
const recentFile4 = `recentFile4-${Utils.random()}.txt`; let recentFile4Id;
beforeAll(done => {
apis.user.nodes.createFile(recentFile1).then(resp => recentFile1Id = resp.data.entry.id)
.then(() => apis.user.nodes.createFile(recentFile2).then(resp => recentFile2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(recentFile3).then(resp => recentFile3Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFile(recentFile4).then(resp => recentFile4Id = resp.data.entry.id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }))
.then(() => loginPage.loginWith(username))
.then((): any => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(6000).then(() => page.refresh());
}
})
)
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
page.refresh().then(done);
});
afterAll(done => {
Promise.all([
logoutPage.load(),
apis.user.nodes.deleteNodesById([recentFile2Id, recentFile3Id, recentFile4Id])
])
.then(done);
});
xit('Successful delete notification shows Undo action', () => {
dataTable.clickOnItemName(recentFile1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.getSnackBarMessage())
.then(message => expect(message).toContain(`Undo`));
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
xit('Undo delete of file', () => {
dataTable.clickOnItemName(recentFile2)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => expect(dataTable.getRowName(recentFile2).isPresent()).toBe(false, 'Item is in Trash'));
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
xit('undo delete of multiple files', () => {
dataTable.selectMultipleItems([recentFile3, recentFile4])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Delete'))
.then(() => page.clickSnackBarAction())
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => {
expect(dataTable.getRowName(recentFile3).isPresent()).toBe(false, `${recentFile3} is in Trash`);
expect(dataTable.getRowName(recentFile4).isPresent()).toBe(false, `${recentFile4} is in Trash`);
});
});
});
});
+3 -3
View File
@@ -45,8 +45,8 @@ describe('Upload files', () => {
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.data.entry.id)) .then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
@@ -67,7 +67,7 @@ describe('Upload files', () => {
}); });
it('Upload a file', () => { it('Upload a file', () => {
dataTable.doubleClickOnItemName(folder1) dataTable.doubleClickOnRowByName(folder1)
.then(() => page.sidenav.openNewMenu()) .then(() => page.sidenav.openNewMenu())
.then(() => page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`)); .then(() => page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`));
}); });
+60 -10
View File
@@ -25,25 +25,32 @@
import { browser } from 'protractor'; import { browser } from 'protractor';
import { SIDEBAR_LABELS } from '../../configs'; import { SIDEBAR_LABELS, PAGE_TITLES } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Page titles', () => { describe('Page titles', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const logoutPage = new LogoutPage(); const logoutPage = new LogoutPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const adminApi = new RepoClient();
const { nodes: nodesApi } = adminApi;
const file = `file-${Utils.random()}.txt`; let fileId;
const header = page.header;
xit(''); xit('');
describe('on Login / Logout pages', () => { describe('on Login / Logout pages', () => {
it('on Login page', () => { it('on Login page - [C217155]', () => {
loginPage.load() loginPage.load()
.then(() => { .then(() => {
expect(browser.getTitle()).toContain('Sign in'); expect(browser.getTitle()).toContain('Sign in');
}); });
}); });
it('after logout', () => { it('after logout - [C217156]', () => {
loginPage.loginWithAdmin() loginPage.loginWithAdmin()
.then(() => page.signOut()) .then(() => page.signOut())
.then(() => { .then(() => {
@@ -51,7 +58,7 @@ describe('Page titles', () => {
}); });
}); });
it('when pressing Back after Logout', () => { it('when pressing Back after Logout - [C280414]', () => {
loginPage.loginWithAdmin() loginPage.loginWithAdmin()
.then(() => page.signOut()) .then(() => page.signOut())
.then(() => browser.navigate().back()) .then(() => browser.navigate().back())
@@ -71,7 +78,7 @@ describe('Page titles', () => {
.then(done); .then(done);
}); });
it('Personal Files page', () => { it('Personal Files page - [C217157]', () => {
const label = SIDEBAR_LABELS.PERSONAL_FILES; const label = SIDEBAR_LABELS.PERSONAL_FILES;
page.sidenav.navigateToLinkByLabel(label) page.sidenav.navigateToLinkByLabel(label)
@@ -80,7 +87,7 @@ describe('Page titles', () => {
}); });
}); });
it('File Libraries page', () => { it('File Libraries page - [C217158]', () => {
const label = SIDEBAR_LABELS.FILE_LIBRARIES; const label = SIDEBAR_LABELS.FILE_LIBRARIES;
page.sidenav.navigateToLinkByLabel(label) page.sidenav.navigateToLinkByLabel(label)
@@ -89,7 +96,7 @@ describe('Page titles', () => {
}); });
}); });
it('Shared Files page', () => { it('Shared Files page - [C217159]', () => {
const label = SIDEBAR_LABELS.SHARED_FILES; const label = SIDEBAR_LABELS.SHARED_FILES;
page.sidenav.navigateToLinkByLabel(label) page.sidenav.navigateToLinkByLabel(label)
@@ -98,7 +105,7 @@ describe('Page titles', () => {
}); });
}); });
it('Recent Files page', () => { it('Recent Files page - [C217160]', () => {
const label = SIDEBAR_LABELS.RECENT_FILES; const label = SIDEBAR_LABELS.RECENT_FILES;
page.sidenav.navigateToLinkByLabel(label) page.sidenav.navigateToLinkByLabel(label)
@@ -107,7 +114,7 @@ describe('Page titles', () => {
}); });
}); });
it('Favorites page', () => { it('Favorites page - [C217161]', () => {
const label = SIDEBAR_LABELS.FAVORITES; const label = SIDEBAR_LABELS.FAVORITES;
page.sidenav.navigateToLinkByLabel(label) page.sidenav.navigateToLinkByLabel(label)
@@ -116,7 +123,7 @@ describe('Page titles', () => {
}); });
}); });
it('Trash page', () => { it('Trash page - [C217162]', () => {
const label = SIDEBAR_LABELS.TRASH; const label = SIDEBAR_LABELS.TRASH;
page.sidenav.navigateToLinkByLabel(label) page.sidenav.navigateToLinkByLabel(label)
@@ -124,5 +131,48 @@ describe('Page titles', () => {
expect(browser.getTitle()).toContain(label); expect(browser.getTitle()).toContain(label);
}); });
}); });
});
describe('on File Viewer', () => {
beforeAll( async (done) => {
fileId = (await nodesApi.createFile(file)).entry.id;
await loginPage.loginWithAdmin();
done();
});
afterAll( async (done) => {
await logoutPage.load();
await adminApi.nodes.deleteNodeById(fileId);
done();
});
it('File Preview page - [C280415]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader();
await page.dataTable.doubleClickOnRowByName(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER);
});
});
describe ('on Search query', () => {
beforeAll( async (done) => {
await loginPage.loginWithAdmin();
done();
});
afterAll( async (done) => {
await logoutPage.load();
done();
});
it('Search Results page - [C280413]', async () => {
await header.waitForSearchButton();
await header.searchButton.click();
await page.dataTable.waitForHeader();
await header.waitForSearchBar();
await header.searchForText(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
});
}); });
}); });
+21 -27
View File
@@ -61,14 +61,12 @@ describe('Login', () => {
beforeAll(done => { beforeAll(done => {
Promise Promise
.all([ .all([
peopleApi.createUser(testUser), peopleApi.createUser({ username: testUser }),
peopleApi.createUser(russianUser.username, russianUser.password), peopleApi.createUser(russianUser),
peopleApi.createUser(johnDoe.username, johnDoe.password, { peopleApi.createUser(johnDoe),
firstName: johnDoe.firstName, peopleApi.createUser({ username: disabledUser })
lastName: johnDoe.lastName .then(() => peopleApi.disableUser(disabledUser)),
}), peopleApi.createUser(testUser2)
peopleApi.createUser(disabledUser).then(() => peopleApi.disableUser(disabledUser)),
peopleApi.createUser(testUser2.username, testUser2.password)
]) ])
.then(done); .then(done);
}); });
@@ -86,14 +84,14 @@ describe('Login', () => {
loginPage.load().then(done); loginPage.load().then(done);
}); });
it('login page default values', () => { it('login page layout - [C213089]', () => {
expect(loginPage.login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled'); expect(loginPage.login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled');
expect(loginPage.login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled'); expect(loginPage.login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled');
expect(loginPage.login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled'); expect(loginPage.login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled');
expect(loginPage.login.getPasswordVisibility()).toBe(false, 'Password is not hidden by default'); expect(loginPage.login.getPasswordVisibility()).toBe(false, 'Password is not hidden by default');
}); });
it('change password visibility', () => { it('change password visibility - [C213091]', () => {
loginPage.login.enterPassword('some password'); loginPage.login.enterPassword('some password');
expect(loginPage.login.isPasswordShown()).toBe(false, 'password is visible'); expect(loginPage.login.isPasswordShown()).toBe(false, 'password is visible');
loginPage.login.passwordVisibility.click() loginPage.login.passwordVisibility.click()
@@ -105,7 +103,7 @@ describe('Login', () => {
}); });
describe('with valid credentials', () => { describe('with valid credentials', () => {
it('navigate to "Personal Files"', () => { it('navigate to "Personal Files" - [C213092]', () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage.loginWith(username) loginPage.loginWith(username)
@@ -114,7 +112,7 @@ describe('Login', () => {
}); });
}); });
it(`displays user's name in header`, () => { it(`displays user's name in header - [C213108]`, () => {
const { userInfo } = new BrowsingPage(APP_ROUTES.PERSONAL_FILES).header; const { userInfo } = new BrowsingPage(APP_ROUTES.PERSONAL_FILES).header;
const { username, firstName, lastName } = johnDoe; const { username, firstName, lastName } = johnDoe;
@@ -124,7 +122,7 @@ describe('Login', () => {
}); });
}); });
it(`logs in with user having username containing "@"`, () => { it(`logs in with user having username containing "@" - [C213096]`, () => {
loginPage loginPage
.loginWith(testUser) .loginWith(testUser)
.then(() => { .then(() => {
@@ -132,7 +130,7 @@ describe('Login', () => {
}); });
}); });
it('logs in with user with non-latin characters', () => { it('logs in with user with non-latin characters - [C213097]', () => {
const { username, password } = russianUser; const { username, password } = russianUser;
loginPage loginPage
@@ -142,7 +140,7 @@ describe('Login', () => {
}); });
}); });
it('redirects to Home Page when navigating to the Login page while already logged in', () => { it('redirects to Home Page when navigating to the Login page while already logged in - [C213107]', () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage loginPage
@@ -154,7 +152,7 @@ describe('Login', () => {
); );
}); });
it('redirects to Personal Files when pressing browser Back while already logged in ', () => { it('redirects to Personal Files when pressing browser Back while already logged in - [C213109]', () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage loginPage
@@ -165,7 +163,7 @@ describe('Login', () => {
}); });
}); });
it('user is able to login after changing his password', () => { it('user is able to login after changing his password - [C213104]', () => {
loginPage.loginWith(testUser2.username, testUser2.password) loginPage.loginWith(testUser2.username, testUser2.password)
.then(() => logoutPage.load()) .then(() => logoutPage.load())
.then(() => peopleApi.changePassword(testUser2.username, newPassword)) .then(() => peopleApi.changePassword(testUser2.username, newPassword))
@@ -184,21 +182,17 @@ describe('Login', () => {
loginPage.load().then(done); loginPage.load().then(done);
}); });
it('disabled submit button when no credentials are entered', () => { it('disabled submit button when password is empty - [C280072]', () => {
expect(submitButton.isEnabled()).toBe(false);
});
it('disabled submit button when password is empty', () => {
loginComponent.enterUsername('any-username'); loginComponent.enterUsername('any-username');
expect(submitButton.isEnabled()).toBe(false); expect(submitButton.isEnabled()).toBe(false);
}); });
it('disabled submit button when username is empty', () => { it('disabled submit button when username is empty - [C280070]', () => {
loginPage.login.enterPassword('any-password'); loginPage.login.enterPassword('any-password');
expect(submitButton.isEnabled()).toBe(false); expect(submitButton.isEnabled()).toBe(false);
}); });
it('shows error when entering nonexistent user', () => { it('shows error when entering nonexistent user - [C213093]', () => {
loginPage loginPage
.tryLoginWith('nonexistent-user', 'any-password') .tryLoginWith('nonexistent-user', 'any-password')
.then(() => { .then(() => {
@@ -208,7 +202,7 @@ describe('Login', () => {
}); });
}); });
it('shows error when entering invalid password', () => { it('shows error when entering invalid password - [C280071]', () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage loginPage
@@ -220,14 +214,14 @@ describe('Login', () => {
}); });
}); });
it('unauthenticated user is redirected to Login page', () => { it('unauthenticated user is redirected to Login page - [C213106]', () => {
browser.get(APP_ROUTES.PERSONAL_FILES) browser.get(APP_ROUTES.PERSONAL_FILES)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
}); });
}); });
it('disabled user is not logged in', () => { it('disabled user is not logged in - [C213100]', () => {
loginPage.tryLoginWith(disabledUser) loginPage.tryLoginWith(disabledUser)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
+5 -5
View File
@@ -40,7 +40,7 @@ describe('Logout', () => {
beforeAll((done) => { beforeAll((done) => {
peopleApi peopleApi
.createUser(johnDoe) .createUser({ username: johnDoe })
.then(done); .then(done);
}); });
@@ -52,19 +52,19 @@ describe('Logout', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('Sign out option is available [C213143]', () => { it('Sign out option is available - [C213143]', () => {
page.header.userInfo.openMenu() page.header.userInfo.openMenu()
.then(() => expect(page.header.userInfo.menu.isMenuItemPresent('Sign out')).toBe(true, 'Sign out option not displayed')); .then(() => expect(page.header.userInfo.menu.isMenuItemPresent('Sign out')).toBe(true, 'Sign out option not displayed'));
}); });
it('redirects to Login page on sign out [C213144]', () => { it('redirects to Login page on sign out - [C213144]', () => {
page.signOut() page.signOut()
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
}); });
}); });
it('redirects to Login page when pressing browser Back after logout [C213145]', () => { it('redirects to Login page when pressing browser Back after logout - [C213145]', () => {
page.signOut() page.signOut()
.then(() => browser.navigate().back()) .then(() => browser.navigate().back())
.then(() => { .then(() => {
@@ -72,7 +72,7 @@ describe('Logout', () => {
}); });
}); });
it('redirects to Login page when trying to access a part of the app after logout [C213146]', () => { it('redirects to Login page when trying to access a part of the app after logout - [C213146]', () => {
page.signOut() page.signOut()
.then(() => page.load('/favorites')) .then(() => page.load('/favorites'))
.then(() => { .then(() => {
+174
View File
@@ -0,0 +1,174 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { InfoDrawer } from './../../components/info-drawer/info-drawer';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { SIDEBAR_LABELS, EXTENSIBILITY_CONFIGS } from '../../configs';
import { Utils } from '../../utilities/utils';
describe('Extensions - Info Drawer', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
const properties_tab = {
order: 1,
title: 'MY PROPERTIES'
};
const custom_tab = {
order: 2,
icon: 'mood',
title: 'MY CUSTOM TITLE',
component: 'app.toolbar.toggleFavorite'
};
const no_title_tab = {
order: 3,
icon: 'check_circle',
title: ''
};
const comments_tab = {
title: 'COMMENTS'
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const infoDrawer = new InfoDrawer();
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createFile(file)).entry.id;
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileId);
done();
});
describe('', () => {
beforeAll(async (done) => {
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.INFO_DRAWER);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader();
await page.dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('Add a new tab with icon and title - [C284646]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(custom_tab.order)).toEqual(`${custom_tab.icon}\n${custom_tab.title}\n`);
});
it('Remove existing tab - [C284647]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`);
});
it('Change tab title - [C284648]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(properties_tab.order)).toEqual(properties_tab.title);
});
it('Tab with icon and no title - [C284649]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(no_title_tab.order)).toEqual(`${no_title_tab.icon}\n`);
});
it('Insert new component in tab - [C284651]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`);
await infoDrawer.clickTab(custom_tab.title);
expect(await infoDrawer.getComponentIdOfTab(custom_tab.title)).toEqual(custom_tab.component);
});
});
describe('', () => {
beforeAll(async (done) => {
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.INFO_DRAWER_EMPTY);
await loginPage.loginWith(username);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('Remove all tabs - [C284650]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
});
});
xit('');
});
+96
View File
@@ -0,0 +1,96 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Viewer } from './../../components/components';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { SIDEBAR_LABELS, EXTENSIBILITY_CONFIGS, FILES } from '../../configs';
import { Utils } from '../../utilities/utils';
describe('Extensions - Viewer', () => {
const username = `user-${Utils.random()}`;
const pdfFile = {
file_name: FILES.pdfFile,
component: 'app.components.tabs.metadata'
};
let pdfFileId;
const docxFile = {
file_name: FILES.docxFile,
component: 'app.components.tabs.comments'
};
let docxFileId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const viewer = new Viewer();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
pdfFileId = (await apis.user.upload.uploadFile(pdfFile.file_name)).entry.id;
docxFileId = (await apis.user.upload.uploadFile(docxFile.file_name)).entry.id;
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.VIEWER);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodesById([ pdfFileId, docxFileId ]),
logoutPage.load()
]);
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader();
done();
});
it('Insert new component in a content viewer - [C284659]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component);
await viewer.clickClose();
await page.dataTable.doubleClickOnRowByName(docxFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(docxFile.component);
});
});
+8 -8
View File
@@ -43,7 +43,7 @@ describe('Empty list views', () => {
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
}); });
@@ -52,7 +52,7 @@ describe('Empty list views', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('empty Personal Files', () => { it('empty Personal Files - [C280131]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => { .then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
@@ -60,16 +60,16 @@ describe('Empty list views', () => {
}); });
}); });
it('empty File Libraries [C217099]', () => { it('empty File Libraries - [C217099]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => { .then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`); expect(dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
expect(dataTable.getEmptyStateSubtitle()).toContain('Join sites to upload, view, and share files.'); expect(dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
}); });
}); });
it('empty Shared Files', () => { it('empty Shared Files - [C280132]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => { .then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
@@ -78,7 +78,7 @@ describe('Empty list views', () => {
}); });
}); });
it('empty Recent Files [C213169]', () => { it('empty Recent Files - [C213169]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => { .then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
@@ -87,7 +87,7 @@ describe('Empty list views', () => {
}); });
}); });
it('empty Favorites', () => { it('empty Favorites - [C280133]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => { .then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
@@ -96,7 +96,7 @@ describe('Empty list views', () => {
}); });
}); });
it('empty Trash', () => { it('empty Trash - [C280134]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => { .then(() => {
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
+74 -71
View File
@@ -33,11 +33,12 @@ describe('Favorites', () => {
const password = username; const password = username;
const siteName = `site-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const folderName = `folder-${Utils.random()}`; const favFolderName = `favFolder-${Utils.random()}`;
const parentFolder = `parent-${Utils.random()}`;
const fileName1 = `file1-${Utils.random()}.txt`; const fileName1 = `file1-${Utils.random()}.txt`;
const fileName2 = `file2-${Utils.random()}.txt`; const fileName2 = `file2-${Utils.random()}.txt`;
const fileName3 = `file3-${Utils.random()}.txt`; let file3Id; const fileName3 = `file3-${Utils.random()}.txt`;
const fileName4 = `file4-${Utils.random()}.txt`; let file4Id; const fileName4 = `file4-${Utils.random()}.txt`;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
@@ -50,107 +51,109 @@ describe('Favorites', () => {
const { dataTable } = favoritesPage; const { dataTable } = favoritesPage;
const { breadcrumb } = favoritesPage.toolbar; const { breadcrumb } = favoritesPage.toolbar;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser(username) await apis.admin.people.createUser({ username });
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER)) const docLibId = await apis.admin.sites.getDocLibId(siteName);
.then(() => apis.admin.nodes.createFiles([ fileName1 ], `Sites/${siteName}/documentLibrary`) await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
.then(resp => apis.user.favorites.addFavoriteById('file', resp.data.entry.id)))
.then(() => apis.user.nodes.createFolders([ folderName ])
.then(resp => apis.user.favorites.addFavoriteById('folder', resp.data.entry.id)))
.then(() => apis.user.nodes.createFiles([ fileName2 ], folderName)
.then(resp => apis.user.favorites.addFavoriteById('file', resp.data.entry.id)))
.then(() => apis.user.nodes.createFiles([ fileName3 ], folderName)
.then(resp => file3Id = resp.data.entry.id)
.then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.then(() => apis.user.nodes.deleteNodeById(file3Id, false)))
.then(() => apis.user.nodes.createFiles([ fileName4 ], folderName)
.then(resp => file4Id = resp.data.entry.id)
.then(() => apis.user.favorites.addFavoriteById('file', file4Id))
.then(() => apis.user.nodes.deleteNodeById(file4Id, false))
.then(() => apis.user.trashcan.restore(file4Id)))
.then(() => loginPage.loginWith(username)) const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id;
.then(done); await apis.user.favorites.addFavoriteById('file', file1Id);
const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderId);
const parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id;
const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file2Id);
const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.nodes.deleteNodeById(file3Id, false);
const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id);
await loginPage.loginWith(username);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.sites.deleteSite(siteName), apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ folderName ]), apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]),
apis.admin.trashcan.emptyTrash(), apis.admin.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('has the correct columns', () => { it('has the correct columns - [C280482]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ]; const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns'); expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => { await elements.forEach(async (element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`); expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
}); });
}); });
it('displays the favorite files and folders [C213226]', () => { it('displays the favorite files and folders - [C213226]', async () => {
expect(dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed'); expect(await dataTable.countRows()).toEqual(4, 'Incorrect number of items displayed');
expect(dataTable.getRowName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); expect(await dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); expect(await dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowName(folderName).isPresent()).toBe(true, `${folderName} not displayed`); expect(await dataTable.getRowByName(favFolderName).isPresent()).toBe(true, `${favFolderName} not displayed`);
}); });
it(`file not displayed if it's in the Trashcan [C213228]`, () => { it(`deleted favorite file does not appear - [C213228]`, async () => {
expect(dataTable.getRowName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); expect(await dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`);
}); });
it(`file is displayed after it is restored from Trashcan [C213229]`, () => { it(`file is displayed after it is restored from Trashcan - [C213229]`, async () => {
expect(dataTable.getRowName(fileName4).isPresent()).toBe(true, `${fileName4} not displayed`); expect(await dataTable.getRowByName(fileName4).isPresent()).toBe(true, `${fileName4} not displayed`);
}); });
it('Location column displays the parent folder of the files [C213231]', () => { it('Location column displays the parent folder of the files - [C213231]', async () => {
expect(dataTable.getItemLocation(fileName1).getText()).toEqual(siteName); expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(siteName);
expect(dataTable.getItemLocation(fileName2).getText()).toEqual(folderName); expect(await dataTable.getItemLocation(fileName2).getText()).toEqual(parentFolder);
expect(dataTable.getItemLocation(folderName).getText()).toEqual('Personal Files'); expect(await dataTable.getItemLocation(favFolderName).getText()).toEqual('Personal Files');
}); });
it('Location column displays a tooltip with the entire path of the file [C213671]', () => { it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => {
expect(dataTable.getItemLocationTooltip(fileName1)).toEqual(`File Libraries/${siteName}`); expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${folderName}`); expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`);
expect(dataTable.getItemLocationTooltip(folderName)).toEqual('Personal Files'); expect(dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files');
}); });
it('Location column redirect - item in user Home [C213650] [C260968]', () => { it('Location column redirect - item in user Home - [C213650]', async () => {
dataTable.clickItemLocation(folderName) await dataTable.clickItemLocation(favFolderName);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
}); });
it('Location column redirect - file in folder [C213650] [C260968]', () => { it('Location column redirect - file in folder - [C280484]', async () => {
dataTable.clickItemLocation(fileName2) await dataTable.clickItemLocation(fileName2);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', parentFolder ]);
}); });
it('Location column redirect - file in site [C213650] [C260969]', () => { it('Location column redirect - file in site - [C280485]', async () => {
dataTable.clickItemLocation(fileName1) await dataTable.clickItemLocation(fileName1);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ])); expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
}); });
it('Navigate into folder from Favorites [C213230]', () => { it('Navigate into folder from Favorites - [C213230]', async () => {
dataTable.doubleClickOnItemName(folderName) await dataTable.doubleClickOnRowByName(favFolderName);
.then(() => dataTable.waitForHeader()) await dataTable.waitForEmptyState();
.then(() => breadcrumb.getCurrentItemName()) expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName);
.then(name => {
expect(name).toBe(folderName);
}); });
});
}); });
+11 -13
View File
@@ -23,8 +23,6 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { by } from 'protractor';
import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs'; import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
@@ -57,13 +55,13 @@ describe('File Libraries', () => {
beforeAll(done => { beforeAll(done => {
Promise Promise
.all([ .all([
apis.admin.people.createUser(username), apis.admin.people.createUser({ username }),
apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC), apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, { description: siteDescription }), apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription),
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, { description: '' }), apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null),
apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC), apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, { id: siteId1 }), apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, { id: siteId2 }) apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2)
]) ])
.then(() => apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER)) .then(() => apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER)) .then(() => apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER))
@@ -96,7 +94,7 @@ describe('File Libraries', () => {
.then(done); .then(done);
}); });
it('has the correct columns', () => { it('has the correct columns - [C217095]', () => {
const labels = [ 'Title', 'Status' ]; const labels = [ 'Title', 'Status' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
@@ -107,7 +105,7 @@ describe('File Libraries', () => {
}); });
}); });
it('User can see only the sites he is a member of [C217095]', () => { it('User can see only the sites he is a member of - [C280501]', () => {
const sitesCount = dataTable.countRows(); const sitesCount = dataTable.countRows();
const expectedSites = { const expectedSites = {
@@ -117,7 +115,7 @@ describe('File Libraries', () => {
}; };
expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed'); expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed');
expect(dataTable.getRowName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list'); expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
dataTable.getRows() dataTable.getRows()
.map((row) => { .map((row) => {
@@ -136,7 +134,7 @@ describe('File Libraries', () => {
}); });
}); });
it('Site ID is displayed when two sites have the same name [C217098]', () => { it('Site ID is displayed when two sites have the same name - [C217098]', () => {
const expectedSites = [ const expectedSites = [
`${siteName} (${siteId1})`, `${siteName} (${siteId1})`,
`${siteName} (${siteId2})` `${siteName} (${siteId2})`
@@ -149,12 +147,12 @@ describe('File Libraries', () => {
}); });
}); });
it('Tooltip for sites without description [C217096]', () => { it('Tooltip for sites without description - [C217096]', () => {
const tooltip = dataTable.getItemNameTooltip(sitePrivate); const tooltip = dataTable.getItemNameTooltip(sitePrivate);
expect(tooltip).toBe(`${sitePrivate}`); expect(tooltip).toBe(`${sitePrivate}`);
}); });
it('Tooltip for sites with description [C217097]', () => { it('Tooltip for sites with description - [C217097]', () => {
const tooltip = dataTable.getItemNameTooltip(siteModerated); const tooltip = dataTable.getItemNameTooltip(siteModerated);
expect(tooltip).toBe(`${siteDescription}`); expect(tooltip).toBe(`${siteDescription}`);
}); });
+9 -9
View File
@@ -47,7 +47,7 @@ describe('Special permissions', () => {
xit(''); xit('');
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
describe('file not displayed if user no longer has permissions on it', () => { describe('file not displayed if user no longer has permissions on it', () => {
@@ -59,7 +59,7 @@ describe('Special permissions', () => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE) apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE)
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR)) .then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR))
.then(() => apis.admin.nodes.createFiles([ fileName ], `Sites/${sitePrivate}/documentLibrary`) .then(() => apis.admin.nodes.createFiles([ fileName ], `Sites/${sitePrivate}/documentLibrary`)
.then(resp => fileId = resp.data.entry.id)) .then(resp => fileId = resp.entry.id))
.then(() => apis.user.favorites.addFavoriteById('file', fileId)) .then(() => apis.user.favorites.addFavoriteById('file', fileId))
.then(() => apis.admin.shared.shareFileById(fileId)) .then(() => apis.admin.shared.shareFileById(fileId))
.then(() => apis.user.nodes.editNodeContent(fileId, 'edited by user')) .then(() => apis.user.nodes.editNodeContent(fileId, 'edited by user'))
@@ -83,7 +83,7 @@ describe('Special permissions', () => {
.then(done); .then(done);
}); });
it('on Recent Files [C213173]', () => { it('on Recent Files - [C213173]', () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
@@ -96,7 +96,7 @@ describe('Special permissions', () => {
}); });
}); });
it('on Favorites [C213227]', () => { it('on Favorites - [C213227]', () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
@@ -109,7 +109,7 @@ describe('Special permissions', () => {
}); });
}); });
it('on Shared Files [C213116]', () => { it('on Shared Files - [C213116]', () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
@@ -133,7 +133,7 @@ describe('Special permissions', () => {
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR)) .then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR))
.then(() => apis.admin.sites.getDocLibId(sitePrivate)) .then(() => apis.admin.sites.getDocLibId(sitePrivate))
.then(resp => apis.user.nodes.createFile(fileName, resp)) .then(resp => apis.user.nodes.createFile(fileName, resp))
.then(resp => fileId = resp.data.entry.id) .then(resp => fileId = resp.entry.id)
.then(() => apis.user.favorites.addFavoriteById('file', fileId)) .then(() => apis.user.favorites.addFavoriteById('file', fileId))
.then(() => apis.user.shared.shareFileById(fileId)) .then(() => apis.user.shared.shareFileById(fileId))
.then(() => apis.user.shared.waitForApi({ expect: 1 })) .then(() => apis.user.shared.waitForApi({ expect: 1 }))
@@ -151,7 +151,7 @@ describe('Special permissions', () => {
.then(done); .then(done);
}); });
it(`on Recent Files [C213178]`, () => { it(`on Recent Files - [C213178]`, () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
@@ -160,7 +160,7 @@ describe('Special permissions', () => {
}); });
}); });
it(`on Favorites [C213672]`, () => { it(`on Favorites - [C213672]`, () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
@@ -169,7 +169,7 @@ describe('Special permissions', () => {
}); });
}); });
it(`on Shared Files [C213668]`, () => { it(`on Shared Files - [C213668]`, () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
+16 -19
View File
@@ -51,7 +51,7 @@ describe('Personal Files', () => {
beforeAll(done => { beforeAll(done => {
Promise Promise
.all([ .all([
apis.admin.people.createUser(username), apis.admin.people.createUser({ username }),
apis.admin.nodes.createFolders([ adminFolder ]) apis.admin.nodes.createFolders([ adminFolder ])
]) ])
.then(() => apis.user.nodes.createFolders([ userFolder ])) .then(() => apis.user.nodes.createFolders([ userFolder ]))
@@ -85,12 +85,9 @@ describe('Personal Files', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('has "Data Dictionary" folder [C213241]', () => { it('has Data Dictionary and created content - [C213241]', () => {
expect(dataTable.getRowName('Data Dictionary').isPresent()).toBe(true); expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
}); expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
it('has created content', () => {
expect(dataTable.getRowName(adminFolder).isPresent()).toBe(true);
}); });
}); });
@@ -109,7 +106,7 @@ describe('Personal Files', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('has the correct columns [C217142]', () => { it('has the correct columns - [C217142]', () => {
const labels = [ 'Name', 'Size', 'Modified', 'Modified by' ]; const labels = [ 'Name', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
@@ -120,22 +117,22 @@ describe('Personal Files', () => {
}); });
}); });
it('has default sorted column [C217143]', () => { it('has default sorted column - [C217143]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified'); expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
}); });
it('has user created content [C213242]', () => { it('has user created content - [C213242]', () => {
expect(dataTable.getRowName(userFolder).isPresent()) expect(dataTable.getRowByName(userFolder).isPresent())
.toBe(true); .toBe(true);
}); });
it('navigates to folder [C213244]', () => { it('navigates to folder - [C213244]', () => {
const getNodeIdPromise = apis.user.nodes const getNodeIdPromise = apis.user.nodes
.getNodeByPath(`/${userFolder}`) .getNodeByPath(`/${userFolder}`)
.then(response => response.data.entry.id); .then(response => response.entry.id);
const navigatePromise = dataTable const navigatePromise = dataTable
.doubleClickOnItemName(userFolder) .doubleClickOnRowByName(userFolder)
.then(() => dataTable.waitForHeader()); .then(() => dataTable.waitForHeader());
Promise Promise
@@ -147,24 +144,24 @@ describe('Personal Files', () => {
expect(browser.getCurrentUrl()) expect(browser.getCurrentUrl())
.toContain(nodeId, 'Node ID is not in the URL'); .toContain(nodeId, 'Node ID is not in the URL');
expect(dataTable.getRowName(userFile).isPresent()) expect(dataTable.getRowByName(userFile).isPresent())
.toBe(true, 'user file is missing'); .toBe(true, 'user file is missing');
}); });
}); });
it('redirects to Personal Files on clicking the link from sidebar [C213245]', () => { it('redirects to Personal Files on clicking the link from sidebar - [C213245]', () => {
personalFilesPage.dataTable.doubleClickOnItemName(userFolder) personalFilesPage.dataTable.doubleClickOnRowByName(userFolder)
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => browser.getCurrentUrl()) .then(() => browser.getCurrentUrl())
.then(url => expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect url')); .then(url => expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect url'));
}); });
it('page loads correctly after browser refresh [C213246]', () => { it('page loads correctly after browser refresh - [C213246]', () => {
personalFilesPage.refresh() personalFilesPage.refresh()
.then(() => expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES)); .then(() => expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES));
}); });
it('page load by URL [C213247]', () => { it('page load by URL - [C213247]', () => {
let url; let url;
browser.getCurrentUrl() browser.getCurrentUrl()
.then(resp => url = resp) .then(resp => url = resp)
+21 -21
View File
@@ -52,15 +52,15 @@ describe('Recent Files', () => {
const { breadcrumb } = recentFilesPage.toolbar; const { breadcrumb } = recentFilesPage.toolbar;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFolders([ folderName ])).then(resp => folderId = resp.data.entry.id) .then(() => apis.user.nodes.createFolders([ folderName ])).then(resp => folderId = resp.entry.id)
.then(() => apis.user.nodes.createFiles([ fileName1 ], folderName)) .then(() => apis.user.nodes.createFiles([ fileName1 ], folderName))
.then(() => apis.user.nodes.createFiles([ fileName2 ])).then(resp => file2Id = resp.data.entry.id) .then(() => apis.user.nodes.createFiles([ fileName2 ])).then(resp => file2Id = resp.entry.id)
.then(() => apis.user.nodes.createFiles([ fileName3 ]).then(resp => apis.user.nodes.deleteNodeById(resp.data.entry.id, false))) .then(() => apis.user.nodes.createFiles([ fileName3 ]).then(resp => apis.user.nodes.deleteNodeById(resp.entry.id, false)))
.then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) .then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.user.sites.getDocLibId(siteName)) .then(() => apis.user.sites.getDocLibId(siteName))
.then(resp => apis.user.nodes.createFolder(folderSite, resp)).then(resp => folderSiteId = resp.data.entry.id) .then(resp => apis.user.nodes.createFolder(folderSite, resp)).then(resp => folderSiteId = resp.entry.id)
.then(() => apis.user.nodes.createFile(fileSite, folderSiteId)) .then(() => apis.user.nodes.createFile(fileSite, folderSiteId))
.then(() => apis.user.search.waitForApi(username, { expect: 3 })) .then(() => apis.user.search.waitForApi(username, { expect: 3 }))
@@ -85,7 +85,7 @@ describe('Recent Files', () => {
.then(done); .then(done);
}); });
it('has the correct columns [C213168]', () => { it('has the correct columns - [C213168]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified' ]; const labels = [ 'Name', 'Location', 'Size', 'Modified' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
@@ -96,45 +96,45 @@ describe('Recent Files', () => {
}); });
}); });
it('default sorting column [C213171]', () => { it('default sorting column - [C213171]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified'); expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(dataTable.getSortingOrder()).toBe('desc'); expect(dataTable.getSortingOrder()).toBe('desc');
}); });
it('displays the files added by the current user in the last 30 days [C213170]', () => { it('displays the files added by the current user in the last 30 days - [C213170]', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed'); expect(dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed');
expect(dataTable.getRowName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
}); });
it(`file not displayed if it's in the Trashcan [C213174]`, () => { it(`file not displayed if it's been deleted - [C213174]`, () => {
expect(dataTable.getRowName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); expect(dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`);
}); });
it('Location column displays the parent folder of the file [C213175]', () => { it('Location column displays the parent folder of the file - [C213175]', () => {
expect(dataTable.getItemLocation(fileName1).getText()).toEqual(folderName); expect(dataTable.getItemLocation(fileName1).getText()).toEqual(folderName);
expect(dataTable.getItemLocation(fileName2).getText()).toEqual('Personal Files'); expect(dataTable.getItemLocation(fileName2).getText()).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileSite).getText()).toEqual(folderSite); expect(dataTable.getItemLocation(fileSite).getText()).toEqual(folderSite);
}); });
it('Location column displays a tooltip with the entire path of the file [C213177]', () => { it('Location column displays a tooltip with the entire path of the file - [C213177]', () => {
expect(dataTable.getItemLocationTooltip(fileName1)).toEqual(`Personal Files/${folderName}`); expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`Personal Files/${folderName}`);
expect(dataTable.getItemLocationTooltip(fileName2)).toEqual('Personal Files'); expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual('Personal Files');
expect(dataTable.getItemLocationTooltip(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`); expect(dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`);
}); });
it('Location column redirect - file in user Home [C213176] [C260968]', () => { it('Location column redirect - file in user Home - [C213176]', () => {
dataTable.clickItemLocation(fileName2) dataTable.clickItemLocation(fileName2)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]));
}); });
it('Location column redirect - file in folder [C213176] [C260968]', () => { it('Location column redirect - file in folder - [C280486]', () => {
dataTable.clickItemLocation(fileName1) dataTable.clickItemLocation(fileName1)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ]));
}); });
it('Location column redirect - file in site [C213176] [C260969]', () => { it('Location column redirect - file in site - [C280487]', () => {
dataTable.clickItemLocation(fileSite) dataTable.clickItemLocation(fileSite)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ]));
}); });
+34 -22
View File
@@ -39,6 +39,7 @@ describe('Shared Files', () => {
const file1User = `file1-${Utils.random()}.txt`; let file1Id; const file1User = `file1-${Utils.random()}.txt`; let file1Id;
const file2User = `file2-${Utils.random()}.txt`; let file2Id; const file2User = `file2-${Utils.random()}.txt`; let file2Id;
const file3User = `file3-${Utils.random()}.txt`; let file3Id; const file3User = `file3-${Utils.random()}.txt`; let file3Id;
const file4User = `file4-${Utils.random()}.txt`; let file4Id;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
@@ -52,19 +53,20 @@ describe('Shared Files', () => {
const { breadcrumb } = sharedFilesPage.toolbar; const { breadcrumb } = sharedFilesPage.toolbar;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) .then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) .then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`)) .then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`))
.then(resp => apis.admin.shared.shareFileById(resp.data.entry.id)) .then(resp => apis.admin.shared.shareFileById(resp.entry.id))
.then(() => apis.user.nodes.createFolders([ folderUser ])) .then(() => apis.user.nodes.createFolders([ folderUser ]))
.then(() => apis.user.nodes.createFiles([ file1User ], folderUser)).then(resp => file1Id = resp.data.entry.id) .then(() => apis.user.nodes.createFiles([ file1User ], folderUser)).then(resp => file1Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file2User)).then(resp => file2Id = resp.data.entry.id) .then(() => apis.user.nodes.createFile(file2User)).then(resp => file2Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(file3User)).then(resp => file3Id = resp.data.entry.id) .then(() => apis.user.nodes.createFile(file3User)).then(resp => file3Id = resp.entry.id)
.then(() => apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id])) .then(() => apis.user.nodes.createFile(file4User)).then(resp => file4Id = resp.entry.id)
.then(() => apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]))
.then(() => apis.user.shared.waitForApi({ expect: 4 })) .then(() => apis.user.shared.waitForApi({ expect: 5 }))
.then(() => apis.user.nodes.deleteNodeById(file2Id)) .then(() => apis.user.nodes.deleteNodeById(file2Id))
.then(() => apis.user.shared.unshareFile(file3User)) .then(() => apis.user.shared.unshareFile(file3User))
@@ -91,7 +93,7 @@ describe('Shared Files', () => {
.then(done); .then(done);
}); });
it('has the correct columns [C213113]', () => { it('has the correct columns - [C213113]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ]; const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
@@ -102,41 +104,51 @@ describe('Shared Files', () => {
}); });
}); });
it('default sorting column [C213115]', () => { it('default sorting column - [C213115]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified'); expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(dataTable.getSortingOrder()).toBe('desc'); expect(dataTable.getSortingOrder()).toBe('desc');
}); });
it('displays the files shared by everyone [C213114]', () => { it('displays the files shared by everyone - [C213114]', () => {
expect(dataTable.getRowName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowName(file1User).isPresent()).toBe(true, `${file1User} not displayed`); expect(dataTable.getRowByName(file1User).isPresent()).toBe(true, `${file1User} not displayed`);
}); });
it(`file not displayed if it's in the Trashcan [C213117]`, () => { it(`file not displayed if it's been deleted - [C213117]`, () => {
expect(dataTable.getRowName(file2User).isPresent()).toBe(false, `${file2User} is displayed`); expect(dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`);
}); });
xit('unshared file is not displayed [C213118]', () => { // TODO: disabled cause the api is slow to update. Find a way to wait until the file is unshared
expect(dataTable.getRowName(file3User).isPresent()).toBe(false, `${file3User} is displayed`); xit('unshared file is not displayed - [C213118]', async () => {
apis.user.shared.waitForApi({ expect: 4 })
.then(() => {
expect(dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
});
}); });
it('Location column displays the parent folder of the file [C213665]', () => { it('Location column displays the parent folder of the file - [C213665]', () => {
expect(dataTable.getItemLocationTileAttr(file4User)).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileAdmin).getText()).toEqual(siteName); expect(dataTable.getItemLocation(fileAdmin).getText()).toEqual(siteName);
expect(dataTable.getItemLocation(file1User).getText()).toEqual(folderUser); expect(dataTable.getItemLocation(file1User).getText()).toEqual(folderUser);
}); });
it('Location column redirect - file in user Home [C213666] [C260968]', () => { it('Location column redirect - file in user Home - [C213666]', () => {
dataTable.clickItemLocation(file4User)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]));
});
it('Location column redirect - file in folder - [C280490]', () => {
dataTable.clickItemLocation(file1User) dataTable.clickItemLocation(file1User)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderUser ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderUser ]));
}); });
it('Location column redirect - file in site [C213666] [C260969]', () => { it('Location column redirect - file in site - [C280491]', () => {
dataTable.clickItemLocation(fileAdmin) dataTable.clickItemLocation(fileAdmin)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]));
}); });
it('Location column displays a tooltip with the entire path of the file [C213667]', () => { it('Location column displays a tooltip with the entire path of the file - [C213667]', () => {
expect(dataTable.getItemLocationTooltip(fileAdmin)).toEqual(`File Libraries/${siteName}`); expect(dataTable.getItemLocationTileAttr(fileAdmin)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTooltip(file1User)).toEqual(`Personal Files/${folderUser}`); expect(dataTable.getItemLocationTileAttr(file1User)).toEqual(`Personal Files/${folderUser}`);
}); });
}); });
+64 -61
View File
@@ -57,23 +57,23 @@ describe('File / folder tooltips', () => {
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFolder( parent )) .then(() => apis.user.nodes.createFolder( parent ))
.then(resp => parentId = resp.data.entry.id) .then(resp => parentId = resp.entry.id)
.then(() => Promise.all([ .then(() => Promise.all([
apis.user.nodes.createFile(file, parentId).then(resp => file1Id = resp.data.entry.id), apis.user.nodes.createFile(file, parentId).then(resp => file1Id = resp.entry.id),
apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription).then(resp => file2Id = resp.data.entry.id), apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription).then(resp => file2Id = resp.entry.id),
apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle).then(resp => file3Id = resp.data.entry.id), apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle).then(resp => file3Id = resp.entry.id),
apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription) apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription)
.then(resp => file4Id = resp.data.entry.id), .then(resp => file4Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc) apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)
.then(resp => file5Id = resp.data.entry.id), .then(resp => file5Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription) apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription)
.then(resp => file6Id = resp.data.entry.id), .then(resp => file6Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle) apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)
.then(resp => file7Id = resp.data.entry.id), .then(resp => file7Id = resp.entry.id),
apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle).then(resp => file8Id = resp.data.entry.id) apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle).then(resp => file8Id = resp.entry.id)
])) ]))
.then(() => apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id ])) .then(() => apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id ]))
@@ -100,39 +100,39 @@ describe('File / folder tooltips', () => {
describe('on Personal Files', () => { describe('on Personal Files', () => {
beforeAll(done => { beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.doubleClickOnItemName(parent)) .then(() => dataTable.doubleClickOnRowByName(parent))
.then(done); .then(done);
}); });
it('File with name, no title, no description', () => { it('File with name, no title, no description - [C255871]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title', () => { it('File with name and description, no title - [C255872]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description', () => { it('File with name and title, no description - [C255873]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different', () => { it('File with name and title and description, all different - [C255874]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal', () => { it('File with name and title and description, all equal - [C255875]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description', () => { it('File with name = title, different description - [C255876]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title', () => { it('File with name = description, different title - [C255877]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name', () => { it('File with title = description, different name - [C255878]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
@@ -144,35 +144,35 @@ describe('File / folder tooltips', () => {
.then(done); .then(done);
}); });
it('File with name, no title, no description', () => { it('File with name, no title, no description - [C280135]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title', () => { it('File with name and description, no title - [C280136]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description', () => { it('File with name and title, no description - [C280137]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different', () => { it('File with name and title and description, all different - [C280138]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal', () => { it('File with name and title and description, all equal - [C280139]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description', () => { it('File with name = title, different description - [C280140]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title', () => { it('File with name = description, different title - [C280141]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name', () => { it('File with title = description, different name - [C280142]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
@@ -185,73 +185,75 @@ describe('File / folder tooltips', () => {
.then(done); .then(done);
}); });
it('File with name, no title, no description', () => { xit('File with name, no title, no description - [C280143]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title', () => { xit('File with name and description, no title - [C280144]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description', () => { xit('File with name and title, no description - [C280145]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different', () => { xit('File with name and title and description, all different - [C280146]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal', () => { xit('File with name and title and description, all equal - [C280147]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description', () => { xit('File with name = title, different description - [C280148]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title', () => { xit('File with name = description, different title - [C280149]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name', () => { xit('File with title = description, different name - [C280150]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
describe('on Favorites', () => { describe('on Favorites', () => {
beforeAll(done => { beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES).then(done); page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
}); });
it('File with name, no title, no description', () => { it('File with name, no title, no description - [C280151]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title', () => { it('File with name and description, no title - [C280152]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description', () => { it('File with name and title, no description - [C280153]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different', () => { it('File with name and title and description, all different - [C280154]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal', () => { it('File with name and title and description, all equal - [C280155]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description', () => { it('File with name = title, different description - [C280156]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title', () => { it('File with name = description, different title - [C280157]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name', () => { it('File with title = description, different name - [C280158]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
@@ -263,24 +265,24 @@ describe('File / folder tooltips', () => {
beforeAll(done => { beforeAll(done => {
apis.user.nodes.createFolder( parentForTrash ) apis.user.nodes.createFolder( parentForTrash )
.then(resp => parentForTrashId = resp.data.entry.id) .then(resp => parentForTrashId = resp.entry.id)
.then(() => Promise.all([ .then(() => Promise.all([
apis.user.nodes.createFile(file, parentForTrashId) apis.user.nodes.createFile(file, parentForTrashId)
.then(resp => file1TrashId = resp.data.entry.id), .then(resp => file1TrashId = resp.entry.id),
apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription) apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription)
.then(resp => file2TrashId = resp.data.entry.id), .then(resp => file2TrashId = resp.entry.id),
apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle) apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle)
.then(resp => file3TrashId = resp.data.entry.id), .then(resp => file3TrashId = resp.entry.id),
apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription) apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription)
.then(resp => file4TrashId = resp.data.entry.id), .then(resp => file4TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc) apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)
.then(resp => file5TrashId = resp.data.entry.id), .then(resp => file5TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription) apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription)
.then(resp => file6TrashId = resp.data.entry.id), .then(resp => file6TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle) apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle)
.then(resp => file7TrashId = resp.data.entry.id), .then(resp => file7TrashId = resp.entry.id),
apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle) apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle)
.then(resp => file8TrashId = resp.data.entry.id) .then(resp => file8TrashId = resp.entry.id)
])) ]))
.then(() => apis.user.nodes.deleteNodesById([ .then(() => apis.user.nodes.deleteNodesById([
@@ -288,6 +290,7 @@ describe('File / folder tooltips', () => {
], false)) ], false))
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => dataTable.waitForHeader())
.then(done); .then(done);
}); });
@@ -295,35 +298,35 @@ describe('File / folder tooltips', () => {
apis.user.nodes.deleteNodes([ parentForTrash ]).then(done); apis.user.nodes.deleteNodes([ parentForTrash ]).then(done);
}); });
it('File with name, no title, no description', () => { it('File with name, no title, no description - [C280159]', () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title', () => { it('File with name and description, no title - [C280160]', () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description', () => { it('File with name and title, no description - [C280161]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different', () => { it('File with name and title and description, all different - [C280162]', () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal', () => { it('File with name and title and description, all equal - [C280163]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description', () => { it('File with name = title, different description - [C280164]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title', () => { it('File with name = description, different title - [C280165]', () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name', () => { it('File with title = description, different name - [C280166]', () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
+59 -25
View File
@@ -41,6 +41,12 @@ describe('Trash', () => {
const folderUser = `folder-${Utils.random()}`; let folderUserId; const folderUser = `folder-${Utils.random()}`; let folderUserId;
const fileUser = `file-${Utils.random()}.txt`; let fileUserId; const fileUser = `file-${Utils.random()}.txt`; let fileUserId;
const folderDeleted = `folder-${Utils.random()}`; let folderDeletedId;
const fileDeleted = `file-${Utils.random()}.txt`; let fileDeletedId;
const folderNotDeleted = `folder-${Utils.random()}`; let folderNotDeletedId;
const fileInFolder = `file-${Utils.random()}.txt`; let fileInFolderId;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, username) user: new RepoClient(username, username)
@@ -53,18 +59,24 @@ describe('Trash', () => {
const { breadcrumb } = trashPage.toolbar; const { breadcrumb } = trashPage.toolbar;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.admin.nodes.createFiles([ fileAdmin ]).then(resp => fileAdminId = resp.data.entry.id)) .then(() => apis.admin.nodes.createFiles([ fileAdmin ]).then(resp => fileAdminId = resp.entry.id))
.then(() => apis.admin.nodes.createFolders([ folderAdmin ]).then(resp => folderAdminId = resp.data.entry.id)) .then(() => apis.admin.nodes.createFolders([ folderAdmin ]).then(resp => folderAdminId = resp.entry.id))
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) .then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER)) .then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER))
.then(() => apis.admin.nodes.createFiles([ fileSite ], `Sites/${siteName}/documentLibrary`) .then(() => apis.admin.nodes.createFiles([ fileSite ], `Sites/${siteName}/documentLibrary`)
.then(resp => fileSiteId = resp.data.entry.id)) .then(resp => fileSiteId = resp.entry.id))
.then(() => apis.user.nodes.createFiles([ fileUser ]).then(resp => fileUserId = resp.data.entry.id)) .then(() => apis.user.nodes.createFiles([ fileUser ]).then(resp => fileUserId = resp.entry.id))
.then(() => apis.user.nodes.createFolders([ folderUser ]).then(resp => folderUserId = resp.data.entry.id)) .then(() => apis.user.nodes.createFolders([ folderUser ]).then(resp => folderUserId = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folderDeleted).then(resp => folderDeletedId = resp.entry.id))
.then(() => apis.user.nodes.createFiles([ fileDeleted ], folderDeleted).then(resp => fileDeletedId = resp.entry.id))
.then(() => apis.user.nodes.createFolder(folderNotDeleted).then(resp => folderNotDeletedId = resp.entry.id))
.then(() => apis.user.nodes.createFiles([ fileInFolder ], folderNotDeleted).then(resp => fileInFolderId = resp.entry.id))
.then(() => apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false)) .then(() => apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false))
.then(() => apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId ], false)) .then(() => apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId, fileInFolderId ], false))
.then(() => apis.user.nodes.deleteNodeById(fileDeletedId, false))
.then(() => apis.user.nodes.deleteNodeById(folderDeletedId, false))
.then(done); .then(done);
}); });
@@ -72,6 +84,7 @@ describe('Trash', () => {
afterAll(done => { afterAll(done => {
Promise.all([ Promise.all([
apis.admin.sites.deleteSite(siteName), apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodeById(folderNotDeletedId),
apis.admin.trashcan.emptyTrash() apis.admin.trashcan.emptyTrash()
]) ])
.then(done); .then(done);
@@ -94,7 +107,7 @@ describe('Trash', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('has the correct columns', () => { it('has the correct columns - [C213217]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ]; const labels = [ 'Name', 'Location', 'Size', 'Deleted', 'Deleted by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
@@ -105,14 +118,14 @@ describe('Trash', () => {
}); });
}); });
it('displays the files and folders deleted by everyone [C213217]', () => { it('displays the files and folders deleted by everyone - [C280493]', () => {
expect(dataTable.countRows()).toEqual(5, 'Incorrect number of deleted items displayed'); expect(dataTable.countRows()).toEqual(8, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`); expect(dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(dataTable.getRowName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
}); });
}); });
@@ -131,7 +144,7 @@ describe('Trash', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('has the correct columns', () => { it('has the correct columns - [C280494]', () => {
const labels = [ 'Name', 'Location', 'Size', 'Deleted']; const labels = [ 'Name', 'Location', 'Size', 'Deleted'];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
@@ -142,26 +155,47 @@ describe('Trash', () => {
}); });
}); });
it('displays the files and folders deleted by the user [C213218]', () => { it('displays the files and folders deleted by the user - [C213218]', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of deleted items displayed'); expect(dataTable.countRows()).toEqual(6, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`); expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`);
}); });
it('default sorting column [C213219]', () => { it('default sorting column - [C213219]', () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Deleted'); expect(dataTable.getSortedColumnHeader().getText()).toBe('Deleted');
expect(dataTable.getSortingOrder()).toBe('desc'); expect(dataTable.getSortingOrder()).toBe('desc');
}); });
it('Location column redirect - file in user Home [C217144] [C260968]', () => { it('Location column displays the parent folder of the file - [C280498]', () => {
expect(dataTable.getItemLocation(fileInFolder).getText()).toEqual(folderNotDeleted);
expect(dataTable.getItemLocation(fileUser).getText()).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileSite).getText()).toEqual(siteName);
});
it('Location column displays a tooltip with the entire path of the file - [C280499]', () => {
expect(dataTable.getItemLocationTileAttr(fileInFolder)).toEqual(`Personal Files/${folderNotDeleted}`);
expect(dataTable.getItemLocationTileAttr(fileUser)).toEqual('Personal Files');
expect(dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}`);
});
it('Location column is empty if parent folder no longer exists - [C280500]', () => {
expect(dataTable.getItemLocation(fileDeleted).getText()).toEqual('');
});
it('Location column redirect - file in user Home - [C217144]', () => {
dataTable.clickItemLocation(fileUser) dataTable.clickItemLocation(fileUser)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]));
}); });
it('Location column redirect - file in site [C217144] [C260969]', () => { it('Location column redirect - file in folder - [C280496]', () => {
dataTable.clickItemLocation(fileInFolder)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderNotDeleted ]));
});
it('Location column redirect - file in site - [C280497]', () => {
dataTable.clickItemLocation(fileSite) dataTable.clickItemLocation(fileSite)
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]));
}); });
+45 -45
View File
@@ -55,20 +55,20 @@ describe('Breadcrumb', () => {
}; };
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username) apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFolder(parent)).then(resp => parentId = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(parent)).then(resp => parentId = resp.entry.id)
.then(() => apis.user.nodes.createFolder(subFolder1, parentId)).then(resp => subFolder1Id = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(subFolder1, parentId)).then(resp => subFolder1Id = resp.entry.id)
.then(() => apis.user.nodes.createFolder(subFolder2, subFolder1Id)).then(resp => subFolder2Id = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(subFolder2, subFolder1Id)).then(resp => subFolder2Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(fileName1, subFolder2Id)) .then(() => apis.user.nodes.createFile(fileName1, subFolder2Id))
.then(() => apis.user.nodes.createFolder(parent2)).then(resp => parent2Id = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(parent2)).then(resp => parent2Id = resp.entry.id)
.then(() => apis.user.nodes.createFolder(folder1, parent2Id)).then(resp => folder1Id = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(folder1, parent2Id)).then(resp => folder1Id = resp.entry.id)
.then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) .then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.user.sites.getDocLibId(siteName)) .then(() => apis.user.sites.getDocLibId(siteName))
.then(resp => apis.user.nodes.createFolder(parent, resp)).then(resp => parentId = resp.data.entry.id) .then(resp => apis.user.nodes.createFolder(parent, resp)).then(resp => parentId = resp.entry.id)
.then(() => apis.user.nodes.createFolder(subFolder1, parentId)).then(resp => subFolder1Id = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(subFolder1, parentId)).then(resp => subFolder1Id = resp.entry.id)
.then(() => apis.user.nodes.createFolder(subFolder2, subFolder1Id)).then(resp => subFolder2Id = resp.data.entry.id) .then(() => apis.user.nodes.createFolder(subFolder2, subFolder1Id)).then(resp => subFolder2Id = resp.entry.id)
.then(() => apis.user.nodes.createFile(fileName1, subFolder2Id)) .then(() => apis.user.nodes.createFile(fileName1, subFolder2Id))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -85,7 +85,7 @@ describe('Breadcrumb', () => {
.then(done); .then(done);
}); });
it('Personal Files breadcrumb main node [C260964]', () => { it('Personal Files breadcrumb main node - [C260964]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => { .then(() => {
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
@@ -93,7 +93,7 @@ describe('Breadcrumb', () => {
}); });
}); });
it('File Libraries breadcrumb main node [C260966]', () => { it('File Libraries breadcrumb main node - [C260966]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => { .then(() => {
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
@@ -101,7 +101,7 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Recent Files breadcrumb main node [C260971]', () => { it('Recent Files breadcrumb main node - [C260971]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => { .then(() => {
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
@@ -109,7 +109,7 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Shared Files breadcrumb main node [C260972]', () => { it('Shared Files breadcrumb main node - [C260972]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => { .then(() => {
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
@@ -117,7 +117,7 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Favorites breadcrumb main node [C260973]', () => { it('Favorites breadcrumb main node - [C260973]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => { .then(() => {
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
@@ -125,7 +125,7 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Trash breadcrumb main node [C260974]', () => { it('Trash breadcrumb main node - [C260974]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => { .then(() => {
expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); expect(breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
@@ -133,37 +133,37 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Personal Files breadcrumb for a folder hierarchy [C260965]', () => { it('Personal Files breadcrumb for a folder hierarchy - [C260965]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => page.dataTable.doubleClickOnItemName(parent)) .then(() => page.dataTable.doubleClickOnRowByName(parent))
.then(() => page.dataTable.doubleClickOnItemName(subFolder1)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder1))
.then(() => page.dataTable.doubleClickOnItemName(subFolder2)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder2))
.then(() => { .then(() => {
const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ]; const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1, subFolder2 ];
expect(breadcrumb.getAllItems()).toEqual(expectedBreadcrumb); expect(breadcrumb.getAllItems()).toEqual(expectedBreadcrumb);
}); });
}); });
it('File Libraries breadcrumb for a folder hierarchy [C260967]', () => { it('File Libraries breadcrumb for a folder hierarchy - [C260967]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => page.dataTable.doubleClickOnItemName(siteName)) .then(() => page.dataTable.doubleClickOnRowByName(siteName))
.then(() => page.dataTable.doubleClickOnItemName(parent)) .then(() => page.dataTable.doubleClickOnRowByName(parent))
.then(() => page.dataTable.doubleClickOnItemName(subFolder1)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder1))
.then(() => page.dataTable.doubleClickOnItemName(subFolder2)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder2))
.then(() => { .then(() => {
const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ]; const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ];
expect(breadcrumb.getAllItems()).toEqual(expectedItems); expect(breadcrumb.getAllItems()).toEqual(expectedItems);
}); });
}); });
it('User can navigate to any location by clicking on a step from the breadcrumb [C213235]', () => { it('User can navigate to any location by clicking on a step from the breadcrumb - [C213235]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => page.dataTable.doubleClickOnItemName(parent)) .then(() => page.dataTable.doubleClickOnRowByName(parent))
.then(() => page.dataTable.doubleClickOnItemName(subFolder1)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder1))
.then(() => page.dataTable.doubleClickOnItemName(subFolder2)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder2))
.then(() => breadcrumb.clickItem(subFolder1)) .then(() => breadcrumb.clickItem(subFolder1))
.then(() => { .then(() => {
const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1 ]; const expectedBreadcrumb = [ 'Personal Files', parent, subFolder1 ];
@@ -171,22 +171,22 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Tooltip appears on hover on a step in breadcrumb [C213237]', () => { it('Tooltip appears on hover on a step in breadcrumb - [C213237]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => page.dataTable.doubleClickOnItemName(parent)) .then(() => page.dataTable.doubleClickOnRowByName(parent))
.then(() => page.dataTable.doubleClickOnItemName(subFolder1)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder1))
.then(() => page.dataTable.doubleClickOnItemName(subFolder2)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder2))
.then(() => { .then(() => {
expect(breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1); expect(breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1);
}); });
}); });
it('Breadcrumb updates correctly when folder is renamed [C213238]', () => { it('Breadcrumb updates correctly when folder is renamed - [C213238]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => page.dataTable.doubleClickOnItemName(parent2)) .then(() => page.dataTable.doubleClickOnRowByName(parent2))
.then(() => page.dataTable.doubleClickOnItemName(folder1)) .then(() => page.dataTable.doubleClickOnRowByName(folder1))
.then(() => page.dataTable.wait()) .then(() => page.dataTable.wait())
.then(() => apis.user.nodes.renameNode(folder1Id, folder1Renamed).then(done => done)) .then(() => apis.user.nodes.renameNode(folder1Id, folder1Renamed).then(done => done))
.then(() => page.refresh()) .then(() => page.refresh())
@@ -196,12 +196,12 @@ describe('Breadcrumb', () => {
}); });
}); });
it('Browser back navigates to previous location regardless of breadcrumb steps [C213240]', () => { it('Browser back navigates to previous location regardless of breadcrumb steps - [C213240]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => page.dataTable.waitForHeader()) .then(() => page.dataTable.waitForHeader())
.then(() => page.dataTable.doubleClickOnItemName(parent)) .then(() => page.dataTable.doubleClickOnRowByName(parent))
.then(() => page.dataTable.doubleClickOnItemName(subFolder1)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder1))
.then(() => page.dataTable.doubleClickOnItemName(subFolder2)) .then(() => page.dataTable.doubleClickOnRowByName(subFolder2))
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) .then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(() => page.dataTable.waitForEmptyState()) .then(() => page.dataTable.waitForEmptyState())
.then(() => browser.navigate().back()) .then(() => browser.navigate().back())
@@ -219,8 +219,8 @@ describe('Breadcrumb', () => {
beforeAll(done => { beforeAll(done => {
logoutPage.load() logoutPage.load()
.then(() => apis.admin.people.createUser(user2)) .then(() => apis.admin.people.createUser({ username: user2 }))
.then(() => user2Api.nodes.createFolder(userFolder).then(resp => userFolderId = resp.data.entry.id)) .then(() => user2Api.nodes.createFolder(userFolder).then(resp => userFolderId = resp.entry.id))
.then(() => loginPage.loginWithAdmin()) .then(() => loginPage.loginWithAdmin())
.then(done); .then(done);
}); });
@@ -233,11 +233,11 @@ describe('Breadcrumb', () => {
.then(done); .then(done);
}); });
it(`Breadcrumb on navigation to a user's home [C260970]`, () => { xit(`Breadcrumb on navigation to a user's home - [C260970]`, () => {
page.dataTable.doubleClickOnItemName('User Homes') page.dataTable.doubleClickOnRowByName('User Homes')
.then(() => page.dataTable.doubleClickOnItemName(user2)) .then(() => page.dataTable.doubleClickOnRowByName(user2))
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2 ])) .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2 ]))
.then(() => page.dataTable.doubleClickOnItemName(userFolder)) .then(() => page.dataTable.doubleClickOnRowByName(userFolder))
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2, userFolder ])); .then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', 'User Homes', user2, userFolder ]));
}); });
}); });
+19 -13
View File
@@ -42,12 +42,12 @@ describe('Sidebar', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('has "Personal Files" as default', () => { it('has "Personal Files" as default - [C217149]', () => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Active link'); expect(sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Active link');
}); });
it('navigates to "File Libraries"', () => { it('navigates to "File Libraries" - [C217150]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.FILE_LIBRARIES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.FILE_LIBRARIES);
@@ -55,7 +55,7 @@ describe('Sidebar', () => {
}); });
}); });
it('navigates to "Personal Files"', () => { it('navigates to "Personal Files" - [C280409]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
@@ -63,7 +63,7 @@ describe('Sidebar', () => {
}); });
}); });
it('navigates to "Shared Files"', () => { it('navigates to "Shared Files" - [C213110]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.SHARED_FILES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.SHARED_FILES);
@@ -71,7 +71,7 @@ describe('Sidebar', () => {
}); });
}); });
it('navigates to "Recent Files"', () => { it('navigates to "Recent Files" - [C213166]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.RECENT_FILES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.RECENT_FILES);
@@ -79,7 +79,7 @@ describe('Sidebar', () => {
}); });
}); });
it('navigates to "Favorites"', () => { it('navigates to "Favorites" - [C213225]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITES); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITES);
@@ -87,7 +87,7 @@ describe('Sidebar', () => {
}); });
}); });
it('navigates to "Trash"', () => { it('navigates to "Trash" - [C213216]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => { .then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.TRASHCAN); expect(browser.getCurrentUrl()).toContain(APP_ROUTES.TRASHCAN);
@@ -95,42 +95,48 @@ describe('Sidebar', () => {
}); });
}); });
it('Personal Files tooltip', () => { // TODO: incomplete test
xit('Personal Files tooltip - [C217151]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => { .then(() => {
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.PERSONAL_FILES)).toContain('View your Personal Files'); expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.PERSONAL_FILES)).toContain('View your Personal Files');
}); });
}); });
it('File Libraries tooltip', () => { // TODO: incomplete test
xit('File Libraries tooltip - [C217152]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => { .then(() => {
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('Access File Libraries'); expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('Access File Libraries');
}); });
}); });
it('Shared Files tooltip', () => { // TODO: incomplete test
xit('Shared Files tooltip - [C213111]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => { .then(() => {
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.SHARED_FILES)).toContain('View files that have been shared'); expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.SHARED_FILES)).toContain('View files that have been shared');
}); });
}); });
it('Recent Files tooltip', () => { // TODO: incomplete test
xit('Recent Files tooltip - [C213167]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => { .then(() => {
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.RECENT_FILES)).toContain('View files you recently edited'); expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.RECENT_FILES)).toContain('View files you recently edited');
}); });
}); });
it('Favorites tooltip', () => { // TODO: incomplete test
xit('Favorites tooltip - [C217153]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => { .then(() => {
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITES)).toContain('View your favorite files and folders'); expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITES)).toContain('View your favorite files and folders');
}); });
}); });
it('Trash tooltip', () => { // TODO: incomplete test
xit('Trash tooltip - [C217154]', () => {
sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => { .then(() => {
expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.TRASH)).toContain('View deleted files in the trash'); expect(sidenav.getLinkTooltip(SIDEBAR_LABELS.TRASH)).toContain('View deleted files in the trash');
+35 -25
View File
@@ -52,7 +52,7 @@ describe('Pagination on Favorites', () => {
const file = `file-${Utils.random()}.txt`; let fileId; const file = `file-${Utils.random()}.txt`; let fileId;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
xit(''); xit('');
@@ -66,7 +66,7 @@ describe('Pagination on Favorites', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('pagination controls not displayed [C213164]', () => { it('pagination controls not displayed - [C280111]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => { .then(() => {
expect(pagination.range.isPresent()).toBe(false); expect(pagination.range.isPresent()).toBe(false);
@@ -81,7 +81,7 @@ describe('Pagination on Favorites', () => {
describe('on single page', () => { describe('on single page', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFile(file).then(resp => fileId = resp.data.entry.id) nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
.then(() => favoritesApi.addFavoriteById('file', fileId)) .then(() => favoritesApi.addFavoriteById('file', fileId))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
@@ -95,7 +95,7 @@ describe('Pagination on Favorites', () => {
.then(done); .then(done);
}); });
it('page selector not displayed when having a single page [C213165]', () => { it('page selector not displayed when having a single page - [C280112]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed')); .then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
@@ -105,7 +105,7 @@ describe('Pagination on Favorites', () => {
describe('on multiple pages', () => { describe('on multiple pages', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFiles(files, parent) nodesApi.createFiles(files, parent)
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id)) .then(resp => filesIds = resp.list.entries.map(entries => entries.entry.id))
.then(() => favoritesApi.addFavoritesByIds('file', filesIds)) .then(() => favoritesApi.addFavoritesByIds('file', filesIds))
.then(() => favoritesApi.waitForApi({ expect: 101 })) .then(() => favoritesApi.waitForApi({ expect: 101 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -130,7 +130,7 @@ describe('Pagination on Favorites', () => {
.then(done); .then(done);
}); });
it('default values [C213157]', () => { it('Pagination control default values - [C280113]', () => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25'); expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
@@ -139,7 +139,7 @@ describe('Pagination on Favorites', () => {
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
}); });
it('page sizes [C213157]', () => { it('Items per page values - [C280114]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => { .then(() => {
const [ first, second, third ] = [1, 2, 3] const [ first, second, third ] = [1, 2, 3]
@@ -151,29 +151,41 @@ describe('Pagination on Favorites', () => {
.then(() => pagination.menu.closeMenu()); .then(() => pagination.menu.closeMenu());
}); });
it('change the page size [C213158]', () => { it('current page menu items - [C280115]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => pagination.menu.clickMenuItem('25'))
.then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('25');
expect(pagination.getText(pagination.totalPages)).toContain('of 5');
})
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('50')) .then(() => pagination.menu.clickMenuItem('50'))
.then(() => { .then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('50'); expect(pagination.getText(pagination.maxItems)).toContain('50');
expect(pagination.getText(pagination.totalPages)).toContain('of 3'); expect(pagination.getText(pagination.totalPages)).toContain('of 3');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu()) .then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('100')) .then(() => pagination.menu.clickMenuItem('100'))
.then(() => { .then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('100'); expect(pagination.getText(pagination.maxItems)).toContain('100');
expect(pagination.getText(pagination.totalPages)).toContain('of 2'); expect(pagination.getText(pagination.totalPages)).toContain('of 2');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.resetToDefaultPageSize()); .then(() => pagination.resetToDefaultPageSize());
}); });
it('current page menu items', () => { it('change the current page from menu - [C280116]', () => {
pagination.openCurrentPageMenu()
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu());
});
it('change the current page from menu [C260518]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(3)) .then(() => pagination.menu.clickNthItem(3))
.then(() => { .then(() => {
@@ -181,41 +193,39 @@ describe('Pagination on Favorites', () => {
expect(pagination.getText(pagination.currentPage)).toContain('Page 3'); expect(pagination.getText(pagination.currentPage)).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('navigate to next page [C213160]', () => { it('navigate to next and previous pages - [C280119]', () => {
pagination.nextButton.click() pagination.nextButton.click()
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101'); expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber())
});
it('navigate to previous page [C213160]', () => { .then(() => pagination.openCurrentPageMenu())
pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(2)) .then(() => pagination.menu.clickNthItem(2))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click()) .then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowName('file-88.txt').isPresent()) expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page'); .toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('Previous button is disabled on first page [C260519]', () => { it('Previous button is disabled on first page - [C280117]', () => {
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page'); expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
}); });
it('Next button is disabled on last page [C260519]', () => { it('Next button is disabled on last page - [C280118]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(5)) .then(() => pagination.menu.clickNthItem(5))
.then(() => { .then(() => {
+217
View File
@@ -0,0 +1,217 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Pagination on File Libraries', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const sites = Array(101)
.fill('site')
.map((name, index): string => `${name}-${index + 1}`);
const site = `userSite-${Utils.random()}`; let siteId;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
done();
});
xit('');
describe('on empty page', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('pagination controls not displayed - [C280084]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
expect(await pagination.range.isPresent()).toBe(false);
expect(await pagination.maxItems.isPresent()).toBe(false);
expect(await pagination.currentPage.isPresent()).toBe(false);
expect(await pagination.totalPages.isPresent()).toBe(false);
expect(await pagination.previousButton.isPresent()).toBe(false);
expect(await pagination.nextButton.isPresent()).toBe(false);
});
});
describe('on single page', () => {
beforeAll(async (done) => {
siteId = (await apis.user.sites.createSite(site)).entry.id;
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.sites.deleteSite(siteId);
await logoutPage.load();
done();
});
it('page selector not displayed when having a single page - [C280085]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
});
});
describe('on multiple pages', () => {
beforeAll(async (done) => {
await apis.user.sites.createSites(sites, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.waitForApi({ expect: 101 });
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done();
});
afterAll(async (done) => {
await apis.user.sites.deleteSites(sites);
await logoutPage.load();
done();
});
it('Pagination control default values - [C280086]', async () => {
expect(await pagination.range.getText()).toContain('1-25 of 101');
expect(await pagination.maxItems.getText()).toContain('25');
expect(await pagination.currentPage.getText()).toContain('Page 1');
expect(await pagination.totalPages.getText()).toContain('of 5');
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('Items per page values - [C280087]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu();
});
it('current page menu items - [C280088]', async () => {
await pagination.openMaxItemsMenu();
await pagination.menu.clickMenuItem('25');
expect(await pagination.getText(pagination.maxItems)).toContain('25');
expect(await pagination.getText(pagination.totalPages)).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.getText(pagination.maxItems)).toContain('50');
expect(await pagination.getText(pagination.totalPages)).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.getText(pagination.maxItems)).toContain('100');
expect(await pagination.getText(pagination.totalPages)).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 - [C280089]', async () => {
await pagination.openCurrentPageMenu();
await pagination.menu.clickNthItem(3);
await dataTable.waitForHeader();
expect(await pagination.range.getText()).toContain('51-75 of 101');
expect(await pagination.currentPage.getText()).toContain('Page 3');
expect(await pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(await dataTable.getRowByName('site-60').isPresent()).toBe(true, 'Site-60 not found on page');
await pagination.resetToDefaultPageNumber();
});
it('navigate to next and previous pages - [C280092]', async () => {
await pagination.clickNext();
await dataTable.waitForHeader();
expect(await pagination.range.getText()).toContain('26-50 of 101');
expect(await dataTable.getRowByName('site-30').isPresent()).toBe(true, 'Site-30 not found on page');
await pagination.resetToDefaultPageNumber();
await pagination.openCurrentPageMenu();
await pagination.menu.clickNthItem(2);
await dataTable.waitForHeader();
await pagination.previousButton.click();
await dataTable.waitForHeader();
expect(await pagination.range.getText()).toContain('1-25 of 101');
expect(await dataTable.getRowByName('site-12').isPresent()).toBe(true, 'Site-12 not found on page');
await pagination.resetToDefaultPageNumber();
});
it('Previous button is disabled on first page - [C280090]', async () => {
expect(await pagination.currentPage.getText()).toContain('Page 1');
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
});
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 pagination.currentPage.getText()).toContain('Page 5');
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
});
});
});
@@ -51,7 +51,7 @@ describe('Pagination on Personal Files', () => {
const file = `file-${Utils.random()}.txt`; let fileId; const file = `file-${Utils.random()}.txt`; let fileId;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
xit(''); xit('');
@@ -65,7 +65,7 @@ describe('Pagination on Personal Files', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('pagination controls not displayed [C213164]', () => { it('pagination controls not displayed - [C280075]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => { .then(() => {
expect(pagination.range.isPresent()).toBe(false); expect(pagination.range.isPresent()).toBe(false);
@@ -80,7 +80,7 @@ describe('Pagination on Personal Files', () => {
describe('on single page', () => { describe('on single page', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFile(file).then(resp => fileId = resp.data.entry.id) nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
}); });
@@ -93,7 +93,7 @@ describe('Pagination on Personal Files', () => {
.then(done); .then(done);
}); });
it('page selector not displayed when having a single page [C213165]', () => { it('page selector not displayed when having a single page - [C280076]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed')); .then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
@@ -110,7 +110,7 @@ describe('Pagination on Personal Files', () => {
beforeEach(done => { beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(parent)) .then(() => dataTable.doubleClickOnRowByName(parent))
.then(done); .then(done);
}); });
@@ -126,7 +126,7 @@ describe('Pagination on Personal Files', () => {
.then(done); .then(done);
}); });
it('default values [C213157]', () => { it('Pagination control default values - [C280077]', () => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25'); expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
@@ -135,7 +135,7 @@ describe('Pagination on Personal Files', () => {
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
}); });
it('page sizes [C213157]', () => { it('Items per page values - [C280078]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => { .then(() => {
const [ first, second, third ] = [1, 2, 3] const [ first, second, third ] = [1, 2, 3]
@@ -147,30 +147,41 @@ describe('Pagination on Personal Files', () => {
.then(() => pagination.menu.closeMenu()); .then(() => pagination.menu.closeMenu());
}); });
it('change the page size [C213158]', () => { it('current page menu items - [C280079]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => pagination.menu.clickMenuItem('50')) .then(() => pagination.menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.maxItems.getText()).toContain('50'); expect(pagination.getText(pagination.maxItems)).toContain('25');
expect(pagination.totalPages.getText()).toContain('of 3'); expect(pagination.getText(pagination.totalPages)).toContain('of 5');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('50'))
.then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('50');
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
})
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu()) .then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('100')) .then(() => pagination.menu.clickMenuItem('100'))
.then(() => { .then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('100'); expect(pagination.getText(pagination.maxItems)).toContain('100');
expect(pagination.getText(pagination.totalPages)).toContain('of 2'); expect(pagination.getText(pagination.totalPages)).toContain('of 2');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.resetToDefaultPageSize()); .then(() => pagination.resetToDefaultPageSize());
}); });
it('current page menu items', () => { it('change the current page from menu - [C280080]', () => {
pagination.openCurrentPageMenu()
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu());
});
it('change the current page from menu [C260518]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(3)) .then(() => pagination.menu.clickNthItem(3))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
@@ -179,43 +190,41 @@ describe('Pagination on Personal Files', () => {
expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowName('file-60.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-60.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('navigate to next page [C213160]', () => { it('navigate to next and previous pages - [C280083]', () => {
pagination.clickNext() pagination.clickNext()
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101'); expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowName('file-30.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-30.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber())
});
it('navigate to previous page [C213160]', () => { .then(() => pagination.openCurrentPageMenu())
pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(2)) .then(() => pagination.menu.clickNthItem(2))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => pagination.clickPrevious()) .then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowName('file-12.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-12.txt').isPresent())
.toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('Previous button is disabled on first page [C260519]', () => { it('Previous button is disabled on first page - [C280081]', () => {
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page'); expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
}); });
it('Next button is disabled on last page [C260519]', () => { it('Next button is disabled on last page - [C280082]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(5)) .then(() => pagination.menu.clickNthItem(5))
.then(() => { .then(() => {
+38 -29
View File
@@ -51,7 +51,7 @@ describe('Pagination on Recent Files', () => {
const file = `file-${Utils.random()}.txt`; let fileId; const file = `file-${Utils.random()}.txt`; let fileId;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
xit(''); xit('');
@@ -65,7 +65,7 @@ describe('Pagination on Recent Files', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('pagination controls not displayed [C213164]', () => { it('pagination controls not displayed - [C280102]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => { .then(() => {
expect(pagination.range.isPresent()).toBe(false); expect(pagination.range.isPresent()).toBe(false);
@@ -80,7 +80,7 @@ describe('Pagination on Recent Files', () => {
describe('on single page', () => { describe('on single page', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFile(file).then(resp => fileId = resp.data.entry.id) nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
.then(() => searchApi.waitForApi(username, { expect: 1 })) .then(() => searchApi.waitForApi(username, { expect: 1 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
.then(done); .then(done);
@@ -94,7 +94,7 @@ describe('Pagination on Recent Files', () => {
.then(done); .then(done);
}); });
it('page selector not displayed when having a single page [C213165]', () => { it('page selector not displayed when having a single page - [C280103]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed')); .then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
@@ -128,7 +128,7 @@ describe('Pagination on Recent Files', () => {
.then(done); .then(done);
}); });
it('default values [C213157]', () => { it('Pagination control default values - [C280104]', () => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25'); expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
@@ -137,7 +137,7 @@ describe('Pagination on Recent Files', () => {
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
}); });
it('page sizes [C213157]', () => { it('Items per page values - [C280105]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => { .then(() => {
const [ first, second, third ] = [1, 2, 3] const [ first, second, third ] = [1, 2, 3]
@@ -149,30 +149,41 @@ describe('Pagination on Recent Files', () => {
.then(() => pagination.menu.closeMenu()); .then(() => pagination.menu.closeMenu());
}); });
it('change the page size [C213158]', () => { it('current page menu items - [C280106]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => pagination.menu.clickMenuItem('50')) .then(() => pagination.menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.maxItems.getText()).toContain('50'); expect(pagination.getText(pagination.maxItems)).toContain('25');
expect(pagination.totalPages.getText()).toContain('of 3'); expect(pagination.getText(pagination.totalPages)).toContain('of 5');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('50'))
.then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('50');
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
})
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu()) .then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('100')) .then(() => pagination.menu.clickMenuItem('100'))
.then(() => { .then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('100'); expect(pagination.getText(pagination.maxItems)).toContain('100');
expect(pagination.getText(pagination.totalPages)).toContain('of 2'); expect(pagination.getText(pagination.totalPages)).toContain('of 2');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.resetToDefaultPageSize()); .then(() => pagination.resetToDefaultPageSize());
}); });
it('current page menu items', () => { it('change the current page from menu - [C280107]', () => {
pagination.openCurrentPageMenu()
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu());
});
it('change the current page from menu [C260518]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(3)) .then(() => pagination.menu.clickNthItem(3))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
@@ -181,43 +192,41 @@ describe('Pagination on Recent Files', () => {
expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('navigate to next page [C213160]', () => { it('navigate to next and previous pages - [C280110]', () => {
pagination.nextButton.click() pagination.nextButton.click()
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101'); expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber())
});
it('navigate to previous page [C213160]', () => { .then(() => pagination.openCurrentPageMenu())
pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(2)) .then(() => pagination.menu.clickNthItem(2))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click()) .then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('Previous button is disabled on first page [C260519]', () => { it('Previous button is disabled on first page - [C280108]', () => {
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page'); expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
}); });
it('Next button is disabled on last page [C260519]', () => { it('Next button is disabled on last page - [C280109]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(5)) .then(() => pagination.menu.clickNthItem(5))
.then(() => { .then(() => {
+39 -30
View File
@@ -52,7 +52,7 @@ describe('Pagination on Shared Files', () => {
const file = `file-${Utils.random()}.txt`; let fileId; const file = `file-${Utils.random()}.txt`; let fileId;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
xit(''); xit('');
@@ -66,7 +66,7 @@ describe('Pagination on Shared Files', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('pagination controls not displayed [C213164]', () => { it('pagination controls not displayed - [C280094]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => { .then(() => {
expect(pagination.range.isPresent()).toBe(false); expect(pagination.range.isPresent()).toBe(false);
@@ -81,7 +81,7 @@ describe('Pagination on Shared Files', () => {
describe('on single page', () => { describe('on single page', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFile(file).then(resp => fileId = resp.data.entry.id) nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
.then(() => sharedApi.shareFileById(fileId)) .then(() => sharedApi.shareFileById(fileId))
.then(() => sharedApi.waitForApi({ expect: 1 })) .then(() => sharedApi.waitForApi({ expect: 1 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -96,7 +96,7 @@ describe('Pagination on Shared Files', () => {
.then(done); .then(done);
}); });
it('page selector not displayed when having a single page [C213165]', () => { it('page selector not displayed when having a single page - [C280094]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed')); .then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
@@ -106,7 +106,7 @@ describe('Pagination on Shared Files', () => {
describe('on multiple pages', () => { describe('on multiple pages', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFiles(files, parent) nodesApi.createFiles(files, parent)
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id)) .then(resp => filesIds = resp.list.entries.map(entries => entries.entry.id))
.then(() => sharedApi.shareFilesByIds(filesIds)) .then(() => sharedApi.shareFilesByIds(filesIds))
.then(() => sharedApi.waitForApi({ expect: 101 })) .then(() => sharedApi.waitForApi({ expect: 101 }))
@@ -133,7 +133,7 @@ describe('Pagination on Shared Files', () => {
.then(done); .then(done);
}); });
it('default values [C213157]', () => { it('Pagination control default values - [C280095]', () => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25'); expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
@@ -142,7 +142,7 @@ describe('Pagination on Shared Files', () => {
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
}); });
it('page sizes [C213157]', () => { it('Items per page values - [C280096]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => { .then(() => {
const [ first, second, third ] = [1, 2, 3] const [ first, second, third ] = [1, 2, 3]
@@ -154,30 +154,41 @@ describe('Pagination on Shared Files', () => {
.then(() => pagination.menu.closeMenu()); .then(() => pagination.menu.closeMenu());
}); });
it('change the page size [C213158]', () => { it('current page menu items - [C280097]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => pagination.menu.clickMenuItem('50')) .then(() => pagination.menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.maxItems.getText()).toContain('50'); expect(pagination.getText(pagination.maxItems)).toContain('25');
expect(pagination.totalPages.getText()).toContain('of 3'); expect(pagination.getText(pagination.totalPages)).toContain('of 5');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('50'))
.then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('50');
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
})
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu()) .then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('100')) .then(() => pagination.menu.clickMenuItem('100'))
.then(() => { .then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('100'); expect(pagination.getText(pagination.maxItems)).toContain('100');
expect(pagination.getText(pagination.totalPages)).toContain('of 2'); expect(pagination.getText(pagination.totalPages)).toContain('of 2');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.resetToDefaultPageSize()); .then(() => pagination.resetToDefaultPageSize());
}); });
it('current page menu items', () => { it('change the current page from menu - [C280098]', () => {
pagination.openCurrentPageMenu()
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu());
});
it('change the current page from menu [C260518]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(3)) .then(() => pagination.menu.clickNthItem(3))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
@@ -186,44 +197,42 @@ describe('Pagination on Shared Files', () => {
expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowName('file-40.txt').isPresent()) expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page'); .toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('navigate to next page [C213160]', () => { it('navigate to next and previous pages - [C280101]', () => {
pagination.nextButton.click() pagination.nextButton.click()
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101'); expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber())
});
it('navigate to previous page [C213160]', () => { .then(() => pagination.openCurrentPageMenu())
pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(2)) .then(() => pagination.menu.clickNthItem(2))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click()) .then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('Previous button is disabled on first page [C260519]', () => { it('Previous button is disabled on first page - [C280099]', () => {
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page'); expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
}); });
it('Next button is disabled on last page [C260519]', () => { it('Next button is disabled on last page - [C280100]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(5)) .then(() => pagination.menu.clickNthItem(5))
.then(() => { .then(() => {
+39 -30
View File
@@ -51,7 +51,7 @@ describe('Pagination on Trash', () => {
const file = `file-${Utils.random()}.txt`; let fileId; const file = `file-${Utils.random()}.txt`; let fileId;
beforeAll(done => { beforeAll(done => {
apis.admin.people.createUser(username).then(done); apis.admin.people.createUser({ username }).then(done);
}); });
xit(''); xit('');
@@ -65,7 +65,7 @@ describe('Pagination on Trash', () => {
logoutPage.load().then(done); logoutPage.load().then(done);
}); });
it('pagination controls not displayed [C213164]', () => { it('pagination controls not displayed - [C280120]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => { .then(() => {
expect(pagination.range.isPresent()).toBe(false); expect(pagination.range.isPresent()).toBe(false);
@@ -80,7 +80,7 @@ describe('Pagination on Trash', () => {
describe('on single page', () => { describe('on single page', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFile(file).then(resp => fileId = resp.data.entry.id) nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
.then(() => nodesApi.deleteNodeById(fileId, false)) .then(() => nodesApi.deleteNodeById(fileId, false))
.then(() => trashApi.waitForApi({ expect: 1 })) .then(() => trashApi.waitForApi({ expect: 1 }))
.then(() => loginPage.loginWith(username)) .then(() => loginPage.loginWith(username))
@@ -95,7 +95,7 @@ describe('Pagination on Trash', () => {
.then(done); .then(done);
}); });
it('page selector not displayed when having a single page [C213165]', () => { it('page selector not displayed when having a single page - [C280121]', () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed')); .then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
@@ -105,7 +105,7 @@ describe('Pagination on Trash', () => {
describe('on multiple pages', () => { describe('on multiple pages', () => {
beforeAll(done => { beforeAll(done => {
nodesApi.createFiles(filesForDelete) nodesApi.createFiles(filesForDelete)
.then(resp => filesDeletedIds = resp.data.list.entries.map(entries => entries.entry.id)) .then(resp => filesDeletedIds = resp.list.entries.map(entries => entries.entry.id))
.then(() => nodesApi.deleteNodesById(filesDeletedIds, false)) .then(() => nodesApi.deleteNodesById(filesDeletedIds, false))
.then(() => trashApi.waitForApi({expect: 101})) .then(() => trashApi.waitForApi({expect: 101}))
@@ -131,7 +131,7 @@ describe('Pagination on Trash', () => {
.then(done); .then(done);
}); });
it('default values [C213157]', () => { it('Pagination control default values - [C280122]', () => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25'); expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
@@ -140,7 +140,7 @@ describe('Pagination on Trash', () => {
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
}); });
it('page sizes [C213157]', () => { it('Items per page values - [C280123]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => { .then(() => {
const [ first, second, third ] = [1, 2, 3] const [ first, second, third ] = [1, 2, 3]
@@ -152,30 +152,41 @@ describe('Pagination on Trash', () => {
.then(() => pagination.menu.closeMenu()); .then(() => pagination.menu.closeMenu());
}); });
it('change the page size [C213158]', () => { it('current page menu items - [C280124]', () => {
pagination.openMaxItemsMenu() pagination.openMaxItemsMenu()
.then(() => pagination.menu.clickMenuItem('50')) .then(() => pagination.menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.maxItems.getText()).toContain('50'); expect(pagination.getText(pagination.maxItems)).toContain('25');
expect(pagination.totalPages.getText()).toContain('of 3'); expect(pagination.getText(pagination.totalPages)).toContain('of 5');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('50'))
.then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('50');
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
})
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.openMaxItemsMenu()) .then(() => pagination.openMaxItemsMenu())
.then(() => pagination.menu.clickMenuItem('100')) .then(() => pagination.menu.clickMenuItem('100'))
.then(() => { .then(() => {
expect(pagination.getText(pagination.maxItems)).toContain('100'); expect(pagination.getText(pagination.maxItems)).toContain('100');
expect(pagination.getText(pagination.totalPages)).toContain('of 2'); expect(pagination.getText(pagination.totalPages)).toContain('of 2');
}) })
.then(() => pagination.openCurrentPageMenu())
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
.then(() => pagination.menu.closeMenu())
.then(() => pagination.resetToDefaultPageSize()); .then(() => pagination.resetToDefaultPageSize());
}); });
it('current page menu items', () => { it('change the current page from menu - [C280125]', () => {
pagination.openCurrentPageMenu()
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
.then(() => pagination.menu.closeMenu());
});
it('change the current page from menu [C260518]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(3)) .then(() => pagination.menu.clickNthItem(3))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
@@ -184,43 +195,41 @@ describe('Pagination on Trash', () => {
expect(pagination.currentPage.getText()).toContain('Page 3'); expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled'); expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled'); expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowName('file-40.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('navigate to next page [C213160]', () => { it('navigate to next and previous pages - [C280128]', () => {
pagination.nextButton.click() pagination.nextButton.click()
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101'); expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowName('file-70.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber())
});
it('navigate to previous page [C213160]', () => { .then(() => pagination.openCurrentPageMenu())
pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(2)) .then(() => pagination.menu.clickNthItem(2))
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click()) .then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101'); expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowName('file-88.txt').isPresent()).toBe(true, 'File not found on page'); expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
}) })
.then(() => pagination.resetToDefaultPageNumber()); .then(() => pagination.resetToDefaultPageNumber());
}); });
it('Previous button is disabled on first page [C260519]', () => { it('Previous button is disabled on first page - [C280126]', () => {
expect(pagination.currentPage.getText()).toContain('Page 1'); expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page'); expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
}); });
it('Next button is disabled on last page [C260519]', () => { it('Next button is disabled on last page - [C280127]', () => {
pagination.openCurrentPageMenu() pagination.openCurrentPageMenu()
.then(() => pagination.menu.clickNthItem(5)) .then(() => pagination.menu.clickNthItem(5))
.then(() => { .then(() => {
+189
View File
@@ -0,0 +1,189 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { protractor, browser } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SIDEBAR_LABELS, FILES, SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
import { Viewer } from '../../components/viewer/viewer';
describe('Viewer general', () => {
const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
const xlsxFile = FILES.xlsxFile; let xlsxFileId;
const fileAdmin = FILES.docxFile; let fileAdminId;
const siteAdmin = `siteAdmin-${Utils.random()}`; let docLibId;
const siteUser = `siteUser-${Utils.random()}`; let docLibSiteUserId;
const fileInSite = FILES.docxFile;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const dataTable = page.dataTable;
const viewer = new Viewer();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFile(xlsxFile, parentId)).entry.id;
await apis.admin.sites.createSite(siteAdmin, SITE_VISIBILITY.PRIVATE);
docLibId = await apis.admin.sites.getDocLibId(siteAdmin);
fileAdminId = (await apis.admin.upload.uploadFile(fileAdmin, docLibId)).entry.id;
await apis.user.sites.createSite(siteUser, SITE_VISIBILITY.PUBLIC);
docLibSiteUserId = await apis.user.sites.getDocLibId(siteUser);
await apis.user.upload.uploadFile(fileInSite, docLibSiteUserId);
await apis.user.shared.shareFileById(xlsxFileId);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.favorites.addFavoriteById('file', xlsxFileId);
await apis.user.favorites.waitForApi({ expect: 1 });
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
done();
});
afterAll(async (done) => {
await Promise
.all([
apis.user.nodes.deleteNodeById(parentId),
apis.admin.sites.deleteSite(siteAdmin),
apis.user.sites.deleteSite(siteUser),
logoutPage.load()
])
.then(done);
});
it('Viewer opens on double clicking on a file from Personal Files - [C279269]', async () => {
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
});
it('Viewer opens when clicking the View action for a file - [C279270]', async () => {
await dataTable.selectItem(xlsxFile);
await page.toolbar.actions.getButtonByTitleAttribute('View').click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
});
it('The viewer general elements are displayed - [C279283]', async () => {
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
it('Close the viewer - [C279271]', async () => {
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await viewer.clickClose();
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer did not close');
});
it('Close button tooltip - [C284632]', async () => {
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.getCloseButtonTooltip()).toEqual('Close');
});
it('Viewer opens when accessing the preview URL for a file - [C279285]', async () => {
const previewURL = `personal-files/${parentId}/preview/${xlsxFileId}`;
await page.load(previewURL);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.getFileTitle()).toEqual(xlsxFile);
});
it('Viewer does not open when accessing the preview URL for a file without permissions - [C279287]', async () => {
const previewURL = `libraries/${docLibId}/preview/${fileAdminId}`;
await page.load(previewURL);
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer should not be opened!');
});
it('Viewer opens for a file from File Libraries - [C284633]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteUser);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(fileInSite);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
it('Viewer opens for a file from Recent Files - [C284636]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
it('Viewer opens for a file from Shared Files - [C284635]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
it('Viewer opens for a file from Favorites - [C284634]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
});
@@ -23,96 +23,82 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { promise } from 'protractor';
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { NodesApi } from '../nodes/nodes-api';
import { RepoClient } from './../../repo-client'; import { RepoClient } from './../../repo-client';
import { Utils } from '../../../../utilities/utils'; import { Utils } from '../../../../utilities/utils';
export class FavoritesApi extends RepoApi { export class FavoritesApi extends RepoApi {
addFavorite(api: RepoClient, nodeType: string, name: string): Promise<any> { constructor(username?, password?) {
return api.nodes.getNodeByPath(name) super(username, password);
.then((response) => { }
const { id } = response.data.entry;
return ([{ async addFavorite(api: RepoClient, nodeType: string, name: string) {
const nodeId = (await api.nodes.getNodeByPath(name)).entry.id;
const data = {
target: {
[nodeType]: {
guid: nodeId
}
}
};
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
}
async addFavoriteById(nodeType: 'file' | 'folder', id: string) {
const data = {
target: { target: {
[nodeType]: { [nodeType]: {
guid: id guid: id
} }
} }
}]); };
}) await this.apiAuth();
.then((data) => { return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
return this.post(`/people/-me-/favorites`, { data });
})
.catch(this.handleError);
} }
addFavoriteById(nodeType: 'file' | 'folder', id: string): Promise<any> { async addFavoritesByIds(nodeType: 'file' | 'folder', ids: string[]) {
const data = [{ await this.apiAuth();
target: { return await ids.reduce(async (previous, current) => {
[nodeType]: { await previous;
guid: id await this.addFavoriteById(nodeType, current);
} }, Promise.resolve());
}
}];
return this
.post(`/people/-me-/favorites`, { data })
.catch(this.handleError);
} }
addFavoritesByIds(nodeType: 'file' | 'folder', ids: string[]): Promise<any[]> { async getFavorites() {
return ids.reduce((previous, current) => ( await this.apiAuth();
previous.then(() => this.addFavoriteById(nodeType, current)) return await this.alfrescoJsApi.core.favoritesApi.getFavorites(this.getUsername());
), Promise.resolve());
} }
getFavorites(): Promise<any> { async getFavoriteById(nodeId: string) {
return this await this.apiAuth();
.get('/people/-me-/favorites') return await this.alfrescoJsApi.core.favoritesApi.getFavorite('-me', nodeId);
.catch(this.handleError);
} }
getFavoriteById(nodeId: string): Promise<any> { async isFavorite(nodeId: string) {
return this return JSON.stringify((await this.getFavorites()).list.entries).includes(nodeId);
.get(`/people/-me-/favorites/${nodeId}`)
.catch(this.handleError);
} }
isFavorite(nodeId: string) { async removeFavoriteById(nodeId: string) {
return this.getFavorites() await this.apiAuth();
.then(resp => JSON.stringify(resp.data.list.entries).includes(nodeId)); return await this.alfrescoJsApi.core.peopleApi.removeFavoriteSite('-me-', nodeId);
} }
removeFavorite(api: RepoClient, nodeType: string, name: string): Promise<any> { async removeFavorite(api: RepoClient, name: string) {
return api.nodes.getNodeByPath(name) const nodeId = (await api.nodes.getNodeByPath(name)).entry.id;
.then((response) => { return await this.removeFavoriteById(nodeId);
const { id } = response.data.entry;
return this.delete(`/people/-me-/favorites/${id}`);
})
.catch(this.handleError);
} }
removeFavoriteById(nodeId: string) { async waitForApi(data) {
return this const favoriteFiles = async () => {
.delete(`/people/-me-/favorites/${nodeId}`) const totalItems = (await this.getFavorites()).list.pagination.totalItems;
.catch(this.handleError);
}
waitForApi(data) {
const favoriteFiles = () => {
return this.getFavorites()
.then(response => response.data.list.pagination.totalItems)
.then(totalItems => {
if ( totalItems < data.expect) { if ( totalItems < data.expect) {
return Promise.reject(totalItems); return Promise.reject(totalItems);
} else { } else {
return Promise.resolve(totalItems); return Promise.resolve(totalItems);
} }
});
}; };
return Utils.retryCall(favoriteFiles); return await Utils.retryCall(favoriteFiles);
} }
} }
@@ -23,127 +23,125 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { NodeBodyLock } from 'alfresco-js-api-node';
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { NodeBodyCreate, NODE_TYPE_FILE, NODE_TYPE_FOLDER } from './node-body-create'; import { NodeBodyCreate } from './node-body-create';
import { NodeContentTree, flattenNodeContentTree } from './node-content-tree'; import { NodeContentTree, flattenNodeContentTree } from './node-content-tree';
export class NodesApi extends RepoApi { export class NodesApi extends RepoApi {
constructor(username?, password?) {
super(username, password);
}
// nodes // nodes
getNodeByPath(relativePath: string = '/'): Promise<any> {
return this async getNodeByPath(relativePath: string = '/') {
.get(`/nodes/-my-`, { parameters: { relativePath } }) await this.apiAuth();
.catch(this.handleError); return await this.alfrescoJsApi.core.nodesApi.getNode('-my-', { relativePath });
} }
getNodeById(id: string): Promise<any> { async getNodeById(id: string) {
return this await this.apiAuth();
.get(`/nodes/${id}`) return await this.alfrescoJsApi.core.nodesApi.getNode(id);
.catch(this.handleError);
} }
getNodeDescription(name: string, relativePath: string = '/') { async getNodeDescription(name: string, relativePath: string = '/') {
relativePath = (relativePath === '/') relativePath = (relativePath === '/')
? `${name}` ? `${name}`
: `${relativePath}/${name}`; : `${relativePath}/${name}`;
return this.getNodeByPath(`${relativePath}`) return (await this.getNodeByPath(`${relativePath}`)).entry.properties['cm:description'];
.then(response => response.data.entry.properties['cm:description']);
} }
deleteNodeById(id: string, permanent: boolean = true): Promise<any> { async deleteNodeById(id: string, permanent: boolean = true) {
return this await this.apiAuth();
.delete(`/nodes/${id}?permanent=${permanent}`) return await this.alfrescoJsApi.core.nodesApi.deleteNode(id, { permanent });
.catch(this.handleError);
} }
deleteNodeByPath(path: string, permanent: boolean = true): Promise<any> { async deleteNodeByPath(path: string, permanent: boolean = true) {
return this const id = (await this.getNodeByPath(path)).entry.id;
.getNodeByPath(path) return await this.deleteNodeById(id, permanent);
.then((response: any): string => response.data.entry.id)
.then((id: string): any => this.deleteNodeById(id, permanent))
.catch(this.handleError);
} }
deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true): Promise<any[]> { async deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true) {
return names.reduce((previous, current) => ( return await names.reduce(async (previous, current) => {
previous.then(() => this.deleteNodeByPath(`${relativePath}/${current}`, permanent)) await previous;
), Promise.resolve()); return await this.deleteNodeByPath(`${relativePath}/${current}`, permanent);
}, Promise.resolve());
} }
deleteNodesById(ids: string[], permanent: boolean = true): Promise<any[]> { async deleteNodesById(ids: string[], permanent: boolean = true) {
return ids.reduce((previous, current) => ( return await ids.reduce(async (previous, current) => {
previous.then(() => this.deleteNodeById(current, permanent)) await previous;
), Promise.resolve()); return await this.deleteNodeById(current, permanent);
}, Promise.resolve());
} }
// children // children
getNodeChildren(nodeId: string): Promise<any> {
return this async getNodeChildren(nodeId: string) {
.get(`/nodes/${nodeId}/children`) await this.apiAuth();
.catch(this.handleError); return await this.alfrescoJsApi.core.nodesApi.getNodeChildren(nodeId);
} }
createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise<any> { async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '') {
const data = { const nodeBody = {
name: name, name,
nodeType: nodeType, nodeType,
properties: { properties: {
'cm:title': title, 'cm:description': description 'cm:title': title,
'cm:description': description
} }
}; };
return this await this.apiAuth();
.post(`/nodes/${parentId}/children`, { data }) return await this.alfrescoJsApi.core.nodesApi.addNode(parentId, nodeBody);
.catch(this.handleError);
} }
createFile(name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise<any> { async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
return this.createNode('cm:content', name, parentId, title, description); return await this.createNode('cm:content', name, parentId, title, description);
} }
createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = ''): Promise<any> { async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
return this.createNode('cm:folder', name, parentId, title, description); return await this.createNode('cm:folder', name, parentId, title, description);
} }
createChildren(data: NodeBodyCreate[]): Promise<any> { async createChildren(data: NodeBodyCreate[]): Promise<any> {
return this await this.apiAuth();
.post(`/nodes/-my-/children`, { data }) return await this.alfrescoJsApi.core.nodesApi.addNode('-my-', data);
.catch(this.handleError);
} }
createContent(content: NodeContentTree, relativePath: string = '/'): Promise<any> { async createContent(content: NodeContentTree, relativePath: string = '/') {
return this.createChildren(flattenNodeContentTree(content, relativePath)); return await this.createChildren(flattenNodeContentTree(content, relativePath));
} }
createFolders(names: string[], relativePath: string = '/'): Promise<any> { async createFolders(names: string[], relativePath: string = '/') {
return this.createContent({ folders: names }, relativePath); return await this.createContent({ folders: names }, relativePath);
} }
createFiles(names: string[], relativePath: string = '/'): Promise<any> { async createFiles(names: string[], relativePath: string = '/') {
return this.createContent({ files: names }, relativePath); return await this.createContent({ files: names }, relativePath);
} }
// node content // node content
getNodeContent(nodeId: string): Promise<any> { async getNodeContent(nodeId: string) {
return this await this.apiAuth();
.get(`/nodes/${nodeId}/content`) return await this.alfrescoJsApi.core.nodesApi.getNodeContent(nodeId);
.catch(this.handleError);
} }
editNodeContent(nodeId: string, content: string): Promise<any> { async editNodeContent(nodeId: string, content: string) {
return this await this.apiAuth();
.put(`/nodes/${nodeId}/content`, { data: content }) return await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, content);
.catch(this.handleError);
} }
renameNode(nodeId: string, newName: string): Promise<any> { async renameNode(nodeId: string, newName: string) {
return this await this.apiAuth();
.put(`/nodes/${nodeId}`, { data: { name: newName } }) return this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: newName });
.catch(this.handleError);
} }
// node permissions // node permissions
setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string): Promise<any> { async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string) {
const data = { const data = {
permissions: { permissions: {
isInheritanceEnabled: inheritPermissions, isInheritanceEnabled: inheritPermissions,
@@ -156,27 +154,26 @@ export class NodesApi extends RepoApi {
} }
}; };
return this await this.apiAuth();
.put(`/nodes/${nodeId}`, { data }) return await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, data);
.catch(this.handleError);
} }
getNodePermissions(nodeId: string): Promise<any> { async getNodePermissions(nodeId: string) {
return this await this.apiAuth();
.get(`/nodes/${nodeId}?include=permissions`) return await this.alfrescoJsApi.core.nodesApi.getNode(nodeId, { include: ['permissions'] });
.catch(this.handleError);
} }
// lock node // lock node
lockFile(nodeId: string, lockType: string = 'FULL') { async lockFile(nodeId: string, lockType: string = 'FULL') {
return this const data = <NodeBodyLock>{
.post(`/nodes/${nodeId}/lock?include=isLocked`, { data: { 'type': lockType } }) type: lockType
.catch(this.handleError); };
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.lockNode(nodeId, data );
} }
unlockFile(nodeId: string) { async unlockFile(nodeId: string) {
return this await this.apiAuth();
.post(`/nodes/${nodeId}/unlock`) return await this.alfrescoJsApi.core.nodesApi.unlockNode(nodeId);
.catch(this.handleError);
} }
} }
@@ -23,21 +23,31 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
export class Person { export interface PersonModel {
id?: string; username?: string;
password?: string; password?: string;
firstName?: string; firstName?: string;
lastName?: string; lastName?: string;
email?: string; email?: string;
enabled?: boolean;
properties?: any; properties?: any;
}
constructor(username: string, password: string, details: Person) { export class Person {
this.id = username; id: string;
this.password = password || username; password: string;
this.firstName = username; firstName: string;
this.lastName = username; lastName: string;
this.email = `${username}@alfresco.com`; email: string;
enabled: boolean;
properties: any;
Object.assign(this, details); constructor(user: PersonModel) {
this.id = user.username;
this.password = user.password || user.username;
this.firstName = user.firstName || user.username;
this.lastName = user.lastName || user.username;
this.email = user.email || `${user.username}@alfresco.com`;
this.enabled = user.enabled || true;
} }
} }
@@ -23,48 +23,36 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { PersonModel, Person } from './people-api-models';
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { Person } from './people-api-models';
export class PeopleApi extends RepoApi { export class PeopleApi extends RepoApi {
getUser(username: string) {
return this constructor(username?, password?) {
.get(`/people/${username}`) super(username, password);
.catch(this.handleError);
} }
updateUser(username: string, details?: Person): Promise<any> { async createUser(user: PersonModel) {
if (details.id) { const person = new Person(user);
delete details.id; await this.apiAuth();
return await this.alfrescoJsApi.core.peopleApi.addPerson(person);
} }
return this async getUser(username: string) {
.put(`/people/${username}`, { data: details }) await this.apiAuth();
.catch(this.handleError); return await this.alfrescoJsApi.core.peopleApi.getPerson(username);
} }
createUser(username: string, password?: string, details?: Person): Promise<any> { async updateUser(username: string, userDetails?: PersonModel) {
const person: Person = new Person(username, password, details); await this.apiAuth();
const onSuccess = (response) => response; return this.alfrescoJsApi.core.peopleApi.updatePerson(username, userDetails);
const onError = (response) => {
return (response.statusCode === 409)
? Promise.resolve(this.updateUser(username, person))
: Promise.reject(response);
};
return this
.post(`/people`, { data: person })
.then(onSuccess, onError)
.catch(this.handleError);
} }
disableUser(username: string): Promise<any> { async disableUser(username: string) {
return this.put(`/people/${username}`, { data: { enabled: false } }) return await this.updateUser(username, { enabled: false });
.catch(this.handleError);
} }
changePassword(username: string, newPassword: string) { async changePassword(username: string, newPassword: string) {
return this.put(`/people/${username}`, { data: { password: newPassword } }) return await this.updateUser(username, { password: newPassword });
.catch(this.handleError);
} }
} }
+15 -36
View File
@@ -23,49 +23,28 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { RestClient, RestClientArgs, RestClientResponse } from '../../rest-client/rest-client'; import * as AlfrescoApi from 'alfresco-js-api-node';
import { RepoClientAuth, RepoClientConfig } from '../repo-client-models'; import { REPO_API_HOST } from '../../../configs';
import { RepoClientAuth } from '../repo-client-models';
export abstract class RepoApi { export abstract class RepoApi {
private client: RestClient;
private defaults: RepoClientConfig = new RepoClientConfig(); alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: REPO_API_HOST
});
constructor( constructor(
auth: RepoClientAuth = new RepoClientAuth(), private username: string = RepoClientAuth.DEFAULT_USERNAME,
private config?: RepoClientConfig private password: string = RepoClientAuth.DEFAULT_PASSWORD
) { ) {}
const { username, password } = auth;
this.client = new RestClient(username, password); apiAuth() {
return this.alfrescoJsApi.login(this.username, this.password);
} }
private createEndpointUri(endpoint: string, apiDefinition: string = 'alfresco'): string { getUsername() {
const { defaults, config } = this; return this.username;
const { host, tenant } = Object.assign(defaults, config);
return `${host}/alfresco/api/${tenant}/public/${apiDefinition}/versions/1${endpoint}`;
} }
protected handleError(response: RestClientResponse) {
const { request: { method, path, data }, data: error } = response;
console.log(`ERROR on ${method}\n${path}\n${data}`);
console.log(error);
}
protected get(endpoint: string, args: RestClientArgs = {}, apiDefinition: string = 'alfresco') {
return this.client.get(this.createEndpointUri(endpoint, apiDefinition), args);
}
protected post(endpoint: string, args: RestClientArgs = {}, apiDefinition: string = 'alfresco') {
return this.client.post(this.createEndpointUri(endpoint, apiDefinition), args);
}
protected put(endpoint: string, args: RestClientArgs = {}, apiDefinition: string = 'alfresco') {
return this.client.put(this.createEndpointUri(endpoint, apiDefinition), args);
}
protected delete(endpoint: string, args: RestClientArgs = {}, apiDefinition: string = 'alfresco') {
return this.client.delete(this.createEndpointUri(endpoint, apiDefinition), args);
}
} }
@@ -27,15 +27,12 @@ import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils'; import { Utils } from '../../../../utilities/utils';
export class SearchApi extends RepoApi { export class SearchApi extends RepoApi {
apiDefinition = 'search';
search(data: any[]): Promise<any> { constructor(username?, password?) {
return this super(username, password);
.post(`/search`, { data }, this.apiDefinition)
.catch(this.handleError);
} }
queryRecentFiles(username: string): Promise<any> { async queryRecentFiles(username: string) {
const data = { const data = {
query: { query: {
query: '*', query: '*',
@@ -48,24 +45,21 @@ export class SearchApi extends RepoApi {
] ]
}; };
return this await this.apiAuth();
.post(`/search`, { data }, this.apiDefinition) return this.alfrescoJsApi.search.searchApi.search(data);
.catch(this.handleError);
} }
waitForApi(username, data) { async waitForApi(username, data) {
const recentFiles = () => { const recentFiles = async () => {
return this.queryRecentFiles(username) const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
.then(response => response.data.list.pagination.totalItems)
.then(totalItems => {
if ( totalItems < data.expect) { if ( totalItems < data.expect) {
return Promise.reject(totalItems); return Promise.reject(totalItems);
} else { } else {
return Promise.resolve(totalItems); return Promise.resolve(totalItems);
} }
});
}; };
return Utils.retryCall(recentFiles); return await Utils.retryCall(recentFiles);
} }
} }
@@ -24,56 +24,53 @@
*/ */
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { NodesApi } from '../nodes/nodes-api';
import { RepoClient } from './../../repo-client';
import { Utils } from '../../../../utilities/utils'; import { Utils } from '../../../../utilities/utils';
export class SharedLinksApi extends RepoApi { export class SharedLinksApi extends RepoApi {
shareFileById(id: string): Promise<any> { constructor(username?, password?) {
const data = [{ nodeId: id }]; super(username, password);
return this.post(`/shared-links`, { data })
.catch(this.handleError);
} }
shareFilesByIds(ids: string[]): Promise<any[]> { async shareFileById(id: string) {
return ids.reduce((previous, current) => ( await this.apiAuth();
previous.then(() => this.shareFileById(current)) const data = { nodeId: id };
), Promise.resolve()); return await this.alfrescoJsApi.core.sharedlinksApi.addSharedLink(data);
} }
getSharedIdOfNode(name: string) { async shareFilesByIds(ids: string[]) {
return this.getSharedLinks() return await ids.reduce(async (previous: any, current: any) => {
.then(resp => resp.data.list.entries.find(entries => entries.entry.name === name)) await previous;
.then(resp => resp.entry.id) return await this.shareFileById(current);
.catch(this.handleError); }, Promise.resolve());
} }
unshareFile(name: string) { async getSharedIdOfNode(name: string) {
return this.getSharedIdOfNode(name) const sharedLinks = (await this.getSharedLinks()).list.entries;
.then(id => this.delete(`/shared-links/${id}`)) const found = sharedLinks.find(sharedLink => sharedLink.entry.name === name);
.catch(this.handleError); return (found || { entry: { id: null } }).entry.id;
} }
getSharedLinks(): Promise<any> { async unshareFile(name: string) {
return this.get(`/shared-links`) const id = await this.getSharedIdOfNode(name);
.catch(this.handleError); return await this.alfrescoJsApi.core.sharedlinksApi.deleteSharedLink(id);
} }
waitForApi(data) { async getSharedLinks() {
const sharedFiles = () => { await this.apiAuth();
return this.getSharedLinks() return await this.alfrescoJsApi.core.sharedlinksApi.findSharedLinks();
.then(response => response.data.list.pagination.totalItems) }
.then(totalItems => {
if ( totalItems < data.expect) { async waitForApi(data) {
const sharedFiles = async () => {
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
if ( totalItems < data.expect ) {
return Promise.reject(totalItems); return Promise.reject(totalItems);
} else { } else {
return Promise.resolve(totalItems); return Promise.resolve(totalItems);
} }
});
}; };
return Utils.retryCall(sharedFiles); return await Utils.retryCall(sharedFiles);
} }
} }
@@ -24,101 +24,96 @@
*/ */
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { Site } from './sites-api-models'; import { SiteBody, SiteMemberRoleBody, SiteMemberBody } from 'alfresco-js-api-node';
import { SITE_VISIBILITY } from '../../../../configs';
import { Utils } from '../../../../utilities/utils';
export class SitesApi extends RepoApi { export class SitesApi extends RepoApi {
getSite(id: string): Promise<any> {
return this constructor(username?, password?) {
.get(`/sites/${id}`) super(username, password);
.catch(this.handleError);
} }
getSiteContainers(siteId: string): Promise<any> { async getSite(siteId: string) {
return this await this.apiAuth();
.get(`/sites/${siteId}/containers`) return await this.alfrescoJsApi.core.sitesApi.getSite(siteId);
.then(resp => resp.data.list.entries)
.catch(this.handleError);
} }
getDocLibId(siteId: string) { async getSites() {
return this.getSiteContainers(siteId) await this.apiAuth();
.then(resp => resp[0].entry.id) return await this.alfrescoJsApi.core.peopleApi.getSiteMembership(this.getUsername());
.catch(this.handleError);
} }
updateSite(id: string, details?: Site): Promise<any> { async getDocLibId(siteId: string) {
if (details.id) { await this.apiAuth();
delete details.id; return (await this.alfrescoJsApi.core.sitesApi.getSiteContainers(siteId)).list.entries[0].entry.id;
} }
return this async createSite(title: string, visibility?: string, description?: string, siteId?: string) {
.put(`/sites/${id}`, { data: details }) const site = <SiteBody>{
.catch(this.handleError); title,
} visibility: visibility || SITE_VISIBILITY.PUBLIC,
description: description,
createOrUpdateSite(title: string, visibility: string, details?: Site): Promise<any> { id: siteId || title
const site: Site = new Site(title, visibility, details);
const onSuccess = (response) => response;
const onError = (response) => {
return (response.statusCode === 409)
? Promise.resolve(this.updateSite(site.id, site))
: Promise.reject(response);
}; };
return this await this.apiAuth();
.post(`/sites`, { data: site }) return await this.alfrescoJsApi.core.sitesApi.createSite(site);
.then(onSuccess, onError)
.catch(this.handleError);
} }
createSite(title: string, visibility: string, details?: Site): Promise<any> { async createSites(titles: string[], visibility?: string) {
const site: Site = new Site(title, visibility, details); return titles.reduce(async (previous: any, current: any) => {
return this await previous;
.post(`/sites`, { data: site }) return await this.createSite(current, visibility);
.catch(this.handleError); }, Promise.resolve());
} }
createSites(titles: string[], visibility: string): Promise<any[]> { async deleteSite(siteId: string, permanent: boolean = true) {
return titles.reduce((previous, current) => ( await this.apiAuth();
previous.then(() => this.createSite(current, visibility)) return await this.alfrescoJsApi.core.sitesApi.deleteSite(siteId, { permanent });
), Promise.resolve());
} }
deleteSite(id: string, permanent: boolean = true): Promise<any> { async deleteSites(siteIds: string[], permanent: boolean = true) {
return this return siteIds.reduce(async (previous, current) => {
.delete(`/sites/${id}?permanent=${permanent}`) await previous;
.catch(this.handleError); return await this.deleteSite(current, permanent);
}, Promise.resolve());
} }
deleteSites(ids: string[], permanent: boolean = true): Promise<any[]> { async updateSiteMember(siteId: string, userId: string, role: string) {
return ids.reduce((previous, current) => ( const siteRole = <SiteMemberRoleBody>{
previous.then(() => this.deleteSite(current)) role: role
), Promise.resolve());
}
updateSiteMember(siteId: string, userId: string, role: string): Promise<any> {
return this
.put(`/sites/${siteId}/members/${userId}`, { data: { role } })
.catch(this.handleError);
}
addSiteMember(siteId: string, userId: string, role: string): Promise<any> {
const onSuccess = (response) => response;
const onError = (response) => {
return (response.statusCode === 409)
? Promise.resolve(this.updateSiteMember(siteId, userId, role))
: Promise.reject(response);
}; };
return this await this.apiAuth();
.post(`/sites/${siteId}/members`, { data: { role, id: userId } }) return await this.alfrescoJsApi.core.sitesApi.updateSiteMember(siteId, userId, siteRole);
.then(onSuccess, onError)
.catch(this.handleError);
} }
deleteSiteMember(siteId: string, userId: string): Promise<any> { async addSiteMember(siteId: string, userId: string, role: string) {
return this const memberBody = <SiteMemberBody>{
.delete(`/sites/${siteId}/members/${userId}`) id: userId,
.catch(this.handleError); role: role
};
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.addSiteMember(siteId, memberBody);
}
async deleteSiteMember(siteId: string, userId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.removeSiteMember(siteId, userId);
}
async waitForApi(data) {
const sites = async () => {
const totalItems = (await this.getSites()).list.pagination.totalItems;
if ( totalItems < data.expect ) {
return Promise.reject(totalItems);
} else {
return Promise.resolve(totalItems);
}
};
return await Utils.retryCall(sites);
} }
} }
+28 -30
View File
@@ -27,50 +27,48 @@ import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils'; import { Utils } from '../../../../utilities/utils';
export class TrashcanApi extends RepoApi { export class TrashcanApi extends RepoApi {
permanentlyDelete(id: string): Promise<any> {
return this constructor(username?, password?) {
.delete(`/deleted-nodes/${id}`) super(username, password);
.catch(this.handleError);
} }
restore(id: string) { async permanentlyDelete(id: string) {
return this await this.apiAuth();
.post(`/deleted-nodes/${id}/restore`) return await this.alfrescoJsApi.core.nodesApi.purgeDeletedNode(id);
.catch(this.handleError);
} }
getDeletedNodes(): Promise<any> { async restore(id: string) {
return this await this.apiAuth();
.get(`/deleted-nodes?maxItems=1000`) return await this.alfrescoJsApi.core.nodesApi.restoreNode(id);
.catch(this.handleError);
} }
emptyTrash(): Promise<any> { async getDeletedNodes() {
return this.getDeletedNodes() const opts = {
.then(resp => { maxItems: 1000
return resp.data.list.entries.map(entries => entries.entry.id); };
}) await this.apiAuth();
.then(ids => { return await this.alfrescoJsApi.core.nodesApi.getDeletedNodes(opts);
return ids.reduce((previous, current) => (
previous.then(() => this.permanentlyDelete(current))
), Promise.resolve());
})
.catch(this.handleError);
} }
waitForApi(data) { async emptyTrash() {
const deletedFiles = () => { const ids = (await this.getDeletedNodes()).list.entries.map(entries => entries.entry.id);
return this.getDeletedNodes()
.then(response => response.data.list.pagination.totalItems) return await ids.reduce(async (previous, current) => {
.then(totalItems => { await previous;
return await this.permanentlyDelete(current);
}, Promise.resolve());
}
async waitForApi(data) {
const deletedFiles = async () => {
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
if ( totalItems < data.expect) { if ( totalItems < data.expect) {
return Promise.reject(totalItems); return Promise.reject(totalItems);
} else { } else {
return Promise.resolve(totalItems); return Promise.resolve(totalItems);
} }
});
}; };
return Utils.retryCall(deletedFiles); return await Utils.retryCall(deletedFiles);
} }
} }
@@ -0,0 +1,48 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoApi } from '../repo-api';
import { E2E_ROOT_PATH } from '../../../../configs';
const fs = require('fs');
export class UploadApi extends RepoApi {
constructor(username?, password?) {
super(username, password);
}
async uploadFile(fileName: string, parentFolderId: string = '-my-') {
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
const opts = {
mane: file.name,
nodeType: 'cm:content'
};
await this.apiAuth();
return await this.alfrescoJsApi.upload.uploadFile(file, '', parentFolderId, null, opts);
}
}
@@ -25,9 +25,7 @@
import { import {
ADMIN_USERNAME, ADMIN_USERNAME,
ADMIN_PASSWORD, ADMIN_PASSWORD
REPO_API_HOST,
REPO_API_TENANT
} from '../../configs'; } from '../../configs';
export class RepoClientAuth { export class RepoClientAuth {
@@ -39,8 +37,3 @@ export class RepoClientAuth {
public password: string = RepoClientAuth.DEFAULT_PASSWORD public password: string = RepoClientAuth.DEFAULT_PASSWORD
) {} ) {}
} }
export class RepoClientConfig {
host?: string = REPO_API_HOST;
tenant?: string = REPO_API_TENANT;
}
+35 -11
View File
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { RepoClientAuth, RepoClientConfig } from './repo-client-models'; import { RepoClientAuth } from './repo-client-models';
import { PeopleApi } from './apis/people/people-api'; import { PeopleApi } from './apis/people/people-api';
import { NodesApi } from './apis/nodes/nodes-api'; import { NodesApi } from './apis/nodes/nodes-api';
@@ -32,26 +32,50 @@ import { FavoritesApi } from './apis/favorites/favorites-api';
import { SharedLinksApi } from './apis/shared-links/shared-links-api'; import { SharedLinksApi } from './apis/shared-links/shared-links-api';
import { TrashcanApi } from './apis/trashcan/trashcan-api'; import { TrashcanApi } from './apis/trashcan/trashcan-api';
import { SearchApi } from './apis/search/search-api'; import { SearchApi } from './apis/search/search-api';
import { UploadApi } from './apis/upload/upload-api';
export class RepoClient { export class RepoClient {
public people: PeopleApi = new PeopleApi(this.auth, this.config);
public nodes: NodesApi = new NodesApi(this.auth, this.config);
public sites: SitesApi = new SitesApi(this.auth, this.config);
public favorites: FavoritesApi = new FavoritesApi(this.auth, this.config);
public shared: SharedLinksApi = new SharedLinksApi(this.auth, this.config);
public trashcan: TrashcanApi = new TrashcanApi(this.auth, this.config);
public search: SearchApi = new SearchApi(this.auth, this.config);
constructor( constructor(
private username: string = RepoClientAuth.DEFAULT_USERNAME, private username: string = RepoClientAuth.DEFAULT_USERNAME,
private password: string = RepoClientAuth.DEFAULT_PASSWORD, private password: string = RepoClientAuth.DEFAULT_PASSWORD
private config?: RepoClientConfig
) {} ) {}
private get auth(): RepoClientAuth { private get auth(): RepoClientAuth {
const { username, password } = this; const { username, password } = this;
return { username, password }; return { username, password };
} }
get people () {
return new PeopleApi(this.auth.username, this.auth.password);
}
get nodes() {
return new NodesApi(this.auth.username, this.auth.password);
}
get sites() {
return new SitesApi(this.auth.username, this.auth.password);
}
get favorites() {
return new FavoritesApi(this.auth.username, this.auth.password);
}
get shared() {
return new SharedLinksApi(this.auth.username, this.auth.password);
}
get trashcan() {
return new TrashcanApi(this.auth.username, this.auth.password);
}
get search() {
return new SearchApi(this.auth.username, this.auth.password);
}
get upload() {
return new UploadApi(this.auth.username, this.auth.password);
}
} }
export * from './apis/nodes/node-body-create'; export * from './apis/nodes/node-body-create';
-89
View File
@@ -1,89 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Client } from 'node-rest-client';
import { NodeRestClient, RestClientArgs, RestClientResponse } from './rest-client-models';
export * from './rest-client-models';
export class RestClient {
private static DEFAULT_HEADERS = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
private client: NodeRestClient;
constructor(user: string, password: string) {
this.client = <NodeRestClient>(new Client({ user, password }));
}
get(uri: string, args: RestClientArgs = {}): Promise<RestClientResponse> {
return this.promisify('get', uri, args);
}
post(uri: string, args: RestClientArgs = {}): Promise<RestClientResponse> {
return this.promisify('post', uri, args);
}
put(uri: string, args: RestClientArgs = {}): Promise<RestClientResponse> {
return this.promisify('put', uri, args);
}
delete(uri: string, args: RestClientArgs = {}): Promise<RestClientResponse> {
return this.promisify('delete', uri, args);
}
private createArgs(args: RestClientArgs = {}): RestClientArgs {
const data = JSON.stringify(args.data);
return Object.assign({}, RestClient.DEFAULT_HEADERS, args, { data });
}
private promisify(fnName: string, uri: string, args: RestClientArgs): Promise<RestClientResponse> {
const fn: Function = this.client[fnName];
const fnArgs = [ encodeURI(uri), this.createArgs(args) ];
return new Promise((resolve, reject) => {
const fnCallback = (data, rawResponse) => {
const {
statusCode, statusMessage,
req: { method, path }
} = rawResponse;
const response: RestClientResponse = {
data, statusCode, statusMessage,
request: { method, path, data: args.data }
};
(response.statusCode >= 400)
? reject(response)
: resolve(response);
};
fn(...fnArgs, fnCallback);
});
}
}
+20 -1
View File
@@ -24,7 +24,9 @@
*/ */
import { browser, promise, ElementFinder, ExpectedConditions as EC } from 'protractor'; import { browser, promise, ElementFinder, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../configs'; import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH, EXTENSIBILITY_CONFIGS } from '../configs';
const fs = require('fs');
export class Utils { export class Utils {
// generate a random value // generate a random value
@@ -42,6 +44,23 @@ export class Utils {
return browser.executeScript('window.sessionStorage.clear();'); return browser.executeScript('window.sessionStorage.clear();');
} }
static getSessionStorage() {
return browser.executeScript('return window.sessionStorage.getItem("aca.extension.config");');
}
static async setSessionStorageFromConfig(key: string, configFileName: string) {
const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`;
const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' }));
return await browser.executeScript(`window.sessionStorage.setItem(${key}, ${fileContent});`);
}
static async resetExtensionConfig() {
const defConfig = `${E2E_ROOT_PATH}/resources/extensibility-configs/${EXTENSIBILITY_CONFIGS.DEFAULT_EXTENSIONS_CONFIG}`;
return await this.setSessionStorageFromConfig('"aca.extension.config"', defConfig);
}
static retryCall(fn: () => Promise <any>, retry: number = 30, delay: number = 1000): Promise<any> { static retryCall(fn: () => Promise <any>, retry: number = 30, delay: number = 1000): Promise<any> {
const pause = (duration) => new Promise(res => setTimeout(res, duration)); const pause = (duration) => new Promise(res => setTimeout(res, duration));
+402
View File
@@ -0,0 +1,402 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/Alfresco/alfresco-content-app/blob/development/extension.schema.json",
"title": "ACA Extension Schema",
"description": "Provides a validation schema for ACA extensions",
"definitions": {
"ruleRef": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"description": "Unique rule definition id",
"type": "string"
},
"type": {
"description": "Rule evaluator type",
"type": "string"
},
"parameters": {
"description": "Rule evaluator parameters",
"type": "array",
"items": { "$ref": "#/definitions/ruleParameter" },
"minItems": 1
}
}
},
"ruleParameter": {
"type": "object",
"required": ["type", "value"],
"properties": {
"type": {
"description": "Rule parameter type",
"type": "string"
},
"value": {
"description": "Rule parameter value",
"type": "string"
},
"parameters": {
"description": "Parameters",
"type": "array",
"items": { "$ref": "#/definitions/ruleParameter" },
"minItems": 1
}
}
},
"routeRef": {
"type": "object",
"required": ["id", "path", "component"],
"properties": {
"id": {
"description": "Unique route reference identifier.",
"type": "string"
},
"path": {
"description": "Route path to register.",
"type": "string"
},
"component": {
"description": "Unique identifier for the Component to use with the route.",
"type": "string"
},
"layout": {
"description": "Unique identifier for the custom layout component to use.",
"type": "string"
},
"auth": {
"description": "List of the authentication guards to use with the route.",
"type": "array",
"items": {
"type": "string"
},
"minLength": 1,
"uniqueItems": true
},
"data": {
"description": "Custom data to pass to the activated route so that your components can access it",
"type": "object"
}
}
},
"actionRef": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"description": "Unique action identifier",
"type": "string"
},
"type": {
"description": "Action type",
"type": "string"
},
"payload": {
"description": "Action payload value (string or expression)",
"type": "string"
}
}
},
"contentActionRef": {
"type": "object",
"required": ["id"],
"properties": {
"id": {
"description": "Unique action identifier.",
"type": "string"
},
"type": {
"description": "Element type",
"type": "string",
"enum": ["default", "button", "separator", "menu", "custom"]
},
"title": {
"description": "Element title",
"type": "string"
},
"description": {
"description": "Element description, used for the tooltips.",
"type": "string"
},
"description-disabled": {
"description": "Description to use when element is in the disabled state.",
"type": "string"
},
"order": {
"description": "Element order",
"type": "number"
},
"icon": {
"description": "Element icon",
"type": "string"
},
"disabled": {
"description": "Toggles disabled state",
"type": "boolean"
},
"component": {
"description": "Custom component id (requires type to be 'custom')",
"type": "string"
},
"children": {
"description": "Child entries for the container types.",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"actions": {
"description": "Element actions",
"type": "object",
"properties": {
"click": {
"description": "Action reference for the click handler",
"type": "string"
}
}
},
"rules": {
"description": "Element rules",
"type": "object",
"properties": {
"enabled": {
"description": "Rule to evaluate the enabled state",
"type": "string"
},
"visible": {
"description": "Rule to evaluate the visibility state",
"type": "string"
}
}
}
}
},
"navBarLinkRef": {
"type": "object",
"required": ["id", "icon", "title", "route"],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"icon": {
"description": "Element icon",
"type": "string"
},
"title": {
"description": "Element title",
"type": "string"
},
"route": {
"description": "Route reference identifier",
"type": "string"
},
"description": {
"description": "Element description or tooltip",
"type": "string"
},
"order": {
"description": "Element order",
"type": "number"
},
"disabled": {
"description": "Toggles the disabled state",
"type": "boolean"
}
}
},
"navBarGroupRef": {
"type": "object",
"required": ["id", "items"],
"properties": {
"id": {
"description": "Unique identifier for the navigation group",
"type": "string"
},
"items": {
"description": "Navigation group items",
"type": "array",
"items": { "$ref": "#/definitions/navBarLinkRef" },
"minItems": 1
},
"order": {
"description": "Group order",
"type": "number"
},
"disabled": {
"description": "Toggles the disabled state",
"type": "boolean"
}
}
},
"sidebarTabRef": {
"type": "object",
"required": ["id", "component"],
"properties": {
"id": {
"description": "Unique identifier for the navigation group",
"type": "string"
},
"title": {
"description": "Element title",
"type": "string"
},
"component": {
"description": "Component id",
"type": "string"
},
"icon": {
"description": "Material icon name",
"type": "string"
},
"disabled": {
"description": "Toggles disabled state",
"type": "boolean"
},
"order": {
"description": "Element order",
"type": "number"
},
"rules": {
"description": "Element rules",
"type": "object",
"properties": {
"visible": {
"description": "Rule to evaluate the visibility state",
"type": "string"
}
}
}
}
},
"viewerExtensionRef": {
"type": "object",
"required": ["id", "component", "fileExtension"],
"properties": {
"id": {
"description": "Unique identifier for the navigation group",
"type": "string"
},
"component": {
"description": "Component id",
"type": "string"
},
"fileExtension": {
"description": "Target file extension",
"type": "string"
},
"order": {
"description": "Group order",
"type": "number"
},
"disabled": {
"description": "Toggles the disabled state",
"type": "boolean"
}
}
}
},
"type": "object",
"required": ["$name", "$version"],
"properties": {
"$name": {
"description": "Extension name",
"type": "string"
},
"$version": {
"description": "Extension version",
"type": "string"
},
"$description": {
"description": "Brief description on what the extension does"
},
"$references": {
"description": "References to external files",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"rules": {
"description": "List of rule definitions",
"type": "array",
"items": { "$ref": "#/definitions/ruleRef" },
"minItems": 1
},
"routes": {
"description": "List of custom application routes",
"type": "array",
"items": { "$ref": "#/definitions/routeRef" },
"minItems": 1
},
"actions": {
"description": "List of action definitions",
"type": "array",
"items": { "$ref": "#/definitions/actionRef" },
"minItems": 1
},
"features": {
"description": "Application-specific features and extensions",
"type": "object",
"properties": {
"create": {
"description": "The [New] menu component extensions",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"viewer": {
"description": "Viewer component extensions",
"type": "object",
"properties": {
"openWith": {
"description": "The [Open With] menu extensions",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"toolbar": {
"description": "Toolbar entries",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"content": {
"description": "Viewer content extensions",
"type": "array",
"items": { "$ref": "#/definitions/viewerExtensionRef" },
"minItems": 1
}
}
},
"navbar": {
"description": "Navigation bar extensions",
"type": "array",
"items": { "$ref": "#/definitions/navBarGroupRef" },
"minItems": 1
},
"sidebar": {
"description": "Sidebar extensions",
"type": "array",
"items": { "$ref": "#/definitions/sidebarTabRef" },
"minItems": 1
},
"toolbar": {
"description": "Toolbar entries",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"contextMenu": {
"description": "Context menu entries",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
}
}
}
}
}
+4 -6
View File
@@ -4,13 +4,13 @@
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: '', basePath: '',
frameworks: ['jasmine', '@angular/cli'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [ plugins: [
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'), require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma') require('@angular-devkit/build-angular/plugins/karma')
], ],
files: [ files: [
{ pattern: './node_modules/hammerjs/hammer.js', watched: false }, { pattern: './node_modules/hammerjs/hammer.js', watched: false },
@@ -27,12 +27,10 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser clearContext: false // leave Jasmine Spec Runner output visible in browser
}, },
coverageIstanbulReporter: { coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ], dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true fixWebpackSourcePaths: true
}, },
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
+7008 -3428
View File
File diff suppressed because it is too large Load Diff
+60 -50
View File
@@ -1,90 +1,100 @@
{ {
"name": "alfresco-content-app", "name": "alfresco-content-app",
"version": "1.3.0", "version": "1.4.0",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "npm run server-versions && ng serve --open", "start": "npm run server-versions && npm run build.libs.dev && ng serve --open",
"start:prod": "npm run server-versions && ng serve --prod --open", "start:prod": "npm run server-versions && npm run build.libs.prod && ng serve --prod --open",
"build": "npm run server-versions && ng build --prod", "build.libs.dev": "ng build adf-extensions && ng build aca-dev-tools",
"build:prod": "npm run server-versions && ng build --prod", "build.libs.prod": "ng build adf-extensions --prod && ng build aca-dev-tools --prod",
"build:dev": "npm run server-versions && ng build", "build": "npm run server-versions && npm run build.libs.prod && node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app --prod",
"build:tomcat": "npm run server-versions && ng build --base-href ./", "build:dev": "npm run server-versions && npm run build.libs.dev && ng build",
"build:electron": "npm run server-versions && ng build --output-path www --base-href ./", "test": "npm run build.libs.dev && ng test app --code-coverage",
"test": "ng test --code-coverage", "test:ci": "npm run build.libs.dev && ng test app --code-coverage --watch=false",
"test:ci": "ng test --code-coverage --single-run --no-progress && cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage && rm -rf ./coverage",
"lint": "ng lint", "lint": "ng lint",
"server-versions": "rimraf ./src/versions.json && npm list --depth=0 --json=true --prod=true > ./src/versions.json || exit 0", "server-versions": "rimraf ./src/versions.json && npm list --depth=0 --json=true --prod=true > ./src/versions.json || exit 0",
"_e2e": "ng e2e", "e2e": "ng e2e",
"wd:update": "webdriver-manager update --gecko=false --versions.chrome=2.38", "wd:update": "webdriver-manager update --gecko=false --versions.chrome=2.38",
"e2e": "npm run wd:update && protractor protractor.conf.js", "_e2e": "npm run wd:update && protractor protractor.conf.js",
"start:docker": "docker-compose up -d --build && wait-on http://localhost:8080 && wait-on http://localhost:4000", "start:docker": "docker-compose up -d --build && wait-on http://localhost:8080 && wait-on http://localhost:4000",
"stop:docker": "docker-compose stop", "stop:docker": "docker-compose stop",
"e2e:docker": "npm run start:docker && npm run e2e && npm run stop:docker", "e2e:docker": "npm run start:docker && npm run e2e && npm run stop:docker",
"spellcheck": "cspell 'src/**/*.ts' 'e2e/**/*.ts'" "spellcheck": "cspell 'src/**/*.ts' 'e2e/**/*.ts' 'projects/**/*.ts'",
"inspect.bundle": "ng build app --prod --stats-json && npx webpack-bundle-analyzer dist/app/stats.json"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "2.4.0", "@alfresco/adf-content-services": "2.5.0",
"@alfresco/adf-core": "2.4.0", "@alfresco/adf-core": "2.5.0",
"@angular/animations": "5.1.1", "@angular/animations": "6.1.4",
"@angular/cdk": "5.0.1", "@angular/cdk": "^6.4.6",
"@angular/common": "5.1.1", "@angular/common": "6.1.4",
"@angular/compiler": "5.1.1", "@angular/compiler": "6.1.4",
"@angular/core": "5.1.1", "@angular/core": "6.1.4",
"@angular/flex-layout": "2.0.0-beta.12", "@angular/flex-layout": "^6.0.0-beta.17",
"@angular/forms": "5.1.1", "@angular/forms": "6.1.4",
"@angular/http": "5.1.1", "@angular/http": "6.1.4",
"@angular/material": "5.0.1", "@angular/material": "^6.4.6",
"@angular/material-moment-adapter": "5.0.1", "@angular/material-moment-adapter": "^6.4.6",
"@angular/platform-browser": "5.1.1", "@angular/platform-browser": "6.1.4",
"@angular/platform-browser-dynamic": "5.1.1", "@angular/platform-browser-dynamic": "6.1.4",
"@angular/router": "5.1.1", "@angular/router": "6.1.4",
"@mat-datetimepicker/core": "1.0.1", "@mat-datetimepicker/core": "^2.0.1",
"@mat-datetimepicker/moment": "1.0.1", "@mat-datetimepicker/moment": "^2.0.1",
"@ngrx/effects": "^5.2.0", "@ngrx/effects": "^6.1.0",
"@ngrx/router-store": "^5.2.0", "@ngrx/router-store": "^6.1.0",
"@ngrx/store": "^5.2.0", "@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^5.2.0", "@ngrx/store-devtools": "^6.1.0",
"@ngx-translate/core": "9.1.1", "@ngstack/code-editor": "^0.4.3",
"alfresco-js-api": "2.4.0", "@ngx-translate/core": "^10.0.2",
"core-js": "2.5.3", "@types/showdown": "^1.7.5",
"cspell": "^2.1.12", "alfresco-js-api": "2.5.0",
"core-js": "^2.5.7",
"hammerjs": "2.0.8", "hammerjs": "2.0.8",
"minimatch-browser": "^1.0.0",
"moment": "^2.22.2",
"moment-es6": "1.0.0", "moment-es6": "1.0.0",
"monaco-editor": "^0.14.2",
"pdfjs-dist": "2.0.303", "pdfjs-dist": "2.0.303",
"rxjs": "5.5.2", "rxjs": "^6.2.2",
"showdown": "^1.8.6",
"web-animations-js": "2.3.1", "web-animations-js": "2.3.1",
"zone.js": "0.8.20" "zone.js": "0.8.26"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "1.7.3", "@angular-devkit/build-angular": "~0.7.4",
"@angular/compiler-cli": "5.1.1", "@angular-devkit/build-ng-packagr": "~0.7.4",
"@angular/language-service": "5.1.1", "@angular/cli": "^6.1.5",
"@angular/compiler-cli": "6.1.4",
"@angular/language-service": "6.1.4",
"@types/jasmine": "^2.5.53", "@types/jasmine": "^2.5.53",
"@types/jasminewd2": "^2.0.2", "@types/jasminewd2": "^2.0.2",
"@types/node": "9.3.0", "@types/node": "9.3.0",
"@types/selenium-webdriver": "^3.0.8", "@types/selenium-webdriver": "^3.0.8",
"codacy-coverage": "^2.0.3", "alfresco-js-api-node": "2.5.0-b048ff2aad00611aac1c02af531549b60acc0e66",
"codelyzer": "^4.0.1", "codelyzer": "^4.4.3",
"cspell": "^3.1.3",
"jasmine-core": "~2.8.0", "jasmine-core": "~2.8.0",
"jasmine-reporters": "^2.2.1", "jasmine-reporters": "^2.2.1",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
"jasmine2-protractor-utils": "^1.3.0", "jasmine2-protractor-utils": "^1.3.0",
"jasminewd2": "^2.2.0", "jasminewd2": "^2.2.0",
"karma": "2.0.2", "karma": "^3.0.0",
"karma-chrome-launcher": "~2.2.0", "karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1", "karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1", "karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0", "karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2", "karma-jasmine-html-reporter": "^0.2.2",
"node-rest-client": "^3.1.0", "ng-packagr": "^4.1.0",
"protractor": "5.3.2", "protractor": "^5.4.0",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"selenium-webdriver": "4.0.0-alpha.1", "selenium-webdriver": "4.0.0-alpha.1",
"ts-node": "~4.1.0", "ts-node": "~4.1.0",
"tslint": "~5.9.1", "tsickle": ">=0.29.0",
"typescript": "~2.7.2", "tslib": "^1.9.0",
"tslint": "~5.11.0",
"typescript": "^2.9.2",
"wait-on": "2.1.0" "wait-on": "2.1.0"
} }
} }
+31
View File
@@ -0,0 +1,31 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
+16
View File
@@ -0,0 +1,16 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/aca-dev-tools",
"deleteDestPath": false,
"lib": {
"entryFile": "src/public_api.ts",
"flatModuleFile": "aca-dev-tools",
"umdModuleIds": {
"showdown": "showdown",
"@alfresco/adf-core": "@alfresco/adf-core",
"@ngstack/code-editor": "@ngstack/code-editor",
"@alfresco/adf-content-services": "@alfresco/adf-content-services",
"@alfresco/adf-extensions": "@alfresco/adf-extensions"
}
}
}
@@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/aca-dev-tools",
"lib": {
"entryFile": "src/public_api.ts"
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"name": "aca-dev-tools",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^6.0.0",
"@angular/core": "^6.0.0",
"@ngstack/code-editor": "^0.4.1"
}
}
@@ -0,0 +1,46 @@
<div class="inner-layout">
<div class="inner-layout__header">
<adf-breadcrumb root="app.extensions.json"></adf-breadcrumb>
<adf-toolbar class="inline">
<button
mat-icon-button
color="primary"
title="Save changes"
(click)="saveChanges()">
<mat-icon>save_alt</mat-icon>
</button>
<button
mat-icon-button
color="primary"
title="Download"
(click)="download()">
<mat-icon>cloud_download</mat-icon>
</button>
<button
mat-icon-button
color="primary"
title="Revert changes"
(click)="revertChanges()">
<mat-icon>history</mat-icon>
</button>
</adf-toolbar>
</div>
<div class="inner-layout__content">
<div class="inner-layout__panel">
<div fxLayout="column" fxFill>
<div fxLayout fxFlex>
<div fxFlex="100">
<ng-container *ngIf="model">
<ngs-code-editor
[codeModel]="model"
(valueChanged)="onCodeChanged($event)">
</ngs-code-editor>
</ng-container>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,23 @@
.lib-aca-dev-tools {
display: flex;
flex-direction: column;
flex: 1;
height: 100%;
overflow: hidden;
min-height: 0;
}
.ngs-code-editor {
display: flex;
flex-direction: column;
flex: 1;
height: 100%;
max-height: 100%;
overflow: hidden;
min-height: 0;
.editor {
// border: 1px solid grey;
// min-height: 400px;
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AcaDevToolsComponent } from './aca-dev-tools.component';
describe('AcaDevToolsComponent', () => {
let component: AcaDevToolsComponent;
let fixture: ComponentFixture<AcaDevToolsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AcaDevToolsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AcaDevToolsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,89 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { CodeModel } from '@ngstack/code-editor';
import { ActivatedRoute } from '@angular/router';
import { HttpClient } from '@angular/common/http';
import { forkJoin } from 'rxjs';
@Component({
selector: 'aca-dev-tools-main',
encapsulation: ViewEncapsulation.None,
host: { class: 'lib-aca-dev-tools' },
templateUrl: './aca-dev-tools.component.html',
styleUrls: ['./aca-dev-tools.component.scss']
})
export class AcaDevToolsComponent implements OnInit {
model: CodeModel = null;
private code: string;
constructor(private route: ActivatedRoute, private http: HttpClient) {}
ngOnInit() {
const routeData = this.route.snapshot.data;
if (!routeData) {
return;
}
const schemaUri = routeData.schemaUri;
const getSchema = this.http.get(routeData.schemaPath);
const getConfig = this.http.get(routeData.configPath, {
responseType: 'text'
});
forkJoin([getSchema, getConfig]).subscribe(
([schema, config]) => {
let code = config;
const override = sessionStorage.getItem('aca.extension.config');
if (override) {
code = override;
}
this.model = {
language: 'json',
uri: 'app.extensions.json',
value: code,
schemas: [
{
uri: schemaUri,
schema
}
]
};
this.code = code;
},
err => {
console.log(err);
}
);
}
onCodeChanged(value: string) {
this.code = value;
}
saveChanges() {
sessionStorage.setItem('aca.extension.config', this.code);
// window.location.reload(true);
}
revertChanges() {
sessionStorage.removeItem('aca.extension.config');
window.location.reload(true);
}
download() {
const element = document.createElement('a');
element.setAttribute(
'href',
'data:text/plain;charset=utf-8,' + encodeURIComponent(this.code)
);
element.setAttribute('download', 'plugin.json');
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
}
@@ -0,0 +1,35 @@
import { NgModule } from '@angular/core';
import { CodeEditorModule } from '@ngstack/code-editor';
import { FlexLayoutModule } from '@angular/flex-layout';
import { AcaDevToolsComponent } from './aca-dev-tools.component';
import { CoreModule } from '@alfresco/adf-core';
import { ContentModule } from '@alfresco/adf-content-services';
import { ExtensionService } from '@alfresco/adf-extensions';
import { MarkdownViewComponent } from './viewer/markdown-view/markdown-view.component';
export function components() {
return [
AcaDevToolsComponent,
MarkdownViewComponent
];
}
@NgModule({
imports: [
FlexLayoutModule,
CodeEditorModule.forChild(),
CoreModule.forChild(),
ContentModule.forChild()
],
declarations: components(),
exports: components(),
entryComponents: components()
})
export class AcaDevToolsModule {
constructor(extensions: ExtensionService) {
extensions.setComponents({
'dev.tools.component': AcaDevToolsComponent,
'dev.tools.viewer.markdown': MarkdownViewComponent
});
}
}
@@ -0,0 +1,18 @@
.aca-markdown-view {
display: flex;
flex-direction: column;
.content {
display: flex;
flex-direction: column;
}
}
.adf-viewer-content-container {
height: 100%;
}
.adf-viewer-custom-content {
overflow: scroll;
height: 100%;
}
@@ -0,0 +1,78 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
Component,
Input,
OnInit,
ViewEncapsulation
} from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { AlfrescoApiService } from '@alfresco/adf-core';
// import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { Converter } from 'showdown';
@Component({
selector: 'aca-markdown-view',
template: `<div class="content" [innerHTML]="content"></div>`,
styleUrls: ['./markdown-view.component.scss'],
encapsulation: ViewEncapsulation.None,
host: { 'class': 'aca-markdown-view' }
})
export class MarkdownViewComponent implements OnInit {
@Input()
url: string;
@Input()
node: MinimalNodeEntryEntity;
// content: SafeHtml = null;
content: string = null;
constructor(
private apiService: AlfrescoApiService
// private sanitizer: DomSanitizer
) {}
ngOnInit() {
this.apiService.nodesApi.getFileContent(this.node.id).then(
result => {
const converter = new Converter({
tables: true,
ghCodeBlocks: true,
ghCompatibleHeaderId: true,
simplifiedAutoLink: true
});
converter.setOption('metadata', true);
converter.setFlavor('github');
const html = converter.makeHtml(result);
// this.content = this.sanitizer.bypassSecurityTrustHtml(html);
this.content = html;
},
err => console.log(err)
);
}
}
+6
View File
@@ -0,0 +1,6 @@
/*
* Public API Surface of aca-dev-tools
*/
export * from './lib/aca-dev-tools.component';
export * from './lib/aca-dev-tools.module';
+22
View File
@@ -0,0 +1,22 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
+33
View File
@@ -0,0 +1,33 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"types": [],
"lib": [
"dom",
"es2015"
]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"aca",
"camelCase"
],
"component-selector": [
true,
"element",
"aca",
"kebab-case"
]
}
}
+31
View File
@@ -0,0 +1,31 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

Some files were not shown because too many files have changed in this diff Show More