Merge pull request #1164 from Alfresco/development

1.8.0
This commit is contained in:
Denys Vuika
2019-07-10 18:47:15 +01:00
committed by GitHub
397 changed files with 20874 additions and 16092 deletions
+38
View File
@@ -0,0 +1,38 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# these users will be requested for
# review when someone opens a pull request.
* @DenysVuika @pionnegru
# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
e2e/* @adinapitul @pionnegru @DenysVuika
protractor.conf.js @adinapitul
# You can also use email addresses if you prefer. They'll be
# used to look up users just like we do for commit author
# emails.
#*.go docs@example.com
# In this example, @doctocat owns any files in the build/logs
# directory at the root of the repository and any of its
# subdirectories.
#/build/logs/ @doctocat
# The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`.
#docs/* docs@example.com
# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
#apps/ @octocat
# In this example, @doctocat owns any file in the `/docs`
# directory in the root of your repository.
#/docs/ @doctocat
+7 -39
View File
@@ -1,44 +1,12 @@
## PR Checklist ## Definition of Done
Please check if your PR fulfills the following requirements:
``` - Technical Documentation
- [ ] The commit message follows our guidelines: https://github.com/Alfresco/alfresco-content-app/blob/master/CONTRIBUTING.md#commit - Code compliant with Clean Coding rules and tslint
- [ ] Tests for the changes have been added (for bug fixes / features) - Unit tests
- [ ] Docs have been added / updated (for bug fixes / features) - Automation tests
```
## PR Type ## Current behavior
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application / Infrastructure changes
[ ] Other... Please describe:
```
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
Issue Number: N/A Issue Number: N/A
## New behavior
## What is the new behavior?
## Does this PR introduce a breaking change?
```
[ ] Yes
[ ] No
```
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
## Other information
+23
View File
@@ -1,2 +1,25 @@
modules: modules:
- pr.prettier - pr.prettier
- pr.spellcheck
prettier:
options:
singleQuote: true
exclude:
- '*.json'
spellcheck:
dictionaries:
- softwareTerms
- html
- en-gb
- en_US
words:
- plint
- ngrx
- qshare
- snackbar
- exif
- docx
exclude:
- src/assets/app.extensions.json
+26 -12
View File
@@ -7,27 +7,41 @@ addons:
language: node_js language: node_js
node_js: node_js:
- '10' - '10'
before_script:
- sudo /etc/init.d/postgresql stop cache:
directories:
- node_modules
before_install: before_install:
- sudo /etc/init.d/postgresql stop
- 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 - sleep 3
stages:
- name: Quality and Unit tests
- name: e2e
jobs: jobs:
include: include:
- stage: test - stage: Quality and Unit tests
name: 'Code quality checks' name: 'Code quality checks'
script: script: npm run lint
- npm run lint - name: 'Unit tests'
- 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' name: Test Suite appNavigation&search
script: npm run build.e2e && npm run e2e:docker script: npm run build.e2e && SUITE="--suite authentication,listViews,navigation,application,pagination,search" npm run e2e:docker
- stage: e2e - name: Test Suite actionsAvailable
name: 'Tomcat' script: npm run build.e2e && SUITE="--suite actionsAvailable" npm run e2e:docker
script: npm run build.tomcat.e2e && npm run docker.tomcat.e2e - name: Test Suite addRemoveContent
script: npm run build.e2e && SUITE="--suite addRemoveContent" npm run e2e:docker
- name: Test Suite manageContent
script: npm run build.e2e && SUITE="--suite manageContent" npm run e2e:docker
- name: Test Suite sharingContent&markFavorite
script: npm run build.e2e && SUITE="--suite sharingContent" npm run e2e:docker
- name: Test Suite viewContent&metadata&extensions
script: npm run build.e2e && SUITE="--suite viewer,infoDrawer,extensions" npm run e2e:docker
+2 -2
View File
@@ -1,9 +1,9 @@
{ {
"recommendations": [ "recommendations": [
"eg2.tslint", "ms-vscode.vscode-typescript-tslint-plugin",
"angular.ng-template", "angular.ng-template",
"streetsidesoftware.code-spell-checker", "streetsidesoftware.code-spell-checker",
"peterjausovec.vscode-docker", "ms-azuretools.vscode-docker",
"editorconfig.editorconfig", "editorconfig.editorconfig",
"davidanson.vscode-markdownlint", "davidanson.vscode-markdownlint",
"esbenp.prettier-vscode", "esbenp.prettier-vscode",
+11 -8
View File
@@ -1,4 +1,4 @@
<p align="left"> <img title="Alfresco" src="alfresco.png" alt="Alfresco - make business flow"></p> <p align="left"> <img title="Alfresco" src="alfresco.png" alt="Alfresco - Simply a better way to create amazing digital experiences"></p>
# Alfresco Content Application # Alfresco Content Application
@@ -32,25 +32,23 @@ Please include a clear description, steps to reproduce and screenshots where app
#### Features added in the latest release #### Features added in the latest release
- Edit Offline - lock and download files whilst editing - New language translations (Arabic, Czech, Danish, Finnish, Polish and Swedish)
- Edit Online - edit files directly in Microsoft Office - Automatic display of metadata aspects and properties
- [Alfresco Full Text Search (FTS) syntax](https://alfresco-content-app.netlify.com/#/features/search-results?id=alfresco-full-text-search) - enhanced search input to support the Alfresco Search Query Language - Search result facet improvements
- [Single Sign-On](https://alfresco-content-app.netlify.com/#/getting-started/sso) (SSO) support with Alfresco Identity Service and ADF 3.0.0, basic Kerberos support - Various extensibility improvements and enhancements
Please refer to the [release notes] for details of all changes. Please refer to the [release notes] for details of all changes.
#### High level feature themes planned for 2019 #### High level feature themes planned for 2019
- Extensibility - Extensibility
- Building on the existing framework to further enhance the developer experience - Building on the existing framework to further enhance the developer experience
- Collaboration & File Management - Collaboration & File Management
- Folder rule creation - Folder rule creation
- File/Folder linking via secondary association - File/Folder linking via secondary association
- File Library Management - File Library Management
- For managers: manage Library users and requests to join
- Enhanced UI and user experience - Enhanced UI and user experience
- New language translations (Arabic, Czech, Danish, Finnish, Polish and Swedish).
- Accessibility WCAG AA compliance - Accessibility WCAG AA compliance
- Search result facet improvements
- Search query input assistance - Search query input assistance
- Metadata information drawer enhancements - Metadata information drawer enhancements
@@ -63,6 +61,7 @@ Read up on our guidelines for [contributing] and then check out one of our issue
| ACA Version | Built with | Tested on | | ACA Version | Built with | Tested on |
| ----------- | ---------- | --------- | | ----------- | ---------- | --------- |
| ACA 1.8 | ADF 3.3.0 | ACS 6.1 |
| ACA 1.7 | ADF 3.0.0 | ACS 6.1 | | ACA 1.7 | ADF 3.0.0 | ACS 6.1 |
| ACA 1.6 | ADF 2.6.1 | ACS 6.1 | | ACA 1.6 | ADF 2.6.1 | ACS 6.1 |
| ACA 1.5 | ADF 2.6.0 | ACS 6.0 | | ACA 1.5 | ADF 2.6.0 | ACS 6.0 |
@@ -96,6 +95,10 @@ Read up on our guidelines for [contributing] and then check out one of our issue
| 1.7 | Edit with Microsoft Office | Extension to edit online with Alfresco Office Services (AOS) | | 1.7 | Edit with Microsoft Office | Extension to edit online with Alfresco Office Services (AOS) |
| 1.7 | Single Sign-On (SSO) | Support for Alfresco Identity Service, with ADF 3.0.0 | | 1.7 | Single Sign-On (SSO) | Support for Alfresco Identity Service, with ADF 3.0.0 |
| 1.7 | Search Query Language | Enhanced search input using the Alfresco Search Query Language | | 1.7 | Search Query Language | Enhanced search input using the Alfresco Search Query Language |
| 1.8 | Localizations . | Arabic, Czech, Danish, Finnish, Polish and Swedish |
| 1.8 | Metadata improvements | Automatic display of aspects and properties |
| 1.8 | Search facet improvements | Facet intervals and grouped facet queries |
| 1.8 | Extensibility improvements | Various - see [release notes](https://github.com/Alfresco/alfresco-content-app/releases) for details |
[contributing]: https://github.com/Alfresco/alfresco-content-app/blob/master/CONTRIBUTING.md [contributing]: https://github.com/Alfresco/alfresco-content-app/blob/master/CONTRIBUTING.md
[github]: https://github.com/Alfresco/alfresco-content-app/issues [github]: https://github.com/Alfresco/alfresco-content-app/issues
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

+40
View File
@@ -22,6 +22,11 @@
] ]
}, },
"assets": [ "assets": [
{
"glob": "LICENSE",
"input": ".",
"output": "/"
},
"src/assets", "src/assets",
"src/favicon-96x96.png", "src/favicon-96x96.png",
"src/app.config.json", "src/app.config.json",
@@ -273,6 +278,41 @@
} }
} }
} }
},
"aca-shared": {
"root": "projects/aca-shared",
"sourceRoot": "projects/aca-shared/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/aca-shared/tsconfig.lib.json",
"project": "projects/aca-shared/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/aca-shared/test.ts",
"tsConfig": "projects/aca-shared/tsconfig.spec.json",
"karmaConfig": "projects/aca-shared/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/aca-shared/tsconfig.lib.json",
"projects/aca-shared/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
} }
}, },
"defaultProject": "app", "defaultProject": "app",
+3 -1
View File
@@ -42,6 +42,7 @@
"docx", "docx",
"SOLR", "SOLR",
"simpletask", "simpletask",
"titlecase",
"unshare", "unshare",
"qshare", "qshare",
@@ -62,7 +63,8 @@
"keycodes", "keycodes",
"denysvuika", "denysvuika",
"submenu", "submenu",
"submenus" "submenus",
"dateitem"
], ],
"dictionaries": ["html", "en-gb", "en_US"] "dictionaries": ["html", "en-gb", "en_US"]
} }
+9 -3
View File
@@ -60,17 +60,23 @@ if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT}" ];then
fi fi
if [[ $ACSURL ]]; then if [[ $ACSURL ]]; then
sed -i s%{protocol}//{hostname}{:port}%"$ACSURL"%g /tmp/app.config.json && \ replace="\/"
encoded=${ACSURL//\//$replace}
sed -i s%{protocol}//{hostname}{:port}%"$encoded"%g /tmp/app.config.json && \
cat /tmp/app.config.json > ./app.config.json cat /tmp/app.config.json > ./app.config.json
fi fi
if [[ $BASEPATH ]]; then if [[ $BASEPATH ]]; then
sed -i s%href=\"/\"%href=\""$BASEPATH"\"%g /tmp/index.html && \ replace="\/"
encoded=${BASEPATH//\//$replace}
sed -i s%href=\"/\"%href=\""$encoded"\"%g /tmp/index.html && \
cat /tmp/index.html > ./index.html cat /tmp/index.html > ./index.html
fi fi
if [ -n "${APP_BASE_SHARE_URL}" ];then if [ -n "${APP_BASE_SHARE_URL}" ];then
sed -e "s/\"baseShareUrl\": \".*\"/\"baseShareUrl\": \"${APP_BASE_SHARE_URL}\"/g" \ replace="\/"
encoded=${APP_BASE_SHARE_URL//\//$replace}
sed -e "s/\"baseShareUrl\": \".*\"/\"baseShareUrl\": \"${encoded}\"/g" \
-i /tmp/app.config.json && \ -i /tmp/app.config.json && \
cat /tmp/app.config.json > ./app.config.json cat /tmp/app.config.json > ./app.config.json
fi fi
+1
View File
@@ -24,6 +24,7 @@ The documentation is divided into the following sections:
| ACA Version | Built with | Tested on | | ACA Version | Built with | Tested on |
| ----------- | ---------- | --------- | | ----------- | ---------- | --------- |
| ACA 1.8 | ADF 3.3.0 | ACS 6.1 |
| ACA 1.7 | ADF 3.0.0 | ACS 6.1 | | ACA 1.7 | ADF 3.0.0 | ACS 6.1 |
| ACA 1.6 | ADF 2.6.1 | ACS 6.1 | | ACA 1.6 | ADF 2.6.1 | ACS 6.1 |
| ACA 1.5 | ADF 2.6.0 | ACS 6.0 | | ACA 1.5 | ADF 2.6.0 | ACS 6.0 |
+47 -45
View File
@@ -76,48 +76,50 @@ and perform document list reload if needed.
Below is the list of public actions types you can use in the plugin definitions as a reference to the action: Below is the list of public actions types you can use in the plugin definitions as a reference to the action:
| Name | Payload | Description | | Version | Name | Payload | Description |
| ---------------------- | ------------------- | ----------------------------------------------------------------------------------------------- | | ------- | ---------------------- | ------------------- | ----------------------------------------------------------------------------------------------- |
| SET_CURRENT_FOLDER | Node | Notify components about currently opened folder. | | 1.7.0 | SET_CURRENT_FOLDER | Node | Notify components about currently opened folder. |
| SET_CURRENT_URL | string | Notify components about current browser URL. | | 1.7.0 | SET_CURRENT_URL | string | Notify components about current browser URL. |
| SET_USER_PROFILE | Person | Assign current user profile. | | 1.7.0 | SET_USER_PROFILE | Person | Assign current user profile. |
| TOGGLE_INFO_DRAWER | n/a | Toggle info drawer for the selected node. | | 1.7.0 | TOGGLE_INFO_DRAWER | n/a | Toggle info drawer for the selected node. |
| ADD_FAVORITE | MinimalNodeEntity[] | Add nodes (or selection) to favorites. | | 1.7.0 | ADD_FAVORITE | MinimalNodeEntity[] | Add nodes (or selection) to favorites. |
| REMOVE_FAVORITE | MinimalNodeEntity[] | Removes nodes (or selection) from favorites. | | 1.7.0 | REMOVE_FAVORITE | MinimalNodeEntity[] | Removes nodes (or selection) from favorites. |
| DELETE_LIBRARY | string | Delete a Library by id. Takes selected node if payload not provided. | | 1.7.0 | DELETE_LIBRARY | string | Delete a Library by id. Takes selected node if payload not provided. |
| CREATE_LIBRARY | n/a | Invoke a "Create Library" dialog. | | 1.7.0 | CREATE_LIBRARY | n/a | Invoke a "Create Library" dialog. |
| SET_SELECTED_NODES | MinimalNodeEntity[] | Notify components about selected nodes. | | 1.7.0 | SET_SELECTED_NODES | MinimalNodeEntity[] | Notify components about selected nodes. |
| DELETE_NODES | MinimalNodeEntity[] | Delete the nodes (or selection). Supports undo actions. | | 1.7.0 | DELETE_NODES | MinimalNodeEntity[] | Delete the nodes (or selection). Supports undo actions. |
| UNDO_DELETE_NODES | any[] | Reverts deletion of nodes (or selection). | | 1.7.0 | UNDO_DELETE_NODES | any[] | Reverts deletion of nodes (or selection). |
| RESTORE_DELETED_NODES | MinimalNodeEntity[] | Restores deleted nodes (or selection). Typically used with Trashcan. | | 1.7.0 | RESTORE_DELETED_NODES | MinimalNodeEntity[] | Restores deleted nodes (or selection). Typically used with Trashcan. |
| PURGE_DELETED_NODES | MinimalNodeEntity[] | Permanently delete nodes (or selection). Typically used with Trashcan. | | 1.7.0 | PURGE_DELETED_NODES | MinimalNodeEntity[] | Permanently delete nodes (or selection). Typically used with Trashcan. |
| DOWNLOAD_NODES | MinimalNodeEntity[] | Download nodes (or selections). Creates a ZIP archive for folders or multiple items. | | 1.7.0 | DOWNLOAD_NODES | MinimalNodeEntity[] | Download nodes (or selections). Creates a ZIP archive for folders or multiple items. |
| CREATE_FOLDER | string | Invoke a "Create Folder" dialog for the opened folder (or the parent folder id in the payload). | | 1.7.0 | CREATE_FOLDER | string | Invoke a "Create Folder" dialog for the opened folder (or the parent folder id in the payload). |
| EDIT_FOLDER | MinimalNodeEntity | Invoke an "Edit Folder" dialog for the node (or selection). | | 1.7.0 | EDIT_FOLDER | MinimalNodeEntity | Invoke an "Edit Folder" dialog for the node (or selection). |
| SHARE_NODE | MinimalNodeEntity | Invoke a "Share" dialog for the node (or selection). | | 1.7.0 | SHARE_NODE | MinimalNodeEntity | Invoke a "Share" dialog for the node (or selection). |
| UNSHARE_NODES | MinimalNodeEntity[] | Remove nodes (or selection) from the shared nodes (does not remove content). | | 1.7.0 | UNSHARE_NODES | MinimalNodeEntity[] | Remove nodes (or selection) from the shared nodes (does not remove content). |
| COPY_NODES | MinimalNodeEntity[] | Invoke a "Copy" dialog for the nodes (or selection). Supports undo actions. | | 1.7.0 | COPY_NODES | MinimalNodeEntity[] | Invoke a "Copy" dialog for the nodes (or selection). Supports undo actions. |
| MOVE_NODES | MinimalNodeEntity[] | Invoke a "Move" dialog for the nodes (or selection). Supports undo actions. | | 1.7.0 | MOVE_NODES | MinimalNodeEntity[] | Invoke a "Move" dialog for the nodes (or selection). Supports undo actions. |
| MANAGE_PERMISSIONS | MinimalNodeEntity | Invoke a "Manage Permissions" dialog for the node (or selection). | | 1.7.0 | MANAGE_PERMISSIONS | MinimalNodeEntity | Invoke a "Manage Permissions" dialog for the node (or selection). |
| MANAGE_VERSIONS | MinimalNodeEntity | Invoke a "Manage Versions" dialog for the node (or selection). | | 1.7.0 | MANAGE_VERSIONS | MinimalNodeEntity | Invoke a "Manage Versions" dialog for the node (or selection). |
| NAVIGATE_URL | string | Navigate to a given route URL within the application. | | 1.7.0 | NAVIGATE_URL | string | Navigate to a given route URL within the application. |
| NAVIGATE_ROUTE | any[] | Navigate to a particular Route (supports parameters). | | 1.7.0 | NAVIGATE_ROUTE | any[] | Navigate to a particular Route (supports parameters). |
| NAVIGATE_FOLDER | MinimalNodeEntity | Navigate to a folder based on the Node properties. | | 1.7.0 | NAVIGATE_FOLDER | MinimalNodeEntity | Navigate to a folder based on the Node properties. |
| NAVIGATE_PARENT_FOLDER | MinimalNodeEntity | Navigate to a containing folder based on the Node properties. | | 1.7.0 | NAVIGATE_PARENT_FOLDER | MinimalNodeEntity | Navigate to a containing folder based on the Node properties. |
| NAVIGATE_LIBRARY | string | Navigate to library. | | 1.7.0 | NAVIGATE_LIBRARY | string | Navigate to library. |
| SEARCH_BY_TERM | string | Perform a simple search by the term and navigate to Search results. | | 1.7.0 | SEARCH_BY_TERM | string | Perform a simple search by the term and navigate to Search results. |
| SNACKBAR_INFO | string | Show information snackbar with the message provided. | | 1.7.0 | SNACKBAR_INFO | string | Show information snackbar with the message provided. |
| SNACKBAR_WARNING | string | Show warning snackbar with the message provided. | | 1.7.0 | SNACKBAR_WARNING | string | Show warning snackbar with the message provided. |
| SNACKBAR_ERROR | string | Show error snackbar with the message provided. | | 1.7.0 | SNACKBAR_ERROR | string | Show error snackbar with the message provided. |
| UPLOAD_FILES | n/a | Invoke "Upload Files" dialog and upload files to the currently opened folder. | | 1.7.0 | UPLOAD_FILES | n/a | Invoke "Upload Files" dialog and upload files to the currently opened folder. |
| UPLOAD_FOLDER | n/a | Invoke "Upload Folder" dialog and upload selected folder to the currently opened one. | | 1.7.0 | UPLOAD_FOLDER | n/a | Invoke "Upload Folder" dialog and upload selected folder to the currently opened one. |
| UPLOAD_FILE_VERSION | n/a | Invoke "New File Version" dialog. | | 1.7.0 | UPLOAD_FILE_VERSION | n/a | Invoke "New File Version" dialog. |
| VIEW_FILE | MinimalNodeEntity | Preview the file (or selection) in the Viewer. | | 1.7.0 | VIEW_FILE | MinimalNodeEntity | Preview the file (or selection) in the Viewer. |
| UNLOCK_WRITE | NodeEntry | Unlock file from read only mode | | 1.7.0 | UNLOCK_WRITE | NodeEntry | Unlock file from read only mode |
| PRINT_FILE | MinimalNodeEntity | Print the file opened in the Viewer (or selected). | | 1.7.0 | PRINT_FILE | MinimalNodeEntity | Print the file opened in the Viewer (or selected). |
| FULLSCREEN_VIEWER | n/a | Enters fullscreen mode to view the file opened in the Viewer. | | 1.7.0 | FULLSCREEN_VIEWER | n/a | Enters fullscreen mode to view the file opened in the Viewer. |
| LOGOUT | n/a | Log out and redirect to Login screen. | | 1.7.0 | LOGOUT | n/a | Log out and redirect to Login screen. |
| RELOAD_DOCUMENT_LIST | n/a | Reload active document list | | 1.7.0 | RELOAD_DOCUMENT_LIST | n/a | Reload active document list |
| TOGGLE_SEARCH_FILTER | n/a | Toggle Filter component visibility in Search Results. | | 1.7.0 | TOGGLE_SEARCH_FILTER | n/a | Toggle Filter component visibility in Search Results. |
| SHOW_SEARCH_FILTER | n/a | Show Filter component in Search Results. | | 1.7.0 | SHOW_SEARCH_FILTER | n/a | Show Filter component in Search Results. |
| HIDE_SEARCH_FILTER | n/a | Hide Filter component in Search Results | | 1.7.0 | HIDE_SEARCH_FILTER | n/a | Hide Filter component in Search Results |
| 1.8.0 | VIEW_NODE | string | Lightweight preview of a node by id. Can be invoked from extensions. |
| 1.8.0 | CLOSE_PREVIEW | n/a | Closes the viewer ( preview of the item ) |
+30
View File
@@ -363,6 +363,7 @@ Viewer component in ACA supports the following extension points:
- Toolbar actions - Toolbar actions
- `More` toolbar actions - `More` toolbar actions
- `Open With` actions - `Open With` actions
- Rules
```json ```json
{ {
@@ -547,6 +548,35 @@ and invoke it from the custom `Open With` menu entry called `Snackbar`.
As with other content actions, custom plugins can disable, update or extend `Open With` actions. As with other content actions, custom plugins can disable, update or extend `Open With` actions.
### Rules
You can provide global rules for the Viewer by utilizing the `features.viewer.rules` object:
```ts
export interface ViewerRules {
/**
* Checks if user can preview the node.
*/
canPreview?: string;
}
```
For example:
```json
{
"features": {
"viewer": {
"rules": {
"canPreview": "customRule"
}
}
}
}
```
The rule should return `true` if node preview is allowed, otherwise `false`.
## Content metadata presets ## Content metadata presets
The content metadata presets are needed by the [Content Metadata Component](https://www.alfresco.com/abn/adf/docs/content-services/content-metadata-card.component/) to render the properties of metadata aspects for a given node. The content metadata presets are needed by the [Content Metadata Component](https://www.alfresco.com/abn/adf/docs/content-services/content-metadata-card.component/) to render the properties of metadata aspects for a given node.
+64 -52
View File
@@ -56,11 +56,11 @@ in case you do not need providing extra parameters, or chaining multiple rules t
You can create new rules by chaining other rules and evaluators. You can create new rules by chaining other rules and evaluators.
| Key | Description | | Version | Key | Description |
| ---------- | ----------------------------------------------------------------------------- | | ------- | ---------- | ----------------------------------------------------------------------------- |
| core.every | Evaluates to `true` if all chained rules evaluate to `true`. | | 1.7.0 | core.every | Evaluates to `true` if all chained rules evaluate to `true`. |
| core.some | Evaluates to `true` if at least one of the chained rules evaluates to `true`. | | 1.7.0 | core.some | Evaluates to `true` if at least one of the chained rules evaluates to `true`. |
| core.not | Evaluates to `true` if all chained rules evaluate to `false`. | | 1.7.0 | core.not | Evaluates to `true` if all chained rules evaluate to `false`. |
Below is an example of the composite rule definition that combines the following conditions: Below is an example of the composite rule definition that combines the following conditions:
@@ -129,31 +129,43 @@ The button will be visible only when the linked rule evaluates to `true`.
## Application Evaluators ## Application Evaluators
| Key | Description | | Ver. | Key | Description |
| ----------------------------------- | ------------------------------------------------------------ | | ----- | ----------------------------------- | ------------------------------------------------------------------------ |
| app.selection.canDelete | User has permission to delete selected node(s). | | 1.7.0 | app.selection.canDelete | User has permission to delete selected node(s). |
| app.selection.canDownload | User can download selected node(s). | | 1.7.0 | app.selection.canDownload | User can download selected node(s). |
| app.selection.notEmpty | At least one node is selected. | | 1.7.0 | app.selection.notEmpty | At least one node is selected. |
| app.selection.canUnshare | User is able to remove selected node(s) from public sharing. | | 1.7.0 | app.selection.canUnshare | User is able to remove selected node(s) from public sharing. |
| app.selection.canAddFavorite | User can add selected node(s) to favorites. | | 1.7.0 | app.selection.canAddFavorite | User can add selected node(s) to favorites. |
| app.selection.canRemoveFavorite | User can remove selected node(s) from favorites. | | 1.7.0 | app.selection.canRemoveFavorite | User can remove selected node(s) from favorites. |
| app.selection.first.canUpdate | User has permission to update selected node(s). | | 1.7.0 | app.selection.first.canUpdate | User has permission to update selected node(s). |
| app.selection.file | A single File node is selected. | | 1.7.0 | app.selection.file | A single File node is selected. |
| app.selection.file.canShare | User is able to share the selected file. | | 1.7.0 | app.selection.file.canShare | User is able to share the selected file. |
| app.selection.file.isShared | A shared node is selected. | | 1.7.0 | app.selection.file.isShared | A shared node is selected. |
| app.selection.file.isLocked | File is locked for editing. | | 1.7.0 | app.selection.file.isLocked | File is locked for editing. |
| app.selection.file.isLockOwner | File is locked and current user is the lock owner. | | 1.7.0 | app.selection.file.isLockOwner | File is locked and current user is the lock owner. |
| app.selection.file.canUploadVersion | User can update file version. | | 1.7.0 | app.selection.file.canUploadVersion | User can update file version. |
| app.selection.library | A single Library node is selected. | | 1.7.0 | app.selection.library | A single Library node is selected. |
| app.selection.isPrivateLibrary | A private Library node is selected. | | 1.7.0 | app.selection.isPrivateLibrary | A private Library node is selected. |
| app.selection.hasLibraryRole | The selected Library node has a role property. | | 1.7.0 | app.selection.hasLibraryRole | The selected Library node has a role property. |
| app.selection.hasNoLibraryRole | The selected Library node has no role property. | | 1.7.0 | app.selection.hasNoLibraryRole | The selected Library node has no role property. |
| app.selection.folder | A single Folder node is selected. | | 1.7.0 | app.selection.folder | A single Folder node is selected. |
| app.selection.folder.canUpdate | User has permissions to update the selected folder. | | 1.7.0 | app.selection.folder.canUpdate | User has permissions to update the selected folder. |
| app.selection.folder.canUpdate | User has permissions to update the selected folder. | | 1.7.0 | app.selection.folder.canUpdate | User has permissions to update the selected folder. |
| app.selection.file.canLock | User has permissions to lock file. | | 1.7.0 | app.selection.file.canLock | User has permissions to lock file. |
| app.selection.file.canUnlock | User has permissions to unlock file. | | 1.7.0 | app.selection.file.canUnlock | User has permissions to unlock file. |
| repository.isQuickShareEnabled | Whether the quick share repository option is enabled or not. | | 1.7.0 | repository.isQuickShareEnabled | Whether the quick share repository option is enabled or not. |
| 1.8.0 | canCopyNode | Checks if user can copy selected node. |
| 1.8.0 | canToggleJoinLibrary | Checks if user can perform "Join" or "Cancel Join Request" on a library. |
| 1.8.0 | canEditFolder | Checks if user can edit the selected folder. |
| 1.8.0 | isTrashcanItemSelected | Checks if user has trashcan item selected. |
| 1.8.0 | canViewFile | Checks if user can view the file. |
| 1.8.0 | canLeaveLibrary | Checks if user can **Leave** selected library. |
| 1.8.0 | canToggleSharedLink | Checks if user can toggle shared link mode. |
| 1.8.0 | canShowInfoDrawer | Checks if user can show **Info Drawer** for the selected node. |
| 1.8.0 | canManageFileVersions | Checks if user can manage file versions for the selected node. |
| 1.8.0 | canManagePermissions | Checks if user can manage permissions for the selected node. |
| 1.8.0 | canToggleEditOffline | Checks if user can toggle **Edit Offline** mode for selected node. |
| 1.8.0 | user.isAdmin | Checks if user is admin. |
## Navigation Evaluators ## Navigation Evaluators
@@ -165,28 +177,28 @@ for example mixing `core.every` and `core.not`.
**Tip:** You can also negate any rule by utilizing a `!` prefix: **Tip:** You can also negate any rule by utilizing a `!` prefix:
`!app.navigation.isTrashcan` is the opposite of the `app.navigation.isTrashcan`. `!app.navigation.isTrashcan` is the opposite of the `app.navigation.isTrashcan`.
| Key | Description | | Version | Key | Description |
| --------------------------------- | ---------------------------------------------------------------- | | ------- | --------------------------------- | ---------------------------------------------------------------- |
| app.navigation.folder.canCreate | User can create content in the currently opened folder. | | 1.7.0 | app.navigation.folder.canCreate | User can create content in the currently opened folder. |
| app.navigation.folder.canUpload | User can upload content to the currently opened folder. | | 1.7.0 | app.navigation.folder.canUpload | User can upload content to the currently opened folder. |
| app.navigation.isTrashcan | User is using the **Trashcan** page. | | 1.7.0 | app.navigation.isTrashcan | User is using the **Trashcan** page. |
| app.navigation.isNotTrashcan | Current page is not a **Trashcan**. | | 1.7.0 | app.navigation.isNotTrashcan | Current page is not a **Trashcan**. |
| app.navigation.isLibraries | User is using a **Libraries** or **Library Search Result** page. | | 1.7.0 | app.navigation.isLibraries | User is using a **Libraries** or **Library Search Result** page. |
| app.navigation.isNotLibraries | Current page is not a **Libraries** page. | | 1.7.0 | app.navigation.isNotLibraries | Current page is not a **Libraries** page. |
| app.navigation.isSharedFiles | User is using the **Shared Files** page. | | 1.7.0 | app.navigation.isSharedFiles | User is using the **Shared Files** page. |
| app.navigation.isNotSharedFiles | Current page is not **Shared Files**. | | 1.7.0 | app.navigation.isNotSharedFiles | Current page is not **Shared Files**. |
| app.navigation.isFavorites | User is using the **Favorites** page. | | 1.7.0 | app.navigation.isFavorites | User is using the **Favorites** page. |
| app.navigation.isNotFavorites | Current page is not **Favorites**. | | 1.7.0 | app.navigation.isNotFavorites | Current page is not **Favorites**. |
| app.navigation.isRecentFiles | User is using the **Recent Files** page. | | 1.7.0 | app.navigation.isRecentFiles | User is using the **Recent Files** page. |
| app.navigation.isNotRecentFiles | Current page is not **Recent Files**. | | 1.7.0 | app.navigation.isNotRecentFiles | Current page is not **Recent Files**. |
| app.navigation.isSearchResults | User is using the **Search Results** page. | | 1.7.0 | app.navigation.isSearchResults | User is using the **Search Results** page. |
| app.navigation.isNotSearchResults | Current page is not the **Search Results**. | | 1.7.0 | app.navigation.isNotSearchResults | Current page is not the **Search Results**. |
| app.navigation.isSharedPreview | Current page is preview **Shared Files**. | | 1.7.0 | app.navigation.isSharedPreview | Current page is preview **Shared Files**. |
| app.navigation.isFavoritesPreview | Current page is preview **Favorites**. | | 1.7.0 | app.navigation.isFavoritesPreview | Current page is preview **Favorites**. |
| app.navigation.isSharedFileViewer | Current page is shared file preview page. | | 1.7.0 | app.navigation.isSharedFileViewer | Current page is shared file preview page. |
| app.navigation.isPreview | Current page is **Preview**. | | 1.7.0 | app.navigation.isPreview | Current page is **Preview**. |
| app.navigation.isPersonalFiles | Current page is **Personal Files**. | | 1.7.0 | app.navigation.isPersonalFiles | Current page is **Personal Files**. |
| app.navigation.isLibraryFiles | Current page is **Library Files**. | | 1.7.0 | app.navigation.isLibraryFiles | Current page is **Library Files**. |
**Tip:** See the [Registration](/extending/registration) section for more details **Tip:** See the [Registration](/extending/registration) section for more details
on how to register your own entries to be re-used at runtime. on how to register your own entries to be re-used at runtime.
+2 -2
View File
@@ -161,7 +161,7 @@ Update `my-extension-dialog.component.ts`:
```ts ```ts
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material'; import { MatDialogRef } from '@angular/material/dialog';
@Component({ @Component({
selector: 'aca-my-extension-dialog', selector: 'aca-my-extension-dialog',
@@ -229,7 +229,7 @@ See also:
Update to raise a dialog Update to raise a dialog
```ts ```ts
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material/dialog';
import { MyExtensionDialogComponent } from '../../dialogs/my-extension-dialog/my-extension-dialog.component'; import { MyExtensionDialogComponent } from '../../dialogs/my-extension-dialog/my-extension-dialog.component';
@Injectable() @Injectable()
@@ -17,6 +17,12 @@ The Content Application provides support for the following languages:
- Brazilian Portuguese (`pt-BR`) - Brazilian Portuguese (`pt-BR`)
- Russian (`ru`) - Russian (`ru`)
- Simplified Chinese (`zh-CN`) - Simplified Chinese (`zh-CN`)
- Arabic (`ar`)
- Czech (`cs`)
- Danish (`da`)
- Finnish (`fi`)
- Polish (`pl`)
- Swedish (`sv`)
The default language is English, however the current browser language is taken as the default one automatically when the application starts. The default language is English, however the current browser language is taken as the default one automatically when the application starts.
+48
View File
@@ -138,6 +138,30 @@ In the `app.config.json` define a link entry which will point to the custom page
``` ```
This can also be declared using ngrx store action:
```json
{
...,
"navigation": [
"main": [ ... ],
"secondary": [ ... ],
"custom": [
{
"icon": "work",
"label": "Link",
"title": "My custom link",
"click": {
"action": "NAVIGATE_ROUTE",
"payload": "custom-route"
}
}
]
]
}
```
Map the `/custom-route` in `app.routes.ts` as a child of `LayoutComponent` definition. Map the `/custom-route` in `app.routes.ts` as a child of `LayoutComponent` definition.
```js ```js
@@ -162,4 +186,28 @@ Map the `/custom-route` in `app.routes.ts` as a child of `LayoutComponent` defin
![](../images/navigation-03.png) ![](../images/navigation-03.png)
### Rendering custom components
Navigation definition also supports custom components to be dynamically render. The schema for this is as follows:
```json
"navbar": [
{
"id": "app.navbar.primary",
"items": [
...
{
"id": "custom-component",
"component": "custom-menu-item"
}
...
]
}
]
```
Note that components must be declared as entryComponents under the app module.
For more information about the content of a custom page see [Document List Layout](/features/document-list-layout) section. For more information about the content of a custom page see [Document List Layout](/features/document-list-layout) section.
+3 -3
View File
@@ -6,9 +6,9 @@ Title: Prerequisites
This application uses the latest releases from Alfresco: 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 ADF (3.3.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) - [Alfresco Content Services (6.1)](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.1 - General Availability 201901)](https://www.alfresco.com/products/community/download)
**Note:** You also need [Node.js](https://nodejs.org/en/) (LTS) installed to build it locally from source code. **Note:** You also need [Node.js](https://nodejs.org/en/) (LTS) installed to build it locally from source code.
+2 -2
View File
@@ -36,7 +36,7 @@ Update `my-extension-dialog.component.ts`:
```ts ```ts
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material'; import { MatDialogRef } from '@angular/material/dialog';
@Component({ @Component({
selector: 'aca-my-extension-dialog', selector: 'aca-my-extension-dialog',
@@ -104,7 +104,7 @@ See also:
Update to raise a dialog Update to raise a dialog
```ts ```ts
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material/dialog';
import { MyExtensionDialogComponent } from '../../dialogs/my-extension-dialog/my-extension-dialog.component'; import { MyExtensionDialogComponent } from '../../dialogs/my-extension-dialog/my-extension-dialog.component';
@Injectable() @Injectable()
+1
View File
@@ -29,6 +29,7 @@ export * from './header/user-info';
export * from './data-table/data-table'; export * from './data-table/data-table';
export * from './dialog/confirm-dialog'; export * from './dialog/confirm-dialog';
export * from './dialog/create-edit-folder-dialog'; export * from './dialog/create-edit-folder-dialog';
export * from './dialog/password-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';
+102 -23
View File
@@ -34,16 +34,16 @@ export class DataTable extends Component {
root: 'adf-datatable', root: 'adf-datatable',
head: '.adf-datatable-header', head: '.adf-datatable-header',
columnHeader: '.adf-datatable-row .adf-datatable-table-cell-header', columnHeader: '.adf-datatable-row .adf-datatable-cell-header',
sortedColumnHeader: ` sortedColumnHeader: `
.adf-data-table__header--sorted-asc, .adf-datatable__header--sorted-asc,
.adf-data-table__header--sorted-desc .adf-datatable__header--sorted-desc
`, `,
body: '.adf-datatable-body', body: '.adf-datatable-body',
row: '.adf-datatable-row[role]', row: '.adf-datatable-row[role]',
selectedRow: '.adf-datatable-row.adf-is-selected', selectedRow: '.adf-datatable-row.adf-is-selected',
cell: '.adf-data-table-cell', cell: '.adf-datatable-cell-container',
locationLink: '.aca-location-link', locationLink: '.aca-location-link',
nameLink: '.adf-datatable-link', nameLink: '.adf-datatable-link',
libraryRole: 'adf-library-role-column', libraryRole: 'adf-library-role-column',
@@ -57,7 +57,13 @@ export class DataTable extends Component {
emptyListTitle: '.adf-empty-content__title', emptyListTitle: '.adf-empty-content__title',
emptyListSubtitle: '.adf-empty-content__subtitle', emptyListSubtitle: '.adf-empty-content__subtitle',
emptyListText: '.adf-empty-content__text' emptyListText: '.adf-empty-content__text',
emptySearchText: '.empty-search__text',
searchResultsRow: 'aca-search-results-row',
searchResultsRowLine: '.line',
searchResultsNameLink: '.link'
}; };
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head)); head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
@@ -69,6 +75,8 @@ export class DataTable extends Component {
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));
emptySearchText: ElementFinder = this.component.element(by.css(DataTable.selectors.emptySearchText));
menu: Menu = new Menu(); menu: Menu = new Menu();
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
@@ -76,12 +84,12 @@ export class DataTable extends Component {
} }
// Wait methods (waits for elements) // Wait methods (waits for elements)
waitForHeader() { async waitForHeader() {
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---'); return await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
} }
waitForBody() { async waitForBody() {
return browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---'); return await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
} }
async waitForEmptyState() { async waitForEmptyState() {
@@ -166,20 +174,28 @@ export class DataTable extends Component {
return this.body.element(by.cssContainingText(DataTable.selectors.row, name)); return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
} }
getRowCells(name: string, location: string = '') {
return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell));
}
async getRowCellsCount(itemName: string) {
return await this.getRowCells(itemName).count();
}
getRowFirstCell(name: string, location: string = '') { getRowFirstCell(name: string, location: string = '') {
return this.getRowByName(name, location).all(by.css(DataTable.selectors.cell)).get(0); return this.getRowCells(name, location).get(0);
} }
getRowNameCell(name: string) { getRowNameCell(name: string, location: string = '') {
return this.getRowByName(name).all(by.css(DataTable.selectors.cell)).get(1); return this.getRowCells(name, location).get(1);
} }
getRowNameCellText(name: string) { getRowNameCellSpan(name: string, location: string = '') {
return this.getRowNameCell(name).$('span'); return this.getRowNameCell(name, location).$('span');
} }
async getItemNameTooltip(name: string) { async getItemNameTooltip(name: string, location: string = '') {
return await this.getRowNameCellText(name).getAttribute('title'); return await this.getRowNameCellSpan(name, location).getAttribute('title');
} }
async hasCheckMarkIcon(itemName: string, location: string = '') { async hasCheckMarkIcon(itemName: string, location: string = '') {
@@ -214,19 +230,21 @@ export class DataTable extends Component {
} }
// Navigation/selection methods // Navigation/selection methods
async doubleClickOnRowByName(name: string) { async doubleClickOnRowByName(name: string, location: string = '') {
try { try {
const item = this.getRowFirstCell(name); const item = this.getRowFirstCell(name, location);
await Utils.waitUntilElementClickable(item); await Utils.waitUntilElementClickable(item);
await browser.actions().mouseMove(item).perform(); await browser.actions().mouseMove(item).perform();
await browser.actions().click().click().perform(); await browser.actions().doubleClick().perform();
} catch (error) { } catch (error) {
console.log('--- catch: doubleClickOnRowByName', error); console.log('--- catch: doubleClickOnRowByName', error);
} }
} }
async selectItem(name: string, location: string = '') { async selectItem(name: string, location: string = '') {
try{ const isSelected = await this.hasCheckMarkIcon(name, location);
if (!isSelected) {
try {
const item = this.getRowFirstCell(name, location); const item = this.getRowFirstCell(name, location);
await item.click(); await item.click();
@@ -235,6 +253,13 @@ export class DataTable extends Component {
} }
} }
}
async clickItem(name: string, location: string = '') {
const item = this.getRowFirstCell(name, location);
await item.click();
}
async clickNameLink(itemName: string) { async clickNameLink(itemName: string) {
await this.getNameLink(itemName).click(); await this.getNameLink(itemName).click();
} }
@@ -262,13 +287,14 @@ export class DataTable extends Component {
async rightClickOnItem(itemName: string) { async rightClickOnItem(itemName: string) {
const item = this.getRowFirstCell(itemName); const item = this.getRowFirstCell(itemName);
await browser.actions().click(item, protractor.Button.RIGHT).perform(); await browser.actions().mouseMove(item).perform();
await browser.actions().click(protractor.Button.RIGHT).perform();
} }
async rightClickOnMultipleSelection() { async rightClickOnMultipleSelection() {
await this.wait();
const itemFromSelection = this.getSelectedRows().get(0); const itemFromSelection = this.getSelectedRows().get(0);
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform(); await browser.actions().mouseMove(itemFromSelection).perform();
await browser.actions().click(protractor.Button.RIGHT).perform();
} }
getItemLocationEl(name: string) { getItemLocationEl(name: string) {
@@ -330,6 +356,10 @@ export class DataTable extends Component {
} }
} }
async getEmptySearchResultsText() {
return await this.emptySearchText.getText();
}
async getCellsContainingName(name: string) { async getCellsContainingName(name: string) {
const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
return rows.map(async cell => await cell.getText()); return rows.map(async cell => await cell.getText());
@@ -370,4 +400,53 @@ export class DataTable extends Component {
}, {}); }, {});
} }
getSearchResultsRowByName(name: string, location: string = '') {
if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
.filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
.first();
}
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
}
getSearchResultRowLines(name: string, location: string = '') {
return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine));
}
async getSearchResultLinesCount(name: string, location: string = '') {
return await this.getSearchResultRowLines(name, location).count();
}
getSearchResultNthLine(name: string, location: string = '', index: number) {
return this.getSearchResultRowLines(name, location).get(index);
}
async getSearchResultNameAndTitle(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 0).getText();
}
async getSearchResultDescription(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 1).getText();
}
async getSearchResultModified(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 2).getText();
}
async getSearchResultLocation(name: string, location: string = '') {
return await this.getSearchResultNthLine(name, location, 3).getText();
}
getSearchResultNameLink(itemName: string, location: string = '') {
return this.getSearchResultsRowByName(itemName, location).$(DataTable.selectors.searchResultsNameLink);
}
async hasLinkOnSearchResultName(itemName: string, location: string = '') {
return await this.getSearchResultNameLink(itemName, location).isPresent();
}
async clickSearchResultNameLink(itemName: string, location: string = '') {
await this.getSearchResultNameLink(itemName, location).click();
}
} }
+1 -1
View File
@@ -109,7 +109,7 @@ export class ConfirmDialog extends Component {
} }
async clickCancel() { async clickCancel() {
return await this.clickButton('Cancel'); return await this.cancelButton.click();
} }
async clickKeep() { async clickKeep() {
+109
View File
@@ -0,0 +1,109 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser, ExpectedConditions as EC, until } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
export class PasswordDialog extends Component {
private static selectors = {
root: 'adf-pdf-viewer-password-dialog',
title: '.mat-dialog-title',
content: '.mat-dialog-content',
passwordInput: 'input[type="Password"]',
actionButtons: '.mat-dialog-actions',
errorMessage: '.mat-error'
};
title: ElementFinder = this.component.element(by.css(PasswordDialog.selectors.title));
content: ElementFinder = this.component.element(by.css(PasswordDialog.selectors.content));
passwordInput: ElementFinder = this.component.element(by.css(PasswordDialog.selectors.passwordInput));
errorMessage: ElementFinder = this.component.element(by.css(PasswordDialog.selectors.errorMessage));
closeButton: ElementFinder = this.component.element(by.buttonText('Close'));
submitButton: ElementFinder = this.component.element(by.buttonText('Submit'));
constructor(ancestor?: ElementFinder) {
super(PasswordDialog.selectors.root, ancestor);
}
async waitForDialogToClose() {
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(PasswordDialog.selectors.root));
}
async getTitle() {
return await this.title.getText();
}
async isCloseEnabled() {
return await this.closeButton.isEnabled();
}
async isSubmitEnabled() {
return await this.submitButton.isEnabled();
}
async clickClose() {
return await this.closeButton.click();
}
async clickSubmit() {
return await this.submitButton.click();
}
async isPasswordInputDisplayed() {
const present = await browser.isElementPresent(this.passwordInput);
if (present) {
return await this.passwordInput.isDisplayed();
} else {
return false;
}
}
async isErrorDisplayed() {
const elem = await browser.wait(until.elementLocated(by.css(PasswordDialog.selectors.errorMessage)), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for error message to appear')
return await browser.isElementPresent(elem);
}
async getErrorMessage() {
if (await this.isErrorDisplayed()) {
return await this.errorMessage.getText();
}
return '';
}
async enterPassword(password: string) {
await this.passwordInput.clear();
await this.passwordInput.sendKeys(password);
}
}
+140
View File
@@ -0,0 +1,140 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, until } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
export class CommentsTab extends Component {
private static selectors = {
root: 'adf-comments',
commentsContainer: '.adf-comments-container',
commentsHeader: '.adf-comments-header',
commentsTextArea: '.adf-comments-input-container textarea',
addCommentButton: 'button.adf-comments-input-add',
commentsList: '.adf-comment-list',
commentsListItem: '.adf-comment-list-item',
commentById: `adf-comment-`,
commentUserName: 'comment-user',
commentUserAvatar: 'comment-user-icon',
commentMessage: 'comment-message',
commentTime: 'comment-time'
};
commentsContainer: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsContainer));
commentsHeader: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsHeader));
commentTextarea: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsTextArea));
addCommentButton: ElementFinder = this.component.element(by.css(CommentsTab.selectors.addCommentButton));
commentsList: ElementArrayFinder = this.component.all(by.css(CommentsTab.selectors.commentsListItem));
commentListItem = by.css(CommentsTab.selectors.commentsListItem);
commentUserAvatar = by.id(CommentsTab.selectors.commentUserAvatar);
commentUser = by.id(CommentsTab.selectors.commentUserName)
commentText = by.id(CommentsTab.selectors.commentMessage);
commentTime = by.id(CommentsTab.selectors.commentTime);
constructor(ancestor?: ElementFinder) {
super(CommentsTab.selectors.root, ancestor);
}
async waitForCommentsContainer() {
await browser.wait(EC.visibilityOf(this.commentsContainer), BROWSER_WAIT_TIMEOUT);
}
async getCommentsTabHeaderText() {
return await this.commentsHeader.getText();
}
async isCommentTextAreaDisplayed() {
return await browser.isElementPresent(this.commentTextarea);
}
async isAddCommentButtonEnabled() {
const present = await browser.isElementPresent(this.addCommentButton);
if (present) {
return await this.addCommentButton.isEnabled();
}
return false;
}
async getCommentListItem() {
return await browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2);
}
async getCommentById(commentId?: string) {
if (commentId) {
return await browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
}
return await this.getCommentListItem();
}
async isCommentDisplayed(commentId?: string) {
return await browser.isElementPresent(await this.getCommentById(commentId));
}
async isCommentUserAvatarDisplayed(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
return await browser.isElementPresent(commentElement.findElement(this.commentUserAvatar));
}
async getCommentText(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
const message = await commentElement.findElement(this.commentText);
return await message.getText();
}
async getCommentUserName(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
const user = await commentElement.findElement(this.commentUser);
return await user.getText();
}
async getCommentTime(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
const time = await commentElement.findElement(this.commentTime);
return await time.getText();
}
async getNthCommentId(index: number) {
return await this.commentsList.get(index - 1).getAttribute('id');
}
async typeComment(text: string) {
return await this.commentTextarea.sendKeys(text);
}
async clickAddButton() {
return await this.addCommentButton.click();
}
async getCommentTextFromTextArea() {
return await this.commentTextarea.getAttribute('value');
}
}
+125
View File
@@ -0,0 +1,125 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
export class ContentMetadata extends Component {
private static selectors = {
root: 'adf-content-metadata-card',
expandedPanel: '.mat-expansion-panel.mat-expanded',
propertyList: '.adf-property-list',
property: '.adf-property',
propertyLabel: '.adf-property-label',
propertyValue: '.adf-property-value',
editProperties: `button[title='Edit']`,
editProperty: `.mat-icon[title='Edit']`,
editDateItem: `.adf-dateitem-editable`,
moreLessInformation: `[data-automation-id='meta-data-card-toggle-expand']`
};
expandedPanel: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.expandedPanel));
propertyList: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyList));
propertyListElements: ElementArrayFinder = this.component.all(by.css(ContentMetadata.selectors.property));
propertyValue: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyValue));
editPropertiesButton: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.editProperties));
lessInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'Less information'));
moreInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'More information'));
imagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`));
expandedImagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`));
constructor(ancestor?: ElementFinder) {
super(ContentMetadata.selectors.root, ancestor);
}
async isPropertiesListExpanded() {
return await browser.isElementPresent(this.expandedPanel);
}
async waitForImagePropertiesPanelToExpand() {
return await browser.wait(EC.visibilityOf(this.expandedImagePropertiesPanel), BROWSER_WAIT_TIMEOUT);
}
async getVisiblePropertiesLabels() {
return await this.component.all(by.css(ContentMetadata.selectors.propertyLabel))
.filter(async (elem) => await elem.isDisplayed())
.map(async (elem) => await elem.getText());
}
async getVisiblePropertiesValues() {
return await this.component.all(by.css(ContentMetadata.selectors.propertyValue))
.filter(async (elem) => await elem.isDisplayed())
.map(async (elem) => {
if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) {
return true;
}
return false
}
return await elem.getText();
});
}
async isEditPropertiesButtonEnabled() {
return (await browser.isElementPresent(this.editPropertiesButton)) && (await this.editPropertiesButton.isEnabled());
}
async isLessInfoButtonEnabled() {
return (await browser.isElementPresent(this.lessInfoButton)) && (await this.lessInfoButton.isEnabled());
}
async isMoreInfoButtonEnabled() {
return (await browser.isElementPresent(this.moreInfoButton)) && (await this.moreInfoButton.isEnabled());
}
async isLessInfoButtonDisplayed() {
return await browser.isElementPresent(this.lessInfoButton);
}
async isMoreInfoButtonDisplayed() {
return await browser.isElementPresent(this.moreInfoButton);
}
async clickLessInformationButton() {
return await this.lessInfoButton.click();
}
async clickMoreInformationButton() {
return await this.moreInfoButton.click();
}
async isImagePropertiesPanelDisplayed() {
return (await browser.isElementPresent(this.imagePropertiesPanel)) && (await this.imagePropertiesPanel.isDisplayed());
}
async clickImagePropertiesPanel() {
return await this.imagePropertiesPanel.click();
}
}
+254
View File
@@ -0,0 +1,254 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
export class LibraryMetadata extends Component {
private static selectors = {
root: 'app-library-metadata-form',
metadataTabContent: '.mat-card-content',
metadataTabAction: '.mat-card-actions .mat-button',
field: '.mat-form-field',
fieldLabelWrapper: '.mat-form-field-label-wrapper',
fieldInput: '.mat-input-element',
dropDown: '.mat-select',
visibilityOption: '.mat-option .mat-option-text',
hint: '.mat-hint',
error: '.mat-error'
};
metadataTabContent: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabContent));
metadataTabAction: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabAction));
fieldLabelWrapper: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldLabelWrapper));
fieldInput: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldInput));
visibilityDropDown: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.dropDown));
visibilityPublic: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Public'));
visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Private'));
visibilityModerated: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Moderated'));
hint: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.hint));
error: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.error));
constructor(ancestor?: ElementFinder) {
super(LibraryMetadata.selectors.root, ancestor);
}
getLabelWrapper(label: string) {
return this.component.element(by.cssContainingText(LibraryMetadata.selectors.fieldLabelWrapper, label));
}
getFieldByName(fieldName: string) {
const wrapper = this.getLabelWrapper(fieldName);
return wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.fieldInput));
}
async isFieldDisplayed(fieldName: string) {
return await browser.isElementPresent(this.getFieldByName(fieldName));
}
async isInputEnabled(fieldName: string) {
return this.getFieldByName(fieldName).isEnabled();
}
async getValueOfField(fieldName: string) {
return await this.getFieldByName(fieldName).getText();
}
async enterTextInInput(fieldName: string, text: string) {
const input = this.getFieldByName(fieldName);
await input.clear();
return await input.sendKeys(text);
}
getButton(button: string) {
return this.component.element(by.cssContainingText(LibraryMetadata.selectors.metadataTabAction, button));
}
async isButtonDisplayed(button: string) {
return browser.isElementPresent(this.getButton(button));
}
async isButtonEnabled(button: string) {
return await this.getButton(button).isEnabled();
}
async clickButton(button: string) {
return await this.getButton(button).click();
}
async waitForVisibilityDropDownToOpen() {
await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT);
}
async waitForVisibilityDropDownToClose() {
await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT);
}
async isMessageDisplayed() {
return await browser.isElementPresent(this.hint);
}
async getMessage() {
return await this.hint.getText();
}
async isErrorDisplayed() {
return await browser.isElementPresent(this.error);
}
async getError() {
return await this.error.getText();
}
async isNameDisplayed() {
return await this.isFieldDisplayed('Name');
}
async isNameEnabled() {
return await this.isInputEnabled('Name');
}
async getName() {
return await this.getValueOfField('Name');
}
async enterName(name: string) {
return await this.enterTextInInput('Name', name);
}
async isDescriptionDisplayed() {
return await this.isFieldDisplayed('Description');
}
async isDescriptionEnabled() {
return await this.isInputEnabled('Description');
}
async getDescription() {
return await this.getValueOfField('Description');
}
async enterDescription(desc: string) {
return await this.enterTextInInput('Description', desc);
}
async isVisibilityEnabled() {
const wrapper = this.getLabelWrapper('Visibility');
const field = wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.dropDown));
return await field.isEnabled();
}
async isVisibilityDisplayed() {
return await this.isFieldDisplayed('Visibility');
}
async getVisibility() {
return await this.getValueOfField('Visibility');
}
async setVisibility(visibility: string) {
const val = visibility.toLowerCase();
await this.visibilityDropDown.click();
await this.waitForVisibilityDropDownToOpen();
if (val === 'public') {
await this.visibilityPublic.click();
} else if (val === 'private') {
await this.visibilityPrivate.click();
} else if (val === 'moderated') {
await this.visibilityModerated.click();
} else {
console.log('----- invalid visibility', val);
}
await this.waitForVisibilityDropDownToClose();
}
async isLibraryIdDisplayed() {
return await this.isFieldDisplayed('Library ID');
}
async isLibraryIdEnabled() {
return await this.isInputEnabled('Library ID');
}
async getLibraryId() {
return await this.getValueOfField('Library ID');
}
async isEditLibraryPropertiesEnabled() {
return await this.isButtonEnabled('Edit');
}
async isEditLibraryPropertiesDisplayed() {
return await this.isButtonDisplayed('Edit');
}
async clickEditLibraryProperties() {
return await this.clickButton('Edit');
}
async isUpdateEnabled() {
return await this.isButtonEnabled('Update');
}
async isUpdateDisplayed() {
return await this.isButtonDisplayed('Update');
}
async clickUpdate() {
return await this.clickButton('Update');
}
async isCancelEnabled() {
return await this.isButtonEnabled('Cancel');
}
async isCancelDisplayed() {
return await this.isButtonDisplayed('Cancel');
}
async clickCancel() {
return await this.clickButton('Cancel');
}
}
+19 -330
View File
@@ -23,13 +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 { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, until } 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';
import { CommentsTab } from './info-drawer-comments-tab';
import { LibraryMetadata } from './info-drawer-metadata-library';
import { ContentMetadata } from './info-drawer-metadata-content';
export class InfoDrawer extends Component { export class InfoDrawer extends Component {
private static selectors = { private static selectors = {
root: 'aca-info-drawer', root: 'adf-info-drawer',
header: '.adf-info-drawer-layout-header', header: '.adf-info-drawer-layout-header',
content: '.adf-info-drawer-layout-content', content: '.adf-info-drawer-layout-content',
@@ -42,34 +45,13 @@ export class InfoDrawer extends Component {
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron', next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron', previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron',
headerTitle: '.adf-info-drawer-layout-header-title', headerTitle: '.adf-info-drawer-layout-header-title'
// comments tab
commentsContainer: '.adf-comments-container',
commentsHeader: '.adf-comments-header',
commentsTextArea: '.adf-comments-input-container textarea',
addCommentButton: 'button.adf-comments-input-add',
commentsList: '.adf-comment-list',
commentsListItem: '.adf-comment-list-item',
commentById: `adf-comment-`,
commentUserName: 'comment-user',
commentUserAvatar: 'comment-user-icon',
commentMessage: 'comment-message',
commentTime: 'comment-time',
// metadata card
metadataTabContent: '.app-metadata-tab .mat-card-content',
metadataTabAction: '.app-metadata-tab .mat-card-actions .mat-button',
field: '.mat-form-field',
fieldLabelWrapper: '.mat-form-field-label-wrapper',
fieldInput: '.mat-input-element',
dropDown: '.mat-select',
visibilityOption: '.mat-option .mat-option-text',
hint: '.mat-hint',
error: '.mat-error'
}; };
commentsTab = new CommentsTab($(InfoDrawer.selectors.root));
aboutTab = new LibraryMetadata($(InfoDrawer.selectors.root));
propertiesTab = new ContentMetadata($(InfoDrawer.selectors.root));
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header)); header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle)); headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle));
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel)); tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
@@ -78,40 +60,14 @@ export class InfoDrawer extends Component {
tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent)); tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent));
commentsContainer: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.commentsContainer));
commentsHeader: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.commentsHeader));
commentTextarea: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.commentsTextArea));
addCommentButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.addCommentButton));
commentsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.commentsListItem));
commentListItem = by.css(InfoDrawer.selectors.commentsListItem);
commentUserAvatar = by.id(InfoDrawer.selectors.commentUserAvatar);
commentUser = by.id(InfoDrawer.selectors.commentUserName)
commentText = by.id(InfoDrawer.selectors.commentMessage);
commentTime = by.id(InfoDrawer.selectors.commentTime);
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next)); nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous)); previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
metadataTabContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.metadataTabContent));
metadataTabAction: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.metadataTabAction));
fieldLabelWrapper: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.fieldLabelWrapper));
fieldInput: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.fieldInput));
visibilityDropDown: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.dropDown));
visibilityPublic: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Public'));
visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Private'));
visibilityModerated: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Moderated'));
hint: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.hint));
error: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.error));
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(InfoDrawer.selectors.root, ancestor); super(InfoDrawer.selectors.root, ancestor);
} }
async waitForInfoDrawerToOpen() { async waitForInfoDrawerToOpen() {
return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT); return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
} }
@@ -124,10 +80,6 @@ export class InfoDrawer extends Component {
return !(await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))); return !(await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs)));
} }
async waitForCommentsTabContainer() {
await browser.wait(EC.visibilityOf(this.commentsContainer), BROWSER_WAIT_TIMEOUT);
}
getTabByTitle(title: string) { getTabByTitle(title: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title)); return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title));
} }
@@ -166,60 +118,6 @@ export class InfoDrawer extends Component {
return await this.headerTitle.getText(); return await this.headerTitle.getText();
} }
getLabelWrapper(label: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.fieldLabelWrapper, label));
}
getFieldByName(fieldName: string) {
const wrapper = this.getLabelWrapper(fieldName);
return wrapper.element(by.xpath('..')).element(by.css(InfoDrawer.selectors.fieldInput));
}
async isFieldDisplayed(fieldName: string) {
return await browser.isElementPresent(this.getFieldByName(fieldName));
}
async isInputEnabled(fieldName: string) {
return this.getFieldByName(fieldName).isEnabled();
}
async getValueOfField(fieldName: string) {
return await this.getFieldByName(fieldName).getText();
}
async enterTextInInput(fieldName: string, text: string) {
const input = this.getFieldByName(fieldName);
await input.clear();
return await input.sendKeys(text);
}
getButton(button: string) {
return this.component.element(by.cssContainingText(InfoDrawer.selectors.metadataTabAction, button));
}
async isButtonDisplayed(button: string) {
return browser.isElementPresent(this.getButton(button));
}
async isButtonEnabled(button: string) {
return await this.getButton(button).isEnabled();
}
async clickButton(button: string) {
return await this.getButton(button).click();
}
async waitForVisibilityDropDownToOpen() {
await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT);
}
async waitForVisibilityDropDownToClose() {
await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT);
}
// ---------------
async isAboutTabDisplayed() { async isAboutTabDisplayed() {
return await this.isTabDisplayed('About'); return await this.isTabDisplayed('About');
} }
@@ -228,236 +126,27 @@ export class InfoDrawer extends Component {
return await this.isTabDisplayed('Properties'); return await this.isTabDisplayed('Properties');
} }
async isPropertiesTabActive() {
return (await this.getActiveTabTitle()) === 'PROPERTIES';
}
async isCommentsTabDisplayed() { async isCommentsTabDisplayed() {
return await this.isTabDisplayed('Comments'); return await this.isTabDisplayed('Comments');
} }
async clickCommentsTab() { async clickCommentsTab() {
try { try {
await this.getTabByTitle('Comments').click(); await this.getTabByTitle('Comments').click();
await this.waitForCommentsTabContainer(); await this.commentsTab.waitForCommentsContainer();
await browser.wait(EC.visibilityOf(this.addCommentButton), BROWSER_WAIT_TIMEOUT); await Promise.all([
browser.wait(EC.visibilityOf(this.commentsTab.component), BROWSER_WAIT_TIMEOUT),
browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT)
]);
} catch (error) { } catch (error) {
console.error('--- catch error on clickCommentsTab ---'); console.error('--- catch error on clickCommentsTab ---');
throw error; throw error;
} }
} }
async clickAboutTab() {
try {
return await this.getTabByTitle('About').click();
} catch (error) {
console.error('--- catch error on clickAboutTab ---');
}
}
async isMessageDisplayed() {
return await browser.isElementPresent(this.hint);
}
async getMessage() {
return await this.hint.getText();
}
async isErrorDisplayed() {
return await browser.isElementPresent(this.error);
}
async getError() {
return await this.error.getText();
}
async isNameDisplayed() {
return await this.isFieldDisplayed('Name');
}
async isNameEnabled() {
return await this.isInputEnabled('Name');
}
async getName() {
return await this.getValueOfField('Name');
}
async enterName(name: string) {
return await this.enterTextInInput('Name', name);
}
async isDescriptionDisplayed() {
return await this.isFieldDisplayed('Description');
}
async isDescriptionEnabled() {
return await this.isInputEnabled('Description');
}
async getDescription() {
return await this.getValueOfField('Description');
}
async enterDescription(desc: string) {
return await this.enterTextInInput('Description', desc);
}
async isVisibilityEnabled() {
const wrapper = this.getLabelWrapper('Visibility');
const field = wrapper.element(by.xpath('..')).element(by.css(InfoDrawer.selectors.dropDown));
return await field.isEnabled();
}
async isVisibilityDisplayed() {
return await this.isFieldDisplayed('Visibility');
}
async getVisibility() {
return await this.getValueOfField('Visibility');
}
async setVisibility(visibility: string) {
const val = visibility.toLowerCase();
await this.visibilityDropDown.click();
await this.waitForVisibilityDropDownToOpen();
if (val === 'public') {
await this.visibilityPublic.click();
} else if (val === 'private') {
await this.visibilityPrivate.click();
} else if (val === 'moderated') {
await this.visibilityModerated.click();
} else {
console.log('----- invalid visibility', val);
}
await this.waitForVisibilityDropDownToClose();
}
async isLibraryIdDisplayed() {
return await this.isFieldDisplayed('Library ID');
}
async isLibraryIdEnabled() {
return await this.isInputEnabled('Library ID');
}
async getLibraryId() {
return await this.getValueOfField('Library ID');
}
async isEditEnabled() {
return await this.isButtonEnabled('Edit');
}
async isEditDisplayed() {
return await this.isButtonDisplayed('Edit');
}
async clickEdit() {
return await this.clickButton('Edit');
}
async isUpdateEnabled() {
return await this.isButtonEnabled('Update');
}
async isUpdateDisplayed() {
return await this.isButtonDisplayed('Update');
}
async clickUpdate() {
return await this.clickButton('Update');
}
async isCancelEnabled() {
return await this.isButtonEnabled('Cancel');
}
async isCancelDisplayed() {
return await this.isButtonDisplayed('Cancel');
}
async clickCancel() {
return await this.clickButton('Cancel');
}
async getCommentsTabHeaderText() {
return await this.commentsHeader.getText();
}
async isCommentTextAreaDisplayed() {
return await browser.isElementPresent(this.commentTextarea);
}
async isAddCommentButtonEnabled() {
const present = await browser.isElementPresent(this.addCommentButton);
if (present) {
return await this.addCommentButton.isEnabled();
}
return false;
}
async getCommentListItem() {
return await browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2);
}
async getCommentById(commentId?: string) {
if (commentId) {
return await browser.wait(until.elementLocated(by.id(`${InfoDrawer.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
}
return await this.getCommentListItem();
}
async isCommentDisplayed(commentId?: string) {
return await browser.isElementPresent(await this.getCommentById(commentId));
}
async isCommentUserAvatarDisplayed(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
return await browser.isElementPresent(commentElement.findElement(this.commentUserAvatar));
}
async getCommentText(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
const message = await commentElement.findElement(this.commentText);
return await message.getText();
}
async getCommentUserName(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
const user = await commentElement.findElement(this.commentUser);
return await user.getText();
}
async getCommentTime(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
const time = await commentElement.findElement(this.commentTime);
return await time.getText();
}
async getNthCommentId(index: number) {
return await this.commentsList.get(index - 1).getAttribute('id');
}
async typeComment(text: string) {
return await this.commentTextarea.sendKeys(text);
}
async clickAddButton() {
return await this.addCommentButton.click();
}
async getCommentTextFromTextArea() {
return await this.commentTextarea.getAttribute('value');
}
} }
+2 -2
View File
@@ -68,8 +68,8 @@ export class LoginComponent extends Component {
await this.enterPassword(password); await this.enterPassword(password);
} }
submit() { async submit() {
return this.submitButton.click(); await this.submitButton.click();
} }
async clickPasswordVisibility() { async clickPasswordVisibility() {
+30 -18
View File
@@ -40,8 +40,8 @@ export class Menu extends Component {
editFolder: `.mat-menu-item[id$='editFolder']`, editFolder: `.mat-menu-item[id$='editFolder']`,
favoriteAction: `.mat-menu-item[id$='favorite.add']`, favoriteAction: `.mat-menu-item[id$='favorite.add']`,
removeFavoriteAction: `.mat-menu-item[id$='favorite.remove']`, removeFavoriteAction: `.mat-menu-item[id$='favorite.remove']`,
editOffline: `.mat-menu-item[title='Edit offline']`, editOffline: `.mat-menu-item[title='Edit Offline']`,
cancelEditing: `.mat-menu-item[title='Cancel editing']` cancelEditing: `.mat-menu-item[title='Cancel Editing']`
}; };
items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item)); items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
@@ -50,9 +50,9 @@ export class Menu extends Component {
submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu)); submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu));
cancelEditingAction: ElementFinder = this.component.element(by.css(Menu.selectors.cancelEditing)); cancelEditingAction: ElementFinder = this.component.element(by.css(Menu.selectors.cancelEditing));
cancelJoinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Cancel join')); cancelJoinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Cancel Join'));
copyAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Copy')); copyAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Copy'));
createFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create folder')); createFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create Folder'));
createLibraryAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create Library')); createLibraryAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create Library'));
deleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Delete')); deleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Delete'));
downloadAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Download')); downloadAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Download'));
@@ -61,38 +61,38 @@ export class Menu extends Component {
favoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.favoriteAction)); favoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.favoriteAction));
removeFavoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.removeFavoriteAction)); removeFavoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.removeFavoriteAction));
toggleFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Favorite')); toggleFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Favorite'));
toggleRemoveFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Remove favorite')); toggleRemoveFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Remove Favorite'));
joinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Join')); joinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Join'));
leaveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Leave')); leaveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Leave'));
managePermissionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permissions')); managePermissionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permissions'));
manageVersionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Manage Versions')); manageVersionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Manage Versions'));
uploadNewVersionAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload new version')); uploadNewVersionAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload New Version'));
moveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Move')); moveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Move'));
permanentDeleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permanently delete')); permanentDeleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permanently Delete'));
restoreAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Restore')); restoreAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Restore'));
shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Share')); shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Share'));
shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Shared link settings')); shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Shared Link Settings'));
uploadFileAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload file')); uploadFileAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload File'));
uploadFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload folder')); uploadFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload Folder'));
viewAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View')); viewAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View'));
viewDetailsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View details')); viewDetailsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View Details'));
constructor(ancestor?: ElementFinder) { constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor); super(Menu.selectors.root, ancestor);
} }
async waitForMenuToOpen() { async waitForMenuToOpen() {
await 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-container .mat-menu-panel'))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT);
} }
async waitForMenuToClose() { async waitForMenuToClose() {
await 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('.cdk-overlay-container .mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
} }
async closeMenu() { async closeMenu() {
return Utils.pressEscape(); await Utils.pressEscape();
await this.waitForMenuToClose();
} }
getNthItem(nth: number) { getNthItem(nth: number) {
@@ -127,17 +127,29 @@ export class Menu extends Component {
return await this.items.count(); return await this.items.count();
} }
async getMenuItems(): Promise<string[]> {
return this.items.map(async (elem) => {
const text = await elem.element(by.css('span')).getText();
return text;
});
}
async clickNthItem(nth: number) { async clickNthItem(nth: number) {
try {
const elem = this.getNthItem(nth); const elem = this.getNthItem(nth);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable');
await browser.actions().mouseMove(elem).click().perform(); await browser.actions().mouseMove(elem).perform();
await browser.actions().click().perform();
await this.waitForMenuToClose(); await this.waitForMenuToClose();
} catch (e) {
console.log('____ click nth menu item catch ___', e);
}
} }
async clickMenuItem(menuItem: string) { async clickMenuItem(menuItem: string) {
try { try {
const elem = this.getItemByLabel(menuItem); const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable');
await elem.click(); await elem.click();
} catch (e) { } catch (e) {
console.log('___click menu item catch___', e); console.log('___click menu item catch___', e);
+23 -4
View File
@@ -23,10 +23,11 @@
* 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, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { browser } from 'protractor';
export class Pagination extends Component { export class Pagination extends Component {
private static selectors = { private static selectors = {
root: 'adf-pagination', root: 'adf-pagination',
@@ -59,27 +60,45 @@ export class Pagination extends Component {
async openMaxItemsMenu() { async openMaxItemsMenu() {
const { menu, maxItemsButton } = this; const { menu, maxItemsButton } = this;
try {
await browser.wait(EC.elementToBeClickable(maxItemsButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for maxItemsButton to be clickable');
await maxItemsButton.click(); await maxItemsButton.click();
await menu.waitForMenuToOpen(); await menu.waitForMenuToOpen();
} catch (error) {
console.log('____ open max items catch ___', error);
}
} }
async openCurrentPageMenu() { async openCurrentPageMenu() {
const { menu, pagesButton } = this; const { menu, pagesButton } = this;
try {
await browser.wait(EC.elementToBeClickable(pagesButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for pagesButton to be clickable');
await pagesButton.click(); await pagesButton.click();
await menu.waitForMenuToOpen(); await menu.waitForMenuToOpen();
} catch (error) {
console.log('____ open current page menu ___', error);
}
} }
async resetToDefaultPageSize() { async resetToDefaultPageSize() {
try {
await this.openMaxItemsMenu(); await this.openMaxItemsMenu();
await this.menu.clickMenuItem('25'); await this.menu.clickNthItem(1);
await this.menu.waitForMenuToClose(); await this.menu.waitForMenuToClose();
} catch (error) {
console.log('___ reset to default page size catch ___', error);
}
} }
async resetToDefaultPageNumber() { async resetToDefaultPageNumber() {
try {
await this.openCurrentPageMenu(); await this.openCurrentPageMenu();
await this.menu.clickMenuItem('1'); await this.menu.clickNthItem(1);
await this.menu.waitForMenuToClose(); await this.menu.waitForMenuToClose();
} catch (error) {
console.log('____ reset to default page number catch ___', error);
}
} }
async clickNext() { async clickNext() {
-5
View File
@@ -167,9 +167,4 @@ export class SearchInput extends Component {
await this.searchBar.sendKeys(text); await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER); await this.searchBar.sendKeys(protractor.Key.ENTER);
} }
async searchForTextAndCloseSearchOptions(text: string) {
await this.searchFor(text);
await Utils.pressEscape();
}
} }
+7 -6
View File
@@ -32,13 +32,14 @@ import { Utils } from '../../utilities/utils';
export class Sidenav extends Component { export class Sidenav extends Component {
private static selectors = { private static selectors = {
root: 'app-sidenav', root: 'app-sidenav',
link: '.menu__item', link: '.item',
label: '.item--label', label: '.action-button__label',
expansion_panel: ".mat-expansion-panel-header", expansion_panel: ".mat-expansion-panel-header",
expansion_panel_content: ".mat-expansion-panel-body", expansion_panel_content: ".mat-expansion-panel-body",
active: 'mat-accent', active: 'mat-accent',
activeClass: '.item--active', activeClass: '.action-button--active',
activeChild: 'item--active', activeClassName: 'action-button--active',
activeChild: 'action-button--active',
newButton: '[data-automation-id="create-button"]', newButton: '[data-automation-id="create-button"]',
@@ -97,7 +98,7 @@ export class Sidenav extends Component {
async openCreateFolderDialog() { async openCreateFolderDialog() {
await this.openNewMenu(); await this.openNewMenu();
await this.menu.clickMenuItem('Create folder'); await this.menu.clickMenuItem('Create Folder');
} }
async openCreateLibraryDialog() { async openCreateLibraryDialog() {
@@ -106,7 +107,7 @@ export class Sidenav extends Component {
} }
async isActive(name: string) { async isActive(name: string) {
return await this.getLinkLabel(name).isElementPresent(by.css(Sidenav.selectors.activeClass)); return (await this.getLinkLabel(name).getAttribute('class')).includes(Sidenav.selectors.activeClassName);
} }
async childIsActive(name: string) { async childIsActive(name: string) {
+16 -10
View File
@@ -34,17 +34,17 @@ export class Toolbar extends Component {
button: 'button', button: 'button',
share: `.mat-icon-button[title='Share']`, share: `.mat-icon-button[title='Share']`,
shareEdit: `.mat-icon-button[title='Shared link settings']`, shareEdit: `.mat-icon-button[title='Shared Link Settings']`,
view: `.mat-icon-button[title='View']`, view: `.mat-icon-button[title='View']`,
searchFilterToggle: `.mat-icon-button[title='Toggle search filter']`, searchFilterToggle: `.mat-icon-button[title='Toggle search filter']`,
download: `.mat-icon-button[title='Download']`, download: `.mat-icon-button[title='Download']`,
editFolder: 'app.toolbar.editFolder', editFolder: 'app.toolbar.editFolder',
viewDetails: `.mat-icon-button[title='View details']`, viewDetails: `.mat-icon-button[title='View Details']`,
print: `.mat-icon-button[title='Print']`, print: `.mat-icon-button[title='Print']`,
fullScreen: `.mat-icon-button[title='Activate full-screen mode']`, fullScreen: `.mat-icon-button[title='Activate full-screen mode']`,
joinLibrary: `.mat-icon-button[title='Join']`, joinLibrary: `.mat-icon-button[title='Join']`,
leaveLibrary: `.mat-icon-button[title='Leave library']`, leaveLibrary: `.mat-icon-button[title='Leave Library']`,
permanentlyDelete: `.mat-icon-button[title='Permanently delete']`, permanentlyDelete: `.mat-icon-button[title='Permanently Delete']`,
restore: `.mat-icon-button[title='Restore']` restore: `.mat-icon-button[title='Restore']`
}; };
@@ -77,6 +77,12 @@ export class Toolbar extends Component {
return await this.buttons.count(); return await this.buttons.count();
} }
async getButtons(): Promise<string[]> {
return this.buttons.map(async elem => {
return await elem.getAttribute('title');
});
}
async isButtonPresent(title: string) { async isButtonPresent(title: string) {
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)); const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
return await elem.isPresent(); return await elem.isPresent();
@@ -95,8 +101,8 @@ export class Toolbar extends Component {
} }
async openMoreMenu() { async openMoreMenu() {
await this.isButtonPresent('More actions'); await this.isButtonPresent('More Actions');
const moreMenu = this.getButtonByTitleAttribute('More actions'); const moreMenu = this.getButtonByTitleAttribute('More Actions');
await moreMenu.click(); await moreMenu.click();
await this.menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();
} }
@@ -209,7 +215,7 @@ export class Toolbar extends Component {
async clickMoreActionsRemoveFavorite() { async clickMoreActionsRemoveFavorite() {
await this.openMoreMenu(); await this.openMoreMenu();
return await this.menu.clickMenuItem('Remove favorite'); return await this.menu.clickMenuItem('Remove Favorite');
} }
async clickMoreActionsDelete() { async clickMoreActionsDelete() {
@@ -234,17 +240,17 @@ export class Toolbar extends Component {
async clickMoreActionsEditOffline() { async clickMoreActionsEditOffline() {
await this.openMoreMenu(); await this.openMoreMenu();
return await this.menu.clickMenuItem('Edit offline'); return await this.menu.clickMenuItem('Edit Offline');
} }
async clickMoreActionsCancelEditing() { async clickMoreActionsCancelEditing() {
await this.openMoreMenu(); await this.openMoreMenu();
return await this.menu.clickMenuItem('Cancel editing'); return await this.menu.clickMenuItem('Cancel Editing');
} }
async clickMoreActionsUploadNewVersion() { async clickMoreActionsUploadNewVersion() {
await this.openMoreMenu(); await this.openMoreMenu();
return await this.menu.clickMenuItem('Upload new version'); return await this.menu.clickMenuItem('Upload New Version');
} }
async clickFullScreen() { async clickFullScreen() {
+10 -3
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, browser, ExpectedConditions as EC } from 'protractor'; import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Toolbar } from '../toolbar/toolbar'; import { Toolbar } from '../toolbar/toolbar';
@@ -37,7 +37,9 @@ export class Viewer extends Component {
closeBtn: '.adf-viewer-close-button', closeBtn: '.adf-viewer-close-button',
fileTitle: '.adf-viewer__file-title', fileTitle: '.adf-viewer__file-title',
viewerExtensionContent: 'app-preview-extension' viewerExtensionContent: 'adf-preview-extension',
pdfViewerContentPage: '.adf-pdf-viewer__content .page'
}; };
root: ElementFinder = browser.$(Viewer.selectors.root); root: ElementFinder = browser.$(Viewer.selectors.root);
@@ -46,6 +48,7 @@ export class Viewer extends Component {
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));
pdfViewerContentPages: ElementArrayFinder = this.component.all(by.css(Viewer.selectors.pdfViewerContentPage));
toolbar = new Toolbar(this.component); toolbar = new Toolbar(this.component);
@@ -63,7 +66,6 @@ export class Viewer extends Component {
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() {
@@ -103,4 +105,9 @@ export class Viewer extends Component {
return await this.viewerExtensionContent.getAttribute('data-automation-id'); return await this.viewerExtensionContent.getAttribute('data-automation-id');
} }
} }
async isPdfViewerContentDisplayed() {
const count = await this.pdfViewerContentPages.count();
return count > 0;
}
} }
+10 -1
View File
@@ -42,6 +42,10 @@ export const ADMIN_FULL_NAME = 'Administrator';
export const E2E_ROOT_PATH = __dirname; export const E2E_ROOT_PATH = __dirname;
// Dates
export const DATE_FORMAT = 'MMM D, YYYY';
export const DATE_TIME_FORMAT = 'MMM D, YYYY, H:mm';
// Application Routes // Application Routes
export const APP_ROUTES = { export const APP_ROUTES = {
FAVORITES: '/favorites', FAVORITES: '/favorites',
@@ -113,7 +117,12 @@ export const FILES = {
xlsxFile: 'file-xlsx.xlsx', xlsxFile: 'file-xlsx.xlsx',
xlsxFile2: 'file2-xlsx.xlsx', xlsxFile2: 'file2-xlsx.xlsx',
pdfFile: 'file-pdf.pdf', pdfFile: 'file-pdf.pdf',
unsupportedFile: 'file_unsupported.3DS' unsupportedFile: 'file_unsupported.3DS',
protectedFile: {
name: 'protected.pdf',
password: '0000'
},
jpgFile: 'file-jpg.jpg'
}; };
export const EXTENSIBILITY_CONFIGS = { export const EXTENSIBILITY_CONFIGS = {
+19 -8
View File
@@ -25,6 +25,7 @@
import { browser, by, ElementFinder, ExpectedConditions as EC, until } from 'protractor'; import { browser, by, ElementFinder, ExpectedConditions as EC, until } from 'protractor';
import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs'; import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs';
import { Utils } from '../utilities/utils';
export abstract class Page { export abstract class Page {
protected static locators = { protected static locators = {
@@ -55,22 +56,22 @@ export abstract class Page {
constructor(public url: string = '') {} constructor(public url: string = '') {}
getTitle() { async getTitle() {
return browser.getTitle(); return await browser.getTitle();
} }
load(relativeUrl: string = '') { async load(relativeUrl: string = '') {
const hash = USE_HASH_STRATEGY ? '/#' : ''; const hash = USE_HASH_STRATEGY ? '/#' : '';
const path = `${browser.baseUrl}${hash}${this.url}${relativeUrl}`; const path = `${browser.baseUrl}${hash}${this.url}${relativeUrl}`;
return browser.get(path); return await browser.get(path);
} }
waitForApp() { async waitForApp() {
return browser.wait(EC.presenceOf(this.layout), BROWSER_WAIT_TIMEOUT); return await browser.wait(EC.presenceOf(this.layout), BROWSER_WAIT_TIMEOUT);
} }
waitForSnackBarToAppear() { async waitForSnackBarToAppear() {
return browser.wait(until.elementLocated(by.css('.mat-snack-bar-container')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snackbar to appear'); return await browser.wait(until.elementLocated(by.css('.mat-snack-bar-container')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snackbar to appear');
} }
async waitForSnackBarToClose() { async waitForSnackBarToClose() {
@@ -81,6 +82,16 @@ export abstract class Page {
await browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT); await browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT);
} }
async isDialogOpen() {
return await browser.isElementPresent(this.dialogContainer);
}
async closeOpenDialogs() {
while (await this.isDialogOpen()) {
await Utils.pressEscape();
}
}
async refresh() { async refresh() {
await browser.refresh(); await browser.refresh();
await this.waitForApp(); await this.waitForApp();
+8 -6
View File
@@ -23,13 +23,14 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { browser, ElementFinder } from 'protractor'; import { browser, by } from 'protractor';
import { BrowsingPage } from './browsing-page'; import { BrowsingPage } from './browsing-page';
export class SearchResultsPage extends BrowsingPage { export class SearchResultsPage extends BrowsingPage {
private static selectors = { private static selectors = {
root: 'aca-search-results', root: 'aca-search-results',
filter: 'adf-search-filter', filter: 'adf-search-filter',
expansionPanel: 'mat-expansion-panel', expansionPanel: 'mat-expansion-panel',
size: '#expansion-panel-SEARCH.CATEGORIES.SIZE', size: '#expansion-panel-SEARCH.CATEGORIES.SIZE',
@@ -41,17 +42,18 @@ export class SearchResultsPage extends BrowsingPage {
location: '#expansion-panel-SEARCH.CATEGORIES.LOCATION', location: '#expansion-panel-SEARCH.CATEGORIES.LOCATION',
resultsContent: 'adf-search-results__content', resultsContent: 'adf-search-results__content',
resultsContentHeader: 'adf-search-results__content-header', resultsContentHeader: '.adf-search-results__content-header',
resultsInfoText: 'adf-search-results--info-text', resultsInfoText: 'adf-search-results--info-text',
resultsFacets: 'adf-search-results__facets', resultsFacets: 'adf-search-results__facets',
sortingPicker: 'adf-sorting-picker' sortingPicker: 'adf-sorting-picker'
}; };
root: ElementFinder = browser.$(SearchResultsPage.selectors.root); async waitForResults() {
return await this.dataTable.waitForBody();
waitForResults() {
return this.dataTable.waitForBody();
} }
async getResultsHeader() {
return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
}
} }
@@ -946,7 +946,6 @@
"id": "app.files.thumbnail", "id": "app.files.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -955,7 +954,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -982,7 +981,7 @@
"key": "modifiedByUser.displayName", "key": "modifiedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
} }
@@ -992,7 +991,6 @@
"id": "app.libraries.thumbnail", "id": "app.libraries.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1001,7 +999,7 @@
"key": "title", "key": "title",
"title": "APP.DOCUMENT_LIST.COLUMNS.TITLE", "title": "APP.DOCUMENT_LIST.COLUMNS.TITLE",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.libraryName", "template": "app.columns.libraryName",
"desktopOnly": false "desktopOnly": false
@@ -1021,7 +1019,6 @@
"id": "app.shared.thumbnail", "id": "app.shared.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1030,7 +1027,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -1066,7 +1063,7 @@
"key": "modifiedByUser.displayName", "key": "modifiedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
}, },
@@ -1075,7 +1072,7 @@
"key": "sharedByUser.displayName", "key": "sharedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.SHARED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.SHARED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
} }
@@ -1085,7 +1082,6 @@
"id": "app.recent.thumbnail", "id": "app.recent.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1094,7 +1090,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -1131,7 +1127,6 @@
"id": "app.favorites.thumbnail", "id": "app.favorites.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1140,7 +1135,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -1176,7 +1171,7 @@
"key": "modifiedByUser.displayName", "key": "modifiedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
} }
@@ -1186,7 +1181,6 @@
"id": "app.trashcan.thumbnail", "id": "app.trashcan.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1195,7 +1189,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.trashcanName", "template": "app.columns.trashcanName",
"desktopOnly": false "desktopOnly": false
@@ -880,7 +880,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -907,7 +907,7 @@
"key": "modifiedByUser.displayName", "key": "modifiedByUser.displayName",
"title": "Test header", "title": "Test header",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
}, },
@@ -916,7 +916,7 @@
"key": "createdByUser.displayName", "key": "createdByUser.displayName",
"title": "New column", "title": "New column",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
} }
@@ -926,7 +926,6 @@
"id": "app.libraries.thumbnail", "id": "app.libraries.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -935,7 +934,7 @@
"key": "title", "key": "title",
"title": "APP.DOCUMENT_LIST.COLUMNS.TITLE", "title": "APP.DOCUMENT_LIST.COLUMNS.TITLE",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.libraryName", "template": "app.columns.libraryName",
"desktopOnly": false "desktopOnly": false
@@ -955,7 +954,6 @@
"id": "app.shared.thumbnail", "id": "app.shared.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -964,7 +962,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -1000,7 +998,7 @@
"key": "modifiedByUser.displayName", "key": "modifiedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
}, },
@@ -1009,7 +1007,7 @@
"key": "sharedByUser.displayName", "key": "sharedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.SHARED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.SHARED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
} }
@@ -1019,7 +1017,6 @@
"id": "app.recent.thumbnail", "id": "app.recent.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1028,7 +1025,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -1065,7 +1062,6 @@
"id": "app.favorites.thumbnail", "id": "app.favorites.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1074,7 +1070,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.name", "template": "app.columns.name",
"desktopOnly": false "desktopOnly": false
@@ -1110,7 +1106,7 @@
"key": "modifiedByUser.displayName", "key": "modifiedByUser.displayName",
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis", "class": "adf-ellipsis-cell",
"sortable": true, "sortable": true,
"desktopOnly": true "desktopOnly": true
} }
@@ -1120,7 +1116,6 @@
"id": "app.trashcan.thumbnail", "id": "app.trashcan.thumbnail",
"key": "$thumbnail", "key": "$thumbnail",
"type": "image", "type": "image",
"class": "adf-image-table-cell",
"sortable": false, "sortable": false,
"desktopOnly": false "desktopOnly": false
}, },
@@ -1129,7 +1124,7 @@
"key": "name", "key": "name",
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME", "title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
"type": "text", "type": "text",
"class": "adf-data-table-cell--ellipsis__name", "class": "adf-ellipsis-cell adf-expand-cell-5",
"sortable": true, "sortable": true,
"template": "app.columns.trashcanName", "template": "app.columns.trashcanName",
"desktopOnly": false "desktopOnly": false
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.
@@ -0,0 +1,182 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File/folder actions : on Favorites : ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
let fileDocxFavId, fileFavId, fileDocxSharedFavId, fileSharedFavId, fileFavLockedId, fileSharedFavLockedId;
let folderFavId, folderFav2Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id;
fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id;
fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id;
fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id;
fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id;
fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id;
folderFavId = (await apis.user.nodes.createFolder(data.folderFav.name, parentId)).entry.id;
folderFav2Id = (await apis.user.nodes.createFolder(data.folderFav2.name, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderFavId);
await apis.user.favorites.addFavoriteById('folder', folderFav2Id);
await apis.user.shared.shareFilesByIds([
fileDocxSharedFavId,
fileSharedFavId,
fileSharedFavLockedId
]);
await apis.user.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId
]);
await apis.user.nodes.lockFile(fileFavLockedId);
await apis.user.nodes.lockFile(fileSharedFavLockedId);
await apis.user.favorites.waitForApi({ expect: 8 });
await apis.user.shared.waitForApi({ expect: 3 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('on a file', () => {
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.favoritesContextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.favoritesContextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesContextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.favoritesContextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.favoritesContextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesContextMenu);
});
});
describe('on a folder', () => {
it('Folder favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.favoritesContextMenu);
});
});
describe('on multiple selection', () => {
it('multiple files - [C280656]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('multiple locked files - [C297631]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('multiple folders - [C280664]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('both files and folders - [C280657]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
});
});
+244
View File
@@ -0,0 +1,244 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File/folder actions : on Personal Files: ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
let folderFavId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name );
fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id;
await apis.user.nodes.createFile(data.file.name, parentId);
fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id;
fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id;
fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id;
fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id;
fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id;
fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id;
await apis.user.nodes.createFolder(data.folder.name, parentId);
folderFavId = (await apis.user.nodes.createFolder(data.folderFav.name, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderFavId);
await apis.user.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId
]);
await apis.user.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId
]);
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.nodes.lockFile(fileFavLockedId);
await apis.user.nodes.lockFile(fileSharedLockedId);
await apis.user.nodes.lockFile(fileSharedFavLockedId);
await apis.user.favorites.waitForApi({ expect: 7 });
await apis.user.shared.waitForApi({ expect: 6 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('on a file', () => {
it('File Office - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore);
await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu);
});
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu);
});
it('File simple - []', async () => {
await testUtil.checkToolbarPrimary(data.file.name, data.file.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore);
await testUtil.checkContextMenu(data.file.name, data.file.contextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu);
});
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu);
});
it('File locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu);
});
});
describe('on a folder', () => {
it('Folder not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folder.name, data.folder.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.toolbarMore);
await testUtil.checkContextMenu(data.folder.name, data.folder.contextMenu);
});
it('Folder favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.toolbarMore);
await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.contextMenu);
});
});
describe('on multiple selection', () => {
it('multiple files - [C217112]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarMore);
});
it('multiple files - all favorite - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarMore);
});
it('multiple locked files - [C297619]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore);
});
it('multiple folders - [C280459]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folder.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarMore);
});
it('both files and folders - [C280460]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folder.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folder.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folder.name ], data.multipleSel.toolbarMore);
});
});
});
+212
View File
@@ -0,0 +1,212 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File actions : on Recent Files: ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name);
fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id;
await apis.user.nodes.createFile(data.file.name, parentId);
fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id;
fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id;
fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id;
fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id;
fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id;
fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id;
await apis.user.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId
]);
await apis.user.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId
]);
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.nodes.lockFile(fileFavLockedId);
await apis.user.nodes.lockFile(fileSharedLockedId);
await apis.user.nodes.lockFile(fileSharedFavLockedId);
await apis.user.favorites.waitForApi({ expect: 6 });
await apis.user.shared.waitForApi({ expect: 6 });
await apis.user.search.waitForApi(username, { expect: 12 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickRecentFilesAndWait();
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('on single selection', () => {
it('File Office - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore);
await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu);
});
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu);
});
it('File simple - []', async () => {
await testUtil.checkToolbarPrimary(data.file.name, data.file.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore);
await testUtil.checkContextMenu(data.file.name, data.file.contextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu);
});
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu);
});
it('File locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu);
});
});
describe('on multiple selection', () => {
it('multiple files - [C280468]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileLocked.name ], data.multipleSel.toolbarMore);
});
it('multiple files - all favorite - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileFav.name ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileFav.name ], data.multipleSelAllFav.toolbarMore);
});
it('multiple locked files - [C297624]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore);
});
});
});
+291
View File
@@ -0,0 +1,291 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File/folder actions : on Search Results : ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
let folderFavId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { searchInput } = page.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name );
fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id;
await apis.user.nodes.createFile(data.file.name, parentId);
fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id;
fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id;
fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id;
fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id;
fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id;
fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id;
await apis.user.nodes.createFolder(data.folder.name, parentId);
folderFavId = (await apis.user.nodes.createFolder(data.folderFav.name, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folderFavId);
await apis.user.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId
]);
await apis.user.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId
]);
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.nodes.lockFile(fileFavLockedId);
await apis.user.nodes.lockFile(fileSharedLockedId);
await apis.user.nodes.lockFile(fileSharedFavLockedId);
await apis.user.favorites.waitForApi({ expect: 7 });
await apis.user.shared.waitForApi({ expect: 6 });
await apis.user.search.waitForApi(username, { expect: 12 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
describe('on a file', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.searchToolbarMore);
await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.searchContextMenu);
});
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.searchToolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.searchContextMenu);
});
it('File simple - []', async () => {
await testUtil.checkToolbarPrimary(data.file.name, data.file.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.file.name, data.file.searchToolbarMore);
await testUtil.checkContextMenu(data.file.name, data.file.searchContextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.searchToolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.searchContextMenu);
});
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.searchToolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.searchContextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchToolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchContextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.searchToolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.searchContextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.searchToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.searchContextMenu);
});
it('File locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.searchToolbarMore);
await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.searchContextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.searchToolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.searchContextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.searchToolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.searchContextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchContextMenu);
});
});
describe('on a folder', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchFor('folder-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('Folder not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folder.name, data.folder.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.searchToolbarMore);
await testUtil.checkContextMenu(data.folder.name, data.folder.searchContextMenu);
});
it('Folder favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.searchToolbarMore);
await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.searchContextMenu);
});
});
describe('on multiple selection', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('multiple files - [C291820]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchToolbarMore);
});
it('multiple files - all favorite - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.searchContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.searchToolbarMore);
});
it('multiple locked files - [C297626]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchToolbarMore);
});
it('multiple folders - [C291821]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchFor('folder-');
await testUtil.checkMultipleSelContextMenu([ data.folder.name, data.folderFav.name ], data.multipleSel.searchContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.folder.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.folder.name, data.folderFav.name ], data.multipleSel.searchToolbarMore);
});
it('both files and folders - [C291822]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(`=${data.file.name} or =${data.folderFav.name}`);
await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folderFav.name ], data.multipleSel.searchContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folderFav.name ], data.multipleSel.searchToolbarMore);
});
});
});
+162
View File
@@ -0,0 +1,162 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File actions : on Shared Files : ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
let fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileSharedLockedId, fileSharedFavLockedId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id;
fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id;
fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id;
await apis.user.favorites.addFavoritesByIds('file', [
fileDocxSharedFavId,
fileSharedFavId,
fileSharedFavLockedId
]);
await apis.user.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId
]);
await apis.user.nodes.lockFile(fileSharedLockedId);
await apis.user.nodes.lockFile(fileSharedFavLockedId);
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.shared.waitForApi({ expect: 6 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('single selection', () => {
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.sharedContextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedContextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.sharedContextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.sharedContextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.sharedContextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedContextMenu);
});
});
describe('multiple selection', () => {
it('multiple files - [C280467]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarMore);
});
it('multiple files - all favorite - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarMore);
});
it('multiple locked files - [C297623]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore);
});
});
});
@@ -0,0 +1,472 @@
import { Utils } from '../../../utilities/utils';
export const trashActions = ['Permanently Delete', 'Restore'];
// ----- files -----
const fileContextMenu = ['Share', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileSharedFavLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
const fileToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileDocxToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileDocxContextMenu = ['Share', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const fileFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileDocxFavContextMenu = ['Share', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileDocxFavToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileDocxSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileDocxSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileFavContextMenu = ['Share', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileFavLockedContextMenu = ['Share', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileLockedContextMenu = ['Share', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileSharedLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// ---- VIEWER ----
const viewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const viewerToolbarPrimary = ['Activate full-screen mode', 'Share', 'Download', 'Print', 'View Details', 'More Actions'];
const viewerToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const viewerFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const viewerDocxToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const viewerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const viewerDocxFavToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const viewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// ---- FAVORITES workarounds ----
// TODO: add Edit Offline when ACA-2174 is fixed
// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done
// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue
// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done
const favoritesSharedToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
// TODO: add Edit Offline when ACA-2174 is fixed
// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue
const favoritesContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
// TODO: add Edit Offline when ACA-2174 is fixed
// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue
const favoritesToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
// TODO: add Edit Offline when ACA-2174 is fixed
// TODO: investigate why 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue
// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done
const favoritesSharedContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
// ---- SEARCH workarounds ----
const searchDocxContextMenu = ['Share', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchToolbarPrimary = ['Toggle search filter', 'Share', 'Download', 'View', 'View Details', 'More Actions'];
const searchSharedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const searchFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchSharedFavLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchDocxToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchFavContextMenu = ['Share', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchSharedLockedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchDocxFavContextMenu = ['Share', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchDocxFavToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchDocxSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchDocxSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchContextMenu = ['Share', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchFavLockedContextMenu = ['Share', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchLockedContextMenu = ['Share', 'Download', 'View', 'Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchViewerToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchViewerFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchViewerDocxToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchViewerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchViewerDocxFavToolbarMore = ['Edit in Microsoft Office™', 'Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
const searchViewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
// ---- SHARED workarounds ----
// TODO: add Edit Offline to expectedContextMenu when ACA-2173 is fixed
const sharedFilesDocxContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Edit Offline to expectedToolbarMore when ACA-2173 is fixed
const sharedFilesDocxToolbarMore = ['Edit in Microsoft Office™', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Edit Offline to expectedContextMenu when ACA-2173 is fixed
const sharedFilesDocxSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Edit in Microsoft Office™', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Edit Offline to expectedToolbarMore when ACA-2173 is fixed
const sharedFilesDocxSharedFavToolbarMore = ['Edit in Microsoft Office™', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Cancel Editing to expectedContextMenu when ACA-2173 is fixed
const sharedFilesSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Cancel Editing to expectedToolbarMore when ACA-2173 is fixed
const sharedFilesSharedToolbarMore = ['Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Edit Offline to expectedToolbarMore when ACA-2173 is fixed
const sharedFilesFavSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// TODO: add Cancel Editing to expectedToolbarMore when ACA-2173 is fixed
const sharedFilesSharedFavToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
export const fileDocx = {
name: `file-docx-${Utils.random()}.docx`,
description: 'file not shared, not fav, office, not locked',
contextMenu: fileDocxContextMenu,
toolbarPrimary: fileToolbarPrimary,
toolbarMore: fileDocxToolbarMore,
viewerToolbarPrimary,
viewerToolbarMore: viewerDocxToolbarMore,
searchContextMenu: searchDocxContextMenu,
searchToolbarPrimary,
searchToolbarMore: searchDocxToolbarMore,
searchViewerToolbarMore: searchViewerDocxToolbarMore
};
export const fileDocxFav = {
name: `file-docx-fav-${Utils.random()}.docx`,
description: 'file not shared, fav, office, not locked',
contextMenu: fileDocxFavContextMenu,
toolbarPrimary: fileToolbarPrimary,
toolbarMore: fileDocxFavToolbarMore,
viewerToolbarPrimary,
viewerToolbarMore: viewerDocxFavToolbarMore,
favoritesToolbarMore,
favoritesContextMenu,
searchContextMenu: searchDocxFavContextMenu,
searchToolbarPrimary,
searchToolbarMore: searchDocxFavToolbarMore,
searchViewerToolbarMore: searchViewerDocxFavToolbarMore,
};
export const file = {
name: `file-${Utils.random()}.txt`,
description: 'file not shared, not fav, not office, not locked',
contextMenu: fileContextMenu,
toolbarPrimary: fileToolbarPrimary,
toolbarMore: fileToolbarMore,
viewerToolbarPrimary,
viewerToolbarMore,
searchViewerToolbarMore,
searchContextMenu,
searchToolbarPrimary,
searchToolbarMore
};
export const fileFav = {
name: `file-fav-${Utils.random()}.txt`,
description: 'file not shared, fav, not office, not locked',
contextMenu: fileFavContextMenu,
toolbarPrimary: fileToolbarPrimary,
toolbarMore: fileFavToolbarMore,
viewerToolbarPrimary,
viewerToolbarMore: viewerFavToolbarMore,
favoritesContextMenu,
favoritesToolbarMore,
searchContextMenu: searchFavContextMenu,
searchToolbarPrimary,
searchToolbarMore: searchFavToolbarMore,
searchViewerToolbarMore: searchViewerFavToolbarMore
};
export const fileDocxShared = {
name: `file-docx-shared-${Utils.random()}.docx`,
description: 'file shared, not fav, office, not locked',
contextMenu: fileDocxSharedContextMenu,
toolbarPrimary: fileSharedToolbarPrimary,
toolbarMore: fileDocxToolbarMore,
viewerToolbarPrimary: viewerSharedToolbarPrimary,
viewerToolbarMore: viewerDocxToolbarMore,
searchContextMenu: searchDocxSharedContextMenu,
searchToolbarPrimary: searchSharedToolbarPrimary,
searchToolbarMore: searchDocxToolbarMore,
searchViewerToolbarMore: searchViewerDocxToolbarMore,
sharedContextMenu: sharedFilesDocxContextMenu,
sharedToolbarMore: sharedFilesDocxToolbarMore
};
export const fileDocxSharedFav = {
name: `file-docx-shared-fav-${Utils.random()}.docx`,
description: 'file shared, fav, office, not locked',
contextMenu: fileDocxSharedFavContextMenu,
toolbarPrimary: fileSharedToolbarPrimary,
toolbarMore: fileDocxFavToolbarMore,
viewerToolbarPrimary: viewerSharedToolbarPrimary,
viewerToolbarMore: viewerDocxFavToolbarMore,
favoritesContextMenu: favoritesSharedContextMenu,
favoritesToolbarPrimary: favoritesSharedToolbarPrimary,
favoritesToolbarMore,
searchContextMenu: searchDocxSharedFavContextMenu,
searchToolbarPrimary: searchSharedToolbarPrimary,
searchToolbarMore: searchDocxFavToolbarMore,
searchViewerToolbarMore: searchViewerDocxFavToolbarMore,
sharedContextMenu: sharedFilesDocxSharedFavContextMenu,
sharedToolbarMore: sharedFilesDocxSharedFavToolbarMore
};
export const fileShared = {
name: `file-shared-${Utils.random()}.txt`,
description: 'file shared, not fav, not office, not locked',
contextMenu: fileSharedContextMenu,
toolbarPrimary: fileSharedToolbarPrimary,
toolbarMore: fileToolbarMore,
viewerToolbarPrimary: viewerSharedToolbarPrimary,
viewerToolbarMore,
searchContextMenu: searchSharedContextMenu,
searchToolbarPrimary: searchSharedToolbarPrimary,
searchToolbarMore,
searchViewerToolbarMore,
sharedContextMenu: sharedFilesSharedContextMenu,
sharedToolbarMore: sharedFilesSharedToolbarMore
};
export const fileSharedFav = {
name: `file-shared-fav-${Utils.random()}.txt`,
description: 'file shared, fav, not office, not locked',
contextMenu: fileSharedFavContextMenu,
toolbarPrimary: fileSharedToolbarPrimary,
toolbarMore: fileFavToolbarMore,
viewerToolbarPrimary: viewerSharedToolbarPrimary,
viewerToolbarMore: viewerFavToolbarMore,
favoritesContextMenu: favoritesSharedContextMenu,
favoritesToolbarPrimary: favoritesSharedToolbarPrimary,
favoritesToolbarMore,
searchContextMenu: searchSharedFavContextMenu,
searchToolbarPrimary: searchSharedToolbarPrimary,
searchToolbarMore: searchFavToolbarMore,
searchViewerToolbarMore: searchViewerFavToolbarMore,
sharedContextMenu: sharedFilesFavSharedContextMenu,
sharedToolbarMore: sharedFilesSharedFavToolbarMore
};
export const fileLocked = {
name: `file-locked-${Utils.random()}.txt`,
description: 'file not shared, not fav, not office, locked',
contextMenu: fileLockedContextMenu,
toolbarPrimary: fileToolbarPrimary,
toolbarMore: fileLockedToolbarMore,
viewerToolbarPrimary,
viewerToolbarMore: viewerLockedToolbarMore,
searchContextMenu: searchLockedContextMenu,
searchToolbarPrimary,
searchToolbarMore: searchLockedToolbarMore,
searchViewerToolbarMore: searchViewerLockedToolbarMore
};
export const fileFavLocked = {
name: `file-fav-locked-${Utils.random()}.txt`,
description: 'file not shared, fav, not office, locked',
contextMenu: fileFavLockedContextMenu,
toolbarPrimary: fileToolbarPrimary,
toolbarMore: fileFavLockedToolbarMore,
viewerToolbarPrimary,
viewerToolbarMore: viewerFavLockedToolbarMore,
favoritesContextMenu,
favoritesToolbarMore,
searchContextMenu: searchFavLockedContextMenu,
searchToolbarPrimary,
searchToolbarMore: searchFavLockedToolbarMore,
searchViewerToolbarMore: searchViewerFavLockedToolbarMore
};
export const fileSharedLocked = {
name: `file-shared-locked-${Utils.random()}.txt`,
description: 'file shared, not fav, not office, locked',
contextMenu: fileSharedLockedContextMenu,
toolbarPrimary: fileSharedToolbarPrimary,
toolbarMore: fileLockedToolbarMore,
viewerToolbarPrimary: viewerSharedToolbarPrimary,
viewerToolbarMore: viewerLockedToolbarMore,
searchContextMenu: searchSharedLockedContextMenu,
searchToolbarPrimary: searchSharedToolbarPrimary,
searchToolbarMore: searchLockedToolbarMore,
searchViewerToolbarMore: searchViewerLockedToolbarMore,
sharedContextMenu: sharedFilesSharedContextMenu,
sharedToolbarMore: sharedFilesSharedToolbarMore
};
export const fileSharedFavLocked = {
name: `file-shared-fav-locked-${Utils.random()}.txt`,
description: 'file shared, fav, not office, locked',
contextMenu: fileSharedFavLockedContextMenu,
toolbarPrimary: fileSharedToolbarPrimary,
toolbarMore: fileFavLockedToolbarMore,
viewerToolbarPrimary: viewerSharedToolbarPrimary,
viewerToolbarMore: viewerFavLockedToolbarMore,
favoritesContextMenu: favoritesSharedContextMenu,
favoritesToolbarPrimary: favoritesSharedToolbarPrimary,
favoritesToolbarMore,
searchContextMenu: searchSharedFavLockedContextMenu,
searchToolbarPrimary: searchSharedToolbarPrimary,
searchToolbarMore: searchFavLockedToolbarMore,
searchViewerToolbarMore: searchViewerFavLockedToolbarMore,
sharedContextMenu: sharedFilesFavSharedContextMenu,
sharedToolbarMore: sharedFilesSharedFavToolbarMore
};
export const fileInTrash = {
name: `deleted-file-${Utils.random()}.txt`,
trashActions
};
export const file2InTrash = {
name: `deleted-file2-${Utils.random()}.txt`,
trashActions
};
export const folderInTrash = {
name: `deleted-folder-${Utils.random()}`,
trashActions
};
export const folder2InTrash = {
name: `deleted-folder2-${Utils.random()}`,
trashActions
};
// ---- folders ---
const folderContextMenu = ['Download', 'Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
const folderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
const folderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
const favoritesFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
const favoritesFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
const searchFolderContextMenu = ['Download', 'Edit', 'Favorite', 'Copy', 'Permissions'];
const searchFolderToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions'];
const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Permissions'];
const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Permissions'];
const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Permissions'];
export const folder = {
name: `folder-${Utils.random()}`,
description: 'folder not favorite',
contextMenu: folderContextMenu,
toolbarPrimary: folderToolbarPrimary,
toolbarMore: folderToolbarMore,
searchContextMenu: searchFolderContextMenu,
searchToolbarPrimary: searchFolderToolbarPrimary,
searchToolbarMore: searchFolderToolbarMore
};
export const folderFav = {
name: `folder-fav-${Utils.random()}`,
description: 'folder favorite',
contextMenu: folderFavContextMenu,
toolbarPrimary: folderToolbarPrimary,
toolbarMore: folderFavToolbarMore,
favoritesContextMenu: favoritesFolderFavContextMenu,
favoritesToolbarMore: favoritesFolderFavToolbarMore,
searchContextMenu: searchFolderFavContextMenu,
searchToolbarPrimary: searchFolderToolbarPrimary,
searchToolbarMore: searchFolderFavToolbarMore
};
export const folderFav2 = {
name: `folder-fav-2-${Utils.random()}`,
description: 'folder favorite',
contextMenu: folderFavContextMenu,
toolbarPrimary: folderToolbarPrimary,
toolbarMore: folderFavToolbarMore,
favoritesContextMenu: favoritesFolderFavContextMenu,
favoritesToolbarMore: favoritesFolderFavToolbarMore,
searchContextMenu: searchFolderFavContextMenu,
searchToolbarPrimary: searchFolderToolbarPrimary,
searchToolbarMore: searchFolderFavToolbarMore
};
// ---- multiple selection ---
// TODO: raise issue to remove 'Permissions'
const multipleSelContextMenu = ['Download', 'Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
// TODO: raise issue to remove 'Permissions'
const multipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
const multipleSelToolbarPrimary = ['Download', 'View Details', 'More Actions'];
// TODO: raise issue to remove 'Permissions'
const multipleSelToolbarMore = ['Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
// TODO: raise issue to remove 'Permissions'
const multipleSelAllFavToolbarMore = ['Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
const favoritesMultipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
const favoritesMultipleSelAllFavToolbarMore = ['Remove Favorite', 'Move', 'Copy', 'Delete'];
// TODO: raise issue to remove 'Permissions'
const searchMultipleSelContextMenu = ['Download', 'Favorite', 'Copy', 'Permissions'];
// TODO: raise issue to remove 'Permissions'
const searchMultipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Copy', 'Permissions'];
const searchMultipleSelToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions'];
// TODO: raise issue to remove 'Permissions'
const searchMultipleSelToolbarMore = ['Favorite', 'Copy', 'Permissions'];
// TODO: raise issue to remove 'Permissions'
const searchMultipleSelAllFavToolbarMore = ['Remove Favorite', 'Copy', 'Permissions'];
export const multipleSel = {
contextMenu: multipleSelContextMenu,
toolbarPrimary: multipleSelToolbarPrimary,
toolbarMore: multipleSelToolbarMore,
searchContextMenu: searchMultipleSelContextMenu,
searchToolbarMore: searchMultipleSelToolbarMore,
searchToolbarPrimary: searchMultipleSelToolbarPrimary
}
export const multipleSelAllFav = {
contextMenu: multipleSelAllFavContextMenu,
toolbarPrimary: multipleSelToolbarPrimary,
toolbarMore: multipleSelAllFavToolbarMore,
favoritesContextMenu: favoritesMultipleSelAllFavContextMenu,
favoritesToolbarMore: favoritesMultipleSelAllFavToolbarMore,
searchToolbarPrimary: searchMultipleSelToolbarPrimary,
searchContextMenu: searchMultipleSelAllFavContextMenu,
searchToolbarMore: searchMultipleSelAllFavToolbarMore
}
+106
View File
@@ -0,0 +1,106 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File/folder actions : on Trash : ', () => {
const username = `user-${Utils.random()}`;
let fileInTrashId, file2InTrashId, folderInTrashId, folder2InTrashId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileInTrashId = (await apis.user.nodes.createFile(data.fileInTrash.name)).entry.id;
file2InTrashId = (await apis.user.nodes.createFile(data.file2InTrash.name)).entry.id;
folderInTrashId = (await apis.user.nodes.createFolder(data.folderInTrash.name)).entry.id;
folder2InTrashId = (await apis.user.nodes.createFolder(data.folder2InTrash.name)).entry.id;
await apis.user.nodes.deleteNodeById(fileInTrashId, false);
await apis.user.nodes.deleteNodeById(file2InTrashId, false);
await apis.user.nodes.deleteNodeById(folderInTrashId, false);
await apis.user.nodes.deleteNodeById(folder2InTrashId, false);
await apis.user.trashcan.waitForApi({ expect: 4 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.trashcan.emptyTrash();
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickTrashAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('on a file - [C286258]', async () => {
await testUtil.checkToolbarPrimary(data.fileInTrash.name, data.fileInTrash.trashActions);
await testUtil.checkContextMenu(data.fileInTrash.name, data.fileInTrash.trashActions);
});
it('on a folder - [C286259]', async () => {
await testUtil.checkToolbarPrimary(data.folderInTrash.name, data.folderInTrash.trashActions);
await testUtil.checkContextMenu(data.folderInTrash.name, data.folderInTrash.trashActions);
});
it('multiple files - [C280472]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileInTrash.name, data.file2InTrash.name ], data.trashActions);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileInTrash.name, data.file2InTrash.name ], data.trashActions);
});
it('multiple folders - [C280473]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.folderInTrash.name, data.folder2InTrash.name ], data.trashActions);
await testUtil.checkMultipleSelToolbarPrimary([ data.folderInTrash.name, data.folder2InTrash.name ], data.trashActions);
});
it('both files and folders - [C280474]', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileInTrash.name, data.folderInTrash.name ], data.trashActions);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileInTrash.name, data.folderInTrash.name ], data.trashActions);
});
});
+421
View File
@@ -0,0 +1,421 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-files-folders';
import * as testUtil from '../test-util';
describe('File/folder actions : in the viewer : ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const { searchInput } = page.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocx.name );
fileDocxFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxFav.name)).entry.id;
await apis.user.nodes.createFile(data.file.name, parentId);
fileFavId = (await apis.user.nodes.createFile(data.fileFav.name, parentId)).entry.id;
fileDocxSharedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.user.nodes.createFile(data.fileShared.name, parentId)).entry.id;
fileSharedFavId = (await apis.user.nodes.createFile(data.fileSharedFav.name, parentId)).entry.id;
fileLockedId = (await apis.user.nodes.createFile(data.fileLocked.name, parentId)).entry.id;
fileFavLockedId = (await apis.user.nodes.createFile(data.fileFavLocked.name, parentId)).entry.id;
fileSharedLockedId = (await apis.user.nodes.createFile(data.fileSharedLocked.name, parentId)).entry.id;
fileSharedFavLockedId = (await apis.user.nodes.createFile(data.fileSharedFavLocked.name, parentId)).entry.id;
await apis.user.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId
]);
await apis.user.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId
]);
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.nodes.lockFile(fileFavLockedId);
await apis.user.nodes.lockFile(fileSharedLockedId);
await apis.user.nodes.lockFile(fileSharedFavLockedId);
await apis.user.favorites.waitForApi({ expect: 6 });
await apis.user.shared.waitForApi({ expect: 6 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
describe('file opened from Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore);
});
it('File Office, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore);
});
it('File simple - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore);
});
it('File favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore);
});
it('File Office, shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore);
});
it('File favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore);
});
it('File shared, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickRecentFilesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore);
});
it('File Office, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore);
});
it('File simple - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore);
});
it('File favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore);
});
it('File Office, shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore);
});
it('File favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore);
});
it('File shared, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore);
});
it('File favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office, shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File shared, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Search Results', () => {
beforeAll(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.searchViewerToolbarMore);
});
it('File Office, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.searchViewerToolbarMore);
});
it('File simple - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.searchViewerToolbarMore);
});
it('File favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.searchViewerToolbarMore);
});
it('File Office, shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.searchViewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchViewerToolbarMore);
});
it('File shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.searchViewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.searchViewerToolbarMore);
});
it('File locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.searchViewerToolbarMore);
});
it('File favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.searchViewerToolbarMore);
});
it('File shared, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.searchViewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchViewerToolbarMore);
});
});
});
+224
View File
@@ -0,0 +1,224 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, protractor } from 'protractor';
import { LoginPage, BrowsingPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Generic tests : ', () => {
const random = Utils.random();
const username = `user-${random}`;
const parent = `parent-${random}`; let parentId;
const file1 = `file1-${random}.txt`;
const file2 = `file2-${random}.txt`;
const folder1 = `my-folder1-${Utils.random()}`;
const folder2 = `my-folder2-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const { searchInput } = page.header;
const contextMenu = dataTable.menu;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.nodes.createFile(file1, parentId);
await apis.user.nodes.createFile(file2, parentId);
await apis.user.nodes.createFolder(folder1, parentId);
await apis.user.nodes.createFolder(folder2, parentId);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('selected row is marked with a check circle icon - [C213134]', async () => {
await dataTable.selectItem(file1);
expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, 'check mark missing');
});
it('Row is marked with a check circle icon on direct right click - [C286252]', async () => {
await dataTable.rightClickOnItem(file2);
expect(await dataTable.hasCheckMarkIcon(file2)).toBe(true, 'check mark missing');
});
it('Context menu appears on direct right click on an item - [C286253]', async () => {
await dataTable.rightClickOnItem(file1);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
});
it('Context menu appears when selecting an item and then right clicking on it - [C286254]', async () => {
await dataTable.selectItem(file2);
await dataTable.rightClickOnItem(file2);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
});
it('Context menu appears correctly when right clicking on another item - [C284666]', async () => {
await dataTable.selectItem(file1);
await dataTable.rightClickOnItem(file2);
expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed`);
expect(await dataTable.hasCheckMarkIcon(file2)).toBe(true, `${file2} is not selected`);
expect(await dataTable.hasCheckMarkIcon(file1)).toBe(false, `${file1} is not selected`);
});
it('Context menu closes when clicking away from it - [C280619]', async () => {
await dataTable.rightClickOnItem(file1);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
await page.breadcrumb.getCurrentItem().click();
expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed');
});
describe('Actions are not displayed when no item is selected', () => {
it('on Personal Files - [C213120]', async () => {
await page.clickPersonalFilesAndWait();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on Trash - [C280452]', async () => {
await page.clickTrash();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on Favorites - [C280449]', async () => {
await page.clickFavorites();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on Recent Files - [C280447]', async () => {
await page.clickRecentFilesAndWait();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on Shared Files - [C280445]', async () => {
await page.clickSharedFiles();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on My Libraries - [C280439]', async () => {
await page.goToMyLibraries();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on Favorite Libraries - [C280439]', async () => {
await page.goToFavoriteLibraries();
await dataTable.clearSelection();
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('on Search Results - [C291815]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('*');
expect(await toolbar.isToggleSearchFiltersPresent()).toBe(true, `Search filter toggle is not displayed`);
expect(await toolbar.numberOfAvailableActions()).toBe(1, `more than 1 action is present`);
});
});
it('Context menu appears on right click on a multiple selection of items - [C286268]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
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.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`);
expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`);
expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`);
});
it('Unselect items with single click - [C280458]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
await dataTable.clickItem(file1);
expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number');
});
it('Select / unselect items by CMD+click - [C217110]', async () => {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await dataTable.clickItem(file1);
await dataTable.clickItem(file2);
await dataTable.clickItem(folder1);
await dataTable.clickItem(folder2);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await dataTable.clickItem(file1);
await dataTable.clickItem(file2);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number');
});
});
+328
View File
@@ -0,0 +1,328 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage } from '../../../pages/pages';
import { SITE_VISIBILITY } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-libraries';
import * as testUtil from '../test-util';
describe('Library actions : ', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.user.sites.createSite(data.publicUserMemberFav.name);
await apis.user.sites.createSite(data.privateUserMemberFav.name, SITE_VISIBILITY.PRIVATE);
await apis.user.sites.createSite(data.moderatedUserMemberFav.name, SITE_VISIBILITY.MODERATED);
const publicUserMemberNotFavId = (await apis.user.sites.createSite(data.publicUserMemberNotFav.name)).entry.guid;
const privateUserMemberNotFavId = (await apis.user.sites.createSite(data.privateUserMemberNotFav.name, SITE_VISIBILITY.PRIVATE)).entry.guid;
const moderatedUserMemberNotFavId = (await apis.user.sites.createSite(data.moderatedUserMemberNotFav.name, SITE_VISIBILITY.MODERATED)).entry.guid;
await apis.admin.sites.createSite(data.publicNotMemberFav.name);
await apis.admin.sites.createSite(data.moderatedNotMemberFav.name, SITE_VISIBILITY.MODERATED);
await apis.admin.sites.createSite(data.publicNotMemberNotFav.name);
await apis.admin.sites.createSite(data.moderatedNotMemberNotFav.name, SITE_VISIBILITY.MODERATED);
await apis.admin.sites.createSite(data.moderatedRequestedJoinFav.name, SITE_VISIBILITY.MODERATED);
await apis.admin.sites.createSite(data.moderatedRequestedJoinNotFav.name, SITE_VISIBILITY.MODERATED);
await apis.user.sites.createSite(data.siteInTrash.name, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.createSite(data.site2InTrash.name, SITE_VISIBILITY.PUBLIC);
await apis.user.sites.waitForApi({ expect: 8 });
await apis.admin.sites.waitForApi({ expect: 6 });
await apis.user.favorites.removeFavoriteById(publicUserMemberNotFavId);
await apis.user.favorites.removeFavoriteById(privateUserMemberNotFavId);
await apis.user.favorites.removeFavoriteById(moderatedUserMemberNotFavId);
await apis.user.favorites.addFavoriteById('site', data.publicNotMemberFav.name);
await apis.user.favorites.addFavoriteById('site', data.moderatedNotMemberFav.name);
await apis.user.favorites.addFavoriteById('site', data.moderatedRequestedJoinFav.name);
await apis.user.sites.requestToJoin(data.moderatedRequestedJoinFav.name);
await apis.user.sites.requestToJoin(data.moderatedRequestedJoinNotFav.name);
await apis.user.queries.waitForSites('site-', { expect: 13 });
await apis.user.sites.deleteSite(data.siteInTrash.name, false);
await apis.user.sites.deleteSite(data.site2InTrash.name, false);
await apis.user.trashcan.waitForApi({ expect: 2 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.sites.deleteSites([
data.publicUserMemberFav.name,
data.privateUserMemberFav.name,
data.moderatedUserMemberFav.name,
data.publicUserMemberNotFav.name,
data.privateUserMemberNotFav.name,
data.moderatedUserMemberNotFav.name
]),
apis.admin.sites.deleteSites([
data.publicNotMemberFav.name,
data.moderatedNotMemberFav.name,
data.publicNotMemberNotFav.name,
data.moderatedNotMemberNotFav.name,
data.moderatedRequestedJoinFav.name,
data.moderatedRequestedJoinNotFav.name
]),
apis.user.trashcan.emptyTrash()
]);
done();
});
describe('on My Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('Public library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.publicUserMemberFav.name, data.publicUserMemberFav.contextMenu);
});
it('Private library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.privateUserMemberFav.name, data.privateUserMemberFav.contextMenu);
});
it('Moderated library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.contextMenu);
});
it('Public library, user is a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.contextMenu);
});
it('Private library, user is a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.contextMenu);
});
it('Moderated library, user is a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.contextMenu);
});
});
describe('on Favorite Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToFavoriteLibrariesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('Public library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.publicUserMemberFav.name, data.publicUserMemberFav.contextMenu);
});
it('Private library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.privateUserMemberFav.name, data.privateUserMemberFav.contextMenu);
});
it('Moderated library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.contextMenu);
});
it('Public library, user not a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicNotMemberFav.name, data.publicNotMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicNotMemberFav.name, data.publicNotMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.publicNotMemberFav.name, data.publicNotMemberFav.contextMenu);
});
it('Moderated library, user not a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.contextMenu);
});
it('Moderated library, user requested to join, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.contextMenu);
});
});
describe('on Search Results', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor('site-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('Public library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicUserMemberFav.name, data.publicUserMemberFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicUserMemberFav.name, data.publicUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.publicUserMemberFav.name, data.publicUserMemberFav.contextMenu);
});
it('Private library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.privateUserMemberFav.name, data.privateUserMemberFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.privateUserMemberFav.name, data.privateUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.privateUserMemberFav.name, data.privateUserMemberFav.contextMenu);
});
it('Moderated library, user is a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedUserMemberFav.name, data.moderatedUserMemberFav.contextMenu);
});
it('Public library, user is a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.publicUserMemberNotFav.name, data.publicUserMemberNotFav.contextMenu);
});
it('Private library, user is a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.privateUserMemberNotFav.name, data.privateUserMemberNotFav.contextMenu);
});
it('Moderated library, user is a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedUserMemberNotFav.name, data.moderatedUserMemberNotFav.contextMenu);
});
it('Public library, user not a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicNotMemberFav.name, data.publicNotMemberFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicNotMemberFav.name, data.publicNotMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.publicNotMemberFav.name, data.publicNotMemberFav.contextMenu);
});
it('Moderated library, user not a member, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedNotMemberFav.name, data.moderatedNotMemberFav.contextMenu);
});
it('Public library, user not a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.publicNotMemberNotFav.name, data.publicNotMemberNotFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.publicNotMemberNotFav.name, data.publicNotMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.publicNotMemberNotFav.name, data.publicNotMemberNotFav.contextMenu);
});
it('Moderated library, user not a member, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedNotMemberNotFav.name, data.moderatedNotMemberNotFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedNotMemberNotFav.name, data.moderatedNotMemberNotFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedNotMemberNotFav.name, data.moderatedNotMemberNotFav.contextMenu);
});
it('Moderated library, user requested to join, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedRequestedJoinFav.name, data.moderatedRequestedJoinFav.contextMenu);
});
it('Moderated library, user requested to join, not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.moderatedRequestedJoinNotFav.name, data.moderatedRequestedJoinNotFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.moderatedRequestedJoinNotFav.name, data.moderatedRequestedJoinNotFav.toolbarMore);
await testUtil.checkContextMenu(data.moderatedRequestedJoinNotFav.name, data.moderatedRequestedJoinNotFav.contextMenu);
});
});
describe('on Trash', () => {
beforeEach(async (done) => {
await page.clickTrashAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('single library - []', async () => {
await testUtil.checkToolbarPrimary(data.siteInTrash.name, data.siteInTrash.trashActions);
await testUtil.checkContextMenu(data.siteInTrash.name, data.siteInTrash.trashActions);
});
it('multiple libraries - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.siteInTrash.name, data.site2InTrash.name ], data.trashActions);
await testUtil.checkMultipleSelToolbarPrimary([ data.siteInTrash.name, data.site2InTrash.name ], data.trashActions);
});
});
});
@@ -0,0 +1,156 @@
import { Utils } from '../../../utilities/utils';
// ---- multiple selection ---
export const trashActions = ['Permanently Delete', 'Restore'];
// ---- single selection ----
const memberFavContextMenu = ['Leave Library', 'Delete', 'Remove Favorite'];
const memberNotFavContextMenu = ['Leave Library', 'Delete', 'Favorite'];
const memberToolbarPrimary = ['Leave Library', 'View Details', 'More Actions'];
const favToolbarMore = ['Delete', 'Remove Favorite'];
const notFavToolbarMore = ['Delete', 'Favorite'];
const searchMemberToolbarPrimary = ['Toggle search filter', 'Leave Library', 'View Details', 'More Actions'];
const searchReqJoinToolbarPrimary = ['Toggle search filter', 'Cancel Join Request', 'View Details', 'More Actions'];
const searchNotMemberToolbarPrimary = ['Toggle search filter', 'Join', 'View Details', 'More Actions'];
const reqJoinToolbarMore = ['Cancel Join Request', 'View Details', 'More Actions'];
const notMemberFavContextMenu = ['Join', 'Delete', 'Remove Favorite'];
const notMemberNotFavContextMenu = ['Join', 'Delete', 'Favorite'];
const notMemberToolbarPrimary = ['Join', 'View Details', 'More Actions'];
const reqJoinNotFavContextMenu = ['Cancel Join Request', 'Delete', 'Favorite'];
const reqJoinFavContextMenu = ['Cancel Join Request', 'Delete', 'Remove Favorite'];
export const publicUserMemberFav = {
name: `site-public-member-fav-${Utils.random()}`,
description: 'public site, user member, user favorite',
contextMenu: memberFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
toolbarMore: favToolbarMore,
searchToolbarPrimary: searchMemberToolbarPrimary
};
export const privateUserMemberFav = {
name: `site-private-member-fav-${Utils.random()}`,
description: 'private site, user member, user favorite',
contextMenu: memberFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
toolbarMore: favToolbarMore,
searchToolbarPrimary: searchMemberToolbarPrimary
};
export const moderatedUserMemberFav = {
name: `site-moderated-member-fav-${Utils.random()}`,
description: 'moderated site, user member, user favorite',
contextMenu: memberFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
toolbarMore: favToolbarMore,
searchToolbarPrimary: searchMemberToolbarPrimary
};
export const publicUserMemberNotFav = {
name: `site-public-member-not-fav-${Utils.random()}`,
description: 'public site, user member, not favorite',
contextMenu: memberNotFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
toolbarMore: notFavToolbarMore,
searchToolbarPrimary: searchMemberToolbarPrimary
};
export const privateUserMemberNotFav = {
name: `site-private-member-not-fav-${Utils.random()}`,
description: 'private site, user member, not favorite',
contextMenu: memberNotFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
toolbarMore: notFavToolbarMore,
searchToolbarPrimary: searchMemberToolbarPrimary
};
export const moderatedUserMemberNotFav = {
name: `site-moderated-member-not-fav-${Utils.random()}`,
description: 'moderated site, user member, not favorite',
contextMenu: memberNotFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
toolbarMore: notFavToolbarMore,
searchToolbarPrimary: searchMemberToolbarPrimary
};
export const publicNotMemberFav = {
name: `site-public-not-member-fav-${Utils.random()}`,
description: 'public site, user not member, user favorite',
contextMenu: notMemberFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
toolbarMore: favToolbarMore,
searchToolbarPrimary: searchNotMemberToolbarPrimary
};
export const moderatedNotMemberFav = {
name: `site-moderated-not-member-fav-${Utils.random()}`,
description: 'moderated site, user not member, user favorite',
contextMenu: notMemberFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
toolbarMore: favToolbarMore,
searchToolbarPrimary: searchNotMemberToolbarPrimary
};
export const publicNotMemberNotFav = {
name: `site-public-not-member-not-fav-${Utils.random()}`,
description: 'public site, user not member, not favorite',
contextMenu: notMemberNotFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
toolbarMore: notFavToolbarMore,
searchToolbarPrimary: searchNotMemberToolbarPrimary
};
export const moderatedNotMemberNotFav = {
name: `site-moderated-not-member-not-fav-${Utils.random()}`,
description: 'moderated site, user not member, not favorite',
contextMenu: notMemberNotFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
toolbarMore: notFavToolbarMore,
searchToolbarPrimary: searchNotMemberToolbarPrimary
};
export const moderatedRequestedJoinFav = {
name: `site-moderated-req-join-fav-${Utils.random()}`,
description: 'moderated site, user requested join, user favorite',
contextMenu: reqJoinFavContextMenu,
toolbarPrimary: reqJoinToolbarMore,
toolbarMore: favToolbarMore,
searchToolbarPrimary: searchReqJoinToolbarPrimary
};
export const moderatedRequestedJoinNotFav = {
name: `site-moderated-req-join-not-fav-${Utils.random()}`,
description: 'moderated site, user requested join, not favorite',
contextMenu: reqJoinNotFavContextMenu,
toolbarPrimary: reqJoinToolbarMore,
toolbarMore: notFavToolbarMore,
searchToolbarPrimary: searchReqJoinToolbarPrimary
};
export const siteInTrash = {
name: `deleted-site-${Utils.random()}`,
trashActions
};
export const site2InTrash = {
name: `deleted-site2-${Utils.random()}`,
trashActions
};
@@ -0,0 +1,841 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage } from '../../../pages/pages';
import { SITE_VISIBILITY, SITE_ROLES, FILES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import { Viewer } from '../../../components/viewer/viewer';
describe('', () => {
const userConsumer = `consumer-${Utils.random()}`;
const userCollaborator = `collaborator-${Utils.random()}`;
const userDemoted = `demoted-${Utils.random()}`;
const siteName = `site-private-${Utils.random()}`;
const file1 = `my-file1-${Utils.random()}.txt`;
let file1Id;
const file2 = `my-file2-${Utils.random()}.txt`;
let file2Id;
const file3 = `my-file3-${Utils.random()}.txt`;
let file3Id;
const fileLocked = `my-file-locked-${Utils.random()}.txt`;
let fileLockedId;
const folder1 = `my-folder1-${Utils.random()}`;
let folder1Id;
const folder2 = `my-folder2-${Utils.random()}`;
let folder2Id;
const docxFile = FILES.docxFile;
let docxFileId;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer),
userCollaborator: new RepoClient(userCollaborator, userCollaborator),
userDemoted: new RepoClient(userDemoted, userDemoted)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const viewer = new Viewer();
const viewerToolbar = viewer.toolbar;
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.people.createUser({ username: userCollaborator });
await apis.admin.people.createUser({ username: userDemoted });
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id;
file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id;
file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id;
folder1Id = (await apis.admin.nodes.createFolder(folder1, docLibId)).entry.id;
folder2Id = (await apis.admin.nodes.createFolder(folder2, docLibId)).entry.id;
docxFileId = (await apis.admin.upload.uploadFile(docxFile, docLibId)).entry.id;
await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.sites.addSiteMember(siteName, userCollaborator, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await apis.admin.sites.addSiteMember(siteName, userDemoted, SITE_ROLES.SITE_MANAGER.ROLE);
fileLockedId = (await apis.admin.nodes.createFile(fileLocked, docLibId)).entry.id;
await apis.userDemoted.nodes.lockFile(fileLockedId);
await apis.userDemoted.favorites.addFavoriteById('file', fileLockedId);
await apis.userDemoted.shared.shareFileById(fileLockedId);
await apis.admin.sites.updateSiteMember(siteName, userDemoted, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.userConsumer.shared.shareFileById(file1Id);
await apis.userConsumer.shared.shareFileById(file2Id);
await apis.userConsumer.shared.shareFileById(docxFileId);
await apis.userConsumer.shared.shareFileById(file3Id);
await apis.userConsumer.shared.waitForApi({ expect: 5 });
await apis.userConsumer.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, docxFileId]);
await apis.userConsumer.favorites.addFavoritesByIds('folder', [folder1Id, folder2Id]);
await apis.userConsumer.favorites.waitForApi({ expect: 6 });
await apis.userCollaborator.favorites.addFavoritesByIds('file', [file1Id, docxFileId]);
await apis.userCollaborator.favorites.waitForApi({ expect: 2 });
await apis.admin.favorites.addFavoriteById('file', fileLockedId);
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(siteName);
done();
});
describe('Collaborator', () => {
beforeAll(async (done) => {
await loginPage.loginWith(userCollaborator);
done();
});
it('on File Libraries - [C297647]', async () => {
await page.clickFileLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectItem(file1);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${file1}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('on Shared Files - [C297651]', async () => {
await page.clickSharedFilesAndWait();
await page.dataTable.selectItem(file1);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
// TODO: change expect to true when ACA-2173 is done
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${file1}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('on Favorites - [C297652]', async () => {
await page.clickFavoritesAndWait();
await dataTable.selectItem(file1);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
// TODO: replace with isSharedLinkSettingsPresent when ACA-2175 is done
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
await toolbar.openMoreMenu();
// TODO: change expect to true when ACA-2174 is done
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is not displayed for ${file1}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`);
// TODO: change expect to false when ACA-1737 is done
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is displayed for ${file1}`);
// TODO: change expect to false when ACA-1737 is done
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('on Search Results - [C297653]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor(file1);
await dataTable.selectItem(file1);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${file1}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${file1}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${file1}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${file1}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${file1}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${file1}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${file1}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${file1}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${file1}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
describe('in the viewer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickPersonalFiles();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('file opened from File Libraries - [C297654]', async () => {
await page.clickFileLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(docxFile);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Shared Files - [C297655]', async () => {
await page.clickSharedFilesAndWait();
await dataTable.doubleClickOnRowByName(docxFile);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Favorites - [C297656]', async () => {
await page.clickFavoritesAndWait();
await dataTable.doubleClickOnRowByName(docxFile);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove Favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Search Results - [C306992]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor(docxFile);
await dataTable.waitForBody();
await dataTable.doubleClickOnRowByName(docxFile);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
});
});
describe('File locked - lock owner : ', () => {
beforeAll(async (done) => {
await loginPage.loginWith(userDemoted);
done();
});
it('on File Libraries - [C297657]', async () => {
await page.clickFileLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed');
await toolbar.closeMoreMenu();
});
it('on Shared Files - [C297658]', async () => {
await page.clickSharedFilesAndWait();
await page.dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2173 is done
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed');
await toolbar.closeMoreMenu();
});
it('on Favorites - [C297659]', async () => {
await page.clickFavoritesAndWait();
await dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
// TODO: replace with isSharedLinkSettingsPresent when ACA-2175 is done
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2174 is fixed
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
// TODO: change expect to false when ACA-1737 is fixed
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is displayed for ${fileLocked}`);
// TODO: change expect to false when ACA-1737 is fixed
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed');
await toolbar.closeMoreMenu();
});
it('on Search Results - [C297660]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor(fileLocked);
await dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is not displayed');
await toolbar.closeMoreMenu();
});
describe('in the viewer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickPersonalFiles();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('file opened from File Libraries - [C297661]', async () => {
await page.clickFileLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Shared Files - [C297662]', async () => {
await page.clickSharedFilesAndWait();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Favorites - [C297663]', async () => {
await page.clickFavoritesAndWait();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Search Results - [C306993]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor(fileLocked);
await dataTable.waitForBody();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await viewerToolbar.closeMoreMenu();
});
});
});
describe('File locked - manager : ', () => {
beforeAll(async (done) => {
await loginPage.loginWithAdmin();
done();
});
it('on File Libraries - [C297664]', async () => {
await page.clickFileLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, 'Upload new version is displayed');
await toolbar.closeMoreMenu();
});
it('on Shared Files - [C297665]', async () => {
await page.clickSharedFilesAndWait();
await page.dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2173 is done
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
// TODO: change expect to false when ACA-2173 is done
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is displayed');
await toolbar.closeMoreMenu();
});
it('on Favorites - [C297666]', async () => {
await page.clickFavoritesAndWait();
await dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
// TODO: replace with isSharedLinkSettingsPresent when ACA-2175 is done
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2174 is fixed
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
// TODO: change expect to false when ACA-1737 is done
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, 'Upload new version is displayed');
await toolbar.closeMoreMenu();
});
it('on Search Results - [C297667]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor(fileLocked);
await dataTable.selectItem(fileLocked);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked} in Search Results`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked} in Search Results`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, 'Manage versions is not displayed');
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, 'Upload new version is displayed');
await toolbar.closeMoreMenu();
});
describe('in the viewer', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickPersonalFiles();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('file opened from File Libraries - [C297671]', async () => {
await page.clickFileLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Shared Files - [C297672]', async () => {
await page.clickSharedFilesAndWait();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Favorites - [C297673]', async () => {
await page.clickFavoritesAndWait();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await viewerToolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await viewerToolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await viewerToolbar.closeMoreMenu();
});
it('file opened from Search Results - [C306994]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor(fileLocked);
await dataTable.waitForBody();
await dataTable.doubleClickOnRowByName(fileLocked);
await viewer.waitForViewerToOpen();
expect(await viewerToolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await viewerToolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await viewerToolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await viewerToolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await viewerToolbar.isSharedLinkSettingsPresent()).toBe(true, 'Shared link settings is not displayed');
expect(await viewerToolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed`);
await viewerToolbar.openMoreMenu();
expect(await viewerToolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await viewerToolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await viewerToolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await viewerToolbar.menu.isSharePresent()).toBe(false, `Share is displayed in More Actions`);
expect(await viewerToolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
// TODO: change expect to true when ACA-2319 is fixed
expect(await viewerToolbar.menu.isMovePresent()).toBe(false, `Move is not displayed`);
// TODO: change expect to true when ACA-2319 is fixed
expect(await viewerToolbar.menu.isDeletePresent()).toBe(false, `Delete is not displayed`);
expect(await viewerToolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await viewerToolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await viewerToolbar.closeMoreMenu();
});
});
});
});
@@ -0,0 +1,198 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-permissions';
import * as testUtil from '../test-util';
describe('Special permissions actions : on Favorites : ', () => {
const site = `site-private-${Utils.random()}`;
const userConsumer = `consumer-${Utils.random()}`;
let fileDocxFavId, fileFavId, fileDocxSharedFavId, fileSharedFavId, fileFavLockedId, fileSharedFavLockedId;
let folderFavId, folderFav2Id;
const file3 = `file-3-${Utils.random()}.txt`;
let file3Id;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(site);
await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id;
fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id;
fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id;
fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id;
fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id;
fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id;
file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id;
folderFavId = (await apis.admin.nodes.createFolder(data.folderFav.name, docLibId)).entry.id;
folderFav2Id = (await apis.admin.nodes.createFolder(data.folderFav2.name, docLibId)).entry.id;
await apis.userConsumer.favorites.addFavoriteById('folder', folderFavId);
await apis.userConsumer.favorites.addFavoriteById('folder', folderFav2Id);
await apis.userConsumer.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId,
file3Id
]);
await apis.userConsumer.shared.shareFilesByIds([
fileDocxSharedFavId,
fileSharedFavId,
fileSharedFavLockedId,
file3Id
]);
await apis.admin.nodes.lockFile(fileFavLockedId);
await apis.admin.nodes.lockFile(fileSharedFavLockedId);
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.userConsumer.favorites.waitForApi({ expect: 9 });
await apis.userConsumer.shared.waitForApi({ expect: 4 });
await loginPage.loginWith(userConsumer);
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(site);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('on a file', () => {
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.favoritesContextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.favoritesContextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.favoritesContextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.favoritesContextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.favoritesContextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.favoritesContextMenu);
});
});
describe('on a folder', () => {
it('Folder favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.favoritesToolbarMore);
await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.favoritesContextMenu);
});
});
describe('on multiple selection', () => {
it('multiple files - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('multiple locked files - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFavLocked.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('multiple folders - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folderFav2.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('both files and folders - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFav.name, data.folderFav.name ], data.multipleSelAllFav.favoritesToolbarMore);
});
it('multiple files with different granular permissions - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileFav.name, file3 ], data.multipleSelAllFav.favoritesContextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileFav.name, file3 ], data.multipleSelAllFav.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileFav.name, file3 ], data.multipleSelAllFav.favoritesToolbarMore);
});
});
});
@@ -0,0 +1,266 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-permissions';
import * as testUtil from '../test-util';
describe('Special permissions actions : on File Libraries : ', () => {
const site = `site-private-${Utils.random()}`;
const userConsumer = `consumer-${Utils.random()}`;
const file3 = `file-3-${Utils.random()}.txt`;
let file3Id;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
let folderFavId;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(site);
await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocx.name );
fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id;
await apis.admin.nodes.createFile(data.file.name, docLibId);
fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id;
fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id;
fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id;
fileLockedId = (await apis.admin.nodes.createFile(data.fileLocked.name, docLibId)).entry.id;
fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id;
fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id;
fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id;
file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id;
await apis.admin.nodes.createFolder(data.folder.name, docLibId);
folderFavId = (await apis.admin.nodes.createFolder(data.folderFav.name, docLibId)).entry.id;
done();
});
beforeAll(async (done) => {
await apis.userConsumer.favorites.addFavoriteById('folder', folderFavId);
await apis.userConsumer.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId,
file3Id
]);
await apis.userConsumer.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId,
file3Id
]);
await apis.admin.nodes.lockFile(fileLockedId);
await apis.admin.nodes.lockFile(fileFavLockedId);
await apis.admin.nodes.lockFile(fileSharedLockedId);
await apis.admin.nodes.lockFile(fileSharedFavLockedId);
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.userConsumer.favorites.waitForApi({ expect: 8 });
await apis.userConsumer.shared.waitForApi({ expect: 7 });
done();
});
beforeAll(async (done) => {
await loginPage.loginWith(userConsumer);
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(site);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(site);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('on a file', () => {
it('File Office - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore);
await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu);
});
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu);
});
it('File simple - []', async () => {
await testUtil.checkToolbarPrimary(data.file.name, data.file.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore);
await testUtil.checkContextMenu(data.file.name, data.file.contextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu);
});
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu);
});
it('File locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu);
});
});
describe('on a folder', () => {
it('Folder not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folder.name, data.folder.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.toolbarMore);
await testUtil.checkContextMenu(data.folder.name, data.folder.contextMenu);
});
it('Folder favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.toolbarMore);
await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.contextMenu);
});
});
describe('on multiple selection', () => {
it('multiple files - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocx.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarMore);
});
it('multiple files - all favorite - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileDocxSharedFav.name ], data.multipleSelAllFav.toolbarMore);
});
it('multiple locked files - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore);
});
it('multiple folders - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.folderFav.name, data.folder.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.folderFav.name, data.folder.name ], data.multipleSel.toolbarMore);
});
it('both files and folders - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folder.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folder.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folder.name ], data.multipleSel.toolbarMore);
});
it('multiple files with different granular permissions - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, file3 ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.toolbarMore);
});
});
});
@@ -0,0 +1,310 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-permissions';
import * as testUtil from '../test-util';
describe('Special permissions actions : on Search Results : ', () => {
const site = `site-private-${Utils.random()}`;
const userConsumer = `consumer-${Utils.random()}`;
const file3 = `file-3-${Utils.random()}.txt`;
let file3Id;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
let folderFavId;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { searchInput } = page.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(site);
await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocx.name );
fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id;
await apis.admin.nodes.createFile(data.file.name, docLibId);
fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id;
fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id;
fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id;
fileLockedId = (await apis.admin.nodes.createFile(data.fileLocked.name, docLibId)).entry.id;
fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id;
fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id;
fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id;
file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id;
await apis.admin.nodes.createFolder(data.folder.name, docLibId);
folderFavId = (await apis.admin.nodes.createFolder(data.folderFav.name, docLibId)).entry.id;
await apis.userConsumer.favorites.addFavoriteById('folder', folderFavId);
await apis.userConsumer.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId,
file3Id
]);
await apis.userConsumer.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId,
file3Id
]);
await apis.admin.nodes.lockFile(fileLockedId);
await apis.admin.nodes.lockFile(fileFavLockedId);
await apis.admin.nodes.lockFile(fileSharedLockedId);
await apis.admin.nodes.lockFile(fileSharedFavLockedId);
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.userConsumer.favorites.waitForApi({ expect: 8 });
await apis.userConsumer.shared.waitForApi({ expect: 7 });
await apis.userConsumer.search.waitForApi(userConsumer, { expect: 13 });
await loginPage.loginWith(userConsumer);
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(site);
done();
});
describe('on a file', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocx.name, data.fileDocx.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocx.name, data.fileDocx.toolbarMore);
await testUtil.checkContextMenu(data.fileDocx.name, data.fileDocx.contextMenu);
});
it('File Office, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxFav.name, data.fileDocxFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxFav.name, data.fileDocxFav.contextMenu);
});
it('File simple - []', async () => {
await testUtil.checkToolbarPrimary(data.file.name, data.file.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.file.name, data.file.toolbarMore);
await testUtil.checkContextMenu(data.file.name, data.file.contextMenu);
});
it('File favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFav.name, data.fileFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFav.name, data.fileFav.toolbarMore);
await testUtil.checkContextMenu(data.fileFav.name, data.fileFav.contextMenu);
});
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.contextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.contextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.toolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.contextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.contextMenu);
});
it('File locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileLocked.name, data.fileLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileLocked.name, data.fileLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileLocked.name, data.fileLocked.contextMenu);
});
it('File favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileFavLocked.name, data.fileFavLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileFavLocked.name, data.fileFavLocked.contextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.contextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.contextMenu);
});
});
describe('on a folder', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchFor('folder-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('Folder not favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folder.name, data.folder.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folder.name, data.folder.toolbarMore);
await testUtil.checkContextMenu(data.folder.name, data.folder.contextMenu);
});
it('Folder favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.folderFav.name, data.folderFav.searchToolbarPrimary);
await testUtil.checkToolbarMoreActions(data.folderFav.name, data.folderFav.toolbarMore);
await testUtil.checkContextMenu(data.folderFav.name, data.folderFav.contextMenu);
});
});
describe('on multiple selection', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('multiple files - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.file.name, data.fileDocxShared.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.fileDocxShared.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.fileDocxShared.name ], data.multipleSel.toolbarMore);
});
it('multiple files - all favorite - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, data.fileSharedFav.name ], data.multipleSelAllFav.toolbarMore);
});
it('multiple locked files - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore);
});
it('multiple folders - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchFor('folder-');
await testUtil.checkMultipleSelContextMenu([ data.folder.name, data.folderFav.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.folder.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.folder.name, data.folderFav.name ], data.multipleSel.toolbarMore);
});
it('both files and folders - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(`=${data.file.name} or =${data.folderFav.name}`);
await testUtil.checkMultipleSelContextMenu([ data.file.name, data.folderFav.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.file.name, data.folderFav.name ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.file.name, data.folderFav.name ], data.multipleSel.toolbarMore);
});
it('multiple files with different granular permissions - []', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
await testUtil.checkMultipleSelContextMenu([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileDocxFav.name, file3 ], data.multipleSel.searchToolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileDocxFav.name, file3 ], data.multipleSelAllFav.toolbarMore);
});
});
});
@@ -0,0 +1,179 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-permissions';
import * as testUtil from '../test-util';
describe('Special permissions actions : on Shared Files : ', () => {
const site = `site-private-${Utils.random()}`;
const userConsumer = `consumer-${Utils.random()}`;
const file3 = `file-3-${Utils.random()}.txt`;
let file3Id;
let fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileSharedLockedId, fileSharedFavLockedId;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(site);
await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id;
fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id;
fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id;
fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id;
file3Id = (await apis.admin.nodes.createFile(file3, docLibId)).entry.id;
await apis.userConsumer.favorites.addFavoritesByIds('file', [
fileDocxSharedFavId,
fileSharedFavId,
fileSharedFavLockedId,
file3Id
]);
await apis.userConsumer.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId,
file3Id
]);
await apis.admin.nodes.lockFile(fileSharedLockedId);
await apis.admin.nodes.lockFile(fileSharedFavLockedId);
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.userConsumer.favorites.waitForApi({ expect: 7 });
await apis.userConsumer.shared.waitForApi({ expect: 4 });
await loginPage.loginWith(userConsumer);
done();
});
afterAll(async (done) => {
await apis
await apis.admin.sites.deleteSite(site);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('single selection', () => {
it('File Office, shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxShared.name, data.fileDocxShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileDocxShared.name, data.fileDocxShared.sharedContextMenu);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileDocxSharedFav.name, data.fileDocxSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileDocxSharedFav.name, data.fileDocxSharedFav.sharedContextMenu);
});
it('File shared - []', async () => {
await testUtil.checkToolbarPrimary(data.fileShared.name, data.fileShared.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileShared.name, data.fileShared.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileShared.name, data.fileShared.sharedContextMenu);
});
it('File shared, favorite - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFav.name, data.fileSharedFav.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFav.name, data.fileSharedFav.sharedContextMenu);
});
it('File shared, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedLocked.name, data.fileSharedLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileSharedLocked.name, data.fileSharedLocked.sharedContextMenu);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkToolbarPrimary(data.fileSharedFavLocked.name, data.fileSharedFavLocked.toolbarPrimary);
await testUtil.checkToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedToolbarMore);
await testUtil.checkContextMenu(data.fileSharedFavLocked.name, data.fileSharedFavLocked.sharedContextMenu);
});
});
describe('multiple selection', () => {
it('multiple files - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileShared.name, data.fileSharedFav.name ], data.multipleSel.toolbarMore);
});
it('multiple files - all favorite - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedFav.name, data.fileSharedFavLocked.name ], data.multipleSelAllFav.toolbarMore);
});
it('multiple locked files - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedLocked.name, data.fileSharedFavLocked.name ], data.multipleSel.toolbarMore);
});
it('multiple files with different granular permissions - []', async () => {
await testUtil.checkMultipleSelContextMenu([ data.fileSharedFav.name, file3 ], data.multipleSelAllFav.contextMenu);
await testUtil.checkMultipleSelToolbarPrimary([ data.fileSharedFav.name, file3 ], data.multipleSel.toolbarPrimary);
await testUtil.checkMultipleSelToolbarMoreActions([ data.fileSharedFav.name, file3 ], data.multipleSelAllFav.toolbarMore);
});
});
});
@@ -0,0 +1,401 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../../pages/pages';
import { FILES, SITE_VISIBILITY, SITE_ROLES } from '../../../configs';
import { RepoClient } from '../../../utilities/repo-client/repo-client';
import { Utils } from '../../../utilities/utils';
import * as data from './test-data-permissions';
import * as testUtil from '../test-util';
describe('Special permissions actions : in the Viewer : ', () => {
const site = `site-private-${Utils.random()}`;
const userConsumer = `consumer-${Utils.random()}`;
let fileDocxFavId, fileFavId, fileDocxSharedId, fileDocxSharedFavId, fileSharedId, fileSharedFavId, fileLockedId, fileFavLockedId, fileSharedLockedId, fileSharedFavLockedId;
const apis = {
admin: new RepoClient(),
userConsumer: new RepoClient(userConsumer, userConsumer)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const { searchInput } = page.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username: userConsumer });
await apis.admin.sites.createSite(site, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(site);
await apis.admin.sites.addSiteMember(site, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocx.name );
fileDocxFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxFav.name)).entry.id;
await apis.admin.nodes.createFile(data.file.name, docLibId);
fileFavId = (await apis.admin.nodes.createFile(data.fileFav.name, docLibId)).entry.id;
fileDocxSharedId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await apis.admin.upload.uploadFileWithRename(FILES.docxFile, docLibId, data.fileDocxSharedFav.name)).entry.id;
fileSharedId = (await apis.admin.nodes.createFile(data.fileShared.name, docLibId)).entry.id;
fileSharedFavId = (await apis.admin.nodes.createFile(data.fileSharedFav.name, docLibId)).entry.id;
fileLockedId = (await apis.admin.nodes.createFile(data.fileLocked.name, docLibId)).entry.id;
fileFavLockedId = (await apis.admin.nodes.createFile(data.fileFavLocked.name, docLibId)).entry.id;
fileSharedLockedId = (await apis.admin.nodes.createFile(data.fileSharedLocked.name, docLibId)).entry.id;
fileSharedFavLockedId = (await apis.admin.nodes.createFile(data.fileSharedFavLocked.name, docLibId)).entry.id;
done();
});
beforeAll(async (done) => {
await apis.userConsumer.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
fileDocxSharedFavId,
fileSharedFavId,
fileFavLockedId,
fileSharedFavLockedId
]);
await apis.userConsumer.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
fileSharedId,
fileSharedFavId,
fileSharedLockedId,
fileSharedFavLockedId
]);
await apis.admin.nodes.lockFile(fileLockedId);
await apis.admin.nodes.lockFile(fileFavLockedId);
await apis.admin.nodes.lockFile(fileSharedLockedId);
await apis.admin.nodes.lockFile(fileSharedFavLockedId);
await apis.userConsumer.favorites.waitForApi({ expect: 6 });
await apis.userConsumer.shared.waitForApi({ expect: 6 });
done();
});
beforeAll(async (done) => {
await loginPage.loginWith(userConsumer);
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(site);
done();
});
describe('file opened from File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(site);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore);
});
it('File Office, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore);
});
it('File simple - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore);
});
it('File favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore);
});
it('File Office, shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore);
});
it('File favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore);
});
it('File shared, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore);
});
it('File favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office, shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File shared, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
describe('file opened from Search Results', () => {
beforeAll(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchFor('file-');
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File Office - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocx.name, data.fileDocx.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocx.name, data.fileDocx.viewerToolbarMore);
});
it('File Office, favorite - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxFav.name, data.fileDocxFav.viewerToolbarMore);
});
it('File simple - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.file.name, data.file.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.file.name, data.file.viewerToolbarMore);
});
it('File favorite - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileFav.name, data.fileFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFav.name, data.fileFav.viewerToolbarMore);
});
it('File Office, shared - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxShared.name, data.fileDocxShared.viewerToolbarMore);
});
it('File Office, shared, favorite - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileDocxSharedFav.name, data.fileDocxSharedFav.viewerToolbarMore);
});
it('File shared - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileShared.name, data.fileShared.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileShared.name, data.fileShared.viewerToolbarMore);
});
it('File shared, favorite - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFav.name, data.fileSharedFav.viewerToolbarMore);
});
it('File locked - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileLocked.name, data.fileLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileLocked.name, data.fileLocked.viewerToolbarMore);
});
it('File favorite, locked - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileFavLocked.name, data.fileFavLocked.viewerToolbarMore);
});
it('File shared, locked - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedLocked.name, data.fileSharedLocked.viewerToolbarMore);
});
it('File shared, favorite, locked - []', async () => {
// await searchInput.clickSearchButton();
// await searchInput.checkOnlyFiles();
// await searchInput.searchFor('file-');
await testUtil.checkViewerToolbarPrimaryActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarPrimary);
await testUtil.checkViewerToolbarMoreActions(data.fileSharedFavLocked.name, data.fileSharedFavLocked.viewerToolbarMore);
});
});
});
@@ -0,0 +1,335 @@
import { Utils } from '../../../utilities/utils';
// ----- files -----
const consumerContextMenu = ['Share', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions'];
const consumerFavContextMenu = ['Share', 'Download', 'View', 'Remove Favorite', 'Copy', 'Manage Versions'];
const consumerSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions'];
const consumerSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Remove Favorite', 'Copy', 'Manage Versions'];
const consumerToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
const consumerSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const searchConsumerToolbarPrimary = ['Toggle search filter', 'Share', 'Download', 'View', 'View Details', 'More Actions'];
const searchConsumerSharedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const consumerToolbarMore = ['Favorite', 'Copy', 'Manage Versions'];
const consumerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions'];
// ---- VIEWER ----
const consumerViewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const consumerViewerToolbarPrimary = ['Activate full-screen mode', 'Share', 'Download', 'Print', 'View Details', 'More Actions'];
const consumerViewerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions'];
const consumerViewerToolbarMore = ['Favorite', 'Copy', 'Manage Versions'];
// ---- FAVORITES workarounds ----
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
// TODO: remove 'Upload New Version' when ACA-2175 is done
const favoritesConsumerToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
// TODO: remove 'Upload New Version' when ACA-2175 is done
const favoritesConsumerContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
// TODO: remove 'Upload New Version' when ACA-2175 is done
// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done
const favoritesConsumerSharedContextMenu = ['Share', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
// TODO: change 'Share' into 'Shared Link Settings' when ACA-2175 is done
const favoritesConsumerSharedToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
// ---- SHARED FILES workaround ----
// TODO: remove 'Upload New Version' when ACA-2173 is done
const sharedConsumerToolbarMore = ['Upload New Version', 'Favorite', 'Copy', 'Manage Versions'];
// TODO: remove 'Upload New Version' when ACA-2173 is done
const sharedConsumerFavToolbarMore = ['Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
// TODO: remove 'Upload New Version' when ACA-2173 is done
const sharedConsumerContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions'];
// TODO: remove 'Upload New Version' when ACA-2173 is done
const sharedConsumerFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
export const fileDocx = {
name: `file-docx-${Utils.random()}.docx`,
description: 'file not shared, not fav, office, not locked',
contextMenu: consumerContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileDocxFav = {
name: `file-docx-fav-${Utils.random()}.docx`,
description: 'file not shared, fav, office, not locked',
contextMenu: consumerFavContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerContextMenu,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const file = {
name: `file-${Utils.random()}.txt`,
description: 'file not shared, not fav, not office, not locked',
contextMenu: consumerContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileFav = {
name: `file-fav-${Utils.random()}.txt`,
description: 'file not shared, fav, not office, not locked',
contextMenu: consumerFavContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerContextMenu,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileDocxShared = {
name: `file-docx-shared-${Utils.random()}.docx`,
description: 'file shared, not fav, office, not locked',
contextMenu: consumerSharedContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
sharedToolbarMore: sharedConsumerToolbarMore,
sharedContextMenu: sharedConsumerContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileDocxSharedFav = {
name: `file-docx-shared-fav-${Utils.random()}.docx`,
description: 'file shared, fav, office, not locked',
contextMenu: consumerSharedFavContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerSharedContextMenu,
favoritesToolbarPrimary: favoritesConsumerSharedToolbarPrimary,
sharedToolbarMore: sharedConsumerFavToolbarMore,
sharedContextMenu: sharedConsumerFavContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileShared = {
name: `file-shared-${Utils.random()}.txt`,
description: 'file shared, not fav, not office, not locked',
contextMenu: consumerSharedContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
sharedToolbarMore: sharedConsumerToolbarMore,
sharedContextMenu: sharedConsumerContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileSharedFav = {
name: `file-shared-fav-${Utils.random()}.txt`,
description: 'file shared, fav, not office, not locked',
contextMenu: consumerSharedFavContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerSharedContextMenu,
favoritesToolbarPrimary: favoritesConsumerSharedToolbarPrimary,
sharedToolbarMore: sharedConsumerFavToolbarMore,
sharedContextMenu: sharedConsumerFavContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileLocked = {
name: `file-locked-${Utils.random()}.txt`,
description: 'file not shared, not fav, not office, locked',
contextMenu: consumerContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileFavLocked = {
name: `file-fav-locked-${Utils.random()}.txt`,
description: 'file not shared, fav, not office, locked',
contextMenu: consumerFavContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerContextMenu,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileSharedLocked = {
name: `file-shared-locked-${Utils.random()}.txt`,
description: 'file shared, not fav, not office, locked',
contextMenu: consumerSharedContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
sharedToolbarMore: sharedConsumerToolbarMore,
sharedContextMenu: sharedConsumerContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileSharedFavLocked = {
name: `file-shared-fav-locked-${Utils.random()}.txt`,
description: 'file shared, fav, not office, locked',
contextMenu: consumerSharedFavContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerSharedContextMenu,
favoritesToolbarPrimary: favoritesConsumerSharedToolbarPrimary,
sharedToolbarMore: sharedConsumerFavToolbarMore,
sharedContextMenu: sharedConsumerFavContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
// ---- folders ---
const consumerFolderContextMenu = ['Download', 'Favorite', 'Copy'];
const consumerFolderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const consumerFolderToolbarMore = ['Favorite', 'Copy'];
const searchConsumerFolderToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions'];
const consumerFolderFavContextMenu = ['Download', 'Remove Favorite', 'Copy'];
const consumerFolderFavToolbarMore = ['Remove Favorite', 'Copy'];
// ---- FAVORITES workarounds ----
// TODO: remove 'Edit', 'Move' and 'Delete' when ACA-1737 is done
const favoritesConsumerFolderContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
// TODO: remove 'Edit', 'Move' and 'Delete' when ACA-1737 is done
const favoritesConsumerFolderToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
export const folder = {
name: `folder-${Utils.random()}`,
description: 'folder not favorite',
contextMenu: consumerFolderContextMenu,
toolbarPrimary: consumerFolderToolbarPrimary,
toolbarMore: consumerFolderToolbarMore,
searchToolbarPrimary: searchConsumerFolderToolbarPrimary
};
export const folderFav = {
name: `folder-fav-${Utils.random()}`,
description: 'folder favorite',
contextMenu: consumerFolderFavContextMenu,
toolbarPrimary: consumerFolderToolbarPrimary,
toolbarMore: consumerFolderFavToolbarMore,
favoritesContextMenu: favoritesConsumerFolderContextMenu,
favoritesToolbarMore: favoritesConsumerFolderToolbarMore,
searchToolbarPrimary: searchConsumerFolderToolbarPrimary,
};
export const folderFav2 = {
name: `folder-fav-2-${Utils.random()}`,
description: 'folder 2 favorite'
};
// ---- multiple selection ---
const multipleSelContextMenu = ['Download', 'Favorite', 'Copy'];
const multipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Copy'];
const multipleSelToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const multipleSelToolbarMore = ['Favorite', 'Copy'];
const multipleSelAllFavToolbarMore = ['Remove Favorite', 'Copy'];
const searchMultipleSelToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions'];
// ---- FAVORITES workarounds ----
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
const favoritesMultipleSelContextMenu = ['Download', 'Favorite', 'Move', 'Copy', 'Delete'];
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
const favoritesMultipleSelToolbarMore = ['Favorite', 'Move', 'Copy', 'Delete'];
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
const favoritesMultipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
// TODO: remove 'Move' and 'Delete' when ACA-1737 is done
const favoritesMultipleSelAllFavToolbarMore = ['Remove Favorite', 'Move', 'Copy', 'Delete'];
export const multipleSel = {
contextMenu: multipleSelContextMenu,
toolbarPrimary: multipleSelToolbarPrimary,
toolbarMore: multipleSelToolbarMore,
favoritesContextMenu: favoritesMultipleSelContextMenu,
favoritesToolbarMore: favoritesMultipleSelToolbarMore,
searchToolbarPrimary: searchMultipleSelToolbarPrimary
}
export const multipleSelAllFav = {
contextMenu: multipleSelAllFavContextMenu,
toolbarPrimary: multipleSelToolbarPrimary,
toolbarMore: multipleSelAllFavToolbarMore,
favoritesContextMenu: favoritesMultipleSelAllFavContextMenu,
favoritesToolbarMore: favoritesMultipleSelAllFavToolbarMore,
searchToolbarPrimary: searchMultipleSelToolbarPrimary
}
+102
View File
@@ -0,0 +1,102 @@
import { BrowsingPage } from '../../pages/pages';
import { Viewer } from '../../components/viewer/viewer';
import { Utils } from '../../utilities/utils';
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const contextMenu = dataTable.menu;
const viewer = new Viewer();
export async function checkContextMenu(item: string, expectedContextMenu: string[]) {
await dataTable.rightClickOnItem(item);
const actualActions = await contextMenu.getMenuItems();
expect(actualActions.length).toBe(expectedContextMenu.length, 'Incorrect number of context menu items');
expect(JSON.stringify(actualActions)).toEqual(JSON.stringify(expectedContextMenu), 'Incorrect context menu actions');
}
export async function checkToolbarPrimary(item: string, expectedToolbarPrimary: string[]) {
await dataTable.selectItem(item);
const actualPrimaryActions = await toolbar.getButtons();
expect(actualPrimaryActions.length).toBe(expectedToolbarPrimary.length, 'Incorrect number of toolbar primary items');
expect(JSON.stringify(actualPrimaryActions)).toEqual(JSON.stringify(expectedToolbarPrimary), 'Incorrect toolbar primary actions');
}
export async function checkToolbarMoreActions(item: string, expectedToolbarMore: string[]) {
await dataTable.selectItem(item);
await toolbar.openMoreMenu();
const actualMoreActions = await toolbar.menu.getMenuItems();
expect(actualMoreActions.length).toBe(expectedToolbarMore.length, 'Incorrect number of toolbar More menu items');
expect(JSON.stringify(actualMoreActions)).toEqual(JSON.stringify(expectedToolbarMore), 'Incorrect toolbar More actions');
await toolbar.closeMoreMenu();
}
export async function checkMultipleSelContextMenu(items: string[], expectedContextMenu: string[]) {
await dataTable.selectMultipleItems(items);
await dataTable.rightClickOnMultipleSelection();
const actualActions = await contextMenu.getMenuItems();
expect(actualActions.length).toBe(expectedContextMenu.length, 'Incorrect number of context menu items');
expect(JSON.stringify(actualActions)).toEqual(JSON.stringify(expectedContextMenu), 'Incorrect context menu actions');
}
export async function checkMultipleSelToolbarPrimary(items: string[], expectedToolbarPrimary: string[]) {
await dataTable.selectMultipleItems(items);
const actualPrimaryActions = await toolbar.getButtons();
expect(actualPrimaryActions.length).toBe(expectedToolbarPrimary.length, 'Incorrect number of toolbar primary items');
expect(JSON.stringify(actualPrimaryActions)).toEqual(JSON.stringify(expectedToolbarPrimary), 'Incorrect toolbar primary actions');
}
export async function checkMultipleSelToolbarMoreActions(items: string[], expectedToolbarMore: string[]) {
await dataTable.selectMultipleItems(items);
await toolbar.openMoreMenu();
const actualMoreActions = await toolbar.menu.getMenuItems();
expect(actualMoreActions.length).toBe(expectedToolbarMore.length, 'Incorrect number of toolbar More menu items');
expect(JSON.stringify(actualMoreActions)).toEqual(JSON.stringify(expectedToolbarMore), 'Incorrect toolbar More actions');
await toolbar.closeMoreMenu();
}
export async function checkViewerToolbarPrimaryActions(item: string, expectedToolbarPrimary: string[]) {
await dataTable.doubleClickOnRowByName(item);
await viewer.waitForViewerToOpen();
let actualPrimaryActions = await toolbar.getButtons();
actualPrimaryActions = removeClosePreviousNextOldInfo(actualPrimaryActions);
expect(actualPrimaryActions.length).toBe(expectedToolbarPrimary.length, 'Incorrect number of viewer toolbar primary items');
expect(JSON.stringify(actualPrimaryActions)).toEqual(JSON.stringify(expectedToolbarPrimary), 'Incorrect viewer toolbar primary actions');
await Utils.pressEscape();
}
export async function checkViewerToolbarMoreActions(item: string, expectedToolbarMore: string[]) {
await dataTable.doubleClickOnRowByName(item);
await viewer.waitForViewerToOpen();
await toolbar.openMoreMenu();
const actualMoreActions = await toolbar.menu.getMenuItems();
expect(actualMoreActions.length).toBe(expectedToolbarMore.length, 'Incorrect number of toolbar More menu items');
expect(JSON.stringify(actualMoreActions)).toEqual(JSON.stringify(expectedToolbarMore), 'Incorrect toolbar More actions');
await toolbar.closeMoreMenu();
await Utils.pressEscape();
}
function removeClosePreviousNextOldInfo(actions: string[]) {
return actions.filter(elem => {
if ( (elem !== 'Close') && (elem !== 'Previous File') && (elem !== 'Next File') && (elem !== 'View details')) {
return elem;
}
});
}
@@ -1,656 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages';
import { SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Context menu actions - multiple selection : ', () => {
const username = `user-${Utils.random()}`;
const parent = `parent=${Utils.random()}`; let parentId;
const file1 = `my-file1-${Utils.random()}.txt`; let file1Id;
const file2 = `my-file2-${Utils.random()}.txt`; let file2Id;
const fileLocked1 = `my-fileLocked1-${Utils.random()}.txt`; let fileLocked1Id;
const fileLocked2 = `my-fileLocked2-${Utils.random()}.txt`; let fileLocked2Id;
const folder1 = `my-folder1-${Utils.random()}`; let folder1Id;
const folder2 = `my-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 = `my-inSite-file1-${Utils.random()}.txt`;
const file2Site = `my-inSite-file2-${Utils.random()}.txt`;
const fileLocked1Site = `my-inSite-fileLocked1-${Utils.random()}.txt`; let fileLocked1SiteId;
const fileLocked2Site = `my-inSite-fileLocked2-${Utils.random()}.txt`; let fileLocked2SiteId;
const folder1Site = `my-inSite-folder1-${Utils.random()}`;
const folder2Site = `my-inSite-folder2-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const contextMenu = dataTable.menu;
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1, parentId)).entry.id;
folder2Id = (await apis.user.nodes.createFolder(folder2, parentId)).entry.id;
fileLocked1Id = (await apis.user.nodes.createFile(fileLocked1, parentId)).entry.id;
fileLocked2Id = (await apis.user.nodes.createFile(fileLocked2, parentId)).entry.id;
await apis.user.nodes.lockFile(fileLocked1Id);
await apis.user.nodes.lockFile(fileLocked2Id);
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.createFolder(folder2Site, docLibId);
fileLocked1SiteId = (await apis.user.nodes.createFile(fileLocked1Site, docLibId)).entry.id;
fileLocked2SiteId = (await apis.user.nodes.createFile(fileLocked2Site, docLibId)).entry.id;
await apis.user.nodes.lockFile(fileLocked1SiteId);
await apis.user.nodes.lockFile(fileLocked2SiteId);
await apis.user.shared.shareFilesByIds([ file1Id, file2Id, fileLocked1Id, fileLocked2Id ]);
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.favorites.addFavoritesByIds('file', [ file1Id, file2Id, fileLocked1Id, fileLocked2Id ]);
await apis.user.favorites.addFavoritesByIds('folder', [ folder1Id, folder2Id ]);
await apis.user.favorites.waitForApi({ expect: 6 + 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.deleteNodeById(parentId);
await apis.user.sites.deleteSite(siteName);
await apis.user.trashcan.emptyTrash();
done();
});
describe('Generic tests', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu appears on right click on a multiple selection of items - [C286268]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
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.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`);
expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`);
expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`);
expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`);
});
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForBody();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280661]', async () => {
await dataTable.selectMultipleItems([file1, file2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple locked files are selected - [C297627]', async () => {
await dataTable.selectMultipleItems([fileLocked1, fileLocked2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple folders are selected - [C280632]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is 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.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280641]', async () => {
await dataTable.selectMultipleItems([ file1Site, file2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple locked files are selected - [C297628]', async () => {
await dataTable.selectMultipleItems([ fileLocked1Site, fileLocked2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple folders are selected - [C280574]', async () => {
await dataTable.selectMultipleItems([ folder1Site, folder2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is 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.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
await dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280648]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is not displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple locked files are selected - [C297629]', async () => {
await dataTable.selectMultipleItems([ fileLocked1, fileLocked2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is not displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
describe('Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickRecentFilesAndWait();
await dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280652]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple locked files are selected - [C297630]', async () => {
await dataTable.selectMultipleItems([ fileLocked1, fileLocked2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
describe('Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
await dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280656]', async () => {
await dataTable.selectMultipleItems([ file1, file2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple locked files are selected - [C297631]', async () => {
await dataTable.selectMultipleItems([ fileLocked1, fileLocked2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple folders are selected - [C280664]', async () => {
await dataTable.selectMultipleItems([ folder1, folder2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is 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.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
describe('Trash', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickTrashAndWait();
await dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C286273]', async () => {
await dataTable.selectMultipleItems([ fileInTrash1, fileInTrash2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isPermanentDeletePresent()).toBe(true, 'Permanently delete is not displayed');
expect(await contextMenu.isRestorePresent()).toBe(true, 'Restore is not displayed');
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(false, 'Download is displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(false, `Copy is displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(false, `Favorite is displayed`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple folders are selected - [C286274]', async () => {
await dataTable.selectMultipleItems([ folderInTrash1, folderInTrash2 ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isPermanentDeletePresent()).toBe(true, 'Permanently delete is not displayed');
expect(await contextMenu.isRestorePresent()).toBe(true, 'Restore is not displayed');
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(false, 'Download is displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(false, `Copy is displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(false, `Favorite is displayed`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version 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.isPermanentDeletePresent()).toBe(true, 'Permanently delete is not displayed');
expect(await contextMenu.isRestorePresent()).toBe(true, 'Restore is not displayed');
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(false, 'Download is displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(false, `Copy is displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isFavoritePresent()).toBe(false, `Favorite is displayed`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
describe('on Search Results', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C291831]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions('my-inSite-file');
await dataTable.selectMultipleItems([ file1Site, file2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isToggleFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple locked files are selected - [C297632]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions('my-inSite-file');
await dataTable.selectMultipleItems([ fileLocked1Site, fileLocked2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isToggleFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when multiple folders are selected - [C291832]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchForTextAndCloseSearchOptions('my-inSite-folder');
await dataTable.selectMultipleItems([ folder1Site, folder2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isToggleFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
it('correct actions appear when both files and folders are selected - [C291833]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchForTextAndCloseSearchOptions('my-inSite-f');
await dataTable.selectMultipleItems([ file1Site, file2Site, folder1Site, folder2Site ]);
await dataTable.rightClickOnMultipleSelection();
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await contextMenu.isViewPresent()).toBe(false, 'View is displayed');
expect(await contextMenu.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await contextMenu.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed`);
expect(await contextMenu.isToggleFavoritePresent()).toBe(true, `Toggle favorite is not displayed`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
});
});
});
@@ -1,697 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages';
import { SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
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 fileLocked = `fileLocked-${Utils.random()}.txt`; let fileLockedId;
const siteName = `userSite-${Utils.random()}`;
const fileSiteUser = `fileUser-${Utils.random()}.txt`;
const fileLockedInSite = `file-locked-site-${Utils.random()}.txt`; let fileLockedInSiteId;
const folderSiteUser = `folderUser-${Utils.random()}`;
const adminPublic = `admin-public-${Utils.random()}`;
const adminModerated = `admin-moderated-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const contextMenu = dataTable.menu;
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
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;
fileLockedId = (await apis.user.nodes.createFile(fileLocked)).entry.id;
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFile(fileSiteUser, docLibId);
fileLockedInSiteId = (await apis.user.nodes.createFile(fileLockedInSite, docLibId)).entry.id;
await apis.user.nodes.createFolder(folderSiteUser, docLibId);
await apis.user.nodes.lockFile(fileLockedInSiteId);
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.shareFileById(fileLockedId);
await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.favorites.addFavoriteById('file', fileUserId);
await apis.user.favorites.addFavoriteById('file', fileLockedId);
await apis.user.favorites.addFavoriteById('folder', folderUserId);
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.admin.sites.createSite(adminPublic);
await apis.admin.sites.createSite(adminModerated, SITE_VISIBILITY.MODERATED);
await apis.user.favorites.addFavoriteById('site', adminPublic);
await apis.user.favorites.addFavoriteById('site', adminModerated);
await apis.user.sites.requestToJoin(adminModerated);
await apis.user.queries.waitForSites(siteName, { expect: 1 });
await apis.user.queries.waitForSites(adminPublic, { expect: 1 });
await apis.user.queries.waitForSites(adminModerated, { expect: 1 });
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.admin.sites.deleteSite(adminPublic);
await apis.admin.sites.deleteSite(adminModerated);
await apis.user.trashcan.emptyTrash();
done();
});
describe('Generic tests', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
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.isEditFolderPresent()).toBe(true, `Edit folder 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.getActiveLink().click();
expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed');
});
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
await dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C280615]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await contextMenu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions is not displayed for ${fileUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileUser}`);
});
it('Context menu has the correct actions for a locked file - [C297633]', async () => {
await dataTable.rightClickOnItem(fileLocked);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileLocked}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions is not displayed for ${fileLocked}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileLocked}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileLocked}`);
});
it('Context menu has the correct actions for a folder - [C280616]', async () => {
await dataTable.rightClickOnItem(folderUser);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${folderUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderUser}`);
expect(await contextMenu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${folderUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${folderUser}`);
expect(await contextMenu.isViewPresent()).toBe(false, `View is displayed for ${folderUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage Versions is displayed for ${folderUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderUser}`);
expect(await contextMenu.isSharePresent()).toBe(false, `Share is displayed for ${folderUser}`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderUser}`);
});
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C280594]', async () => {
await dataTable.rightClickOnItem(fileSiteUser);
expect(await contextMenu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileSiteUser}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileSiteUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileSiteUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileSiteUser}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileSiteUser}`);
});
it('Context menu has the correct actions for a locked file - [C297634]', async () => {
await dataTable.rightClickOnItem(fileLockedInSite);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(true, `Cancel editing is displayed for ${fileLockedInSite}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileLockedInSite}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLockedInSite}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileLockedInSite}`);
});
it('Context menu has the correct actions for a folder - [C280595]', async () => {
await dataTable.rightClickOnItem(folderSiteUser);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isFavoritePresent()).toBe(true, `Favorite is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isViewPresent()).toBe(false, `View is displayed for ${folderSiteUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage Versions displayed for ${folderSiteUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version displayed for ${folderSiteUser}`);
expect(await contextMenu.isSharePresent()).toBe(false, `Share is displayed for ${folderSiteUser}`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderSiteUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderSiteUser}`);
});
});
describe('on a library', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Available actions for a library - My Libraries - [C290080]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.rightClickOnItem(siteName);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isLeaveLibraryPresent()).toBe(true, `Leave is not displayed for ${siteName}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${siteName}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${siteName}`);
});
it('Available actions for a library - Favorite Libraries - user is a member - [C290081]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.rightClickOnItem(siteName);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isLeaveLibraryPresent()).toBe(true, `Leave is not displayed for ${siteName}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${siteName}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${siteName}`);
});
it('Available actions for a library - Favorite Libraries - user is not a member - [C290082]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.rightClickOnItem(adminPublic);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isJoinLibraryPresent()).toBe(true, `Join is not displayed for ${adminPublic}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminPublic}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${adminPublic}`);
});
it('Available actions for a moderated library - Favorite Libraries - user requested to join - [C290089]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.rightClickOnItem(adminModerated);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isCancelJoinPresent()).toBe(true, `Cancel join is not displayed for ${adminModerated}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminModerated}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${adminModerated}`);
});
it('Available actions for a library - Search Results - user is a member - [C291812]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchForTextAndCloseSearchOptions(siteName);
await dataTable.rightClickOnItem(siteName);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isLeaveLibraryPresent()).toBe(true, `Leave is not displayed for ${siteName}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${siteName}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${siteName}`);
});
it('Available actions for a library - Search Results - user is not a member - [C291813]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchForTextAndCloseSearchOptions(adminPublic);
await dataTable.rightClickOnItem(adminPublic);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isJoinLibraryPresent()).toBe(true, `Join is not displayed for ${adminPublic}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminPublic}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${adminPublic}`);
});
it('Available actions for a moderated library - Search Results - user requested to join - [C291814]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchForTextAndCloseSearchOptions(adminModerated);
await dataTable.rightClickOnItem(adminModerated);
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
expect(await contextMenu.isCancelJoinPresent()).toBe(true, `Cancel join is not displayed for ${adminModerated}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminModerated}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${adminModerated}`);
});
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C280601]', async () => {
await dataTable.rightClickOnItem(fileUser);
// TODO: change expect to true when ACA-2173 is done
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed for ${fileUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileUser}`);
});
it('Context menu has the correct actions for a locked file - [C297635]', async () => {
await dataTable.rightClickOnItem(fileLocked);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2173 is done
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileLocked}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileLocked}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await contextMenu.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed for ${fileLocked}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileLocked}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileLocked}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileLocked}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileLocked}`);
});
});
describe('on Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickRecentFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C280622]', async () => {
await dataTable.rightClickOnItem(fileUser);
expect(await contextMenu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileUser}`);
});
it('Context menu has the correct actions for a locked file - [C297636]', async () => {
await dataTable.rightClickOnItem(fileLocked);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileLocked}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileLocked}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileLocked}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileLocked}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileLocked}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileLocked}`);
});
});
describe('on Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C280608]', async () => {
await dataTable.rightClickOnItem(fileUser);
// TODO: change expect to true when ACA-2174 is done
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions is not displayed for ${fileUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileUser}`);
});
it('Context menu has the correct actions for a locked file - [C297637]', async () => {
await dataTable.rightClickOnItem(fileLocked);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2174 is done
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileLocked}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileLocked}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileLocked}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions is not displayed for ${fileLocked}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileLocked}`);
});
it('Context menu has the correct actions for a folder - [C280609]', async () => {
await dataTable.rightClickOnItem(folderUser);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${folderUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderUser}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${folderUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await contextMenu.isMovePresent()).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await contextMenu.isDeletePresent()).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await contextMenu.isViewPresent()).toBe(false, `View is displayed for ${folderUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage Versions is displayed for ${folderUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderUser}`);
expect(await contextMenu.isSharePresent()).toBe(false, `Share is displayed for ${folderUser}`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderUser}`);
});
});
describe('on Trash', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C286258]', async () => {
await dataTable.rightClickOnItem(fileInTrash);
expect(await contextMenu.isPermanentDeletePresent()).toBe(true, `Permanently delete is not displayed for ${fileInTrash}`);
expect(await contextMenu.isRestorePresent()).toBe(true, `Restore is not displayed for ${fileInTrash}`);
expect(await contextMenu.isDownloadPresent()).toBe(false, `Download is displayed for ${fileInTrash}`);
expect(await contextMenu.isViewPresent()).toBe(false, `View is displayed for ${fileInTrash}`);
expect(await contextMenu.isFavoritePresent()).toBe(false, `Favorite is displayed for ${fileInTrash}`);
expect(await contextMenu.isCopyPresent()).toBe(false, `Copy is displayed for ${fileInTrash}`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed for ${fileInTrash}`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileInTrash}`);
expect(await contextMenu.isSharePresent()).toBe(false, `Share is displayed for ${fileInTrash}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage Versions is displayed for ${fileInTrash}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${fileInTrash}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileInTrash}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileInTrash}`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileInTrash}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileInTrash}`);
});
it('Context menu has the correct actions for a folder - [C286259]', async () => {
await dataTable.rightClickOnItem(folderInTrash);
expect(await contextMenu.isPermanentDeletePresent()).toBe(true, `Permanently delete is not displayed for ${folderInTrash}`);
expect(await contextMenu.isRestorePresent()).toBe(true, `Restore is not displayed for ${folderInTrash}`);
expect(await contextMenu.isDownloadPresent()).toBe(false, `Download is displayed for ${folderInTrash}`);
expect(await contextMenu.isViewPresent()).toBe(false, `View is displayed for ${folderInTrash}`);
expect(await contextMenu.isFavoritePresent()).toBe(false, `Favorite is displayed for ${folderInTrash}`);
expect(await contextMenu.isCopyPresent()).toBe(false, `Copy is displayed for ${folderInTrash}`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed for ${folderInTrash}`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed for ${folderInTrash}`);
expect(await contextMenu.isSharePresent()).toBe(false, `Share is displayed for ${folderInTrash}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage Versions is displayed for ${folderInTrash}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderInTrash}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${folderInTrash}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${folderInTrash}`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderInTrash}`);
});
});
describe('on Search Results', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Context menu has the correct actions for a file - [C291827]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions(fileSiteUser);
await dataTable.rightClickOnItem(fileSiteUser);
expect(await contextMenu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileSiteUser}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isToggleFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed for ${fileSiteUser}`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileSiteUser}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileSiteUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileSiteUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileSiteUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileSiteUser}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileSiteUser}`);
});
it('Context menu has the correct actions for a locked file - [C297638]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions(fileLocked);
await dataTable.rightClickOnItem(fileLocked);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await contextMenu.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await contextMenu.isToggleRemoveFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${fileLocked}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`);
expect(await contextMenu.isSharePresent()).toBe(true, `Share is not displayed for ${fileLocked}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(true, `Manage Versions not displayed for ${fileLocked}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(true, `Upload new version not displayed for ${fileLocked}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${fileLocked}`);
expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await contextMenu.isViewDetailsPresent()).toBe(false, `View details is displayed for ${fileLocked}`);
});
it('Context menu has the correct actions for a folder - [C291828]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchForTextAndCloseSearchOptions(folderSiteUser);
await dataTable.rightClickOnItem(folderSiteUser);
expect(await contextMenu.isDownloadPresent()).toBe(true, `Download is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isToggleFavoritePresent()).toBe(true, `Toggle favorite is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isMovePresent()).toBe(false, `Move is displayed for ${folderSiteUser}`);
expect(await contextMenu.isDeletePresent()).toBe(false, `Delete is displayed for ${folderSiteUser}`);
expect(await contextMenu.isManagePermissionsPresent()).toBe(true, `Permissions is not displayed for ${folderSiteUser}`);
expect(await contextMenu.isViewPresent()).toBe(false, `View is displayed for ${folderSiteUser}`);
expect(await contextMenu.isManageVersionsPresent()).toBe(false, `Manage Versions displayed for ${folderSiteUser}`);
expect(await contextMenu.isUploadNewVersionPresent()).toBe(false, `Upload new version displayed for ${folderSiteUser}`);
expect(await contextMenu.isSharePresent()).toBe(false, `Share is displayed for ${folderSiteUser}`);
expect(await contextMenu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderSiteUser}`);
expect(await contextMenu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderSiteUser}`);
});
});
});
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -273,7 +273,7 @@ describe('Download', () => {
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchForTextAndCloseSearchOptions('*Search*'); await searchInput.searchFor('*Search*');
done(); done();
}); });
+59 -2
View File
@@ -39,7 +39,8 @@ describe('Edit folder', () => {
const folderNameToEdit = `folder-${Utils.random()}`; const folderNameToEdit = `folder-${Utils.random()}`;
const duplicateFolderName = `folder-${Utils.random()}`; const duplicateFolderName = `folder-${Utils.random()}`;
const folderNameEdited = `folder-${Utils.random()}`; const folderNameEdited = `folder-renamed-${Utils.random()}`;
const folderNameEdited2 = `folder-search-renamed-${Utils.random()}`;
const folderDescriptionEdited = 'description edited'; const folderDescriptionEdited = 'description edited';
const sitePrivate = `site-private-${Utils.random()}`; const sitePrivate = `site-private-${Utils.random()}`;
@@ -54,6 +55,10 @@ describe('Edit folder', () => {
const folderFavoriteToEdit = `folder-fav-${Utils.random()}`; let folderFavoriteToEditId; const folderFavoriteToEdit = `folder-fav-${Utils.random()}`; let folderFavoriteToEditId;
const folderFavoriteDuplicate = `folder-fav-${Utils.random()}`; let folderFavoriteDuplicateId; const folderFavoriteDuplicate = `folder-fav-${Utils.random()}`; let folderFavoriteDuplicateId;
const folderSearch = `folder-search-${Utils.random()}`;
const folderSearchToEdit = `folder-search-${Utils.random()}`; let folderSearchToEditId;
const folderSearchDuplicate = `folder-search-${Utils.random()}`;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, username) user: new RepoClient(username, username)
@@ -63,6 +68,7 @@ describe('Edit folder', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const editDialog = new CreateOrEditFolderDialog(); const editDialog = new CreateOrEditFolderDialog();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -86,6 +92,10 @@ describe('Edit folder', () => {
folderFavoriteToEditId = (await apis.user.nodes.createFolder(folderFavoriteToEdit)).entry.id; folderFavoriteToEditId = (await apis.user.nodes.createFolder(folderFavoriteToEdit)).entry.id;
folderFavoriteDuplicateId = (await apis.user.nodes.createFolder(folderFavoriteDuplicate)).entry.id; folderFavoriteDuplicateId = (await apis.user.nodes.createFolder(folderFavoriteDuplicate)).entry.id;
await apis.user.nodes.createFolder(folderSearch);
folderSearchToEditId = (await apis.user.nodes.createFolder(folderSearchToEdit)).entry.id;
await apis.user.nodes.createFolder(folderSearchDuplicate);
await apis.user.favorites.addFavoriteById('folder', folderFavoriteId); await apis.user.favorites.addFavoriteById('folder', folderFavoriteId);
await apis.user.favorites.addFavoriteById('folder', folderFavoriteToEditId); await apis.user.favorites.addFavoriteById('folder', folderFavoriteToEditId);
await apis.user.favorites.addFavoriteById('folder', folderFavoriteDuplicateId); await apis.user.favorites.addFavoriteById('folder', folderFavoriteDuplicateId);
@@ -98,7 +108,7 @@ describe('Edit folder', () => {
await Promise.all([ await Promise.all([
apis.admin.sites.deleteSite(sitePrivate), apis.admin.sites.deleteSite(sitePrivate),
apis.user.sites.deleteSite(siteName), apis.user.sites.deleteSite(siteName),
apis.user.nodes.deleteNodesById([ parentId, folderFavoriteToEditId, folderFavoriteDuplicateId ]) apis.user.nodes.deleteNodesById([ parentId, folderFavoriteToEditId, folderFavoriteDuplicateId, folderSearchToEditId ])
]); ]);
done(); done();
}); });
@@ -288,4 +298,51 @@ describe('Edit folder', () => {
expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present');
}); });
}); });
describe('on Search Results', () => {
beforeAll(async (done) => {
await apis.user.search.waitForNodes('folder-search', { expect: 3 });
done();
});
it('properties are modified when pressing OK - [C306947]', async () => {
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchFor(folderSearchToEdit);
await dataTable.waitForBody();
await dataTable.selectItem(folderSearchToEdit);
await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder();
await editDialog.waitForDialogToOpen();
await editDialog.enterDescription(folderDescriptionEdited);
await editDialog.enterName(folderNameEdited2);
await editDialog.clickUpdate();
await editDialog.waitForDialogToClose();
await page.refresh();
expect(await dataTable.isItemPresent(folderNameEdited2)).toBe(true, 'Folder not displayed');
const desc = await apis.user.nodes.getNodeProperty(folderSearchToEditId, 'cm:description');
expect(desc).toEqual(folderDescriptionEdited);
});
it('with duplicate folder name - [C306948]', async () => {
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchFor(folderSearch);
await dataTable.waitForBody();
await dataTable.selectItem(folderSearch);
await toolbar.openMoreMenu();
await toolbar.menu.clickEditFolder();
await editDialog.waitForDialogToOpen();
await editDialog.enterName(folderSearchDuplicate);
await editDialog.clickUpdate();
expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present');
});
});
}); });
+68 -6
View File
@@ -35,10 +35,15 @@ describe('Edit offline', () => {
const fileLocked = `file-locked-${Utils.random()}.docx`; let fileLockedId; const fileLocked = `file-locked-${Utils.random()}.docx`; let fileLockedId;
const fileLocked2 = `file-locked2-${Utils.random()}.docx`; let fileLocked2Id; const fileLocked2 = `file-locked2-${Utils.random()}.docx`; let fileLocked2Id;
const fileSearch1 = `file-search-1-${Utils.random()}.docx`; let fileSearch1Id;
const fileSearchLocked = `file-search-locked-${Utils.random()}.docx`; let fileSearchLockedId;
const fileSearchLocked2 = `file-search-locked2-${Utils.random()}.docx`; let fileSearchLocked2Id;
const parentPF = `parentPersonal-${Utils.random()}`; let parentPFId; const parentPF = `parentPersonal-${Utils.random()}`; let parentPFId;
const parentSF = `parentShared-${Utils.random()}`; let parentSFId; const parentSF = `parentShared-${Utils.random()}`; let parentSFId;
const parentRF = `parentRecent-${Utils.random()}`; let parentRFId; const parentRF = `parentRecent-${Utils.random()}`; let parentRFId;
const parentFav = `parentFav-${Utils.random()}`; let parentFavId; const parentFav = `parentFav-${Utils.random()}`; let parentFavId;
const parentSearch = `parentSearch-${Utils.random()}`; let parentSearchId;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
@@ -48,6 +53,7 @@ describe('Edit offline', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -56,6 +62,7 @@ describe('Edit offline', () => {
parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id; parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id;
parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id; parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id;
parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id; parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id;
parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id;
done(); done();
}); });
@@ -65,6 +72,7 @@ describe('Edit offline', () => {
await apis.user.nodes.deleteNodeById(parentSFId); await apis.user.nodes.deleteNodeById(parentSFId);
await apis.user.nodes.deleteNodeById(parentRFId); await apis.user.nodes.deleteNodeById(parentRFId);
await apis.user.nodes.deleteNodeById(parentFavId); await apis.user.nodes.deleteNodeById(parentFavId);
await apis.user.nodes.deleteNodeById(parentSearchId);
done(); done();
}); });
@@ -143,7 +151,7 @@ describe('Edit offline', () => {
done(); done();
}); });
xit('File is locked and downloaded when clicking Edit Offline - []', async () => { xit('File is locked and downloaded when clicking Edit Offline - [C306950]', async () => {
await dataTable.selectItem(file1, parentSF); await dataTable.selectItem(file1, parentSF);
await toolbar.clickMoreActionsEditOffline(); await toolbar.clickMoreActionsEditOffline();
@@ -151,13 +159,13 @@ describe('Edit offline', () => {
expect(await apis.user.nodes.isFileLockedWrite(file1Id)).toBe(true, `${file1} is not locked`); expect(await apis.user.nodes.isFileLockedWrite(file1Id)).toBe(true, `${file1} is not locked`);
}); });
xit('Lock information is displayed - []', async () => { xit('Lock information is displayed - [C306951]', async () => {
expect(await dataTable.isItemPresent(fileLocked2, parentSF)).toBe(true, `${fileLocked2} is not displayed`); expect(await dataTable.isItemPresent(fileLocked2, parentSF)).toBe(true, `${fileLocked2} is not displayed`);
expect(await dataTable.hasLockIcon(fileLocked2, parentSF)).toBe(true, `${fileLocked2} does not have a lock icon`); expect(await dataTable.hasLockIcon(fileLocked2, parentSF)).toBe(true, `${fileLocked2} does not have a lock icon`);
expect(await dataTable.getLockOwner(fileLocked2, parentSF)).toContain(username, `${fileLocked2} does not have correct lock owner info`); expect(await dataTable.getLockOwner(fileLocked2, parentSF)).toContain(username, `${fileLocked2} does not have correct lock owner info`);
}); });
xit('Cancel Editing unlocks the file - []', async () => { xit('Cancel Editing unlocks the file - [C306952]', async () => {
await dataTable.selectItem(fileLocked); await dataTable.selectItem(fileLocked);
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
await dataTable.clearSelection(); await dataTable.clearSelection();
@@ -243,7 +251,7 @@ describe('Edit offline', () => {
done(); done();
}); });
xit('File is locked and downloaded when clicking Edit Offline - []', async () => { xit('File is locked and downloaded when clicking Edit Offline - [C306956]', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await toolbar.clickMoreActionsEditOffline(); await toolbar.clickMoreActionsEditOffline();
@@ -251,13 +259,13 @@ describe('Edit offline', () => {
expect(await apis.user.nodes.isFileLockedWrite(file1Id)).toBe(true, `${file1} is not locked`); expect(await apis.user.nodes.isFileLockedWrite(file1Id)).toBe(true, `${file1} is not locked`);
}); });
xit('Lock information is displayed - []', async () => { xit('Lock information is displayed - [C306957]', async () => {
expect(await dataTable.isItemPresent(fileLocked2)).toBe(true, `${fileLocked2} is not displayed`); expect(await dataTable.isItemPresent(fileLocked2)).toBe(true, `${fileLocked2} is not displayed`);
expect(await dataTable.hasLockIcon(fileLocked2)).toBe(true, `${fileLocked2} does not have a lock icon`); expect(await dataTable.hasLockIcon(fileLocked2)).toBe(true, `${fileLocked2} does not have a lock icon`);
expect(await dataTable.getLockOwner(fileLocked2)).toContain(username, `${fileLocked2} does not have correct lock owner info`); expect(await dataTable.getLockOwner(fileLocked2)).toContain(username, `${fileLocked2} does not have correct lock owner info`);
}); });
xit('Cancel Editing unlocks the file - []', async () => { xit('Cancel Editing unlocks the file - [C306958]', async () => {
await dataTable.selectItem(fileLocked); await dataTable.selectItem(fileLocked);
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
await dataTable.clearSelection(); await dataTable.clearSelection();
@@ -267,4 +275,58 @@ describe('Edit offline', () => {
}); });
}); });
describe('on Search Results', () => {
beforeAll(async (done) => {
fileSearch1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearch1)).entry.id;
fileSearchLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked)).entry.id;
fileSearchLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked2)).entry.id;
await apis.user.nodes.lockFile(fileSearchLockedId);
await apis.user.nodes.lockFile(fileSearchLocked2Id);
await apis.user.search.waitForNodes('file-search', { expect: 3 });
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('file-search');
await dataTable.waitForBody();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
it('File is locked and downloaded when clicking Edit Offline - [C306953]', async () => {
await dataTable.selectItem(fileSearch1);
await toolbar.clickMoreActionsEditOffline();
expect(await Utils.fileExistsOnOS(fileSearch1)).toBe(true, 'File not found in download location');
expect(await apis.user.nodes.isFileLockedWrite(fileSearch1Id)).toBe(true, `${fileSearch1} is not locked`);
});
// TODO: enable when ACA-2314 is fixed
xit('Lock information is displayed - [C306954]', async () => {
expect(await dataTable.isItemPresent(fileSearchLocked2, parentSearch)).toBe(true, `${fileSearchLocked2} is not displayed`);
expect(await dataTable.hasLockIcon(fileSearchLocked2, parentSearch)).toBe(true, `${fileSearchLocked2} does not have a lock icon`);
expect(await dataTable.getLockOwner(fileSearchLocked2, parentSearch)).toContain(username, `${fileSearchLocked2} does not have correct lock owner info`);
});
it('Cancel Editing unlocks the file - [C306955]', async () => {
await dataTable.selectItem(fileSearchLocked);
await toolbar.clickMoreActionsCancelEditing();
await dataTable.clearSelection();
expect(await apis.user.nodes.isFileLockedWrite(fileSearchLockedId)).toBe(false, `${fileSearchLocked} is still locked`);
// TODO: enable when ACA-2314 is fixed
// expect(await dataTable.hasLockIcon(fileSearchLocked, parentSearch)).toBe(false, `${fileSearchLocked} has a lock icon`);
});
});
}); });
+276 -28
View File
@@ -36,10 +36,26 @@ describe('Library actions', () => {
const sitePublic2Admin = `admin-public2-${Utils.random()}`; const sitePublic2Admin = `admin-public2-${Utils.random()}`;
const sitePublic3Admin = `admin-public3-${Utils.random()}`; const sitePublic3Admin = `admin-public3-${Utils.random()}`;
const sitePublic4Admin = `admin-public4-${Utils.random()}`; const sitePublic4Admin = `admin-public4-${Utils.random()}`;
const sitePublic5Admin = `admin-public5-${Utils.random()}`;
const sitePublic6Admin = `admin-public6-${Utils.random()}`;
const sitePublic7Admin = `admin-public7-${Utils.random()}`;
const sitePublic8Admin = `admin-public8-${Utils.random()}`;
const sitePublicUser = `user-public1-${Utils.random()}`;
const siteForDelete1 = `user-public2-${Utils.random()}`;
const siteForDelete2 = `user-public3-${Utils.random()}`;
const siteModerated1Admin = `admin-moderated1-${Utils.random()}`; const siteModerated1Admin = `admin-moderated1-${Utils.random()}`;
const siteModerated2Admin = `admin-moderated2-${Utils.random()}`; const siteModerated2Admin = `admin-moderated2-${Utils.random()}`;
const sitePublicUser = `user-public-${Utils.random()}`; const siteSearchModerated1Admin = `site-moderated-search-1-${Utils.random()}`;
const siteSearchModerated2Admin = `site-moderated-search-2-${Utils.random()}`;
const siteSearchPublic1Admin = `site-public-search-1-${Utils.random()}`;
const siteSearchPublic2Admin = `site-public-search-2-${Utils.random()}`;
const siteSearchPublic3Admin = `site-public-search-3-${Utils.random()}`;
const siteSearchPublic4Admin = `site-public-search-4-${Utils.random()}`;
const siteSearchForDelete = `site-public-search-5-${Utils.random()}`;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
@@ -49,30 +65,23 @@ describe('Library actions', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header;
const confirmDialog = new ConfirmDialog(); const confirmDialog = new ConfirmDialog();
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
await apis.admin.sites.createSite(sitePublic1Admin);
await apis.admin.sites.createSite(sitePublic2Admin);
await apis.admin.sites.createSite(sitePublic3Admin);
await apis.admin.sites.createSite(sitePublic4Admin);
await apis.admin.sites.createSite(siteModerated1Admin, SITE_VISIBILITY.MODERATED);
await apis.admin.sites.createSite(siteModerated2Admin, SITE_VISIBILITY.MODERATED);
await apis.user.sites.createSite(sitePublicUser); await apis.admin.sites.createSite(siteSearchPublic1Admin);
await apis.admin.sites.createSite(siteSearchPublic2Admin);
await apis.admin.sites.createSite(siteSearchPublic3Admin);
await apis.admin.sites.createSite(siteSearchPublic4Admin);
await apis.admin.sites.createSite(siteSearchModerated1Admin, SITE_VISIBILITY.MODERATED);
await apis.admin.sites.createSite(siteSearchModerated2Admin, SITE_VISIBILITY.MODERATED);
await apis.user.sites.createSite(siteSearchForDelete);
await apis.admin.sites.addSiteMember(sitePublic2Admin, username, SITE_ROLES.SITE_COLLABORATOR.ROLE); await apis.user.queries.waitForSites('site-public-search', { expect: 5 });
await apis.admin.sites.addSiteMember(sitePublic3Admin, username, SITE_ROLES.SITE_MANAGER.ROLE); await apis.user.queries.waitForSites('site-moderated-search', { expect: 2 });
await apis.admin.sites.addSiteMember(sitePublic4Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.user.favorites.addFavoriteById('site', sitePublic1Admin);
await apis.user.favorites.addFavoriteById('site', sitePublic3Admin);
await apis.user.favorites.addFavoriteById('site', siteModerated1Admin);
await apis.user.favorites.addFavoriteById('site', siteModerated2Admin);
await apis.user.sites.requestToJoin(siteModerated2Admin);
await loginPage.loginWith(username); await loginPage.loginWith(username);
done(); done();
@@ -80,22 +89,43 @@ describe('Library actions', () => {
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await Utils.pressEscape();
await dataTable.clearSelection(); await page.header.expandSideNav();
await page.clickPersonalFiles();
done(); done();
}); });
afterAll(async (done) => { afterAll(async (done) => {
await apis.admin.sites.deleteSite(sitePublic1Admin); await apis.admin.sites.deleteSite(sitePublic1Admin);
await apis.admin.sites.deleteSite(siteSearchPublic1Admin);
await apis.admin.sites.deleteSite(sitePublic2Admin); await apis.admin.sites.deleteSite(sitePublic2Admin);
await apis.admin.sites.deleteSite(sitePublic3Admin); await apis.admin.sites.deleteSite(sitePublic3Admin);
await apis.admin.sites.deleteSite(sitePublic4Admin); await apis.admin.sites.deleteSite(sitePublic4Admin);
await apis.admin.sites.deleteSite(sitePublic5Admin);
await apis.admin.sites.deleteSite(sitePublic6Admin);
await apis.admin.sites.deleteSite(sitePublic7Admin);
await apis.admin.sites.deleteSite(sitePublic8Admin);
await apis.admin.sites.deleteSite(siteSearchPublic2Admin);
await apis.admin.sites.deleteSite(siteSearchPublic3Admin);
await apis.admin.sites.deleteSite(siteSearchPublic4Admin);
await apis.admin.sites.deleteSite(siteModerated1Admin); await apis.admin.sites.deleteSite(siteModerated1Admin);
await apis.admin.sites.deleteSite(siteModerated2Admin); await apis.admin.sites.deleteSite(siteModerated2Admin);
await apis.admin.sites.deleteSite(siteSearchModerated1Admin);
await apis.admin.sites.deleteSite(siteSearchModerated2Admin);
await apis.user.sites.deleteSite(sitePublicUser); await apis.user.sites.deleteSite(sitePublicUser);
await apis.admin.trashcan.emptyTrash();
done(); done();
}); });
it('Join a public library - Favorite Libraries - [C290105]', async () => { describe('Join a public library', () => {
beforeAll(async done => {
await apis.admin.sites.createSite(sitePublic1Admin);
await apis.user.favorites.addFavoriteById('site', sitePublic1Admin);
done();
});
it('from Favorite Libraries - [C290105]', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(sitePublic1Admin); await dataTable.selectItem(sitePublic1Admin);
await toolbar.clickJoin(); await toolbar.clickJoin();
@@ -103,7 +133,30 @@ describe('Library actions', () => {
expect(await dataTable.getLibraryRole(sitePublic1Admin)).toEqual('Consumer'); expect(await dataTable.getLibraryRole(sitePublic1Admin)).toEqual('Consumer');
}); });
it('Join a moderated library - Favorite Libraries - [C290109]', async () => { it('from Search Results - [C306959]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic1Admin);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic1Admin);
await toolbar.clickJoin();
expect(await dataTable.getLibraryRole(siteSearchPublic1Admin)).toEqual('Consumer');
});
});
describe('Join a moderated library', () => {
beforeAll(async done => {
await apis.admin.sites.createSite(siteModerated1Admin, SITE_VISIBILITY.MODERATED);
await apis.user.favorites.addFavoriteById('site', siteModerated1Admin);
await apis.user.queries.waitForSites(siteSearchModerated1Admin, { expect: 1 });
done();
});
it('from Favorite Libraries - [C290109]', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(siteModerated1Admin); await dataTable.selectItem(siteModerated1Admin);
await toolbar.clickJoin(); await toolbar.clickJoin();
@@ -113,7 +166,41 @@ describe('Library actions', () => {
expect(hasJoinRequest).toBe(true, `Join request does not exist on ${siteModerated1Admin}`); expect(hasJoinRequest).toBe(true, `Join request does not exist on ${siteModerated1Admin}`);
}); });
it('Leave a library - My Libraries - [C290106]', async () => { it('from Search Results - [C306960]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchModerated1Admin);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchModerated1Admin);
await toolbar.clickJoin();
expect(await dataTable.getLibraryRole(siteSearchModerated1Admin)).toEqual('');
const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteSearchModerated1Admin);
expect(hasJoinRequest).toBe(true, `Join request does not exist on ${siteSearchModerated1Admin}`);
});
});
describe('Leave a library', () => {
beforeAll(async done => {
await apis.admin.sites.createSite(sitePublic2Admin);
await apis.admin.sites.createSite(sitePublic3Admin);
await apis.admin.sites.createSite(sitePublic4Admin);
await apis.admin.sites.createSite(sitePublic5Admin);
await apis.user.sites.createSite(sitePublicUser);
await apis.user.favorites.addFavoriteById('site', sitePublic3Admin);
await apis.admin.sites.addSiteMember(sitePublic2Admin, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await apis.admin.sites.addSiteMember(sitePublic3Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.admin.sites.addSiteMember(siteSearchPublic2Admin, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
await apis.admin.sites.addSiteMember(sitePublic4Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.admin.sites.addSiteMember(sitePublic5Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.user.queries.waitForSites(siteSearchPublic2Admin, { expect: 1 });
done();
});
it('from My Libraries - [C290106]', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic2Admin); await dataTable.selectItem(sitePublic2Admin);
await toolbar.clickLeave(); await toolbar.clickLeave();
@@ -124,7 +211,7 @@ describe('Library actions', () => {
expect(await dataTable.isItemPresent(sitePublic2Admin)).toBe(false, `${sitePublic2Admin} is displayed`); expect(await dataTable.isItemPresent(sitePublic2Admin)).toBe(false, `${sitePublic2Admin} is displayed`);
}); });
it('Leave a library - Favorite Libraries - [C290110]', async () => { it('from Favorite Libraries - [C290110]', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(sitePublic3Admin); await dataTable.selectItem(sitePublic3Admin);
await toolbar.clickLeave(); await toolbar.clickLeave();
@@ -135,6 +222,21 @@ describe('Library actions', () => {
expect(await dataTable.isItemPresent(sitePublic3Admin)).toBe(true, `${sitePublic3Admin} is not displayed`); expect(await dataTable.isItemPresent(sitePublic3Admin)).toBe(true, `${sitePublic3Admin} is not displayed`);
}); });
it('from Search Results - [C306961]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic2Admin);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic2Admin);
await toolbar.clickLeave();
await page.waitForDialog();
await confirmDialog.clickOk();
expect(await page.getSnackBarMessage()).toEqual(`You have left the library`);
expect(await dataTable.isItemPresent(siteSearchPublic2Admin)).toBe(true, `${siteSearchPublic2Admin} is not displayed`);
});
it('Confirmation dialog UI - [C290136]', async () => { it('Confirmation dialog UI - [C290136]', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic4Admin); await dataTable.selectItem(sitePublic4Admin);
@@ -148,15 +250,15 @@ describe('Library actions', () => {
expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled');
}); });
it('Cancel Leave library - [C290111]', async () => { it('Cancel Leave Library - [C290111]', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic4Admin); await dataTable.selectItem(sitePublic5Admin);
await toolbar.clickLeave(); await toolbar.clickLeave();
await page.waitForDialog(); await page.waitForDialog();
expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled');
await confirmDialog.clickCancel(); await confirmDialog.clickCancel();
expect(await dataTable.isItemPresent(sitePublic4Admin)).toBe(true, `${sitePublic4Admin} was deleted`); expect(await dataTable.isItemPresent(sitePublic5Admin)).toBe(true, `${sitePublic5Admin} was deleted`);
}); });
it('Leave a library - failure notification - [C290107]', async () => { it('Leave a library - failure notification - [C290107]', async () => {
@@ -168,11 +270,23 @@ describe('Library actions', () => {
expect(await page.getSnackBarMessage()).toEqual(`Cannot leave this library`); expect(await page.getSnackBarMessage()).toEqual(`Cannot leave this library`);
}); });
});
it('Cancel join - Favorite Libraries - [C290108]', async () => { describe('Cancel join', () => {
beforeAll(async done => {
await apis.admin.sites.createSite(siteModerated2Admin, SITE_VISIBILITY.MODERATED);
await apis.user.favorites.addFavoriteById('site', siteModerated2Admin);
await apis.user.sites.requestToJoin(siteModerated2Admin);
await apis.user.sites.requestToJoin(siteSearchModerated2Admin);
await apis.user.queries.waitForSites(siteSearchModerated2Admin, { expect: 1 });
done();
});
it('from Favorite Libraries - [C290108]', async () => {
await page.goToFavoriteLibrariesAndWait(); await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(siteModerated2Admin); await dataTable.selectItem(siteModerated2Admin);
await toolbar.clickButton('Cancel join request'); await toolbar.clickButton('Cancel Join Request');
expect(await page.getSnackBarMessage()).toEqual(`Canceled the request to join the library`); expect(await page.getSnackBarMessage()).toEqual(`Canceled the request to join the library`);
@@ -180,4 +294,138 @@ describe('Library actions', () => {
expect(hasJoinRequest).toBe(false, `Join request exists on ${siteModerated2Admin}`); expect(hasJoinRequest).toBe(false, `Join request exists on ${siteModerated2Admin}`);
}); });
it('from Search Results - [C306962]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchModerated2Admin);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchModerated2Admin);
await toolbar.clickButton('Cancel Join Request');
expect(await page.getSnackBarMessage()).toEqual(`Canceled the request to join the library`);
const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteSearchModerated2Admin);
expect(hasJoinRequest).toBe(false, `Join request exists on ${siteSearchModerated2Admin}`);
});
});
describe('Mark library as favorite', () => {
beforeAll(async done => {
await apis.admin.sites.createSite(sitePublic6Admin);
await apis.admin.sites.addSiteMember(sitePublic6Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.user.queries.waitForSites(siteSearchPublic3Admin, { expect: 1 });
done();
});
it('from My Libraries - [C289974]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic6Admin);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(sitePublic6Admin, { expect: true })).toBe(true, `${sitePublic6Admin} not favorite`);
});
it('from on Search Results - [C306963]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic3Admin);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic3Admin);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(siteSearchPublic3Admin, { expect: true })).toBe(true, `${siteSearchPublic3Admin} not favorite`);
});
});
describe('Remove library from favorites', () => {
beforeAll(async done => {
await apis.admin.sites.createSite(sitePublic7Admin);
await apis.admin.sites.createSite(sitePublic8Admin);
await apis.user.favorites.addFavoriteById('site', sitePublic7Admin);
await apis.user.favorites.addFavoriteById('site', sitePublic8Admin);
await apis.user.favorites.addFavoriteById('site', siteSearchPublic4Admin);
await apis.admin.sites.addSiteMember(sitePublic7Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.admin.sites.addSiteMember(sitePublic8Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.admin.sites.addSiteMember(siteSearchPublic4Admin, username, SITE_ROLES.SITE_MANAGER.ROLE);
await apis.user.queries.waitForSites(siteSearchPublic4Admin, { expect: 1 });
done();
});
it('from My Libraries - [C289975]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.selectItem(sitePublic7Admin);
await toolbar.clickMoreActionsRemoveFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(sitePublic7Admin, { expect: false })).toBe(false, `${sitePublic7Admin} still favorite`);
});
it('from Favorite Libraries - [C289976]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(sitePublic8Admin);
await toolbar.clickMoreActionsRemoveFavorite();
expect(await dataTable.isItemPresent(sitePublic8Admin)).toBe(false, `${sitePublic8Admin} is displayed`);
expect(await apis.user.favorites.isFavoriteWithRetry(sitePublic8Admin, { expect: false })).toBe(false, `${sitePublic8Admin} still favorite`);
});
it('from Search Results - [C306964]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic4Admin);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic4Admin);
await toolbar.clickMoreActionsRemoveFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(siteSearchPublic4Admin, { expect: false })).toBe(false, `${siteSearchPublic4Admin} still favorite`);
});
});
describe('Delete a library', () => {
beforeAll(async done => {
await apis.user.sites.createSite(siteForDelete1);
await apis.user.sites.createSite(siteForDelete2);
await apis.user.queries.waitForSites(siteSearchForDelete, { expect: 1 });
done();
});
it('from My Libraries - [C289988]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.selectItem(siteForDelete1);
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toEqual(`Library deleted`);
expect(await dataTable.isItemPresent(siteForDelete1)).toBe(false, `${siteForDelete1} still displayed`);
});
it('from Favorite Libraries - [C289991]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(siteForDelete2);
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toEqual(`Library deleted`);
expect(await dataTable.isItemPresent(siteForDelete2)).toBe(false, `${siteForDelete2} still displayed`);
});
it('from Search Results - [C306965]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchForDelete);
await dataTable.waitForBody();
await dataTable.selectItem(siteSearchForDelete);
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toEqual(`Library deleted`);
expect(await dataTable.isItemPresent(siteSearchForDelete)).toBe(false, `${siteSearchForDelete} still displayed`);
});
});
}); });
+105 -64
View File
@@ -24,7 +24,7 @@
*/ */
import { LoginPage, BrowsingPage } from '../../pages/pages'; import { LoginPage, BrowsingPage } from '../../pages/pages';
import { SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { 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';
@@ -47,6 +47,19 @@ describe('Mark items as favorites', () => {
let fileNotFavUIId, fileFavUIId, fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id, folderId, parentId; let fileNotFavUIId, fileFavUIId, fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id, folderId, parentId;
const fileSearchNotFav1 = `search-fileNotFav1-${Utils.random()}.txt`;
const fileSearchNotFav2 = `search-fileNotFav2-${Utils.random()}.txt`;
const fileSearchNotFav3 = `search-fileNotFav3-${Utils.random()}.txt`;
const fileSearchNotFav4 = `search-fileNotFav4-${Utils.random()}.txt`;
const fileSearchFav1 = `search-fileFav1-${Utils.random()}.txt`;
const fileSearchFav2 = `search-fileFav2-${Utils.random()}.txt`;
const fileSearchFav3 = `search-fileFav3-${Utils.random()}.txt`;
const fileSearchFav4 = `search-fileFav4-${Utils.random()}.txt`;
const folderSearch = `search-folder-${Utils.random()}`;
let fileSearchNotFav1Id, fileSearchNotFav2Id, fileSearchNotFav3Id, fileSearchNotFav4Id;
let fileSearchFav1Id, fileSearchFav2Id, fileSearchFav3Id, fileSearchFav4Id, folderSearchId;
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, username) user: new RepoClient(username, username)
@@ -55,6 +68,7 @@ describe('Mark items as favorites', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -73,8 +87,19 @@ describe('Mark items as favorites', () => {
fileFav4Id = (await apis.user.nodes.createFile(fileFav4, parentId)).entry.id; fileFav4Id = (await apis.user.nodes.createFile(fileFav4, parentId)).entry.id;
folderId = (await apis.user.nodes.createFolder(folder, parentId)).entry.id; folderId = (await apis.user.nodes.createFolder(folder, parentId)).entry.id;
fileSearchNotFav1Id = (await apis.user.nodes.createFile(fileSearchNotFav1, parentId)).entry.id;
fileSearchNotFav2Id = (await apis.user.nodes.createFile(fileSearchNotFav2, parentId)).entry.id;
fileSearchNotFav3Id = (await apis.user.nodes.createFile(fileSearchNotFav3, parentId)).entry.id;
fileSearchNotFav4Id = (await apis.user.nodes.createFile(fileSearchNotFav4, parentId)).entry.id;
fileSearchFav1Id = (await apis.user.nodes.createFile(fileSearchFav1, parentId)).entry.id;
fileSearchFav2Id = (await apis.user.nodes.createFile(fileSearchFav2, parentId)).entry.id;
fileSearchFav3Id = (await apis.user.nodes.createFile(fileSearchFav3, parentId)).entry.id;
fileSearchFav4Id = (await apis.user.nodes.createFile(fileSearchFav4, parentId)).entry.id;
folderSearchId = (await apis.user.nodes.createFolder(folderSearch, parentId)).entry.id;
await apis.user.favorites.addFavoritesByIds('file', [ fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]); await apis.user.favorites.addFavoritesByIds('file', [ fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]);
await apis.user.favorites.waitForApi({ expect: 5 }); await apis.user.favorites.addFavoritesByIds('file', [ fileSearchFav1Id, fileSearchFav2Id, fileSearchFav3Id, fileSearchFav4Id ]);
await apis.user.favorites.waitForApi({ expect: 9 });
await apis.user.shared.shareFilesByIds([ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]); await apis.user.shared.shareFilesByIds([ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]);
await apis.user.shared.shareFilesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]); await apis.user.shared.shareFilesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]);
@@ -89,12 +114,17 @@ describe('Mark items as favorites', () => {
done(); done();
}); });
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('on Personal Files', () => { describe('on Personal Files', () => {
afterAll(async (done) => { afterAll(async (done) => {
await apis.user.favorites.addFavoritesByIds('file', [ fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]); await apis.user.favorites.addFavoritesByIds('file', [ fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]);
await apis.user.favorites.addFavoriteById('folder', folderId); await apis.user.favorites.addFavoriteById('folder', folderId);
await apis.user.favorites.removeFavoritesByIds([ fileNotFavUIId , fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]); await apis.user.favorites.removeFavoritesByIds([ fileNotFavUIId , fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]);
await apis.user.favorites.waitForApi({ expect: 6 }); await apis.user.favorites.waitForApi({ expect: 10 });
done(); done();
}); });
@@ -123,7 +153,7 @@ describe('Mark items as favorites', () => {
await dataTable.selectItem(fileFavUI); await dataTable.selectItem(fileFavUI);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemIconText('Remove favorite')).toEqual('star'); expect(await toolbar.menu.getItemIconText('Remove Favorite')).toEqual('star');
}); });
it('favorite a file - [C217189]', async () => { it('favorite a file - [C217189]', async () => {
@@ -176,7 +206,7 @@ describe('Mark items as favorites', () => {
afterAll(async (done) => { afterAll(async (done) => {
await apis.user.favorites.addFavoritesByIds('file', [ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]); await apis.user.favorites.addFavoritesByIds('file', [ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]);
await apis.user.favorites.removeFavoritesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]); await apis.user.favorites.removeFavoritesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]);
await apis.user.favorites.waitForApi({ expect: 6 }); await apis.user.favorites.waitForApi({ expect: 10 });
done(); done();
}); });
@@ -229,7 +259,7 @@ describe('Mark items as favorites', () => {
afterAll(async (done) => { afterAll(async (done) => {
await apis.user.favorites.addFavoritesByIds('file', [ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]); await apis.user.favorites.addFavoritesByIds('file', [ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]);
await apis.user.favorites.removeFavoritesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]); await apis.user.favorites.removeFavoritesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]);
await apis.user.favorites.waitForApi({ expect: 6 }); await apis.user.favorites.waitForApi({ expect: 10 });
done(); done();
}); });
@@ -282,7 +312,7 @@ describe('Mark items as favorites', () => {
afterAll(async (done) => { afterAll(async (done) => {
await apis.user.favorites.addFavoritesByIds('file', [ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]); await apis.user.favorites.addFavoritesByIds('file', [ fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id ]);
await apis.user.favorites.removeFavoritesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]); await apis.user.favorites.removeFavoritesByIds([ fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id ]);
await apis.user.favorites.waitForApi({ expect: 6 }); await apis.user.favorites.waitForApi({ expect: 10 });
done(); done();
}); });
@@ -315,7 +345,74 @@ describe('Mark items as favorites', () => {
await dataTable.selectItem(fileFav2); await dataTable.selectItem(fileFav2);
await toolbar.openMoreMenu(); await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemIconText('Remove favorite')).toEqual('star'); expect(await toolbar.menu.getItemIconText('Remove Favorite')).toEqual('star');
});
});
describe('on Search Results', () => {
beforeAll(async done => {
await apis.user.search.waitForNodes('search-f', { expect: 9 });
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('search-f');
await dataTable.waitForBody();
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async done => {
await page.header.expandSideNav();
await page.clickPersonalFiles();
done();
});
it('favorite a file - [C306966]', async () => {
await dataTable.selectItem(fileSearchNotFav1);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchNotFav1Id, { expect: true })).toBe(true, `${fileSearchNotFav1} not marked as favorite`);
});
it('favorite a folder - [C306971]', async () => {
await dataTable.selectItem(folderSearch);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(folderSearchId, { expect: true })).toBe(true, `${folderSearch} not marked as favorite`);
});
it('unfavorite an item - [C306967]', async () => {
await dataTable.selectItem(fileSearchFav1);
await toolbar.clickMoreActionsRemoveFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchFav1Id, { expect: false })).toBe(false, `${fileSearchFav1} is marked as favorite`);
});
it('favorite multiple items - all unfavorite - [C306968]', async () => {
await dataTable.selectMultipleItems([ fileSearchNotFav2, fileSearchNotFav3 ]);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchNotFav2Id, { expect: true })).toBe(true, `${fileSearchNotFav2} not marked as favorite`);
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchNotFav3Id, { expect: true })).toBe(true, `${fileSearchNotFav3} not marked as favorite`);
});
it('favorite multiple items - some favorite and some unfavorite - [C306970]', async () => {
await dataTable.selectMultipleItems([ fileSearchNotFav4, fileSearchFav2 ]);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchNotFav4Id, { expect: true })).toBe(true, `${fileSearchNotFav4} not marked as favorite`);
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchFav2Id, { expect: true })).toBe(true, `${fileSearchFav2} not marked as favorite`);
});
it('unfavorite multiple items - [C306969]', async () => {
await dataTable.selectMultipleItems([ fileSearchFav3, fileSearchFav4 ])
await toolbar.clickMoreActionsRemoveFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchFav3Id, { expect: false })).toBe(false, `${fileSearchFav3} marked as favorite`);
expect(await apis.user.favorites.isFavoriteWithRetry(fileSearchFav4Id, { expect: false })).toBe(false, `${fileSearchFav4} marked as favorite`);
}); });
}); });
@@ -423,60 +520,4 @@ describe('Mark items as favorites', () => {
expect(await apis.user.favorites.isFavoriteWithRetry(fileSiteFav4Id, { expect: true })).toBe(true, 'item not marked as favorite'); expect(await apis.user.favorites.isFavoriteWithRetry(fileSiteFav4Id, { expect: true })).toBe(true, 'item not marked as favorite');
}); });
}); });
describe('on a library', () => {
const adminSite1 = `adminSite1-${Utils.random()}`;
const adminSite2 = `adminSite2-${Utils.random()}`;
const adminSite3 = `adminSite3-${Utils.random()}`;
beforeAll(async (done) => {
await apis.admin.sites.createSite(adminSite1);
await apis.admin.sites.createSite(adminSite2);
await apis.admin.sites.createSite(adminSite3);
await apis.admin.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.user.favorites.addFavoriteById('site', adminSite2);
await apis.user.favorites.addFavoriteById('site', adminSite3);
done();
});
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(adminSite1);
await apis.admin.sites.deleteSite(adminSite2);
await apis.admin.sites.deleteSite(adminSite3);
done();
});
it('Mark a library as favorite - [C289974]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.selectItem(adminSite1);
await toolbar.clickMoreActionsFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(adminSite1, { expect: true })).toBe(true, `${adminSite1} not favorite`);
});
it('Remove a library from favorites - on My Libraries - [C289975]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.selectItem(adminSite2);
await toolbar.clickMoreActionsRemoveFavorite();
expect(await apis.user.favorites.isFavoriteWithRetry(adminSite2, { expect: false })).toBe(false, `${adminSite2} still favorite`);
});
it('Remove a library from favorites - on Favorite Libraries - [C289976]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(adminSite3);
await toolbar.clickMoreActionsRemoveFavorite();
expect(await dataTable.isItemPresent(adminSite3)).toBe(false, `${adminSite3} is displayed`);
expect(await apis.user.favorites.isFavoriteWithRetry(adminSite3, { expect: false })).toBe(false, `${adminSite3} still favorite`);
});
});
}); });
+2 -2
View File
@@ -149,7 +149,7 @@ describe('New menu', () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await sidenav.openNewMenu(); await sidenav.openNewMenu();
const tooltip = await sidenav.menu.getItemTooltip('Create folder'); const tooltip = await sidenav.menu.getItemTooltip('Create Folder');
expect(tooltip).toContain('Create new folder'); expect(tooltip).toContain('Create new folder');
}); });
@@ -158,7 +158,7 @@ describe('New menu', () => {
await dataTable.doubleClickOnRowByName(siteAdmin); await dataTable.doubleClickOnRowByName(siteAdmin);
await sidenav.openNewMenu(); await sidenav.openNewMenu();
const tooltip = await sidenav.menu.getItemTooltip('Create folder'); const tooltip = await sidenav.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`);
}); });
+193 -105
View File
@@ -33,29 +33,31 @@ import { Utils } from '../../utilities/utils';
describe('Share a file', () => { describe('Share a file', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId; const parent = `parent-${Utils.random()}`; let parentId;
const expiryDate: any = '2020-12-25T18:30:00.000+0000'; const file1 = `file1-${Utils.random()}.txt`; let file1Id;
const file2 = `file2-${Utils.random()}.txt`; let file2Id;
let file3 = `file3-${Utils.random()}.txt`; let file3Id;
const file4 = `file4-${Utils.random()}.txt`; let file4Id;
let file5 = `file5-${Utils.random()}.txt`; let file5Id;
let file6 = `file6-${Utils.random()}.txt`; let file6Id;
let file7 = `file7-${Utils.random()}.txt`; let file7Id;
const file8 = `file8-${Utils.random()}.txt`; let file8Id;
let file9 = `file9-${Utils.random()}.txt`; let file9Id;
const viewer = new Viewer();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const shareLinkPreUrl = "/#/preview/s/";
const apis = { const apis = {
admin: new RepoClient(), admin: new RepoClient(),
user: new RepoClient(username, username) user: new RepoClient(username, username)
}; };
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const shareDialog = new ShareDialog();
const viewer = new Viewer();
const contextMenu = dataTable.menu;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id; parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await loginPage.loginWith(username);
done(); done();
}); });
@@ -64,17 +66,47 @@ describe('Share a file', () => {
done(); done();
}); });
describe('from Personal Files', () => { describe('when logged out', () => {
let file6SharedLink;
const file1 = `file1-${Utils.random()}.txt`; let file1Id; beforeAll(async (done) => {
const file2 = `file2-${Utils.random()}.txt`; let file2Id; file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id;
const file3 = `file3-${Utils.random()}.txt`; let file3Id; const sharedId = (await apis.user.shared.shareFileById(file6Id)).entry.id;
const file4 = `file4-${Utils.random()}.txt`; let file4Id; file6SharedLink = `${shareLinkPreUrl}${sharedId}`;
const file5 = `file5-${Utils.random()}.txt`; let file5Id; await apis.user.shared.waitForApi({ expect: 1 });
const file6 = `file6-${Utils.random()}.txt`; let file6Id; done();
const file7 = `file7-${Utils.random()}.txt`; let file7Id; });
const file8 = `file8-${Utils.random()}.txt`; let file8Id;
const file9 = `file9-${Utils.random()}.txt`; let file9Id; afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(file6Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('A non-logged user can download the shared file from the viewer - [C286326]', async () => {
await browser.get(file6SharedLink);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).toEqual(file6);
await toolbar.clickDownload();
expect(await Utils.fileExistsOnOS(file6)).toBe(true, 'File not found in download location');
});
})
describe('when logged in', () => {
const expiryDate: any = '2020-12-25T18:30:00.000+0000';
const loginPage = new LoginPage();
const shareDialog = new ShareDialog();
const contextMenu = dataTable.menu;
const { searchInput } = page.header;
beforeAll(async (done) => {
await loginPage.loginWith(username);
done();
});
describe('from Personal Files', () => {
beforeAll(async (done) => { beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
@@ -126,7 +158,7 @@ describe('Share a file', () => {
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain('/preview/s/'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on');
@@ -154,10 +186,6 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file3Id); const sharedId = await apis.user.nodes.getSharedId(file3Id);
expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file3)).toBe(true, `${file3} is not in the Shared files list`);
}); });
it('Copy shared file URL - [C286330]', async () => { it('Copy shared file URL - [C286330]', async () => {
@@ -165,7 +193,7 @@ describe('Share a file', () => {
await toolbar.clickShare(); await toolbar.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/'); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.copyUrl();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
@@ -244,6 +272,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286345]', async () => { it('Share a file from the context menu - [C286345]', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
@@ -252,25 +281,11 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file9Id); const sharedId = await apis.user.nodes.getSharedId(file9Id);
expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file9)).toBe(true, `${file9} is not in the Shared files list`);
}); });
}); });
describe('from File Libraries', () => { describe('from File Libraries', () => {
const file1 = `file1-${Utils.random()}.txt`;
const file2 = `file2-${Utils.random()}.txt`;
const file3 = `file3-${Utils.random()}.txt`; let file3Id;
const file4 = `file4-${Utils.random()}.txt`;
const file5 = `file5-${Utils.random()}.txt`; let file5Id;
const file6 = `file6-${Utils.random()}.txt`; let file6Id;
const file7 = `file7-${Utils.random()}.txt`; let file7Id;
const file8 = `file8-${Utils.random()}.txt`;
const file9 = `file9-${Utils.random()}.txt`; let file9Id;
const siteName = `site-${Utils.random()}`; const siteName = `site-${Utils.random()}`;
const parentInSite = `parent-site-${Utils.random()}`; let parentInSiteId; const parentInSite = `parent-site-${Utils.random()}`; let parentInSiteId;
@@ -305,6 +320,7 @@ describe('Share a file', () => {
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done(); done();
}); });
@@ -322,7 +338,7 @@ describe('Share a file', () => {
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain('/preview/s/'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on');
@@ -350,10 +366,6 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file3Id); const sharedId = await apis.user.nodes.getSharedId(file3Id);
expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file3)).toBe(true, `${file3} is not in the Shared files list`);
}); });
it('Copy shared file URL - [C286642]', async () => { it('Copy shared file URL - [C286642]', async () => {
@@ -361,7 +373,7 @@ describe('Share a file', () => {
await toolbar.clickShare(); await toolbar.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/'); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.copyUrl();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
@@ -440,6 +452,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286647]', async () => { it('Share a file from the context menu - [C286647]', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
@@ -448,25 +461,11 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file9Id); const sharedId = await apis.user.nodes.getSharedId(file9Id);
expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file9)).toBe(true, `${file9} is not in the Shared files list`);
}); });
}); });
describe('from Recent Files', () => { 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;
const file5 = `file5-${Utils.random()}.txt`; let file5Id;
const file6 = `file6-${Utils.random()}.txt`; let file6Id;
const file7 = `file7-${Utils.random()}.txt`; let file7Id;
const file8 = `file8-${Utils.random()}.txt`; let file8Id;
const file9 = `file9-${Utils.random()}.txt`; let file9Id;
beforeAll(async (done) => { beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
@@ -484,13 +483,13 @@ describe('Share a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh();
await page.clickRecentFilesAndWait(); await page.clickRecentFilesAndWait();
done(); done();
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done(); done();
}); });
@@ -516,7 +515,7 @@ describe('Share a file', () => {
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain('/preview/s/'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on');
@@ -544,10 +543,6 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file3Id); const sharedId = await apis.user.nodes.getSharedId(file3Id);
expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file3)).toBe(true, `${file3} is not in the Shared files list`);
}); });
it('Copy shared file URL - [C286660]', async () => { it('Copy shared file URL - [C286660]', async () => {
@@ -555,7 +550,7 @@ describe('Share a file', () => {
await toolbar.clickShare(); await toolbar.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/'); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.copyUrl();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
@@ -634,6 +629,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286665]', async () => { it('Share a file from the context menu - [C286665]', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
@@ -642,23 +638,11 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file9Id); const sharedId = await apis.user.nodes.getSharedId(file9Id);
expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file9)).toBe(true, `${file9} is not in the Shared files list`);
}); });
}); });
describe('from Shared Files', () => { 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;
const file5 = `file5-${Utils.random()}.txt`; let file5Id;
const file6 = `file6-${Utils.random()}.txt`; let file6Id;
const file7 = `file7-${Utils.random()}.txt`; let file7Id;
beforeAll(async (done) => { beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
@@ -680,13 +664,13 @@ describe('Share a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh();
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
done(); done();
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done(); done();
}); });
@@ -710,7 +694,7 @@ describe('Share a file', () => {
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain('/preview/s/'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on');
@@ -733,7 +717,7 @@ describe('Share a file', () => {
await toolbar.clickSharedLinkSettings(); await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/'); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.copyUrl();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
@@ -791,13 +775,14 @@ describe('Share a file', () => {
it('Open Share dialog from context menu - [C286656]', async () => { it('Open Share dialog from context menu - [C286656]', async () => {
await dataTable.rightClickOnItem(file7); await dataTable.rightClickOnItem(file7);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickSharedLinkSettings(); await contextMenu.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain('/preview/s/'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on');
@@ -808,16 +793,6 @@ describe('Share a file', () => {
describe('from Favorites', () => { 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;
const file5 = `file5-${Utils.random()}.txt`; let file5Id;
const file6 = `file6-${Utils.random()}.txt`; let file6Id;
const file7 = `file7-${Utils.random()}.txt`; let file7Id;
const file8 = `file8-${Utils.random()}.txt`; let file8Id;
const file9 = `file9-${Utils.random()}.txt`; let file9Id;
beforeAll(async (done) => { beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
@@ -853,6 +828,7 @@ describe('Share a file', () => {
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done(); done();
}); });
@@ -878,7 +854,7 @@ describe('Share a file', () => {
expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`);
expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.');
expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share');
expect(await shareDialog.getLinkUrl()).toContain('/preview/s/'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl);
expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly'); expect(await shareDialog.isUrlReadOnly()).toBe('true', 'url is not readonly');
expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked');
expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on');
@@ -906,10 +882,6 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file3Id); const sharedId = await apis.user.nodes.getSharedId(file3Id);
expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file3)).toBe(true, `${file3} is not in the Shared files list`);
}); });
it('Copy shared file URL - [C286669]', async () => { it('Copy shared file URL - [C286669]', async () => {
@@ -917,7 +889,7 @@ describe('Share a file', () => {
await toolbar.clickShare(); await toolbar.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl(); const url = await shareDialog.getLinkUrl();
expect(url).toContain('/preview/s/'); expect(url).toContain(shareLinkPreUrl);
await shareDialog.copyUrl(); await shareDialog.copyUrl();
expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard');
@@ -996,6 +968,7 @@ describe('Share a file', () => {
it('Share a file from the context menu - [C286674]', async () => { it('Share a file from the context menu - [C286674]', async () => {
await dataTable.rightClickOnItem(file9); await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare(); await contextMenu.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
@@ -1004,11 +977,126 @@ describe('Share a file', () => {
const sharedId = await apis.user.nodes.getSharedId(file9Id); const sharedId = await apis.user.nodes.getSharedId(file9Id);
expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`);
expect(url).toContain(sharedId); expect(url).toContain(sharedId);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file9)).toBe(true, `${file9} is not in the Shared files list`);
}); });
}); });
describe('from Search Results', () => {
file3 = `search-file3-${Utils.random()}.txt`;
file5 = `search-file5-${Utils.random()}.txt`;
file6 = `search-file6-${Utils.random()}.txt`;
file7 = `search-file7-${Utils.random()}.txt`;
file9 = `search-file9-${Utils.random()}.txt`;
beforeAll(async (done) => {
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file5Id = (await apis.user.nodes.createFile(file5, parentId)).entry.id;
file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id;
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.search.waitForNodes('search-f', { expect: 5 });
done();
});
beforeEach(async done => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('search-f');
await dataTable.waitForBody();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file5Id);
await apis.user.nodes.deleteNodeById(file6Id);
await apis.user.nodes.deleteNodeById(file7Id);
await apis.user.nodes.deleteNodeById(file9Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
});
it('Share a file - [C306975]', async () => {
await dataTable.selectItem(file3);
await toolbar.clickShare();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await Utils.pressEscape();
const sharedId = await apis.user.nodes.getSharedId(file3Id);
expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`);
expect(url).toContain(sharedId);
});
it('Share a file with expiration date - [C306977]', async () => {
await dataTable.selectItem(file5);
await toolbar.clickShare();
await shareDialog.waitForDialogToOpen();
await shareDialog.clickExpirationToggle();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked');
expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened');
const date = await shareDialog.dateTimePicker.setDefaultDay();
await shareDialog.dateTimePicker.waitForDateTimePickerToClose();
const setDate = (`${date}`).replace(',', '');
const inputDate = await shareDialog.getExpireDate();
expect(new Date(inputDate)).toEqual(new Date(setDate));
const expireDateProperty = await apis.user.nodes.getSharedExpiryDate(file5Id);
expect(Utils.formatDate(expireDateProperty)).toEqual(Utils.formatDate(inputDate));
});
it('Expire date is displayed correctly - [C306978]', async () => {
await dataTable.selectItem(file6);
await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id);
expect(expireProperty).toEqual(expiryDate);
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(Utils.formatDate(await shareDialog.getExpireDate())).toEqual(Utils.formatDate(expiryDate));
});
it('Disable the share link expiration - [C306979]', async () => {
await dataTable.selectItem(file7);
await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked');
expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty');
await shareDialog.clickExpirationToggle();
expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked');
expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty');
await shareDialog.clickClose();
expect(await apis.user.nodes.getSharedExpiryDate(file7Id)).toBe(undefined, `${file7} link still has expiration`);
});
it('Share a file from the context menu - [C306981]', async () => {
await dataTable.rightClickOnItem(file9);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickShare();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await Utils.pressEscape();
const sharedId = await apis.user.nodes.getSharedId(file9Id);
expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`);
expect(url).toContain(sharedId);
});
});
})
}); });
File diff suppressed because it is too large Load Diff
@@ -1,703 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, protractor } from 'protractor';
import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages';
import { SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Toolbar actions - multiple selection : ', () => {
const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
const file1 = `my-file1-${Utils.random()}.txt`; let file1Id;
const file2 = `my-file2-${Utils.random()}.txt`; let file2Id;
const folder1 = `my-folder1-${Utils.random()}`; let folder1Id;
const folder2 = `my-folder2-${Utils.random()}`; let folder2Id;
const fileForDelete1 = `file-${Utils.random()}.txt`; let fileForDelete1Id;
const fileForDelete2 = `file-${Utils.random()}.txt`; let fileForDelete2Id;
const folderForDelete1 = `folder-${Utils.random()}`; let folderForDelete1Id;
const folderForDelete2 = `folder-${Utils.random()}`; let folderForDelete2Id;
const siteName = `site-${Utils.random()}`;
const file1InSite = `my-fileInSite1-${Utils.random()}.txt`;
const file2InSite = `my-fileInSite2-${Utils.random()}.txt`;
const folder1InSite = `my-folderInSite1-${Utils.random()}`;
const folder2InSite = `my-folderInSite2-${Utils.random()}`;
const fileLocked1InSite = `my-fileLockedInSite1-${Utils.random()}.txt`; let fileLocked1InSiteId;
const fileLocked2InSite = `my-fileLockedInSite2-${Utils.random()}.txt`; let fileLocked2InSiteId;
const fileLocked1 = `my-fileLocked1-${Utils.random()}.txt`; let fileLocked1Id;
const fileLocked2 = `my-fileLocked2-${Utils.random()}.txt`; let fileLocked2Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1, parentId)).entry.id;
folder2Id = (await apis.user.nodes.createFolder(folder2, parentId)).entry.id;
fileForDelete1Id = (await apis.user.nodes.createFile(fileForDelete1, parentId)).entry.id;
fileForDelete2Id = (await apis.user.nodes.createFile(fileForDelete2, parentId)).entry.id;
folderForDelete1Id = (await apis.user.nodes.createFolder(folderForDelete1, parentId)).entry.id;
folderForDelete2Id = (await apis.user.nodes.createFolder(folderForDelete2, parentId)).entry.id;
fileLocked1Id = (await apis.user.nodes.createFile(fileLocked1, parentId)).entry.id;
fileLocked2Id = (await apis.user.nodes.createFile(fileLocked2, parentId)).entry.id;
await apis.user.nodes.lockFile(fileLocked1Id);
await apis.user.nodes.lockFile(fileLocked2Id);
await apis.user.shared.shareFilesByIds([file1Id, file2Id, fileLocked1Id, fileLocked2Id]);
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id, fileLocked1Id, fileLocked2Id]);
await apis.user.favorites.addFavoritesByIds('folder', [folder1Id, folder2Id]);
await apis.user.favorites.waitForApi({ expect: 6 });
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);
fileLocked1InSiteId = (await apis.user.nodes.createFile(fileLocked1InSite, docLibId)).entry.id;
fileLocked2InSiteId = (await apis.user.nodes.createFile(fileLocked2InSite, docLibId)).entry.id;
await apis.user.nodes.lockFile(fileLocked1InSiteId);
await apis.user.nodes.lockFile(fileLocked2InSiteId);
await apis.user.search.waitForApi(username, { expect: 6 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(parentId),
apis.user.trashcan.emptyTrash(),
apis.user.sites.deleteSite(siteName)
]);
done();
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForBody();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('Unselect items with single click - [C280458]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
await dataTable.selectItem(file1);
expect(await dataTable.countSelectedRows()).toEqual(1, 'incorrect selected rows number');
});
it('Select / unselect selected items by CMD+click - [C217110]', async () => {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await dataTable.selectItem(file1);
await dataTable.selectItem(file2);
await dataTable.selectItem(folder1);
await dataTable.selectItem(folder2);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
expect(await dataTable.countSelectedRows()).toEqual(4, 'incorrect selected rows number');
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await dataTable.selectItem(file1);
await dataTable.selectItem(file2);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
expect(await dataTable.countSelectedRows()).toEqual(2, 'incorrect selected rows number');
});
it('correct actions appear when multiple files are selected - [C217112]', async () => {
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple locked files are selected - [C297619]', async () => {
await dataTable.selectMultipleItems([fileLocked1, fileLocked2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple folders are selected - [C280459]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when both files and folders are selected - [C280460]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280461]', async () => {
await dataTable.selectMultipleItems([file1InSite, file2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed for selected files');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed for selected files');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple locked files are selected - [C297620]', async () => {
await dataTable.selectMultipleItems([fileLocked1InSite, fileLocked2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed for selected files');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed for selected files');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple folders are selected - [C280462]', async () => {
await dataTable.selectMultipleItems([folder1InSite, folder2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when both files and folders are selected - [C280463]', async () => {
await dataTable.selectMultipleItems([file1InSite, file2InSite, folder1InSite, folder2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickSharedFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280467]', async () => {
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed for selected files');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple locked files are selected - [C297623]', async () => {
await dataTable.selectMultipleItems([fileLocked1, fileLocked2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed for selected files');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
});
describe('on Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickRecentFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280468]', async () => {
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple locked files are selected - [C297624]', async () => {
await dataTable.selectMultipleItems([fileLocked1, fileLocked2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
});
describe('on Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickFavoritesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280469]', async () => {
await dataTable.selectMultipleItems([file1, file2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple locked files are selected - [C297625]', async () => {
await dataTable.selectMultipleItems([fileLocked1, fileLocked2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple folders are selected - [C280470]', async () => {
await dataTable.selectMultipleItems([folder1, folder2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when both files and folders are selected - [C280471]', async () => {
await dataTable.selectMultipleItems([file1, file2, folder1, folder2]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for selected files`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
});
describe('on Trash', () => {
beforeEach(async (done) => {
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C280472]', async () => {
await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2]);
expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
});
it('correct actions appear when multiple folders are selected - [C280473]', async () => {
await dataTable.selectMultipleItems([folderForDelete1, folderForDelete2]);
expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
});
it('correct actions appear when both files and folders are selected - [C280474]', async () => {
await dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2]);
expect(await toolbar.isButtonPresent('Permanently delete')).toBe(true, 'Permanently delete is displayed');
expect(await toolbar.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed');
});
});
describe('on Search Results', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('correct actions appear when multiple files are selected - [C291820]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions('my-fileInSite');
await dataTable.selectMultipleItems([file1InSite, file2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed for selected files');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed for selected files');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isToggleFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple locked files are selected - [C297626]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions('my-fileLockedInSite');
await dataTable.selectMultipleItems([fileLocked1InSite, fileLocked2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed for selected files');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed for selected files');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed for selected files');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isToggleFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when multiple folders are selected - [C291821]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchForTextAndCloseSearchOptions('my-folderInSite');
await dataTable.selectMultipleItems([folder1InSite, folder2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isToggleFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when both files and folders are selected - [C291822]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchForTextAndCloseSearchOptions('my-f');
await dataTable.selectMultipleItems([file1InSite, file2InSite, folder1InSite, folder2InSite]);
expect(await toolbar.isViewPresent()).toBe(false, 'View is displayed');
expect(await toolbar.isDownloadPresent()).toBe(true, 'Download is not displayed');
expect(await toolbar.isEditFolderPresent()).toBe(false, 'Edit folder is displayed');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for selected files`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for selected files`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for selected files`);
expect(await toolbar.menu.isToggleFavoritePresent()).toBe(true, `Favorite is not displayed for selected files`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed`);
await toolbar.closeMoreMenu();
});
});
});
@@ -1,760 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, SearchResultsPage } from '../../pages/pages';
import { SITE_VISIBILITY } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Toolbar actions - single selection : ', () => {
const username = `user-${Utils.random()}`;
const fileUser = `fileUser-${Utils.random()}.txt`; let fileUserId;
const folderUser = `folderUser-${Utils.random()}`; let folderUserId;
const fileForDelete = `fileForDelete-${Utils.random()}.txt`; let fileForDeleteId;
const folderForDelete = `folderForDelete-${Utils.random()}`; let folderForDeleteId;
const fileLocked = `fileLocked-${Utils.random()}.txt`; let fileLockedId;
const siteName = `site-${Utils.random()}`;
const fileInSite = `file-site-${Utils.random()}.txt`;
const fileLockedInSite = `file-locked-site-${Utils.random()}.txt`; let fileLockedInSiteId;
const folderInSite = `folder-site-${Utils.random()}`;
const adminPublic = `admin-public-${Utils.random()}`;
const adminModerated = `admin-moderated-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileUserId = (await apis.user.nodes.createFile(fileUser)).entry.id;
fileForDeleteId = (await apis.user.nodes.createFile(fileForDelete)).entry.id;
folderForDeleteId = (await apis.user.nodes.createFolder(folderForDelete)).entry.id;
folderUserId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
fileLockedId = (await apis.user.nodes.createFile(fileLocked)).entry.id;
await apis.user.shared.shareFileById(fileUserId);
await apis.user.shared.shareFileById(fileLockedId);
await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.favorites.addFavoriteById('file', fileUserId);
await apis.user.favorites.addFavoriteById('folder', folderUserId);
await apis.user.favorites.addFavoriteById('file', fileLockedId);
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFile(fileInSite, docLibId);
fileLockedInSiteId = (await apis.user.nodes.createFile(fileLockedInSite, docLibId)).entry.id;
await apis.user.nodes.createFolder(folderInSite, docLibId);
await apis.user.nodes.lockFile(fileLockedInSiteId);
await apis.user.nodes.deleteNodeById(fileForDeleteId, false);
await apis.user.nodes.deleteNodeById(folderForDeleteId, false);
await apis.admin.sites.createSite(adminPublic);
await apis.admin.sites.createSite(adminModerated, SITE_VISIBILITY.MODERATED);
await apis.user.favorites.addFavoriteById('site', adminPublic);
await apis.user.favorites.addFavoriteById('site', adminModerated);
await apis.user.sites.requestToJoin(adminModerated);
await apis.user.queries.waitForSites(siteName, { expect: 1 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await Promise.all([
apis.user.nodes.deleteNodeById(fileUserId),
apis.user.nodes.deleteNodeById(folderUserId),
apis.user.sites.deleteSite(siteName),
apis.admin.sites.deleteSite(adminPublic),
apis.admin.sites.deleteSite(adminModerated),
apis.user.trashcan.emptyTrash()
]);
done();
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await dataTable.clearSelection();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('selected row is marked with a check circle icon - [C213134]', async () => {
await dataTable.selectItem(fileUser);
expect(await dataTable.hasCheckMarkIcon(fileUser)).toBe(true, 'check mark missing');
});
it('actions are not displayed when no item is selected - [C213120]', async () => {
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C213122]', async () => {
await dataTable.selectItem(fileUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload New Version is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a locked file is selected - [C297612]', async () => {
await dataTable.selectItem(fileLocked);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileLocked}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a folder is selected - [C213123]', async () => {
await dataTable.selectItem(folderUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not enabled for ${folderUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderUser}`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await toolbar.menu.isRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${folderUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed for ${folderUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderUser}`);
await toolbar.closeMoreMenu();
});
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('actions are not displayed when no item is selected - [C280439]', async () => {
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C280440]', async () => {
await dataTable.selectItem(fileInSite);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileInSite}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileInSite}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileInSite}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileInSite}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileInSite}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileInSite}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileInSite}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a locked file is selected - [C297614]', async () => {
await dataTable.selectItem(fileLockedInSite);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileLockedInSite}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLockedInSite}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLockedInSite}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLockedInSite}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileLockedInSite}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLockedInSite}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a folder is selected - [C280441]', async () => {
await dataTable.selectItem(folderInSite);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderInSite}`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed for ${folderInSite}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not enabled for ${folderInSite}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderInSite}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderInSite}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed for ${folderInSite}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed for ${folderInSite}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderInSite}`);
await toolbar.closeMoreMenu();
});
});
describe('on a library', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFiles();
done();
});
it('Available actions for a library - My Libraries - [C213135]', async () => {
await page.goToMyLibrariesAndWait();
await dataTable.selectItem(siteName);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${siteName}`);
expect(await toolbar.isButtonPresent('Leave library')).toBe(true, `Leave is not displayed for ${siteName}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${siteName}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${siteName}`);
await toolbar.closeMoreMenu();
});
it('Available actions for a library - Favorite Libraries - user is a member - [C289892]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(siteName);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${siteName}`);
expect(await toolbar.isButtonPresent('Leave library')).toBe(true, `Leave is not displayed for ${siteName}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${siteName}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${siteName}`);
await toolbar.closeMoreMenu();
});
it('Available actions for a library - Favorite Libraries - user is not a member - [C290090]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(adminPublic);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${adminPublic}`);
expect(await toolbar.isButtonPresent('Join')).toBe(true, `Join is not displayed for ${adminPublic}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminPublic}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${adminPublic}`);
await toolbar.closeMoreMenu();
});
it('Available actions for a moderated library - Favorite Libraries - user requested to join - [C290091]', async () => {
await page.goToFavoriteLibrariesAndWait();
await dataTable.selectItem(adminModerated);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${adminModerated}`);
expect(await toolbar.isButtonPresent('Cancel join request')).toBe(true, `Cancel join is not displayed for ${adminModerated}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminModerated}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${adminModerated}`);
await toolbar.closeMoreMenu();
});
it('Available actions for a library - Search Results - [C290084]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchForTextAndCloseSearchOptions(siteName);
await dataTable.selectItem(siteName);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${siteName}`);
expect(await toolbar.isButtonPresent('Leave library')).toBe(true, `Leave is not displayed for ${siteName}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${siteName}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${siteName}`);
await toolbar.closeMoreMenu();
});
it('Available actions for a library - Search Results - user is not a member - [C290085]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchForTextAndCloseSearchOptions(adminPublic);
await dataTable.selectItem(adminPublic);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${adminPublic}`);
expect(await toolbar.isButtonPresent('Join')).toBe(true, `Join is not displayed for ${adminPublic}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminPublic}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${adminPublic}`);
await toolbar.closeMoreMenu();
});
it('Available actions for a moderated library - Search Results - user requested to join - [C290086]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchForTextAndCloseSearchOptions(adminModerated);
await dataTable.selectItem(adminModerated);
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
expect(await toolbar.isViewDetailsPresent()).toBe(true, `View details is not displayed for ${adminModerated}`);
expect(await toolbar.isButtonPresent('Cancel join request')).toBe(true, `Cancel join is not displayed for ${adminModerated}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${adminModerated}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${adminModerated}`);
await toolbar.closeMoreMenu();
});
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('actions are not displayed when no item is selected - [C280445]', async () => {
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C286265]', async () => {
await page.dataTable.selectItem(fileUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed for ${fileUser}`);
await toolbar.openMoreMenu();
// TODO: change expect to true when ACA-2173 is done
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a locked file is selected - [C297615]', async () => {
await page.dataTable.selectItem(fileLocked);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileLocked}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed for ${fileLocked}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2173 is done
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
await toolbar.closeMoreMenu();
});
});
describe('on Recent Files', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickRecentFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('actions are not displayed when no item is selected - [C280447]', async () => {
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C280448]', async () => {
await dataTable.selectItem(fileUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a locked file is selected - [C297616]', async () => {
await dataTable.selectItem(fileLocked);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileLocked}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
await toolbar.closeMoreMenu();
});
});
describe('on Favorites', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickFavoritesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('actions are not displayed when no item is selected - [C280449]', async () => {
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C280450]', async () => {
await dataTable.selectItem(fileUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
await toolbar.openMoreMenu();
// TODO: change expect to true when ACA-2174 is done
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileUser}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a locked file is selected - [C297617]', async () => {
await dataTable.selectItem(fileLocked);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileLocked}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
// TODO: change expect to true when ACA-2174 is done
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a folder is selected - [C280451]', async () => {
await dataTable.selectItem(folderUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not enabled for ${folderUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderUser}`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed for ${folderUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed for ${folderUser}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${folderUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed for ${folderUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderUser}`);
await toolbar.closeMoreMenu();
});
});
describe('on Trash', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickTrashAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('actions are not displayed when no item is selected - [C280452]', async () => {
expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`);
});
it('correct actions appear when a file is selected - [C280453]', async () => {
await dataTable.selectItem(fileForDelete);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`);
expect(await toolbar.isPermanentlyDeletePresent()).toBe(true, `Permanently delete is not displayed for file`);
expect(await toolbar.isRestorePresent()).toBe(true, `Restore is not displayed for file`);
});
it('correct actions appear when a folder is selected - [C280454]', async () => {
await dataTable.selectItem(folderForDelete);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`);
expect(await toolbar.isPermanentlyDeletePresent()).toBe(true, `Permanently delete is displayed for folder`);
expect(await toolbar.isRestorePresent()).toBe(true, `Restore is not displayed for folder`);
});
});
describe('on Search Results', () => {
beforeEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
await Utils.pressEscape();
done();
});
it('nodes actions are not displayed when no item is selected - [C291815]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchForTextAndCloseSearchOptions(fileInSite);
expect(await toolbar.isToggleSearchFiltersPresent()).toBe(true, `Search filter toggle is not displayed`);
expect(await toolbar.numberOfAvailableActions()).toBe(1, `more than 1 action is present`);
});
it('correct actions appear when a file is selected - [C291816]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions(fileUser);
await dataTable.selectItem(fileUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileUser}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed for ${fileUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${fileUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileUser}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileUser}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a locked file is selected - [C297618]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles();
await searchInput.searchForTextAndCloseSearchOptions(fileLocked);
await dataTable.selectItem(fileLocked);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${fileLocked}`);
expect(await toolbar.isViewPresent()).toBe(true, `View is not displayed for ${fileLocked}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed for ${fileLocked}`);
expect(await toolbar.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${fileLocked}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${fileLocked}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${fileLocked}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${fileLocked}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed for ${fileLocked}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed for ${fileLocked}`);
await toolbar.closeMoreMenu();
});
it('correct actions appear when a folder is selected - [C291817]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders();
await searchInput.searchForTextAndCloseSearchOptions(folderUser);
await dataTable.selectItem(folderUser);
expect(await toolbar.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed for ${folderUser}`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not enabled for ${folderUser}`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditFolderPresent()).toBe(true, `Edit folder is not displayed for ${folderUser}`);
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed for ${folderUser}`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed for ${folderUser}`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed for ${folderUser}`);
expect(await toolbar.menu.isDeletePresent()).toBe(false, `Delete is displayed for ${folderUser}`);
expect(await toolbar.menu.isMovePresent()).toBe(false, `Move is displayed for ${folderUser}`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed for ${folderUser}`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(false, `Manage versions is displayed for ${folderUser}`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(false, `Upload new version is displayed for ${folderUser}`);
await toolbar.closeMoreMenu();
});
});
});
+239
View File
@@ -0,0 +1,239 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser } from 'protractor';
import { LoginPage, BrowsingPage } from '../../pages/pages';
import { 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 from Search Results', () => {
const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
const file1 = `search-file1-${Utils.random()}.txt`; let file1Id;
const file2 = `search-file2-${Utils.random()}.txt`; let file2Id;
const file3 = `search-file3-${Utils.random()}.txt`; let file3Id;
const file4 = `search-file4-${Utils.random()}.txt`; let file4Id;
const sitePrivate = `site-private-${Utils.random()}`;
const fileSite1 = `search-fileSite1-${Utils.random()}.txt`; let fileSite1Id;
const fileSite2 = `search-fileSite2-${Utils.random()}.txt`; let fileSite2Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const shareDialog = new ShareDialog();
const confirmDialog = new ConfirmDialog();
const contextMenu = dataTable.menu;
const viewer = new Viewer();
const { searchInput } = page.header;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
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.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
fileSite1Id = (await apis.admin.nodes.createFile(fileSite1, docLibId)).entry.id;
fileSite2Id = (await apis.admin.nodes.createFile(fileSite2, docLibId)).entry.id;
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.shared.shareFileById(fileSite1Id);
await apis.user.shared.shareFileById(fileSite2Id);
await apis.user.shared.waitForApi({ expect: 6 });
await apis.user.search.waitForNodes('search-file', { expect: 6 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.admin.sites.deleteSite(sitePrivate);
done();
});
afterEach(async (done) => {
await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait();
done();
});
it('Unshare dialog UI - [C306995]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file1);
await dataTable.waitForBody();
await dataTable.selectItem(file1);
await toolbar.clickSharedLinkSettings();
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.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled');
expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled');
});
it('Unshare a file - [C306996]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file2);
await dataTable.waitForBody();
await dataTable.selectItem(file2);
await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
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`);
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 - [C306997]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file3);
await dataTable.waitForBody();
await dataTable.selectItem(file3);
await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
const urlBefore = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickCancel();
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 - [C306999]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file4);
await dataTable.waitForBody();
await dataTable.rightClickOnItem(file4);
await contextMenu.waitForMenuToOpen();
await contextMenu.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
const url = await shareDialog.getLinkUrl();
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
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`);
await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4);
await page.load();
});
it('Consumer - on Search Results - file shared by other user - [C306998]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSite1);
await dataTable.waitForBody();
await dataTable.selectItem(fileSite1);
await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`);
});
it('Consumer - on Search Results - file shared by the user - [C307000]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSite2);
await dataTable.waitForBody();
await dataTable.selectItem(fileSite2);
await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(fileSite2Id)).toBe(false, `${fileSite2} is shared`);
});
});
+88 -69
View File
@@ -83,7 +83,7 @@ describe('Unshare a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh(); await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent); await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -91,7 +91,7 @@ describe('Unshare a file', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await page.closeOpenDialogs();
done(); done();
}); });
@@ -132,10 +132,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`); expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2); expect(await viewer.getFileTitle()).not.toEqual(file2);
@@ -173,10 +169,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`); expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4); expect(await viewer.getFileTitle()).not.toEqual(file4);
@@ -213,7 +205,7 @@ describe('Unshare a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh(); await page.closeOpenDialogs();
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName); await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -223,7 +215,7 @@ describe('Unshare a file', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await page.closeOpenDialogs();
done(); done();
}); });
@@ -261,10 +253,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`); expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2); expect(await viewer.getFileTitle()).not.toEqual(file2);
@@ -302,10 +290,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`); expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4); expect(await viewer.getFileTitle()).not.toEqual(file4);
@@ -335,13 +319,13 @@ describe('Unshare a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh(); await page.closeOpenDialogs();
await page.clickRecentFilesAndWait(); await page.clickRecentFilesAndWait();
done(); done();
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await page.closeOpenDialogs();
done(); done();
}); });
@@ -382,10 +366,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`); expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2); expect(await viewer.getFileTitle()).not.toEqual(file2);
@@ -423,10 +403,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`); expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4); expect(await viewer.getFileTitle()).not.toEqual(file4);
@@ -456,13 +432,13 @@ describe('Unshare a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh(); await page.closeOpenDialogs();
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
done(); done();
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await page.closeOpenDialogs();
done(); done();
}); });
@@ -582,13 +558,13 @@ describe('Unshare a file', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.refresh(); await page.closeOpenDialogs();
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
done(); done();
}); });
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await page.closeOpenDialogs();
done(); done();
}); });
@@ -633,10 +609,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`); expect(await apis.user.nodes.isFileShared(file2Id)).toBe(false, `${file2} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file2)).toBe(false, `${file2} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file2); expect(await viewer.getFileTitle()).not.toEqual(file2);
@@ -678,10 +650,6 @@ describe('Unshare a file', () => {
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`); expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`);
// TODO: disable check cause api is slow to update
// await page.clickSharedFiles();
// expect(await dataTable.isItemPresent(file4)).toBe(false, `${file4} is in the Shared files list`);
await browser.get(url); await browser.get(url);
expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open');
expect(await viewer.getFileTitle()).not.toEqual(file4); expect(await viewer.getFileTitle()).not.toEqual(file4);
@@ -694,25 +662,38 @@ describe('Unshare a file', () => {
const sitePrivate = `site-private-${Utils.random()}`; const sitePrivate = `site-private-${Utils.random()}`;
const file1 = `file1-${Utils.random()}.txt`; let file1Id; const file1FileLib = `file1-FL-${Utils.random()}.txt`; let file1FileLibId;
const file2 = `file2-${Utils.random()}.txt`; let file2Id; const file2FileLib = `file2-FL-${Utils.random()}.txt`; let file2FileLibId;
const file1Shared = `file1-Shared-${Utils.random()}.txt`; let file1SharedId;
const file2Shared = `file2-Shared-${Utils.random()}.txt`; let file2SharedId;
const file1Fav = `file1-Fav-${Utils.random()}.txt`; let file1FavId;
const file2Fav = `file2-Fav-${Utils.random()}.txt`; let file2FavId;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE); await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate); const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id; file1FileLibId = (await apis.admin.nodes.createFile(file1FileLib, docLibId)).entry.id;
file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id; file2FileLibId = (await apis.admin.nodes.createFile(file2FileLib, docLibId)).entry.id;
file1SharedId = (await apis.admin.nodes.createFile(file1Shared, docLibId)).entry.id;
file2SharedId = (await apis.admin.nodes.createFile(file2Shared, docLibId)).entry.id;
file1FavId = (await apis.admin.nodes.createFile(file1Fav, docLibId)).entry.id;
file2FavId = (await apis.admin.nodes.createFile(file2Fav, docLibId)).entry.id;
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE); await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
await apis.admin.shared.shareFileById(file1Id); await apis.admin.shared.shareFileById(file1FileLibId);
await apis.user.shared.shareFileById(file2Id); await apis.user.shared.shareFileById(file2FileLibId);
await apis.user.shared.waitForApi({ expect: 2 }); await apis.admin.shared.shareFileById(file1SharedId);
await apis.user.shared.shareFileById(file2SharedId);
await apis.admin.shared.shareFileById(file1FavId);
await apis.user.shared.shareFileById(file2FavId);
await apis.user.favorites.addFavoriteById('file', file1FavId);
await apis.user.favorites.addFavoriteById('file', file2FavId);
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.waitForApi({ expect: 2 }); await apis.user.favorites.waitForApi({ expect: 2 });
await apis.user.shared.waitForApi({ expect: 6 });
done(); done();
}); });
@@ -722,13 +703,9 @@ describe('Unshare a file', () => {
done(); done();
}); });
beforeEach(async (done) => {
await page.refresh();
done();
});
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await page.closeOpenDialogs();
await page.clickPersonalFilesAndWait();
done(); done();
}); });
@@ -736,62 +713,104 @@ describe('Unshare a file', () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.selectItem(file1); await dataTable.selectItem(file1FileLib);
await toolbar.clickSharedLinkSettings(); await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`);
}); });
it('on File Libraries - file shared by the user - [C286701]', async () => { it('on File Libraries - file shared by the user - [C286701]', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.doubleClickOnRowByName(sitePrivate);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await dataTable.selectItem(file2); await dataTable.selectItem(file2FileLib);
await toolbar.clickSharedLinkSettings(); await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2FileLibId)).toBe(false, `${file2FileLib} is shared`);
}); });
it('on Shared Files - file shared by other user - [C286687]', async () => { it('on Shared Files - file shared by other user - [C286687]', async () => {
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
await dataTable.selectItem(file1); await dataTable.selectItem(file1Shared);
await toolbar.clickSharedLinkSettings(); await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`);
}); });
it('on Shared Files - file shared by the user - [C286702]', async () => { it('on Shared Files - file shared by the user - [C286702]', async () => {
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
await dataTable.selectItem(file1); await dataTable.selectItem(file2Shared);
await toolbar.clickSharedLinkSettings(); await toolbar.clickSharedLinkSettings();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2SharedId)).toBe(false, `${file2Shared} is shared`);
}); });
it('on Favorites - file shared by other user - [C286697]', async () => { it('on Favorites - file shared by other user - [C286697]', async () => {
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
await dataTable.selectItem(file1); await dataTable.selectItem(file1Fav);
// TODO: remove workaround for favorites // TODO: remove workaround for favorites
// await toolbar.clickSharedLinkSettings(); // await toolbar.clickSharedLinkSettings();
await toolbar.clickShare(); await toolbar.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
const msg = await page.getSnackBarMessage();
expect(msg).toContain(`You don't have permission to unshare this file`);
}); });
it('on Favorites - file shared by the user - [C286703]', async () => { it('on Favorites - file shared by the user - [C286703]', async () => {
await page.clickFavoritesAndWait(); await page.clickFavoritesAndWait();
await dataTable.selectItem(file1); await dataTable.selectItem(file2Fav);
// TODO: remove workaround for favorites // TODO: remove workaround for favorites
// await toolbar.clickSharedLinkSettings(); // await toolbar.clickSharedLinkSettings();
await toolbar.clickShare(); await toolbar.clickShare();
await shareDialog.waitForDialogToOpen(); await shareDialog.waitForDialogToOpen();
expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle enabled for consumer'); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer');
await shareDialog.clickShareToggle();
await confirmDialog.clickRemove();
await confirmDialog.waitForDialogToClose();
await shareDialog.waitForDialogToClose();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open');
expect(await apis.user.nodes.isFileShared(file2FavId)).toBe(false, `${file2Fav} is shared`);
}); });
}); });
+185 -3
View File
@@ -39,10 +39,18 @@ describe('Upload new version', () => {
const fileLocked1 = `file-locked1-${Utils.random()}.docx`; let fileLocked1Id; const fileLocked1 = `file-locked1-${Utils.random()}.docx`; let fileLocked1Id;
const fileLocked2 = `file-locked2-${Utils.random()}.docx`; let fileLocked2Id; const fileLocked2 = `file-locked2-${Utils.random()}.docx`; let fileLocked2Id;
const fileSearch1 = `search-file1-${Utils.random()}.docx`; let fileSearch1Id;
const fileSearch2 = `search-file2-${Utils.random()}.docx`; let fileSearch2Id;
const fileSearch3 = `search-file3-${Utils.random()}.docx`; let fileSearch3Id;
const fileSearch4 = `search-file4-${Utils.random()}.docx`; let fileSearch4Id;
const fileLockedSearch1 = `search-file-locked1-${Utils.random()}.docx`; let fileLockedSearch1Id;
const fileLockedSearch2 = `search-file-locked2-${Utils.random()}.docx`; let fileLockedSearch2Id;
const parentPF = `parentPersonal-${Utils.random()}`; let parentPFId; const parentPF = `parentPersonal-${Utils.random()}`; let parentPFId;
const parentSF = `parentShared-${Utils.random()}`; let parentSFId; const parentSF = `parentShared-${Utils.random()}`; let parentSFId;
const parentRF = `parentRecent-${Utils.random()}`; let parentRFId; const parentRF = `parentRecent-${Utils.random()}`; let parentRFId;
const parentFav = `parentFav-${Utils.random()}`; let parentFavId; const parentFav = `parentFav-${Utils.random()}`; let parentFavId;
const parentSearch = `parentSearch-${Utils.random()}`; let parentSearchId;
const file = FILES.pdfFile; let fileId; const file = FILES.pdfFile; let fileId;
const fileToUpload1 = FILES.docxFile; const fileToUpload1 = FILES.docxFile;
@@ -60,6 +68,7 @@ describe('Upload new version', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const uploadNewVersionDialog = new UploadNewVersionDialog(); const uploadNewVersionDialog = new UploadNewVersionDialog();
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -68,6 +77,7 @@ describe('Upload new version', () => {
parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id; parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id;
parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id; parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id;
parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id; parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id;
parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id;
done(); done();
}); });
@@ -77,6 +87,7 @@ describe('Upload new version', () => {
await apis.user.nodes.deleteNodeById(parentSFId); await apis.user.nodes.deleteNodeById(parentSFId);
await apis.user.nodes.deleteNodeById(parentRFId); await apis.user.nodes.deleteNodeById(parentRFId);
await apis.user.nodes.deleteNodeById(parentFavId); await apis.user.nodes.deleteNodeById(parentFavId);
await apis.user.nodes.deleteNodeById(parentSearchId);
done(); done();
}); });
@@ -253,7 +264,6 @@ describe('Upload new version', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
// await Utils.pressEscape();
await page.refresh(); await page.refresh();
done(); done();
}); });
@@ -400,7 +410,6 @@ describe('Upload new version', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
// await Utils.pressEscape();
await page.refresh(); await page.refresh();
done(); done();
}); });
@@ -548,7 +557,6 @@ describe('Upload new version', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
// await Utils.pressEscape();
await page.refresh(); await page.refresh();
done(); done();
}); });
@@ -669,4 +677,178 @@ describe('Upload new version', () => {
}); });
}); });
describe('on Search Results', () => {
beforeAll(async (done) => {
fileId = (await apis.user.upload.uploadFile(file, parentSearchId)).entry.id;
fileSearch1Id = (await apis.user.nodes.createFile(fileSearch1, parentSearchId)).entry.id;
fileSearch2Id = (await apis.user.nodes.createFile(fileSearch2, parentSearchId)).entry.id;
fileSearch3Id = (await apis.user.nodes.createFile(fileSearch3, parentSearchId)).entry.id;
fileSearch4Id = (await apis.user.nodes.createFile(fileSearch4, parentSearchId)).entry.id;
fileLockedSearch1Id = (await apis.user.nodes.createFile(fileLockedSearch1, parentSearchId)).entry.id;
fileLockedSearch2Id = (await apis.user.nodes.createFile(fileLockedSearch2, parentSearchId)).entry.id;
await apis.user.nodes.lockFile(fileLockedSearch1Id);
await apis.user.nodes.lockFile(fileLockedSearch2Id);
await apis.user.search.waitForNodes('search-f', { expect: 6 })
await loginPage.loginWith(username);
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
await page.header.expandSideNav();
await page.clickPersonalFilesAndWait();
done();
});
it('dialog UI defaults - [C307003]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file);
await dataTable.waitForBody();
await dataTable.selectItem(file, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog();
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?');
expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
});
it('file is updated after uploading a new version - major - [C307004]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch1);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch1, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog();
await uploadNewVersionDialog.clickMajor();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.clickUpload();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload1, parentSearch)).toBe(true, 'File not updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch1Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch1Id)).toEqual('1.0', 'File has incorrect version label');
});
it('file is updated after uploading a new version - minor - [C307005]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch2);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch2, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog();
await uploadNewVersionDialog.clickMinor();
await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.clickUpload();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload2, parentSearch)).toBe(true, 'File not updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch2Id)).toEqual('MINOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch2Id)).toEqual('0.1', 'File has incorrect version label');
});
it('file is not updated when clicking Cancel - [C307006]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch3);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch3, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog();
await uploadNewVersionDialog.clickMinor();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel();
expect(await dataTable.isItemPresent(fileSearch3, parentSearch)).toBe(true, 'File was updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch3Id)).toEqual('', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch3Id)).toEqual('', 'File has incorrect version label');
});
it('upload new version fails when new file name already exists - [C307007]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch4);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch4, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(file);
await page.waitForDialog();
await uploadNewVersionDialog.clickMinor();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload();
await page.refresh();
expect(await dataTable.isItemPresent(fileSearch4, parentSearch)).toBe(true, 'File was updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch4Id)).toEqual('', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch4Id)).toEqual('', 'File has incorrect version label');
});
it('file is unlocked after uploading a new version - [C307008]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch1);
await dataTable.waitForBody();
await dataTable.selectItem(fileLockedSearch1, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog();
await uploadNewVersionDialog.clickMinor();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickUpload();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload4, parentSearch)).toBe(true, 'File name was not changed');
expect(await apis.user.nodes.isFileLockedWrite(fileLockedSearch1Id)).toBe(false, `${fileLockedSearch1} is still locked`);
expect(await apis.user.nodes.getFileVersionType(fileLockedSearch1Id)).toEqual('MINOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileLockedSearch1Id)).toEqual('0.1', 'File has incorrect version label');
});
it('file remains locked after canceling of uploading a new version - [C307009]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch2);
await dataTable.waitForBody();
await dataTable.selectItem(fileLockedSearch2, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog();
await uploadNewVersionDialog.clickMinor();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel();
expect(await dataTable.isItemPresent(fileToUpload5, parentSearch)).toBe(false, 'File was updated');
expect(await dataTable.isItemPresent(fileLockedSearch2, parentSearch)).toBe(true, 'File not displayed');
expect(await apis.user.nodes.isFileLockedWrite(fileLockedSearch2Id)).toBe(true, `${fileLockedSearch2} was unlocked`);
});
});
}); });
+3 -3
View File
@@ -45,19 +45,19 @@ describe('Extensions - Viewer', () => {
let docxFileId; let docxFileId;
const customAction = { const customAction = {
id: 'app.toolbar.my-action', id: 'app.viewer.my-action',
title: 'My action', title: 'My action',
icon: 'http' icon: 'http'
}; };
const customSecondaryAction = { const customSecondaryAction = {
id: 'app.toolbar.my-secondary-action', id: 'app.viewer.my-secondary-action',
title: 'My secondary action', title: 'My secondary action',
icon: 'alarm' icon: 'alarm'
}; };
const downloadButton = { const downloadButton = {
id: 'app.toolbar.download', id: 'app.viewer.download',
title: 'My custom title' title: 'My custom title'
}; };
+119 -86
View File
@@ -35,6 +35,8 @@ describe('Comments', () => {
const parent = `parent-${Utils.random()}`; let parentId; const parent = `parent-${Utils.random()}`; let parentId;
const file1 = `file1-${Utils.random()}.txt`; const file1 = `file1-${Utils.random()}.txt`;
const folder1 = `folder1-${Utils.random()}`;
const folder2 = `folder2-${Utils.random()}`; let folder2Id;
const fileWith1Comment = `file1Comment-${Utils.random()}.txt`; let fileWith1CommentId; const fileWith1Comment = `file1Comment-${Utils.random()}.txt`; let fileWith1CommentId;
const fileWith2Comments = `file2Comments-${Utils.random()}.txt`; let fileWith2CommentsId; const fileWith2Comments = `file2Comments-${Utils.random()}.txt`; let fileWith2CommentsId;
@@ -53,6 +55,7 @@ describe('Comments', () => {
}; };
const infoDrawer = new InfoDrawer(); const infoDrawer = new InfoDrawer();
const { commentsTab } = infoDrawer;
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
@@ -80,6 +83,10 @@ describe('Comments', () => {
await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]); await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]);
await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]); await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]);
await apis.user.nodes.createFolder(folder1, parentId);
folder2Id = (await apis.user.nodes.createFolder(folder2, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folder2Id);
await loginPage.loginWith(username); await loginPage.loginWith(username);
done(); done();
}); });
@@ -96,11 +103,6 @@ describe('Comments', () => {
done(); done();
}); });
afterEach(async (done) => {
await dataTable.clearSelection();
done();
});
it('Comments tab default fields - [C299173]', async () => { it('Comments tab default fields - [C299173]', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
@@ -108,9 +110,9 @@ describe('Comments', () => {
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getActiveTabTitle()).toBe('COMMENTS'); expect(await infoDrawer.getActiveTabTitle()).toBe('COMMENTS');
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (0)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (0)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
}); });
it('Comment info display - [C280582]', async () => { it('Comment info display - [C280582]', async () => {
@@ -119,15 +121,15 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
}); });
it('Comments are displayed ordered by created date in descending order - [C280583]', async () => { it('Comments are displayed ordered by created date in descending order - [C280583]', async () => {
@@ -136,8 +138,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
}); });
it('Total number of comments is displayed - [C280585]', async () => { it('Total number of comments is displayed - [C280585]', async () => {
@@ -146,7 +148,7 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
}); });
it('Add button is enabled when typing in the comment field - [C280589]', async () => { it('Add button is enabled when typing in the comment field - [C280589]', async () => {
@@ -155,25 +157,40 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
await infoDrawer.typeComment('my comment'); await commentsTab.typeComment('my comment');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(true, 'Add comment button not enabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(true, 'Add comment button not enabled');
}); });
it('Add a comment - [C280590]', async () => { it('Add a comment on a file - [C280590]', async () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Personal); await dataTable.selectItem(file2Personal);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment); await commentsTab.typeComment(myComment);
await infoDrawer.clickAddButton(); await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
it('Add a comment on a folder - [C299208]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(folder1);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
}); });
it('Escape key clears the text when focus is on the textarea - [C280591]', async () => { it('Escape key clears the text when focus is on the textarea - [C280591]', async () => {
@@ -181,19 +198,19 @@ describe('Comments', () => {
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment('myComment'); await commentsTab.typeComment('myComment');
expect(await infoDrawer.getCommentTextFromTextArea()).toBe('myComment'); expect(await commentsTab.getCommentTextFromTextArea()).toBe('myComment');
await Utils.pressEscape(); await Utils.pressEscape();
expect(await infoDrawer.getCommentTextFromTextArea()).toBe(''); expect(await commentsTab.getCommentTextFromTextArea()).toBe('');
}); });
}); });
describe('from Favorites', () => { describe('from Favorites', () => {
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.user.favorites.waitForApi({ expect: 3 }); await apis.user.favorites.waitForApi({ expect: 4 });
done(); done();
}); });
@@ -203,7 +220,7 @@ describe('Comments', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
await dataTable.clearSelection(); await page.clickPersonalFiles();
done(); done();
}); });
@@ -213,15 +230,16 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); // ACA-2348 expect broken because of parallel test suites
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); // expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
}); });
it('Comments are displayed ordered by created date in descending order - [C299197]', async () => { it('Comments are displayed ordered by created date in descending order - [C299197]', async () => {
@@ -230,8 +248,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
}); });
it('Total number of comments is displayed - [C299198]', async () => { it('Total number of comments is displayed - [C299198]', async () => {
@@ -240,22 +258,37 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
}); });
it('Add a comment - [C299199]', async () => { it('Add a comment on a file - [C299199]', async () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Favorites); await dataTable.selectItem(file2Favorites);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment); await commentsTab.typeComment(myComment);
await infoDrawer.clickAddButton(); await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
it('Add a comment on a folder - [C299209]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(folder2);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
}); });
}); });
@@ -271,7 +304,7 @@ describe('Comments', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
await dataTable.clearSelection(); await page.clickPersonalFiles();
done(); done();
}); });
@@ -281,15 +314,15 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
}); });
it('Comments are displayed ordered by created date in descending order - [C299189]', async () => { it('Comments are displayed ordered by created date in descending order - [C299189]', async () => {
@@ -298,8 +331,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
}); });
it('Total number of comments is displayed - [C299190]', async () => { it('Total number of comments is displayed - [C299190]', async () => {
@@ -308,22 +341,22 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
}); });
it('Add a comment - [C299191]', async () => { it('Add a comment on a file - [C299191]', async () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Shared); await dataTable.selectItem(file2Shared);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment); await commentsTab.typeComment(myComment);
await infoDrawer.clickAddButton(); await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
}); });
}); });
@@ -339,7 +372,7 @@ describe('Comments', () => {
}); });
afterEach(async (done) => { afterEach(async (done) => {
await dataTable.clearSelection(); await page.clickPersonalFiles();
done(); done();
}); });
@@ -349,15 +382,15 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present'); expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled'); expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`); expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text'); expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user'); expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed'); expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
}); });
it('Comments are displayed ordered by created date in descending order - [C299193]', async () => { it('Comments are displayed ordered by created date in descending order - [C299193]', async () => {
@@ -366,8 +399,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id); expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id); expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
}); });
it('Total number of comments is displayed - [C299194]', async () => { it('Total number of comments is displayed - [C299194]', async () => {
@@ -376,22 +409,22 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
}); });
it('Add a comment - [C299195]', async () => { it('Add a comment on a file - [C299195]', async () => {
const myComment = 'my comment'; const myComment = 'my comment';
await dataTable.selectItem(file2Recent); await dataTable.selectItem(file2Recent);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab(); await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment); await commentsTab.typeComment(myComment);
await infoDrawer.clickAddButton(); await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)'); expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`); expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text'); expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
}); });
}); });
+249
View File
@@ -0,0 +1,249 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { InfoDrawer } from './../../components/info-drawer/info-drawer';
import { Utils } from '../../utilities/utils';
import { FILES, DATE_TIME_FORMAT, DATE_FORMAT } from '../../configs';
import * as moment from 'moment';
describe('File / Folder properties', () => {
const username = `user1-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
const file1 = {
name: `file1-${Utils.random()}.txt`,
title: 'file title',
description: 'file description',
author: 'file author'
};
let file1Id;
const image1 = {
name: FILES.jpgFile,
title: 'image title',
description: 'image description',
author: 'image author'
}
let image1Id;
const folder1 = {
name: `folder1-${Utils.random()}`,
title: 'folder title',
description: 'folder description',
author: 'folder author'
};
let folder1Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const infoDrawer = new InfoDrawer();
const { propertiesTab } = infoDrawer;
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1.name, parentId, file1.title, file1.description, file1.author)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1.name, parentId, folder1.title, folder1.description, folder1.author)).entry.id;
image1Id = (await apis.user.upload.uploadFile(image1.name, parentId)).entry.id;
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
done();
});
describe('View properties', () => {
it('Default tabs - [C299162]', async () => {
await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed');
expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed');
expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs');
});
it('File properties - [C269003]', async () => {
const apiProps = await apis.user.nodes.getNodeById(file1Id);
const expectedPropLabels = [
'Name',
'Title',
'Creator',
'Created Date',
'Size',
'Modifier',
'Modified Date',
'Mimetype',
'Author',
'Description'
];
const expectedPropValues = [
file1.name,
file1.title,
apiProps.entry.createdByUser.displayName,
moment(apiProps.entry.createdAt).format(DATE_FORMAT),
`${apiProps.entry.content.sizeInBytes} Bytes`,
apiProps.entry.modifiedByUser.displayName,
moment(apiProps.entry.modifiedAt).format(DATE_FORMAT),
apiProps.entry.content.mimeTypeName,
file1.author,
file1.description
];
await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
});
it('Folder properties - [C307106]', async () => {
const apiProps = await apis.user.nodes.getNodeById(folder1Id);
const expectedPropLabels = [
'Name',
'Title',
'Creator',
'Created Date',
'Modifier',
'Modified Date',
'Author',
'Description'
];
const expectedPropValues = [
folder1.name,
folder1.title,
apiProps.entry.createdByUser.displayName,
moment(apiProps.entry.createdAt).format(DATE_FORMAT),
apiProps.entry.modifiedByUser.displayName,
moment(apiProps.entry.modifiedAt).format(DATE_FORMAT),
folder1.author,
folder1.description
];
await dataTable.selectItem(folder1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
});
it('Less / More information buttons - [C269004]', async () => {
await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded');
await propertiesTab.clickLessInformationButton();
expect(await propertiesTab.isLessInfoButtonDisplayed()).toBe(false, 'Less information button displayed');
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded');
await propertiesTab.clickMoreInformationButton();
expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded');
});
it('Image properties - [C269007]', async () => {
const apiProps = await apis.user.nodes.getNodeById(image1Id);
const expectedPropLabels = [
'Image Width',
'Image Height',
'Date and Time',
'Exposure Time',
'F Number',
'Flash Activated',
'Focal Length',
'ISO Speed',
'Orientation',
'Camera Manufacturer',
'Camera Model',
'Camera Software'
];
const expectedPropValues = [
apiProps.entry.properties['exif:pixelXDimension'].toString(),
apiProps.entry.properties['exif:pixelYDimension'].toString(),
moment(apiProps.entry.properties['exif:dateTimeOriginal']).format(DATE_TIME_FORMAT),
apiProps.entry.properties['exif:exposureTime'].toString(),
apiProps.entry.properties['exif:fNumber'].toString(),
apiProps.entry.properties['exif:flash'],
apiProps.entry.properties['exif:focalLength'].toString(),
apiProps.entry.properties['exif:isoSpeedRatings'],
(apiProps.entry.properties['exif:orientation']).toString(),
apiProps.entry.properties['exif:manufacturer'],
apiProps.entry.properties['exif:model'],
apiProps.entry.properties['exif:software']
];
await dataTable.selectItem(image1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await propertiesTab.clickLessInformationButton();
await propertiesTab.clickImagePropertiesPanel();
await propertiesTab.waitForImagePropertiesPanelToExpand();
expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed');
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
});
});
});
+6 -6
View File
@@ -76,15 +76,15 @@ describe('General', () => {
done(); done();
}); });
it('Info drawer for a file - default tabs - [C299162]', async () => { it('Info drawer closes on page refresh - [C268999]', async () => {
await dataTable.selectItem(file1); await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open');
expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); await page.refresh();
expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed'); await dataTable.waitForBody();
expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed');
expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs'); expect(await infoDrawer.isOpen()).toBe(false, 'Info drawer open');
}); });
}); });
@@ -62,6 +62,7 @@ describe('Library properties', () => {
}; };
const infoDrawer = new InfoDrawer(); const infoDrawer = new InfoDrawer();
const { aboutTab } = infoDrawer;
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
@@ -108,17 +109,17 @@ describe('Library properties', () => {
expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
expect(await infoDrawer.isAboutTabDisplayed()).toBe(true, 'About tab is not displayed'); expect(await infoDrawer.isAboutTabDisplayed()).toBe(true, 'About tab is not displayed');
expect(await infoDrawer.isNameDisplayed()).toBe(true, 'Name field not displayed'); expect(await aboutTab.isNameDisplayed()).toBe(true, 'Name field not displayed');
expect(await infoDrawer.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed'); expect(await aboutTab.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed');
expect(await infoDrawer.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed'); expect(await aboutTab.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed');
expect(await infoDrawer.isDescriptionDisplayed()).toBe(true, 'Description field not displayed'); expect(await aboutTab.isDescriptionDisplayed()).toBe(true, 'Description field not displayed');
expect(await infoDrawer.getName()).toEqual(site.name); expect(await aboutTab.getName()).toEqual(site.name);
expect(await infoDrawer.getLibraryId()).toEqual(site.id); expect(await aboutTab.getLibraryId()).toEqual(site.id);
expect((await infoDrawer.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase()); expect((await aboutTab.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase());
expect(await infoDrawer.getDescription()).toEqual(site.description); expect(await aboutTab.getDescription()).toEqual(site.description);
expect(await infoDrawer.isEditDisplayed()).toBe(true, 'Edit action is not displayed'); expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(true, 'Edit action is not displayed');
}); });
it('Editable properties - [C289338]', async () => { it('Editable properties - [C289338]', async () => {
@@ -126,18 +127,18 @@ describe('Library properties', () => {
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled'); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
expect(await infoDrawer.isNameEnabled()).toBe(true, 'Name field not enabled'); expect(await aboutTab.isNameEnabled()).toBe(true, 'Name field not enabled');
expect(await infoDrawer.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled'); expect(await aboutTab.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled');
expect(await infoDrawer.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled'); expect(await aboutTab.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled');
expect(await infoDrawer.isDescriptionEnabled()).toBe(true, 'Description field not enabled'); expect(await aboutTab.isDescriptionEnabled()).toBe(true, 'Description field not enabled');
expect(await infoDrawer.isCancelDisplayed()).toBe(true, 'Cancel button not displayed'); expect(await aboutTab.isCancelDisplayed()).toBe(true, 'Cancel button not displayed');
expect(await infoDrawer.isUpdateDisplayed()).toBe(true, 'Update button not displayed'); expect(await aboutTab.isUpdateDisplayed()).toBe(true, 'Update button not displayed');
expect(await infoDrawer.isCancelEnabled()).toBe(true, 'Cancel button not enabled'); expect(await aboutTab.isCancelEnabled()).toBe(true, 'Cancel button not enabled');
expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled'); expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled');
}); });
it('Edit site details - [C289339]', async () => { it('Edit site details - [C289339]', async () => {
@@ -145,15 +146,15 @@ describe('Library properties', () => {
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled'); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(siteUpdated.name); await aboutTab.enterName(siteUpdated.name);
await infoDrawer.enterDescription(siteUpdated.description); await aboutTab.enterDescription(siteUpdated.description);
await infoDrawer.setVisibility(siteUpdated.visibility); await aboutTab.setVisibility(siteUpdated.visibility);
expect(await infoDrawer.isUpdateEnabled()).toBe(true, 'Update button not enabled'); expect(await aboutTab.isUpdateEnabled()).toBe(true, 'Update button not enabled');
await infoDrawer.clickUpdate(); await aboutTab.clickUpdate();
expect(await page.getSnackBarMessage()).toEqual('Library properties updated'); expect(await page.getSnackBarMessage()).toEqual('Library properties updated');
expect(await dataTable.isItemPresent(siteUpdated.name)).toBe(true, 'New site name not displayed in the list'); expect(await dataTable.isItemPresent(siteUpdated.name)).toBe(true, 'New site name not displayed in the list');
@@ -172,14 +173,14 @@ describe('Library properties', () => {
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled'); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(newName); await aboutTab.enterName(newName);
await infoDrawer.enterDescription(newDesc); await aboutTab.enterDescription(newDesc);
await infoDrawer.setVisibility(SITE_VISIBILITY.MODERATED); await aboutTab.setVisibility(SITE_VISIBILITY.MODERATED);
await infoDrawer.clickCancel(); await aboutTab.clickCancel();
expect(await dataTable.isItemPresent(newName)).toBe(false, 'New site name is displayed in the list'); expect(await dataTable.isItemPresent(newName)).toBe(false, 'New site name is displayed in the list');
expect(await dataTable.isItemPresent(site.name)).toBe(true, 'Original site name not displayed in the list'); expect(await dataTable.isItemPresent(site.name)).toBe(true, 'Original site name not displayed in the list');
@@ -192,37 +193,37 @@ describe('Library properties', () => {
await dataTable.selectItem(siteDup); await dataTable.selectItem(siteDup);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(site.name); await aboutTab.enterName(site.name);
expect(await infoDrawer.isMessageDisplayed()).toBe(true, 'Message not displayed'); expect(await aboutTab.isMessageDisplayed()).toBe(true, 'Message not displayed');
expect(await infoDrawer.getMessage()).toEqual('Library name already in use'); expect(await aboutTab.getMessage()).toEqual('Library name already in use');
}); });
it('Site name too long - [C289342]', async () => { it('Site name too long - [C289342]', async () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(Utils.string257); await aboutTab.enterName(Utils.string257);
await Utils.pressTab(); await Utils.pressTab();
expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed'); expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed');
expect(await infoDrawer.getError()).toEqual('Use 256 characters or less for title'); expect(await aboutTab.getError()).toEqual('Use 256 characters or less for title');
expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled'); expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled');
}); });
it('Site description too long - [C289343]', async () => { it('Site description too long - [C289343]', async () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterDescription(Utils.string513); await aboutTab.enterDescription(Utils.string513);
await Utils.pressTab(); await Utils.pressTab();
expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed'); expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed');
expect(await infoDrawer.getError()).toEqual('Use 512 characters or less for description'); expect(await aboutTab.getError()).toEqual('Use 512 characters or less for description');
expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled'); expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled');
}); });
describe('Non manager', () => { describe('Non manager', () => {
@@ -238,7 +239,7 @@ describe('Library properties', () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditDisplayed()).toBe(false, 'Edit action is displayed'); expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed');
}); });
it('Error notification - [C289344]', async () => { it('Error notification - [C289344]', async () => {
@@ -248,12 +249,12 @@ describe('Library properties', () => {
await dataTable.selectItem(site.name); await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails(); await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit(); await aboutTab.clickEditLibraryProperties();
await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE); await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE);
await infoDrawer.enterDescription('new description'); await aboutTab.enterDescription('new description');
await infoDrawer.clickUpdate(); await aboutTab.clickUpdate();
expect(await page.getSnackBarMessage()).toEqual('There was an error updating library properties'); expect(await page.getSnackBarMessage()).toEqual('There was an error updating library properties');
}); });
+22
View File
@@ -180,4 +180,26 @@ describe('Empty list views', () => {
expect(await pagination.isPreviousButtonPresent()).toBe(false, 'Previous button is present'); expect(await pagination.isPreviousButtonPresent()).toBe(false, 'Previous button is present');
expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present'); expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present');
}); });
it('Empty Search results - Libraries - [C290020]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
/* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop');
await dataTable.waitForBody();
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results');
});
it('Empty Search results - Files / Folders - [C290031]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
/* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop');
await dataTable.waitForBody();
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results');
});
}); });
+29
View File
@@ -40,6 +40,7 @@ describe('Special permissions', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable } = page;
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -100,6 +101,24 @@ describe('Special permissions', () => {
await page.refresh(); await page.refresh();
expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed'); expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed');
}); });
it('on Search Results - [C290122]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileName);
await dataTable.waitForBody();
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} is not displayed`);
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileName);
await dataTable.waitForBody();
expect(await dataTable.isItemPresent(fileName)).toBe(false, `${fileName} is displayed`);
});
}); });
describe(`Location column is empty if user doesn't have permissions on the file's parent folder`, () => { describe(`Location column is empty if user doesn't have permissions on the file's parent folder`, () => {
@@ -143,5 +162,15 @@ describe('Special permissions', () => {
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items'); expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown'); expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
}); });
it('on Search results - [C306868]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileName);
await dataTable.waitForBody();
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} is not displayed`);
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
});
}); });
}); });
+9 -9
View File
@@ -61,22 +61,22 @@ describe('Sidebar', () => {
it('My Libraries is automatically selected on expanding File Libraries - [C289900]', async () => { it('My Libraries is automatically selected on expanding File Libraries - [C289900]', async () => {
await sidenav.expandFileLibraries(); await sidenav.expandFileLibraries();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES);
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(false, 'File Libraries link is active'); expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries is not active');
expect(await sidenav.childIsActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active'); expect(await sidenav.isActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active');
}); });
it('navigate to Favorite Libraries - [C289902]', async () => { it('navigate to Favorite Libraries - [C289902]', async () => {
await page.goToFavoriteLibraries(); await page.goToFavoriteLibraries();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES);
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(false, 'File Libraries link is active'); expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link is not active');
expect(await sidenav.childIsActive(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toBe(true, 'Favorite Libraries link not active'); expect(await sidenav.isActive(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toBe(true, 'Favorite Libraries link not active');
}); });
it('navigate to My Libraries - [C289901]', async () => { it('navigate to My Libraries - [C289901]', async () => {
await page.goToMyLibraries(); await page.goToMyLibraries();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES);
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(false, 'File Libraries link is active'); expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link is not active');
expect(await sidenav.childIsActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active'); expect(await sidenav.isActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active');
}); });
it('navigates to "Shared Files" - [C213110]', async () => { it('navigates to "Shared Files" - [C213110]', async () => {
@@ -209,7 +209,7 @@ describe('Sidebar', () => {
it('sidebar is collapsed automatically when Search Results opens - [C277223]', async () => { it('sidebar is collapsed automatically when Search Results opens - [C277223]', async () => {
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchForTextAndCloseSearchOptions('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed'); expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed');
@@ -218,7 +218,7 @@ describe('Sidebar', () => {
it('sidenav returns to the default state when navigating away from the Search Results page - [C277224]', async () => { it('sidenav returns to the default state when navigating away from the Search Results page - [C277224]', async () => {
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchForTextAndCloseSearchOptions('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
await page.clickFavorites(); await page.clickFavorites();
@@ -228,7 +228,7 @@ describe('Sidebar', () => {
it('sidenav can be expanded when search results page is displayed - [C277230]', async () => { it('sidenav can be expanded when search results page is displayed - [C277230]', async () => {
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchForTextAndCloseSearchOptions('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
await header.expandSideNav(); await header.expandSideNav();
@@ -49,6 +49,7 @@ describe('Single click on item name', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, breadcrumb } = page; const { dataTable, breadcrumb } = page;
const viewer = new Viewer(); const viewer = new Viewer();
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -196,4 +197,43 @@ describe('Single click on item name', () => {
}); });
}); });
describe('on Search Results', () => {
beforeEach(async done => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
it('Hyperlink appears when mouse over a file - [C306988]', async () => {
await searchInput.searchFor(file1);
await dataTable.waitForBody();
expect(await dataTable.hasLinkOnSearchResultName(file1)).toBe(true, 'Link on name is missing');
});
it('File preview opens when clicking the hyperlink - [C306989]', async () => {
await searchInput.searchFor(file1);
await dataTable.waitForBody();
await dataTable.clickSearchResultNameLink(file1);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await Utils.pressEscape();
});
it('Navigate inside the folder when clicking the hyperlink - [C306990]', async () => {
await searchInput.searchFor(folder1);
await dataTable.waitForBody();
await dataTable.clickSearchResultNameLink(folder1);
expect(await breadcrumb.getCurrentItemName()).toBe(folder1);
});
});
}); });
+3 -5
View File
@@ -83,11 +83,9 @@ describe('Pagination on multiple pages on Favorites', () => {
it('Items per page values - [C280114]', async () => { it('Items per page values - [C280114]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -78,11 +78,9 @@ describe('Pagination on multiple pages', () => {
it('Items per page values - [C280087]', async () => { it('Items per page values - [C280087]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -181,11 +179,9 @@ describe('Pagination on multiple pages', () => {
it('Items per page values - [C291876]', async () => { it('Items per page values - [C291876]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -55,6 +55,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
beforeEach(async (done) => { beforeEach(async (done) => {
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent); await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done(); done();
}); });
@@ -79,11 +80,9 @@ describe('Pagination on multiple pages on Personal Files', () => {
it('Items per page values - [C280078]', async () => { it('Items per page values - [C280078]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -93,7 +92,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getMaxItems()).toContain('25');
expect(await pagination.getTotalPages()).toContain('of 5'); expect(await pagination.getTotalPages()).toContain('of 5');
await pagination.openCurrentPageMenu(); await pagination.openCurrentPageMenu();
expect(pagination.menu.getItemsCount()).toBe(5); expect(await pagination.menu.getItemsCount()).toBe(5);
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
@@ -101,7 +100,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getMaxItems()).toContain('50');
expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.getTotalPages()).toContain('of 3');
await pagination.openCurrentPageMenu(); await pagination.openCurrentPageMenu();
expect(pagination.menu.getItemsCount()).toBe(3); expect(await pagination.menu.getItemsCount()).toBe(3);
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
@@ -79,11 +79,9 @@ describe('Pagination on multiple pages on Recent Files', () => {
it('Items per page values - [C280105]', async () => { it('Items per page values - [C280105]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -140,8 +138,8 @@ describe('Pagination on multiple pages on Recent Files', () => {
await dataTable.waitForHeader(); await dataTable.waitForHeader();
await pagination.clickPrevious(); await pagination.clickPrevious();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
expect(pagination.getRange()).toContain('1-25 of 101'); expect(await pagination.getRange()).toContain('1-25 of 101');
expect(dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page'); expect(await dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page');
await pagination.resetToDefaultPageNumber(); await pagination.resetToDefaultPageNumber();
}); });
@@ -81,11 +81,9 @@ describe('Pagination on multiple pages on Search Results', () => {
it('Items per page values - [C290126]', async () => { it('Items per page values - [C290126]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -140,7 +138,7 @@ describe('Pagination on multiple pages on Search Results', () => {
await dataTable.waitForBody(); await dataTable.waitForBody();
await pagination.clickPrevious(); await pagination.clickPrevious();
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(pagination.getRange()).toContain('1-25 of 101'); expect(await pagination.getRange()).toContain('1-25 of 101');
await pagination.resetToDefaultPageNumber(); await pagination.resetToDefaultPageNumber();
}); });
@@ -82,12 +82,9 @@ describe('Pagination on multiple pages on Shared Files', () => {
it('Items per page values - [C280096]', async () => { it('Items per page values - [C280096]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
+5 -7
View File
@@ -78,11 +78,9 @@ describe('Pagination on multiple pages on Trash', () => {
it('Items per page values - [C280123]', async () => { it('Items per page values - [C280123]', async () => {
await pagination.openMaxItemsMenu(); await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3] expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
.map(async nth => await pagination.menu.getNthItem(nth).getText()); expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(first).toBe('25'); expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
expect(second).toBe('50');
expect(third).toBe('100');
await pagination.menu.closeMenu(); await pagination.menu.closeMenu();
}); });
@@ -130,8 +128,8 @@ describe('Pagination on multiple pages on Trash', () => {
it('navigate to next and previous pages - [C280128]', async () => { it('navigate to next and previous pages - [C280128]', async () => {
await pagination.clickNext(); await pagination.clickNext();
await dataTable.waitForHeader(); await dataTable.waitForHeader();
expect(pagination.getRange()).toContain('26-50 of 101'); expect(await pagination.getRange()).toContain('26-50 of 101');
expect(dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page'); expect(await dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page');
await pagination.resetToDefaultPageNumber(); await pagination.resetToDefaultPageNumber();
await pagination.openCurrentPageMenu(); await pagination.openCurrentPageMenu();
@@ -0,0 +1,214 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, SearchResultsPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
import * as moment from 'moment';
describe('Search results - files and folders', () => {
const username = `user-${Utils.random()}`;
const file = `test-file-${Utils.random()}.txt`;
let fileId;
const fileTitle = 'file title';
const fileDescription = 'file description';
/* cspell:disable-next-line */
const fileRussian = `любимый-сайт-${Utils.random()}`;
let fileRussianId;
const folder = `test-folder-${Utils.random()}`;
let folderId;
const folderTitle = 'folder title';
const folderDescription = 'folder description';
const site = `test-site-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new SearchResultsPage();
const { searchInput } = page.header;
const { dataTable, breadcrumb } = page;
beforeAll(async done => {
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createFile(
file,
'-my-',
fileTitle,
fileDescription
)).entry.id;
await apis.user.nodes.editNodeContent(fileId, 'edited by user');
folderId = (await apis.user.nodes.createFolder(
folder,
'-my-',
folderTitle,
folderDescription
)).entry.id;
fileRussianId = (await apis.user.nodes.createFile(fileRussian)).entry.id;
await apis.user.sites.createSite(site);
await apis.user.search.waitForApi(username, { expect: 2 });
await apis.user.queries.waitForSites(site, { expect: 1 });
await loginPage.loginWith(username);
done();
});
afterAll(async done => {
await Promise.all([
apis.user.nodes.deleteNodeById(fileId),
apis.user.nodes.deleteNodeById(fileRussianId),
apis.user.nodes.deleteNodeById(folderId),
apis.user.sites.deleteSite(site)
]);
done();
});
beforeEach(async done => {
await page.refresh();
done();
});
it('Results page title - [C307002]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('test-');
await dataTable.waitForBody();
expect(await page.breadcrumb.getCurrentItemName()).toEqual(
'Search Results'
);
});
it('File information - [C279183]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('test-');
await dataTable.waitForBody();
const fileEntry = await apis.user.nodes.getNodeById(fileId);
const modifiedDate = moment(fileEntry.entry.modifiedAt).format(
'MMM D, YYYY, h:mm:ss A'
);
const modifiedBy = fileEntry.entry.modifiedByUser.displayName;
const size = fileEntry.entry.content.sizeInBytes;
expect(await dataTable.isItemPresent(file)).toBe(
true,
`${file} is not displayed`
);
expect(await dataTable.getRowCellsCount(file)).toEqual(
2,
'incorrect number of columns'
);
expect(await dataTable.getSearchResultLinesCount(file)).toEqual(
4,
'incorrect number of lines for search result'
);
expect(await dataTable.getSearchResultNameAndTitle(file)).toBe(
`${file} ( ${fileTitle} )`
);
expect(await dataTable.getSearchResultDescription(file)).toBe(
fileDescription
);
expect(await dataTable.getSearchResultModified(file)).toBe(
`Modified: ${modifiedDate} by ${modifiedBy} | Size: ${size} Bytes`
);
expect(await dataTable.getSearchResultLocation(file)).toMatch(
/Location:\s+Personal Files/
);
});
it('Folder information - [C306867]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('test-');
await dataTable.waitForBody();
const folderEntry = await apis.user.nodes.getNodeById(folderId);
const modifiedDate = moment(folderEntry.entry.modifiedAt).format(
'MMM D, YYYY, h:mm:ss A'
);
const modifiedBy = folderEntry.entry.modifiedByUser.displayName;
expect(await dataTable.isItemPresent(folder)).toBe(
true,
`${folder} is not displayed`
);
expect(await dataTable.getRowCellsCount(folder)).toEqual(
2,
'incorrect number of columns'
);
expect(await dataTable.getSearchResultLinesCount(folder)).toEqual(
4,
'incorrect number of lines for search result'
);
expect(await dataTable.getSearchResultNameAndTitle(folder)).toBe(
`${folder} ( ${folderTitle} )`
);
expect(await dataTable.getSearchResultDescription(folder)).toBe(
folderDescription
);
expect(await dataTable.getSearchResultModified(folder)).toBe(
`Modified: ${modifiedDate} by ${modifiedBy}`
);
expect(await dataTable.getSearchResultLocation(folder)).toMatch(
/Location:\s+Personal Files/
);
});
it('Search file with special characters - [C290029]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileRussian);
await dataTable.waitForBody();
expect(await dataTable.isItemPresent(fileRussian)).toBe(
true,
`${fileRussian} is not displayed`
);
});
it('Location column redirect - file in user Home - [C279177]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file);
await dataTable.waitForBody();
await dataTable.clickItemLocation(file);
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
});
});
@@ -26,8 +26,9 @@
import { LoginPage, SearchResultsPage } from '../../pages/pages'; import { LoginPage, SearchResultsPage } from '../../pages/pages';
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('Search results', () => { describe('Search results general', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const file = `test-file-${Utils.random()}.txt`; let fileId; const file = `test-file-${Utils.random()}.txt`; let fileId;
@@ -116,4 +117,36 @@ describe('Search results', () => {
expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`); expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`);
}); });
it('Results are updated automatically when changing the search term - [C279162]', async () => {
await searchInput.clickSearchButton();
await searchInput.searchFor(file);
await page.waitForResults();
expect(await dataTable.isItemPresent(file)).toBe(true, `${file} is not displayed`);
expect(await dataTable.isItemPresent(folder)).toBe(false, `${folder} is displayed`);
await searchInput.clickSearchButton();
await searchInput.searchFor(folder);
expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`);
expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not displayed`);
});
it('Results are returned when accessing an URL containing a search query - [C279178]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor(site);
await page.waitForResults();
expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`);
const url = await browser.getCurrentUrl();
await page.clickPersonalFiles();
await browser.get(url);
await page.waitForResults();
expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`);
});
}); });
@@ -103,13 +103,14 @@ describe('Search results - libraries', () => {
await apis.user.sites.waitForApi({ expect: 12 }); await apis.user.sites.waitForApi({ expect: 12 });
await apis.user.queries.waitForSites('lib', { expect: 2 }); await apis.user.queries.waitForSites('lib', { expect: 2 });
await apis.user.queries.waitForSites('my-site', { expect: 1 });
await loginPage.loginWith(username); await loginPage.loginWith(username);
done(); done();
}); });
afterAll(async (done) => { afterAll(async (done) => {
await Promise.all([ await Promise.all(<any>[
apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate ]), apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate ]),
apis.user.sites.deleteSites([ site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id ]) apis.user.sites.deleteSites([ site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id ])
]); ]);
+22 -282
View File
@@ -66,7 +66,7 @@ describe('Viewer actions', () => {
const destination = `destPF-${Utils.random()}`; let destinationId; const destination = `destPF-${Utils.random()}`; let destinationId;
const docxPersonalFiles = `docxPF-${Utils.random()}.docx`; let docxFileId; const docxPersonalFiles = `docxPF-${Utils.random()}.docx`; let docxFileId;
const docxLockedPersonalFiles = `docxLockedPF-${Utils.random()}.docx`; let docxLockedId;
const xlsxPersonalFiles = `xlsxPF-${Utils.random()}.xlsx`; const xlsxPersonalFiles = `xlsxPF-${Utils.random()}.xlsx`;
const pdfPersonalFiles = `pdfPF-${Utils.random()}.pdf`; const pdfPersonalFiles = `pdfPF-${Utils.random()}.pdf`;
const filePersonalFiles = docxFile2; let filePersonalFilesId; const filePersonalFiles = docxFile2; let filePersonalFilesId;
@@ -80,7 +80,7 @@ describe('Viewer actions', () => {
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id; destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id; docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id;
docxLockedId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxLockedPersonalFiles)).entry.id;
filePersonalFilesId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id; filePersonalFilesId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles); await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles); await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);
@@ -91,7 +91,7 @@ describe('Viewer actions', () => {
await apis.user.nodes.lockFile(fileForCancelEditingId); await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId); await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(docxLockedId);
await loginPage.loginWith(username); await loginPage.loginWith(username);
done(); done();
@@ -116,58 +116,6 @@ describe('Viewer actions', () => {
done(); done();
}); });
it('Correct actions appear in the viewer toolbar - [C282025]', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Correct actions appear in the viewer toolbar for a locked file - [C297583]', async () => {
await dataTable.doubleClickOnRowByName(docxLockedPersonalFiles);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Download action - [C268129]', async () => { it('Download action - [C268129]', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles); await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
@@ -251,7 +199,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`); expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
}); });
@@ -321,7 +269,7 @@ describe('Viewer actions', () => {
const destination = `destFL-${Utils.random()}`; let destinationId; const destination = `destFL-${Utils.random()}`; let destinationId;
const docxLibraries = `docxFL-${Utils.random()}.docx`; let docxFileId; const docxLibraries = `docxFL-${Utils.random()}.docx`; let docxFileId;
const docxLockedLibraries = `docxLockedFL-${Utils.random()}.docx`; let docxLockedId;
const xlsxLibraries = `xlsxFL-${Utils.random()}.xlsx`; const xlsxLibraries = `xlsxFL-${Utils.random()}.xlsx`;
const pdfLibraries = `pdfFL-${Utils.random()}.pdf`; const pdfLibraries = `pdfFL-${Utils.random()}.pdf`;
const fileLibraries = docxFile2; let fileLibrariesId; const fileLibraries = docxFile2; let fileLibrariesId;
@@ -335,9 +283,9 @@ describe('Viewer actions', () => {
const docLibId = await apis.user.sites.getDocLibId(siteName); const docLibId = await apis.user.sites.getDocLibId(siteName);
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id; destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id; docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id;
docxLockedId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLockedLibraries)).entry.id;
fileLibrariesId = (await apis.user.upload.uploadFile(docxFile2, docLibId)).entry.id; fileLibrariesId = (await apis.user.upload.uploadFile(docxFile2, docLibId)).entry.id;
await apis.user.nodes.lockFile(docxLockedId);
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries); await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries); await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);
@@ -371,58 +319,6 @@ describe('Viewer actions', () => {
done(); done();
}); });
it('Correct actions appear in the viewer toolbar - [C297587]', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Correct actions appear in the viewer toolbar for a locked file - [C297588]', async () => {
await dataTable.doubleClickOnRowByName(docxLockedLibraries);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Download action - [C286369]', async () => { it('Download action - [C286369]', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries); await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -506,7 +402,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`); expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
}); });
@@ -552,7 +448,7 @@ describe('Viewer actions', () => {
const destination = `destRF-${Utils.random()}`; let destinationId; const destination = `destRF-${Utils.random()}`; let destinationId;
const docxRecentFiles = `docxRF-${Utils.random()}.docx`; let docxFileId; const docxRecentFiles = `docxRF-${Utils.random()}.docx`; let docxFileId;
const docxLockedRecentFiles = `docxLockedRF-${Utils.random()}.docx`; let docxLockedId;
const xlsxRecentFiles = `xlsxRF-${Utils.random()}.xlsx`; const xlsxRecentFiles = `xlsxRF-${Utils.random()}.xlsx`;
const pdfRecentFiles = `pdfRF-${Utils.random()}.pdf`; const pdfRecentFiles = `pdfRF-${Utils.random()}.pdf`;
const fileRecent = docxFile2; let fileRecentId; const fileRecent = docxFile2; let fileRecentId;
@@ -566,7 +462,7 @@ describe('Viewer actions', () => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id; parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id; destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id; docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id;
docxLockedId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxLockedRecentFiles)).entry.id;
fileRecentId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id; fileRecentId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id; fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
@@ -576,7 +472,7 @@ describe('Viewer actions', () => {
await apis.user.nodes.lockFile(fileForCancelEditingId); await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId); await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(docxLockedId);
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles); await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxRecentFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles); await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfRecentFiles);
@@ -603,58 +499,6 @@ describe('Viewer actions', () => {
done(); done();
}); });
it('Correct actions appear in the viewer toolbar - [C297592]', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isToggleFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Correct actions appear in the viewer toolbar for a locked file - [C297593]', async () => {
await dataTable.doubleClickOnRowByName(docxLockedRecentFiles);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await toolbar.menu.isToggleFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Download action - [C286383]', async () => { it('Download action - [C286383]', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles); await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -739,7 +583,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`); expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
}); });
@@ -785,7 +629,7 @@ describe('Viewer actions', () => {
const destination = `destSF-${Utils.random()}`; let destinationId; const destination = `destSF-${Utils.random()}`; let destinationId;
const docxSharedFiles = `docxSF-${Utils.random()}.docx`; let docxFileId; const docxSharedFiles = `docxSF-${Utils.random()}.docx`; let docxFileId;
const docxLockedSharedFiles = `docxLockedSF-${Utils.random()}.docx`; let docxLockedId;
const xlsxSharedFiles = `xlsxSF-${Utils.random()}.xlsx`; let xlsxFileId; const xlsxSharedFiles = `xlsxSF-${Utils.random()}.xlsx`; let xlsxFileId;
const pdfSharedFiles = `pdfSF-${Utils.random()}.pdf`; let pdfFileId; const pdfSharedFiles = `pdfSF-${Utils.random()}.pdf`; let pdfFileId;
const fileShared = docxFile2; let fileSharedId; const fileShared = docxFile2; let fileSharedId;
@@ -798,7 +642,7 @@ describe('Viewer actions', () => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id; parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id; destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxSharedFiles)).entry.id; docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxSharedFiles)).entry.id;
docxLockedId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxLockedSharedFiles)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxSharedFiles)).entry.id; xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxSharedFiles)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfSharedFiles)).entry.id; pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfSharedFiles)).entry.id;
fileSharedId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id; fileSharedId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
@@ -809,9 +653,9 @@ describe('Viewer actions', () => {
await apis.user.nodes.lockFile(fileForCancelEditingId); await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId); await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(docxLockedId);
await apis.user.shared.shareFilesByIds([docxFileId, docxLockedId, xlsxFileId, pdfFileId, fileForCancelEditingId, fileForEditOfflineId, fileForUploadNewVersionId, fileSharedId])
await apis.user.shared.shareFilesByIds([docxFileId, xlsxFileId, pdfFileId, fileForCancelEditingId, fileForEditOfflineId, fileForUploadNewVersionId, fileSharedId])
await apis.user.shared.waitForApi({expect: 8}); await apis.user.shared.waitForApi({expect: 8});
await loginPage.loginWith(username); await loginPage.loginWith(username);
@@ -835,58 +679,6 @@ describe('Viewer actions', () => {
done(); done();
}); });
it('Correct actions appear in the viewer toolbar - [C297597]', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Correct actions appear in the viewer toolbar for a locked file - [C297598]', async () => {
await dataTable.doubleClickOnRowByName(docxLockedSharedFiles);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharedLinkSettingsPresent()).toBe(true, `Shared link settings is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await toolbar.menu.isFavoritePresent()).toBe(true, `Favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Download action - [C286376]', async () => { it('Download action - [C286376]', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles); await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -971,7 +763,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`); expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
}); });
@@ -1019,7 +811,7 @@ describe('Viewer actions', () => {
let destinationId; let destinationId;
const docxFavorites = `docxFav-${Utils.random()}.docx`; let docxFileId; const docxFavorites = `docxFav-${Utils.random()}.docx`; let docxFileId;
const docxLockedFavorites = `docxLockedFav-${Utils.random()}.docx`; let docxLockedId;
const xlsxFavorites = `xlsxFav-${Utils.random()}.xlsx`; let xlsxFileId; const xlsxFavorites = `xlsxFav-${Utils.random()}.xlsx`; let xlsxFileId;
const pdfFavorites = `pdfFav-${Utils.random()}.pdf`; let pdfFileId; const pdfFavorites = `pdfFav-${Utils.random()}.pdf`; let pdfFileId;
const fileFav = docxFile2; let fileFavId; const fileFav = docxFile2; let fileFavId;
@@ -1032,7 +824,7 @@ describe('Viewer actions', () => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id; parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id; destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxFavorites)).entry.id; docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxFavorites)).entry.id;
docxLockedId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxLockedFavorites)).entry.id;
xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxFavorites)).entry.id; xlsxFileId = (await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxFavorites)).entry.id;
pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfFavorites)).entry.id; pdfFileId = (await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfFavorites)).entry.id;
fileFavId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id; fileFavId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
@@ -1043,9 +835,9 @@ describe('Viewer actions', () => {
await apis.user.nodes.lockFile(fileForCancelEditingId); await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId); await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(docxLockedId);
await apis.user.favorites.addFavoritesByIds('file', [docxFileId, docxLockedId, xlsxFileId, pdfFileId, fileForEditOfflineId, fileForCancelEditingId, fileForUploadNewVersionId, fileFavId])
await apis.user.favorites.addFavoritesByIds('file', [docxFileId, xlsxFileId, pdfFileId, fileForEditOfflineId, fileForCancelEditingId, fileForUploadNewVersionId, fileFavId])
await apis.user.favorites.waitForApi({expect: 8}); await apis.user.favorites.waitForApi({expect: 8});
await loginPage.loginWith(username); await loginPage.loginWith(username);
@@ -1069,58 +861,6 @@ describe('Viewer actions', () => {
done(); done();
}); });
it('Correct actions appear in the viewer toolbar - [C297599]', async () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `Edit offline is not displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `Cancel editing is displayed`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Correct actions appear in the viewer toolbar for a locked file - [C297600]', async () => {
await dataTable.doubleClickOnRowByName(docxLockedFavorites);
await viewer.waitForViewerToOpen();
expect(await toolbar.isEmpty()).toBe(false, `viewer toolbar is empty`);
expect(await toolbar.isViewPresent()).toBe(false, `View is displayed`);
expect(await toolbar.isDownloadPresent()).toBe(true, `Download is not displayed`);
expect(await toolbar.isPrintPresent()).toBe(true, `Print is not displayed`);
expect(await toolbar.isFullScreenPresent()).toBe(true, `Full screen is not displayed`);
expect(await toolbar.isSharePresent()).toBe(true, `Share is not displayed`);
expect(await toolbar.isViewDetailsPresent()).toBe(true, `view details is not displayed`);
await toolbar.openMoreMenu();
expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `Edit offline is displayed`);
expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `Cancel editing is not displayed`);
expect(await toolbar.menu.isToggleRemoveFavoritePresent()).toBe(true, `Remove favorite is not displayed`);
expect(await toolbar.menu.isCopyPresent()).toBe(true, `Copy is not displayed`);
expect(await toolbar.menu.isMovePresent()).toBe(true, `Move is not displayed`);
expect(await toolbar.menu.isDeletePresent()).toBe(true, `Delete is not displayed`);
expect(await toolbar.menu.isManageVersionsPresent()).toBe(true, `Manage versions is not displayed`);
expect(await toolbar.menu.isUploadNewVersionPresent()).toBe(true, `Upload new version is not displayed`);
await toolbar.closeMoreMenu();
});
it('Download action - [C286390]', async () => { it('Download action - [C286390]', async () => {
await dataTable.doubleClickOnRowByName(docxFavorites); await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -1205,7 +945,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen(); await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing(); await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`); expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
}); });
+17 -1
View File
@@ -49,8 +49,9 @@ describe('Viewer general', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const dataTable = page.dataTable; const { dataTable } = page;
const viewer = new Viewer(); const viewer = new Viewer();
const { searchInput } = page.header;
beforeAll(async (done) => { beforeAll(async (done) => {
await apis.admin.people.createUser({ username }); await apis.admin.people.createUser({ username });
@@ -75,6 +76,7 @@ describe('Viewer general', () => {
}); });
beforeEach(async (done) => { beforeEach(async (done) => {
await page.header.expandSideNav();
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent); await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader(); await dataTable.waitForHeader();
@@ -83,6 +85,7 @@ describe('Viewer general', () => {
afterEach(async (done) => { afterEach(async (done) => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.header.expandSideNav();
done(); done();
}); });
@@ -175,4 +178,17 @@ describe('Viewer general', () => {
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed'); expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
}); });
it('Viewer opens for a file from Search Results - [C279175]', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(xlsxFile);
await dataTable.waitForBody();
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
}); });
+119
View File
@@ -0,0 +1,119 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../pages/pages';
import { FILES } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
import { Viewer } from '../../components/viewer/viewer';
import { PasswordDialog } from './../../components/dialog/password-dialog';
describe('Viewer - password protected file', () => {
const username = `user-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
const protectedFile = FILES.protectedFile;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
const viewer = new Viewer();
const passwordDialog = new PasswordDialog();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.upload.uploadFile(protectedFile.name, parentId);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await page.header.expandSideNav();
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(protectedFile.name);
await viewer.waitForViewerToOpen();
await page.waitForDialog();
done();
});
afterEach(async (done) => {
if (await passwordDialog.isDialogOpen()) {
await passwordDialog.clickClose();
}
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
it('Password dialog appears when opening a protected file - [C268958]', async () => {
expect(await passwordDialog.isDialogOpen()).toBe(true, 'Password dialog not open');
expect(await passwordDialog.isPasswordInputDisplayed()).toBe(true, 'Password input not displayed');
expect(await passwordDialog.isSubmitEnabled()).toBe(false, 'Submit button not disabled');
expect(await passwordDialog.isCloseEnabled()).toBe(true, 'Close button not enabled');
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');
});
it('File content is displayed when entering the correct password - [C268959]', async () => {
await passwordDialog.enterPassword(protectedFile.password);
expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled');
await passwordDialog.clickSubmit();
await passwordDialog.waitForDialogToClose();
expect(await viewer.isPdfViewerContentDisplayed()).toBe(true, 'file content not displayed');
});
it('Error appears when entering an incorrect password - [C268960]', async () => {
await passwordDialog.enterPassword('incorrect');
expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled');
await passwordDialog.clickSubmit();
expect(await passwordDialog.getErrorMessage()).toBe('Password is wrong');
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');
});
it('Refresh the page while Password dialog is open - [C268961]', async () => {
await passwordDialog.enterPassword(protectedFile.password);
await page.refresh();
await viewer.waitForViewerToOpen();
expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed');
expect(await passwordDialog.isDialogOpen()).toBe(true, 'Password dialog not open');
});
});

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