Merge pull request #754 from Alfresco/development

ACA 1.5 update
This commit is contained in:
Suzana Dirla
2018-10-25 11:50:59 +03:00
committed by GitHub
470 changed files with 42343 additions and 27670 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ root = true
[*] [*]
charset = utf-8 charset = utf-8
indent_style = space indent_style = space
indent_size = 4 indent_size = 2
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
+4
View File
@@ -0,0 +1,4 @@
node_modules
src/assets/i18n
e2e
/angular.json
+3
View File
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
+17 -10
View File
@@ -1,33 +1,40 @@
dist: trusty dist: trusty
sudo: required sudo: required
services: services:
- docker - docker
addons: addons:
chrome: stable chrome: stable
artifacts:
paths:
- e2e-output
target_paths:
- /${TRAVIS_BUILD_NUMBER}
language: node_js language: node_js
node_js: node_js:
- "8" - '8'
before_script: before_script:
# Disable services enabled by default
- sudo /etc/init.d/postgresql stop - sudo /etc/init.d/postgresql stop
before_install: before_install:
- npm install -g npm@latest - npm install -g npm@latest
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start - sh -e /etc/init.d/xvfb start
- sleep 3 # give xvfb some time to start - sleep 3
jobs: jobs:
include: include:
- stage: test - stage: test
script: npm run lint && npm run spellcheck name: 'Code quality checks'
script:
- npm run lint
- npm run spellcheck
- npm run format:check
- stage: test - stage: test
name: 'Unit tests'
script: script:
- npm run test:ci - npm run test:ci
- bash <(curl -s https://codecov.io/bash) -X gcov - bash <(curl -s https://codecov.io/bash) -X gcov
- stage: e2e - stage: e2e
name: 'Nginx'
script: npm run build && npm run e2e:docker script: npm run build && npm run e2e:docker
- stage: e2e
name: 'Tomcat'
script: npm run build.tomcat.e2e && npm run docker.tomcat.e2e
+10 -1
View File
@@ -1,4 +1,13 @@
{ {
"javascript.preferences.quoteStyle": "single", "javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single" "javascript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.quoteStyle": "single",
"typescript.preferences.importModuleSpecifier": "relative",
"editor.formatOnSave": true,
"[html]": {
"editor.formatOnSave": false
},
"[json]": {
"editor.formatOnSave": false
}
} }
+5 -1
View File
@@ -1,9 +1,13 @@
FROM nginx:stable-alpine FROM nginx:stable-alpine
LABEL version="1.3" LABEL version="1.4"
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
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
COPY dist/app/ . COPY dist/app/ .
ENTRYPOINT [ "/docker-entrypoint.sh" ]
+14 -45
View File
@@ -28,19 +28,24 @@ 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.
#### Features added in the latest release #### Features added in the latest release
* Application Extensibility - first phase of extensibilty, see [Documentation](https://alfresco.github.io/alfresco-content-app/#/extending) for details. * Application Extensibility - Phase 2
* Sharing Files - activate and deactivate shared file links. * Document list presets
* Commenting - View and add comments to files and folders. * File viewer actions
* Permissions - update file and folder permissions. * Create menu button
* Print - print action from the file viewer * Application header
* Improved UX - single click to open folders and files, and right click actions menu * Metadata card configuration
* see [Documentation](https://alfresco.github.io/alfresco-content-app/#/extending) for details.
* Sharing Files
* Set expiry date for shared links
* Right click action to access shared link settings
* Automatic disable of sharing based on respository configuration
Please refer to the [release notes](https://github.com/Alfresco/alfresco-content-app/releases) for details of all changes. 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) #### High level features planned for H2 2018 (July - December)
* Library Management - create, find, join and manage file libraries. * Library Management
* Sharing Files - add an expiry date to a sharable link. * For end users: Find, join and favorite libraries
* Application Extensibility - Extension framework to provide simple ways to extend the application. * For managers: Create libraries, manage users and requests to join
### Want to help? ### Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for [contributing](https://github.com/Alfresco/alfresco-content-app/blob/master/CONTRIBUTING.md) and then check out one of our issues in the [Jira](https://issues.alfresco.com/jira/projects/ACA) or [GitHub](https://github.com/Alfresco/alfresco-content-app/issues) Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for [contributing](https://github.com/Alfresco/alfresco-content-app/blob/master/CONTRIBUTING.md) and then check out one of our issues in the [Jira](https://issues.alfresco.com/jira/projects/ACA) or [GitHub](https://github.com/Alfresco/alfresco-content-app/issues)
@@ -60,42 +65,6 @@ Want to file a bug, contribute some code, or improve documentation? Excellent! R
| Metadata | The information drawer can be configured in the app.config.json to display metadata information, by default file the Properties Aspect is shown and images will also include EXIF information.| | Metadata | The information drawer can be configured in the app.config.json to display metadata information, by default file the Properties Aspect is shown and images will also include EXIF information.|
| Versioning | The version manager provides access and management of previous file versions, and the ability to upload new versions.| | Versioning | The version manager provides access and management of previous file versions, and the ability to upload new versions.|
## Development server
Run `npm start` for a dev server. Navigate to `http://localhost:4200/` (opens by default).
The app will automatically reload if you change any of the source files.
## Build
Run `npm run build` to build the project in the production mode. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `npm test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run the local instance of the application packaged into the docker image together with the ACS images:
```sh
npm run build
npm run start:docker
```
The ACA runs on port 4000 inside the docker container.
Run `npm run e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
```sh
npm run e2e
```
When testing is over you can stop all corresponding containers:
```sh
npm run stop:docker
```
## Further help ## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
+7 -89
View File
@@ -47,14 +47,14 @@
"output": "/" "output": "/"
}, },
{ {
"glob": "**/*", "glob": "**/*.json",
"input": "node_modules/monaco-editor/min", "input": "node_modules/@denysvuika/aca-dev-tools/assets",
"output": "./assets/monaco" "output": "./assets/plugins"
}, },
{ {
"glob": "**/*.js", "glob": "extension.schema.json",
"input": "node_modules/@ngstack/code-editor/workers", "input": ".",
"output": "./assets/workers" "output": "./assets"
} }
], ],
"styles": [ "styles": [
@@ -64,7 +64,6 @@
], ],
"scripts": [ "scripts": [
"node_modules/pdfjs-dist/build/pdf.js", "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/pdfjs-dist/web/pdf_viewer.js",
"node_modules/moment/min/moment.min.js" "node_modules/moment/min/moment.min.js"
] ]
@@ -124,7 +123,6 @@
"tsConfig": "src/tsconfig.spec.json", "tsConfig": "src/tsconfig.spec.json",
"scripts": [ "scripts": [
"node_modules/pdfjs-dist/build/pdf.js", "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/pdfjs-dist/web/pdf_viewer.js",
"node_modules/moment/min/moment.min.js" "node_modules/moment/min/moment.min.js"
], ],
@@ -154,7 +152,7 @@
"output": "/assets" "output": "/assets"
}, },
{ {
"glob": "pdf.worker.js", "glob": "pdf.worker.min.js",
"input": "node_modules/pdfjs-dist/build", "input": "node_modules/pdfjs-dist/build",
"output": "/" "output": "/"
} }
@@ -204,86 +202,6 @@
} }
} }
} }
},
"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", "defaultProject": "app",
+13
View File
@@ -0,0 +1,13 @@
npm run build -- --base-href ./
node -e "
const fs = require('fs');
const config = require('./dist/app/app.config.json');
config.baseShareUrl = 'http://localhost:4000/content-app';
fs.writeFileSync(
'./dist/app/app.config.json',
JSON.stringify(config, null, 2)
);
"
jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .
+10 -6
View File
@@ -4,6 +4,8 @@
"words": [ "words": [
"succes", "succes",
"sharedlinks", "sharedlinks",
"Redistributable",
"fullscreen",
"ngrx", "ngrx",
"ngstack", "ngstack",
@@ -16,6 +18,8 @@
"classlist", "classlist",
"folderlink", "folderlink",
"filelink", "filelink",
"formcontrolname",
"datetimepicker",
"datatable", "datatable",
"repo", "repo",
"snackbar", "snackbar",
@@ -32,6 +36,7 @@
"SOLR", "SOLR",
"unshare", "unshare",
"qshare",
"validators", "validators",
"guid", "guid",
"polyfill", "polyfill",
@@ -46,11 +51,10 @@
"exif", "exif",
"cardview", "cardview",
"webm", "webm",
"keycodes" "keycodes",
"denysvuika",
"submenu",
"submenus"
], ],
"dictionaries": [ "dictionaries": ["html", "en-gb", "en_US"]
"html",
"en-gb",
"en_US"
]
} }
+17 -7
View File
@@ -1,12 +1,12 @@
version: "3" version: '3'
services: services:
alfresco: alfresco:
image: alfresco/alfresco-content-repository-community:6.0.7-ga image: alfresco/alfresco-content-repository-community:6.1.0-ea
depends_on: depends_on:
- postgres - postgres
environment: environment:
JAVA_OPTS : " JAVA_OPTS: '
-Ddb.driver=org.postgresql.Driver -Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco -Ddb.username=alfresco
-Ddb.password=alfresco -Ddb.password=alfresco
@@ -19,14 +19,14 @@ services:
-Dshare.host=localhost -Dshare.host=localhost
-Ddeployment.method=DOCKER_COMPOSE -Ddeployment.method=DOCKER_COMPOSE
-Dcsrf.filter.enabled=false -Dcsrf.filter.enabled=false
" '
networks: networks:
- internal - internal
ports: ports:
- 8080:8080 #Browser port - 8080:8080 #Browser port
share: share:
image: alfresco/alfresco-share:6.0.b image: alfresco/alfresco-share:6.0.c
depends_on: depends_on:
- alfresco - alfresco
environment: environment:
@@ -50,7 +50,7 @@ services:
- 5432:5432 - 5432:5432
solr6: solr6:
image: alfresco/alfresco-search-services:1.1.1 image: alfresco/alfresco-search-services:1.2.0
depends_on: depends_on:
- alfresco - alfresco
environment: environment:
@@ -67,6 +67,16 @@ services:
ports: ports:
- 8983:8983 #Browser port - 8983:8983 #Browser port
activemq:
image: alfresco/alfresco-activemq:5.15.6
networks:
- internal
ports:
- 8161:8161 # Web Console
- 5672:5672 # AMQP
- 61616:61616 # OpenWire
- 61613:61613 # STOMP
content-app: content-app:
image: alfresco/alfresco-content-app:latest image: alfresco/alfresco-content-app:latest
build: . build: .
@@ -92,4 +102,4 @@ services:
- 4000:80 - 4000:80
networks: networks:
internal: ? internal
+64
View File
@@ -0,0 +1,64 @@
#!/bin/sh
if [ -n "${APP_CONFIG_AUTH_TYPE}" ];then
sed -e "s/\"authType\": \".*\"/\"authType\": \"${APP_CONFIG_AUTH_TYPE}\"/g" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_HOST}" ];then
replace="\/"
encoded=${APP_CONFIG_OAUTH2_HOST//\//$replace}
sed -e "s/\"host\": \".*\"/\"host\": \"${encoded}\"/g" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_CLIENTID}" ];then
sed -e "s/\"clientId\": \".*\"/\"clientId\": \"${APP_CONFIG_OAUTH2_CLIENTID}\"/g" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_IMPLICIT_FLOW}" ];then
sed "/implicitFlow/s/true/${APP_CONFIG_OAUTH2_IMPLICIT_FLOW}/" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_SILENT_LOGIN}" ];then
sed "/silentLogin/s/true/${APP_CONFIG_OAUTH2_SILENT_LOGIN}/" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI}" ];then
replace="\/"
encoded=${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI//\//$replace}
sed -e "s/\"redirectSilentIframeUri\": \".*\"/\"redirectSilentIframeUri\": \"${encoded}\"/g" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGIN}" ];then
replace="\/"
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGIN//\//$replace}
sed -e "s/\"redirectUri\": \".*\"/\"redirectUri\": \"${encoded}\"/g" \
-i ./app.config.json
fi
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT}" ];then
replace="\/"
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT//\//$replace}
sed -e "s/\"redirectUriLogout\": \".*\"/\"redirectUriLogout\": \"${encoded}\"/g" \
-i ./app.config.json
fi
if [[ $ACSURL ]]; then
sed -i s%{protocol}//{hostname}{:port}%"$ACSURL"%g /usr/share/nginx/html/app.config.json
fi
if [[ $BASEPATH ]]; then
sed -i s%href=\"/\"%href=\""$BASEPATH"\"%g /usr/share/nginx/html/index.html
fi
if [ -n "${APP_BASE_SHARE_URL}" ];then
sed -e "s/\"baseShareUrl\": \".*\"/\"baseShareUrl\": \"${APP_BASE_SHARE_URL}\"/g" \
-i ./app.config.json
fi
nginx -g "daemon off;"
+5
View File
@@ -0,0 +1,5 @@
FROM tomcat:8.5-alpine
LABEL version="1.3"
LABEL maintainer="Denys Vuika <denys.vuika@alfresco.com>"
COPY ./artifacts/content-app.war /usr/local/tomcat/webapps/content-app.war
+1
View File
@@ -0,0 +1 @@
*.war
View File
+97
View File
@@ -0,0 +1,97 @@
version: '3'
services:
alfresco:
image: alfresco/alfresco-content-repository-community:6.1.0-ea
depends_on:
- postgres
environment:
JAVA_OPTS: '
-Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbc:postgresql://postgres:5432/alfresco
-Dsolr.host=solr6
-Dsolr.port=8983
-Dsolr.secureComms=none
-Dsolr.base.url=/solr
-Dindex.subsystem.name=solr6
-Dshare.host=localhost
-Ddeployment.method=DOCKER_COMPOSE
-Dcsrf.filter.enabled=false
'
networks:
- internal
ports:
- 8080:8080 #Browser port
share:
image: alfresco/alfresco-share:6.0.c
depends_on:
- alfresco
environment:
- REPO_HOST=alfresco
- REPO_PORT=8080
networks:
- internal
ports:
- 8083:8080
postgres:
image: postgres:10.1
environment:
- POSTGRES_PASSWORD=alfresco
- POSTGRES_USER=alfresco
- POSTGRES_DB=alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
networks:
- internal
ports:
- 5432:5432
solr6:
image: alfresco/alfresco-search-services:1.2.0
depends_on:
- alfresco
environment:
#Solr needs to know how to register itself with Alfresco
- SOLR_ALFRESCO_HOST=alfresco
- SOLR_ALFRESCO_PORT=8080
#Alfresco needs to know how to call solr
- SOLR_SOLR_HOST=solr6
- SOLR_SOLR_PORT=8983
#Create the default alfresco and archive cores
- SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
networks:
- internal
ports:
- 8983:8983 #Browser port
content-app:
image: alfresco/alfresco-content-app:development-latest-tomcat8
build: .
environment:
- APP_BASE_SHARE_URL={protocol}//{hostname}{:port}/content-app/
depends_on:
- alfresco
networks:
- internal
ports:
- 4001:8080
# volumes:
# - ./app.config.json:/usr/share/nginx/html/app.config.json
# - ./nginx.conf:/etc/nginx/conf.d/default.conf
proxy:
image: nginx
depends_on:
- content-app
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
networks:
- internal
ports:
- 4000:80
networks:
? internal
+43
View File
@@ -0,0 +1,43 @@
server {
listen *:80;
set $allowOriginSite *;
proxy_pass_request_headers on;
proxy_pass_header Set-Cookie;
location / {
proxy_pass http://content-app:8080;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
}
location /alfresco/ {
proxy_pass http://alfresco:8080;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
}
location /share/ {
proxy_pass http://share:8080;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
}
}
+15 -18
View File
@@ -7,7 +7,7 @@
The Alfresco Content Application is an example application built using The Alfresco Content Application is an example application built using
[Alfresco Application Development Framework (ADF)](https://github.com/Alfresco/alfresco-ng2-components) components. [Alfresco Application Development Framework (ADF)](https://github.com/Alfresco/alfresco-ng2-components) components.
### Who is this example application for ### Who is this example application for?
This example application demonstrates to Angular software engineers This example application demonstrates to Angular software engineers
how to construct a content application using the Alfresco ADF. how to construct a content application using the Alfresco ADF.
@@ -19,7 +19,7 @@ with a simple and easy to use interface for working with files stored in the Alf
This application was created based on the latest releases from Alfresco: This application was created based on the latest releases from Alfresco:
- [Alfresco ADF (2.5.0)](https://community.alfresco.com/community/application-development-framework/pages/get-started) - [Alfresco ADF (2.6.0)](https://community.alfresco.com/community/application-development-framework/pages/get-started)
- [Alfresco Content Services (6.0.0)](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 (6.0 - General Release: 201806)](https://www.alfresco.com/products/community/download) or [Alfresco Community Edition (6.0 - General Release: 201806)](https://www.alfresco.com/products/community/download)
@@ -27,8 +27,7 @@ This application was created based on the latest releases from Alfresco:
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.
</p> </p>
The latest version of the Alfresco Content platform is required **Note:** The latest version of the Alfresco Content platform is required due to the application using the latest [REST APIs](https://docs.alfresco.com/5.2/pra/1/topics/pra-welcome.html) developments.
due to the application using the latest [REST APIs](https://docs.alfresco.com/5.2/pra/1/topics/pra-welcome.html) developments.
## Features ## Features
@@ -46,9 +45,9 @@ using the Alfresco Application Development Framework to easily and quickly creat
There are three main areas of the application controlled by the [Layout component](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/layout): There are three main areas of the application controlled by the [Layout component](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/layout):
- [(1) Application Header](#header) 1. [Application Header](#header)
- [(2) Side Navigation](#side-navigation) 2. [Side Navigation](#side-navigation)
- [(3) Document List](#document-list-layout) 3. [Document List](#document-list-layout)
![Features](images/features-01.png) ![Features](images/features-01.png)
@@ -66,13 +65,13 @@ The application [header](https://github.com/Alfresco/alfresco-content-app/tree/m
Logo & app primary color - logo and color are configurable by updating the Logo & app primary color - logo and color are configurable by updating the
[app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json) file in the root folder of the project. [app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json) file in the root folder of the project.
Please refer to the [Application Configuration](/getting-started#application-logo) documentation for more information on how to change the logo and color. Please refer to the [Application Configuration](/getting-started/configuration) documentation for more information on how to change the logo and color.
#### Search #### Search
The application [Search](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/search) - The application [Search](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/search) -
uses the [ADF Search Component](https://github.com/Alfresco/alfresco-ng2-components/tree/master/lib/content-services/search) uses the [ADF Search Component](https://github.com/Alfresco/alfresco-ng2-components/tree/master/lib/content-services/search).
the app provides a 'live' search feature, where users can open files and folders directly from the Search API results. The app provides a 'live' search feature, where users can open files and folders directly from the Search API results.
![Search Input](images/search.png) ![Search Input](images/search.png)
@@ -114,16 +113,16 @@ and uploads can be canceled which will stop uploads in progress or permanently d
The navigation links are configurable via the [app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json). The navigation links are configurable via the [app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json).
Default configuration creates two sections. Default configuration creates two sections.
See [Navigation](/getting-started#navigation) for more information about configuring the side navigation. See [Navigation](/getting-started/navigation) for more information about configuring the side navigation.
### Document List Layout ### Document List Layout
The main area of the application is composed of several individual ADF components: The main area of the application is composed of several individual ADF components:
- (1) [Breadcrumb](https://alfresco.github.io/adf-component-catalog/components/BreadcrumbComponent.html) 1. [Breadcrumb](https://alfresco.github.io/adf-component-catalog/components/BreadcrumbComponent.html)
- (2) [Toolbar](https://alfresco.github.io/adf-component-catalog/components/ToolbarComponent.html) 2. [Toolbar](https://alfresco.github.io/adf-component-catalog/components/ToolbarComponent.html)
- (3) [Document List](https://alfresco.github.io/adf-component-catalog/components/DocumentListComponent.html) 3. [Document List](https://alfresco.github.io/adf-component-catalog/components/DocumentListComponent.html)
- (4) [Pagination](https://alfresco.github.io/adf-component-catalog/components/PaginationComponent.html) 4. [Pagination](https://alfresco.github.io/adf-component-catalog/components/PaginationComponent.html)
![](images/doclist.png) ![](images/doclist.png)
@@ -155,8 +154,6 @@ and includes extra columns to display where the file is
[located](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/location-link) [located](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/location-link)
in the content repository and who created the shared link. in the content repository and who created the shared link.
A feature for creating and removing Shared Links will be added in the future.
#### Recent Files #### Recent Files
The Recent Files view shows all the files that have been created or modified within the last 30 days by the current user. The Recent Files view shows all the files that have been created or modified within the last 30 days by the current user.
@@ -248,7 +245,7 @@ actions are automatically hidden when the user does not have permission.
<tr> <tr>
<td>Share</td> <td>Share</td>
<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. 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. Share links can automatically expire based on a date, the minimum expiry date is controlled by the Content Services repository, which is 1 day from the date of creation.
</td> </td>
<td> <td>
Not applicable. Not applicable.
+658 -141
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
-560
View File
@@ -1,560 +0,0 @@
---
title: Getting Started
---
# Getting Started
## Prerequisites
This application uses the latest releases from Alfresco:
- [Alfresco ADF (2.4.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)
or [Alfresco Community Edition (201802 EA)](https://www.alfresco.com/products/community/download)
<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.
</p>
The latest version of the Alfresco Content platform is required
due to the application using the latest [REST APIs](https://docs.alfresco.com/5.2/pra/1/topics/pra-welcome.html) developments.
## Building from source
The Content App is based on [Angular CLI](https://cli.angular.io), and you can use all the commands, generators and blueprints supported by the CLI.
### Prerequisites for building
- [Node.js](https://nodejs.org/en/) LTS
- [Angular CLI](https://cli.angular.io/) 1.7.3
### Cloning and running
Use the following commands to clone the project, install dependencies and run it.
```sh
git clone https://github.com/Alfresco/alfresco-content-app.git
cd alfresco-content-app
npm install
npm start
```
The application runs at port `4200` by default, and should automatically open in the default browser once project compilation finishes.
### Proxy settings
The Content App provides a proxy configuration for local development server
that allows you to address specific scenarios with CORS and native authentication dialog.
You can find settings in the "proxy.conf.js" file in the project root directory.
<p class="warning">
The proxy settings get automatically applied every time you run the application with "npm start" script.
You must restart the application every time you change the settings values.
</p>
### Running unit tests
Run `npm test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Internationalization (i18n)
The Content Application provides support for the following languages:
- German (`de`)
- English (`en`)
- Spanish (`es`)
- French (`fr`)
- Italian (`it`)
- Japanese (`ja`)
- Norwegian (`nb`)
- Dutch (`nl`)
- Brazilian Portuguese (`pt-BR`)
- Russian (`ru`)
- Simplified Chinese (`zh-CN`)
The fallback locale is the English one, however current browser language is taken as the default one automatically when the application starts.
### User-defined language
You can allow users to set custom language that gets saved to user preferences.
The main application menu already has the [ADF Language Menu](https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/language-menu.component.md) component integrated and pre-filled with the supported items.
To change the default language set edit the `app.config.json` file and add or remove items:
```json
{
...,
"languages": [
{
"key": "de",
"label": "German"
},
{
"key": "en",
"label": "English"
},
{
"key": "es",
"label": "Spanish"
},
...
]
}
```
The file is located at the following path: `/src/app.config.json`.
### Custom languages
To add a custom language, add a new "JSON" file to the "/src/assets/i18n" folder
with the name of the target locale, for instance, a "de.json" for the "German".
Translate the resource strings based on the default "en.json" file.
You can copy the content over to your newly created file and replace English values with translated text.
```json
{
"APP": {
"SIGN_IN": "Anmelden",
"SIGN_OUT": "Abmelden",
"NEW_MENU": {
"LABEL": "Neu",
"MENU_ITEMS": {
"CREATE_FOLDER": "Ordner erstellen",
"UPLOAD_FILE": "Datei hochladen",
"UPLOAD_FOLDER": "Ordner hochladen"
},
...
}
},
...
}
```
The Content Application automatically bundles your file upon project build.
You can test your locale by changing the browser language settings and reloading the page.
Optionally, you can extend the [ADF Language Menu](https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/language-menu.component.md) component with the newly added language by updating the `app.config.json` file.
### Customizing ADF translations
In addition to creating a custom language file for the Content Application,
you can also provide translations for the ADF resources.
Your `/src/assets/i18n/<lang>.json` file can reflect the structure of one of the ADF language files:
- ADF Core ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/core/i18n/en.json))
- ADF Content Services ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/content-services/i18n/en.json))
- ADF Process Services ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/process-services/i18n/en.json))
- ADF Insights ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/insights/i18n/en.json))
At runtime, the application-level strings have the highest priority.
That means you can replace the value of any ADF resource string if needed.
For example, let's change the title of the "Create Folder" dialog shipped with the ADF.
Modify the `/src/assets/i18n/en.json` file and append the "CORE" section like in the example below:
```json
{
"APP": {
...
},
"CORE": {
"FOLDER_DIALOG": {
"CREATE_FOLDER_TITLE": "Custom title"
}
}
}
```
Now, if you run the application and click the "New → Create Folder" menu,
the title of the dialog should look like the following:
![](images/aca-i18n-01.png)
### Language picker
You can enable internal language picker in the `app.config.json` file:
```json
{
...,
"languagePicker": true,
...
}
```
![](images/aca-i18n-02.png)
## CORS
The ACA already comes with the proxy configuration for Angular CLI to address CORS-related issues for development.
Also, the docker images contain Nginx settings needed for CORS when developing and debugging application locally.
### Chrome Workaround
For the Chrome browser, you can use the following plugin that allows you to toggle CORS:
[Allow-Control-Allow-Origin](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi)
### Firefox Workaround
Firefox users can try the following plugin: [CORS Everywhere](https://addons.mozilla.org/en-Gb/firefox/addon/cors-everywhere/)
### Safari Workaround
If you are developing or testing with Safari then you can use the "Develop" menu to toggle the CORS mode.
Please note that the page must be reloaded every time you change CORS settings.
![](images/safari-develop-menu.png)
### See also
- [Using CORS](https://www.html5rocks.com/en/tutorials/cors/)
## Configuration
The Content Application provides support for a global settings file `app.config.json` that you can use to customize the behavior of ACA and ADF components.
### Server settings
Once the Content Application starts, it needs to know where the Alfresco Content Services (either Community or Enterprise) server is.
The "ecmHost" property allows you to set the address of the server using the dynamic or static format.
#### Dynamic address
The example below demonstrates the most common dynamic format for development environment:
```json
{
"ecmHost": "http://{hostname}{:port}",
...
}
```
The configuration above assumes you are running ACS and Content App on the same server and port
and allows deploying to different servers having the same unified configuration file.
For example, a proxy server at `localhost:4200` hosting the Content App as the root application,
and `localhost:4200/alfresco` for the ACS repository.
At runtime, the application is going to automatically substitute the "{hostname}" value with the original hostname.
Optionally it can also use the value of the original port if present, for example, "4200" at local machines, or skip the value for port 80.
#### Static address
Alternatively, you can provide a static address for the ACS server if necessary:
```json
{
"ecmHost": "http://localhost:4200",
...
}
```
### Application settings
There are many settings you can change to alter the default behavior of the application.
#### Application Name
The following block allows you to change the name of the application.
```json
{
...,
"application": {
"name": "Alfresco Example Content Application"
}
}
```
The value of the `application.name` key gets appended to every browser tab title at runtime
with the format `[page title] - [application name]`,
for example: "Personal Files - Alfresco Example Content Application".
#### Application Logo
The default logo displayed in the top left corner of the Alfresco Content Application can be easily changed:
1. Place your custom logo image file in the [app-name]/src/assets/images folder. The displayed image will resize automatically, an image with extreme width/height might not retain its dimensions.
2. In the app.config.json file, set the value of the application.logo to contain the name of the custom logo image: "logo": "/assets/images/[image-name].[extension]"
```json
{
...,
"application": {
"logo": "/assets/images/alfresco-logo-white.svg"
}
}
```
#### Header Background color
You can change the header background color by specifying color code for the "headerColor" key:
```json
{
...,
"headerColor": "#2196F3"
}
```
#### Restricted content
You can restrict users from uploading certain types of files and folders by setting or extending the list of rules at the "files.excluded" path.
By default, the application ships with the following rules already predefined:
```json
{
...,
"files": {
"excluded": [
".DS_Store",
"desktop.ini",
"thumbs.db",
".git"
]
},
...
}
```
<p class="tip">
You can get more details on the supported rules in the following article: <a href="https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/upload.service.md" target="_blank">Upload Service</a>.
</p>
#### Pagination settings
You can change the default settings of the pagination that gets applied to all the document lists in the application.
```json
{
...,
"pagination": {
"supportedPageSizes": [
25,
50,
100
]
},
...
}
```
### Your custom settings
You can store any information in the application configuration file, and access it at runtime by using the `AppConfigService` service provided by ADF.
<p class="tip">
Please refer to the <a href="https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/app-config.service.md" target="_blank">AppConfigService</a> documentation to get more details on Application Configuration features and API available.
</p>
## Navigation
The Alfresco Content Application provides the following navigation links:
- Personal Files
- File Libraries
- Shared
- Recent Files
- Favorites
- Trash
The side navigation provides support to customize the appearance of the links by editing the `app.config.json`.
### Customization
Navigation configuration supports array and object like schema. Defining an object helps navigation to render visual delimiters between different groups of links.
```json
{
"navigation": {
"main": [
...
],
"secondary": [
...
]
}
}
```
![](images/navigation-01.png)
```json
{
"navigation": [
{ ... },
{ ... },
...
]
}
```
![](images/navigation-02.png)
#### Customize icons and text
`icon` - supported value can be anything from [Material Design](https://material.io/icons) icons library. If not defined, the link will render just the label value.
`title` - instructs the link to render a native browser tooltip with the given value. It can be a string or a i18n defined reference. If not defined, the link will not show a tooltip.
`label` - represents the visual name of the link. It can be a string or a i18n defined reference.
<p class="danger">
Changing ` "route": { "url": "/..." } ` value will affect the navigation since these are mapped to application routing system.
</p>
#### Custom text (i18n)
To change the `title` and `label` of navigation links edit the values under `BROWSE` entry found at `/src/assets/i18n/en.json`
```json
"APP" : {
...
"BROWSE": {
"PERSONAL": {
"TITLE": "Personal Files",
"SIDENAV_LINK": {
"LABEL": "Personal Files",
"TOOLTIP": "View your Personal Files"
}
},
...
}
}
```
For more information about internationalization see [Internationalization (i18n)](#internationalization-i18n) section.
### User-defined navigation
To add custom navigation link for the application, first we need to create a component.
`src/app/components/custom-page/custom-page.component.ts`
```js
import { Component } from '@angular/core';
@Component({
template: `
<h4>{{ title }}</h4>
`
})
export class CustomPage {
title = 'My Custom Page'
}
```
Register the component in ```app.module.ts```
```javascript
...
import { CustomPage } from './components/custom-page/custom-page.component';
@NgModule({
...
declarations: [
...,
CustomPage
],
...
})
```
In the `app.config.json` define a link entry which will point to the custom page
```json
{
...,
"navigation": [
"main": [ ... ],
"secondary": [ ... ],
"custom": [
{
"icon": "work",
"label": "Link",
"title": "My custom link",
"route": {
"url": "/custom-route"
}
}
]
]
}
```
Map the `/custom-route` in `app.routes.ts` as a child of `LayoutComponent` definition.
```js
import { CustomPage } from './components/custom-page/custom-page.component.ts';
...
{
path: '',
component: LayoutComponent,
children: [
...,
{
path: 'custom-route',
component: CustomPage
}
]
}
...,
```
![](images/navigation-03.png)
For more information about the content of a custom page see [Document List Layout](/#document-list-layout) section.
## Docker
The ACA comes with the ACS 6.0 Community Edition preconfigured.
The application runs in to modes:
- Development (runs latest source code, requires building application)
- Preview (runs with latest published containers, master branch)
### Development Mode
Run the local instance of the application packaged into the docker image together with the ACS images:
```sh
npm run build
npm run start:docker
```
The ACA runs on port `4000` when served from within container.
Use the following command to stop all the containers:
```sh
npm run stop:docker
```
### Preview Mode
<p class="tip">
With this mode, you do not need building application from source code or installing dependencies.
</p>
To run the latest published container go to the `docker-compose` folder and start docker compose from there:
```sh
cd docker-compose
docker-compose up
```
The application is available at the `http://localhost:3000` address.
+16
View File
@@ -0,0 +1,16 @@
---
---
# Getting started
Learn how to start developing with the Alfresco Content Application.
## Contents
- [Prerequisites](/getting-started/prerequisites)
- [Building from source](/getting-started/building-from-source)
- [Internationalization (i18n)](/getting-started/internationalization)
- [CORS](/getting-started/cors)
- [Configuration](/getting-started/configuration)
- [Navigation](/getting-started/navigation)
- [Docker](/getting-started/docker)
@@ -0,0 +1,39 @@
---
---
# Building from source
The Content App is based on [Angular CLI](https://cli.angular.io), and you can use all the commands, generators, and blueprints supported by the CLI.
## Prerequisites for building
- [Node.js](https://nodejs.org/en/) LTS
- [Angular CLI](https://cli.angular.io/) 1.7.3
## Cloning and running
Use the following commands to clone the project, install dependencies and run it.
```sh
git clone https://github.com/Alfresco/alfresco-content-app.git
cd alfresco-content-app
npm install
npm start
```
The application runs at port `4200` by default, and should automatically open in the default browser once the project has compiled.
## Proxy settings
The Content App provides a proxy configuration for a local development server that allows you to address specific scenarios with CORS and a native authentication dialog.
You can find settings in the "proxy.conf.js" file in the project root directory.
<p class="warning">
The proxy settings get automatically applied every time you run the application with the "npm start" script.
You must restart the application every time you change its settings.
</p>
## Running unit tests
Run `npm test` to execute the unit tests via [Karma](https://karma-runner.github.io).
+179
View File
@@ -0,0 +1,179 @@
---
---
# Configuration
The Alfresco Content Application provides support for the global settings file `app.config.json` that you can use to customize the behavior of the Content Application and ADF components.
## Server settings
Once the Content Application starts, it needs to know where the Alfresco Content Services server is, and what the file sharing URL will be.
### Content Services Address
The "ecmHost" property allows you to set the address of the server using the dynamic or static format.
#### Dynamic address
The example below demonstrates the most common dynamic format for a development environment:
```json
{
"ecmHost": "http://{hostname}{:port}",
...
}
```
The configuration above assumes you are running ACS and the Alfresco Content Application on the same server and port
and allows deploying to different servers having the same unified configuration file.
For example, a proxy server at `localhost:4200` hosting the Alfresco Content Application as the root application,
and `localhost:4200/alfresco` for the ACS repository.
At runtime, the application is going to automatically substitute the "{hostname}" value with the original hostname.
Optionally it can also use the value of the original port if present, for example, "4200" at local machines, or skip the value for port 80.
#### Static address
Alternatively, you can provide a static address for the ACS server if necessary:
```json
{
"ecmHost": "http://localhost:4200",
...
}
```
### Shared Files Address
The "baseShareUrl" property tells the application how to construct the address where users will access shared files.
#### Default
When the default value is set the application will construct the File Share URL from the "ecmHost" property:
```json
{
...
"baseShareUrl": null,
...
}
```
#### Configuration
If you run the application from a different server than the Content Services server the "baseShareUrl" property should must be configured correctly, for example:
```json
{
...
"baseShareUrl": "http://{serveraddress}{:port}",
...
}
```
<p class="warning">
If you run the application as part of Tomcat and not in the root (subfolder), then "baseShareUrl" value should contain full address to the app, for example: "baseShareUrl": "http://{serveraddress}{:port}/{folder}".
</p>
## Application settings
There are many settings you can change to alter the default behavior of the application.
### Application Name
The following block allows you to change the name of the application.
```json
{
...,
"application": {
"name": "Alfresco Example Content Application"
}
}
```
The value of the `application.name` key gets appended to every browser tab title at runtime
with the format `[page title] - [application name]`,
for example: "Personal Files - Alfresco Example Content Application".
### Application Logo
The default logo displayed in the top left corner of the Alfresco Content Application can be changed:
1. Place your custom logo image file in the [app-name]/src/assets/images folder. The displayed image will resize automatically, an image with extreme width/height might not retain its dimensions.
2. In the app.config.json file, set the value of the application.logo to contain the name of the custom logo image: "logo": "/assets/images/[image-name].[extension]"
```json
{
...,
"application": {
"logo": "/assets/images/alfresco-logo-white.svg"
}
}
```
### Header Background color
You can change the header background color by specifying the color code for the "headerColor" key:
```json
{
...,
"headerColor": "#2196F3"
}
```
### Restricted content
You can restrict users from uploading certain types of files and folders by setting or extending the list of rules at the "files.excluded" path.
By default, the application ships with the following rules already predefined:
```json
{
...,
"files": {
"excluded": [
".DS_Store",
"desktop.ini",
"thumbs.db",
".git"
]
},
...
}
```
<p class="tip">
You can get more details on the supported rules in the following article: <a href="https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/upload.service.md" target="_blank">Upload Service</a>.
</p>
### Pagination settings
You can change the default settings of the pagination that gets applied to all the document lists in the application.
```json
{
...,
"pagination": {
"supportedPageSizes": [
25,
50,
100
]
},
...
}
```
## Your custom settings
You can store any information in the application configuration file, and access it at runtime by using the `AppConfigService` service provided by ADF.
<p class="tip">
Please refer to the <a href="https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/app-config.service.md" target="_blank">AppConfigService</a> documentation to get more details on Application Configuration features and API's available.
</p>
+27
View File
@@ -0,0 +1,27 @@
---
---
# CORS
The Alfresco Content Application comes with the proxy configuration for Angular CLI to address CORS-related issues for development.
Also, the docker images contain Nginx settings needed for CORS when developing and debugging an application locally.
## Chrome Workaround
For the Chrome browser, you can use the following plugin that allows you to toggle CORS:
[Allow-Control-Allow-Origin](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi)
## Firefox Workaround
For the Chrome browser, you can use the following plugin: [CORS Everywhere](https://addons.mozilla.org/en-Gb/firefox/addon/cors-everywhere/)
## Safari Workaround
If you are developing or testing with Safari then you can use the "Develop" menu to toggle the CORS mode.
Note, the page must be reloaded every time you change the CORS settings.
![](../images/safari-develop-menu.png)
## See also
- [Using CORS](https://www.html5rocks.com/en/tutorials/cors/)
+42
View File
@@ -0,0 +1,42 @@
---
---
# Docker
The ACA comes with the ACS 6.0 Community Edition preconfigured.
The application runs in two modes:
- Development (runs latest source code, requires building application)
- Preview (runs with latest published containers, master branch)
## Development Mode
Run the local instance of the application packaged into the docker image together with the ACS images:
```sh
npm run build
npm run start:docker
```
The ACA runs on port `4000` when served from within container.
Use the following command to stop all the containers:
```sh
npm run stop:docker
```
## Preview Mode
<p class="tip">
With this mode, you do not need building application from source code or installing dependencies.
</p>
To run the latest published container go to the `docker-compose` folder and start docker compose from there:
```sh
cd docker-compose
docker-compose up
```
The application is available at the `http://localhost:3000` address.
@@ -0,0 +1,134 @@
---
---
# Internationalization (i18n)
The Content Application provides support for the following languages:
- German (`de`)
- English (`en`)
- Spanish (`es`)
- French (`fr`)
- Italian (`it`)
- Japanese (`ja`)
- Norwegian (`nb`)
- Dutch (`nl`)
- Brazilian Portuguese (`pt-BR`)
- Russian (`ru`)
- Simplified Chinese (`zh-CN`)
The default language is English, however the current browser language is taken as the default one automatically when the application starts.
## User-defined language
You can allow users to set custom languages that are saved to their preferences.
The main application menu already has the [ADF Language Menu](https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/language-menu.component.md) component integrated and pre-filled with the supported items.
To change the default language set edit the `app.config.json` file and add or remove items:
```json
{
...,
"languages": [
{
"key": "de",
"label": "German"
},
{
"key": "en",
"label": "English"
},
{
"key": "es",
"label": "Spanish"
},
...
]
}
```
The file is located here: `/src/app.config.json`.
## Custom languages
To add a custom language, add a new "JSON" file to the "/src/assets/i18n" folder
with the name of the target language, for instance, a "de.json" for "German".
Translate the resource strings based on the default "en.json" file.
You can copy the content over to your newly created file and replace the English values with translated text.
```json
{
"APP": {
"SIGN_IN": "Anmelden",
"SIGN_OUT": "Abmelden",
"NEW_MENU": {
"LABEL": "Neu",
"MENU_ITEMS": {
"CREATE_FOLDER": "Ordner erstellen",
"UPLOAD_FILE": "Datei hochladen",
"UPLOAD_FOLDER": "Ordner hochladen"
},
...
}
},
...
}
```
The Content Application automatically bundles your file when the project builds.
You can test your locale by changing the browser language settings and reloading the page.
Optionally, you can extend the [ADF Language Menu](https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/language-menu.component.md) component with the newly added language by updating the `app.config.json` file.
## Customizing ADF translations
In addition to creating a custom language file for the Content Application,
you can also provide translations for the ADF resources.
Your `/src/assets/i18n/<lang>.json` file can reflect the structure of one of the ADF language files:
- ADF Core ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/core/i18n/en.json))
- ADF Content Services ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/content-services/i18n/en.json))
- ADF Process Services ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/process-services/i18n/en.json))
- ADF Insights ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/insights/i18n/en.json))
At runtime, the application-level strings have the highest priority.
That means you can replace the value of any ADF resource string if needed.
For example, let's change the title of the "Create Folder" dialog that was shipped with ADF.
Modify the `/src/assets/i18n/en.json` file and append the "CORE" section like in the example below:
```json
{
"APP": {
...
},
"CORE": {
"FOLDER_DIALOG": {
"CREATE_FOLDER_TITLE": "Custom title"
}
}
}
```
Now, if you run the application and click the "New > Create Folder" menu,
the title of the dialog should look like the following:
![](../images/aca-i18n-01.png)
## Language picker
You can enable internal language picker in the `app.config.json` file:
```json
{
...,
"languagePicker": true,
...
}
```
![](../images/aca-i18n-02.png)
+166
View File
@@ -0,0 +1,166 @@
---
---
# Navigation
The Alfresco Content Application provides the following navigation links:
- Personal Files
- File Libraries
- Shared
- Recent Files
- Favorites
- Trash
The side navigation provides support to customize the appearance of the links by editing the `app.config.json`.
## Customization
Navigation configuration supports array and object like schema. Defining an object helps navigation to render visual delimiters between different groups of links.
```json
{
"navigation": {
"main": [
...
],
"secondary": [
...
]
}
}
```
![](../images/navigation-01.png)
```json
{
"navigation": [
{ ... },
{ ... },
...
]
}
```
![](../images/navigation-02.png)
### Customize icons and text
`icon` - supported value can be anything from [Material Design](https://material.io/icons) icons library. If not defined, the link will render just the label value.
`title` - instructs the link to render a native browser tooltip with the given value. It can be a string or a i18n defined reference. If not defined, the link will not show a tooltip.
`label` - represents the visual name of the link. It can be a string or a i18n defined reference.
<p class="danger">
Changing ` "route": { "url": "/..." } ` value will affect the navigation since these are mapped to application routing system.
</p>
### Custom text (i18n)
To change the `title` and `label` of navigation links edit the values under `BROWSE` entry found at `/src/assets/i18n/en.json`
```json
"APP" : {
...
"BROWSE": {
"PERSONAL": {
"TITLE": "Personal Files",
"SIDENAV_LINK": {
"LABEL": "Personal Files",
"TOOLTIP": "View your Personal Files"
}
},
...
}
}
```
For more information about internationalization see [Internationalization (i18n)](/getting-started/internationalization) section.
## User-defined navigation
To add custom navigation link for the application, first we need to create a component.
`src/app/components/custom-page/custom-page.component.ts`
```js
import { Component } from '@angular/core';
@Component({
template: `
<h4>{{ title }}</h4>
`
})
export class CustomPage {
title = 'My Custom Page'
}
```
Register the component in ```app.module.ts```
```javascript
...
import { CustomPage } from './components/custom-page/custom-page.component';
@NgModule({
...
declarations: [
...,
CustomPage
],
...
})
```
In the `app.config.json` define a link entry which will point to the custom page
```json
{
...,
"navigation": [
"main": [ ... ],
"secondary": [ ... ],
"custom": [
{
"icon": "work",
"label": "Link",
"title": "My custom link",
"route": {
"url": "/custom-route"
}
}
]
]
}
```
Map the `/custom-route` in `app.routes.ts` as a child of `LayoutComponent` definition.
```js
import { CustomPage } from './components/custom-page/custom-page.component.ts';
...
{
path: '',
component: LayoutComponent,
children: [
...,
{
path: 'custom-route',
component: CustomPage
}
]
}
...,
```
![](../images/navigation-03.png)
For more information about the content of a custom page see [Document List Layout](/#document-list-layout) section.
+17
View File
@@ -0,0 +1,17 @@
---
---
# Prerequisites
This application uses the latest releases from Alfresco:
- [Alfresco ADF (2.6.0)](https://community.alfresco.com/community/application-development-framework/pages/get-started)
- [Alfresco Content Services (6.0)](https://www.alfresco.com/platform/content-services-ecm)
or [Alfresco Community Edition (6.0 - General Release: 201806)](https://www.alfresco.com/products/community/download)
<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.
</p>
The latest version of the Alfresco Content platform is required
due to the application using the latest [REST APIs](https://docs.alfresco.com/5.2/pra/1/topics/pra-welcome.html) developments.
+4 -4
View File
@@ -4,11 +4,11 @@ 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: See below for the different ways you can get help when building applications using the Alfresco Application Development Framework.
## Alfresco Community ## Alfresco Community
Visit the Alfresco Community space where you can find many resources to help you get started building your application, Visit Alfresco Community for resources that will help you find information to get started building your application,
along with blog posts from the Alfresco developers and much more: along with blog posts from the Alfresco developers and much more:
https://community.alfresco.com/community/application-development-framework https://community.alfresco.com/community/application-development-framework
@@ -20,8 +20,8 @@ https://gitter.im/Alfresco/alfresco-ng2-components
## Alfresco Developer Support ## Alfresco Developer Support
Developer Support is a subscription-based support offering delivered remotely Developer Support is a remote subscription-based support team that offers
by a dedicated team of development-focused, senior Support Engineers. development-focused, senior Support Engineers to help you with your installation.
This support offering is best for customers and partners that require on-going support This support offering is best for customers and partners that require on-going support
for their development teams and customized code. for their development teams and customized code.
+4 -3
View File
@@ -14,6 +14,7 @@
<script src="https://unpkg.com/prismjs/components/prism-typescript.js"></script> <script src="https://unpkg.com/prismjs/components/prism-typescript.js"></script>
<script> <script>
docute.init({ docute.init({
toc: "toc.md",
nav: [ nav: [
{ {
title: 'Home', title: 'Home',
@@ -21,15 +22,15 @@
}, },
{ {
title: 'Getting Started', title: 'Getting Started',
path: 'getting-started' path: '/getting-started/'
}, },
{ {
title: 'Extending', title: 'Extending',
path: 'extending' path: '/extending'
}, },
{ {
title: 'Get Help', title: 'Get Help',
path: 'help' path: '/help'
} }
], ],
icons: [ icons: [
+46
View File
@@ -0,0 +1,46 @@
- [Home](/)
- [Introduction](/#introduction)
- [Features](/#features)
- [User interface layout](/#user-interface-layout)
- [Header](/#header)
- [Side navigation](/#side-navigation)
- [Document List Layout](/#document-list-layout)
- [File Viewer](/#file-viewer)
- [Info Drawer](/#info-drawer)
- [Version Manager](/#version-manager)
- [Search results](/#search-results1)
- [How to contribute](/#how-to-contribute)
- [Getting started](/getting-started/)
- [Prerequisites](/getting-started/prerequisites)
- [Building from source](/getting-started/building-from-source)
- [Internationalization (i18n)](/getting-started/internationalization)
- [CORS](/getting-started/cors)
- [Configuration](/getting-started/configuration)
- [Navigation](/getting-started/navigation)
- [Docker](/getting-started/docker)
- [Extending](/extending)
- [Format](/extending#format)
- [Schema](/extending#schema)
- [Multiple files](/extending#multiple-files)
- [Startup behaviour](/extending#startup-behaviour)
- [Disabling content](/extending#disabling-content)
- [Routes](/extending#routes)
- [Components](/extending#components)
- [Actions](/extending#actions)
- [Application actions](/extending#application-actions)
- [Rules](/extending#rules)
- [Core evaluators](/extending#core-evaluators)
- [Application evaluators](/extending#application-evaluators)
- [Navigation evaluators](/extending#navigation-evaluators)
- [Application features](/extending#application-features)
- [Content actions](/extending#content-actions)
- [Create menu](/extending#create-menu)
- [Navigation bar](/extending#navigation-bar)
- [Sidebar (Info Drawer)](/extending#sidebar-info-drawer)
- [Toolbar](/extending#toolbar)
- [Context menu](/extending#context-menu)
- [Viewer](/extending#viewer)
- [Registration](/extending#registration)
- [Creating custom evaluator](/extending#creating-custom-evaluator)
- [Tutorials](/extending#tutorials)
- [Get help](/help)
+86
View File
@@ -0,0 +1,86 @@
/*!
* @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, promise } from 'protractor';
import { Component } from '../component';
export class Breadcrumb extends Component {
private static selectors = {
root: 'adf-breadcrumb',
item: '.adf-breadcrumb-item',
currentItem: '.adf-breadcrumb-item-current'
};
items: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item));
currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem));
constructor(ancestor?: ElementFinder) {
super(Breadcrumb.selectors.root, ancestor);
}
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
async getNthItemName(nth: number) {
return await this.getNthItem(nth).getText();
}
async getItemsCount() {
return await this.items.count();
}
async getAllItems() {
return this.items.map(async elem => {
const str = await elem.getText();
return str.split('\nchevron_right')[0];
});
}
async getFirstItemName() {
return await this.items.get(0).getText();
}
getCurrentItem() {
return this.currentItem;
}
async getCurrentItemName() {
return await this.currentItem.getText();
}
async clickItem(name: string) {
const elem = this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`));
await elem.click();
}
async clickNthItem(nth: number) {
await this.getNthItem(nth).click();
}
async getNthItemTooltip(nth: number) {
return await this.getNthItem(nth).getAttribute('title');
}
}
+6 -6
View File
@@ -23,21 +23,21 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, element, by, ExpectedConditions as EC, browser } from 'protractor'; import { ElementFinder, ExpectedConditions as EC, browser } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../configs'; import { BROWSER_WAIT_TIMEOUT } from '../configs';
export abstract class Component { export abstract class Component {
component: ElementFinder; component: ElementFinder;
constructor(selector: string, ancestor?: ElementFinder) { constructor(selector: string, ancestor?: ElementFinder) {
const locator = by.css(selector); const locator = selector;
this.component = ancestor this.component = ancestor
? ancestor.element(locator) ? ancestor.$$(locator).first()
: element(locator); : browser.$$(locator).first();
} }
wait() { async wait() {
return browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT);
} }
} }
+1
View File
@@ -32,4 +32,5 @@ 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 './breadcrumb/breadcrumb';
export * from './viewer/viewer'; export * from './viewer/viewer';
+144 -90
View File
@@ -23,9 +23,10 @@
* 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, promise, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { Menu } from '../menu/menu';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
export class DataTable extends Component { export class DataTable extends Component {
@@ -44,7 +45,7 @@ export class DataTable extends Component {
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', nameLink: '.dl-link',
selectedIcon: '.mat-icon', selectedIcon: '.mat-icon',
@@ -60,88 +61,102 @@ 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)); nameLink: ElementFinder = browser.element(by.css(DataTable.selectors.nameLink));
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));
emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle)); emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle));
emptyListText: ElementArrayFinder = this.component.all(by.css(DataTable.selectors.emptyListText)); emptyListText: ElementArrayFinder = this.component.all(by.css(DataTable.selectors.emptyListText));
menu: Menu = new Menu();
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(DataTable.selectors.root, ancestor); super(DataTable.selectors.root, ancestor);
} }
// Wait methods (waits for elements) // Wait methods (waits for elements)
waitForHeader() { waitForHeader() {
try {
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT); return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
} catch (error) {
console.log('----- wait for header catch : ', error);
}
} }
waitForEmptyState() { async waitForEmptyState() {
return browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
} }
// Header/Column methods // Header/Column methods
getColumnHeaders(): ElementArrayFinder { getColumnHeaders() {
const locator = by.css(DataTable.selectors.columnHeader); const locator = by.css(DataTable.selectors.columnHeader);
return this.head.all(locator); return this.head.all(locator);
} }
getNthColumnHeader(nth: number): ElementFinder { async getHeaderText() {
const el = this.getColumnHeaders();
return await el.getText();
}
getNthColumnHeader(nth: number) {
return this.getColumnHeaders().get(nth - 1); return this.getColumnHeaders().get(nth - 1);
} }
getColumnHeaderByLabel(label: string): ElementFinder { getColumnHeaderByLabel(label: string) {
const locator = by.cssContainingText(DataTable.selectors.columnHeader, label); const locator = by.cssContainingText(DataTable.selectors.columnHeader, label);
return this.head.element(locator); return this.head.element(locator);
} }
getSortedColumnHeader(): ElementFinder { getSortedColumnHeader() {
const locator = by.css(DataTable.selectors.sortedColumnHeader); const locator = by.css(DataTable.selectors.sortedColumnHeader);
return this.head.element(locator); return this.head.element(locator);
} }
getSortingOrder() { async getSortedColumnHeaderText() {
return this.getSortedColumnHeader().getAttribute('class') return await this.getSortedColumnHeader().getText();
.then(str => { }
async getSortingOrder() {
const str = await this.getSortedColumnHeader().getAttribute('class');
if (str.includes('asc')) { if (str.includes('asc')) {
return 'asc'; return 'asc';
} else { }
else {
if (str.includes('desc')) { if (str.includes('desc')) {
return 'desc'; return 'desc';
} }
} }
});
} }
sortByColumn(columnName: string): promise.Promise<void> { async sortByColumn(columnName: string) {
const column = this.getColumnHeaderByLabel(columnName); const column = this.getColumnHeaderByLabel(columnName);
const click = browser.actions().mouseMove(column).click(); const click = browser.actions().mouseMove(column).click();
return click.perform(); await click.perform();
} }
// Rows methods // Rows methods
getRows(): ElementArrayFinder { getRows() {
return this.body.all(by.css(DataTable.selectors.row)); return this.body.all(by.css(DataTable.selectors.row));
} }
countRows(): promise.Promise<number> { async countRows() {
return this.getRows().count(); return await this.getRows().count();
} }
getSelectedRows(): ElementArrayFinder { getSelectedRows() {
return this.body.all(by.css(DataTable.selectors.selectedRow)); return this.body.all(by.css(DataTable.selectors.selectedRow));
} }
countSelectedRows(): promise.Promise<number> { async countSelectedRows() {
return this.getSelectedRows().count(); return await this.getSelectedRows().count();
} }
getNthRow(nth: number): ElementFinder { getNthRow(nth: number) {
return this.getRows().get(nth - 1); return this.getRows().get(nth - 1);
} }
getRowByName(name: string): ElementFinder { getRowByName(name: string) {
return this.body.element(by.cssContainingText(DataTable.selectors.row, name)); return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
} }
@@ -157,108 +172,147 @@ export class DataTable extends Component {
return this.getRowNameCell(name).$('span'); return this.getRowNameCell(name).$('span');
} }
getItemNameTooltip(name: string): promise.Promise<string> { async getItemNameTooltip(name: string) {
return this.getRowNameCellText(name).getAttribute('title'); return await this.getRowNameCellText(name).getAttribute('title');
} }
hasCheckMarkIcon(itemName: string) { async hasCheckMarkIcon(itemName: string) {
return this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent(); return await this.getRowByName(itemName).element(by.css(DataTable.selectors.selectedIcon)).isPresent();
}
getNameLink(itemName: string) {
return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink);
}
async hasLinkOnName(itemName: string) {
return await this.getNameLink(itemName).isPresent();
} }
// Navigation/selection methods // Navigation/selection methods
doubleClickOnRowByName(name: string): promise.Promise<any> { async doubleClickOnRowByName(name: string) {
const item = this.getRowFirstCell(name); const item = this.getRowFirstCell(name);
return Utils.waitUntilElementClickable(item) await Utils.waitUntilElementClickable(item);
.then(() => browser.actions().mouseMove(item).click().click().perform()); await browser.actions().mouseMove(item).perform();
await browser.actions().click().click().perform();
} }
selectItem(name: string): promise.Promise<any> { async selectItem(name: string) {
try{
const item = this.getRowFirstCell(name); const item = this.getRowFirstCell(name);
return Utils.waitUntilElementClickable(item) // await Utils.waitUntilElementClickable(item);
.then(() => item.click()); await item.click();
} catch (e) {
console.log('--- select item catch : ', e);
}
} }
selectMultipleItems(names: string[]): promise.Promise<void> { async clickNameLink(itemName: string) {
return this.clearSelection() await this.getNameLink(itemName).click();
.then(() => browser.actions().sendKeys(protractor.Key.COMMAND).perform())
.then(() => {
names.forEach(name => {
this.selectItem(name);
});
})
.then(() => browser.actions().sendKeys(protractor.Key.NULL).perform());
} }
clearSelection(): promise.Promise<void> { async selectMultipleItems(names: string[]) {
return this.getSelectedRows().count() await this.clearSelection();
.then(count => { await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
if (count !== 0) { browser.refresh().then(() => this.waitForHeader()); } for (const name of names) {
}); await this.selectItem(name);
}
await browser.actions().sendKeys(protractor.Key.NULL).perform();
} }
getItemLocation(name: string) { async clearSelection() {
try {
const count = await this.countSelectedRows();
if (count !== 0) {
await browser.refresh();
await this.waitForHeader();
}
} catch (error) {
console.log('------ clearSelection catch : ', error);
}
}
async rightClickOnItem(itemName: string) {
const item = this.getRowFirstCell(itemName);
await browser.actions().click(item, protractor.Button.RIGHT).perform();
}
async rightClickOnMultipleSelection() {
await this.waitForHeader();
const itemFromSelection = this.getSelectedRows().get(0);
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform();
}
getItemLocationEl(name: string) {
return this.getRowByName(name).element(this.locationLink); return this.getRowByName(name).element(this.locationLink);
} }
getItemLocationTooltip(name: string): promise.Promise<string> { async getItemLocation(name: string) {
return this.getItemLocation(name).$('a').getAttribute('title'); return await this.getItemLocationEl(name).getText();
} }
getItemLocationTileAttr(name: string) { async getItemLocationTooltip(name: string) {
const location = this.getItemLocation(name).$('a'); return await this.getItemLocationEl(name).$('a').getAttribute('title');
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) { async getItemLocationTileAttr(name: string) {
return this.getItemLocation(name).click(); const location = this.getItemLocationEl(name).$('a');
const condition = () => location.getAttribute('title').then(value => value && value.length > 0);
await browser.actions().mouseMove(location).perform();
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
return await location.getAttribute('title');
}
async clickItemLocation(name: string) {
await this.getItemLocationEl(name).click();
} }
// empty state methods // empty state methods
isEmptyList(): promise.Promise<boolean> { async isEmptyList() {
return this.emptyList.isPresent(); return await this.emptyList.isPresent();
} }
isEmptyWithDragAndDrop(): promise.Promise<boolean> { async isEmptyWithDragAndDrop() {
return this.emptyFolderDragAndDrop.isDisplayed(); return await this.emptyFolderDragAndDrop.isDisplayed();
} }
getEmptyDragAndDropText(): promise.Promise<string> { async getEmptyDragAndDropText() {
return this.isEmptyWithDragAndDrop() const isEmpty = await this.isEmptyWithDragAndDrop();
.then(() => { if (isEmpty) {
return this.emptyFolderDragAndDrop.getText(); return await this.emptyFolderDragAndDrop.getText();
}); }
} }
getEmptyStateTitle(): promise.Promise<string> { async getEmptyStateTitle() {
return this.isEmptyList() const isEmpty = await this.isEmptyList();
.then(() => { if (isEmpty) {
return this.emptyListTitle.getText(); return await this.emptyListTitle.getText();
}); }
} }
getEmptyStateSubtitle(): promise.Promise<string> { async getEmptyStateSubtitle() {
return this.isEmptyList() const isEmpty = await this.isEmptyList();
.then(() => { if (isEmpty) {
return this.emptyListSubtitle.getText(); return await this.emptyListSubtitle.getText();
}); }
} }
getEmptyStateText(): promise.Promise<string> { async getEmptyStateText() {
return this.isEmptyList() const isEmpty = await this.isEmptyList();
.then(() => { if (isEmpty) {
return this.emptyListText.getText(); return await this.emptyListText.getText();
}); }
} }
getCellsContainingName(name: string) { async getCellsContainingName(name: string) {
return this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)) const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
.map(cell => cell.getText()); return rows.map(async cell => await cell.getText());
}
async hasContextMenu() {
const count = await this.menu.getItemsCount();
return count > 0;
} }
} }
+83
View File
@@ -0,0 +1,83 @@
/*!
* @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 DateTimePicker extends Component {
private static selectors = {
root: '.mat-datetimepicker-popup',
header: '.mat-datetimepicker-calendar-header',
year: '.mat-datetimepicker-calendar-header-year',
date: '.mat-datetimepicker-calendar-header-date',
content: '.mat-datetimepicker-calendar-content',
dayPicker: 'mat-datetimepicker-month-view',
today: '.mat-datetimepicker-calendar-body-today',
firstActiveDay: '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content',
};
calendar: ElementFinder = browser.element(by.css(DateTimePicker.selectors.root));
headerDate: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.date));
headerYear: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.year));
dayPicker: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.dayPicker));
constructor(ancestor?: ElementFinder) {
super(DateTimePicker.selectors.root, ancestor);
}
async waitForDateTimePickerToOpen() {
await browser.wait(EC.presenceOf(this.calendar), BROWSER_WAIT_TIMEOUT);
}
async waitForDateTimePickerToClose() {
await browser.wait(EC.stalenessOf(this.calendar), BROWSER_WAIT_TIMEOUT);
}
async isCalendarOpen() {
return await browser.isElementPresent(by.css(DateTimePicker.selectors.root));
}
async getDate() {
return await this.headerDate.getText();
}
async getYear() {
return await this.headerYear.getText();
}
async setDefaultDay() {
const today = await this.dayPicker.element(by.css(DateTimePicker.selectors.today)).getText();
const tomorrow = (parseInt(today, 10) + 1).toString();
const date = await this.getDate();
const year = await this.getYear();
const elem = this.dayPicker.element(by.cssContainingText(DateTimePicker.selectors.firstActiveDay, tomorrow));
await elem.click();
return `${date} ${year}`;
}
}
+25 -10
View File
@@ -33,21 +33,31 @@ export class ConfirmDialog extends Component {
title: '.mat-dialog-title', title: '.mat-dialog-title',
content: '.mat-dialog-content', content: '.mat-dialog-content',
delete: 'adf-confirm-accept', accept: 'adf-confirm-accept',
keep: 'adf-confirm-cancel' cancel: 'adf-confirm-cancel',
actionButton: 'adf-confirm'
}; };
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title)); title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content)); content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
deleteButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.delete)); acceptButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.accept));
keepButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.keep)); cancelButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.cancel));
actionButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.actionButton));
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(ConfirmDialog.selectors.root, ancestor); super(ConfirmDialog.selectors.root, ancestor);
} }
async waitForDialogToClose() { async waitForDialogToClose() {
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async waitForDialogToOpen() {
await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async isDialogOpen() {
return await browser.isElementPresent(by.css(ConfirmDialog.selectors.root));
} }
async getTitle() { async getTitle() {
@@ -58,12 +68,17 @@ export class ConfirmDialog extends Component {
return await this.content.getText(); return await this.content.getText();
} }
async clickDelete() { getButtonByName(name: string) {
await this.deleteButton.click(); return this.component.element(by.buttonText(name));
} }
async clickKeep() { async clickButton(name: string) {
await this.keepButton.click(); const button = this.getButtonByName(name);
await this.waitForDialogToClose(); await button.click();
}
async isButtonEnabled(name: string) {
const button = this.getButtonByName(name);
return await button.isEnabled();
} }
} }
+124
View File
@@ -0,0 +1,124 @@
import { Utils } from './../../utilities/utils';
/*!
* @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 CopyMoveDialog extends Component {
private static selectors = {
root: '.adf-content-node-selector-dialog',
title: '.mat-dialog-title',
content: '.mat-dialog-content',
locationDropDown: 'site-dropdown-container',
locationOption: '.mat-option .mat-option-text',
dataTable: '.adf-datatable-body',
row: '.adf-datatable-row[role]',
selectedRow: '.is-selected',
button: '.mat-dialog-actions button'
};
title: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.content));
dataTable: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.dataTable));
locationDropDown: ElementFinder = this.component.element(by.id(CopyMoveDialog.selectors.locationDropDown));
locationPersonalFiles: ElementFinder = browser.element(by.cssContainingText(CopyMoveDialog.selectors.locationOption, 'Personal Files'));
locationFileLibraries: ElementFinder = browser.element(by.cssContainingText(CopyMoveDialog.selectors.locationOption, 'File Libraries'));
row: ElementFinder = this.component.element(by.css(CopyMoveDialog.selectors.row));
cancelButton: ElementFinder = this.component.element(by.cssContainingText(CopyMoveDialog.selectors.button, 'Cancel'));
copyButton: ElementFinder = this.component.element(by.cssContainingText(CopyMoveDialog.selectors.button, 'Copy'));
moveButton: ElementFinder = this.component.element(by.cssContainingText(CopyMoveDialog.selectors.button, 'Move'));
constructor(ancestor?: ElementFinder) {
super(CopyMoveDialog.selectors.root, ancestor);
}
async waitForDialogToClose() {
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async waitForDropDownToOpen() {
await browser.wait(EC.presenceOf(this.locationPersonalFiles), BROWSER_WAIT_TIMEOUT);
}
async waitForDropDownToClose() {
await browser.wait(EC.stalenessOf(browser.$(CopyMoveDialog.selectors.locationOption)), BROWSER_WAIT_TIMEOUT);
}
async waitForRowToBeSelected() {
await browser.wait(EC.presenceOf(this.component.element(by.css(CopyMoveDialog.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT);
}
async isDialogOpen() {
return await browser.$(CopyMoveDialog.selectors.root).isDisplayed();
}
async getTitle() {
return await this.title.getText();
}
async clickCancel() {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
async clickCopy() {
await this.copyButton.click();
}
async clickMove() {
await this.moveButton.click();
}
getRow(folderName: string) {
return this.dataTable.element(by.cssContainingText('.adf-name-location-cell', folderName));
}
async selectLocation(location: 'Personal Files' | 'File Libraries') {
await this.locationDropDown.click();
await this.waitForDropDownToOpen();
if (location === 'Personal Files') {
await this.locationPersonalFiles.click();
} else {
await this.locationFileLibraries.click();
}
await this.waitForDropDownToClose();
}
async chooseDestination(folderName: string) {
const row = this.getRow(folderName);
await Utils.waitUntilElementClickable(row);
await row.click();
await this.waitForRowToBeSelected();
}
}
@@ -51,58 +51,53 @@ export class CreateOrEditFolderDialog extends Component {
super(CreateOrEditFolderDialog.selectors.root, ancestor); super(CreateOrEditFolderDialog.selectors.root, ancestor);
} }
waitForDialogToOpen() { async waitForDialogToOpen() {
return browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT) await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT);
.then(() => browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT)); await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT);
} }
waitForDialogToClose() { async waitForDialogToClose() {
return browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
} }
getTitle(): promise.Promise<string> { async getTitle() {
return this.title.getText(); return await this.title.getText();
} }
isValidationMessageDisplayed(): promise.Promise<boolean> { async isValidationMessageDisplayed() {
return this.validationMessage.isDisplayed(); return await this.validationMessage.isDisplayed();
} }
getValidationMessage(): promise.Promise<string> { async getValidationMessage() {
return this.isValidationMessageDisplayed() await this.isValidationMessageDisplayed();
.then(() => this.validationMessage.getText()); return await this.validationMessage.getText();
} }
enterName(name: string) { async enterName(name: string) {
return this.nameInput.clear() await this.nameInput.clear();
// .then(() => this.nameInput.sendKeys(name)); await Utils.typeInField(this.nameInput, name);
.then(() => Utils.typeInField(this.nameInput, name));
} }
enterDescription(description: string) { async enterDescription(description: string) {
return this.descriptionTextArea.clear() await this.descriptionTextArea.clear();
// .then(() => this.descriptionTextArea.sendKeys(description)); await Utils.typeInField(this.descriptionTextArea, description);
.then(() => Utils.typeInField(this.descriptionTextArea, description));
} }
deleteNameWithBackspace(): promise.Promise<void> { async deleteNameWithBackspace() {
return this.nameInput.clear() await this.nameInput.clear();
.then(() => { await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
return this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
});
} }
clickCreate() { async clickCreate() {
return this.createButton.click(); await this.createButton.click();
} }
clickCancel() { async clickCancel() {
return this.cancelButton.click() await this.cancelButton.click();
.then(() => this.waitForDialogToClose()); await this.waitForDialogToClose();
} }
clickUpdate() { async clickUpdate() {
return this.updateButton.click(); await this.updateButton.click();
} }
} }
+67
View File
@@ -0,0 +1,67 @@
/*!
* @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 ManageVersionsDialog extends Component {
private static selectors = {
root: '.aca-node-versions-dialog',
title: '.mat-dialog-title',
content: '.mat-dialog-content',
button: '.mat-button'
};
title: ElementFinder = this.component.element(by.css(ManageVersionsDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(ManageVersionsDialog.selectors.content));
closeButton: ElementFinder = this.component.element(by.cssContainingText(ManageVersionsDialog.selectors.button, 'Close'));
constructor(ancestor?: ElementFinder) {
super(ManageVersionsDialog.selectors.root, ancestor);
}
async waitForDialogToClose() {
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async isDialogOpen() {
return await browser.$(ManageVersionsDialog.selectors.root).isDisplayed();
}
async getTitle() {
return await this.title.getText();
}
async getText() {
return await this.content.getText();
}
async clickClose() {
await this.closeButton.click();
await this.waitForDialogToClose();
}
}
+154
View File
@@ -0,0 +1,154 @@
/*!
* @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, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { DateTimePicker } from '../../components/datetime-picker/datetime-picker';
import { Component } from '../component';
export class ShareDialog extends Component {
private static selectors = {
root: '.adf-share-dialog',
title: `[data-automation-id='adf-share-dialog-title']`,
info: '.adf-share-link__info',
label: '.adf-share-link__label',
shareToggle: `[data-automation-id='adf-share-toggle']`,
linkUrl: `[data-automation-id='adf-share-link']`,
inputAction: '.input-action',
expireToggle: `[data-automation-id='adf-expire-toggle']`,
datetimePickerButton: '.mat-datetimepicker-toggle',
expirationInput: 'input[formcontrolname="time"]',
button: `[data-automation-id='adf-share-dialog-close']`
};
dateTimePicker = new DateTimePicker();
title: ElementFinder = this.component.element(by.css(ShareDialog.selectors.title));
infoText: ElementFinder = this.component.element(by.css(ShareDialog.selectors.info));
labels: ElementArrayFinder = this.component.all(by.css(ShareDialog.selectors.label));
shareToggle: ElementFinder = this.component.element(by.css(ShareDialog.selectors.shareToggle));
url: ElementFinder = this.component.element(by.css(ShareDialog.selectors.linkUrl));
urlAction: ElementFinder = this.component.element(by.css(ShareDialog.selectors.inputAction));
expireToggle: ElementFinder = this.component.element(by.css(ShareDialog.selectors.expireToggle));
expireInput: ElementFinder = this.component.element(by.css(ShareDialog.selectors.expirationInput));
datetimePickerButton: ElementFinder = this.component.element(by.css(ShareDialog.selectors.datetimePickerButton));
closeButton: ElementFinder = this.component.element(by.css(ShareDialog.selectors.button));
constructor(ancestor?: ElementFinder) {
super(ShareDialog.selectors.root, ancestor);
}
async waitForDialogToClose() {
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT, 'share dialog did not close');
}
async waitForDialogToOpen() {
await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT);
}
async isDialogOpen() {
return await browser.isElementPresent(by.css(ShareDialog.selectors.root));
}
async getTitle() {
return await this.title.getText();
}
async getInfoText() {
return await this.infoText.getText();
}
getLabels() {
return this.labels;
}
async getLinkUrl() {
return await this.url.getAttribute('value');
}
async isUrlReadOnly() {
return await this.url.getAttribute('readonly');
}
async clickClose() {
await this.closeButton.click();
await this.waitForDialogToClose();
}
getShareToggle() {
return this.shareToggle;
}
getExpireToggle() {
return this.expireToggle;
}
getExpireInput() {
return this.expireInput;
}
async isShareToggleChecked() {
const toggleClass = await this.getShareToggle().getAttribute('class');
return toggleClass.includes('checked');
}
async isShareToggleDisabled() {
const toggleClass = await this.getShareToggle().getAttribute('class');
return toggleClass.includes('mat-disabled');
}
async isExpireToggleEnabled() {
const toggleClass = await this.getExpireToggle().getAttribute('class');
return toggleClass.includes('checked');
}
async copyUrl() {
return await this.urlAction.click();
}
async openDatetimePicker() {
return await this.datetimePickerButton.click();
}
async closeDatetimePicker() {
if (await this.dateTimePicker.isCalendarOpen()) {
return await this.datetimePickerButton.click();
}
}
async getExpireDate() {
return await this.getExpireInput().getAttribute('value');
}
async clickExpirationToggle() {
await this.expireToggle.click();
}
async clickShareToggle() {
await this.shareToggle.click();
}
}
+21 -8
View File
@@ -23,41 +23,54 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder, by } from 'protractor'; import { ElementFinder, by, browser } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { UserInfo } from './user-info'; import { UserInfo } from './user-info';
import { protractor } from 'protractor'; import { protractor } from 'protractor';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
import { Menu } from '../menu/menu';
import { Toolbar } from './../toolbar/toolbar';
export class Header extends Component { export class Header extends Component {
private locators = { private locators = {
root: 'app-header',
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'), searchButton: by.css('#adf-search-button'),
searchBar: by.css('#adf-control-input') searchBar: by.css('#adf-control-input'),
moreActions: by.id('app.header.more')
}; };
logoLink: ElementFinder = this.component.element(this.locators.logoLink); 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); searchButton: ElementFinder = this.component.element(this.locators.searchButton);
searchBar: ElementFinder = this.component.element(this.locators.searchBar); searchBar: ElementFinder = this.component.element(this.locators.searchBar);
moreActions: ElementFinder = browser.element(this.locators.moreActions);
menu: Menu = new Menu();
toolbar: Toolbar = new Toolbar();
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super('adf-layout-header', ancestor); super('adf-layout-header', ancestor);
} }
searchForText(text: string) { async searchForText(text: string) {
return this.searchBar.clear() await this.searchBar.clear();
.then(() => this.searchBar.sendKeys(text)) await this.searchBar.sendKeys(text);
.then(() => this.searchBar.sendKeys(protractor.Key.ENTER)); await this.searchBar.sendKeys(protractor.Key.ENTER);
} }
async waitForSearchButton() { async waitForSearchButton() {
return await Utils.waitUntilElementClickable(this.searchButton); await Utils.waitUntilElementClickable(this.searchButton);
} }
async waitForSearchBar() { async waitForSearchBar() {
return await Utils.waitUntilElementClickable(this.searchBar); await Utils.waitUntilElementClickable(this.searchBar);
}
async openMoreMenu() {
await this.moreActions.click();
await this.menu.waitForMenuToOpen();
} }
} }
+9 -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, by, promise } from 'protractor'; import { ElementFinder, by } from 'protractor';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
@@ -43,22 +43,20 @@ export class UserInfo extends Component {
super('aca-current-user', ancestor); super('aca-current-user', ancestor);
} }
openMenu(): promise.Promise<Menu> { async openMenu() {
const { menu, avatar } = this; const { menu, avatar } = this;
return avatar.click() await avatar.click();
.then(() => menu.wait()) await menu.wait();
.then(() => menu); return menu;
} }
get name(): promise.Promise<string> { getName() {
return this.fullName.getText(); return this.fullName.getText();
} }
signOut(): promise.Promise<void> { async signOut() {
return this.openMenu() const menu = await this.openMenu();
.then(menu => { await menu.clickMenuItem('Sign out');
menu.clickMenuItem('Sign out');
});
} }
} }
+4 -4
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, protractor, browser, ExpectedConditions as EC } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
@@ -58,7 +58,7 @@ export class InfoDrawer extends Component {
} }
async waitForInfoDrawerToOpen() { async waitForInfoDrawerToOpen() {
return browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT); return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
} }
async isEmpty() { async isEmpty() {
@@ -85,10 +85,10 @@ export class InfoDrawer extends Component {
} }
async clickTab(title: string) { async clickTab(title: string) {
return await this.getTabByTitle(title).click(); await this.getTabByTitle(title).click();
} }
async getComponentIdOfTab(title: string) { async getComponentIdOfTab() {
return await this.tabActiveContent.getAttribute('data-automation-id'); return await this.tabActiveContent.getAttribute('data-automation-id');
} }
} }
+19 -26
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 { by, ElementFinder, promise } from 'protractor'; import { by, ElementFinder } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
export class LoginComponent extends Component { export class LoginComponent extends Component {
@@ -49,57 +49,50 @@ export class LoginComponent extends Component {
super(LoginComponent.selector, ancestor); super(LoginComponent.selector, ancestor);
} }
enterUsername(username: string): LoginComponent { async enterUsername(username: string) {
const { usernameInput } = this; const { usernameInput } = this;
usernameInput.clear(); await usernameInput.clear();
usernameInput.sendKeys(username); await usernameInput.sendKeys(username);
return this;
} }
enterPassword(password: string): LoginComponent { async enterPassword(password: string) {
const { passwordInput } = this; const { passwordInput } = this;
passwordInput.clear(); await passwordInput.clear();
passwordInput.sendKeys(password); await passwordInput.sendKeys(password);
return this;
} }
enterCredentials(username: string, password: string) { async enterCredentials(username: string, password: string) {
this.enterUsername(username).enterPassword(password); await this.enterUsername(username);
await this.enterPassword(password);
return this;
} }
submit(): promise.Promise<void> { submit() {
return this.submitButton.click(); return this.submitButton.click();
} }
getPasswordVisibility() { async getPasswordVisibility() {
return this.passwordVisibility.getText() const text = await this.passwordVisibility.getText();
.then(text => {
if (text.endsWith('visibility_off')) { if (text.endsWith('visibility_off')) {
return false; return false;
} else { }
else {
if (text.endsWith('visibility')) { if (text.endsWith('visibility')) {
return true; return true;
} }
} }
});
} }
isPasswordShown() { async isPasswordShown() {
return this.passwordInput.getAttribute('type') const type = await this.passwordInput.getAttribute('type');
.then(type => {
if (type === 'text') { if (type === 'text') {
return true; return true;
} else { }
else {
if (type === 'password') { if (type === 'password') {
return false; return false;
} }
} }
});
} }
} }
+102 -33
View File
@@ -23,81 +23,150 @@
* 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, browser, ExpectedConditions as EC, promise } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { Utils } from '../../utilities/utils'
export class Menu extends Component { export class Menu extends Component {
private static selectors = { private static selectors = {
root: '.mat-menu-panel', root: '.mat-menu-panel',
item: '.mat-menu-item', item: '.mat-menu-item',
icon: '.mat-icon', icon: '.mat-icon',
uploadFiles: 'app-upload-files' uploadFiles: 'app-upload-files',
submenu: 'app-context-menu-item .mat-menu-item'
}; };
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 = browser.element(by.id(Menu.selectors.uploadFiles)); uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu));
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor); super(Menu.selectors.root, ancestor);
} }
waitForMenuToOpen() { async waitForMenuToOpen() {
return browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT) await 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)) await 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)); await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT);
} }
waitForMenuToClose() { async waitForMenuToClose() {
return browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
} }
closeMenu() { async closeMenu() {
if (this.backdrop.isPresent()) { // if (await this.backdrop.isPresent()) {
return this.backdrop.click(); // return await this.backdrop.click();
} else { // } else {
return browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform(); // return await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
} // }
return Utils.pressEscape();
} }
getNthItem(nth: number): ElementFinder { getNthItem(nth: number) {
return this.items.get(nth - 1); return this.items.get(nth - 1);
} }
getItemByLabel(menuItem: string): ElementFinder { getItemByLabel(menuItem: string) {
return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem)); return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem));
} }
getItemTooltip(menuItem: string): promise.Promise<string> { getSubItemByLabel(subMenuItem: string) {
return this.getItemByLabel(menuItem).getAttribute('title'); return this.component.element(by.cssContainingText(Menu.selectors.submenu, subMenuItem));
} }
getItemIconText(menuItem: string) { getItemById(id: string) {
return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText(); return this.component.element(by.id(id));
} }
getItemsCount(): promise.Promise<number> { async getItemTooltip(menuItem: string) {
return this.items.count(); return await this.getItemByLabel(menuItem).getAttribute('title');
} }
clickNthItem(nth: number): promise.Promise<any> { async getItemIconText(menuItem: string) {
return await this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
}
async getItemIdAttribute(menuItem: string) {
return await this.getItemByLabel(menuItem).getAttribute('id');
}
async getItemsCount() {
return await this.items.count();
}
async clickNthItem(nth: number) {
const elem = this.getNthItem(nth); const elem = this.getNthItem(nth);
return browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT) await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
.then(() => browser.actions().mouseMove(elem).click().perform()) await browser.actions().mouseMove(elem).click().perform();
.then(() => this.waitForMenuToClose()); await this.waitForMenuToClose();
} }
clickMenuItem(menuItem: string): promise.Promise<any> { async clickMenuItem(menuItem: string) {
try {
const elem = this.getItemByLabel(menuItem); const elem = this.getItemByLabel(menuItem);
return browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT) await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
.then(() => elem.click()) await elem.click();
.then(() => this.waitForMenuToClose()); } catch (e) {
console.log('___click menu item catch___', e);
}
} }
isMenuItemPresent(title: string): promise.Promise<boolean> { async mouseOverMenuItem(menuItem: string) {
return this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent(); try {
const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
await browser.actions().mouseMove(elem).perform();
await browser.sleep(500);
} catch (error) {
console.log('----- mouse over error: ', error);
}
}
async hasSubMenu(menuItem: string) {
try {
const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
const elemClass = await elem.getAttribute('class');
return elemClass.includes('mat-menu-item-submenu-trigger');
} catch (error) {
console.log('---- has submenu error: ', error);
}
}
async clickSubMenuItem(subMenuItem: string) {
try {
const elem = this.getSubItemByLabel(subMenuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
await elem.click();
} catch (e) {
console.log('___click submenu item catch___', e);
}
}
async isMenuItemPresent(title: string) {
return await this.component.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
}
async isSubMenuItemPresent(title: string) {
return await browser.element(by.cssContainingText(Menu.selectors.submenu, title)).isPresent();
}
async getSubmenuItemsCount() {
return await this.submenus.count();
}
async isMenuItemDisabled(title: string) {
try {
const item = this.getItemByLabel(title);
const disabled = await item.getAttribute('disabled');
return disabled;
} catch (error) {
console.log('----- isMenuItemDisabled catch: ', error);
}
} }
uploadFile() { uploadFile() {
@@ -0,0 +1,66 @@
/*!
* @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, ElementArrayFinder } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
export class MetadataCard extends Component {
private static selectors = {
root: 'adf-content-metadata-card',
footer: '.adf-content-metadata-card-footer',
expandButton: '[data-automation-id="meta-data-card-toggle-expand"]',
expansionPanel: '.adf-metadata-grouped-properties-container mat-expansion-panel'
};
footer: ElementFinder = this.component.element(by.css(MetadataCard.selectors.footer));
expandButton: ElementFinder = this.component.element(by.css(MetadataCard.selectors.expandButton));
expansionPanels: ElementArrayFinder = this.component.all(by.css(MetadataCard.selectors.expansionPanel));
constructor(ancestor?: ElementFinder) {
super(MetadataCard.selectors.root, ancestor);
}
async isExpandPresent() {
return await this.expandButton.isPresent();
}
async clickExpandButton() {
await this.expandButton.click();
}
async waitForFirstExpansionPanel() {
return await browser.wait(EC.presenceOf(this.expansionPanels.get(0)), BROWSER_WAIT_TIMEOUT);
}
async isExpansionPanelPresent(index) {
return await this.expansionPanels.get(index).isPresent();
}
async getComponentIdOfPanel(index) {
return await this.expansionPanels.get(index).getAttribute('data-automation-id');
}
}
+23 -23
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, promise, by } from 'protractor'; import { ElementFinder, by } from 'protractor';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
@@ -56,43 +56,43 @@ export class Pagination extends Component {
super(Pagination.selectors.root, ancestor); super(Pagination.selectors.root, ancestor);
} }
openMaxItemsMenu(): promise.Promise<Menu> { async openMaxItemsMenu() {
const { menu, maxItemsButton } = this; const { menu, maxItemsButton } = this;
return maxItemsButton.click() await maxItemsButton.click();
.then(() => menu.waitForMenuToOpen()) await menu.waitForMenuToOpen();
.then(() => menu); // return menu;
} }
openCurrentPageMenu(): promise.Promise<Menu> { async openCurrentPageMenu() {
const { menu, pagesButton } = this; const { menu, pagesButton } = this;
return pagesButton.click() await pagesButton.click();
.then(() => menu.waitForMenuToOpen()) await menu.waitForMenuToOpen();
.then(() => menu); // return menu;
} }
getText(elem: ElementFinder) { async getText(elem: ElementFinder) {
return elem.getText(); return await elem.getText();
} }
resetToDefaultPageSize(): promise.Promise<any> { async resetToDefaultPageSize() {
return this.openMaxItemsMenu() await this.openMaxItemsMenu();
.then(menu => menu.clickMenuItem('25')) await this.menu.clickMenuItem('25');
.then(() => this.menu.waitForMenuToClose()); await this.menu.waitForMenuToClose();
} }
resetToDefaultPageNumber(): promise.Promise<any> { async resetToDefaultPageNumber() {
return this.openCurrentPageMenu() await this.openCurrentPageMenu();
.then(menu => menu.clickMenuItem('1')) await this.menu.clickMenuItem('1');
.then(() => this.menu.waitForMenuToClose()); await this.menu.waitForMenuToClose();
} }
clickNext(): promise.Promise<any> { async clickNext() {
return this.nextButton.click(); await this.nextButton.click();
} }
clickPrevious(): promise.Promise<any> { async clickPrevious() {
return this.previousButton.click(); await this.previousButton.click();
} }
} }
+26 -18
View File
@@ -23,9 +23,10 @@
* 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 } from 'protractor';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { Utils } from '../../utilities/utils';
export class Sidenav extends Component { export class Sidenav extends Component {
private static selectors = { private static selectors = {
@@ -33,7 +34,7 @@ export class Sidenav extends Component {
link: '.sidenav-menu__item', link: '.sidenav-menu__item',
label: '.menu__item--label', label: '.menu__item--label',
activeLink: '.menu__item--active', activeLink: '.menu__item--active',
newButton: '.adf-sidebar-action-menu-button' newButton: '[data-automation-id="create-button"]'
}; };
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link)); links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
@@ -46,37 +47,44 @@ export class Sidenav extends Component {
super(Sidenav.selectors.root, ancestor); super(Sidenav.selectors.root, ancestor);
} }
openNewMenu(): promise.Promise<Menu> { async openNewMenu() {
const { menu, newButton } = this; const { menu, newButton } = this;
return newButton.click() await newButton.click();
.then(() => menu.waitForMenuToOpen()) await menu.waitForMenuToOpen();
.then(() => menu);
} }
openCreateDialog(): any { async openCreateDialog() {
return this.openNewMenu() await this.openNewMenu();
.then(() => this.menu.clickMenuItem('Create folder')); await this.menu.clickMenuItem('Create folder');
} }
isActiveByLabel(label: string): promise.Promise<boolean> { async isActiveByLabel(label: string) {
return this.getLinkByLabel(label).getAttribute('class') const className = await this.getLinkByLabel(label).getAttribute('class');
.then(className => className.includes(Sidenav.selectors.activeLink.replace('.', ''))); return className.includes(Sidenav.selectors.activeLink.replace('.', ''));
} }
getLink(label: string): ElementFinder { getLink(label: string) {
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label)); return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
} }
getLinkByLabel(label: string): ElementFinder { getLinkByLabel(label: string) {
return this.component.element(by.cssContainingText(Sidenav.selectors.label, label)); return this.component.element(by.cssContainingText(Sidenav.selectors.label, label));
// return browser.element(by.xpath(`.//*[.="${label}" and class="${Sidenav.selectors.label}"]`))
} }
getLinkTooltip(label: string): promise.Promise<string> { async getLinkTooltip(label: string) {
return this.getLink(label).getAttribute('title'); return await this.getLink(label).getAttribute('title');
} }
navigateToLinkByLabel(label: string): promise.Promise<any> { async navigateToLinkByLabel(label: string) {
return this.getLinkByLabel(label).click(); try{
const link = this.getLinkByLabel(label);
await Utils.waitUntilElementClickable(link);
return await link.click();
} catch (e){
console.log('---- sidebar navigation catch : ', e);
}
} }
} }
-73
View File
@@ -1,73 +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 { ElementFinder, ElementArrayFinder, by, promise, protractor, browser } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
export class ToolbarActions extends Component {
private static selectors = {
root: 'adf-toolbar',
button: '.mat-icon-button'
};
menu: Menu = new Menu();
buttons: ElementArrayFinder = this.component.all(by.css(ToolbarActions.selectors.button));
constructor(ancestor?: ElementFinder) {
super(ToolbarActions.selectors.root, ancestor);
}
async isEmpty() {
return await this.buttons.count() === 0;
}
async isButtonPresent(title: string) {
return await this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`)).isPresent();
}
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(ToolbarActions.selectors.button, label));
}
getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${ToolbarActions.selectors.button}[title="${title}"]`));
}
async openMoreMenu() {
await this.getButtonByTitleAttribute('More actions').click();
await this.menu.waitForMenuToOpen();
return this.menu;
}
async closeMoreMenu() {
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
}
@@ -1,82 +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 { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
import { Component } from '../component';
export class ToolbarBreadcrumb extends Component {
private static selectors = {
root: 'adf-breadcrumb',
item: '.adf-breadcrumb-item',
currentItem: '.adf-breadcrumb-item-current'
};
items: ElementArrayFinder = this.component.all(by.css(ToolbarBreadcrumb.selectors.item));
currentItem: ElementFinder = this.component.element(by.css(ToolbarBreadcrumb.selectors.currentItem));
constructor(ancestor?: ElementFinder) {
super(ToolbarBreadcrumb.selectors.root, ancestor);
}
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
getNthItemName(nth: number) {
return this.getNthItem(nth).getText();
}
getItemsCount(): promise.Promise<number> {
return this.items.count();
}
getAllItems() {
return this.items.map(elem => elem.getText().then(str => str.split('\nchevron_right')[0]));
}
getFirstItemName(): promise.Promise<string> {
return this.items.get(0).getText();
}
getCurrentItem() {
return this.currentItem;
}
getCurrentItemName(): promise.Promise<string> {
return this.currentItem.getText();
}
clickItem(name: string) {
return this.component.element(by.css(`${ToolbarBreadcrumb.selectors.item}[title=${name}]`)).click();
}
clickNthItem(nth: number) {
return this.getNthItem(nth).click();
}
getNthItemTooltip(nth: number) {
return this.getNthItem(nth).getAttribute('title');
}
}
+48 -6
View File
@@ -23,20 +23,62 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ElementFinder } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, protractor, browser } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { ToolbarActions } from './toolbar-actions';
import { ToolbarBreadcrumb } from './toolbar-breadcrumb';
export class Toolbar extends Component { export class Toolbar extends Component {
private static selectors = { private static selectors = {
root: '.inner-layout__header' root: '.adf-toolbar',
button: '.mat-icon-button'
}; };
actions: ToolbarActions = new ToolbarActions(this.component); menu: Menu = new Menu();
breadcrumb: ToolbarBreadcrumb = new ToolbarBreadcrumb(this.component); buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button));
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(Toolbar.selectors.root, ancestor); super(Toolbar.selectors.root, ancestor);
} }
async isEmpty() {
const count = await this.buttons.count();
return count === 0;
}
async isButtonPresent(title: string) {
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
return await elem.isPresent();
}
getButtonByLabel(label: string) {
return this.component.element(by.cssContainingText(Toolbar.selectors.button, label));
}
getButtonByTitleAttribute(title: string) {
return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
}
getButtonById(id: string) {
return this.component.element(by.id(id));
}
async openMoreMenu() {
await this.isButtonPresent('More actions');
const moreMenu = this.getButtonByTitleAttribute('More actions');
await moreMenu.click();
await this.menu.waitForMenuToOpen();
}
async closeMoreMenu() {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
}
async getButtonTooltip(button: ElementFinder) {
return await button.getAttribute('title');
}
async clickButton(title: string) {
const btn = this.getButtonByTitleAttribute(title);
await btn.click();
}
} }
+6 -5
View File
@@ -26,7 +26,7 @@
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { ToolbarActions } from '../toolbar/toolbar-actions'; import { Toolbar } from '../toolbar/toolbar';
export class Viewer extends Component { export class Viewer extends Component {
private static selectors = { private static selectors = {
@@ -40,25 +40,26 @@ export class Viewer extends Component {
viewerExtensionContent: 'app-preview-extension' viewerExtensionContent: 'app-preview-extension'
}; };
root: ElementFinder = browser.$(Viewer.selectors.root);
viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout)); viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout));
viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer)); viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer));
closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn)); closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn));
fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle)); fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle));
viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent)); viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent));
toolbar = new ToolbarActions(this.component); toolbar = new Toolbar(this.component);
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(Viewer.selectors.root, ancestor); super(Viewer.selectors.root, ancestor);
} }
async waitForViewerToOpen() { async waitForViewerToOpen() {
return await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT) await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
.catch(err => err);
} }
async isViewerOpened() { async isViewerOpened() {
return await browser.isElementPresent(this.viewerLayout); return await browser.isElementPresent(this.viewerLayout);
// return await this.viewerLayout.isPresent();
} }
async isViewerContentDisplayed() { async isViewerContentDisplayed() {
@@ -78,7 +79,7 @@ export class Viewer extends Component {
} }
async clickClose() { async clickClose() {
return await this.closeButton.click(); await this.closeButton.click();
} }
async getCloseButtonTooltip() { async getCloseButtonTooltip() {
+6 -2
View File
@@ -29,7 +29,7 @@ export const BROWSER_RESOLUTION_HEIGHT = 800;
export const BROWSER_WAIT_TIMEOUT = 10000; export const BROWSER_WAIT_TIMEOUT = 10000;
// Application configs // Application configs
export const APP_HOST = 'http://localhost:4000'; export const USE_HASH_STRATEGY = true;
// Repository configs // Repository configs
export const REPO_API_HOST = 'http://localhost:8080'; export const REPO_API_HOST = 'http://localhost:8080';
@@ -96,5 +96,9 @@ export const EXTENSIBILITY_CONFIGS = {
DEFAULT_EXTENSIONS_CONFIG: 'extensions-default.json', DEFAULT_EXTENSIONS_CONFIG: 'extensions-default.json',
INFO_DRAWER: 'info-drawer-ext.json', INFO_DRAWER: 'info-drawer-ext.json',
INFO_DRAWER_EMPTY: 'info-drawer-no-tabs-ext.json', INFO_DRAWER_EMPTY: 'info-drawer-no-tabs-ext.json',
VIEWER: 'viewer-ext.json' VIEWER: 'viewer-ext.json',
HEADER: 'header-ext.json',
METADATA_PRESETS: 'metadata-ext.json',
DOCUMENT_LIST_PRESETS: 'document-presets-ext.json',
CONTEXT_SUBMENUS: 'context-submenus-ext.json'
}; };
+4 -3
View File
@@ -24,17 +24,18 @@
*/ */
import { promise } from 'protractor'; import { promise } from 'protractor';
import { Header, DataTable, Pagination, Toolbar, Sidenav } from '../components/components'; import { Header, DataTable, Pagination, Toolbar, Breadcrumb, Sidenav } from '../components/components';
import { Page } from './page'; import { Page } from './page';
export class BrowsingPage extends Page { export class BrowsingPage extends Page {
header = new Header(this.app); header = new Header(this.app);
sidenav = new Sidenav(this.app); sidenav = new Sidenav(this.app);
toolbar = new Toolbar(this.app); toolbar = new Toolbar(this.app);
breadcrumb = new Breadcrumb(this.app);
dataTable = new DataTable(this.app); dataTable = new DataTable(this.app);
pagination = new Pagination(this.app); pagination = new Pagination(this.app);
signOut(): promise.Promise<void> { async signOut() {
return this.header.userInfo.signOut(); await this.header.userInfo.signOut();
} }
} }
+18 -26
View File
@@ -22,17 +22,11 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, ExpectedConditions as EC, promise } from 'protractor'; import { browser, ExpectedConditions as EC } from 'protractor';
import { LoginComponent } from '../components/components'; import { LoginComponent } from '../components/components';
import { Page } from './page'; import { Page } from './page';
import { Utils } from '../utilities/utils';
import { import { ADMIN_USERNAME, ADMIN_PASSWORD, BROWSER_WAIT_TIMEOUT, APP_ROUTES } from '../configs';
ADMIN_USERNAME,
ADMIN_PASSWORD,
BROWSER_WAIT_TIMEOUT,
APP_ROUTES
} from '../configs';
export class LoginPage extends Page { export class LoginPage extends Page {
login: LoginComponent = new LoginComponent(this.app); login: LoginComponent = new LoginComponent(this.app);
@@ -43,33 +37,31 @@ export class LoginPage extends Page {
} }
/** @override */ /** @override */
load(): promise.Promise<any> { async load() {
return super.load().then(() => { await super.load();
const { submitButton } = this.login; const { submitButton } = this.login;
const hasSubmitButton = EC.presenceOf(submitButton); const hasSubmitButton = EC.presenceOf(submitButton);
return browser.wait(hasSubmitButton, BROWSER_WAIT_TIMEOUT);
return browser.wait(hasSubmitButton, BROWSER_WAIT_TIMEOUT)
.then(() => Utils.clearLocalStorage())
.then(() => browser.manage().deleteAllCookies());
});
} }
loginWith(username: string, password?: string): promise.Promise<any> { async loginWith(username: string, password?: string) {
const pass = password || username; const pass = password || username;
return this.load() await this.load();
.then(() => this.login.enterCredentials(username, pass).submit()) await this.login.enterCredentials(username, pass)
.then(() => super.waitForApp()); await this.login.submit();
return super.waitForApp();
} }
loginWithAdmin(): promise.Promise<any> { async loginWithAdmin() {
return this.load() await this.load();
.then(() => this.loginWith(ADMIN_USERNAME, ADMIN_PASSWORD)); return this.loginWith(ADMIN_USERNAME, ADMIN_PASSWORD);
} }
tryLoginWith(username: string, password?: string): promise.Promise<void> { async tryLoginWith(username: string, password?: string) {
const pass = password || username; const pass = password || username;
return this.load() await this.load();
.then(() => this.login.enterCredentials(username, pass).submit()) await this.login.enterCredentials(username, pass);
.then(() => browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT)); await this.login.submit();
return browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT);
} }
} }
+4 -5
View File
@@ -23,7 +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 { promise } from 'protractor';
import { Page } from './page'; import { Page } from './page';
import { APP_ROUTES } from '../configs'; import { APP_ROUTES } from '../configs';
import { Utils } from '../utilities/utils'; import { Utils } from '../utilities/utils';
@@ -35,9 +34,9 @@ export class LogoutPage extends Page {
} }
/** @override */ /** @override */
load(): promise.Promise<any> { load() {
return Utils.clearLocalStorage() // await Utils.clearLocalStorage();
.then(() => Utils.clearSessionStorage()) // await Utils.clearSessionStorage();
.then(() => super.load()); return super.load();
} }
} }
+53 -33
View File
@@ -23,12 +23,16 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, element, by, ElementFinder, promise, ExpectedConditions as EC } from 'protractor'; import {
import { BROWSER_WAIT_TIMEOUT } from './../configs'; browser,
element,
by,
ElementFinder,
ExpectedConditions as EC
} from 'protractor';
import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs';
export abstract class Page { export abstract class Page {
private static USE_HASH_STRATEGY = true;
private locators = { private locators = {
app: by.css('app-root'), app: by.css('app-root'),
layout: by.css('app-layout'), layout: by.css('app-layout'),
@@ -36,7 +40,11 @@ export abstract class Page {
dialogContainer: by.css('.mat-dialog-container'), dialogContainer: by.css('.mat-dialog-container'),
snackBarContainer: '.cdk-overlay-pane .mat-snack-bar-container', snackBarContainer: '.cdk-overlay-pane .mat-snack-bar-container',
snackBar: '.mat-simple-snackbar', snackBar: '.mat-simple-snackbar',
snackBarAction: '.mat-simple-snackbar-action button' snackBarAction: '.mat-simple-snackbar-action button',
genericError: 'aca-generic-error',
genericErrorIcon: 'aca-generic-error .mat-icon',
genericErrorTitle: '.generic-error__title'
}; };
public app: ElementFinder = element(this.locators.app); public app: ElementFinder = element(this.locators.app);
@@ -47,16 +55,19 @@ export abstract class Page {
snackBarContainer: ElementFinder = browser.$(this.locators.snackBarContainer); snackBarContainer: ElementFinder = browser.$(this.locators.snackBarContainer);
snackBarAction: ElementFinder = browser.$(this.locators.snackBarAction); snackBarAction: ElementFinder = browser.$(this.locators.snackBarAction);
genericError: ElementFinder = browser.$(this.locators.genericError);
genericErrorIcon: ElementFinder = browser.$(this.locators.genericErrorIcon);
genericErrorTitle: ElementFinder = browser.$(this.locators.genericErrorTitle);
constructor(public url: string = '') {} constructor(public url: string = '') {}
get title(): promise.Promise<string> { getTitle() {
return browser.getTitle(); return browser.getTitle();
} }
load(relativeUrl: string = ''): promise.Promise<void> { load(relativeUrl: string = '') {
const hash = Page.USE_HASH_STRATEGY ? '/#' : ''; const hash = USE_HASH_STRATEGY ? '/#' : '';
const path = `${hash}${this.url}${relativeUrl}`; const path = `${browser.baseUrl}${hash}${this.url}${relativeUrl}`;
return browser.get(path); return browser.get(path);
} }
@@ -68,46 +79,55 @@ export abstract class Page {
return browser.wait(EC.visibilityOf(this.snackBarContainer), BROWSER_WAIT_TIMEOUT); return browser.wait(EC.visibilityOf(this.snackBarContainer), BROWSER_WAIT_TIMEOUT);
} }
waitForSnackBarToClose() { async waitForSnackBarToClose() {
return browser.wait(EC.not(EC.visibilityOf(this.snackBarContainer)), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.not(EC.visibilityOf(this.snackBarContainer)), BROWSER_WAIT_TIMEOUT);
} }
waitForDialog() { async waitForDialog() {
return browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT);
} }
waitForDialogToClose() { async waitForDialogToClose() {
return browser.wait(EC.not(EC.visibilityOf(this.dialogContainer)), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.not(EC.visibilityOf(this.dialogContainer)), BROWSER_WAIT_TIMEOUT);
} }
refresh(): promise.Promise<void> { async refresh() {
return browser.refresh(); await browser.refresh();
await this.waitForApp();
} }
getDialogActionByLabel(label) { getDialogActionByLabel(label) {
return element(by.cssContainingText('.mat-button-wrapper', label)); return element(by.cssContainingText('.mat-button-wrapper', label));
} }
isSnackBarDisplayed(): promise.Promise<boolean> { async isSnackBarDisplayed() {
return this.snackBar.isDisplayed(); return await this.snackBar.isDisplayed();
} }
getSnackBarMessage(): promise.Promise<string> { async getSnackBarMessage() {
return this.waitForSnackBarToAppear() await this.waitForSnackBarToAppear();
.then(() => this.snackBar.getAttribute('innerText')); return await this.snackBar.getAttribute('innerText');
} }
getSnackBarAction() { async clickSnackBarAction() {
return this.waitForSnackBarToAppear() try {
.then(() => this.snackBarAction);
// await this.waitForSnackBarToAppear();
// return browser.executeScript(function (elem) {
// elem.click();
// }, this.snackBarAction);
return await this.snackBarAction.click();
} catch (e) {
console.log(e, '.......failed on click snack bar action.........');
}
} }
clickSnackBarAction() { async isGenericErrorDisplayed() {
return this.waitForSnackBarToAppear() return await this.genericError.isDisplayed();
.then(() => { }
return browser.executeScript(function (elem) {
elem.click(); async getGenericErrorTitle() {
}, this.snackBarAction); return await this.genericErrorTitle.getText();
});
} }
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -2,11 +2,7 @@
"$schema": "../../extension.schema.json", "$schema": "../../extension.schema.json",
"$name": "app", "$name": "app",
"$version": "1.0.0", "$version": "1.0.0",
"$references": [ "$references": ["plugin1.json", "dev.tools.json", "app.header.json"],
"plugin1.json",
"plugin2.json",
"dev.tools.json"
],
"rules": [ "rules": [
{ {
@@ -28,7 +24,8 @@
"parameters": [ "parameters": [
{ "type": "rule", "value": "app.navigation.isRecentFiles" }, { "type": "rule", "value": "app.navigation.isRecentFiles" },
{ "type": "rule", "value": "app.navigation.isSharedFiles" }, { "type": "rule", "value": "app.navigation.isSharedFiles" },
{ "type": "rule", "value": "app.navigation.isSearchResults" } { "type": "rule", "value": "app.navigation.isSearchResults" },
{ "type": "rule", "value": "app.navigation.isFavorites" }
] ]
} }
] ]
@@ -40,7 +37,8 @@
{ "type": "rule", "value": "app.selection.canAddFavorite" }, { "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" }, { "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" }, { "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" } { "type": "rule", "value": "app.navigation.isNotSearchResults" },
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
] ]
}, },
{ {
@@ -50,7 +48,8 @@
{ "type": "rule", "value": "app.selection.canRemoveFavorite" }, { "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" }, { "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" }, { "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isNotSearchResults" } { "type": "rule", "value": "app.navigation.isNotSearchResults" },
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
] ]
}, },
{ {
@@ -75,7 +74,6 @@
"id": "app.toolbar.permissions", "id": "app.toolbar.permissions",
"type": "core.every", "type": "core.every",
"parameters": [ "parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.selection.first.canUpdate" }, { "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" } { "type": "rule", "value": "app.navigation.isNotTrashcan" }
] ]
@@ -628,7 +626,57 @@
} }
], ],
"viewer": { "viewer": {
"toolbar": [ "toolbarActions": [
{
"id": "app.toolbar.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.viewer.print",
"order": 200,
"title": "APP.ACTIONS.PRINT",
"icon": "print",
"actions": {
"click": "PRINT_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.fullscreen",
"order": 400,
"title": "APP.ACTIONS.FULLSCREEN",
"icon": "fullscreen",
"actions": {
"click": "FULLSCREEN_VIEWER"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
}
],
"toolbarMoreMenu": [
{ {
"id": "app.viewer.favorite.add", "id": "app.viewer.favorite.add",
"order": 100, "order": 100,
@@ -653,6 +701,16 @@
"visible": "app.toolbar.favorite.canRemove" "visible": "app.toolbar.favorite.canRemove"
} }
}, },
{
"id": "app.viewer.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 101,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{ {
"id": "app.viewer.share", "id": "app.viewer.share",
"order": 300, "order": 300,
@@ -763,4 +821,4 @@
} }
] ]
} }
} }
@@ -0,0 +1,927 @@
{
"$schema": "../../extension.schema.json",
"$name": "app",
"$version": "1.0.0",
"$references": [
"plugin1.json",
"dev.tools.json",
"app.header.json",
"app.create.json",
"metadata-plugin.json"
],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{
"type": "rule",
"value": "app.selection.canAddFavorite"
},
{
"type": "rule",
"value": "app.selection.canRemoveFavorite"
}
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{
"type": "rule",
"value": "app.navigation.isRecentFiles"
},
{
"type": "rule",
"value": "app.navigation.isSharedFiles"
},
{
"type": "rule",
"value": "app.navigation.isSearchResults"
},
{
"type": "rule",
"value": "app.navigation.isFavorites"
}
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{
"type": "rule",
"value": "app.navigation.isNotSearchResults"
},
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
]
},
{
"id": "app.toolbar.favorite.canRemove",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{
"type": "rule",
"value": "app.navigation.isNotSearchResults"
},
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
}
],
"features": {
"create": [
{
"id": "app.create.uploadFile",
"order": 100,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FILES"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.uploadFolder",
"order": 200,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.separator.1",
"type": "separator",
"order": 300
},
{
"id": "app.create.folder",
"order": 400,
"icon": "create_new_folder",
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
"actions": {
"click": "CREATE_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canCreate"
}
},
{
"id": "app.create.library",
"order": 600,
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_LIBRARY",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_LIBRARY",
"icon": "create_new_folder",
"actions": {
"click": "CREATE_LIBRARY"
}
}
],
"navbar": [
{
"id": "app.navbar.primary",
"items": [
{
"id": "app.navbar.personalFiles",
"order": 100,
"icon": "folder",
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
"route": "personal-files"
},
{
"id": "app.navbar.libraries",
"order": 200,
"icon": "group_work",
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
"route": "libraries"
}
]
},
{
"id": "app.navbar.secondary",
"items": [
{
"id": "app.navbar.shared",
"order": 100,
"icon": "people",
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
"route": "shared",
"rules": {
"visible": "repository.isQuickShareEnabled"
}
},
{
"id": "app.navbar.recentFiles",
"order": 200,
"icon": "schedule",
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
"route": "recent-files"
},
{
"id": "app.navbar.favorites",
"order": 300,
"icon": "star",
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
"route": "favorites"
},
{
"id": "app.navbar.trashcan",
"order": 400,
"icon": "delete",
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
"route": "trashcan"
}
]
}
],
"toolbar": [
{
"id": "app.toolbar.preview",
"order": 100,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.toolbar.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.toolbar.purgeDeletedNodes",
"order": 400,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.restoreDeletedNodes",
"order": 500,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.info",
"type": "custom",
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{
"id": "app.toolbar.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "app.toolbar.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 100,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.favorite.add",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.toolbar.favorite.remove",
"order": 300,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.toolbar.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.toolbar.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"order": 600,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.toolbar.unshare",
"order": 700,
"title": "APP.ACTIONS.UNSHARE",
"icon": "stop_screen_share",
"actions": {
"click": "UNSHARE_NODES"
},
"rules": {
"visible": "app.selection.canUnshare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.deleteLibrary",
"order": 900,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.selection.library"
}
},
{
"id": "app.toolbar.versions",
"order": 1000,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.toolbar.permissions",
"order": 1100,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
]
}
],
"contextMenu": [
{
"id": "app.context.menu.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.context.menu.preview",
"order": 200,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"title": "APP.ACTIONS.SHARE",
"order": 400,
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
"order": 500,
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.context.menu.favorite.remove",
"title": "APP.ACTIONS.FAVORITE",
"order": 600,
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.context.menu.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 501,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.context.menu.move",
"title": "APP.ACTIONS.MOVE",
"order": 800,
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.delete",
"title": "APP.ACTIONS.DELETE",
"order": 900,
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
"order": 1000,
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"order": 1100,
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
},
{
"id": "app.context.menu.purgeDeletedNodes",
"order": 1200,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.context.menu.restoreDeletedNodes",
"order": 1300,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
}
],
"viewer": {
"toolbarActions": [
{
"id": "app.toolbar.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.viewer.print",
"order": 200,
"title": "APP.ACTIONS.PRINT",
"icon": "print",
"actions": {
"click": "PRINT_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.fullscreen",
"order": 400,
"title": "APP.ACTIONS.FULLSCREEN",
"icon": "fullscreen",
"actions": {
"click": "FULLSCREEN_VIEWER"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
}
],
"toolbarMoreMenu": [
{
"id": "app.viewer.favorite.add",
"order": 100,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.viewer.favorite.remove",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.viewer.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 101,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.viewer.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.delete",
"order": 600,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.versions",
"order": 700,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.viewer.permissions",
"order": 800,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
],
"content": [
{
"id": "app.viewer.pdf",
"disabled": true,
"fileExtension": "pdf",
"component": "app.components.tabs.metadata"
},
{
"id": "app.viewer.docx",
"disabled": true,
"fileExtension": "docx",
"component": "app.components.tabs.comments"
}
]
},
"sidebar": [
{
"id": "app.sidebar.properties",
"order": 100,
"title": "APP.INFO_DRAWER.TABS.PROPERTIES",
"component": "app.components.tabs.metadata"
},
{
"id": "app.sidebar.comments",
"order": 200,
"title": "APP.INFO_DRAWER.TABS.COMMENTS",
"component": "app.components.tabs.comments"
},
{
"id": "app.sidebar.versions",
"order": 300,
"disabled": true,
"title": "APP.INFO_DRAWER.TABS.VERSIONS",
"component": "app.components.tabs.versions"
}
],
"content-metadata-presets": [
{
"id": "app.content.metadata.custom",
"custom": [
{
"id": "app.content.metadata.customGroup",
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
"items": [
{
"id": "app.content.metadata.exifAspect",
"aspect": "exif:exif",
"properties": [
"exif:pixelXDimension",
"exif:pixelYDimension",
"exif:dateTimeOriginal",
"exif:exposureTime",
"exif:fNumber",
"exif:flash",
"exif:focalLength",
"exif:isoSpeedRatings",
"exif:orientation",
"exif:manufacturer",
"exif:model",
"exif:software"
]
}
]
}
]
}
],
"header": [
{
"id": "app.header.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "settings",
"title": "App settings",
"description": "Application settings",
"icon": "settings",
"disabled": true,
"actions": {
"click": "app.actions.settings"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "button",
"title": "New Button",
"description": "new button description",
"icon": "alarm_on",
"actions": {
"click": "app.actions.settings"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
}
]
}
]
}
}
@@ -0,0 +1,920 @@
{
"$schema": "../../extension.schema.json",
"$name": "app",
"$version": "1.0.0",
"$references": [
"plugin1.json",
"dev.tools.json",
"app.header.json",
"app.create.json"
],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{
"type": "rule",
"value": "app.selection.canAddFavorite"
},
{
"type": "rule",
"value": "app.selection.canRemoveFavorite"
}
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{
"type": "rule",
"value": "app.navigation.isRecentFiles"
},
{
"type": "rule",
"value": "app.navigation.isSharedFiles"
},
{
"type": "rule",
"value": "app.navigation.isSearchResults"
},
{
"type": "rule",
"value": "app.navigation.isFavorites"
}
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{
"type": "rule",
"value": "app.navigation.isNotSearchResults"
},
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
]
},
{
"id": "app.toolbar.favorite.canRemove",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{
"type": "rule",
"value": "app.navigation.isNotSearchResults"
},
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
}
],
"features": {
"create": [
{
"id": "app.create.uploadFile",
"order": 100,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FILES"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.uploadFolder",
"order": 200,
"icon": "file_upload",
"title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED",
"actions": {
"click": "UPLOAD_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canUpload"
}
},
{
"id": "app.create.separator.1",
"type": "separator",
"order": 300
},
{
"id": "app.create.folder",
"order": 400,
"icon": "create_new_folder",
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER",
"description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED",
"actions": {
"click": "CREATE_FOLDER"
},
"rules": {
"enabled": "app.navigation.folder.canCreate"
}
},
{
"id": "app.create.library",
"order": 600,
"title": "APP.NEW_MENU.MENU_ITEMS.CREATE_LIBRARY",
"description": "APP.NEW_MENU.TOOLTIPS.CREATE_LIBRARY",
"icon": "create_new_folder",
"actions": {
"click": "CREATE_LIBRARY"
}
}
],
"navbar": [
{
"id": "app.navbar.primary",
"items": [
{
"id": "app.navbar.personalFiles",
"order": 100,
"icon": "folder",
"title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP",
"route": "personal-files"
},
{
"id": "app.navbar.libraries",
"order": 200,
"icon": "group_work",
"title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP",
"route": "libraries"
}
]
},
{
"id": "app.navbar.secondary",
"items": [
{
"id": "app.navbar.shared",
"order": 100,
"icon": "people",
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
"route": "shared",
"rules": {
"visible": "repository.isQuickShareEnabled"
}
},
{
"id": "app.navbar.recentFiles",
"order": 200,
"icon": "schedule",
"title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP",
"route": "recent-files"
},
{
"id": "app.navbar.favorites",
"order": 300,
"icon": "star",
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
"route": "favorites"
},
{
"id": "app.navbar.trashcan",
"order": 400,
"icon": "delete",
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
"route": "trashcan"
}
]
}
],
"toolbar": [
{
"id": "app.toolbar.preview",
"order": 100,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.toolbar.download",
"order": 200,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.toolbar.purgeDeletedNodes",
"order": 400,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.restoreDeletedNodes",
"order": 500,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.toolbar.info",
"type": "custom",
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{
"id": "app.toolbar.more",
"type": "menu",
"order": 10000,
"icon": "more_vert",
"title": "APP.ACTIONS.MORE",
"children": [
{
"id": "app.toolbar.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 100,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.favorite.add",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.toolbar.favorite.remove",
"order": 300,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.toolbar.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.toolbar.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.share",
"order": 600,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.toolbar.unshare",
"order": 700,
"title": "APP.ACTIONS.UNSHARE",
"icon": "stop_screen_share",
"actions": {
"click": "UNSHARE_NODES"
},
"rules": {
"visible": "app.selection.canUnshare"
}
},
{
"id": "app.toolbar.delete",
"order": 800,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.toolbar.deleteLibrary",
"order": 900,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.selection.library"
}
},
{
"id": "app.toolbar.versions",
"order": 1000,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.toolbar.permissions",
"order": 1100,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
]
}
],
"contextMenu": [
{
"id": "app.context.menu.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.context.menu.preview",
"order": 200,
"title": "APP.ACTIONS.VIEW",
"icon": "open_in_browser",
"actions": {
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.context.menu.editFolder",
"order": 300,
"title": "APP.ACTIONS.EDIT",
"icon": "create",
"actions": {
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
}
},
{
"id": "app.context.menu.share",
"title": "APP.ACTIONS.SHARE",
"order": 400,
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.context.menu.favorite.add",
"title": "APP.ACTIONS.FAVORITE",
"order": 500,
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.context.menu.favorite.remove",
"title": "APP.ACTIONS.FAVORITE",
"order": 600,
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.context.menu.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 501,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.context.menu.copy",
"title": "APP.ACTIONS.COPY",
"order": 700,
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.context.menu.move",
"title": "APP.ACTIONS.MOVE",
"order": 800,
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.delete",
"title": "APP.ACTIONS.DELETE",
"order": 900,
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.context.menu.versions",
"title": "APP.ACTIONS.VERSIONS",
"order": 1000,
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"order": 1100,
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
},
{
"id": "app.context.menu.purgeDeletedNodes",
"order": 1200,
"title": "APP.ACTIONS.DELETE_PERMANENT",
"icon": "delete_forever",
"actions": {
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
},
{
"id": "app.context.menu.restoreDeletedNodes",
"order": 1300,
"title": "APP.ACTIONS.RESTORE",
"icon": "restore",
"actions": {
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
}
}
],
"viewer": {
"toolbarActions": [
{
"id": "app.toolbar.download",
"order": 100,
"title": "APP.ACTIONS.DOWNLOAD",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.viewer.print",
"order": 200,
"title": "APP.ACTIONS.PRINT",
"icon": "print",
"actions": {
"click": "PRINT_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.fullscreen",
"order": 400,
"title": "APP.ACTIONS.FULLSCREEN",
"icon": "fullscreen",
"actions": {
"click": "FULLSCREEN_VIEWER"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
}
],
"toolbarMoreMenu": [
{
"id": "app.viewer.favorite.add",
"order": 100,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star_border",
"actions": {
"click": "ADD_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canAdd"
}
},
{
"id": "app.viewer.favorite.remove",
"order": 200,
"title": "APP.ACTIONS.FAVORITE",
"icon": "star",
"actions": {
"click": "REMOVE_FAVORITE"
},
"rules": {
"visible": "app.toolbar.favorite.canRemove"
}
},
{
"id": "app.viewer.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 101,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.copy",
"order": 400,
"title": "APP.ACTIONS.COPY",
"icon": "content_copy",
"actions": {
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
}
},
{
"id": "app.viewer.move",
"order": 500,
"title": "APP.ACTIONS.MOVE",
"icon": "library_books",
"actions": {
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.delete",
"order": 600,
"title": "APP.ACTIONS.DELETE",
"icon": "delete",
"actions": {
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.selection.canDelete"
}
},
{
"id": "app.viewer.versions",
"order": 700,
"title": "APP.ACTIONS.VERSIONS",
"icon": "history",
"actions": {
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
}
},
{
"id": "app.viewer.permissions",
"order": 800,
"title": "APP.ACTIONS.PERMISSIONS",
"icon": "settings_input_component",
"actions": {
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
}
}
],
"content": [
{
"id": "app.viewer.pdf",
"disabled": true,
"fileExtension": "pdf",
"component": "app.components.tabs.metadata"
},
{
"id": "app.viewer.docx",
"disabled": true,
"fileExtension": "docx",
"component": "app.components.tabs.comments"
}
]
},
"sidebar": [
{
"id": "app.sidebar.properties",
"order": 100,
"title": "APP.INFO_DRAWER.TABS.PROPERTIES",
"component": "app.components.tabs.metadata"
},
{
"id": "app.sidebar.comments",
"order": 200,
"title": "APP.INFO_DRAWER.TABS.COMMENTS",
"component": "app.components.tabs.comments"
},
{
"id": "app.sidebar.versions",
"order": 300,
"disabled": true,
"title": "APP.INFO_DRAWER.TABS.VERSIONS",
"component": "app.components.tabs.versions"
}
],
"content-metadata-presets": [
{
"id": "app.content.metadata.custom",
"custom": [
{
"id": "a.testGroup",
"title": "A Test Group of Properties",
"items": [
{
"id": "app.content.metadata.exifAspect",
"aspect": "exif:exif",
"properties": [
"exif:pixelXDimension",
"exif:pixelYDimension",
"exif:dateTimeOriginal",
"exif:exposureTime",
"exif:fNumber",
"exif:flash",
"exif:focalLength",
"exif:isoSpeedRatings",
"exif:orientation",
"exif:manufacturer",
"exif:model",
"exif:software"
]
}
]
},
{
"id": "another.testGroup",
"title": "Another Test Group of Properties",
"disabled": false,
"items": [
{
"id": "testAspects",
"aspect": "exif:exif",
"properties": [
"exif:pixelXDimension",
"exif:pixelYDimension"
]
}
]
},
{
"id": "disabled.testGroup",
"title": "Hidden Group of Properties",
"disabled": true,
"items": [
{
"id": "testAspects",
"aspect": "exif:exif",
"properties": [
"exif:pixelXDimension",
"exif:pixelYDimension"
]
}
]
}
]
}
]
}
}
@@ -628,7 +628,70 @@
} }
], ],
"viewer": { "viewer": {
"toolbar": [ "toolbarActions": [
{
"id": "app.toolbar.download",
"order": 100,
"title": "My custom title",
"icon": "get_app",
"actions": {
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
}
},
{
"id": "app.toolbar.my-action",
"order": 150,
"title": "My action",
"icon": "http",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.print",
"order": 200,
"title": "APP.ACTIONS.PRINT",
"icon": "print",
"disabled": true,
"actions": {
"click": "PRINT_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{
"id": "app.viewer.share",
"order": 300,
"title": "APP.ACTIONS.SHARE",
"icon": "share",
"actions": {
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.selection.file.canShare"
}
},
{
"id": "app.viewer.fullscreen",
"order": 400,
"title": "APP.ACTIONS.FULLSCREEN",
"icon": "fullscreen",
"actions": {
"click": "FULLSCREEN_VIEWER"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
}
],
"toolbarMoreMenu": [
{ {
"id": "app.viewer.favorite.add", "id": "app.viewer.favorite.add",
"order": 100, "order": 100,
@@ -653,6 +716,28 @@
"visible": "app.toolbar.favorite.canRemove" "visible": "app.toolbar.favorite.canRemove"
} }
}, },
{
"id": "app.viewer.favorite",
"comment": "workaround for Recent Files and Search API issue",
"type": "custom",
"order": 101,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
}
},
{
"id": "app.toolbar.my-secondary-action",
"order": 150,
"title": "My secondary action",
"icon": "alarm",
"actions": {
"click": "PRINT_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
}
},
{ {
"id": "app.viewer.share", "id": "app.viewer.share",
"order": 300, "order": 300,
@@ -680,7 +765,7 @@
{ {
"id": "app.viewer.move", "id": "app.viewer.move",
"order": 500, "order": 500,
"title": "APP.ACTIONS.MOVE", "title": "My new title",
"icon": "library_books", "icon": "library_books",
"actions": { "actions": {
"click": "MOVE_NODES" "click": "MOVE_NODES"
@@ -717,6 +802,7 @@
"id": "app.viewer.permissions", "id": "app.viewer.permissions",
"order": 800, "order": 800,
"title": "APP.ACTIONS.PERMISSIONS", "title": "APP.ACTIONS.PERMISSIONS",
"disabled": true,
"icon": "settings_input_component", "icon": "settings_input_component",
"actions": { "actions": {
"click": "MANAGE_PERMISSIONS" "click": "MANAGE_PERMISSIONS"
+379
View File
@@ -0,0 +1,379 @@
/*!
* @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 { SITE_VISIBILITY, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Context menu actions - multiple selection : ', () => {
const username = `user-${Utils.random()}`;
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`; let file2Id;
const folder1 = `folder1-${Utils.random()}`; let folder1Id;
const folder2 = `folder2-${Utils.random()}`; let folder2Id;
const fileInTrash1 = `deletedFile1-${Utils.random()}.txt`; let fileInTrash1Id;
const fileInTrash2 = `deletedFile2-${Utils.random()}.txt`; let fileInTrash2Id;
const folderInTrash1 = `deletedFolder1-${Utils.random()}`; let folderInTrash1Id;
const folderInTrash2 = `deletedFolder2-${Utils.random()}`; let folderInTrash2Id;
const siteName = `site-${Utils.random()}`;
const file1Site = `file1-${Utils.random()}.txt`;
const file2Site = `file2-${Utils.random()}.txt`;
const folder1Site = `folder1-${Utils.random()}`;
const folder2Site = `folder2-${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 } = page;
const contextMenu = dataTable.menu;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
file1Id = (await apis.user.nodes.createFile(file1)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = (await apis.user.sites.getDocLibId(siteName));
await apis.user.nodes.createFile(file1Site, docLibId);
await apis.user.nodes.createFile(file2Site, docLibId);
await apis.user.nodes.createFolder(folder1Site, docLibId);
await apis.user.nodes.createFile(folder2Site, docLibId);
await apis.user.shared.shareFilesByIds([ file1Id, file2Id ]);
await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ]);
await apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ]);
await apis.user.favorites.waitForApi({ expect: 4 + 1 });
fileInTrash1Id = (await apis.user.nodes.createFile(fileInTrash1)).entry.id;
fileInTrash2Id = (await apis.user.nodes.createFile(fileInTrash2)).entry.id;
folderInTrash1Id = (await apis.user.nodes.createFolder(folderInTrash1)).entry.id;
folderInTrash2Id = (await apis.user.nodes.createFolder(folderInTrash2)).entry.id;
await apis.user.nodes.deleteNodesById([ fileInTrash1Id, fileInTrash2Id, folderInTrash1Id, folderInTrash2Id ], false);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodesById([ file1Id, file2Id, folder1Id, folder2Id ]);
await apis.user.sites.deleteSite(siteName);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
xit('');
describe('Generic tests', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('Context menu appears on right click on a multiple selection of items - [C286268]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
// await dataTable.rightClickOnItem(file1);
await dataTable.rightClickOnMultipleSelection();
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
});
it('Context menu appears when right clicking on a single item while having multiple items selected - [C286269]', async () => {
await dataTable.selectMultipleItems([ file2, folder1 ]);
await dataTable.rightClickOnItem(file1);
expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${file1}`);
expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect number of selected rows');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`);
expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`);
expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`);
});
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('correct actions appear when multiple files are selected - [C280661]', async () => {
await dataTable.selectMultipleItems([file1, file2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
it('correct actions appear when multiple folders are selected - [C280632]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
it('correct actions appear when both files and folders are selected - [C280631]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('correct actions appear when multiple files are selected - [C280641]', async () => {
await dataTable.selectMultipleItems([ file1Site, file2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
it('correct actions appear when multiple folders are selected - [C280574]', async () => {
await dataTable.selectMultipleItems([ folder1Site, folder2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
it('correct actions appear when both files and folders are selected - [C280642]', async () => {
await dataTable.selectMultipleItems([ file1Site, file2Site, folder1Site, folder2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('correct actions appear when multiple files are selected - [C280648]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
});
describe('Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('correct actions appear when multiple files are selected - [C280652]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
});
describe('Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('correct actions appear when multiple files are selected - [C280656]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
it('correct actions appear when multiple folders are selected - [C280664]', async () => {
await dataTable.selectMultipleItems([ folder1, folder2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
it('correct actions appear when both files and folders are selected - [C280657]', async () => {
await dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed`);
});
});
describe('Trash', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('correct actions appear when multiple files are selected - [C286273]', async () => {
await dataTable.selectMultipleItems([ fileInTrash1, fileInTrash2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('Permanently delete')).toBe(true, 'Permanently delete is not displayed');
expect(await contextMenu.isMenuItemPresent('Restore')).toBe(true, 'Restore is not displayed');
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(false, 'Download is displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(false, `Copy is displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(false, `Favorite is displayed`);
});
it('correct actions appear when multiple folders are selected - [C286274]', async () => {
await dataTable.selectMultipleItems([ folderInTrash1, folderInTrash2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('Permanently delete')).toBe(true, 'Permanently delete is not displayed');
expect(await contextMenu.isMenuItemPresent('Restore')).toBe(true, 'Restore is not displayed');
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(false, 'Download is displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(false, `Copy is displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(false, `Favorite is displayed`);
});
it('correct actions appear when both files and folders are selected - [C286275]', async () => {
await dataTable.selectMultipleItems([ fileInTrash1, fileInTrash2, folderInTrash1, folderInTrash2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('Permanently delete')).toBe(true, 'Permanently delete is not displayed');
expect(await contextMenu.isMenuItemPresent('Restore')).toBe(true, 'Restore is not displayed');
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(false, 'Download is displayed');
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, 'Edit is displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(false, `Copy is displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(false, `Favorite is displayed`);
});
});
});
+353
View File
@@ -0,0 +1,353 @@
/*!
* @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, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SITE_VISIBILITY, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Context menu actions - single selection : ', () => {
const username = `user-${Utils.random()}`;
const fileUser = `fileUser-${Utils.random()}.txt`; let fileUserId;
const folderUser = `folderUser-${Utils.random()}`; let folderUserId;
const fileInTrash = `fileForDelete-${Utils.random()}.txt`; let fileInTrashId;
const folderInTrash = `folderForDelete-${Utils.random()}`; let folderInTrashId;
const siteName = `userSite-${Utils.random()}`;
const fileSiteUser = `fileUser-${Utils.random()}.txt`;
const folderSiteUser = `folderUser-${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 } = page;
const contextMenu = dataTable.menu;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileUserId = (await apis.user.nodes.createFile(fileUser)).entry.id;
folderUserId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFile(fileSiteUser, docLibId);
await apis.user.nodes.createFolder(folderSiteUser, docLibId);
fileInTrashId = (await apis.user.nodes.createFiles([fileInTrash])).entry.id;
folderInTrashId = (await apis.user.nodes.createFolders([ folderInTrash ])).entry.id;
await apis.user.nodes.deleteNodeById(fileInTrashId, false);
await apis.user.nodes.deleteNodeById(folderInTrashId, false);
await apis.user.shared.shareFileById(fileUserId);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.favorites.addFavoriteById('file', fileUserId);
await apis.user.favorites.addFavoriteById('folder', folderUserId);
await apis.user.favorites.waitForApi({ expect: 3 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileUserId);
await apis.user.nodes.deleteNodeById(folderUserId);
await apis.user.sites.deleteSite(siteName);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
xit('');
describe('Generic tests', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
it('Row is marked with a check circle icon on direct right click - [C286252]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await dataTable.hasCheckMarkIcon(fileUser)).toBe(true, 'check mark missing');
});
it('Context menu appears on direct right click on an item - [C286253]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
});
it('Context menu appears when selecting an item and then right clicking on it - [C286254]', async () => {
await dataTable.selectItem(fileUser);
await dataTable.rightClickOnItem(fileUser);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
});
it('Context menu appears correctly when right clicking on another item - [C284666]', async () => {
await dataTable.selectItem(fileUser);
await dataTable.rightClickOnItem(folderUser);
expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
expect(await dataTable.hasCheckMarkIcon(folderUser)).toBe(true, `${folderUser} is not selected`);
expect(await dataTable.hasCheckMarkIcon(fileUser)).toBe(false, `${fileUser} is not selected`);
});
it('Context menu closes when clicking away from it - [C280619]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
await page.sidenav.activeLink.click();
expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed');
});
it('Context menu does not appear for a library - [C286276]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.rightClickOnItem(siteName);
expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed for a site');
});
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.clearSelection();
done();
});
it('Context menu has the correct actions for a file - [C280615]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${fileUser}`);
});
it('Context menu has the correct actions for a folder - [C280616]', async () => {
await dataTable.rightClickOnItem(folderUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(false, `Manage Versions is displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is displayed for ${folderUser}`);
});
});
describe('File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
});
it('Context menu has the correct actions for a file - [C280594]', async () => {
await dataTable.rightClickOnItem(fileSiteUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileSiteUser}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${fileSiteUser}`);
});
it('Context menu has the correct actions for a folder - [C280595]', async () => {
await dataTable.rightClickOnItem(folderSiteUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not enabled for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(true, `Edit is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(false, `Manage Versions displayed for ${folderSiteUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is displayed for ${folderSiteUser}`);
});
});
describe('Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
done();
});
it('Context menu has the correct actions for a file - [C280601]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
// TODO: enable this when the action is properly implemented: ACA-92
// expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${fileUser}`);
});
});
describe('Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
});
it('Context menu has the correct actions for a file - [C280622]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${fileUser}`);
});
});
describe('Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
it('Context menu has the correct actions for a file - [C280608]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions is not displayed for ${fileUser}`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${fileUser}`);
});
it('Context menu has the correct actions for a folder - [C280609]', async () => {
await dataTable.rightClickOnItem(folderUser);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(false, `Manage Versions is displayed for ${folderUser}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is displayed for ${folderUser}`);
});
});
describe('Trash', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
done();
});
it('Context menu has the correct actions for a file - [C286258]', async () => {
await dataTable.rightClickOnItem(fileInTrash);
expect(await contextMenu.isMenuItemPresent('Permanently delete'))
.toBe(true, `Permanently delete is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Restore')).toBe(true, `Restore is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(false, `Download is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(false, `Favorite is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(false, `Copy is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions'))
.toBe(false, `Manage Versions is not displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${fileInTrash}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${fileInTrash}`);
});
it('Context menu has the correct actions for a folder - [C286259]', async () => {
await dataTable.rightClickOnItem(folderInTrash);
expect(await contextMenu.isMenuItemPresent('Permanently delete'))
.toBe(true, `Permanently delete is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Restore')).toBe(true, `Restore is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(false, `Download is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(false, `Favorite is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(false, `Copy is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions'))
.toBe(false, `Manage Versions is not displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${folderInTrash}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${folderInTrash}`);
});
});
});
+140 -165
View File
@@ -28,13 +28,14 @@ import { browser } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { SIDEBAR_LABELS, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { Menu } from '../../components/menu/menu';
import { Utils } from '../../utilities/utils'; import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Create folder', () => { describe('Create folder', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; const parent = `parent-${Utils.random()}`; let parentId;
const folderName1 = `folder-${Utils.random()}`; const folderName1 = `folder-${Utils.random()}`;
const folderName2 = `folder-${Utils.random()}`; const folderName2 = `folder-${Utils.random()}`;
const folderDescription = 'description of my folder'; const folderDescription = 'description of my folder';
@@ -53,95 +54,89 @@ describe('Create folder', () => {
const personalFilesPage = new BrowsingPage(); const personalFilesPage = new BrowsingPage();
const createDialog = new CreateOrEditFolderDialog(); const createDialog = new CreateOrEditFolderDialog();
const { dataTable } = personalFilesPage; const { dataTable } = personalFilesPage;
const menu = new Menu();
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)) await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`)) const docLibId = (await apis.admin.sites.getDocLibId(siteName));
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) await apis.admin.nodes.createFolder(folderName1, docLibId);
.then(() => apis.user.nodes.createFolders([ duplicateFolderName ], parent)) await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
.then(() => loginPage.loginWith(username)) parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
.then(done); await apis.user.nodes.createFolder(duplicateFolderName, parentId);
await loginPage.loginWith(username);
done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise await apis.admin.sites.deleteSite(siteName);
.all([ await apis.user.nodes.deleteNodeById(parentId);
apis.admin.sites.deleteSite(siteName), await logoutPage.load();
apis.user.nodes.deleteNodes([ parent ]), done();
logoutPage.load()
])
.then(done);
}); });
describe('on Personal Files', () => { describe('on Personal Files', () => {
beforeEach(done => { beforeEach(async (done) => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); await Utils.pressEscape();
done();
}); });
it('option is enabled when having enough permissions - [C216339]', () => { it('option is enabled when having enough permissions - [C216339]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openNewMenu()) await personalFilesPage.sidenav.openNewMenu();
.then(menu => { const isEnabled = await menu.getItemByLabel('Create folder').isEnabled();
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(true, 'Create folder is not enabled'); expect(isEnabled).toBe(true, 'Create folder is not enabled');
}); });
});
it('creates new folder with name - [C216341]', () => { it('creates new folder with name - [C216341]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName(folderName1)) await createDialog.enterName(folderName1);
.then(() => createDialog.clickCreate()) await createDialog.clickCreate();
.then(() => createDialog.waitForDialogToClose()) await createDialog.waitForDialogToClose();
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { const isPresent = await dataTable.getRowByName(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 - [C216340]', async (done) => {
await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
await personalFilesPage.sidenav.openCreateDialog();
await createDialog.waitForDialogToOpen();
await createDialog.enterName(folderName2);
await createDialog.enterDescription(folderDescription);
await createDialog.clickCreate();
await createDialog.waitForDialogToClose();
await dataTable.waitForHeader();
expect(await dataTable.getRowByName(folderName2).isPresent()).toBe(true, 'Folder not displayed');
const desc = await apis.user.nodes.getNodeDescription(folderName2, parent);
expect(desc).toEqual(folderDescription);
done();
}); });
it('creates new folder with name and description - [C216340]', () => { it('enabled option tooltip - [C216342]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openNewMenu();
.then(() => createDialog.waitForDialogToOpen()) await browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform();
.then(() => createDialog.enterName(folderName2)) expect(await menu.getItemTooltip('Create folder')).toContain('Create new folder');
.then(() => createDialog.enterDescription(folderDescription))
.then(() => createDialog.clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => expect(dataTable.getRowByName(folderName2).isPresent()).toBe(true, 'Folder not displayed'))
.then(() => apis.user.nodes.getNodeDescription(folderName2, parent))
.then(desc => expect(desc).toEqual(folderDescription));
}); });
it('enabled option tooltip - [C216342]', () => { it('dialog UI elements - [C216345]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openNewMenu()) await personalFilesPage.sidenav.openCreateDialog();
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() await createDialog.waitForDialogToOpen();
.then(() => menu)) const dialogTitle = await createDialog.getTitle();
.then(menu => { const isFolderNameDisplayed = await createDialog.nameInput.isDisplayed();
expect(menu.getItemTooltip('Create folder')).toContain('Create new folder'); const isDescriptionDisplayed = await createDialog.descriptionTextArea.isDisplayed();
}); const isCreateEnabled = await createDialog.createButton.isEnabled();
}); const isCancelEnabled = await createDialog.cancelButton.isEnabled();
it('dialog UI elements - [C216345]', () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen())
.then(() => {
const dialogTitle = createDialog.getTitle();
const isFolderNameDisplayed = createDialog.nameInput.isDisplayed();
const isDescriptionDisplayed = createDialog.descriptionTextArea.isDisplayed();
const isCreateEnabled = createDialog.createButton.isEnabled();
const isCancelEnabled = createDialog.cancelButton.isEnabled();
expect(dialogTitle).toMatch('Create new folder'); expect(dialogTitle).toMatch('Create new folder');
expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed'); expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed');
@@ -149,142 +144,122 @@ describe('Create folder', () => {
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled'); expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled');
}); });
});
it('with empty folder name - [C216346]', () => { it('with empty folder name - [C216346]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.deleteNameWithBackspace()) await createDialog.deleteNameWithBackspace();
.then(() => { const isCreateEnabled = await createDialog.createButton.isEnabled();
const isCreateEnabled = createDialog.createButton.isEnabled(); const validationMessage = await createDialog.getValidationMessage();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is enabled'); expect(isCreateEnabled).toBe(false, 'Create button is enabled');
expect(validationMessage).toMatch('Folder name is required'); expect(validationMessage).toMatch('Folder name is required');
}); });
});
it('with folder name ending with a dot "." - [C216348]', () => { it('with folder name ending with a dot "." - [C216348]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName('folder-name.')) await createDialog.enterName('folder-name.');
.then(() => { const isCreateEnabled = await createDialog.createButton.isEnabled();
const isCreateEnabled = createDialog.createButton.isEnabled(); const validationMessage = await createDialog.getValidationMessage();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't end with a period .`); expect(validationMessage).toMatch(`Folder name can't end with a period .`);
}); });
});
it('with folder name containing special characters - [C216347]', () => { it('with folder name containing special characters - [C216347]', async () => {
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.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => namesWithSpecialChars.forEach(name => {
createDialog.enterName(name);
const isCreateEnabled = createDialog.createButton.isEnabled(); for (const name of namesWithSpecialChars) {
const validationMessage = createDialog.getValidationMessage(); await createDialog.enterName(name);
expect(await createDialog.createButton.isEnabled()).toBe(false, 'Create button is not disabled');
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(await createDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
expect(validationMessage).toContain(`Folder name can't contain these characters`); }
}));
}); });
it('with folder name containing only spaces - [C280406]', () => { it('with folder name containing only spaces - [C280406]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName(' ')) await createDialog.enterName(' ');
.then(() => { const isCreateEnabled = await createDialog.createButton.isEnabled();
const isCreateEnabled = createDialog.createButton.isEnabled(); const validationMessage = await createDialog.getValidationMessage();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled'); expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't contain only spaces`); expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
}); });
it('cancel folder creation - [C216349]', async () => {
await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
await personalFilesPage.sidenav.openCreateDialog();
await createDialog.waitForDialogToOpen();
await createDialog.enterName('test');
await createDialog.enterDescription('test description');
await createDialog.clickCancel();
expect(await createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
}); });
it('cancel folder creation - [C216349]', () => { it('duplicate folder name - [C216350]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName('test')) await createDialog.enterName(duplicateFolderName);
.then(() => createDialog.enterDescription('test description')) await createDialog.clickCreate();
.then(() => createDialog.clickCancel()) const message = await personalFilesPage.getSnackBarMessage();
.then(() => {
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
});
});
it('duplicate folder name - [C216350]', () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent)
.then(() => personalFilesPage.sidenav.openCreateDialog())
.then(() => createDialog.waitForDialogToOpen())
.then(() => createDialog.enterName(duplicateFolderName))
.then(() => createDialog.clickCreate())
.then(() => personalFilesPage.getSnackBarMessage())
.then(message => {
expect(message).toEqual(`There's already a folder with this name. Try a different name.`); expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present'); expect(await createDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
}); });
it('trim ending spaces from folder name - [C216351]', () => { it('trim ending spaces from folder name - [C216351]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(parent) await personalFilesPage.dataTable.doubleClickOnRowByName(parent);
.then(() => personalFilesPage.sidenav.openCreateDialog()) await personalFilesPage.sidenav.openCreateDialog();
.then(() => createDialog.waitForDialogToOpen()) await createDialog.waitForDialogToOpen();
.then(() => createDialog.enterName(nameWithSpaces)) await createDialog.enterName(nameWithSpaces);
.then(() => createDialog.clickCreate()) await createDialog.clickCreate();
.then(() => createDialog.waitForDialogToClose()) await createDialog.waitForDialogToClose();
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { const isPresent = await dataTable.getRowByName(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', () => { describe('on File Libraries', () => {
const fileLibrariesPage = new BrowsingPage(); const fileLibrariesPage = new BrowsingPage();
beforeEach(done => { beforeEach(async (done) => {
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done); await Utils.pressEscape();
done();
}); });
it('option is disabled when not enough permissions - [C280397]', () => { it('option is disabled when not enough permissions - [C280397]', async () => {
fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName) await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1)) await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1);
.then(() => fileLibrariesPage.sidenav.openNewMenu()) await fileLibrariesPage.sidenav.openNewMenu();
.then(menu => { const isEnabled = await menu.getItemByLabel('Create folder').isEnabled();
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(false, 'Create folder is not disabled'); expect(isEnabled).toBe(false, 'Create folder is not disabled');
}); });
});
it('disabled option tooltip - [C280398]', () => { it('disabled option tooltip - [C280398]', async () => {
fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName) await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1)) await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderName1);
.then(() => fileLibrariesPage.sidenav.openNewMenu()) await fileLibrariesPage.sidenav.openNewMenu();
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform() await browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform();
.then(() => menu)) const tooltip = await menu.getItemTooltip('Create folder');
.then(menu => {
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`); expect(tooltip).toContain(`Folders cannot be created whilst viewing the current items`);
}); });
}); });
});
xit(''); xit('');
}); });
File diff suppressed because it is too large Load Diff
+92 -98
View File
@@ -33,7 +33,7 @@ import { Utils } from '../../utilities/utils';
describe('Edit folder', () => { describe('Edit folder', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; const parent = `parent-${Utils.random()}`; let parentId;
const folderName = `folder-${Utils.random()}`; const folderName = `folder-${Utils.random()}`;
const folderDescription = 'my folder description'; const folderDescription = 'my folder description';
@@ -55,133 +55,127 @@ describe('Edit folder', () => {
const personalFilesPage = new BrowsingPage(); const personalFilesPage = new BrowsingPage();
const editDialog = new CreateOrEditFolderDialog(); const editDialog = new CreateOrEditFolderDialog();
const { dataTable } = personalFilesPage; const { dataTable } = personalFilesPage;
const editButton = personalFilesPage.toolbar.actions.getButtonByTitleAttribute('Edit'); const editButton = personalFilesPage.toolbar.getButtonByTitleAttribute('Edit');
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)) await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`)) const docLibId = await apis.admin.sites.getDocLibId(siteName);
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER)) await apis.admin.nodes.createFolder(folderName, docLibId);
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
.then(() => apis.user.nodes.createFolder( parent )) parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
.then(resp => apis.user.nodes.createFolder( folderName, resp.entry.id, '', folderDescription )) await apis.user.nodes.createFolder(folderName, parentId, '', folderDescription);
.then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent)) await apis.user.nodes.createFolder(folderNameToEdit, parentId);
await apis.user.nodes.createFolder(duplicateFolderName, parentId);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => dataTable.doubleClickOnRowByName(parent)) await dataTable.doubleClickOnRowByName(parent);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done); await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise await Promise.all([
.all([
apis.admin.sites.deleteSite(siteName), apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ parent ]), apis.user.nodes.deleteNodeById(parentId),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('dialog UI defaults - [C216331]', () => { it('dialog UI defaults - [C216331]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => { expect(await editDialog.getTitle()).toEqual('Edit folder');
expect(editDialog.getTitle()).toEqual('Edit folder'); expect(await editDialog.nameInput.getAttribute('value')).toBe(folderName);
expect(editDialog.nameInput.getAttribute('value')).toBe(folderName); expect(await editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription);
expect(editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription); expect(await editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled');
expect(editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled'); expect(await editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
expect(editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
});
}); });
it('properties are modified when pressing OK - [C216335]', () => { it('properties are modified when pressing OK - [C216335]', async (done) => {
dataTable.selectItem(folderNameToEdit) await dataTable.selectItem(folderNameToEdit);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.waitForDialogToOpen()) await editDialog.waitForDialogToOpen();
.then(() => editDialog.enterDescription(folderDescriptionEdited)) await editDialog.enterDescription(folderDescriptionEdited);
.then(() => editDialog.enterName(folderNameEdited)) await editDialog.enterName(folderNameEdited);
.then(() => editDialog.clickUpdate()) await editDialog.clickUpdate();
.then(() => editDialog.waitForDialogToClose()) await editDialog.waitForDialogToClose();
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => expect(dataTable.getRowByName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed')) expect(await dataTable.getRowByName(folderNameEdited).isPresent()).toBe(true, 'Folder not displayed');
.then(() => apis.user.nodes.getNodeDescription(folderNameEdited, parent)) const desc = await apis.user.nodes.getNodeDescription(folderNameEdited, parent);
.then(desc => expect(desc).toEqual(folderDescriptionEdited)); expect(desc).toEqual(folderDescriptionEdited);
done();
}); });
it('with empty folder name - [C216332]', () => { it('with empty folder name - [C216332]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.deleteNameWithBackspace()) await editDialog.deleteNameWithBackspace();
.then(() => { expect(await editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled'); expect(await editDialog.getValidationMessage()).toMatch('Folder name is required');
expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
});
}); });
it('with name with special characters - [C216333]', () => { it('with name with special characters - [C216333]', async () => {
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.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => namesWithSpecialChars.forEach(name => {
editDialog.enterName(name);
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not disabled'); for (const name of namesWithSpecialChars) {
expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`); await editDialog.enterName(name);
})); expect(await editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not disabled');
expect(await editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
}
}); });
it('with name ending with a dot - [C216334]', () => { it('with name ending with a dot - [C216334]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.nameInput.sendKeys('.')) await editDialog.waitForDialogToOpen();
.then(() => { await editDialog.nameInput.sendKeys('.');
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled'); expect(await editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`); expect(await editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
});
}); });
it('Cancel button - [C216336]', () => { it('Cancel button - [C216336]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.clickCancel()) await editDialog.waitForDialogToOpen();
.then(() => { await editDialog.clickCancel();
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'); expect(await editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
});
}); });
it('with duplicate folder name - [C216337]', () => { it('with duplicate folder name - [C216337]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.enterName(duplicateFolderName)) await editDialog.waitForDialogToOpen();
.then(() => editDialog.clickUpdate()) await editDialog.enterName(duplicateFolderName);
.then(() => personalFilesPage.getSnackBarMessage()) await editDialog.clickUpdate();
.then(message => { const message = await personalFilesPage.getSnackBarMessage();
expect(message).toEqual(`There's already a folder with this name. Try a different name.`); expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(editDialog.component.isPresent()).toBe(true, 'dialog is not present'); expect(await editDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
}); });
it('trim ending spaces - [C216338]', () => { it('trim ending spaces - [C216338]', async () => {
dataTable.selectItem(folderName) await dataTable.selectItem(folderName);
.then(() => editButton.click()) await editButton.click();
.then(() => editDialog.nameInput.sendKeys(' ')) await editDialog.nameInput.sendKeys(' ');
.then(() => editDialog.clickUpdate()) await editDialog.clickUpdate();
.then(() => editDialog.waitForDialogToClose()) await editDialog.waitForDialogToClose();
.then(() => { expect(await personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears'); expect(await dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
});
}); });
}); });
+398 -435
View File
@@ -27,22 +27,22 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SIDEBAR_LABELS, SITE_VISIBILITY } 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';
describe('Mark items as favorites', () => { describe('Mark items as favorites', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const file1NotFav = `file-${Utils.random()}.txt`; const file1NotFav = `file1-${Utils.random()}.txt`;
const file2NotFav = `file-${Utils.random()}.txt`; const file2NotFav = `file2-${Utils.random()}.txt`;
const file3Fav = `file-${Utils.random()}.txt`; const file3Fav = `file3-${Utils.random()}.txt`;
const file4Fav = `file-${Utils.random()}.txt`; const file4Fav = `file4-${Utils.random()}.txt`;
const folder1 = `folder-${Utils.random()}`; const folder1 = `folder-${Utils.random()}`;
const siteName = `site-public-${Utils.random()}`; const siteName = `site-public-${Utils.random()}`;
const fileSiteNotFav1 = `file-site${Utils.random()}.txt`; const fileSiteNotFav1 = `file1-site-${Utils.random()}.txt`;
const fileSiteNotFav2 = `file-site${Utils.random()}.txt`; const fileSiteNotFav2 = `file2-site-${Utils.random()}.txt`;
const folderSite = `folder-${Utils.random()}`; const folderSite = `folder-site-${Utils.random()}`;
const fileSiteFav1 = `file-${Utils.random()}.txt`; const fileSiteFav1 = `file3-${Utils.random()}.txt`;
const fileSiteFav2 = `file-${Utils.random()}.txt`; const fileSiteFav2 = `file4-${Utils.random()}.txt`;
let file1Id, file2Id, file3Id, file4Id, folder1Id, fileSiteNotFav1Id, fileSiteNotFav2Id, folderSiteId, fileSiteFav1Id, fileSiteFav2Id; let file1Id, file2Id, file3Id, file4Id, folder1Id, fileSiteNotFav1Id, fileSiteNotFav2Id, folderSiteId, fileSiteFav1Id, fileSiteFav2Id;
@@ -56,386 +56,21 @@ describe('Mark items as favorites', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => {
apis.admin.people.createUser({ username })
.then(() => apis.user.nodes.createFile( file1NotFav ).then(resp => file1Id = resp.entry.id))
.then(() => apis.user.nodes.createFile( file2NotFav ).then(resp => file2Id = resp.entry.id))
.then(() => apis.user.nodes.createFile( file3Fav ).then(resp => file3Id = resp.entry.id))
.then(() => apis.user.nodes.createFile( file4Fav ).then(resp => file4Id = resp.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', file4Id))
.then(() => apis.user.search.waitForApi(username, { expect: 4 }))
.then(() => apis.user.favorites.waitForApi({ expect: 2 }))
.then(() => loginPage.loginWith(username))
.then(done);
});
afterAll(done => {
Promise.all([
apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id]),
apis.user.sites.deleteSite(siteName),
logoutPage.load()
])
.then(done);
});
xit('');
describe('on Personal Files', () => {
beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
beforeEach(done => {
toolbar.actions.closeMoreMenu().then(done);
});
it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', () => {
dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu())
.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 - [C217187]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star_border'));
});
it('Favorite action has full star icon for items marked as favorite - [C217188]', () => {
dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => expect(toolbar.actions.menu.getItemIconText('Favorite')).toEqual('star'));
});
it('favorite a file - [C217189]', () => {
dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => apis.user.favorites.isFavorite(file1Id))
.then(isFavorite => expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`))
.then(() => apis.user.favorites.removeFavoriteById(file1Id));
});
it('favorite a folder - [C280390]', () => {
dataTable.selectItem(folder1)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => apis.user.favorites.isFavorite(folder1Id))
.then(isFavorite => expect(isFavorite).toBe(true, `${folder1} not marked as favorite`))
.then(() => apis.user.favorites.removeFavoriteById(folder1Id));
});
it('unfavorite an item - [C217190]', () => {
dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 }))
.then(() => apis.user.favorites.isFavorite(file3Id))
.then(isFavorite => expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`))
.then(() => apis.user.favorites.addFavoriteById('file', file3Id));
});
it('favorite multiple items - all unfavorite - [C217192]', () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 4 }))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id)
]))
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id))
.then(() => apis.user.favorites.removeFavoriteById(file2Id));
});
it('favorite multiple items - some favorite and some unfavorite - [C217194]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id)
]))
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id));
});
it('unfavorite multiple items - [C217193]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => browser.sleep(2000))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id)
]))
.then(resp => {
expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.then(() => apis.user.favorites.addFavoriteById('file', file4Id));
});
});
describe('on Recent Files', () => {
beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
beforeEach(done => {
toolbar.actions.closeMoreMenu().then(done);
});
it('favorite a file - [C280352]', () => {
dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => apis.user.favorites.isFavorite(file1Id))
.then(isFavorite => expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`))
.then(() => apis.user.favorites.removeFavoriteById(file1Id));
});
it('unfavorite an item - [C280353]', () => {
dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 }))
.then(() => apis.user.favorites.isFavorite(file3Id))
.then(isFavorite => expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`))
.then(() => apis.user.favorites.addFavoriteById('file', file3Id));
});
it('favorite multiple items - all unfavorite - [C280355]', () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 4 }))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id)
]))
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id))
.then(() => apis.user.favorites.removeFavoriteById(file2Id));
});
it('favorite multiple items - some favorite and some unfavorite - [C280357]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id)
]))
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id));
});
it('unfavorite multiple items - [C280356]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => browser.sleep(2000))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id)
]))
.then(resp => {
expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.then(() => apis.user.favorites.addFavoriteById('file', file4Id));
});
});
describe('on Shared Files', () => {
beforeAll(done => {
apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id ])
.then(() => apis.user.shared.waitForApi({ expect: 4 }))
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES))
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
// browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
});
it('favorite a file - [C280362]', () => {
dataTable.selectItem(file1NotFav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => apis.user.favorites.isFavorite(file1Id))
.then(isFavorite => expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`))
.then(() => apis.user.favorites.removeFavoriteById(file1Id));
});
it('unfavorite an item - [C280363]', () => {
dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 }))
.then(() => apis.user.favorites.isFavorite(file3Id))
.then(isFavorite => expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`))
.then(() => apis.user.favorites.addFavoriteById('file', file3Id));
});
it('favorite multiple items - all unfavorite - [C280365]', () => {
dataTable.selectMultipleItems([ file1NotFav, file2NotFav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 4 }))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file2Id)
]))
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id))
.then(() => apis.user.favorites.removeFavoriteById(file2Id));
});
it('favorite multiple items - some favorite and some unfavorite - [C280367]', () => {
dataTable.selectMultipleItems([ file1NotFav, file3Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 3 }))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file1Id),
apis.user.favorites.isFavorite(file3Id)
]))
.then(resp => {
expect(resp[0]).toBe(true, 'item not marked as favorite');
expect(resp[1]).toBe(true, 'item not marked as favorite');
})
.then(() => apis.user.favorites.removeFavoriteById(file1Id));
});
it('unfavorite multiple items - [C280366]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => browser.sleep(2000))
.then(() => Promise.all([
apis.user.favorites.isFavorite(file3Id),
apis.user.favorites.isFavorite(file4Id)
]))
.then(resp => {
expect(resp[0]).toBe(false, 'item marked as favorite');
expect(resp[1]).toBe(false, 'item marked as favorite');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.then(() => apis.user.favorites.addFavoriteById('file', file4Id));
});
});
describe('on Favorites', () => {
beforeAll(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
page.refresh().then(done);
});
it('unfavorite an item - [C280368]', () => {
dataTable.selectItem(file3Fav)
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => apis.user.favorites.waitForApi({ expect: 1 }))
.then(() => apis.user.favorites.isFavorite(file3Id))
.then(isFavorite => {
expect(isFavorite).toBe(false, 'item is marked as favorite');
expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id));
});
it('unfavorite multiple items - [C280374]', () => {
dataTable.selectMultipleItems([ file3Fav, file4Fav ])
.then(() => toolbar.actions.openMoreMenu())
.then(() => toolbar.actions.menu.clickMenuItem('Favorite'))
.then(() => browser.sleep(2000))
.then(() => apis.user.favorites.isFavorite(file3Id))
.then(resp => {
expect(resp).toBe(false, 'file3 marked as favorite');
expect(dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed');
})
.then(() => apis.user.favorites.isFavorite(file4Id))
.then(resp => {
expect(resp).toBe(false, 'file4 marked as favorite');
expect(dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed');
})
.then(() => apis.user.favorites.addFavoriteById('file', file3Id))
.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) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
file1Id = (await apis.user.nodes.createFile(file1NotFav)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2NotFav)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3Fav)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4Fav)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id ]);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = (await apis.user.sites.getDocLibId(siteName)); const docLibId = await apis.user.sites.getDocLibId(siteName);
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id; folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id; fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id;
fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id; fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id;
@@ -443,99 +78,427 @@ describe('Mark items as favorites', () => {
fileSiteFav2Id = (await apis.user.nodes.createFile(fileSiteFav2, 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', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id); await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
await apis.user.search.waitForApi(username, { expect: 8 });
await apis.user.shared.waitForApi({ expect: 4 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id]),
apis.user.sites.deleteSite(siteName),
logoutPage.load()
]);
done();
});
xit('');
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
it('Favorite action has empty star icon for an item not marked as favorite - [C217186]', async () => {
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star_border');
});
it('Favorite action has empty star icon for multiple selection of items when some are not favorite - [C217187]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star_border');
});
it('Favorite action has full star icon for items marked as favorite - [C217188]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star');
});
it('favorite a file - [C217189]', async () => {
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(file1Id);
expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite a folder - [C280390]', async () => {
await dataTable.selectItem(folder1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(folder1Id);
expect(isFavorite).toBe(true, `${folder1} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(folder1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite an item - [C217190]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - all unfavorite - [C217192]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.removeFavoriteById(file2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - some favorite and some unfavorite - [C217194]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file3Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C217193]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ])
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(file3Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file4Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
describe('on Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
});
it('favorite a file - [C280352]', async () => {
await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(file1Id);
expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite an item - [C280353]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - all unfavorite - [C280355]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.removeFavoriteById(file2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - some favorite and some unfavorite - [C280357]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file3Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C280356]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(file3Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file4Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
describe('on Shared Files', () => {
beforeAll(async (done) => {
await page.refresh();
done(); done();
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); await Utils.pressEscape();
await fileLibrariesPage.dataTable.waitForHeader(); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName); await dataTable.waitForHeader();
await fileLibrariesPage.dataTable.waitForHeader();
await toolbar.actions.closeMoreMenu();
done(); done();
}); });
afterEach(async (done) => { it('favorite a file - [C280362]', async () => {
await browser.refresh(); await dataTable.selectItem(file1NotFav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(file1Id);
expect(isFavorite).toBe(true, `${file1NotFav} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite an item - [C280363]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, `${file3Fav} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - all unfavorite - [C280365]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file2NotFav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 7 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file2Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.removeFavoriteById(file2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('favorite multiple items - some favorite and some unfavorite - [C280367]', async () => {
await dataTable.selectMultipleItems([ file1NotFav, file3Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 6 });
const isFile1Fav = await apis.user.favorites.isFavorite(file1Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file3Id);
expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(isFile2Fav).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(file1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C280366]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFile1Fav = await apis.user.favorites.isFavorite(file3Id);
const isFile2Fav = await apis.user.favorites.isFavorite(file4Id);
expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(isFile2Fav).toBe(false, 'item marked as favorite');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
});
describe('on Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
it('unfavorite an item - [C280368]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(file3Id);
expect(isFavorite).toBe(false, 'item is marked as favorite');
expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'item still displayed');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('unfavorite multiple items - [C280374]', async () => {
await dataTable.selectMultipleItems([ file3Fav, file4Fav ]);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 });
const isFavorite3 = await apis.user.favorites.isFavorite(file3Id);
const isFavorite4 = await apis.user.favorites.isFavorite(file4Id);
expect(isFavorite3).toBe(false, 'file3 marked as favorite');
expect(isFavorite4).toBe(false, 'file4 marked as favorite');
expect(await dataTable.getRowByName(file3Fav).isPresent()).toBe(false, 'file3 still displayed');
expect(await dataTable.getRowByName(file4Fav).isPresent()).toBe(false, 'file4 still displayed');
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 5 });
});
it('Favorite action has full star icon for items marked as favorite - [C280371]', async () => {
await dataTable.selectItem(file3Fav);
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemIconText('Favorite')).toEqual('star');
});
});
describe ('on File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await page.dataTable.waitForHeader();
await page.dataTable.doubleClickOnRowByName(siteName);
await page.dataTable.waitForHeader();
done(); done();
}); });
it('Favorite a folder - [C280391]', async () => { it('Favorite a folder - [C280391]', async () => {
await dataTable.selectItem(folderSite); await dataTable.selectItem(folderSite);
await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite'); await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 }); await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(folderSiteId); const isFavorite = await apis.user.favorites.isFavorite(folderSiteId);
expect(isFavorite).toBe(true, `${folderSite} not marked as favorite`); expect(isFavorite).toBe(true, `${folderSite} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(folderSiteId); await apis.user.favorites.removeFavoriteById(folderSiteId);
await apis.user.favorites.waitForApi({ expect: 5 });
}); });
it('Favorite a file - [C280342]', async () => { it('Favorite a file - [C280342]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite); await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectItem(fileSiteNotFav1); await dataTable.selectItem(fileSiteNotFav1);
await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite'); await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 }); await apis.user.favorites.waitForApi({ expect: 6 });
const isFavorite = await apis.user.favorites.isFavorite(fileSiteNotFav1Id); const isFavorite = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
expect(isFavorite).toBe(true, `${fileSiteNotFav1} not marked as favorite`); expect(isFavorite).toBe(true, `${fileSiteNotFav1} not marked as favorite`);
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id); await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
}); });
it('Unfavorite an item - [C280343]', async () => { it('Unfavorite an item - [C280343]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite); await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectItem(fileSiteFav1); await dataTable.selectItem(fileSiteFav1);
await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite'); await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 }); await apis.user.favorites.waitForApi({ expect: 4 });
const isFavorite = await apis.user.favorites.isFavorite(fileSiteFav1Id); const isFavorite = await apis.user.favorites.isFavorite(fileSiteFav1Id);
expect(isFavorite).toBe(false, `${fileSiteFav1} is marked as favorite`); expect(isFavorite).toBe(false, `${fileSiteFav1} is marked as favorite`);
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id); await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
}); });
it('Favorite multiple items - all unfavorite - [C280345]', async () => { it('Favorite multiple items - all unfavorite - [C280345]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite); await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteNotFav2 ]); await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteNotFav2 ]);
await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite'); await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 4 }); await apis.user.favorites.waitForApi({ expect: 7 });
const listItems1 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteNotFav1Id), const isFile1Fav = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
apis.user.favorites.isFavorite(fileSiteNotFav2Id) const isFile2Fav = await apis.user.favorites.isFavorite(fileSiteNotFav2Id);
]); expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(listItems1[0]).toBe(true, 'item not marked as favorite'); expect(isFile2Fav).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(fileSiteNotFav1Id);
await apis.user.favorites.removeFavoriteById(fileSiteNotFav2Id); await apis.user.favorites.removeFavoriteById(fileSiteNotFav2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
}); });
it('Unfavorite multiple items - [C280346]', async () => { it('Unfavorite multiple items - [C280346]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite); await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteFav1, fileSiteFav2 ]); await dataTable.selectMultipleItems([ fileSiteFav1, fileSiteFav2 ]);
await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite'); await toolbar.menu.clickMenuItem('Favorite');
const listItems2 = await Promise.all([ await apis.user.favorites.waitForApi({ expect: 3 });
apis.user.favorites.isFavorite(fileSiteFav1Id), const isFile1Fav = await apis.user.favorites.isFavorite(fileSiteFav1Id);
apis.user.favorites.isFavorite(fileSiteFav2Id) const isFile2Fav = await apis.user.favorites.isFavorite(fileSiteFav2Id);
]); expect(isFile1Fav).toBe(false, 'item marked as favorite');
expect(listItems2[0]).toBe(false, 'item marked as favorite'); expect(isFile2Fav).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', fileSiteFav1Id);
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id); await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
await apis.user.favorites.waitForApi({ expect: 5 });
}); });
it('Favorite multiple items - some favorite and some unfavorite - [C280347]', async () => { it('Favorite multiple items - some favorite and some unfavorite - [C280347]', async () => {
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite); await page.dataTable.doubleClickOnRowByName(folderSite);
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteFav1 ]); await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteFav1 ]);
await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
await toolbar.actions.menu.clickMenuItem('Favorite'); await toolbar.menu.clickMenuItem('Favorite');
await apis.user.favorites.waitForApi({ expect: 3 }); await apis.user.favorites.waitForApi({ expect: 6 });
const listItems3 = await Promise.all([
apis.user.favorites.isFavorite(fileSiteNotFav1Id), const isFile1Fav = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
apis.user.favorites.isFavorite(fileSiteFav1) const isFile2Fav = await apis.user.favorites.isFavorite(fileSiteFav1);
]); expect(isFile1Fav).toBe(true, 'item not marked as favorite');
expect(listItems3[0]).toBe(true, 'item not marked as favorite'); expect(isFile2Fav).toBe(true, 'item not marked as favorite');
expect(listItems3[1]).toBe(true, 'item not marked as favorite');
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id); await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
await apis.user.favorites.waitForApi({ expect: 5 });
}); });
}); });
}); });
+26 -23
View File
@@ -23,7 +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 { browser, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { ConfirmDialog } from './../../components/components'; import { ConfirmDialog } from './../../components/components';
import { SIDEBAR_LABELS } from '../../configs'; import { SIDEBAR_LABELS } from '../../configs';
@@ -81,62 +80,66 @@ describe('Permanently delete from Trash', () => {
it('delete file - [C217091]', async () => { it('delete file - [C217091]', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click(); await toolbar.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog(); await trashPage.waitForDialog();
await trashPage.getDialogActionByLabel('Delete').click(); // await trashPage.getDialogActionByLabel('Delete').click();
await trashPage.waitForDialogToClose(); // await trashPage.waitForDialogToClose();
await confirmDialog.clickButton('Delete');
const text = await trashPage.getSnackBarMessage(); const text = await trashPage.getSnackBarMessage();
expect(text).toEqual(`${file1} deleted`); expect(text).toEqual(`${file1} deleted`);
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('delete folder - [C280416]', async () => { it('delete folder - [C280416]', async () => {
await dataTable.selectItem(folder1); await dataTable.selectItem(folder1);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click(); await toolbar.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog(); await trashPage.waitForDialog();
await trashPage.getDialogActionByLabel('Delete').click(); // await trashPage.getDialogActionByLabel('Delete').click();
await trashPage.waitForDialogToClose(); // await trashPage.waitForDialogToClose();
await confirmDialog.clickButton('Delete');
const text = await trashPage.getSnackBarMessage(); const text = await trashPage.getSnackBarMessage();
expect(text).toEqual(`${folder1} deleted`); expect(text).toEqual(`${folder1} deleted`);
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('delete multiple items - [C280417]', async () => { it('delete multiple items - [C280417]', async () => {
await dataTable.selectMultipleItems([ file2, folder2 ]); await dataTable.selectMultipleItems([ file2, folder2 ]);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click(); await toolbar.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog(); await trashPage.waitForDialog();
await trashPage.getDialogActionByLabel('Delete').click(); // await trashPage.getDialogActionByLabel('Delete').click();
await trashPage.waitForDialogToClose(); // await trashPage.waitForDialogToClose();
await confirmDialog.clickButton('Delete');
const text = await trashPage.getSnackBarMessage(); const text = await trashPage.getSnackBarMessage();
expect(text).toEqual(`2 items deleted`); expect(text).toEqual(`2 items deleted`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted');
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted'); expect(await dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted');
}); });
it('Confirmation dialog UI - [C269113]', async () => { it('Confirmation dialog UI - [C269113]', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click(); await toolbar.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog(); await trashPage.waitForDialog();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open');
expect(await confirmDialog.getTitle()).toContain('Delete from trash'); expect(await confirmDialog.getTitle()).toContain('Delete from trash');
expect(await confirmDialog.getText()).toContain('This will permanently remove the selected item(s)'); 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.isButtonEnabled('Delete')).toBe(true, 'DELETE button is not enabled');
expect(await confirmDialog.keepButton.isEnabled()).toBe(true, 'KEEP button is not enabled'); expect(await confirmDialog.isButtonEnabled('Keep')).toBe(true, 'KEEP button is not enabled');
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await Utils.pressEscape();
await dataTable.clearSelection(); await dataTable.clearSelection();
}); });
it('"Keep" action cancels the deletion - [C269115]', async () => { it('Keep action cancels the deletion - [C269115]', async () => {
await dataTable.selectItem(file3); await dataTable.selectItem(file3);
await toolbar.actions.getButtonByTitleAttribute('Permanently delete').click(); await toolbar.getButtonByTitleAttribute('Permanently delete').click();
await trashPage.waitForDialog(); await trashPage.waitForDialog();
expect(await confirmDialog.keepButton.isEnabled()).toBe(true, 'KEEP button is not enabled'); expect(await confirmDialog.isButtonEnabled('Keep')).toBe(true, 'KEEP button is not enabled');
await confirmDialog.clickKeep(); await confirmDialog.clickButton('Keep');
expect(dataTable.getRowByName(file3).isPresent()).toBe(true, 'Item was deleted'); expect(await dataTable.getRowByName(file3).isPresent()).toBe(true, 'Item was deleted');
}); });
}); });
+154 -153
View File
@@ -42,227 +42,228 @@ describe('Restore from Trash', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.trashcan.emptyTrash(), apis.admin.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
xit(''); xit('');
describe('successful restore', () => { describe('successful restore', () => {
const file = `file-${Utils.random()}.txt`; let fileId; const file = `file-${Utils.random()}.txt`;
const folder = `folder-${Utils.random()}`; let folderId; let fileId;
const folder = `folder-${Utils.random()}`;
let folderId;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes.createFile(file).then(resp => fileId = resp.entry.id) fileId = (await apis.user.nodes.createFile(file)).entry.id;
.then(() => apis.user.nodes.createFolder(folder).then(resp => folderId = resp.entry.id)) folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
.then(() => apis.user.nodes.deleteNodesById([ fileId, folderId ], false)) await apis.user.nodes.deleteNodesById([fileId, folderId], false);
.then(done); 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) => {
apis.user.trashcan.emptyTrash().then(done); await apis.user.trashcan.emptyTrash();
done();
}); });
it('restore file - [C217177]', () => { it('restore file - [C217177]', async () => {
dataTable.selectItem(file) await dataTable.selectItem(file);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => {
expect(text).toContain(`${file} restored`); expect(text).toContain(`${file} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list');
}) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
.then(() => {
expect(page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
})
.then(() => apis.user.nodes.deleteNodeById(fileId, false)); await apis.user.nodes.deleteNodeById(fileId, false);
}); });
it('restore folder - [C280438]', () => { it('restore folder - [C280438]', async () => {
dataTable.selectItem(folder) await dataTable.selectItem(folder);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => {
expect(text).toContain(`${folder} restored`); expect(text).toContain(`${folder} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list');
}) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
.then(() => {
expect(page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
})
.then(() => apis.user.nodes.deleteNodeById(folderId, false)); await apis.user.nodes.deleteNodeById(folderId, false);
}); });
it('restore multiple items - [C217182]', () => { it('restore multiple items - [C217182]', async () => {
dataTable.selectMultipleItems([ file, folder ]) await dataTable.selectMultipleItems([file, folder]);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => {
expect(text).toContain(`Restore successful`); expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`); expect(text).not.toContain(`View`);
expect(dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(file).isPresent()).toBe(false, 'Item was not removed from list');
expect(dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list'); expect(await dataTable.getRowByName(folder).isPresent()).toBe(false, 'Item was not removed from list');
}) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await page.dataTable.waitForHeader();
.then(() => page.dataTable.waitForHeader()) expect(await page.dataTable.getRowByName(file).isPresent()).toBe(true, 'Item not displayed in list');
.then(() => { expect(await page.dataTable.getRowByName(folder).isPresent()).toBe(true, 'Item not displayed in list');
expect(page.dataTable.getRowByName(file).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)); await apis.user.nodes.deleteNodesById([fileId, folderId], false);
}); });
it('View from notification - [C217181]', () => { it('View from notification - [C217181]', async () => {
dataTable.selectItem(file) await dataTable.selectItem(file);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.clickSnackBarAction()) await page.clickSnackBarAction();
.then(() => page.dataTable.waitForHeader()) await page.dataTable.waitForHeader();
.then(() => { expect(await page.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
expect(page.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active'); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
})
.then(() => apis.user.nodes.deleteNodeById(fileId, false)); await apis.user.nodes.deleteNodeById(fileId, false);
}); });
}); });
describe('failure to restore', () => { describe('failure to restore', () => {
const file1 = `file-${Utils.random()}.txt`; let file1Id1, file1Id2; const file1 = `file-${Utils.random()}.txt`;
const file2 = `file-${Utils.random()}.txt`; let file2Id; let file1Id1, file1Id2;
const file2 = `file-${Utils.random()}.txt`;
let file2Id;
const folder1 = `folder-${Utils.random()}`; let folder1Id; const folder1 = `folder-${Utils.random()}`;
const folder2 = `folder-${Utils.random()}`; let folder2Id; let folder1Id;
const folder2 = `folder-${Utils.random()}`;
let folder2Id;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id) folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id1 = resp.entry.id)) file1Id1 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file1Id1, false)) await apis.user.nodes.deleteNodeById(file1Id1, false);
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id2 = resp.entry.id)) file1Id2 = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
.then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.entry.id)) folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
.then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => file2Id = resp.entry.id)) file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file2Id, false)) await apis.user.nodes.deleteNodeById(file2Id, false);
.then(() => apis.user.nodes.deleteNodeById(folder2Id, false)) await apis.user.nodes.deleteNodeById(folder2Id, false);
.then(done); 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) => {
Promise.all([ await Promise.all([
apis.user.nodes.deleteNodeById(file1Id2), apis.user.nodes.deleteNodeById(file1Id2),
apis.user.trashcan.emptyTrash() apis.user.trashcan.emptyTrash()
]) ]);
.then(done); done();
}); });
it('Restore a file when another file with same name exists on the restore location - [C217178]', () => { it('Restore a file when another file with same name exists on the restore location - [C217178]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => dataTable.selectItem(file1)) await dataTable.selectItem(file1);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => expect(text).toEqual(`Can't restore, ${file1} already exists`)); expect(text).toEqual(`Can't restore, ${file1} already exists`);
}); });
it('Restore a file when original location no longer exists - [C217179]', () => { it('Restore a file when original location no longer exists - [C217179]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => dataTable.selectItem(file2)) await dataTable.selectItem(file2);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`)); expect(text).toEqual(`Can't restore ${file2}, the original location no longer exists`);
}); });
}); });
describe('Notification on partial success', () => { describe('Notification on partial success', () => {
const folder1 = `folder1-${Utils.random()}.txt`; let folder1Id; const folder1 = `folder1-${Utils.random()}.txt`;
const folder2 = `folder2-${Utils.random()}.txt`; let folder2Id; let folder1Id;
const file1 = `file-${Utils.random()}.txt`; let file1Id; const folder2 = `folder2-${Utils.random()}.txt`;
const file2 = `file-${Utils.random()}.txt`; let file2Id; let folder2Id;
const file1 = `file-${Utils.random()}.txt`;
let file1Id;
const file2 = `file-${Utils.random()}.txt`;
let file2Id;
const folder3 = `folder3-${Utils.random()}.txt`; let folder3Id; const folder3 = `folder3-${Utils.random()}.txt`;
const folder4 = `folder4-${Utils.random()}.txt`; let folder4Id; let folder3Id;
const file3 = `file3-${Utils.random()}.txt`; let file3Id; const folder4 = `folder4-${Utils.random()}.txt`;
const file4 = `file4-${Utils.random()}.txt`; let file4Id; let folder4Id;
const file5 = `file5-${Utils.random()}.txt`; let file5Id; const file3 = `file3-${Utils.random()}.txt`;
let file3Id;
const file4 = `file4-${Utils.random()}.txt`;
let file4Id;
const file5 = `file5-${Utils.random()}.txt`;
let file5Id;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id) folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.then(() => apis.user.nodes.createFile(file1, folder1Id).then(resp => file1Id = resp.entry.id)) file1Id = (await apis.user.nodes.createFile(file1, folder1Id)).entry.id;
.then(() => apis.user.nodes.createFolder(folder2).then(resp => folder2Id = resp.entry.id)) folder2Id = (await apis.user.nodes.createFolder(folder2)).entry.id;
.then(() => apis.user.nodes.createFile(file2, folder2Id).then(resp => file2Id = resp.entry.id)) file2Id = (await apis.user.nodes.createFile(file2, folder2Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file1Id, false)) await apis.user.nodes.deleteNodeById(file1Id, false);
.then(() => apis.user.nodes.deleteNodeById(folder1Id, false)) await apis.user.nodes.deleteNodeById(folder1Id, false);
.then(() => apis.user.nodes.deleteNodeById(file2Id, false)) await apis.user.nodes.deleteNodeById(file2Id, false);
.then(() => apis.user.nodes.createFolder(folder3).then(resp => folder3Id = resp.entry.id)) folder3Id = (await apis.user.nodes.createFolder(folder3)).entry.id;
.then(() => apis.user.nodes.createFile(file3, folder3Id).then(resp => file3Id = resp.entry.id)) file3Id = (await apis.user.nodes.createFile(file3, folder3Id)).entry.id;
.then(() => apis.user.nodes.createFile(file4, folder3Id).then(resp => file4Id = resp.entry.id)) file4Id = (await apis.user.nodes.createFile(file4, folder3Id)).entry.id;
.then(() => apis.user.nodes.createFolder(folder4).then(resp => folder4Id = resp.entry.id)) folder4Id = (await apis.user.nodes.createFolder(folder4)).entry.id;
.then(() => apis.user.nodes.createFile(file5, folder4Id).then(resp => file5Id = resp.entry.id)) file5Id = (await apis.user.nodes.createFile(file5, folder4Id)).entry.id;
.then(() => apis.user.nodes.deleteNodeById(file3Id, false)) await apis.user.nodes.deleteNodeById(file3Id, false);
.then(() => apis.user.nodes.deleteNodeById(file4Id, false)) await apis.user.nodes.deleteNodeById(file4Id, false);
.then(() => apis.user.nodes.deleteNodeById(folder3Id, false)) await apis.user.nodes.deleteNodeById(folder3Id, false);
.then(() => apis.user.nodes.deleteNodeById(file5Id, false)) await apis.user.nodes.deleteNodeById(file5Id, false);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); 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) => {
Promise.all([ await Promise.all([
apis.user.trashcan.emptyTrash(), apis.user.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('one failure - [C217183]', () => { it('one failure - [C217183]', async () => {
dataTable.selectMultipleItems([ file1, file2 ]) await dataTable.selectMultipleItems([file1, file2]);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`)); expect(text).toEqual(`Can't restore ${file1}, the original location no longer exists`);
}); });
it('multiple failures - [C217184]', () => { it('multiple failures - [C217184]', async () => {
dataTable.selectMultipleItems([ file3, file4, file5 ]) await dataTable.selectMultipleItems([file3, file4, file5]);
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click()) await toolbar.getButtonByTitleAttribute('Restore').click();
.then(() => page.getSnackBarMessage()) const text = await page.getSnackBarMessage();
.then(text => expect(text).toEqual('2 items not restored because of issues with the restore location')); expect(text).toEqual('2 items not restored because of issues with the restore location');
}); });
}); });
}); });
+1069
View File
File diff suppressed because it is too large Load Diff
+208
View File
@@ -0,0 +1,208 @@
/*!
* @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/viewer/viewer';
import { SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Single click on item name', () => {
const username = `user-${Utils.random()}`;
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const folder1 = `folder1-${Utils.random()}`; let folder1Id;
const deletedFile1 = `file1-${Utils.random()}.txt`; let deletedFile1Id;
const deletedFolder1 = `folder1-${Utils.random()}`; let deletedFolder1Id;
const siteName = `site-${Utils.random()}`;
const fileSite = `fileSite-${Utils.random()}.txt`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, breadcrumb } = page;
const viewer = new Viewer();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
file1Id = (await apis.user.nodes.createFile(file1)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
deletedFile1Id = (await apis.user.nodes.createFile(deletedFile1)).entry.id;
deletedFolder1Id = (await apis.user.nodes.createFolder(deletedFolder1)).entry.id;
await apis.user.nodes.deleteNodeById(deletedFile1Id, false);
await apis.user.nodes.deleteNodeById(deletedFolder1Id, false);
await apis.user.sites.createSite(siteName);
const docLibId = (await apis.user.sites.getDocLibId(siteName));
await apis.user.nodes.createFile(fileSite, docLibId);
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('folder', folder1Id);
await apis.user.favorites.waitForApi({ expect: 2 + 1 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folder1Id);
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
it('Hyperlink does not appear for items in the Trash - [C284899]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader();
expect(await dataTable.hasLinkOnName(deletedFile1)).toBe(false, 'Link on name is present');
expect(await dataTable.hasLinkOnName(deletedFolder1)).toBe(false, 'Link on name is present');
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
it('Hyperlink appears when mouse over a file/folder - [C280032]', async () => {
expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing');
});
it('File preview opens when clicking the hyperlink - [C280033]', async () => {
await dataTable.clickNameLink(file1);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await Utils.pressEscape();
});
it('Navigate inside the folder when clicking the hyperlink - [C280034]', async () => {
await dataTable.clickNameLink(folder1);
expect(await breadcrumb.getCurrentItemName()).toBe(folder1);
});
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
done();
});
it('Hyperlink appears when mouse over a library - [C284901]', async () => {
expect(await dataTable.hasLinkOnName(siteName)).toBe(true, 'Link on site name is missing');
});
it('Navigate inside the library when clicking the hyperlink - [C284902]', async () => {
await dataTable.clickNameLink(siteName);
expect(await breadcrumb.getCurrentItemName()).toBe(siteName);
expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
});
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
done();
});
it('Hyperlink appears when mouse over a file - [C284905]', async () => {
expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing');
});
it('File preview opens when clicking the hyperlink - [C284906]', async () => {
await dataTable.clickNameLink(file1);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await Utils.pressEscape();
});
});
describe('on Recent Files', () => {
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
});
it('Hyperlink appears when mouse over a file - [C284907]', async () => {
expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing');
});
it('File preview opens when clicking the hyperlink - [C284908]', async () => {
await dataTable.clickNameLink(file1);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await Utils.pressEscape();
});
});
describe('on Favorites', () => {
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
it('Hyperlink appears when mouse over a file/folder - [C284909]', async () => {
expect(await dataTable.hasLinkOnName(file1)).toBe(true, 'Link on name is missing');
});
it('File preview opens when clicking the hyperlink - [C284910]', async () => {
await dataTable.clickNameLink(file1);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await Utils.pressEscape();
});
it('Navigate inside the folder when clicking the hyperlink - [C284911]', async () => {
await dataTable.clickNameLink(folder1);
expect(await breadcrumb.getCurrentItemName()).toBe(folder1);
});
});
});
@@ -0,0 +1,720 @@
/*!
* @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 { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS, FILES } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
import { Viewer } from '../../components/viewer/viewer';
describe('Granular permissions available actions : ', () => {
const userConsumer = `consumer-${Utils.random()}`;
const userManager = `manager-${Utils.random()}`;
const siteName = `site-private-${Utils.random()}`;
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 folder1 = `folder1-${Utils.random()}`;
let folder1Id;
const folder2 = `folder2-${Utils.random()}`;
let folder2Id;
const docxFile = FILES.docxFile;
let docxFileId;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer),
userManager: new RepoClient(userManager, userManager)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const contextMenu = dataTable.menu;
const viewer = new Viewer();
const viewerToolbar = viewer.toolbar;
beforeAll(async done => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.people.createUser({ username: userManager });
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id;
file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id;
file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id;
folder1Id = (await apis.admin.nodes.createFolder(folder1, docLibId)).entry.id;
folder2Id = (await apis.admin.nodes.createFolder(folder2, docLibId)).entry.id;
docxFileId = (await apis.admin.upload.uploadFile(docxFile, docLibId)).entry.id;
await apis.admin.sites.addSiteMember(siteName, userManager, SITE_ROLES.SITE_MANAGER);
await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER);
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER);
await apis.userConsumer.shared.shareFileById(file1Id);
await apis.userConsumer.shared.shareFileById(file2Id);
await apis.userConsumer.shared.shareFileById(docxFileId);
await apis.userConsumer.shared.shareFileById(file3Id);
await apis.userConsumer.shared.waitForApi({ expect: 4 });
await apis.userConsumer.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, docxFileId]);
await apis.userConsumer.favorites.addFavoritesByIds('folder', [folder1Id, folder2Id]);
await apis.userConsumer.favorites.waitForApi({ expect: 6 });
await loginPage.loginWith(userConsumer);
done();
});
afterAll(async done => {
await apis.admin.sites.deleteSite(siteName);
await logoutPage.load();
done();
});
xit('');
describe('toolbar displays correct actions when selecting multiple files with different granular permissions', () => {
beforeEach(async done => {
await Utils.pressEscape();
done();
});
it('on File Libraries - [C280476]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
it('on Shared Files - [C280477]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C280478]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for a file - consumer', () => {
beforeEach(async done => {
await Utils.pressEscape();
done();
});
it('on File Libraries - [C280455]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.closeMoreMenu();
});
it('on Shared Files - [C280456]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await page.dataTable.waitForHeader();
await page.dataTable.selectItem(file1);
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C213121]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for a folder - consumer', () => {
beforeEach(async done => {
await Utils.pressEscape();
done();
});
it('on File Libraries - [C280444]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectItem(folder1);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folder1}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${folder1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${folder1}`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folder1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C286266]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectItem(folder1);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is not displayed for ${folder1}`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${folder1}`);
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${folder1}`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folder1}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for multiple selection of files - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
it('on File Libraries - [C280464]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.closeMoreMenu();
});
it('on Shared Files - [C286284]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C286285]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for multiple selection of folders - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
it('on File Libraries - [C280465]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C286286]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('toolbar actions appear correctly for when both files and folders are selected - consumer', () => {
beforeEach(async done => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
it('on File Libraries - [C280466]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, folder1]);
expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C286287]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, folder1]);
expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for selected files`);
expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for selected files`);
expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for selected files`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
// TODO: enable when ACA-1737 is done
// expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
// expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.closeMoreMenu();
});
});
describe('context menu actions are correct for a file - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
it('on File Libraries - [C280599]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.rightClickOnItem(file1);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${file1}`);
});
it('on Shared Files - [C286264]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.rightClickOnItem(file1);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
// TODO: enable this when the action is properly implemented: ACA-92
// expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${file1}`);
});
it('on Favorites - [C286262]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.rightClickOnItem(file1);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
// TODO: enable when ACA-1737 is done
// expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
// expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage Versions is not displayed for ${file1}`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
expect(await contextMenu.isMenuItemPresent('View details')).toBe(false, `View details is displayed for ${file1}`);
});
});
describe('context menu actions are correct for a folder - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
it('on File Libraries - [C280600]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.rightClickOnItem(folder1);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not enabled for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(false, `Manage Versions displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is displayed for ${folder1}`);
});
it('on Favorites - [C286263]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.rightClickOnItem(folder1);
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, `Download is not enabled for ${folder1}`);
// enable when ACA-1737 is done
// expect(await contextMenu.isMenuItemPresent('Edit')).toBe(false, `Edit is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folder1}`);
// TODO: enable when ACA-1737 is done
// expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folder1}`);
// expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folder1}`);
// TODO: enable when ACA-1794 is fixed
// expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(true, `Permissions is not displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, `View is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Manage Versions')).toBe(false, `Manage Versions is displayed for ${folder1}`);
expect(await contextMenu.isMenuItemPresent('Share')).toBe(false, `Share is displayed for ${folder1}`);
});
});
describe('context menu actions are correct for multiple selection of files - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
it('on File Libraries - [C280647]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
it('on Shared Files - [C286283]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
it('on Favorites - [C286280]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, file2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
// TODO: enable when ACA-1737 is done
// expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
// expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
});
describe('context menu actions are correct for multiple selection of folders - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
it('on File Libraries - [C280666]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([folder1, folder2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
it('on Favorites - [C286281]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([folder1, folder2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
// TODO: enable when ACA-1737 is done
// expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
// expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
});
describe('context menu actions are correct when both files and folders are selected - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
it('on File Libraries - [C280669]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, folder1]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
it('on Favorites - [C286282]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([file1, folder1]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isMenuItemPresent('View')).toBe(false, 'View is displayed');
expect(await contextMenu.isMenuItemPresent('Download')).toBe(true, 'Download is not displayed');
expect(await contextMenu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
// TODO: enable when ACA-1737 is done
// expect(await contextMenu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
// expect(await contextMenu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await contextMenu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
});
});
describe('toolbar actions appear correctly in the viewer - consumer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
it('file from File Libraries - [C268128]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(docxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await viewerToolbar.isButtonPresent('View')).toBe(false, `View is displayed`);
expect(await viewerToolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await toolbar.closeMoreMenu();
});
it('file from Shared Files - [C286310]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await page.dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(docxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await viewerToolbar.isButtonPresent('View')).toBe(false, `View is displayed`);
expect(await viewerToolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await toolbar.closeMoreMenu();
});
it('file from Favorites - [C286311]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(docxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await viewerToolbar.isButtonPresent('View')).toBe(false, `View is displayed`);
expect(await viewerToolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isButtonPresent('Print')).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isButtonPresent('Activate full-screen mode')).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Share')).toBe(true, `Share is not displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
// TODO: enable when ACA-1737 is done
// expect(await viewerToolbar.menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
// expect(await viewerToolbar.menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Manage Versions')).toBe(true, `Manage versions is displayed`);
expect(await viewerToolbar.menu.isMenuItemPresent('Permissions')).toBe(false, `Permissions is displayed`);
await toolbar.closeMoreMenu();
});
});
});
@@ -25,73 +25,87 @@
import { browser, protractor } from 'protractor'; import { browser, protractor } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs'; import { SITE_VISIBILITY, 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('Toolbar actions - multiple selection : ', () => { describe('Toolbar actions - multiple selection : ', () => {
const user1 = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const user2 = `user-${Utils.random()}`;
const file1 = `file-${Utils.random()}.txt`; const file1 = `file1-${Utils.random()}.txt`;
let file1Id; let file1Id;
const file2 = `file-${Utils.random()}.txt`; const file2 = `file2-${Utils.random()}.txt`;
let file2Id; let file2Id;
const folder1 = `folder-${Utils.random()}`; const folder1 = `folder1-${Utils.random()}`;
let folder1Id; let folder1Id;
const folder2 = `folder-${Utils.random()}`; const folder2 = `folder2-${Utils.random()}`;
let folder2Id; let folder2Id;
const fileForDelete1 = `file-${Utils.random()}.txt`; let fileForDelete1Id; const fileForDelete1 = `file-${Utils.random()}.txt`;
const fileForDelete2 = `file-${Utils.random()}.txt`; let fileForDelete2Id; let fileForDelete1Id;
const folderForDelete1 = `folder-${Utils.random()}`; let folderForDelete1Id; const fileForDelete2 = `file-${Utils.random()}.txt`;
const folderForDelete2 = `folder-${Utils.random()}`; let folderForDelete2Id; let fileForDelete2Id;
const folderForDelete1 = `folder-${Utils.random()}`;
let folderForDelete1Id;
const folderForDelete2 = `folder-${Utils.random()}`;
let folderForDelete2Id;
const siteName = `site-private-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const file1Admin = `file-${Utils.random()}.txt`; const file1InSite = `file1-${Utils.random()}.txt`;
const file2Admin = `file-${Utils.random()}.txt`; const file2InSite = `file2-${Utils.random()}.txt`;
const folder1Admin = `folder-${Utils.random()}`; const folder1InSite = `folder1-${Utils.random()}`;
const folder2Admin = `folder-${Utils.random()}`; const folder2InSite = `folder2-${Utils.random()}`;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(user1, user1) user: new RepoClient(username, username)
}; };
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 { dataTable } = page; const { dataTable, toolbar } = page;
const { toolbar } = page;
beforeAll(async (done) => { beforeAll(async done => {
await apis.admin.people.createUser({ username: user1 }); await apis.admin.people.createUser({ username });
file1Id = (await apis.user.nodes.createFiles([ file1 ])).entry.id;
file2Id = (await apis.user.nodes.createFiles([ file2 ])).entry.id;
folder1Id = (await apis.user.nodes.createFolders([ folder1 ])).entry.id;
folder2Id = (await apis.user.nodes.createFolders([ folder2 ])).entry.id;
fileForDelete1Id = (await apis.user.nodes.createFiles([ fileForDelete1 ])).entry.id;
fileForDelete2Id = (await apis.user.nodes.createFiles([ fileForDelete2 ])).entry.id;
folderForDelete1Id = (await apis.user.nodes.createFolders([ folderForDelete1 ])).entry.id;
folderForDelete2Id = (await apis.user.nodes.createFolders([ folderForDelete2 ])).entry.id;
await apis.user.shared.shareFilesByIds([ file1Id, file2Id ]); file1Id = (await apis.user.nodes.createFiles([file1])).entry.id;
file2Id = (await apis.user.nodes.createFiles([file2])).entry.id;
folder1Id = (await apis.user.nodes.createFolders([folder1])).entry.id;
folder2Id = (await apis.user.nodes.createFolders([folder2])).entry.id;
fileForDelete1Id = (await apis.user.nodes.createFiles([fileForDelete1])).entry.id;
fileForDelete2Id = (await apis.user.nodes.createFiles([fileForDelete2])).entry.id;
folderForDelete1Id = (await apis.user.nodes.createFolders([folderForDelete1])).entry.id;
folderForDelete2Id = (await apis.user.nodes.createFolders([folderForDelete2])).entry.id;
await apis.user.shared.shareFilesByIds([file1Id, file2Id]);
await apis.user.shared.waitForApi({ expect: 2 }); await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id ]); await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id]);
await apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ]); await apis.user.favorites.addFavoritesByIds('folder', [folder1Id, folder2Id]);
await apis.user.favorites.waitForApi({ expect: 4 }); await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.nodes.deleteNodesById([ fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id ], false); await apis.user.nodes.deleteNodesById([fileForDelete1Id, fileForDelete2Id, folderForDelete1Id, folderForDelete2Id], false);
await apis.user.trashcan.waitForApi({ expect: 4 });
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFile(file1InSite, docLibId);
await apis.user.nodes.createFile(file2InSite, docLibId);
await apis.user.nodes.createFolder(folder1InSite, docLibId);
await apis.user.nodes.createFolder(folder2InSite, docLibId);
await apis.user.search.waitForApi(username, { expect: 4 });
await loginPage.loginWith(username);
done(); done();
}); });
afterAll(async (done) => { afterAll(async done => {
await 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(),
apis.user.sites.deleteSite(siteName),
logoutPage.load() logoutPage.load()
]); ]);
done(); done();
@@ -100,28 +114,19 @@ describe('Toolbar actions - multiple selection : ', () => {
xit(''); xit('');
describe('Personal Files', () => { describe('Personal Files', () => {
beforeAll(async (done) => { beforeEach(async done => {
await loginPage.loginWith(user1); await Utils.pressEscape();
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('Unselect items with single click - [C280458]', async () => { it('Unselect items with single click - [C280458]', async () => {
await dataTable.selectMultipleItems([ file1, file2, folder1, folder2 ]); await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number'); expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number'); expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number');
await dataTable.clearSelection();
}); });
it('Select / unselect selected items by CMD+click - [C217110]', async () => { it('Select / unselect selected items by CMD+click - [C217110]', async () => {
@@ -136,362 +141,217 @@ describe('Toolbar actions - multiple selection : ', () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await dataTable.selectItem(file2); await dataTable.selectItem(file2);
await browser.actions().sendKeys(protractor.Key.NULL).perform(); await browser.actions().sendKeys(protractor.Key.NULL).perform();
expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number'); expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number');
await dataTable.clearSelection();
}); });
it('correct actions appear when multiple files are selected - [C217112]', async () => { it('correct actions appear when multiple files are selected - [C217112]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await toolbar.closeMoreMenu();
await dataTable.clearSelection();
}); });
it('correct actions appear when multiple folders are selected - [C280459]', async () => { it('correct actions appear when multiple folders are selected - [C280459]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]); await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await toolbar.closeMoreMenu();
await dataTable.clearSelection();
}); });
it('correct actions appear when both files and folders are selected - [C280460]', async () => { it('correct actions appear when both files and folders are selected - [C280460]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await toolbar.closeMoreMenu();
await dataTable.clearSelection();
}); });
}); });
describe('File Libraries', () => { describe('File Libraries', () => {
beforeAll(async (done) => { beforeEach(async done => {
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); // await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await apis.admin.people.createUser({ username: user2 }); await Utils.pressEscape();
await apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER);
await apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER);
await apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`);
await apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`);
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName); await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(siteName);
done();
});
xit('');
describe('user is Manager', () => {
beforeAll(async (done) => {
await loginPage.loginWith(user1);
done();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('correct actions appear when multiple files are selected - [C280461]', async () => { it('correct actions appear when multiple files are selected - [C280461]', async () => {
await dataTable.selectMultipleItems([file1Admin, file2Admin]); await dataTable.selectMultipleItems([file1InSite, file2InSite]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files'); expect(await toolbar.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(await toolbar.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(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
it('correct actions appear when multiple folders are selected - [C280462]', async () => { it('correct actions appear when multiple folders are selected - [C280462]', async () => {
await dataTable.selectMultipleItems([folder1Admin, folder2Admin]); await dataTable.selectMultipleItems([folder1InSite, folder2InSite]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
it('correct actions appear when both files and folders are selected - [C280463]', async () => { it('correct actions appear when both files and folders are selected - [C280463]', async () => {
await dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]); await dataTable.selectMultipleItems([file1InSite, file2InSite, folder1InSite, folder2InSite]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
});
});
describe('user is Consumer', () => {
beforeAll(async (done) => {
await loginPage.loginWith(user2);
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('correct actions appear when multiple files are selected - [C280464]', async () => {
await dataTable.selectMultipleItems([file1Admin, file2Admin]);
expect(await 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(await 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`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
});
it('correct actions appear when multiple folders are selected - [C280465]', async () => {
await dataTable.selectMultipleItems([folder1Admin, folder2Admin]);
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`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
});
it('correct actions appear when both files and folders are selected - [C280466]', async () => {
await dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin]);
expect(await 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(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(false, `Delete is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
});
}); });
}); });
describe('Shared Files', () => { describe('Shared Files', () => {
beforeAll(async (done) => { beforeEach(async done => {
await loginPage.loginWith(user1); // await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done(); await Utils.pressEscape();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('correct actions appear when multiple files are selected - [C280467]', async () => { it('correct actions appear when multiple files are selected - [C280467]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.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(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
}); });
describe('Recent Files', () => { describe('Recent Files', () => {
beforeAll(async (done) => { beforeEach(async done => {
await loginPage.loginWith(user1); // await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done(); await Utils.pressEscape();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('correct actions appear when multiple files are selected - [C280468]', async () => { it('correct actions appear when multiple files are selected - [C280468]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
}); });
describe('Favorites', () => { describe('Favorites', () => {
beforeAll(async (done) => { beforeEach(async done => {
await loginPage.loginWith(user1); // await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
done(); await Utils.pressEscape();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('correct actions appear when multiple files are selected - [C280469]', async () => { it('correct actions appear when multiple files are selected - [C280469]', async () => {
await dataTable.selectMultipleItems([file1, file2]); await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
it('correct actions appear when multiple folders are selected - [C280470]', async () => { it('correct actions appear when multiple folders are selected - [C280470]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]); await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
it('correct actions appear when both files and folders are selected - [C280471]', async () => { it('correct actions appear when both files and folders are selected - [C280471]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]); await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed'); expect(await toolbar.isButtonPresent('View')).toBe(false, 'View is displayed');
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files'); expect(await toolbar.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed'); expect(await toolbar.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`); expect(await toolbar.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 toolbar.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 toolbar.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`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
await dataTable.clearSelection();
}); });
}); });
describe('Trash', () => { describe('Trash', () => {
beforeAll(async (done) => { beforeEach(async done => {
await loginPage.loginWith(user1); await Utils.pressEscape();
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('correct actions appear when multiple files are selected - [C280472]', async () => { it('correct actions appear when multiple files are selected - [C280472]', async () => {
await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]); await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]);
expect(await toolbar.actions.isButtonPresent('Permanently delete')) expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
.toBe(true, 'Permanently delete is displayed for selected files'); expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
await dataTable.clearSelection();
}); });
it('correct actions appear when multiple folders are selected - [C280473]', async () => { it('correct actions appear when multiple folders are selected - [C280473]', async () => {
await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]); await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]);
expect(await toolbar.actions.isButtonPresent('Permanently delete')) expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
.toBe(true, 'Permanently delete is displayed for selected files'); expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
await dataTable.clearSelection();
}); });
it('correct actions appear when both files and folders are selected - [C280474]', async () => { it('correct actions appear when both files and folders are selected - [C280474]', async () => {
await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]); await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]);
expect(await toolbar.actions.isButtonPresent('Permanently delete')) expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
.toBe(true, 'Permanently delete is displayed for selected files'); expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
await dataTable.clearSelection();
}); });
}); });
}); });
@@ -23,24 +23,22 @@
* 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 { SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs'; import { SITE_VISIBILITY, 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('Toolbar actions - single selection : ', () => { describe('Toolbar actions - single selection : ', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const username2 = `user-${Utils.random()}`;
const fileUser = `fileUser-${Utils.random()}.txt`; let fileUserId; const fileUser = `fileUser-${Utils.random()}.txt`; let fileUserId;
const folderUser = `folderUser-${Utils.random()}`; let folderUserId; const folderUser = `folderUser-${Utils.random()}`; let folderUserId;
const fileForDelete = `fileForDelete-${Utils.random()}.txt`; let fileForDeleteId; const fileForDelete = `fileForDelete-${Utils.random()}.txt`; let fileForDeleteId;
const folderForDelete = `folderForDelete-${Utils.random()}`; let folderForDeleteId; const folderForDelete = `folderForDelete-${Utils.random()}`; let folderForDeleteId;
const siteName = `site-private-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const fileAdmin = `fileAdmin-${Utils.random()}.txt`; const fileInSite = `fileAdmin-${Utils.random()}.txt`;
const folderAdmin = `folderAdmin-${Utils.random()}`; const folderInSite = `folderAdmin-${Utils.random()}`;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
@@ -55,10 +53,10 @@ describe('Toolbar actions - single selection : ', () => {
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
fileUserId = (await apis.user.nodes.createFiles([fileUser])).entry.id; fileUserId = (await apis.user.nodes.createFile(fileUser)).entry.id;
fileForDeleteId = (await apis.user.nodes.createFiles([fileForDelete])).entry.id; fileForDeleteId = (await apis.user.nodes.createFile(fileForDelete)).entry.id;
folderForDeleteId = (await apis.user.nodes.createFolders([ folderForDelete ])).entry.id; folderForDeleteId = (await apis.user.nodes.createFolder(folderForDelete)).entry.id;
folderUserId = (await apis.user.nodes.createFolders([ folderUser ])).entry.id; folderUserId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
await apis.user.shared.shareFileById(fileUserId); await apis.user.shared.shareFileById(fileUserId);
await apis.user.shared.waitForApi({ expect: 1 }); await apis.user.shared.waitForApi({ expect: 1 });
@@ -67,43 +65,38 @@ describe('Toolbar actions - single selection : ', () => {
await apis.user.favorites.addFavoriteById('folder', folderUserId); await apis.user.favorites.addFavoriteById('folder', folderUserId);
await apis.user.favorites.waitForApi({ expect: 2 }); await apis.user.favorites.waitForApi({ expect: 2 });
done(); await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
}); const docLibId = await apis.user.sites.getDocLibId(siteName);
afterAll(async (done) => { await apis.user.nodes.createFile(fileInSite, docLibId);
await Promise.all([ await apis.user.nodes.createFolder(folderInSite, docLibId);
apis.user.nodes.deleteNodeById(fileUserId),
apis.user.nodes.deleteNodeById(folderUserId)
]);
done(); await apis.user.nodes.deleteNodeById(fileForDeleteId, false);
}); await apis.user.nodes.deleteNodeById(folderForDeleteId, false);
xit('');
describe('General tests', () => {
const userSite = `userSite-${Utils.random()}`;
beforeAll(async (done) => {
await apis.user.sites.createSite(userSite, SITE_VISIBILITY.PUBLIC);
await loginPage.loginWith(username); await loginPage.loginWith(username);
done(); done();
}); });
afterAll(async (done) => { afterAll(async (done) => {
await Promise.all([ await Promise.all([
apis.user.sites.deleteSite(userSite), apis.user.nodes.deleteNodeById(fileUserId),
apis.user.nodes.deleteNodeById(folderUserId),
apis.user.sites.deleteSite(siteName),
apis.user.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]); ]);
done(); done();
}); });
xit('');
describe('General tests', () => {
it('actions not displayed for top level of File Libraries - [C213135]', async () => { it('actions not displayed for top level of File Libraries - [C213135]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.selectItem(userSite); await dataTable.selectItem(siteName);
expect(await toolbar.actions.isEmpty()).toBe(true, 'toolbar not empty'); expect(await toolbar.isEmpty()).toBe(true, 'toolbar not empty');
}); });
it('selected row is marked with a check circle icon - [C213134]', async () => { it('selected row is marked with a check circle icon - [C213134]', async () => {
@@ -114,536 +107,216 @@ describe('Toolbar actions - single selection : ', () => {
}); });
}); });
describe('granular permissions', () => {
const site = `site-${Utils.random()}`;
const file1 = `file1-${Utils.random()}`; let file1Id;
const file2 = `file2-${Utils.random()}`; let file2Id;
beforeAll(async (done) => {
await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(site);
file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id;
file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id;
await apis.admin.sites.addSiteMember(site, username, SITE_ROLES.SITE_CONSUMER);
await apis.admin.nodes.setGranularPermission(file1Id, false, username, SITE_ROLES.SITE_CONSUMER);
await apis.admin.nodes.setGranularPermission(file2Id, false, username, SITE_ROLES.SITE_MANAGER);
await apis.user.shared.shareFileById(file1Id);
await apis.admin.shared.shareFileById(file2Id);
await apis.user.shared.waitForApi({ expect: 3 });
await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id]);
await apis.user.favorites.waitForApi({ expect: 3 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.admin.sites.deleteSite(site),
logoutPage.load()
]);
done();
});
describe('actions update accordingly for files with different granular permissions', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
done();
});
it('on File Libraries - [C280455]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(site);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
let menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.actions.closeMoreMenu();
await dataTable.selectItem(file2);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`);
menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`);
await toolbar.actions.closeMoreMenu();
});
it('on Shared Files - [C280456]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await page.dataTable.waitForHeader();
await page.dataTable.selectItem(file1);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
let menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.actions.closeMoreMenu();
await page.dataTable.selectItem(file2);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`);
menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`);
await toolbar.actions.closeMoreMenu();
});
// disabled until ACA-1184 is done
xit('on Favorites - [C213121]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file1}`);
let menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${file1}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file1}`);
await toolbar.actions.closeMoreMenu();
await dataTable.selectItem(file2);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${file2}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${file2}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${file2}`);
menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${file2}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${file2}`);
await toolbar.actions.closeMoreMenu();
});
});
describe('correct actions are displayed when selecting multiple files with different granular permissions', () => {
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
done();
});
it('on File Libraries - [C280476]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(site);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([ file1, file2 ]);
expect(await 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(await 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`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.actions.closeMoreMenu();
});
it('on Shared Files - [C280477]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([ file1, file2 ]);
expect(await 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(await 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`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.actions.closeMoreMenu();
});
// disabled until ACA-1184 is done
xit('on Favorites - [C280478]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectMultipleItems([ file1, file2 ]);
expect(await 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(await 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`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
await toolbar.actions.closeMoreMenu();
});
});
xit('');
});
describe('Personal Files', () => { describe('Personal Files', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => { beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('actions are not displayed when no item is selected - [C213120]', async () => { it('actions are not displayed when no item is selected - [C213120]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
}); });
it('correct actions appear when a file is selected - [C213122]', async () => { it('correct actions appear when a file is selected - [C213122]', async () => {
await dataTable.selectItem(fileUser); await dataTable.selectItem(fileUser);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
it('correct actions appear when a folder is selected - [C213123]', async () => { it('correct actions appear when a folder is selected - [C213123]', async () => {
await dataTable.selectItem(folderUser); await dataTable.selectItem(folderUser);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`); expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`); expect(await toolbar.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
}); });
describe('File Libraries', () => { describe('File Libraries', () => {
beforeAll(async (done) => {
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
await apis.admin.people.createUser({ username: username2 });
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
await apis.admin.sites.addSiteMember(siteName, username2, SITE_ROLES.SITE_CONSUMER);
await apis.admin.nodes.createFile(fileAdmin, docLibId);
await apis.admin.nodes.createFolder(folderAdmin, docLibId);
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(siteName);
done();
});
xit('');
describe('user is Manager', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => { beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName); await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('actions are not displayed when no item is selected - [C280439]', async () => { it('actions are not displayed when no item is selected - [C280439]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
}); });
it('correct actions appear when a file is selected - [C280440]', async () => { it('correct actions appear when a file is selected - [C280440]', async () => {
await dataTable.selectItem(fileAdmin); await dataTable.selectItem(fileInSite);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileInSite}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`); expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileInSite}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileInSite}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`); expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileInSite}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileInSite}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileInSite}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileInSite}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileInSite}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
it('correct actions appear when a folder is selected - [C280441]', async () => { it('correct actions appear when a folder is selected - [C280441]', async () => {
await dataTable.selectItem(folderAdmin); await dataTable.selectItem(folderInSite);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderInSite}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`); expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folderInSite}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderInSite}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderAdmin}`); expect(await toolbar.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderInSite}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderInSite}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderInSite}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderInSite}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderAdmin}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderInSite}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
});
});
describe('user is Consumer', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username2);
done();
});
beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('actions are not displayed when no item is selected - [C280442]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C280443]', async () => {
await dataTable.selectItem(fileAdmin);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`);
const menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${fileAdmin}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${fileAdmin}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileAdmin}`);
await toolbar.actions.closeMoreMenu();
});
it('correct actions appear when a folder is selected - [C280444]', async () => {
await dataTable.selectItem(folderAdmin);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folderAdmin}`);
const menu = await toolbar.actions.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for ${folderAdmin}`);
expect(await menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for ${folderAdmin}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderAdmin}`);
await toolbar.actions.closeMoreMenu();
});
}); });
}); });
describe('Shared Files', () => { describe('Shared Files', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => { beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('actions are not displayed when no item is selected - [C280445]', async () => { it('actions are not displayed when no item is selected - [C280445]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
}); });
it('correct actions appear when a file is selected - [C280446]', async () => { it('correct actions appear when a file is selected - [C286265]', async () => {
await page.dataTable.selectItem(fileUser); await page.dataTable.selectItem(fileUser);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Shared link settings')).toBe(true, `Shared is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
await toolbar.actions.closeMoreMenu(); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
}); });
}); });
describe('Recent Files', () => { describe('Recent Files', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => { beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('actions are not displayed when no item is selected - [C280447]', async () => { it('actions are not displayed when no item is selected - [C280447]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
}); });
it('correct actions appear when a file is selected - [C280448]', async () => { it('correct actions appear when a file is selected - [C280448]', async () => {
await dataTable.selectItem(fileUser); await dataTable.selectItem(fileUser);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
}); });
describe('Favorites', () => { describe('Favorites', () => {
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => { beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await logoutPage.load();
done(); done();
}); });
it('actions are not displayed when no item is selected - [C280449]', async () => { it('actions are not displayed when no item is selected - [C280449]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
}); });
it('correct actions appear when a file is selected - [C280450]', async () => { it('correct actions appear when a file is selected - [C280450]', async () => {
await dataTable.selectItem(fileUser); await dataTable.selectItem(fileUser);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`); expect(await toolbar.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${fileUser}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
it('correct actions appear when a folder is selected - [C280451]', async () => { it('correct actions appear when a folder is selected - [C280451]', async () => {
await dataTable.selectItem(folderUser); await dataTable.selectItem(folderUser);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
expect(await toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`); expect(await toolbar.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`); expect(await toolbar.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(await toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`); expect(await toolbar.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
const menu = await toolbar.actions.openMoreMenu(); await toolbar.openMoreMenu();
expect(await menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`); expect(await toolbar.menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for ${folderUser}`);
await toolbar.actions.closeMoreMenu(); await toolbar.closeMoreMenu();
}); });
}); });
describe('Trash', () => { describe('Trash', () => {
beforeAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileForDeleteId, false);
await apis.user.nodes.deleteNodeById(folderForDeleteId, false);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => { beforeEach(async (done) => {
await browser.actions().sendKeys(protractor.Key.ESCAPE); await Utils.pressEscape();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
done(); await dataTable.clearSelection();
});
afterAll(async (done) => {
await Promise.all([
apis.user.trashcan.permanentlyDelete(fileForDeleteId),
apis.user.trashcan.permanentlyDelete(folderForDeleteId),
logoutPage.load()
]);
done(); done();
}); });
it('actions are not displayed when no item is selected - [C280452]', async () => { it('actions are not displayed when no item is selected - [C280452]', async () => {
expect(await toolbar.actions.isEmpty()).toBe(true, `actions displayed though nothing selected`); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
}); });
it('correct actions appear when a file is selected - [C280453]', async () => { it('correct actions appear when a file is selected - [C280453]', async () => {
await dataTable.selectItem(fileForDelete); await dataTable.selectItem(fileForDelete);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`);
expect(await toolbar.actions.isButtonPresent('Permanently delete')).toBe(true, `Permanently delete is not displayed for file`); expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, `Permanently delete is not displayed for file`);
expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, `Restore is not displayed for file`); expect(await toolbar.isButtonPresent('Restore')).toBe(true, `Restore is not displayed for file`);
}); });
it('correct actions appear when a folder is selected - [C280454]', async () => { it('correct actions appear when a folder is selected - [C280454]', async () => {
await dataTable.selectItem(folderForDelete); await dataTable.selectItem(folderForDelete);
expect(await toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`); expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`);
expect(await toolbar.actions.isButtonPresent('Permanently delete')).toBe(true, `Permanently delete is displayed for folder`); expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, `Permanently delete is displayed for folder`);
expect(await toolbar.actions.isButtonPresent('Restore')).toBe(true, `Restore is not enabled for folder`); expect(await toolbar.isButtonPresent('Restore')).toBe(true, `Restore is not enabled for folder`);
}); });
}); });
}); });
+823
View File
@@ -0,0 +1,823 @@
/*!
* @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, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { ShareDialog } from '../../components/dialog/share-dialog';
import { ConfirmDialog } from '../../components/dialog/confirm-dialog';
import { Viewer } from '../../components/viewer/viewer';
import { Utils } from '../../utilities/utils';
describe('Unshare a file', () => {
const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
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;
const shareDialog = new ShareDialog();
const confirmDialog = new ConfirmDialog();
const contextMenu = dataTable.menu;
const viewer = new Viewer();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
logoutPage.load()
]);
done();
});
describe('from 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`; let file4Id;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
done();
});
beforeEach(async (done) => {
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('Unshare dialog UI - [C286339]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared');
expect(await confirmDialog.isButtonEnabled('Remove')).toBe(true, 'REMOVE button is not enabled');
expect(await confirmDialog.isButtonEnabled('Cancel')).toBe(true, 'CANCEL button is not enabled');
});
it('Unshare a file - [C286340]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2);
await page.load();
});
it('Cancel the Unshare action - [C286341]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Cancel');
await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
const urlAfter = await shareDialog.getLinkUrl();
expect(urlBefore).toEqual(urlAfter);
});
it('Unshare a file from the context menu - [C286359]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file4).isPresent()).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4);
await page.load();
});
});
describe('from File Libraries', () => {
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`; let file4Id;
const siteName = `site-${Utils.random()}`;
const parentInSite = `parent-site-${Utils.random()}`; let parentInSiteId;
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
parentInSiteId = (await apis.user.nodes.createFolder(parentInSite, docLibId)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentInSiteId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentInSiteId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id;
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
done();
});
beforeEach(async (done) => {
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parentInSite);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(siteName);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('Unshare dialog UI - [C286679]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared');
expect(await confirmDialog.isButtonEnabled('Remove')).toBe(true, 'REMOVE button is not enabled');
expect(await confirmDialog.isButtonEnabled('Cancel')).toBe(true, 'CANCEL button is not enabled');
});
it('Unshare a file - [C286680]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2);
await page.load();
});
it('Cancel the Unshare action - [C286681]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Cancel');
await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
const urlAfter = await shareDialog.getLinkUrl();
expect(urlBefore).toEqual(urlAfter);
});
it('Unshare a file from the context menu - [C286683]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file4).isPresent()).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4);
await page.load();
});
});
describe('from Recent 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`; let file4Id;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
done();
});
beforeEach(async (done) => {
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('Unshare dialog UI - [C286689]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared');
expect(await confirmDialog.isButtonEnabled('Remove')).toBe(true, 'REMOVE button is not enabled');
expect(await confirmDialog.isButtonEnabled('Cancel')).toBe(true, 'CANCEL button is not enabled');
});
it('Unshare a file - [C286690]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2);
await page.load();
});
it('Cancel the Unshare action - [C286691]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Cancel');
await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
const urlAfter = await shareDialog.getLinkUrl();
expect(urlBefore).toEqual(urlAfter);
});
it('Unshare a file from the context menu - [C286693]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file4).isPresent()).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4);
await page.load();
});
});
describe('from Shared 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`; let file4Id;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
done();
});
beforeEach(async (done) => {
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('Unshare dialog UI - [C286684]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared');
expect(await confirmDialog.isButtonEnabled('Remove')).toBe(true, 'REMOVE button is not enabled');
expect(await confirmDialog.isButtonEnabled('Cancel')).toBe(true, 'CANCEL button is not enabled');
});
it('Unshare a file - [C286685]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2);
await page.load();
});
it('Cancel the Unshare action - [C286686]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Cancel');
await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
const urlAfter = await shareDialog.getLinkUrl();
expect(urlBefore).toEqual(urlAfter);
});
it('Unshare a file from the context menu - [C286688]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// expect(await dataTable.getRowByName(file4).isPresent()).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4);
await page.load();
});
});
describe('from Favorites', () => {
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`; let file4Id;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: 4 });
done();
});
beforeEach(async (done) => {
await page.refresh();
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('Unshare dialog UI - [C286694]', async () => {
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
await shareDialog.clickShareToggle();
expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open');
expect(await confirmDialog.getTitle()).toContain('Remove this shared link');
expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared');
expect(await confirmDialog.isButtonEnabled('Remove')).toBe(true, 'REMOVE button is not enabled');
expect(await confirmDialog.isButtonEnabled('Cancel')).toBe(true, 'CANCEL button is not enabled');
});
it('Unshare a file - [C286695]', async () => {
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file2).isPresent()).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2);
await page.load();
});
it('Cancel the Unshare action - [C286696]', async () => {
await dataTable.selectItem(file3);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Cancel');
await confirmDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off');
const urlAfter = await shareDialog.getLinkUrl();
expect(urlBefore).toEqual(urlAfter);
});
it('Unshare a file from the context menu - [C286698]', async () => {
await dataTable.rightClickOnItem(file4);
await contextMenu.clickMenuItem('Share');
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickButton('Remove');
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
// expect(await dataTable.getRowByName(file4).isPresent()).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4);
await page.load();
});
});
describe('as Consumer', () => {
const sitePrivate = `site-private-${Utils.random()}`;
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`; let file2Id;
beforeAll(async (done) => {
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id;
file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id;
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER);
await apis.admin.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.waitForApi({ expect: 2 });
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(sitePrivate);
done();
});
beforeEach(async (done) => {
await page.refresh();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('on File Libraries - file shared by other user - [C286682]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
});
it('on File Libraries - file shared by the user - [C286701]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader();
await dataTable.selectItem(file2);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
});
it('on Shared Files - file shared by other user - [C286687]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
});
it('on Shared Files - file shared by the user - [C286702]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Shared link settings');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
});
it('on Favorites - file shared by other user - [C286697]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
});
it('on Favorites - file shared by the user - [C286703]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
await toolbar.openMoreMenu();
await toolbar.menu.clickMenuItem('Share');
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer');
});
});
xit('');
});
+18 -18
View File
@@ -44,31 +44,31 @@ describe('Upload files', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.user.nodes.createFolder(folder1).then(resp => folder1Id = resp.entry.id)) folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id;
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); 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) => {
Promise.all([ await Promise.all([
// apis.user.nodes.deleteNodeById(folder1Id), apis.user.nodes.deleteNodeById(folder1Id),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('Upload a file', () => { it('Upload a file', async () => {
dataTable.doubleClickOnRowByName(folder1) await dataTable.doubleClickOnRowByName(folder1);
.then(() => page.sidenav.openNewMenu()) await page.sidenav.openNewMenu();
.then(() => page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`)); await page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`);
}); });
}); });
+73
View File
@@ -0,0 +1,73 @@
/*!
* @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 { BrowsingPage, LoginPage, LogoutPage } from '../../pages/pages';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('General', () => {
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const createDialog = new CreateOrEditFolderDialog();
const adminApi = new RepoClient();
const { nodes: nodesApi, authentication: authApi } = adminApi;
const folder = `folder-${Utils.random()}`;
let folderId;
xit('');
describe('on session expire', () => {
beforeAll(async (done) => {
folderId = (await nodesApi.createFolder(folder)).entry.id;
done();
});
afterAll(async (done) => {
await nodesApi.deleteNodeById(folderId);
await logoutPage.load();
done();
});
it('should close opened dialogs - [C286473]', async () => {
await loginPage.loginWithAdmin();
await page.sidenav.openCreateDialog();
await createDialog.waitForDialogToOpen();
await createDialog.enterName(folder);
await authApi.logout();
await createDialog.clickCreate();
expect(await browser.getTitle()).toContain('Sign in');
const message = await page.getSnackBarMessage();
expect(message).toEqual('The action was unsuccessful. Try again or contact your IT Team.');
await createDialog.waitForDialogToClose();
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is present');
});
});
});
+67 -105
View File
@@ -42,128 +42,90 @@ describe('Page titles', () => {
xit(''); xit('');
describe('on Login / Logout pages', () => { describe('on Login / Logout pages', () => {
it('on Login page - [C217155]', () => { it('on Login page - [C217155]', async () => {
loginPage.load() await loginPage.load();
.then(() => { expect(await browser.getTitle()).toContain('Sign in');
expect(browser.getTitle()).toContain('Sign in'); });
it('after logout - [C217156]', async () => {
await loginPage.loginWithAdmin();
await page.signOut();
expect(await browser.getTitle()).toContain('Sign in');
});
it('when pressing Back after Logout - [C280414]', async () => {
await loginPage.loginWithAdmin();
await page.signOut();
await browser.navigate().back();
expect(await browser.getTitle()).toContain('Sign in');
}); });
}); });
it('after logout - [C217156]', () => { describe('on app pages', () => {
loginPage.loginWithAdmin() beforeAll(async (done) => {
.then(() => page.signOut())
.then(() => {
expect(browser.getTitle()).toContain('Sign in');
});
});
it('when pressing Back after Logout - [C280414]', () => {
loginPage.loginWithAdmin()
.then(() => page.signOut())
.then(() => browser.navigate().back())
.then(() => {
expect(browser.getTitle()).toContain('Sign in');
});
});
});
describe('on list views', () => {
beforeAll(done => {
loginPage.loginWithAdmin().then(done);
});
afterAll(done => {
logoutPage.load()
.then(done);
});
it('Personal Files page - [C217157]', () => {
const label = SIDEBAR_LABELS.PERSONAL_FILES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('File Libraries page - [C217158]', () => {
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Shared Files page - [C217159]', () => {
const label = SIDEBAR_LABELS.SHARED_FILES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Recent Files page - [C217160]', () => {
const label = SIDEBAR_LABELS.RECENT_FILES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Favorites page - [C217161]', () => {
const label = SIDEBAR_LABELS.FAVORITES;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
it('Trash page - [C217162]', () => {
const label = SIDEBAR_LABELS.TRASH;
page.sidenav.navigateToLinkByLabel(label)
.then(() => {
expect(browser.getTitle()).toContain(label);
});
});
});
describe('on File Viewer', () => {
beforeAll( async (done) => {
fileId = (await nodesApi.createFile(file)).entry.id; fileId = (await nodesApi.createFile(file)).entry.id;
await loginPage.loginWithAdmin(); await loginPage.loginWithAdmin();
done(); done();
}); });
afterAll( async (done) => { afterAll(async (done) => {
await logoutPage.load(); await Promise.all([
await adminApi.nodes.deleteNodeById(fileId); logoutPage.load(),
adminApi.nodes.deleteNodeById(fileId)
]);
done(); done();
}); });
it('Personal Files page - [C217157]', async () => {
const label = SIDEBAR_LABELS.PERSONAL_FILES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('File Libraries page - [C217158]', async () => {
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Shared Files page - [C217159]', async () => {
const label = SIDEBAR_LABELS.SHARED_FILES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Recent Files page - [C217160]', async () => {
const label = SIDEBAR_LABELS.RECENT_FILES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Favorites page - [C217161]', async () => {
const label = SIDEBAR_LABELS.FAVORITES;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('Trash page - [C217162]', async () => {
const label = SIDEBAR_LABELS.TRASH;
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
});
it('File Preview page - [C280415]', async () => { it('File Preview page - [C280415]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader(); await page.dataTable.waitForHeader();
await page.dataTable.doubleClickOnRowByName(file); await page.dataTable.doubleClickOnRowByName(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER); expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER);
}); await Utils.pressEscape();
});
describe ('on Search query', () => {
beforeAll( async (done) => {
await loginPage.loginWithAdmin();
done();
});
afterAll( async (done) => {
await logoutPage.load();
done();
}); });
it('Search Results page - [C280413]', async () => { it('Search Results page - [C280413]', async () => {
+82 -111
View File
@@ -29,6 +29,7 @@ import { APP_ROUTES } 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';
import { RepoClient } from '../../utilities/repo-client/repo-client'; import { RepoClient } from '../../utilities/repo-client/repo-client';
import { navigate } from '../../utilities/browser-utils';
describe('Login', () => { describe('Login', () => {
const peopleApi = new RepoClient().people; const peopleApi = new RepoClient().people;
@@ -58,119 +59,98 @@ describe('Login', () => {
}; };
const newPassword = 'new password'; const newPassword = 'new password';
beforeAll(done => { beforeAll(async (done) => {
Promise await peopleApi.createUser({ username: testUser });
.all([ await peopleApi.createUser(russianUser);
peopleApi.createUser({ username: testUser }), await peopleApi.createUser(johnDoe);
peopleApi.createUser(russianUser), await peopleApi.createUser({ username: disabledUser });
peopleApi.createUser(johnDoe), await peopleApi.createUser(testUser2);
peopleApi.createUser({ username: disabledUser }) await peopleApi.disableUser(disabledUser);
.then(() => peopleApi.disableUser(disabledUser)), done();
peopleApi.createUser(testUser2)
])
.then(done);
}); });
afterEach(done => { afterEach(async (done) => {
logoutPage.load() await logoutPage.load();
.then(() => Utils.clearLocalStorage()) await Utils.clearLocalStorage();
.then(done); done();
}); });
xit(''); xit('');
describe('general tests', () => { describe('general tests', () => {
beforeEach(done => { beforeEach(async (done) => {
loginPage.load().then(done); await loginPage.load();
done();
}); });
it('login page layout - [C213089]', () => { it('login page layout - [C213089]', async () => {
expect(loginPage.login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled'); expect(await loginPage.login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled');
expect(loginPage.login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled'); expect(await loginPage.login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled');
expect(loginPage.login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled'); expect(await loginPage.login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled');
expect(loginPage.login.getPasswordVisibility()).toBe(false, 'Password is not hidden by default'); expect(await loginPage.login.getPasswordVisibility()).toBe(false, 'Password is not hidden by default');
}); });
it('change password visibility - [C213091]', () => { it('change password visibility - [C213091]', async () => {
loginPage.login.enterPassword('some password'); await loginPage.login.enterPassword('some password');
expect(loginPage.login.isPasswordShown()).toBe(false, 'password is visible'); expect(await loginPage.login.isPasswordShown()).toBe(false, 'password is visible');
loginPage.login.passwordVisibility.click() await loginPage.login.passwordVisibility.click();
.then(() => { expect(await loginPage.login.getPasswordVisibility()).toBe(true, 'Password visibility not changed');
expect(loginPage.login.getPasswordVisibility()).toBe(true, 'Password visibility not changed'); expect(await loginPage.login.isPasswordShown()).toBe(true, 'password is not visible');
expect(loginPage.login.isPasswordShown()).toBe(true, 'password is not visible');
});
}); });
}); });
describe('with valid credentials', () => { describe('with valid credentials', () => {
it('navigate to "Personal Files" - [C213092]', () => { it('navigate to "Personal Files" - [C213092]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage.loginWith(username) await loginPage.loginWith(username);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
it(`displays user's name in header - [C213108]`, () => { it(`displays user's name in header - [C213108]`, async () => {
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;
loginPage.loginWith(username) await loginPage.loginWith(username);
.then(() => { expect(await userInfo.getName()).toEqual(`${firstName} ${lastName}`);
expect(userInfo.name).toEqual(`${firstName} ${lastName}`);
});
}); });
it(`logs in with user having username containing "@" - [C213096]`, () => { it(`logs in with user having username containing "@" - [C213096]`, async () => {
loginPage await loginPage.loginWith(testUser);
.loginWith(testUser) expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
it('logs in with user with non-latin characters - [C213097]', () => { it('logs in with user with non-latin characters - [C213097]', async () => {
const { username, password } = russianUser; const { username, password } = russianUser;
loginPage await loginPage.loginWith(username, password);
.loginWith(username, password) expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
it('redirects to Home Page when navigating to the Login page while already logged in - [C213107]', () => { // TODO: ACA-245
xit('redirects to Home Page when navigating to the Login page while already logged in - [C213107]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage await loginPage.loginWith(username);
.loginWith(username)
.then(() => browser.get(APP_ROUTES.LOGIN) await navigate(APP_ROUTES.LOGIN);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
})
);
}); });
it('redirects to Personal Files when pressing browser Back while already logged in - [C213109]', () => { it('redirects to Personal Files when pressing browser Back while already logged in - [C213109]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage await loginPage.loginWith(username);
.loginWith(username) await browser.navigate().back();
.then(() => browser.navigate().back()) expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
it('user is able to login after changing his password - [C213104]', () => { it('user is able to login after changing his password - [C213104]', async () => {
loginPage.loginWith(testUser2.username, testUser2.password) await loginPage.loginWith(testUser2.username, testUser2.password);
.then(() => logoutPage.load()) await logoutPage.load();
.then(() => peopleApi.changePassword(testUser2.username, newPassword)) await peopleApi.changePassword(testUser2.username, newPassword);
.then(() => loginPage.loginWith(testUser2.username, newPassword)) await loginPage.loginWith(testUser2.username, newPassword);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
}); });
}); });
@@ -178,56 +158,47 @@ describe('Login', () => {
const { login: loginComponent } = loginPage; const { login: loginComponent } = loginPage;
const { submitButton, errorMessage } = loginComponent; const { submitButton, errorMessage } = loginComponent;
beforeEach(done => { beforeEach(async (done) => {
loginPage.load().then(done); await loginPage.load();
done();
}); });
it('disabled submit button when password is empty - [C280072]', () => { it('disabled submit button when password is empty - [C280072]', async () => {
loginComponent.enterUsername('any-username'); await loginComponent.enterUsername('any-username');
expect(submitButton.isEnabled()).toBe(false); expect(await submitButton.isEnabled()).toBe(false, 'submit button is enabled');
}); });
it('disabled submit button when username is empty - [C280070]', () => { it('disabled submit button when username is empty - [C280070]', async () => {
loginPage.login.enterPassword('any-password'); await loginPage.login.enterPassword('any-password');
expect(submitButton.isEnabled()).toBe(false); expect(await submitButton.isEnabled()).toBe(false, 'submit button is enabled');
}); });
it('shows error when entering nonexistent user - [C213093]', () => { it('shows error when entering nonexistent user - [C213093]', async () => {
loginPage await loginPage.tryLoginWith('nonexistent-user', 'any-password');
.tryLoginWith('nonexistent-user', 'any-password') expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
.then(() => { expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed');
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`);
expect(errorMessage.isDisplayed()).toBe(true);
expect(errorMessage.getText()).toBe(`You've entered an unknown username or password`);
});
}); });
it('shows error when entering invalid password - [C280071]', () => { it('shows error when entering invalid password - [C280071]', async () => {
const { username } = johnDoe; const { username } = johnDoe;
loginPage await loginPage.tryLoginWith(username, 'incorrect-password');
.tryLoginWith(username, 'incorrect-password') expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
.then(() => { expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed');
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`);
expect(errorMessage.isDisplayed()).toBe(true);
expect(errorMessage.getText()).toBe(`You've entered an unknown username or password`);
});
}); });
it('unauthenticated user is redirected to Login page - [C213106]', () => { it('unauthenticated user is redirected to Login page - [C213106]', async () => {
browser.get(APP_ROUTES.PERSONAL_FILES) await navigate(APP_ROUTES.PERSONAL_FILES);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
it('disabled user is not logged in - [C213100]', () => { it('disabled user is not logged in - [C213100]', async () => {
loginPage.tryLoginWith(disabledUser) await loginPage.tryLoginWith(disabledUser);
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed');
expect(errorMessage.isDisplayed()).toBe(true); expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`);
expect(errorMessage.getText()).toBe(`You've entered an unknown username or password`);
});
}); });
}); });
}); });
+23 -28
View File
@@ -38,45 +38,40 @@ describe('Logout', () => {
const johnDoe = `user-${Utils.random()}`; const johnDoe = `user-${Utils.random()}`;
beforeAll((done) => { beforeAll(async (done) => {
peopleApi await peopleApi.createUser({ username: johnDoe });
.createUser({ username: johnDoe }) done();
.then(done);
}); });
beforeEach((done) => { beforeEach(async (done) => {
loginPage.loginWith(johnDoe).then(done); await loginPage.loginWith(johnDoe);
done();
}); });
afterEach((done) => { afterEach(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('Sign out option is available - [C213143]', () => { it('Sign out option is available - [C213143]', async () => {
page.header.userInfo.openMenu() await page.header.userInfo.openMenu();
.then(() => expect(page.header.userInfo.menu.isMenuItemPresent('Sign out')).toBe(true, 'Sign out option not displayed')); expect(await 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]', async () => {
page.signOut() await page.signOut();
.then(() => { expect(await 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]', async () => {
page.signOut() await page.signOut();
.then(() => browser.navigate().back()) await browser.navigate().back();
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
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]', async () => {
page.signOut() await page.signOut();
.then(() => page.load('/favorites')) await page.load('/favorites');
.then(() => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});
}); });
}); });
@@ -0,0 +1,114 @@
/*!
* @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 { EXTENSIBILITY_CONFIGS, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Extensions - Context submenu', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
const folder = `folder-${Utils.random()}`;
let folderId;
const restrictedPermissionsItem = 'Share';
const menuItem1 = {
label: 'Test Menu1',
submenu: [ 'Test submenu1', 'Test submenu2', restrictedPermissionsItem ]
};
const menuItem2 = {
label: 'Test Menu2',
submenu: [ restrictedPermissionsItem ]
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage();
const {dataTable} = personalFilesPage;
const contextMenu = dataTable.menu;
beforeAll(async (done) => {
await apis.admin.people.createUser({username});
fileId = (await apis.user.nodes.createFile(file)).entry.id;
folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.CONTEXT_SUBMENUS);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileId, true);
await apis.user.nodes.deleteNodeById(folderId, true);
await logoutPage.load();
done();
});
it('Displays the submenu actions set from config - [C286717]', async () => {
await dataTable.rightClickOnItem(file);
expect(await contextMenu.isMenuItemPresent(menuItem1.label)).toBe(true, `${menuItem1.label} is not displayed for ${file}`);
expect(await contextMenu.hasSubMenu(menuItem1.label)).toBe(true, 'Menu does not have submenu');
await contextMenu.mouseOverMenuItem(menuItem1.label);
expect(await contextMenu.getSubmenuItemsCount()).toBe(3, 'submenu has wrong number of items');
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[0])).toBe(true, `${menuItem1.submenu[0]} is not displayed for ${file}`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[1])).toBe(true, `${menuItem1.submenu[1]} is not displayed for ${file}`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[2])).toBe(true, `${restrictedPermissionsItem} is not displayed for ${file}`);
});
it('Does not display submenu actions without permissions - [C286718]', async () => {
await dataTable.rightClickOnItem(folder);
expect(await contextMenu.isMenuItemPresent(menuItem1.label)).toBe(true, `${menuItem1.label} is not displayed for ${folder}`);
await contextMenu.mouseOverMenuItem(menuItem1.label);
expect(await contextMenu.getSubmenuItemsCount()).toBe(2, 'submenu has wrong number of items');
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[0])).toBe(true, `${menuItem1.submenu[0]} is not displayed for ${file}`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[1])).toBe(true, `${menuItem1.submenu[1]} is not displayed for ${file}`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[2])).toBe(false, `no permission submenu ${restrictedPermissionsItem} is displayed`);
});
it('The parent item is not displayed if all its children have no permission to be displayed - [C287784]', async () => {
await dataTable.rightClickOnItem(folder);
expect(await contextMenu.isMenuItemPresent(menuItem2.label)).toBe(false, `${menuItem2.label} menu is displayed for ${folder}`);
});
});
@@ -0,0 +1,113 @@
/*!
* @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 { BrowsingPage, LoginPage, LogoutPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { EXTENSIBILITY_CONFIGS, SIDEBAR_LABELS } from '../../configs';
import { Utils } from '../../utilities/utils';
describe('Extensions - DocumentList presets', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
const testData = [
{
id: 'app.files.name',
fixtureLabel: 'Name'
},
{
id: 'app.files.thumbnail',
fixtureLabel: 'Thumbnail'
},
{
id: 'app.files.size',
fixtureLabel: 'Size',
disabled: true
},
{
id: 'app.files.modifiedBy',
fixtureLabel: 'Test header'
},
{
id: 'some.id.createdBy',
fixtureLabel: 'New column'
}
];
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage();
const { dataTable } = personalFilesPage;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createFile(file)).entry.id;
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.DOCUMENT_LIST_PRESETS);
await loginPage.loginWith(username);
done();
});
beforeEach(async done => {
await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileId);
await logoutPage.load();
done();
});
it('Sets the columns to display - [C286700]', async () => {
const labels = testData
.filter(item => !item.disabled)
.map(data => data.fixtureLabel);
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(await dataTable.getColumnHeaders().count()).toBe(labels.length, 'Incorrect number of columns');
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('Disabled items are not shown - [C286699]', async () => {
const noColumnLabel = testData.find(item => item.disabled).fixtureLabel;
const element = dataTable.getColumnHeaderByLabel(noColumnLabel);
expect(await element.isPresent()).toBe(false, `"${noColumnLabel}" is displayed`);
});
});
+91
View File
@@ -0,0 +1,91 @@
/*!
* @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 } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { EXTENSIBILITY_CONFIGS } from '../../configs';
import { Utils } from '../../utilities/utils';
import { Header } from '../../components/components';
import { Menu } from './../../components/menu/menu';
describe('Extensions - Info Drawer', () => {
const username = `user-${Utils.random()}`;
const disabledMenu = {
id: 'settings',
title: 'App settings',
description: 'Application settings',
icon: 'settings'
};
const enabledMenu = {
id: 'button',
title: 'New Button',
description: 'new button description',
icon: 'alarm_on'
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const header = new Header();
const toolbarMenu = new Menu();
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.HEADER);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('Add a new button in the header - [C286474]', async () => {
await header.openMoreMenu();
expect(await toolbarMenu.isMenuItemPresent(enabledMenu.title)).toBe(true, 'menu item not present');
expect(await toolbarMenu.getItemIconText(enabledMenu.title)).toEqual(enabledMenu.icon);
});
it('Disable a button from the header - [C286477]', async () => {
await header.openMoreMenu();
expect(await toolbarMenu.isMenuItemPresent(disabledMenu.title)).toBe(true, `${disabledMenu.title} menu item not present`);
expect(await toolbarMenu.isMenuItemDisabled(disabledMenu.title)).toEqual('true', `${disabledMenu.title} is not disabled`);
});
});
+10 -9
View File
@@ -101,16 +101,17 @@ describe('Extensions - Info Drawer', () => {
it('Add a new tab with icon and title - [C284646]', async () => { it('Add a new tab with icon and title - [C284646]', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click(); await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
const val = await infoDrawer.getTabTitle(custom_tab.order);
expect(await infoDrawer.isTabPresent(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not present`); 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`); expect(val).toEqual(`${custom_tab.icon}\n${custom_tab.title}`);
}); });
it('Remove existing tab - [C284647]', async () => { it('Remove existing tab - [C284647]', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click(); await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`); expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`);
@@ -118,7 +119,7 @@ describe('Extensions - Info Drawer', () => {
it('Change tab title - [C284648]', async () => { it('Change tab title - [C284648]', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click(); await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`); expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`);
@@ -127,21 +128,21 @@ describe('Extensions - Info Drawer', () => {
it('Tab with icon and no title - [C284649]', async () => { it('Tab with icon and no title - [C284649]', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click(); await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`); 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`); expect(await infoDrawer.getTabTitle(no_title_tab.order)).toEqual(`${no_title_tab.icon}`);
}); });
it('Insert new component in tab - [C284651]', async () => { it('Insert new component in tab - [C284651]', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click(); await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`); expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`);
await infoDrawer.clickTab(custom_tab.title); await infoDrawer.clickTab(custom_tab.title);
expect(await infoDrawer.getComponentIdOfTab(custom_tab.title)).toEqual(custom_tab.component); expect(await infoDrawer.getComponentIdOfTab()).toEqual(custom_tab.component);
}); });
}); });
@@ -162,7 +163,7 @@ describe('Extensions - Info Drawer', () => {
it('Remove all tabs - [C284650]', async () => { it('Remove all tabs - [C284650]', async () => {
await page.dataTable.selectItem(file); await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click(); await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty'); expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
+115
View File
@@ -0,0 +1,115 @@
/*!
* @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 { BrowsingPage, LoginPage, LogoutPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { EXTENSIBILITY_CONFIGS } from '../../configs';
import { Utils } from '../../utilities/utils';
import { InfoDrawer } from '../../components/info-drawer/info-drawer';
import { MetadataCard } from '../../components/metadata-card/metadata-card';
describe('Extensions - Metadata presets', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.png`;
let fileId;
const properties_tab = {
title: 'Properties',
component: 'app.components.tabs.metadata'
};
const customGroup1 = {
id: 'a.testGroup',
title: 'A Test Group of Properties'
};
const customGroup2 = {
id: 'another.testGroup',
title: 'Another Test Group of Properties'
};
const disabledGroup = {
id: 'disabled.testGroup',
title: 'Hidden Group of Properties'
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const infoDrawer = new InfoDrawer();
const metadataCard = new MetadataCard();
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.createImage(file)).entry.id;
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.METADATA_PRESETS);
await loginPage.loginWith(username);
done();
});
beforeEach(async done => {
await page.refresh();
await page.dataTable.selectItem(file);
await page.toolbar.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickTab(properties_tab.title);
await metadataCard.clickExpandButton();
await metadataCard.waitForFirstExpansionPanel();
done();
});
afterAll(async done => {
await apis.user.nodes.deleteNodeById(fileId);
await logoutPage.load();
done();
});
it('Set groups of properties to display - [C286636]', async () => {
expect(await metadataCard.isExpansionPanelPresent(0)).toBe(true, `expansion panel is not present`);
expect(await metadataCard.getComponentIdOfPanel(0)).toEqual(`adf-metadata-group-${customGroup1.title}`);
expect(await metadataCard.isExpansionPanelPresent(1)).toBe(true, `expansion panel is not present`);
expect(await metadataCard.getComponentIdOfPanel(1)).toEqual(`adf-metadata-group-${customGroup2.title}`);
});
it('Disabled group is not displayed - [C286637]', async () => {
expect(await metadataCard.isExpansionPanelPresent(2)).toBe(false, `disabled group is displayed`);
expect(await metadataCard.getComponentIdOfPanel(1)).not.toEqual(`adf-metadata-group-${disabledGroup.title}`);
expect(await metadataCard.getComponentIdOfPanel(0)).not.toEqual(`adf-metadata-group-${disabledGroup.title}`);
});
});
+86 -4
View File
@@ -44,6 +44,28 @@ describe('Extensions - Viewer', () => {
}; };
let docxFileId; let docxFileId;
const customAction = {
id: 'app.toolbar.my-action',
title: 'My action',
icon: 'http'
};
const customSecondaryAction = {
id: 'app.toolbar.my-secondary-action',
title: 'My secondary action',
icon: 'alarm'
};
const downloadButton = {
id: 'app.toolbar.download',
title: 'My custom title'
};
const moveAction = {
id: 'app.viewer.move',
title: 'My new title'
}
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, username) user: new RepoClient(username, username)
@@ -54,6 +76,7 @@ describe('Extensions - Viewer', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const viewer = new Viewer(); const viewer = new Viewer();
const { toolbar } = viewer;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -67,10 +90,8 @@ describe('Extensions - Viewer', () => {
}); });
afterAll(async (done) => { afterAll(async (done) => {
await Promise.all([ await apis.user.nodes.deleteNodesById([ pdfFileId, docxFileId ]);
apis.user.nodes.deleteNodesById([ pdfFileId, docxFileId ]), await logoutPage.load();
logoutPage.load()
]);
done(); done();
}); });
@@ -80,6 +101,14 @@ describe('Extensions - Viewer', () => {
done(); done();
}); });
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
xit('');
describe('content', () => {
it('Insert new component in a content viewer - [C284659]', async () => { it('Insert new component in a content viewer - [C284659]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name); await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -92,5 +121,58 @@ describe('Extensions - Viewer', () => {
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present'); expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(docxFile.component); expect(await viewer.getComponentIdOfView()).toEqual(docxFile.component);
}); });
});
describe('toolbar actions', () => {
it('Add a new action in the toolbar - [C286416]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.isButtonPresent(customAction.title)).toBe(true, 'Custom action is not present');
expect(await toolbar.getButtonByTitleAttribute(customAction.title).getAttribute('id')).toEqual(customAction.id);
expect(await toolbar.getButtonByTitleAttribute(customAction.title).getText()).toEqual(customAction.icon);
});
it('Modify title of action from toolbar - [C286417]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.getButtonById(downloadButton.id).getAttribute('title')).toEqual(downloadButton.title);
});
it('Remove action from toolbar - [C286419]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.isButtonPresent('Print')).toBe(false, 'Print button is still displayed');
});
});
describe('toolbar More actions menu', () => {
it('Add a new action - [C286420]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent(customSecondaryAction.title)).toBe(true, 'action is not present');
expect(await toolbar.menu.getItemIconText(customSecondaryAction.title)).toEqual(customSecondaryAction.icon);
expect(await toolbar.menu.getItemIdAttribute(customSecondaryAction.title)).toEqual(customSecondaryAction.id);
});
it('Modify title of action from More actions menu - [C286421]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemById(moveAction.id).getAttribute('title')).toEqual(moveAction.title);
});
it('Remove action from More actions menu - [C286423]', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent('Permissions')).toBe(false, 'Action is still displayed');
});
});
}); });
+37 -48
View File
@@ -42,67 +42,56 @@ describe('Empty list views', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('empty Personal Files - [C280131]', () => { it('empty Personal Files - [C280131]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => { expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
expect(dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
});
}); });
it('empty File Libraries - [C217099]', () => { it('empty File Libraries - [C217099]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => { expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await 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(await dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
expect(dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
});
}); });
it('empty Shared Files - [C280132]', () => { it('empty Shared Files - [C280132]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => { expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('No shared files or folders');
expect(dataTable.getEmptyStateTitle()).toContain('No shared files or folders'); expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you share using the Share option are shown here.');
expect(dataTable.getEmptyStateSubtitle()).toContain('Items you share using the Share option are shown here.');
});
}); });
it('empty Recent Files - [C213169]', () => { it('empty Recent Files - [C213169]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => { expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('No recent files');
expect(dataTable.getEmptyStateTitle()).toContain('No recent files'); expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you upload or edit in the last 30 days are shown here.');
expect(dataTable.getEmptyStateSubtitle()).toContain('Items you upload or edit in the last 30 days are shown here.');
});
}); });
it('empty Favorites - [C280133]', () => { it('empty Favorites - [C280133]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => { expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('No favorite files or folders');
expect(dataTable.getEmptyStateTitle()).toContain('No favorite files or folders'); expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite items that you want to easily find later.');
expect(dataTable.getEmptyStateSubtitle()).toContain('Favorite items that you want to easily find later.');
});
}); });
it('empty Trash - [C280134]', () => { it('empty Trash - [C280134]', async () => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(() => { expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty'); expect(await dataTable.getEmptyStateTitle()).toContain('Trash is empty');
expect(dataTable.getEmptyStateTitle()).toContain('Trash is empty'); expect(await dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.');
expect(dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.'); expect(await dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.');
expect(dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.');
});
}); });
}); });
+24 -34
View File
@@ -30,7 +30,6 @@ import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Favorites', () => { describe('Favorites', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const password = username;
const siteName = `site-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const favFolderName = `favFolder-${Utils.random()}`; const favFolderName = `favFolder-${Utils.random()}`;
@@ -42,14 +41,13 @@ describe('Favorites', () => {
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, password) user: new RepoClient(username, username)
}; };
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const logoutPage = new LogoutPage(); const logoutPage = new LogoutPage();
const favoritesPage = new BrowsingPage(); const favoritesPage = new BrowsingPage();
const { dataTable } = favoritesPage; const { dataTable, breadcrumb } = favoritesPage;
const { breadcrumb } = favoritesPage.toolbar;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -59,22 +57,18 @@ describe('Favorites', () => {
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER); await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id; const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file1Id);
const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id; 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 parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id;
const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).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; 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; const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('folder', folderId);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
await apis.user.favorites.addFavoriteById('file', file4Id); await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.nodes.deleteNodeById(file3Id, false);
await apis.user.nodes.deleteNodeById(file4Id, false); await apis.user.nodes.deleteNodeById(file4Id, false);
await apis.user.trashcan.restore(file4Id); await apis.user.trashcan.restore(file4Id);
@@ -89,24 +83,20 @@ describe('Favorites', () => {
}); });
afterAll(async (done) => { afterAll(async (done) => {
await Promise.all([ await apis.admin.sites.deleteSite(siteName);
apis.admin.sites.deleteSite(siteName), await apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]);
apis.user.nodes.deleteNodes([ favFolderName, parentFolder ]), await apis.admin.trashcan.emptyTrash();
apis.admin.trashcan.emptyTrash(), await logoutPage.load();
logoutPage.load()
]);
done(); done();
}); });
it('has the correct columns - [C280482]', async () => { it('has the correct columns - [C280482]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by' ]; const expectedHeader = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const headers = dataTable.getColumnHeaders();
const count = await headers.count();
expect(count).toBe(5 + 1, 'Incorrect number of columns');
expect(await dataTable.getColumnHeaders().count()).toBe(5 + 1, 'Incorrect number of columns'); expect(await dataTable.getHeaderText()).toEqual(expectedHeader);
await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
}); });
it('displays the favorite files and folders - [C213226]', async () => { it('displays the favorite files and folders - [C213226]', async () => {
@@ -125,15 +115,15 @@ describe('Favorites', () => {
}); });
it('Location column displays the parent folder of the files - [C213231]', async () => { it('Location column displays the parent folder of the files - [C213231]', async () => {
expect(await dataTable.getItemLocation(fileName1).getText()).toEqual(siteName); expect(await dataTable.getItemLocation(fileName1)).toEqual(siteName);
expect(await dataTable.getItemLocation(fileName2).getText()).toEqual(parentFolder); expect(await dataTable.getItemLocation(fileName2)).toEqual(parentFolder);
expect(await dataTable.getItemLocation(favFolderName).getText()).toEqual('Personal Files'); expect(await dataTable.getItemLocation(favFolderName)).toEqual('Personal Files');
}); });
it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => { it('Location column displays a tooltip with the entire path of the file - [C213671]', async () => {
expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`); expect(await dataTable.getItemLocationTileAttr(fileName1)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`); expect(await dataTable.getItemLocationTileAttr(fileName2)).toEqual(`Personal Files/${parentFolder}`);
expect(dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files'); expect(await dataTable.getItemLocationTileAttr(favFolderName)).toEqual('Personal Files');
}); });
it('Location column redirect - item in user Home - [C213650]', async () => { it('Location column redirect - item in user Home - [C213650]', async () => {
@@ -148,7 +138,7 @@ describe('Favorites', () => {
it('Location column redirect - file in site - [C280485]', async () => { it('Location column redirect - file in site - [C280485]', async () => {
await dataTable.clickItemLocation(fileName1); await dataTable.clickItemLocation(fileName1);
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]); expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
}); });
it('Navigate into folder from Favorites - [C213230]', async () => { it('Navigate into folder from Favorites - [C213230]', async () => {
+42 -60
View File
@@ -52,61 +52,49 @@ describe('File Libraries', () => {
const fileLibrariesPage = new BrowsingPage(); const fileLibrariesPage = new BrowsingPage();
const { dataTable } = fileLibrariesPage; const { dataTable } = fileLibrariesPage;
beforeAll(done => { beforeAll(async (done) => {
Promise await apis.admin.people.createUser({ username });
.all([ await apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC);
apis.admin.people.createUser({ username }), await apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription);
apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC), await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null);
apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription), await apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC);
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null), await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1);
apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC), await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2);
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1), await apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER);
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2) await apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER);
]) await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR);
.then(() => apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER)) await apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR);
.then(() => apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER)) await apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR);
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES) await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await apis.admin.sites.deleteSites([ sitePublic, siteModerated, sitePrivate, adminSite, siteId1, siteId2 ]);
apis.admin.sites.deleteSites([ await logoutPage.load();
sitePublic, done();
siteModerated,
sitePrivate,
adminSite,
siteId1,
siteId2
]),
logoutPage.load()
])
.then(done);
}); });
it('has the correct columns - [C217095]', () => { it('has the correct columns - [C217095]', async () => {
const labels = [ 'Title', 'Status' ]; const labels = [ 'Title', 'Status' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(2 + 1, 'Incorrect number of columns'); expect(await dataTable.getColumnHeaders().count()).toBe(2 + 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('User can see only the sites he is a member of - [C280501]', () => { it('User can see only the sites he is a member of - [C280501]', async () => {
const sitesCount = dataTable.countRows(); const sitesCount = await dataTable.countRows();
const expectedSites = { const expectedSites = {
[sitePrivate]: SITE_VISIBILITY.PRIVATE, [sitePrivate]: SITE_VISIBILITY.PRIVATE,
@@ -115,45 +103,39 @@ describe('File Libraries', () => {
}; };
expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed'); expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed');
expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list'); expect(await dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
dataTable.getRows() const rowCells = await dataTable.getRows().map((row) => {
.map((row) => { return row.all(dataTable.cell).map(async cell => await cell.getText());
return row.all(dataTable.cell).map(cell => cell.getText()); });
}) const sitesList = rowCells.reduce((acc, cell) => {
.then((rowCells) => {
return rowCells.reduce((acc, cell) => {
acc[cell[1]] = cell[2].toUpperCase(); acc[cell[1]] = cell[2].toUpperCase();
return acc; return acc;
}, {}); }, {});
})
.then((sitesList) => {
Object.keys(expectedSites).forEach((site) => { Object.keys(expectedSites).forEach((site) => {
expect(sitesList[site]).toEqual(expectedSites[site]); expect(sitesList[site]).toEqual(expectedSites[site]);
}); });
}); });
});
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]', async () => {
const expectedSites = [ const expectedSites = [
`${siteName} (${siteId1})`, `${siteName} (${siteId1})`,
`${siteName} (${siteId2})` `${siteName} (${siteId2})`
]; ];
dataTable.getCellsContainingName(siteName) const cells = await dataTable.getCellsContainingName(siteName);
.then(resp => {
const expectedJSON = JSON.stringify(expectedSites.sort()); const expectedJSON = JSON.stringify(expectedSites.sort());
const actualJSON = JSON.stringify(resp.sort()); const actualJSON = JSON.stringify(cells.sort());
expect(actualJSON).toEqual(expectedJSON); expect(actualJSON).toEqual(expectedJSON);
}); });
});
it('Tooltip for sites without description - [C217096]', () => { it('Tooltip for sites without description - [C217096]', async () => {
const tooltip = dataTable.getItemNameTooltip(sitePrivate); const tooltip = await 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]', async () => {
const tooltip = dataTable.getItemNameTooltip(siteModerated); const tooltip = await dataTable.getItemNameTooltip(siteModerated);
expect(tooltip).toBe(`${siteDescription}`); expect(tooltip).toBe(`${siteDescription}`);
}); });
}); });
+106
View File
@@ -0,0 +1,106 @@
/*!
* @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 } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Generic errors', () => {
const username = `user-${Utils.random()}`;
const username2 = `user2-${Utils.random()}`;
const parent = `folder-${Utils.random()}`; let parentId;
const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`;
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;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.admin.people.createUser({ username: username2 });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
await apis.user.nodes.createFile(file2, parentId);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
await logoutPage.load();
done();
});
it('File / folder not found - [C217313]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.doubleClickOnRowByName(file1);
const URL = await browser.getCurrentUrl();
await apis.user.nodes.deleteNodeById(file1Id, false);
await browser.get(URL);
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
});
it('Invalid URL - [C217315]', async () => {
await page.load('/invalid page');
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
});
it('Permission denied - [C217314]', async () => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.doubleClickOnRowByName(file2);
const URL = await browser.getCurrentUrl();
await logoutPage.load();
await loginPage.loginWith(username2);
await browser.get(URL);
expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed');
expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`);
await logoutPage.load();
await loginPage.loginWith(username);
});
});
+74 -91
View File
@@ -46,8 +46,9 @@ describe('Special permissions', () => {
xit(''); xit('');
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }).then(done); await apis.admin.people.createUser({ username });
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', () => {
@@ -55,71 +56,60 @@ describe('Special permissions', () => {
const fileName = `file-${Utils.random()}.txt`; const fileName = `file-${Utils.random()}.txt`;
let fileId; let fileId;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE) await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR)) await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
.then(() => apis.admin.nodes.createFiles([ fileName ], `Sites/${sitePrivate}/documentLibrary`) const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
.then(resp => fileId = resp.entry.id)) fileId = (await apis.admin.nodes.createFile(fileName, docLibId)).entry.id;
.then(() => apis.user.favorites.addFavoriteById('file', fileId)) await apis.user.favorites.addFavoriteById('file', fileId);
.then(() => apis.admin.shared.shareFileById(fileId)) await apis.admin.shared.shareFileById(fileId);
.then(() => apis.user.nodes.editNodeContent(fileId, 'edited by user')) await apis.user.nodes.editNodeContent(fileId, 'edited by user');
.then(() => apis.user.search.waitForApi(username, { expect: 1 })) await apis.user.search.waitForApi(username, { expect: 1 });
.then(() => apis.user.shared.waitForApi({ expect: 1 })) await apis.user.shared.waitForApi({ expect: 1 });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterEach(done => { afterEach(async (done) => {
apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR).then(done); await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.sites.deleteSite(sitePrivate), apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it('on Recent Files - [C213173]', () => { it('on Recent Files - [C213173]', async () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username);
}) await recentFilesPage.refresh();
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
.then(() => recentFilesPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
}); });
it('on Favorites - [C213227]', () => { it('on Favorites - [C213227]', async () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username);
}) await favoritesPage.refresh();
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
.then(() => favoritesPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
}); });
it('on Shared Files - [C213116]', () => { it('on Shared Files - [C213116]', async () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); await apis.admin.sites.deleteSiteMember(sitePrivate, username);
}) await sharedPage.refresh();
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
.then(() => sharedPage.refresh())
.then(() => {
expect(dataTable.countRows()).toBe(0, 'Incorrect number of items');
});
}); });
}); });
@@ -128,54 +118,47 @@ describe('Special permissions', () => {
const fileName = `file-${Utils.random()}.txt`; const fileName = `file-${Utils.random()}.txt`;
let fileId; let fileId;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE) await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR)) await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
.then(() => apis.admin.sites.getDocLibId(sitePrivate)) const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
.then(resp => apis.user.nodes.createFile(fileName, resp)) fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
.then(resp => fileId = resp.entry.id) await apis.user.favorites.addFavoriteById('file', fileId);
.then(() => apis.user.favorites.addFavoriteById('file', fileId)) await apis.user.shared.shareFileById(fileId);
.then(() => apis.user.shared.shareFileById(fileId)) await apis.user.shared.waitForApi({ expect: 1 });
.then(() => apis.user.shared.waitForApi({ expect: 1 })) await apis.user.search.waitForApi(username, { expect: 1 });
.then(() => apis.user.search.waitForApi(username, { expect: 1 })) await apis.admin.sites.deleteSiteMember(sitePrivate, username);
.then(() => apis.admin.sites.deleteSiteMember(sitePrivate, username)) await loginPage.loginWith(username);
.then(() => loginPage.loginWith(username)) done();
.then(done);
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.admin.sites.deleteSite(sitePrivate), apis.admin.sites.deleteSite(sitePrivate),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
it(`on Recent Files - [C213178]`, () => { it(`on Recent Files - [C213178]`, async () => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName)).toEqual('');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
}); });
it(`on Favorites - [C213672]`, () => { it(`on Favorites - [C213672]`, async () => {
favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await favoritesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName)).toEqual('');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
}); });
it(`on Shared Files - [C213668]`, () => { it(`on Shared Files - [C213668]`, async () => {
sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sharedPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(() => { expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.getItemLocation(fileName)).toEqual('');
expect(dataTable.getItemLocation(fileName).getText()).toEqual('');
});
}); });
}); });
}); });
+60 -74
View File
@@ -48,126 +48,112 @@ describe('Personal Files', () => {
const userFolder = `user-folder-${Utils.random()}`; const userFolder = `user-folder-${Utils.random()}`;
const userFile = `file-${Utils.random()}.txt`; const userFile = `file-${Utils.random()}.txt`;
beforeAll(done => { beforeAll(async (done) => {
Promise await 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 ])) await apis.user.nodes.createFolders([ userFolder ]);
.then(() => apis.user.nodes.createFiles([ userFile ], userFolder)) await apis.user.nodes.createFiles([ userFile ], userFolder);
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise await Promise.all([
.all([
apis.admin.nodes.deleteNodes([ adminFolder ]), apis.admin.nodes.deleteNodes([ adminFolder ]),
apis.user.nodes.deleteNodes([ userFolder ]) apis.user.nodes.deleteNodes([ userFolder ])
]) ]);
.then(done); done();
}); });
xit(''); xit('');
describe(`Admin user's personal files`, () => { describe(`Admin user's personal files`, () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWithAdmin().then(done); await loginPage.loginWithAdmin();
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await personalFilesPage.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('has Data Dictionary and created content - [C213241]', () => { it('has Data Dictionary and created content - [C213241]', async () => {
expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true); expect(await dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true); expect(await dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
}); });
}); });
describe(`Regular user's personal files`, () => { describe(`Regular user's personal files`, () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(username).then(done); await loginPage.loginWith(username);
done();
}); });
beforeEach(done => { beforeEach(async (done) => {
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await personalFilesPage.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('has the correct columns - [C217142]', () => { it('has the correct columns - [C217142]', async () => {
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));
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns'); expect(await dataTable.getColumnHeaders().count()).toBe(4 + 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('has default sorted column - [C217143]', () => { it('has default sorted column - [C217143]', async () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified'); expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
}); });
it('has user created content - [C213242]', () => { it('has user created content - [C213242]', async () => {
expect(dataTable.getRowByName(userFolder).isPresent()) expect(await dataTable.getRowByName(userFolder).isPresent()).toBe(true);
.toBe(true);
}); });
it('navigates to folder - [C213244]', () => { it('navigates to folder - [C213244]', async () => {
const getNodeIdPromise = apis.user.nodes const nodeId = (await apis.user.nodes.getNodeByPath(`/${userFolder}`)).entry.id;
.getNodeByPath(`/${userFolder}`)
.then(response => response.entry.id);
const navigatePromise = dataTable await dataTable.doubleClickOnRowByName(userFolder)
.doubleClickOnRowByName(userFolder) await dataTable.waitForHeader();
.then(() => dataTable.waitForHeader());
Promise expect(await browser.getCurrentUrl()).toContain(nodeId, 'Node ID is not in the URL');
.all([ expect(await dataTable.getRowByName(userFile).isPresent()).toBe(true, 'user file is missing');
getNodeIdPromise,
navigatePromise
])
.then(([ nodeId ]) => {
expect(browser.getCurrentUrl())
.toContain(nodeId, 'Node ID is not in the URL');
expect(dataTable.getRowByName(userFile).isPresent())
.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]', async () => {
personalFilesPage.dataTable.doubleClickOnRowByName(userFolder) await personalFilesPage.dataTable.doubleClickOnRowByName(userFolder);
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => browser.getCurrentUrl()) const url = await browser.getCurrentUrl();
.then(url => expect(url.endsWith(APP_ROUTES.PERSONAL_FILES)).toBe(true, 'incorrect 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]', async () => {
personalFilesPage.refresh() await personalFilesPage.refresh();
.then(() => expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES)); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
}); });
it('page load by URL - [C213247]', () => { it('page load by URL - [C213247]', async () => {
let url; const url = await browser.getCurrentUrl();
browser.getCurrentUrl() await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
.then(resp => url = resp) await browser.get(url);
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)) expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
.then(() => browser.get(url))
.then(() => expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES));
}); });
}); });
}); });
+56 -58
View File
@@ -48,94 +48,92 @@ describe('Recent Files', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const logoutPage = new LogoutPage(); const logoutPage = new LogoutPage();
const recentFilesPage = new BrowsingPage(); const recentFilesPage = new BrowsingPage();
const { dataTable } = recentFilesPage; const { dataTable, breadcrumb } = recentFilesPage;
const { breadcrumb } = recentFilesPage.toolbar;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.user.nodes.createFolders([ folderName ])).then(resp => folderId = resp.entry.id) folderId = (await apis.user.nodes.createFolders([ folderName ])).entry.id;
.then(() => apis.user.nodes.createFiles([ fileName1 ], folderName)) await apis.user.nodes.createFiles([ fileName1 ], folderName);
.then(() => apis.user.nodes.createFiles([ fileName2 ])).then(resp => file2Id = resp.entry.id) file2Id = (await apis.user.nodes.createFiles([ fileName2 ])).entry.id;
.then(() => apis.user.nodes.createFiles([ fileName3 ]).then(resp => apis.user.nodes.deleteNodeById(resp.entry.id, false))) const id = (await apis.user.nodes.createFiles([ fileName3 ])).entry.id;
await apis.user.nodes.deleteNodeById(id, false);
.then(() => apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)) await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
.then(() => apis.user.sites.getDocLibId(siteName)) const docLibId = await apis.user.sites.getDocLibId(siteName);
.then(resp => apis.user.nodes.createFolder(folderSite, resp)).then(resp => folderSiteId = resp.entry.id) folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
.then(() => apis.user.nodes.createFile(fileSite, folderSiteId)) await apis.user.nodes.createFile(fileSite, folderSiteId);
.then(() => apis.user.search.waitForApi(username, { expect: 3 })) await apis.user.search.waitForApi(username, { expect: 3 });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES) await recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await apis.user.nodes.deleteNodesById([ folderId, file2Id ]);
apis.user.nodes.deleteNodesById([ folderId, file2Id ]), await apis.user.sites.deleteSite(siteName);
apis.user.sites.deleteSite(siteName), await apis.admin.trashcan.emptyTrash();
apis.admin.trashcan.emptyTrash(), await logoutPage.load();
logoutPage.load() done();
])
.then(done);
}); });
it('has the correct columns - [C213168]', () => { it('has the correct columns - [C213168]', async () => {
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));
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns'); expect(await dataTable.getColumnHeaders().count()).toBe(4 + 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('default sorting column - [C213171]', () => { it('default sorting column - [C213171]', async () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified'); expect(await dataTable.getSortedColumnHeader().getText()).toBe('Modified');
expect(dataTable.getSortingOrder()).toBe('desc'); expect(await 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]', async () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed'); expect(await dataTable.countRows()).toEqual(3, 'Incorrect number of files displayed');
expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); expect(await dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); expect(await dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
}); });
it(`file not displayed if it's been deleted - [C213174]`, () => { it(`file not displayed if it's been deleted - [C213174]`, async () => {
expect(dataTable.getRowByName(fileName3).isPresent()).not.toBe(true, `${fileName3} is displayed`); expect(await 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]', async () => {
expect(dataTable.getItemLocation(fileName1).getText()).toEqual(folderName); expect(await dataTable.getItemLocation(fileName1)).toEqual(folderName);
expect(dataTable.getItemLocation(fileName2).getText()).toEqual('Personal Files'); expect(await dataTable.getItemLocation(fileName2)).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileSite).getText()).toEqual(folderSite); expect(await dataTable.getItemLocation(fileSite)).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]', async () => {
expect(dataTable.getItemLocationTileAttr(fileName1)).toEqual(`Personal Files/${folderName}`); expect(await dataTable.getItemLocationTileAttr(fileName1)).toEqual(`Personal Files/${folderName}`);
expect(dataTable.getItemLocationTileAttr(fileName2)).toEqual('Personal Files'); expect(await dataTable.getItemLocationTileAttr(fileName2)).toEqual('Personal Files');
expect(dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`); expect(await dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}/${folderSite}`);
}); });
it('Location column redirect - file in user Home - [C213176]', () => { it('Location column redirect - file in user Home - [C213176]', async () => {
dataTable.clickItemLocation(fileName2) await dataTable.clickItemLocation(fileName2);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
}); });
it('Location column redirect - file in folder - [C280486]', () => { it('Location column redirect - file in folder - [C280486]', async () => {
dataTable.clickItemLocation(fileName1) await dataTable.clickItemLocation(fileName1);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderName ]);
}); });
it('Location column redirect - file in site - [C280487]', () => { it('Location column redirect - file in site - [C280487]', async () => {
dataTable.clickItemLocation(fileSite) await dataTable.clickItemLocation(fileSite);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ])); expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ]);
}); });
}); });
+65 -75
View File
@@ -33,9 +33,9 @@ describe('Shared Files', () => {
const password = username; const password = username;
const siteName = `site-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`; const fileAdmin = `fileSite-${Utils.random()}.txt`;
const folderUser = `folder-${Utils.random()}`; const folderUser = `folder-${Utils.random()}`; let folderId;
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;
@@ -49,106 +49,96 @@ describe('Shared Files', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const logoutPage = new LogoutPage(); const logoutPage = new LogoutPage();
const sharedFilesPage = new BrowsingPage(); const sharedFilesPage = new BrowsingPage();
const { dataTable } = sharedFilesPage; const { dataTable, breadcrumb } = sharedFilesPage;
const { breadcrumb } = sharedFilesPage.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_CONSUMER)) await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
.then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`)) const docLibId = await apis.admin.sites.getDocLibId(siteName);
.then(resp => apis.admin.shared.shareFileById(resp.entry.id)) const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id;
await apis.admin.shared.shareFileById(nodeId);
.then(() => apis.user.nodes.createFolders([ folderUser ])) folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
.then(() => apis.user.nodes.createFiles([ file1User ], folderUser)).then(resp => file1Id = resp.entry.id) file1Id = (await apis.user.nodes.createFile(file1User, folderId)).entry.id;
.then(() => apis.user.nodes.createFile(file2User)).then(resp => file2Id = resp.entry.id) file2Id = (await apis.user.nodes.createFile(file2User)).entry.id;
.then(() => apis.user.nodes.createFile(file3User)).then(resp => file3Id = resp.entry.id) file3Id = (await apis.user.nodes.createFile(file3User)).entry.id;
.then(() => apis.user.nodes.createFile(file4User)).then(resp => file4Id = resp.entry.id) file4Id = (await apis.user.nodes.createFile(file4User)).entry.id;
.then(() => apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id])) await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
.then(() => apis.user.shared.waitForApi({ expect: 5 })) await apis.admin.shared.waitForApi({ expect: 5 });
.then(() => apis.user.nodes.deleteNodeById(file2Id)) await apis.user.nodes.deleteNodeById(file2Id);
.then(() => apis.user.shared.unshareFile(file3User)) await apis.user.shared.unshareFile(file3User);
await apis.admin.shared.waitForApi({ expect: 3 });
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
beforeEach(done => { beforeEach(async (done) => {
sharedFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES) await sharedFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
afterEach(done => { afterAll(async (done) => {
sharedFilesPage.refresh().then(done); await apis.admin.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folderId);
await apis.user.nodes.deleteNodeById(file4Id);
await logoutPage.load();
done();
}); });
afterAll(done => { it('has the correct columns - [C213113]', async () => {
Promise.all([ const expectedHeader = [ 'Thumbnail', 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
apis.admin.sites.deleteSite(siteName), const headers = dataTable.getColumnHeaders();
apis.user.nodes.deleteNodes([ folderUser ]), const count = await headers.count();
logoutPage.load() expect(count).toBe(6 + 1, 'Incorrect number of columns');
])
.then(done); expect(await dataTable.getHeaderText()).toEqual(expectedHeader);
}); });
it('has the correct columns - [C213113]', () => { it('default sorting column - [C213115]', async () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ]; expect(await dataTable.getSortedColumnHeaderText()).toBe('Modified');
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); expect(await dataTable.getSortingOrder()).toBe('desc');
expect(dataTable.getColumnHeaders().count()).toBe(6 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
}); });
it('default sorting column - [C213115]', () => { it('displays the files shared by everyone - [C213114]', async () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Modified'); expect(await dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getSortingOrder()).toBe('desc'); expect(await dataTable.getRowByName(file1User).isPresent()).toBe(true, `${file1User} not displayed`);
}); });
it('displays the files shared by everyone - [C213114]', () => { it(`file not displayed if it's been deleted - [C213117]`, async () => {
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); expect(await dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`);
expect(dataTable.getRowByName(file1User).isPresent()).toBe(true, `${file1User} not displayed`);
}); });
it(`file not displayed if it's been deleted - [C213117]`, () => { it('unshared file is not displayed - [C213118]', async () => {
expect(dataTable.getRowByName(file2User).isPresent()).toBe(false, `${file2User} is displayed`); expect(await dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
}); });
// TODO: disabled cause the api is slow to update. Find a way to wait until the file is unshared it('Location column displays the parent folder of the file - [C213665]', async () => {
xit('unshared file is not displayed - [C213118]', async () => { expect(await dataTable.getItemLocationTileAttr(file4User)).toEqual('Personal Files');
apis.user.shared.waitForApi({ expect: 4 }) expect(await dataTable.getItemLocation(fileAdmin)).toEqual(siteName);
.then(() => { expect(await dataTable.getItemLocation(file1User)).toEqual(folderUser);
expect(dataTable.getRowByName(file3User).isPresent()).toBe(false, `${file3User} is displayed`);
});
}); });
it('Location column displays the parent folder of the file - [C213665]', () => { it('Location column redirect - file in user Home - [C213666]', async () => {
expect(dataTable.getItemLocationTileAttr(file4User)).toEqual('Personal Files'); await dataTable.clickItemLocation(file4User);
expect(dataTable.getItemLocation(fileAdmin).getText()).toEqual(siteName); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
expect(dataTable.getItemLocation(file1User).getText()).toEqual(folderUser);
}); });
it('Location column redirect - file in user Home - [C213666]', () => { it('Location column redirect - file in folder - [C280490]', async () => {
dataTable.clickItemLocation(file4User) await dataTable.clickItemLocation(file1User);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderUser ]);
}); });
it('Location column redirect - file in folder - [C280490]', () => { it('Location column redirect - file in site - [C280491]', async () => {
dataTable.clickItemLocation(file1User) await dataTable.clickItemLocation(fileAdmin);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderUser ])); expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
}); });
it('Location column redirect - file in site - [C280491]', () => { it('Location column displays a tooltip with the entire path of the file - [C213667]', async () => {
dataTable.clickItemLocation(fileAdmin) expect(await dataTable.getItemLocationTileAttr(fileAdmin)).toEqual(`File Libraries/${siteName}`);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ])); expect(await dataTable.getItemLocationTileAttr(file1User)).toEqual(`Personal Files/${folderUser}`);
});
it('Location column displays a tooltip with the entire path of the file - [C213667]', () => {
expect(dataTable.getItemLocationTileAttr(fileAdmin)).toEqual(`File Libraries/${siteName}`);
expect(dataTable.getItemLocationTileAttr(file1User)).toEqual(`Personal Files/${folderUser}`);
}); });
}); });
+136 -152
View File
@@ -56,205 +56,198 @@ describe('File / folder tooltips', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable } = page;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.user.nodes.createFolder( parent )) parentId = (await apis.user.nodes.createFolder( parent )).entry.id;
.then(resp => parentId = resp.entry.id)
.then(() => Promise.all([ file1Id = (await apis.user.nodes.createFile(file, parentId)).entry.id;
apis.user.nodes.createFile(file, parentId).then(resp => file1Id = resp.entry.id), file2Id = (await apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription)).entry.id;
apis.user.nodes.createFile(fileWithDesc, parentId, '', fileDescription).then(resp => file2Id = resp.entry.id), file3Id = (await apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle)).entry.id;
apis.user.nodes.createFile(fileWithTitle, parentId, fileTitle).then(resp => file3Id = resp.entry.id), file4Id = (await apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription)).entry.id;
apis.user.nodes.createFile(fileWithTitleAndDesc, parentId, fileTitle, fileDescription) file5Id = (await apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)).entry.id;
.then(resp => file4Id = resp.entry.id), file6Id = (await apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription)).entry.id;
apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc) file7Id = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)).entry.id;
.then(resp => file5Id = resp.entry.id), file8Id = (await apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle)).entry.id;
apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentId, fileNameEqTitleDiffDesc, fileDescription)
.then(resp => file6Id = resp.entry.id),
apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)
.then(resp => file7Id = resp.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 ])) await apis.user.shared.shareFilesByIds([ file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id ]);
.then(() => apis.user.favorites.addFavoritesByIds('file', [ await apis.user.favorites.addFavoritesByIds('file', [
file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id
])) ]);
.then(() => loginPage.loginWith(username)) await loginPage.loginWith(username);
.then(done); done();
}); });
afterAll(done => { afterAll(async (done) => {
Promise.all([ await Promise.all([
apis.user.nodes.deleteNodes([ parent ]), apis.user.nodes.deleteNodes([ parent ]),
apis.admin.trashcan.emptyTrash(), apis.user.trashcan.emptyTrash(),
logoutPage.load() logoutPage.load()
]) ]);
.then(done); done();
}); });
xit(''); xit('');
describe('on Personal Files', () => { describe('on Personal Files', () => {
beforeAll(done => { beforeAll(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
.then(() => dataTable.doubleClickOnRowByName(parent)) await dataTable.doubleClickOnRowByName(parent);
.then(done); done();
}); });
it('File with name, no title, no description - [C255871]', () => { it('File with name, no title, no description - [C255871]', async () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title - [C255872]', () => { it('File with name and description, no title - [C255872]', async () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description - [C255873]', () => { it('File with name and title, no description - [C255873]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different - [C255874]', () => { it('File with name and title and description, all different - [C255874]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal - [C255875]', () => { it('File with name and title and description, all equal - [C255875]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description - [C255876]', () => { it('File with name = title, different description - [C255876]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title - [C255877]', () => { it('File with name = description, different title - [C255877]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name - [C255878]', () => { it('File with title = description, different name - [C255878]', async () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
describe('on Recent Files', () => { describe('on Recent Files', () => {
beforeAll(done => { beforeAll(async (done) => {
apis.user.search.waitForApi(username, { expect: 8 }) await apis.user.search.waitForApi(username, { expect: 8 });
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
.then(done); done();
}); });
it('File with name, no title, no description - [C280135]', () => { it('File with name, no title, no description - [C280135]', async () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title - [C280136]', () => { it('File with name and description, no title - [C280136]', async () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description - [C280137]', () => { it('File with name and title, no description - [C280137]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different - [C280138]', () => { it('File with name and title and description, all different - [C280138]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal - [C280139]', () => { it('File with name and title and description, all equal - [C280139]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description - [C280140]', () => { it('File with name = title, different description - [C280140]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title - [C280141]', () => { it('File with name = description, different title - [C280141]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name - [C280142]', () => { it('File with title = description, different name - [C280142]', async () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
// disabled until ACA-518 is done // disabled until ACA-518 is done
xdescribe('on Shared Files', () => { xdescribe('on Shared Files', () => {
beforeAll(done => { beforeAll(async (done) => {
apis.user.shared.waitForApi({ expect: 8 }) await apis.user.shared.waitForApi({ expect: 8 });
.then(() => page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
.then(done); done();
}); });
xit('File with name, no title, no description - [C280143]', () => { xit('File with name, no title, no description - [C280143]', async () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
xit('File with name and description, no title - [C280144]', () => { xit('File with name and description, no title - [C280144]', async () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
xit('File with name and title, no description - [C280145]', () => { xit('File with name and title, no description - [C280145]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
xit('File with name and title and description, all different - [C280146]', () => { xit('File with name and title and description, all different - [C280146]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
xit('File with name and title and description, all equal - [C280147]', () => { xit('File with name and title and description, all equal - [C280147]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
xit('File with name = title, different description - [C280148]', () => { xit('File with name = title, different description - [C280148]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
xit('File with name = description, different title - [C280149]', () => { xit('File with name = description, different title - [C280149]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
xit('File with title = description, different name - [C280150]', () => { xit('File with title = description, different name - [C280150]', async () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
describe('on Favorites', () => { describe('on Favorites', () => {
beforeAll(done => { beforeAll(async (done) => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES) await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
.then(() => dataTable.waitForHeader()) await dataTable.waitForHeader();
.then(done); done();
}); });
it('File with name, no title, no description - [C280151]', () => { it('File with name, no title, no description - [C280151]', async () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title - [C280152]', () => { it('File with name and description, no title - [C280152]', async () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description - [C280153]', () => { it('File with name and title, no description - [C280153]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different - [C280154]', () => { it('File with name and title and description, all different - [C280154]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal - [C280155]', () => { it('File with name and title and description, all equal - [C280155]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description - [C280156]', () => { it('File with name = title, different description - [C280156]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title - [C280157]', () => { it('File with name = description, different title - [C280157]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name - [C280158]', () => { it('File with title = description, different name - [C280158]', async () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
@@ -263,71 +256,62 @@ describe('File / folder tooltips', () => {
let parentForTrashId, file1TrashId, file2TrashId, file3TrashId, file4TrashId; let parentForTrashId, file1TrashId, file2TrashId, file3TrashId, file4TrashId;
let file5TrashId, file6TrashId, file7TrashId, file8TrashId; let file5TrashId, file6TrashId, file7TrashId, file8TrashId;
beforeAll(done => { beforeAll(async (done) => {
apis.user.nodes.createFolder( parentForTrash ) parentForTrashId = (await apis.user.nodes.createFolder( parentForTrash )).entry.id;
.then(resp => parentForTrashId = resp.entry.id) file1TrashId = (await apis.user.nodes.createFile(file, parentForTrashId)).entry.id;
.then(() => Promise.all([ file2TrashId = (await apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription)).entry.id;
apis.user.nodes.createFile(file, parentForTrashId) file3TrashId = (await apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle)).entry.id;
.then(resp => file1TrashId = resp.entry.id), file4TrashId = (await apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription)).entry.id;
apis.user.nodes.createFile(fileWithDesc, parentForTrashId, '', fileDescription) file5TrashId = (await apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)).entry.id;
.then(resp => file2TrashId = resp.entry.id), file6TrashId = (await apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription)).entry.id;
apis.user.nodes.createFile(fileWithTitle, parentForTrashId, fileTitle) file7TrashId = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle)).entry.id;
.then(resp => file3TrashId = resp.entry.id), file8TrashId = (await apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle)).entry.id;
apis.user.nodes.createFile(fileWithTitleAndDesc, parentForTrashId, fileTitle, fileDescription)
.then(resp => file4TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleEqDesc, parentForTrashId, fileNameEqTitleEqDesc, fileNameEqTitleEqDesc)
.then(resp => file5TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqTitleDiffDesc, parentForTrashId, fileNameEqTitleDiffDesc, fileDescription)
.then(resp => file6TrashId = resp.entry.id),
apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentForTrashId, fileTitle, fileNameEqDescDiffTitle)
.then(resp => file7TrashId = resp.entry.id),
apis.user.nodes.createFile(fileTitleEqDesc, parentForTrashId, fileTitle, fileTitle)
.then(resp => file8TrashId = resp.entry.id)
]))
.then(() => apis.user.nodes.deleteNodesById([ await apis.user.nodes.deleteNodesById([
file1TrashId, file2TrashId, file3TrashId, file4TrashId, file5TrashId, file6TrashId, file7TrashId, file8TrashId file1TrashId, file2TrashId, file3TrashId, file4TrashId, file5TrashId, file6TrashId, file7TrashId, file8TrashId
], false)) ], false);
.then(() => 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) => {
apis.user.nodes.deleteNodes([ parentForTrash ]).then(done); await apis.user.nodes.deleteNodes([ parentForTrash ]);
await apis.user.trashcan.emptyTrash();
done();
}); });
it('File with name, no title, no description - [C280159]', () => { it('File with name, no title, no description - [C280159]', async () => {
expect(dataTable.getItemNameTooltip(file)).toEqual(`${file}`); expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`);
}); });
it('File with name and description, no title - [C280160]', () => { it('File with name and description, no title - [C280160]', async () => {
expect(dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`);
}); });
it('File with name and title, no description - [C280161]', () => { it('File with name and title, no description - [C280161]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`);
}); });
it('File with name and title and description, all different - [C280162]', () => { it('File with name and title and description, all different - [C280162]', async () => {
expect(dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`);
}); });
it('File with name and title and description, all equal - [C280163]', () => { it('File with name and title and description, all equal - [C280163]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`);
}); });
it('File with name = title, different description - [C280164]', () => { it('File with name = title, different description - [C280164]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`);
}); });
it('File with name = description, different title - [C280165]', () => { it('File with name = description, different title - [C280165]', async () => {
expect(dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`);
}); });
it('File with title = description, different name - [C280166]', () => { it('File with title = description, different name - [C280166]', async () => {
expect(dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`);
}); });
}); });
}); });
+87 -85
View File
@@ -23,7 +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 { 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';
@@ -55,149 +54,152 @@ describe('Trash', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const logoutPage = new LogoutPage(); const logoutPage = new LogoutPage();
const trashPage = new BrowsingPage(); const trashPage = new BrowsingPage();
const { dataTable } = trashPage; const { dataTable, breadcrumb } = trashPage;
const { breadcrumb } = trashPage.toolbar;
beforeAll(done => { beforeAll(async (done) => {
apis.admin.people.createUser({ username }) await apis.admin.people.createUser({ username });
.then(() => apis.admin.nodes.createFiles([ fileAdmin ]).then(resp => fileAdminId = resp.entry.id)) fileAdminId = (await apis.admin.nodes.createFiles([ fileAdmin ])).entry.id;
.then(() => apis.admin.nodes.createFolders([ folderAdmin ]).then(resp => folderAdminId = resp.entry.id)) folderAdminId = (await apis.admin.nodes.createFolders([ folderAdmin ])).entry.id;
.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)) await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
.then(() => apis.admin.nodes.createFiles([ fileSite ], `Sites/${siteName}/documentLibrary`) const docLibId = await apis.admin.sites.getDocLibId(siteName);
.then(resp => fileSiteId = resp.entry.id)) fileSiteId = (await apis.admin.nodes.createFile(fileSite, docLibId)).entry.id;
.then(() => apis.user.nodes.createFiles([ fileUser ]).then(resp => fileUserId = resp.entry.id)) fileUserId = (await apis.user.nodes.createFiles([ fileUser ])).entry.id;
.then(() => apis.user.nodes.createFolders([ folderUser ]).then(resp => folderUserId = resp.entry.id)) folderUserId = (await apis.user.nodes.createFolders([ folderUser ])).entry.id;
.then(() => apis.user.nodes.createFolder(folderDeleted).then(resp => folderDeletedId = resp.entry.id)) folderDeletedId = (await apis.user.nodes.createFolder(folderDeleted)).entry.id;
.then(() => apis.user.nodes.createFiles([ fileDeleted ], folderDeleted).then(resp => fileDeletedId = resp.entry.id)) fileDeletedId = (await apis.user.nodes.createFiles([ fileDeleted ], folderDeleted)).entry.id;
.then(() => apis.user.nodes.createFolder(folderNotDeleted).then(resp => folderNotDeletedId = resp.entry.id)) folderNotDeletedId = (await apis.user.nodes.createFolder(folderNotDeleted)).entry.id;
.then(() => apis.user.nodes.createFiles([ fileInFolder ], folderNotDeleted).then(resp => fileInFolderId = resp.entry.id)) fileInFolderId = (await apis.user.nodes.createFiles([ fileInFolder ], folderNotDeleted)).entry.id;
.then(() => apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false)) await apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false);
.then(() => apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId, fileInFolderId ], false)) await apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId, fileInFolderId ], false);
.then(() => apis.user.nodes.deleteNodeById(fileDeletedId, false)) await apis.user.nodes.deleteNodeById(fileDeletedId, false);
.then(() => apis.user.nodes.deleteNodeById(folderDeletedId, false)) await apis.user.nodes.deleteNodeById(folderDeletedId, false);
.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.deleteNodeById(folderNotDeletedId), apis.user.nodes.deleteNodeById(folderNotDeletedId),
apis.admin.trashcan.emptyTrash() apis.admin.trashcan.emptyTrash()
]) ]);
.then(done); done();
}); });
xit(''); xit('');
describe('as admin', () => { describe('as admin', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWithAdmin().then(done); await loginPage.loginWithAdmin();
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) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('has the correct columns - [C213217]', () => { it('has the correct columns - [C213217]', async () => {
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));
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 files and folders deleted by everyone - [C280493]', () => { it('displays the files and folders deleted by everyone - [C280493]', async () => {
expect(dataTable.countRows()).toEqual(8, 'Incorrect number of deleted items displayed'); expect(await dataTable.countRows()).toEqual(8, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); expect(await dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`); expect(await dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); expect(await dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); expect(await dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
}); });
}); });
describe('as user', () => { describe('as user', () => {
beforeAll(done => { beforeAll(async (done) => {
loginPage.loginWith(username).then(done); await loginPage.loginWith(username);
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) => {
logoutPage.load().then(done); await logoutPage.load();
done();
}); });
it('has the correct columns - [C280494]', () => { it('has the correct columns - [C280494]', async () => {
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));
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns'); expect(await dataTable.getColumnHeaders().count()).toBe(4 + 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 files and folders deleted by the user - [C213218]', () => { it('displays the files and folders deleted by the user - [C213218]', async () => {
expect(dataTable.countRows()).toEqual(6, 'Incorrect number of deleted items displayed'); expect(await dataTable.countRows()).toEqual(6, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(await dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); expect(await dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); expect(await dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`); expect(await dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`);
}); });
it('default sorting column - [C213219]', () => { it('default sorting column - [C213219]', async () => {
expect(dataTable.getSortedColumnHeader().getText()).toBe('Deleted'); expect(await dataTable.getSortedColumnHeader().getText()).toBe('Deleted');
expect(dataTable.getSortingOrder()).toBe('desc'); expect(await dataTable.getSortingOrder()).toBe('desc');
}); });
it('Location column displays the parent folder of the file - [C280498]', () => { it('Location column displays the parent folder of the file - [C280498]', async () => {
expect(dataTable.getItemLocation(fileInFolder).getText()).toEqual(folderNotDeleted); expect(await dataTable.getItemLocation(fileInFolder)).toEqual(folderNotDeleted);
expect(dataTable.getItemLocation(fileUser).getText()).toEqual('Personal Files'); expect(await dataTable.getItemLocation(fileUser)).toEqual('Personal Files');
expect(dataTable.getItemLocation(fileSite).getText()).toEqual(siteName); expect(await dataTable.getItemLocation(fileSite)).toEqual(siteName);
}); });
it('Location column displays a tooltip with the entire path of the file - [C280499]', () => { it('Location column displays a tooltip with the entire path of the file - [C280499]', async () => {
expect(dataTable.getItemLocationTileAttr(fileInFolder)).toEqual(`Personal Files/${folderNotDeleted}`); expect(await dataTable.getItemLocationTileAttr(fileInFolder)).toEqual(`Personal Files/${folderNotDeleted}`);
expect(dataTable.getItemLocationTileAttr(fileUser)).toEqual('Personal Files'); expect(await dataTable.getItemLocationTileAttr(fileUser)).toEqual('Personal Files');
expect(dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}`); expect(await dataTable.getItemLocationTileAttr(fileSite)).toEqual(`File Libraries/${siteName}`);
}); });
it('Location column is empty if parent folder no longer exists - [C280500]', () => { it('Location column is empty if parent folder no longer exists - [C280500]', async () => {
expect(dataTable.getItemLocation(fileDeleted).getText()).toEqual(''); expect(await dataTable.getItemLocation(fileDeleted)).toEqual('');
}); });
it('Location column redirect - file in user Home - [C217144]', () => { it('Location column redirect - file in user Home - [C217144]', async () => {
dataTable.clickItemLocation(fileUser) await dataTable.clickItemLocation(fileUser);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files' ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files' ]);
}); });
it('Location column redirect - file in folder - [C280496]', () => { it('Location column redirect - file in folder - [C280496]', async () => {
dataTable.clickItemLocation(fileInFolder) await dataTable.clickItemLocation(fileInFolder);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderNotDeleted ])); expect(await breadcrumb.getAllItems()).toEqual([ 'Personal Files', folderNotDeleted ]);
}); });
it('Location column redirect - file in site - [C280497]', () => { it('Location column redirect - file in site - [C280497]', async () => {
dataTable.clickItemLocation(fileSite) await dataTable.clickItemLocation(fileSite);
.then(() => expect(breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ])); expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
}); });
}); });
}); });

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