Merge pull request #130 from Alfresco/development

Sync with latest development
This commit is contained in:
Cilibiu Bogdan 2017-12-11 19:52:01 +02:00 committed by GitHub
commit 65f7d1edfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
199 changed files with 10834 additions and 3625 deletions

View File

@ -13,13 +13,21 @@
"app.config.json",
"versions.json",
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-core/bundles/assets", "output": "./assets/" },
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-datatable/bundles/assets", "output": "./assets/" },
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-viewer/bundles/assets", "output": "./assets/" },
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-documentlist/bundles/assets", "output": "./assets/" },
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-login/bundles/assets", "output": "./assets/" },
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-upload/bundles/assets", "output": "./assets/" },
{ "glob": "**/*", "input": "../node_modules/ng2-alfresco-search/bundles/assets", "output": "./assets/" },
{
"glob": "**/*",
"input": "../node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "./assets/prebuilt-themes"
},
{
"glob": "**/*",
"input": "../node_modules/@alfresco/adf-core/bundles/assets",
"output": "./assets/"
},
{
"glob": "**/*",
"input": "../node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "./assets/"
},
{ "glob": "pdf.worker.js", "input": "../node_modules/pdfjs-dist/build", "output": "./" }
],
@ -31,6 +39,8 @@
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"./assets/fonts/material-icons/material-icons.css",
"./assets/fonts/muli/muli.css",
"styles.scss"
],
"scripts": [
@ -79,7 +89,8 @@
"component": {},
"serve": {
"proxyConfig": "proxy.conf.js",
"port": 3000
"port": 3000,
"host": "0.0.0.0"
}
}
}

288
LICENSE
View File

@ -1,177 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
0. Additional Definitions.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
1. Exception to Section 3 of the GNU GPL.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Conveying Modified Versions.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
3. Object Code Incorporating Material from Library Header Files.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
4. Combined Works.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
d) Do one of the following:
END OF TERMS AND CONDITIONS
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -1,9 +1,75 @@
# Alfresco Content App
# Alfresco Example Content Application
## Prerequisites
## Introduction
- Alfresco Content Services (Community) or Alfresco Content Services 5.2.2 (Enterprise)
- [node.js](https://nodejs.org/en/) 8.9.1 or later
The Alfresco Content Application is an example application built using
[Alfresco Application Development Framework (ADF)](https://github.com/Alfresco/alfresco-ng2-components) components.
### Who is this example application for
This example application demonstrates to Angular software engineers
how to construct a content application using the Alfresco ADF.
This example application represents a meaningful composition of ADF components that provide end users
with a simple and easy to use interface for working with files stored in the Alfresco Content Services repository.
### Prerequisites
This application utilises the latest releases from Alfresco:
- [Alfresco ADF version 2.0](https://community.alfresco.com/community/application-development-framework/pages/get-started)
- [Alfresco Content Services version 5.2.2](https://www.alfresco.com/platform/content-services-ecm)
- [Alfresco Community Edition 201707](https://www.alfresco.com/products/community/download)
<p class="warning">
You also need [node.js](https://nodejs.org/en/) (8.9.1 or later) installed to build it locally from source code.
</p>
The latest version of the Alfresco Content platform is required
due to the application utilising the latest [REST APIs](https://docs.alfresco.com/5.2/pra/1/topics/pra-welcome.html) developments.
## Where to get help
There are a number of ways to get help with building applications using the Alfresco Application Development Framework:
### Alfresco DevCon 2018
DevCon 2018 is an international developer conference entirely dedicated to Alfresco technology.
With the support of our community, customers, and partners, DevCon will increase your technical know-how,
connect you with other Alfresco developers, and let you collaborate with our team and each other.
Register now to avoid disappointment, places are limited:
http://devcon.alfresco.com/
### Alfresco Community
Visit the Alfresco Community space where you can find many resources to help you get started building your application,
along with blog posts from the Alfresco developers and much more:
https://community.alfresco.com/community/application-development-framework
### Alfresco ADF Gitter
Join the vibrant community in Gitter where you can chat with experienced developers,
including the Alfresco employees working directly on the ADF and this example application project:
https://gitter.im/Alfresco/alfresco-ng2-components
### Alfresco Developer Support
Developer Support is a subscription-based support offering delivered remotely
by a dedicated team of development-focused, senior Support Engineers.
This support offering is best for customers and partners that require on-going support
for their development teams and customized code.
Visit the Developer Support Services section on the Alfresco website for more information:
https://www.alfresco.com/alfresco-developer-support-services
### Alfresco University
Training with Alfresco University is the best way to acquire the right skills for your team to deliver a successful Alfresco implementation.
The most cost-effective way to take advantage of this valuable training is through Alfresco University Passport.
Visit the Alfresco University section on the Alfresco website for more information:
https://www.alfresco.com/alfresco-university
## Building and running locally
@ -13,3 +79,25 @@ Please refer to the [developer docs](/build) to get more details on building and
The Content App provides a "Dockerfile" and "docker-compose" files to aid in running application in a container.
Please refer to the "[Using with Docker](/docker)" article for more details.
## Contribution Policy
### How to contribute
Fork our repository and submit a pull request when your code is ready for review.
To be considered the Travis build has to be green and all our automation tests have to run without regressions.
### Contribute to the existing code base
What are we reviewing for?
- **License**: Every file should contain the Alfresco LICENSE header, LGPL Licence.
- **Tests**: Add unit cases to cover the new behaviour, and make sure all the existing tests are still green.
- **JS Documentation**: Every class needs to have its own inline jsdoc, this documentation should explain the general purpose of the class and of each method.
- **Documentation**: Update the documentation explaining how to use the new functionality, may not be necessary in the cases where change impacts only the CSS style.
- **Clean Coding**: Some good rules are enforced by the tslint, but we want also our code to be easy to read. Please avoid comments inside the code or leaving pieces of code commented out.
- **Localization**: Your contribution needs to support localization, with all new strings externalized, all translations are inside the i18n. The minimum requirement is English.
### How long will it take for my contribution to be reviewed?
The time necessary for a code review will vary, smaller changes may be reviewed within days, while larger changes may take longer.

View File

@ -2,7 +2,14 @@
The Content App is based on [Angular CLI](https://cli.angular.io), and you can use all the commands, generators and blueprints supported by the CLI.
Use the following commands to clone a copy of the project, install dependencies and run it.
## Prerequisites
- [Node.js](https://nodejs.org/en/) 8.9.1 or later LTS version
- [Angular CLI](https://cli.angular.io/)
## Cloning and running
Use the following commands to clone the project, install dependencies and run it.
```sh
git clone https://github.com/Alfresco/alfresco-content-app.git
@ -11,18 +18,18 @@ npm install
npm start
```
The application run at port 3000 by default, and should automatically open in the default browser once project compilation finishes.
The application runs at port 3000 by default, and should automatically open in the default browser once project compilation finishes.
## Proxy settings
The Content App provides a proxy configuration for local development server
that allows you to address specific scenarios with CORS and native authentication dialogue.
that allows you to address specific scenarios with CORS and native authentication dialog.
You can find settings in the "proxy.conf.js" file in the project root directory.
<p class="warning">
The proxy settings get automatically applied every time you run the application with "npm start" script.
You must restart the application every time you change the setting values.
You must restart the application every time you change the settings values.
</p>
## Running documentation locally

View File

@ -1,6 +1,6 @@
# Application Configuration
The Content Application provides support for a global settings file `app.config.json` that you can use to customise the behaviour of ACA and ADF components.
The Content Application provides support for a global settings file `app.config.json` that you can use to customize the behavior of ACA and ADF components.
## Server settings
@ -29,7 +29,7 @@ Optionally it can also use the value of the original port if present, for exampl
### Static address
Alternatively, you can provide a static address for the ACS services if necessary:
Alternatively, you can provide a static address for the ACS server if necessary:
```json
{
@ -40,7 +40,7 @@ Alternatively, you can provide a static address for the ACS services if necessar
## Application settings
The are many settings you can change to alter the default behaviour of the application.
The are many settings you can change to alter the default behavior of the application.
### Application Name
@ -104,7 +104,7 @@ You can change the default settings of the pagination that gets applied to all t
## Your custom settings
You can store any information in the application configuration file, and access it at runtime by utilising the `AppConfigService` service provided by the ADF framework.
You can store any information in the application configuration file, and access it at runtime by using the `AppConfigService` service provided by ADF.
<p class="tip">
Please refer to the [AppConfigService](https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/app-config.service.md) documentation to get more details on Application Configuration features and API available.

View File

@ -2,7 +2,7 @@
## Chrome Workaround
For the Chrome you can use the following plugin that allows you toggle CORS:
For the Chrome browser you can use the following plugin that allows you toggle CORS:
[Allow-Control-Allow-Origin](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi)
## Firefox Workaround

View File

@ -86,3 +86,51 @@ To perform a cleanup operation, use the next command:
```sh
docker-compose down --rmi all
```
## Publishing to Docker Hub
First of all, if you do not have a Docker Hub account, you can register here: https://hub.docker.com/, the registration is absolutely free.
Next, it is recommended that you get a clean build of the application:
```sh
npm install
npm run build:dev
```
The commands above are going to produce a fresh build that is stored in the `dist` folder.
At this point, you can make modifications to the final code in the `dist` folder if needed.
For example you may want to change the `app.config.json` file content.
Now you can build your first version of the image:
```sh
docker image build -t myaccount/content-app:1.0 .
```
Where `myaccount` is usually your Docker Hub account name.
<p class="warning">
Please note the ending "." symbol at the end of the command. It instructs the Docker to take current folder where the `Dockerfile` is located.
</p>
To publish the newly created image use the next command:
```sh
docker push myaccount/content-app:1.0
```
## Running from Docker Hub
In order to quickly test the published image, or run it on another machine, use the following command:
```sh
docker container run -p 80:80 --rm myaccount/content-app:1.0
```
The `--rm` switch means the Docker will cleanup the container and image data once you stop the process.
<p class="tip">
You may also want to remove your local image before trying out the Docker Hub:<br>
`docker image rm myaccount/content-app:1.0`
</p>

33
docs/faq.md Normal file
View File

@ -0,0 +1,33 @@
# Frequently asked questions
## How do I log an issue (bug, enhancement, feature)?
Log any issues in the ['ACA' JIRA project](https://issues.alfresco.com/jira/projects/ACA),
please include a clear description, steps to reproduce and screenshots where appropriate.
All issues will be reviewed; bugs will be categorised if reproducible and enhancement/feature suggestions
will be considered against existing priorities if the use case serves a general purpose need.
## Does Alfresco provide customer support for the example content application?
Alfresco does not provide Customer Support, it is an example application for developers; [Developer Support Services](https://www.alfresco.com/alfresco-developer-support-services) are available from Alfresco.
## Does this/Will this application replace Alfresco Share?
This example application is designed to demonstrate how to construct a content application using the Alfresco Application Development Framework,
it is not intended to be a replacement for Alfresco Share.
## Where can I get help building an application?
See [Where to get help](/?id=where-to-get-help) section.
## How do I contribute to the project?
See [Contribution Policy](/?id=contribution-policy) section.
## What would you like me to contribute?
Please refer to the ['ACA' JIRA project](https://issues.alfresco.com/jira/projects/ACA) for tickets in the project backlog.
## How often will this project be updated?
This project will continue evolve as the Alfresco ADF evolves, with Alfresco and community developers contributing to its progress.

191
docs/features.md Normal file
View File

@ -0,0 +1,191 @@
# Features
The concept of this example is a simple user interface which makes accessing files in the Alfresco Content Services repository easy.
Often Content Management systems provide more capabilities out of the box than most users need;
providing too many capabilities to these users prevents them from working efficiently,
so they may end up using unsanctioned file management solutions which presents a proliferation of content storage
and collaboration solutions as well as compliance issues for organisations.
This application demonstrates how the complexity of Content Management can be simplified
using the Alfresco Application Development Framework to easily and quickly create custom solutions for specific user cases.
## User Interface - layout
![](images/features-01.png)
### Header (1)
The application [header](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/header) has three main elements.
Logo & app primary color - logo and color are configurable by updating the
[app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json) file in the root folder of the project,
see [How to change the logo and color](/) and [Application Configuration](/configuration) for more information
[Search](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/search) -
utilizing the [ADF Search Component](https://github.com/Alfresco/alfresco-ng2-components/tree/master/lib/content-services/search)
the app provides a 'live' search feature, where users can open files and folders directly from the Search API results.
[Current User](https://github.com/Alfresco/alfresco-content-app/tree/development/src/app/components/current-user) -
displays the user's name, and a menu where users can logout.
Optionally through updating the [app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json)
a language switching menu can be displayed.
### Side Nav (2)
The application [side navigation](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/sidenav) has two features;
a button menu and navigation links.
#### New button
The New button displays a menu which provides three actions:
- Create a new folder - provides a dialog which allows the creation of a new folder, the folder name is mandatory and the description is optional.
- Upload a file - invokes the operating system file browser and allows a user to select file(s) to upload into their current location in the content repository.
- Upload a folder - invokes the operating system folder browser and allows a user to select folder(s) to upload to their current location in the content repository.
When an upload starts the [upload component](https://github.com/Alfresco/alfresco-ng2-components/tree/master/lib/content-services/upload)
is displayed which shows the user the progress of the uploads they have started.
The upload dialog persists on the screen and can be minimised; users are able to continue using the application whilst uploads are in progress
and uploads can be canceled which will stop uploads in progress or permanently delete already completed uploads.
#### Navigation
The navigation links are configurable via the [app.config.json](https://github.com/Alfresco/alfresco-content-app/blob/master/src/app.config.json).
Default configuration creates two sections.
See [How to work with the side navigation](/) for more information about configuring the side navigation.
### Document List Layout (3)
The main area of the application is composed from a number of individual ADF components:
- [Breadcrumb](https://alfresco.github.io/adf-component-catalog/components/BreadcrumbComponent.html)
- [Toolbar](https://alfresco.github.io/adf-component-catalog/components/ToolbarComponent.html)
- [Document List](https://alfresco.github.io/adf-component-catalog/components/DocumentListComponent.html)
- [Pagination](https://alfresco.github.io/adf-component-catalog/components/PaginationComponent.html)
The application has six different Document List views which contain subtle differences depending on the content being loaded.
#### Personal Files
Personal Files retrieves all content from the logged in users home area (`/User Homes/<username>/` in the repository);
if the user is admin who does not have a home folder then the repository root folder is shown.
Personal Files is the [Files component](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/files),
using the [Nodes API](https://api-explorer.alfresco.com/api-explorer/#/nodes).
#### File Libraries
File Libraries retrieves all the sites that the user is a member including what type of site it is; public, moderated or private.
File Libraries is the [Libraries component](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/libraries),
using the [Sites API](https://api-explorer.alfresco.com/api-explorer/#/sites).
When a user opens one of their sites then the content for that sites document library is shown.
To display the files and folders from a site (`/Sites/<siteid>/Document Library/`) the [Files component](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/files),
using the [Nodes API](https://api-explorer.alfresco.com/api-explorer/#/nodes) is used.
#### Shared Files
The Shared Files view aggregates all files that have been shared using the QuickShare feature in the content repository.
The [Shared Files component](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/shared-files)
uses the [shared-links API](https://api-explorer.alfresco.com/api-explorer/#/shared-links)
and includes extra columns to display where the file is
[located](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/location-link)
in the content repository and who created the shared link.
A feature for creating and removing Shared Links will be added in the future.
#### Recent Files
The Recent Files view shows all the files that have been modified within the last 30 days by the current user.
The [Recent Files](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/current-user)
component uses the Search API to query SOLR for changes made by the user and includes an extra column to display where the file is
[located](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/location-link)
in the content repository.
#### Favorites
The Favorites view shows all files and folders from the content repository that have been marked as a favorite by the current user.
The [Favorites](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/favorites) component uses the
[favorites](https://api-explorer.alfresco.com/api-explorer/#/favorites) API to retrieve all the favorite nodes for the user
and includes an extra column to display where the file is
[located](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/location-link)
in the content repository.
#### Trash
The Trash view shows all the items that a user has deleted, admin will see items deleted by all users.
The actions available in this view are Restore and Permanently Delete.
The [Trashcan](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/trashcan) component uses the
[trashcan](https://api-explorer.alfresco.com/api-explorer/#/trashcan) API to retrieve the deleted items
and perform the actions requested by the user and includes an extra column to display where the file is
[located](https://github.com/Alfresco/alfresco-content-app/tree/master/src/app/components/location-link)
in the content repository.
#### Actions and the Actions Toolbar
All the views incorporate the [toolbar](https://alfresco.github.io/adf-component-catalog/components/ToolbarComponent.html)
component from the Alfresco Application Development Framework;
apart from the Trash view they all display the following actions when the current user has the necessary permissions,
actions are automatically hidden when the user does not have permission.
<table>
<thead>
<th>Action</th>
<th>File</th>
<th>Folder</th>
</thead>
<tbody>
<tr>
<td>View</td>
<td>
Opens the selected file using the [Preview](https://github.com/Alfresco/alfresco-content-app/tree/development/src/app/components/preview) component,
where the file cannot be displayed natively in a browser a PDF rendition is obtained from the repository.
</td>
<td>Not applicable</td>
</tr>
<tr>
<td>Download</td>
<td>Downloads single files to the users computer, when multiple files are selected they are compressed into a ZIP and then downloaded.</td>
<td>Folders are automatically compressed into a ZIP and then downloaded to the users computer.</td>
</tr>
<tr>
<td>Edit</td>
<td>Not applicable</td>
<td>The folder name and description can be edited in a dialog.</td>
</tr>
<tr>
<td>Favorite</td>
<td colspan="2">
Toggle the favorite mark on or off for files and folders, when multiple items are selected
and one or more are not favorites then the mark will be toggled on.
</td>
</tr>
<tr>
<td>Copy</td>
<td colspan="2">
Files and folders can be copied into other locations in the content repository using the
[content-node-selector](https://alfresco.github.io/adf-component-catalog/components/ContentNodeSelectorComponent.html) component;
once the copy action has completed the user is notified and can undo the action (which permanently deletes the copies created).
</td>
</tr>
<tr>
<td>Move</td>
<td colspan="2">
Files and folders can be moved into other locations in the content repository using the
[content-node-selector](https://alfresco.github.io/adf-component-catalog/components/ContentNodeSelectorComponent.html) component;
once the move action has completed the user is notified and can undo the action (which moves the items back to the original location).
</td>
</tr>
<tr>
<td>Delete</td>
<td colspan="2">
Files and folders can be deleted from their location in the content repository;
once the delete action has completed the user is notified and undo the action (which restores the items from the trash).
</td>
</tr>
</tbody>
</table>
As well as the actions available in the toolbar users can single click an item to select it,
or double click on a file to view it, and a folder to open it.

131
docs/i18n.md Normal file
View File

@ -0,0 +1,131 @@
# Internationalization (i18n)
The Content Application provides support for the following languages:
- German (`de`)
- English (`en`)
- Spanish (`es`)
- French (`fr`)
- Italian (`it`)
- Japanese (`ja`)
- Norwegian (`nb`)
- Dutch (`nl`)
- Brazilian Portuguese (`pt-BR`)
- Russian (`ru`)
- Simplified Chinese (`zh-CN`)
The fallback locale is the English one, however current browser language is taken as the default one automatically when the application starts.
## User-defined language
You can allow users to set custom language that gets saved to user preferences.
The main application menu already has the [ADF Language Menu](https://github.com/Alfresco/alfresco-ng2-components/blob/development/docs/language-menu.component.md) component integrated and pre-filled with the supported items.
To change the default language set edit the `app.config.json` file and add or remove items:
```json
{
...,
"languages": [
{
"key": "de",
"label": "German"
},
{
"key": "en",
"label": "English"
},
{
"key": "es",
"label": "Spanish"
},
...
]
}
```
The file is located at the following path: `/src/app.config.json`.
## Custom languages
To add a custom language, add a new "JSON" file to the "/src/assets/i18n" folder
with the name of the target locale, for instance, a "de.json" for the "German".
Translate the resource strings based on the default "en.json" file.
You can copy the content over to your newly created file and replace English values with translated text.
```json
{
"APP": {
"SIGN_IN": "Anmelden",
"SIGN_OUT": "Abmelden",
"NEW_MENU": {
"LABEL": "Neu",
"MENU_ITEMS": {
"CREATE_FOLDER": "Ordner erstellen",
"UPLOAD_FILE": "Datei hochladen",
"UPLOAD_FOLDER": "Ordner hochladen"
},
...
}
},
...
}
```
The Content Application automatically bundles your file upon project build.
You can test your locale by changing the browser language settings and reloading the page.
Optionally, you can extend the [ADF Language Menu](https://github.com/Alfresco/alfresco-ng2-components/blob/development/docs/language-menu.component.md) component with the newly added language by updating the `app.config.json` file.
## Customizing ADF translations
In addition to creating a custom language file for the Content Application,
you can also provide translations for the ADF resources.
Your `/src/assets/i18n/<lang>.json` file can reflect the structure of one of the ADF language files:
- ADF Core ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/core/i18n/en.json))
- ADF Content Services ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/content-services/i18n/en.json))
- ADF Process Services ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/process-services/i18n/en.json))
- ADF Insights ([en.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/insights/i18n/en.json))
At runtime, the application-level strings have the highest priority.
That means you can replace the value of any ADF resource string if needed.
For example, let's change the title of the "Create Folder" dialog shipped with the ADF.
Modify the `/src/assets/i18n/en.json` file and append the "CORE" section like in the example below:
```json
{
"APP": {
...
},
"CORE": {
"FOLDER_DIALOG": {
"CREATE_FOLDER_TITLE": "Custom title"
}
}
}
```
Now, if you run the application and click the "New → Create Folder" menu,
the title of the dialog should look similar to the following:
![](images/aca-i18n-01.png)
## Language picker
You can enable internal language picker in the `app.config.json` file:
```json
{
...,
"languagePicker": true,
...
}
```
![](images/aca-i18n-02.png)

BIN
docs/images/aca-i18n-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
docs/images/aca-i18n-02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
docs/images/features-01.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -18,6 +18,10 @@
title: 'Home',
path: '/'
},
{
title: 'Features',
path: 'features'
},
{
title: 'Building',
path: 'build'
@ -26,6 +30,10 @@
title: 'Docker',
path: 'docker'
},
{
title: 'FAQ',
path: 'faq'
},
{
title: 'Guides',
type: 'dropdown',
@ -34,6 +42,10 @@
title: 'Building',
path: 'build'
},
{
title: 'Internationalization (i18n)',
path: 'i18n'
},
{
title: 'CORS',
path: 'cors'

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, element, by, ExpectedConditions as EC, browser } from 'protractor';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
export * from './login/login';

View File

@ -1,21 +1,29 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, promise, by, browser, ExpectedConditions as EC } from 'protractor';
import { ElementFinder, ElementArrayFinder, promise, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component';
@ -32,7 +40,9 @@ export class DataTable extends Component {
body: 'table > tbody',
row: 'tr',
selectedRow: 'tr.is-selected',
cell: 'td',
locationLink: 'app-location-link',
emptyListContainer: 'td.adf-no-content-container',
emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
@ -44,6 +54,7 @@ export class DataTable extends Component {
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
cell = by.css(DataTable.selectors.cell);
locationLink = by.css(DataTable.selectors.locationLink);
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
@ -94,13 +105,16 @@ export class DataTable extends Component {
return this.body.all(by.css(DataTable.selectors.row));
}
getSelectedRows(): ElementArrayFinder {
return this.body.all(by.css(DataTable.selectors.selectedRow));
}
getNthRow(nth: number): ElementFinder {
return this.getRows().get(nth - 1);
}
getRowByContainingText(text: string): ElementFinder {
const locator = by.cssContainingText(DataTable.selectors.row, text);
return this.body.element(locator);
getRowByName(name: string): ElementFinder {
return this.body.element(by.cssContainingText(`.adf-data-table-cell`, name));
}
countRows(): promise.Promise<number> {
@ -108,18 +122,43 @@ export class DataTable extends Component {
}
// Navigation/selection methods
doubleClickOnRowByContainingText(text: string): promise.Promise<void> {
const row = this.getRowByContainingText(text);
const dblClick = browser.actions().mouseMove(row).click().click();
doubleClickOnItemName(name: string): promise.Promise<any> {
const dblClick = browser.actions()
.mouseMove(this.getRowByName(name))
.click()
.click();
return dblClick.perform();
}
clickOnRowByContainingText(text: string): promise.Promise<void> {
const row = this.getRowByContainingText(text);
const click = browser.actions().mouseMove(row).click();
clickOnItemName(name: string): promise.Promise<any> {
return this.getRowByName(name).click();
}
return click.perform();
selectMultipleItems(names: string[]): promise.Promise<void> {
return browser.actions().sendKeys(protractor.Key.COMMAND).perform()
.then(() => {
names.forEach(name => {
this.clickOnItemName(name);
});
})
.then(() => browser.actions().sendKeys(protractor.Key.NULL).perform());
}
clearSelection() {
this.getSelectedRows().count()
.then(count => {
if (count !== 0) { browser.refresh().then(() => this.waitForHeader()); }
});
}
getItemLocation(name: string) {
const rowLocator = by.cssContainingText(DataTable.selectors.row, name);
return this.body.element(rowLocator).element(this.locationLink);
}
clickItemLocation(name: string) {
return this.getItemLocation(name).click();
}
// empty state methods

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, protractor, ExpectedConditions as EC, promise } from 'protractor';
@ -21,11 +29,11 @@ import { Component } from '../component';
export class CreateOrEditFolderDialog extends Component {
private static selectors = {
root: '.mat-dialog-container',
root: 'adf-folder-dialog',
title: '.mat-dialog-title',
nameInput: '.mat-dialog-container .mat-input-element[placeholder="Name"]',
descriptionTextArea: '.mat-dialog-container .mat-input-element[placeholder="Description"]',
nameInput: '.mat-input-element[placeholder="Name" i]',
descriptionTextArea: '.mat-input-element[placeholder="Description" i]',
button: '.mat-dialog-actions button',
validationMessage: '.mat-hint span'
};
@ -64,33 +72,27 @@ export class CreateOrEditFolderDialog extends Component {
.catch(() => '');
}
enterName(name: string): CreateOrEditFolderDialog {
const { nameInput } = this;
enterName(name: string): promise.Promise<CreateOrEditFolderDialog> {
return this.nameInput.clear()
.then(() => this.nameInput.sendKeys(name))
.then(() => this);
}
nameInput.clear();
nameInput.sendKeys(name);
return this;
enterDescription(description: string): promise.Promise<CreateOrEditFolderDialog> {
return this.descriptionTextArea.clear()
.then(() => {
browser.actions().click(this.descriptionTextArea).sendKeys(description).perform();
})
.then(() => this);
}
deleteNameWithBackspace(): promise.Promise<void> {
const { nameInput } = this;
return nameInput.clear()
return this.nameInput.clear()
.then(() => {
return nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
return this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
});
}
enterDescription(description: string): CreateOrEditFolderDialog {
const { descriptionTextArea } = this;
descriptionTextArea.clear();
descriptionTextArea.sendKeys(description);
return this;
}
clickCreate() {
return this.createButton.click();
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 } from 'protractor';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, element, by, promise } from 'protractor';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { by, ElementFinder, promise } from 'protractor';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, promise } from 'protractor';
@ -47,7 +55,11 @@ export class Menu extends Component {
return this.getItemByLabel(label).getAttribute('title');
}
clicktNthItem(nth: number): promise.Promise<void> {
getItemsCount(): promise.Promise<number> {
return this.items.count();
}
clickNthItem(nth: number): promise.Promise<void> {
return this.getNthItem(nth).click();
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, promise, by, browser, ExpectedConditions as EC } from 'protractor';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
@ -46,10 +54,7 @@ export class Sidenav extends Component {
}
isActiveByLabel(label: string): promise.Promise<boolean> {
return this
.getLinkByLabel(label)
.getWebElement()
.then(element => element.getAttribute('class'))
return this.getLinkByLabel(label).getAttribute('class')
.then(className => className.includes(Sidenav.selectors.activeLink.replace('.', '')));
}
@ -57,7 +62,7 @@ export class Sidenav extends Component {
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
}
navigateToLinkByLabel(label: string): promise.Promise<void> {
navigateToLinkByLabel(label: string): promise.Promise<any> {
return this.getLinkByLabel(label).click();
}
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';

View File

@ -1,21 +1,29 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
@ -34,4 +42,22 @@ export class ToolbarBreadcrumb extends Component {
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
getItemsCount(): promise.Promise<number> {
return this.items.count();
}
getFirstItemName(): promise.Promise<string> {
return this.items.get(0).getAttribute('title');
}
getCurrentItem(): promise.Promise<ElementFinder> {
return this.getItemsCount()
.then(count => this.getNthItem(count));
}
getCurrentItemName(): promise.Promise<string> {
return this.getCurrentItem()
.then(node => node.getAttribute('title'));
}
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 } from 'protractor';

View File

@ -1,7 +1,32 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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/>.
*/
export const BROWSER_RESOLUTION_WIDTH = 1200;
export const BROWSER_RESOLUTION_HEIGHT = 800;
export const BROWSER_WAIT_TIMEOUT = 10000;
export const BROWSER_WAIT_TIMEOUT = 20000;
// Application configs
export const APP_HOST = 'http://localhost:3000';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { promise } from 'protractor';

View File

@ -1,20 +1,27 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, ExpectedConditions as EC, promise } from 'protractor';
import { LoginComponent } from '../components/components';
import { Page } from './page';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { promise } from 'protractor';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, element, by, ElementFinder, promise, ExpectedConditions as EC } from 'protractor';
@ -25,7 +33,8 @@ export abstract class Page {
app: by.css('app-root'),
layout: by.css('app-layout'),
overlay: by.css('.cdk-overlay-container'),
snackBar: by.css('simple-snack-bar')
snackBar: by.css('simple-snack-bar'),
snackBarAction: by.css('.mat-simple-snackbar-action')
};
public app: ElementFinder = element(this.locators.app);
@ -63,4 +72,8 @@ export abstract class Page {
.then(() => this.snackBar.getText())
.catch(() => '');
}
getSnackBarAction(): ElementFinder {
return this.snackBar.element(this.locators.snackBarAction);
}
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
export * from './browsing-page';

View File

@ -1,23 +1,31 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { protractor, browser, by, ElementFinder } from 'protractor';
import { APP_ROUTES, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { Utils } from '../../utilities/utils';
@ -42,16 +50,13 @@ describe('Create folder', () => {
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage(APP_ROUTES.PERSONAL_FILES);
const personalFilesPage = new BrowsingPage();
const createDialog = new CreateOrEditFolderDialog();
const dataTable = personalFilesPage.dataTable;
const { dataTable } = personalFilesPage;
function openCreateDialog(): any {
return personalFilesPage.sidenav
.openNewMenu()
.then((menu) => {
menu.clickMenuItem('Create folder');
})
return personalFilesPage.sidenav.openNewMenu()
.then(menu => menu.clickMenuItem('Create folder'))
.then(() => createDialog.waitForDialogToOpen());
}
@ -61,25 +66,25 @@ describe('Create folder', () => {
.then(() => apis.admin.nodes.createFolders([ folderName1 ], `Sites/${siteName}/documentLibrary`))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.user.nodes.createFolders([ duplicateFolderName ], parent))
.then(() => loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done));
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
personalFilesPage.load()
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.$('body').sendKeys(protractor.Key.ESCAPE).then(done);
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise
.all([
apis.admin.sites.deleteSite(siteName, true),
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ parent ]),
logoutPage.load()
])
@ -87,215 +92,188 @@ describe('Create folder', () => {
});
it('option is enabled when having enough permissions', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => personalFilesPage.sidenav.openNewMenu()
.then((menu) => {
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
expect(isEnabled).toBe(true, 'Create folder is not enabled');
})
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => personalFilesPage.sidenav.openNewMenu())
.then(menu => {
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(true, 'Create folder is not enabled');
});
});
it('creates new folder with name', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => createDialog.enterName(folderName1).clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByContainingText(folderName1).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
})
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName(folderName1))
.then(() => createDialog.clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByName(folderName1).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
});
});
it('creates new folder with name and description', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => {
createDialog
.enterName(folderName2)
.enterDescription(folderDescription)
.clickCreate();
})
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByContainingText(folderName2).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
})
.then(() => {
apis.user.nodes.getNodeDescription(folderName2)
.then((description) => expect(description).toEqual(folderDescription));
})
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName(folderName2))
.then(() => createDialog.enterDescription(folderDescription))
.then(() => createDialog.clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByName(folderName2).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
})
.then(() => {
expect(apis.user.nodes.getNodeDescription(folderName2)).toEqual(folderDescription);
});
});
it('enabled option tooltip', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => personalFilesPage.sidenav.openNewMenu()
.then(menu => {
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
action.perform();
return menu;
})
.then((menu) => {
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain('Create new folder');
})
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => personalFilesPage.sidenav.openNewMenu())
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
.then(() => menu))
.then(menu => {
expect(menu.getItemTooltip('Create folder')).toContain('Create new folder');
});
});
it('option is disabled when not enough permissions', () => {
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
const fileLibrariesPage = new BrowsingPage();
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(siteName))
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(folderName1))
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
.then(() => fileLibrariesPage.sidenav.openNewMenu())
.then(menu => {
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
const isEnabled = menu.getItemByLabel('Create folder').isEnabled();
expect(isEnabled).toBe(false, 'Create folder is not disabled');
});
});
it('disabled option tooltip', () => {
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
const fileLibrariesPage = new BrowsingPage();
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(siteName))
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(folderName1))
fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
.then(() => fileLibrariesPage.sidenav.openNewMenu())
.then(menu => browser.actions().mouseMove(menu.getItemByLabel('Create folder')).perform()
.then(() => menu))
.then(menu => {
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
action.perform()
.then(() => {
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`You can't create a folder here`);
});
const tooltip = menu.getItemTooltip('Create folder');
expect(tooltip).toContain(`You can't create a folder here`);
});
});
it('dialog UI elements', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog().then(() => {
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => {
const dialogTitle = createDialog.getTitle();
const isFolderNameDisplayed = createDialog.nameInput.getWebElement().isDisplayed();
const isDescriptionDisplayed = createDialog.descriptionTextArea.getWebElement().isDisplayed();
const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
const isCancelEnabled = createDialog.cancelButton.getWebElement().isEnabled();
const isFolderNameDisplayed = createDialog.nameInput.isDisplayed();
const isDescriptionDisplayed = createDialog.descriptionTextArea.isDisplayed();
const isCreateEnabled = createDialog.createButton.isEnabled();
const isCancelEnabled = createDialog.cancelButton.isEnabled();
expect(dialogTitle).toBe('Create new folder');
expect(dialogTitle).toMatch('Create new folder');
expect(isFolderNameDisplayed).toBe(true, 'Name input is not displayed');
expect(isDescriptionDisplayed).toBe(true, 'Description field is not displayed');
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(isCancelEnabled).toBe(true, 'Cancel button is not enabled');
})
);
});
});
it('with empty folder name', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => {
createDialog.deleteNameWithBackspace();
})
.then(() => {
const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
const validationMessage = createDialog.getValidationMessage();
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.deleteNameWithBackspace())
.then(() => {
const isCreateEnabled = createDialog.createButton.isEnabled();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is enabled');
expect(validationMessage).toMatch('Folder name is required');
})
);
expect(isCreateEnabled).toBe(false, 'Create button is enabled');
expect(validationMessage).toMatch('Folder name is required');
});
});
it('with folder name ending with a dot "."', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => createDialog.enterName('folder-name.'))
.then((dialog) => {
const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
const validationMessage = dialog.getValidationMessage();
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName('folder-name.'))
.then(dialog => {
const isCreateEnabled = dialog.createButton.isEnabled();
const validationMessage = dialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't end with a period .`);
})
);
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't end with a period .`);
});
});
it('with folder name containing special characters', () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => {
namesWithSpecialChars.forEach(name => {
createDialog.enterName(name);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => namesWithSpecialChars.forEach(name => {
createDialog.enterName(name);
const isCreateEnabled = createDialog.createButton.getWebElement().isEnabled();
const validationMessage = createDialog.getValidationMessage();
const isCreateEnabled = createDialog.createButton.isEnabled();
const validationMessage = createDialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toContain(`Folder name can't contain these characters`);
});
})
);
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toContain(`Folder name can't contain these characters`);
}));
});
it('with folder name containing only spaces', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => createDialog.enterName(' '))
.then((dialog) => {
const isCreateEnabled = dialog.createButton.getWebElement().isEnabled();
const validationMessage = dialog.getValidationMessage();
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName(' '))
.then(dialog => {
const isCreateEnabled = dialog.createButton.isEnabled();
const validationMessage = dialog.getValidationMessage();
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
})
);
expect(isCreateEnabled).toBe(false, 'Create button is not disabled');
expect(validationMessage).toMatch(`Folder name can't contain only spaces`);
});
});
it('cancel folder creation', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => {
createDialog
.enterName('test')
.enterDescription('test description')
.clickCancel();
})
.then(() => expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'))
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName('test'))
.then(() => createDialog.enterDescription('test description'))
.then(() => createDialog.clickCancel())
.then(() => {
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
});
});
it('duplicate folder name', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => createDialog.enterName(duplicateFolderName).clickCreate())
.then(() => {
personalFilesPage.getSnackBarMessage()
.then(message => {
expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
})
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName(duplicateFolderName))
.then(() => createDialog.clickCreate())
.then(() => personalFilesPage.getSnackBarMessage())
.then(message => {
expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(createDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
});
it('trim ending spaces from folder name', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => openCreateDialog()
.then(() => createDialog.enterName(nameWithSpaces).clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByContainingText(nameWithSpaces.trim()).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
})
);
personalFilesPage.dataTable.doubleClickOnItemName(parent)
.then(() => openCreateDialog())
.then(() => createDialog.enterName(nameWithSpaces))
.then(() => createDialog.clickCreate())
.then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
});
});
});

View File

@ -1,23 +1,31 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { protractor, element, browser, by, ElementFinder, promise } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { SIDEBAR_LABELS, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
import { Utils } from '../../utilities/utils';
@ -44,42 +52,40 @@ describe('Edit folder', () => {
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage(APP_ROUTES.PERSONAL_FILES);
const personalFilesPage = new BrowsingPage();
const editDialog = new CreateOrEditFolderDialog();
const dataTable = personalFilesPage.dataTable;
const { dataTable } = personalFilesPage;
const editButton = personalFilesPage.toolbar.actions.getButtonByTitleAttribute('Edit');
beforeAll(done => {
Promise
.all([
apis.admin.people.createUser(username),
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE)
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`))
])
apis.admin.people.createUser(username)
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE))
.then(() => apis.admin.nodes.createFolders([ folderName ], `Sites/${siteName}/documentLibrary`))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => Promise.all([
apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription, parent ),
apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent)
]))
.then(() => loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done));
.then(() => apis.user.nodes.createNodeWithProperties( folderName, '', folderDescription, parent ))
.then(() => apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ], parent))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
personalFilesPage.load()
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(parent))
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.$('body').sendKeys(protractor.Key.ESCAPE).then(done);
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise
.all([
apis.admin.sites.deleteSite(siteName, true),
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ parent ]),
logoutPage.load()
])
@ -87,124 +93,98 @@ describe('Edit folder', () => {
});
it('dialog UI defaults', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => {
expect(editDialog.getTitle()).toBe('Edit folder');
expect(editDialog.nameInput.getWebElement().getAttribute('value')).toBe(folderName);
expect(editDialog.descriptionTextArea.getWebElement().getAttribute('value')).toBe(folderDescription);
expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(true, 'upload button is not enabled');
expect(editDialog.cancelButton.getWebElement().isEnabled()).toBe(true, 'cancel button is not enabled');
})
);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => {
expect(editDialog.getTitle()).toEqual('Edit folder');
expect(editDialog.nameInput.getAttribute('value')).toBe(folderName);
expect(editDialog.descriptionTextArea.getAttribute('value')).toBe(folderDescription);
expect(editDialog.updateButton.isEnabled()).toBe(true, 'upload button is not enabled');
expect(editDialog.cancelButton.isEnabled()).toBe(true, 'cancel button is not enabled');
});
});
it('properties are modified when pressing OK', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderNameToEdit)
.then(() => editButton.click())
.then(() => {
editDialog
.enterName(folderNameEdited)
.enterDescription(folderDescriptionEdited)
.clickUpdate();
})
.then(() => editDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByContainingText(folderNameEdited).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
})
.then(() => {
apis.user.nodes.getNodeDescription(folderNameEdited)
.then((description) => {
expect(description).toEqual(folderDescriptionEdited);
});
})
);
dataTable.clickOnItemName(folderNameToEdit)
.then(() => editButton.click())
.then(() => editDialog.waitForDialogToOpen())
.then(() => editDialog.enterName(folderNameEdited))
.then(() => editDialog.enterDescription(folderDescriptionEdited))
.then(() => editDialog.clickUpdate())
.then(() => editDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader())
.then(() => {
const isPresent = dataTable.getRowByName(folderNameEdited).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view');
})
.then(() => {
expect(apis.user.nodes.getNodeDescription(folderNameEdited)).toEqual(folderDescriptionEdited);
});
});
it('with empty folder name', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => {
editDialog.deleteNameWithBackspace();
})
.then(() => {
expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
})
);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => editDialog.deleteNameWithBackspace())
.then(() => {
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.getValidationMessage()).toMatch('Folder name is required');
});
});
it('with name with special characters', () => {
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => {
namesWithSpecialChars.forEach(name => {
editDialog.enterName(name);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => namesWithSpecialChars.forEach(name => {
editDialog.enterName(name);
expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not disabled');
expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
});
})
);
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not disabled');
expect(editDialog.getValidationMessage()).toContain(`Folder name can't contain these characters`);
}));
});
it('with name ending with a dot', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => editDialog.nameInput.sendKeys('.'))
.then(() => {
expect(editDialog.updateButton.getWebElement().isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
})
);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => editDialog.nameInput.sendKeys('.'))
.then(() => {
expect(editDialog.updateButton.isEnabled()).toBe(false, 'upload button is not enabled');
expect(editDialog.getValidationMessage()).toMatch(`Folder name can't end with a period .`);
});
});
it('Cancel button', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => editDialog.clickCancel())
.then(() => {
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
})
);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => editDialog.clickCancel())
.then(() => {
expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed');
});
});
it('with duplicate folder name', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => editDialog.enterName(duplicateFolderName).clickUpdate())
.then(() => {
personalFilesPage.getSnackBarMessage()
.then(message => {
expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(editDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
})
);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => editDialog.enterName(duplicateFolderName))
.then(() => editDialog.clickUpdate())
.then(() => personalFilesPage.getSnackBarMessage())
.then(message => {
expect(message).toEqual(`There's already a folder with this name. Try a different name.`);
expect(editDialog.component.isPresent()).toBe(true, 'dialog is not present');
});
});
it('trim ending spaces', () => {
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
.then(() => dataTable.clickOnRowByContainingText(folderName)
.then(() => editButton.click())
.then(() => editDialog.nameInput.sendKeys(' '))
.then(() => editDialog.clickUpdate())
.then(() => editDialog.waitForDialogToClose())
.then(() => {
expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(dataTable.getRowByContainingText(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
})
);
dataTable.clickOnItemName(folderName)
.then(() => editButton.click())
.then(() => editDialog.nameInput.sendKeys(' '))
.then(() => editDialog.clickUpdate())
.then(() => editDialog.waitForDialogToClose())
.then(() => {
expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
});
});
});

View File

@ -0,0 +1,113 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Permanently delete from Trash', () => {
const username = `user-${Utils.random()}`;
const file1 = `file-${Utils.random()}.txt`;
const file2 = `file-${Utils.random()}.txt`;
let filesIds;
const folder1 = `folder-${Utils.random()}`;
const folder2 = `folder-${Utils.random()}`;
let foldersIds;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const trashPage = new BrowsingPage();
const { dataTable } = trashPage;
const { toolbar } = trashPage;
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => apis.user.nodes.createFiles([ file1, file2 ]))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => apis.user.nodes.deleteNodesById(filesIds, false))
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
Promise.all([
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
])
.then(done);
});
it('delete file', () => {
dataTable.clickOnItemName(file1)
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toBe(`${file1} deleted`);
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted');
});
});
it('delete folder', () => {
dataTable.clickOnItemName(folder1)
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toBe(`${folder1} deleted`);
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted');
});
});
it('delete multiple items', () => {
dataTable.selectMultipleItems([ file2, folder2 ])
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toBe(`2 items deleted`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted');
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted');
});
});
});

View File

@ -0,0 +1,147 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Restore from Trash', () => {
const username = `user-${Utils.random()}`;
const file1 = `file-${Utils.random()}.txt`;
const file2 = `file-${Utils.random()}.txt`;
const file3 = `file-${Utils.random()}.txt`;
let filesIds;
const folder1 = `folder-${Utils.random()}`;
const folder2 = `folder-${Utils.random()}`;
let foldersIds;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const trashPage = new BrowsingPage();
const personalFilesPage = new BrowsingPage();
const { dataTable } = trashPage;
const { toolbar } = trashPage;
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => apis.user.nodes.createFiles([ file1, file2, file3 ]))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => apis.user.nodes.deleteNodesById(filesIds, false))
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
Promise.all([
apis.user.nodes.deleteNodesById(filesIds),
apis.user.nodes.deleteNodesById(foldersIds),
apis.admin.trashcan.emptyTrash(),
logoutPage.load()
])
.then(done);
});
it('restore file', () => {
dataTable.clickOnItemName(file1)
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toContain(`${file1} restored`);
expect(text).toContain(`View`);
expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list');
})
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => {
expect(personalFilesPage.dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item not displayed in list');
});
});
it('restore folder', () => {
dataTable.clickOnItemName(folder1)
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toContain(`${folder1} restored`);
expect(text).toContain(`View`);
expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list');
})
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => {
expect(personalFilesPage.dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item not displayed in list');
});
});
it('restore multiple items', () => {
dataTable.selectMultipleItems([ file2, folder2 ])
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => trashPage.getSnackBarMessage())
.then(text => {
expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`);
expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not removed from list');
expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not removed from list');
})
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => {
expect(personalFilesPage.dataTable.getRowByName(file2).isPresent()).toBe(true, 'Item not displayed in list');
expect(personalFilesPage.dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item not displayed in list');
});
});
it('View from notification', () => {
dataTable.clickOnItemName(file3)
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
.then(() => trashPage.getSnackBarAction().click())
.then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => {
expect(personalFilesPage.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});
});
});

View File

@ -0,0 +1,535 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Toolbar actions - multiple selection : ', () => {
const user1 = `user-${Utils.random()}`;
const user2 = `user-${Utils.random()}`;
const file1 = `file-${Utils.random()}.txt`;
let file1Id;
const file2 = `file-${Utils.random()}.txt`;
let file2Id;
const folder1 = `folder-${Utils.random()}`;
let folder1Id;
const folder2 = `folder-${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-private-${Utils.random()}`;
const file1Admin = `file-${Utils.random()}.txt`;
const file2Admin = `file-${Utils.random()}.txt`;
const folder1Admin = `folder-${Utils.random()}`;
const folder2Admin = `folder-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(user1, user1)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
const { toolbar } = page;
beforeAll(done => {
apis.admin.people.createUser(user1)
.then(() => apis.user.nodes.createFiles([ file1 ]).then(resp => file1Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFiles([ file2 ]).then(resp => file2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFolders([ folder1 ]).then(resp => folder1Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFolders([ folder2 ]).then(resp => folder2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFiles([ fileForDelete1 ]).then(resp => fileForDelete1Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFiles([ fileForDelete2 ]).then(resp => fileForDelete2Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFolders([ folderForDelete1 ]).then(resp => folderForDelete1Id = resp.data.entry.id))
.then(() => apis.user.nodes.createFolders([ folderForDelete2 ]).then(resp => folderForDelete2Id = resp.data.entry.id))
.then(() => apis.user.shared.shareFileById(file1Id))
.then(() => apis.user.shared.shareFileById(file2Id))
.then(() => apis.user.favorites.addFavoriteById('file', file1Id))
.then(() => apis.user.favorites.addFavoriteById('file', file2Id))
.then(() => apis.user.favorites.addFavoriteById('folder', folder1Id))
.then(() => apis.user.favorites.addFavoriteById('folder', folder2Id))
.then(() => apis.user.nodes.deleteNodeById(fileForDelete1Id, false))
.then(() => apis.user.nodes.deleteNodeById(fileForDelete2Id, false))
.then(() => apis.user.nodes.deleteNodeById(folderForDelete1Id, false))
.then(() => apis.user.nodes.deleteNodeById(folderForDelete2Id, false))
.then(done);
});
afterAll(done => {
Promise.all([
apis.user.nodes.deleteNodeById(file1Id),
apis.user.nodes.deleteNodeById(file2Id),
apis.user.nodes.deleteNodeById(folder1Id),
apis.user.nodes.deleteNodeById(folder2Id),
apis.user.trashcan.permanentlyDelete(fileForDelete1Id),
apis.user.trashcan.permanentlyDelete(fileForDelete2Id),
apis.user.trashcan.permanentlyDelete(folderForDelete1Id),
apis.user.trashcan.permanentlyDelete(folderForDelete2Id),
logoutPage.load()
])
.then(done);
});
xit('');
describe('Personal Files', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user1))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1, folder2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1, file2, folder1, folder2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
});
describe('File Libraries', () => {
beforeAll(done => {
apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC)
.then(() => apis.admin.people.createUser(user2))
.then(() => apis.admin.sites.addSiteMember(siteName, user1, SITE_ROLES.SITE_MANAGER))
.then(() => apis.admin.sites.addSiteMember(siteName, user2, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.nodes.createFiles([ file1Admin, file2Admin ], `Sites/${siteName}/documentLibrary`))
.then(() => apis.admin.nodes.createFolders([ folder1Admin, folder2Admin ], `Sites/${siteName}/documentLibrary`))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(siteName))
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
apis.admin.sites.deleteSite(siteName).then(done);
});
xit('');
describe('user is Manager', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user1))
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1Admin, folder2Admin])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
});
describe('user is Consumer', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user2))
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1Admin, folder2Admin])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
});
});
describe('Shared Files', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user1))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
});
describe('Recent Files', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user1))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
});
describe('Favorites', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user1))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1, folder2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1, file2, folder1, folder2])
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
expect(menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for selected files`);
expect(menu.isMenuItemPresent('Move')).toBe(true, `Move is not displayed for selected files`);
expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
})
.then(() => browser.$('body').click())
.then(() => dataTable.clearSelection());
});
});
describe('Trash', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(user1))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([fileForDelete1, fileForDelete2])
.then(() => {
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, 'Permanently delete is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
})
.then(() => dataTable.clearSelection());
});
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folderForDelete1, folderForDelete2])
.then(() => {
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, 'Permanently delete is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
})
.then(() => dataTable.clearSelection());
});
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([fileForDelete1, fileForDelete2, folderForDelete1, folderForDelete2])
.then(() => {
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, 'Permanently delete is displayed for selected files');
expect(toolbar.actions.isButtonPresent('Restore')).toBe(true, 'Restore is not displayed for selected files');
})
.then(() => dataTable.clearSelection());
});
});
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, promise } from 'protractor';
@ -49,15 +57,18 @@ describe('Toolbar actions - single selection : ', () => {
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable } = page;
const { toolbar } = page;
const { dataTable, toolbar } = page;
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => apis.user.nodes.createFiles([ fileUser ]).then(resp => { fileUserId = resp.data.entry.id; }))
.then(() => apis.user.nodes.createFiles([ fileForDelete ]).then(resp => { fileForDeleteId = resp.data.entry.id; }))
.then(() => apis.user.nodes.createFolders([ folderForDelete ]).then((resp) => { folderForDeleteId = resp.data.entry.id; }))
.then(() => apis.user.nodes.createFolders([ folderUser ]).then(resp => { folderUserId = resp.data.entry.id; }))
.then(() => apis.user.nodes.createFiles([ fileUser ]))
.then(resp => fileUserId = resp.data.entry.id)
.then(() => apis.user.nodes.createFiles([ fileForDelete ]))
.then(resp => fileForDeleteId = resp.data.entry.id)
.then(() => apis.user.nodes.createFolders([ folderForDelete ]))
.then(resp => folderForDeleteId = resp.data.entry.id)
.then(() => apis.user.nodes.createFolders([ folderUser ]))
.then(resp => folderUserId = resp.data.entry.id)
.then(() => apis.user.shared.shareFileById(fileUserId))
.then(() => apis.user.favorites.addFavoriteById('file', fileUserId))
.then(() => apis.user.favorites.addFavoriteById('folder', folderUserId))
@ -97,28 +108,26 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
});
});
it('actions are displayed when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderUser)
dataTable.clickOnItemName(folderUser)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
});
dataTable.clickOnRowByContainingText(fileUser)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
@ -130,14 +139,12 @@ describe('Toolbar actions - single selection : ', () => {
});
it('correct actions appear when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderUser)
dataTable.clickOnItemName(folderUser)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
});
dataTable.clickOnRowByContainingText(folderUser)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
@ -163,11 +170,15 @@ describe('Toolbar actions - single selection : ', () => {
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnRowByContainingText(siteName))
.then(() => dataTable.doubleClickOnItemName(siteName))
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
apis.admin.sites.deleteSite(siteName).then(done);
});
xit('');
describe('user is Manager', () => {
@ -186,28 +197,26 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileAdmin)
dataTable.clickOnItemName(fileAdmin)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
});
});
it('actions are displayed when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderAdmin)
dataTable.clickOnItemName(folderAdmin)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileAdmin)
dataTable.clickOnItemName(fileAdmin)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`);
});
dataTable.clickOnRowByContainingText(fileAdmin)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`);
@ -219,14 +228,12 @@ describe('Toolbar actions - single selection : ', () => {
});
it('correct actions appear when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderAdmin)
dataTable.clickOnItemName(folderAdmin)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderAdmin}`);
});
dataTable.clickOnRowByContainingText(folderAdmin)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`);
@ -254,28 +261,26 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileAdmin)
dataTable.clickOnItemName(fileAdmin)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
});
});
it('actions are displayed when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderAdmin)
dataTable.clickOnItemName(folderAdmin)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileAdmin)
dataTable.clickOnItemName(fileAdmin)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileAdmin}`);
});
dataTable.clickOnRowByContainingText(fileAdmin)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileAdmin}`);
@ -287,14 +292,12 @@ describe('Toolbar actions - single selection : ', () => {
});
it('correct actions appear when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderAdmin)
dataTable.clickOnItemName(folderAdmin)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${folderAdmin}`);
});
dataTable.clickOnRowByContainingText(folderAdmin)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderAdmin}`);
@ -329,21 +332,19 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
});
dataTable.clickOnRowByContainingText(fileUser)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
@ -377,21 +378,19 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
});
dataTable.clickOnRowByContainingText(fileUser)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
@ -425,28 +424,26 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
});
});
it('actions are displayed when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderUser)
dataTable.clickOnItemName(folderUser)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileUser)
dataTable.clickOnItemName(fileUser)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, `Edit is displayed for ${fileUser}`);
});
dataTable.clickOnRowByContainingText(fileUser)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${fileUser}`);
@ -458,14 +455,12 @@ describe('Toolbar actions - single selection : ', () => {
});
it('correct actions appear when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderUser)
dataTable.clickOnItemName(folderUser)
.then(() => {
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, `Edit is not displayed for ${folderUser}`);
});
dataTable.clickOnRowByContainingText(folderUser)
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for ${folderUser}`);
@ -506,21 +501,21 @@ describe('Toolbar actions - single selection : ', () => {
});
it('actions are displayed when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileForDelete)
dataTable.clickOnItemName(fileForDelete)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`);
});
});
it('actions are displayed when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderForDelete)
dataTable.clickOnItemName(folderForDelete)
.then(() => {
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`);
});
});
it('correct actions appear when a file is selected', () => {
dataTable.clickOnRowByContainingText(fileForDelete)
dataTable.clickOnItemName(fileForDelete)
.then(() => {
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, `Permanently delete is not displayed for ${fileForDelete}`);
@ -529,7 +524,7 @@ describe('Toolbar actions - single selection : ', () => {
});
it('correct actions appear when a folder is selected', () => {
dataTable.clickOnRowByContainingText(folderForDelete)
dataTable.clickOnItemName(folderForDelete)
.then(() => {
expect(toolbar.actions.isButtonPresent('Permanently delete'))
.toBe(true, `Permanently delete is displayed for ${folderForDelete}`);

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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';
@ -49,7 +57,7 @@ describe('Page titles', () => {
loginPage.load()
.then(() => loginPage.loginWithAdmin())
.then(() => page.signOut())
.then(() => browser.driver.navigate().back())
.then(() => browser.navigate().back())
.then(() => {
expect(browser.getTitle()).toContain('Sign in');
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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';
@ -121,7 +129,7 @@ describe('Login', () => {
loginPage
.loginWith(username)
.then(() => browser.driver.navigate().back())
.then(() => browser.navigate().back())
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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';
@ -58,7 +66,7 @@ describe('Logout', () => {
it('redirects to Login page when pressing browser Back after logout', () => {
page.signOut()
.then(() => browser.driver.navigate().back())
.then(() => browser.navigate().back())
.then(() => {
expect(browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN);
});

View File

@ -1,22 +1,28 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, by } from 'protractor';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, by } from 'protractor';
@ -40,6 +48,7 @@ describe('Favorites', () => {
const logoutPage = new LogoutPage();
const favoritesPage = new BrowsingPage();
const { dataTable } = favoritesPage;
const { breadcrumb } = favoritesPage.toolbar;
beforeAll(done => {
apis.admin.people.createUser(username)
@ -64,7 +73,7 @@ describe('Favorites', () => {
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(siteName, true),
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ folderName ]),
logoutPage.load()
])
@ -84,9 +93,9 @@ describe('Favorites', () => {
it('displays the favorite files and folders', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of items displayed');
expect(dataTable.getRowByContainingText(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowByContainingText(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowByContainingText(folderName).isPresent()).toBe(true, `${folderName} not displayed`);
expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, `${folderName} not displayed`);
});
it('Location column displays the parent folder of the files', () => {
@ -113,4 +122,36 @@ describe('Favorites', () => {
});
});
it('Location column redirect - item in user Home', () => {
dataTable.clickItemLocation(folderName)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe('Personal Files');
});
});
it('Location column redirect - file in folder', () => {
dataTable.clickItemLocation(fileName2)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe(folderName);
})
.then(() => breadcrumb.getFirstItemName())
.then(name => {
expect(name).toBe('Personal Files');
});
});
it('Location column redirect - file in site', () => {
dataTable.clickItemLocation(fileName1)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe(siteName);
})
.then(() => breadcrumb.getFirstItemName())
.then(name => {
expect(name).toBe('File Libraries');
});
});
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, by } from 'protractor';
@ -54,6 +62,7 @@ describe('File Libraries', () => {
.then(() => apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER))
.then(() => apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
@ -67,10 +76,10 @@ describe('File Libraries', () => {
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(sitePublic, true),
apis.admin.sites.deleteSite(siteModerated, true),
apis.admin.sites.deleteSite(sitePrivate, true),
apis.admin.sites.deleteSite(adminSite, true),
apis.admin.sites.deleteSite(sitePublic),
apis.admin.sites.deleteSite(siteModerated),
apis.admin.sites.deleteSite(sitePrivate),
apis.admin.sites.deleteSite(adminSite),
logoutPage.load()
])
.then(done);
@ -97,7 +106,7 @@ describe('File Libraries', () => {
};
expect(sitesCount).toEqual(3, 'Incorrect number of sites displayed');
expect(dataTable.getRowByContainingText(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
dataTable.getRows()
.map((row) => {

View File

@ -1,40 +1,47 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { APP_ROUTES } from '../../configs';
import { SIDEBAR_LABELS } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
import { RepoClient } from '../../utilities/repo-client/repo-client';
describe('Personal Files', () => {
const username = `user-${Utils.random()}`;
const password = username;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const personalFilesPage = new BrowsingPage(APP_ROUTES.PERSONAL_FILES);
const dataTable = personalFilesPage.dataTable;
const personalFilesPage = new BrowsingPage();
const { dataTable } = personalFilesPage;
const adminFolder = `admin-folder-${Utils.random()}`;
@ -44,7 +51,7 @@ describe('Personal Files', () => {
beforeAll(done => {
Promise
.all([
apis.admin.people.createUser(username, password),
apis.admin.people.createUser(username),
apis.admin.nodes.createFolders([ adminFolder ])
])
.then(() => apis.user.nodes.createFolders([ userFolder ]))
@ -71,41 +78,39 @@ describe('Personal Files', () => {
});
beforeEach(done => {
personalFilesPage.load()
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load()
.then(done);
logoutPage.load().then(done);
});
it('has "Data Dictionary" folder', () => {
expect(dataTable.getRowByContainingText('Data Dictionary').isPresent()).toBe(true);
expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
});
it('has created content', () => {
expect(dataTable.getRowByContainingText('admin-folder').isPresent()).toBe(true);
expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
});
});
describe(`Regular user's personal files`, () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username, password))
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
personalFilesPage.load()
personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
logoutPage.load()
.then(done);
logoutPage.load().then(done);
});
it('has the correct columns', () => {
@ -124,7 +129,7 @@ describe('Personal Files', () => {
});
it('has user created content', () => {
expect(dataTable.getRowByContainingText(userFolder).isPresent())
expect(dataTable.getRowByName(userFolder).isPresent())
.toBe(true);
});
@ -134,7 +139,7 @@ describe('Personal Files', () => {
.then(response => response.data.entry.id);
const navigatePromise = dataTable
.doubleClickOnRowByContainingText(userFolder)
.doubleClickOnItemName(userFolder)
.then(() => dataTable.waitForHeader());
Promise
@ -146,28 +151,9 @@ describe('Personal Files', () => {
expect(browser.getCurrentUrl())
.toContain(nodeId, 'Node ID is not in the URL');
expect(dataTable.getRowByContainingText(userFile).isPresent())
expect(dataTable.getRowByName(userFile).isPresent())
.toBe(true, 'user file is missing');
});
});
// Some tests regarding selection, breadcrumb and toolbar
// probably they can be move to a different suite
describe('Item selection', () => {
it('has toolbar when selected', done => {
const { actions } = personalFilesPage.toolbar;
dataTable
.clickOnRowByContainingText(userFolder)
.then(() => {
expect(actions.isEmpty()).toBe(false, 'Toolbar to be present');
})
.then(() => actions.openMoreMenu())
.then(menu => {
expect(menu.items.count()).toBeGreaterThan(0, 'More actions has items');
})
.then(done);
});
});
});
});

View File

@ -0,0 +1,149 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, by } from 'protractor';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Recent Files', () => {
const username = `user-${Utils.random()}`;
const password = username;
const folderName = `folder-${Utils.random()}`;
let folderId;
const fileName1 = `file-${Utils.random()}.txt`;
const fileName2 = `file-${Utils.random()}.txt`;
let file2Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const recentFilesPage = new BrowsingPage();
const { dataTable } = recentFilesPage;
const { breadcrumb } = recentFilesPage.toolbar;
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => apis.user.nodes.createFolders([ folderName ]))
.then(resp => folderId = resp.data.entry.id)
.then(() => apis.user.nodes.createFiles([ fileName1 ], folderName))
.then(() => apis.user.nodes.createFiles([ fileName2 ]))
.then(resp => file2Id = resp.data.entry.id)
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
recentFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(5000);
recentFilesPage.refresh();
}
})
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
Promise.all([
apis.user.nodes.deleteNodesById([ folderId, file2Id ]),
logoutPage.load()
])
.then(done);
});
it('has the correct columns', () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(4 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('displays the files added by the current user in the last 30 days', () => {
expect(dataTable.countRows()).toEqual(2, 'Incorrect number of sites displayed');
expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
});
it('Location column displays the parent folder of the file', () => {
const itemsLocations = {
[fileName2]: 'Personal Files',
[fileName1]: folderName
};
dataTable.getRows()
.map((row) => {
return row.all(dataTable.cell).map(cell => cell.getText());
})
.then((rowCells) => {
return rowCells.reduce((acc, cell) => {
acc[cell[1]] = cell[2];
return acc;
}, {});
})
.then((recentList) => {
Object.keys(itemsLocations).forEach((item) => {
expect(recentList[item]).toEqual(itemsLocations[item]);
});
});
});
it('Location column redirect - file in user Home', () => {
dataTable.clickItemLocation(fileName1)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe(folderName);
})
.then(() => breadcrumb.getFirstItemName())
.then(name => {
expect(name).toBe('Personal Files');
});
});
it('Location column redirect - file in folder', () => {
dataTable.clickItemLocation(fileName2)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe('Personal Files');
});
});
});

View File

@ -0,0 +1,155 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, by } from 'protractor';
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Shared Files', () => {
const username = `user-${Utils.random()}`;
const password = username;
const siteName = `site-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`;
const folderUser = `folder-${Utils.random()}`;
const fileUser = `file-${Utils.random()}.txt`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const sharedFilesPage = new BrowsingPage();
const { dataTable } = sharedFilesPage;
const { breadcrumb } = sharedFilesPage.toolbar;
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER))
.then(() => apis.admin.nodes.createFiles([ fileAdmin ], `Sites/${siteName}/documentLibrary`))
.then(resp => apis.admin.shared.shareFileById(resp.data.entry.id))
.then(() => apis.user.nodes.createFolders([ folderUser ]))
.then(() => apis.user.nodes.createFiles([ fileUser ], folderUser))
.then(resp => apis.user.shared.shareFileById(resp.data.entry.id))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
sharedFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(5000);
sharedFilesPage.refresh();
}
})
.then(() => dataTable.waitForHeader())
.then(done);
});
afterAll(done => {
Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.user.nodes.deleteNodes([ folderUser ]),
logoutPage.load()
])
.then(done);
});
it('has the correct columns', () => {
const labels = [ 'Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
expect(dataTable.getColumnHeaders().count()).toBe(6 + 1, 'Incorrect number of columns');
elements.forEach((element, index) => {
expect(element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
});
});
it('displays the files shared by everyone', () => {
expect(dataTable.countRows()).toEqual(2, 'Incorrect number of items displayed');
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
});
it('Location column displays the parent folder of the file', () => {
const itemsLocations = {
[fileAdmin]: siteName,
[fileUser]: folderUser
};
dataTable.getRows()
.map((row) => {
return row.all(dataTable.cell).map(cell => cell.getText());
})
.then((rowCells) => {
return rowCells.reduce((acc, cell) => {
acc[cell[1]] = cell[2];
return acc;
}, {});
})
.then((recentList) => {
Object.keys(itemsLocations).forEach((item) => {
expect(recentList[item]).toEqual(itemsLocations[item]);
});
});
});
it('Location column redirect - file in user Home', () => {
dataTable.clickItemLocation(fileUser)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe(folderUser);
})
.then(() => breadcrumb.getFirstItemName())
.then(name => {
expect(name).toBe('Personal Files');
});
});
it('Location column redirect - file in site', () => {
dataTable.clickItemLocation(fileAdmin)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe(siteName);
})
.then(() => breadcrumb.getFirstItemName())
.then(name => {
expect(name).toBe('File Libraries');
});
});
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, by } from 'protractor';
@ -24,50 +32,59 @@ import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-cl
describe('Trash', () => {
const username = `user-${Utils.random()}`;
const password = username;
const siteName = `site-${Utils.random()}`;
const folderAdmin = `folder-${Utils.random()}`;
const folderUser = `folder-${Utils.random()}`;
const fileAdmin = `file-${Utils.random()}.txt`;
const fileUser = `file-${Utils.random()}.txt`;
const fileSite = `file-${Utils.random()}.txt`;
let fileSiteId;
const folderAdmin = `folder-${Utils.random()}`;
let folderAdminId;
const fileAdmin = `file-${Utils.random()}.txt`;
let fileAdminId;
const folderUser = `folder-${Utils.random()}`;
let folderUserId;
const fileUser = `file-${Utils.random()}.txt`;
let fileUserId;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const trashPage = new BrowsingPage();
const { dataTable } = trashPage;
const { breadcrumb } = trashPage.toolbar;
beforeAll(done => {
apis.admin.people.createUser(username)
// admin: create file -> delete file
.then(() => apis.admin.nodes.createFiles([ fileAdmin ])
.then((resp) => apis.admin.nodes.deleteNodeById(resp.data.entry.id, false)))
// admin: create folder -> delete folder
.then(resp => fileAdminId = resp.data.entry.id))
.then(() => apis.admin.nodes.createFolders([ folderAdmin ])
.then((resp) => apis.admin.nodes.deleteNodeById(resp.data.entry.id, false)))
// admin: create site, add user to site, create file
.then(resp => folderAdminId = resp.data.entry.id))
.then(() => apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC))
.then(() => apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER))
.then(() => apis.admin.nodes.createFiles([ fileSite ], `Sites/${siteName}/documentLibrary`)
// user: delete file from site
.then(resp => apis.user.nodes.deleteNodeById(resp.data.entry.id, false)))
// user: create file -> delete file
.then(resp => fileSiteId = resp.data.entry.id))
.then(() => apis.user.nodes.createFiles([ fileUser ])
.then((resp) => apis.user.nodes.deleteNodeById(resp.data.entry.id, false)))
// user: create folder -> delete folder
.then(resp => fileUserId = resp.data.entry.id))
.then(() => apis.user.nodes.createFolders([ folderUser ])
.then((resp) => apis.user.nodes.deleteNodeById(resp.data.entry.id, false)))
.then(resp => folderUserId = resp.data.entry.id))
.then(() => apis.admin.nodes.deleteNodesById([ fileAdminId, folderAdminId ], false))
.then(() => apis.user.nodes.deleteNodesById([ fileSiteId, fileUserId, folderUserId ], false))
.then(done);
});
afterAll(done => {
apis.admin.sites.deleteSite(siteName).then(done);
Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.admin.trashcan.emptyTrash()
])
.then(done);
});
xit('');
@ -76,7 +93,11 @@ describe('Trash', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWithAdmin())
.then(() => trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(done);
});
beforeEach(done => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
@ -99,11 +120,11 @@ describe('Trash', () => {
it('displays the files and folders deleted by everyone', () => {
expect(dataTable.countRows()).toEqual(5, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByContainingText(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByContainingText(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(dataTable.getRowByContainingText(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByContainingText(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByContainingText(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
});
});
@ -111,7 +132,11 @@ describe('Trash', () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username))
.then(() => trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH))
.then(done);
});
beforeEach(done => {
trashPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
@ -134,9 +159,30 @@ describe('Trash', () => {
it('displays the files and folders deleted by the user', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByContainingText(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowByContainingText(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByContainingText(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(false, `${fileAdmin} is displayed`);
});
it('Location column redirect - file in user Home', () => {
dataTable.clickItemLocation(fileUser)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe('Personal Files');
});
});
it('Location column redirect - file in site', () => {
dataTable.clickItemLocation(fileSite)
.then(() => breadcrumb.getCurrentItemName())
.then(name => {
expect(name).toBe(siteName);
})
.then(() => breadcrumb.getFirstItemName())
.then(name => {
expect(name).toBe('File Libraries');
});
});
});
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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';
@ -36,8 +44,7 @@ describe('Side navigation', () => {
});
afterAll(done => {
logoutPage.load()
.then(done);
logoutPage.load().then(done);
});
it('has "Personal Files" as default', () => {

View File

@ -0,0 +1,186 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Favorites', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi, favorites: favoritesApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => favoritesApi.addFavoritesByIds('file', filesIds))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,183 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Personal Files', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(parent))
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-60.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-30.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-12.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,189 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Recent Files', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(3000);
page.refresh();
}
})
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,193 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Shared Files', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi, shared: sharedApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => sharedApi.shareFilesByIds(filesIds))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(6000);
page.refresh();
}
})
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,184 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software 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, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Trash', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi, trashcan: trashApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const filesForDelete = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesDeletedIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(filesForDelete))
.then(resp => filesDeletedIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => nodesApi.deleteNodesById(filesDeletedIds, false))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
trashApi.emptyTrash(),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -1,165 +0,0 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser } from 'protractor';
import { APP_ROUTES } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
beforeAll(done => {
apis.admin.people
.createUser(username)
.then(done);
});
xit('');
describe(`on Personal Files`, () => {
const personalFilesPage = new BrowsingPage(APP_ROUTES.PERSONAL_FILES);
const { dataTable, pagination } = personalFilesPage;
// Generate files
const content: NodeContentTree = {
name: `user-folder-${Utils.random()}`,
files: Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`)
};
const { nodes: nodesApi } = apis.user;
beforeAll(done => {
nodesApi.createContent(content)
.then(() => loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done));
});
beforeEach(done => {
personalFilesPage.load()
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnRowByContainingText(content.name))
.then(() => dataTable.sortByColumn('Name'))
.then(done);
});
afterAll(done => {
logoutPage.load()
.then(() => nodesApi.deleteNodes([ content.name ]))
.then(done);
});
it('has default details', () => {
expect(pagination.range.getText()).toContain('1-25 of 101', 'Range');
expect(pagination.maxItems.getText()).toContain('25', 'Items per page');
expect(pagination.currentPage.getText()).toContain('Page 1', 'Current page');
expect(pagination.totalPages.getText()).toContain('of 5', 'Total pages');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button');
});
it('has page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25', 'Items per page');
expect(second).toBe('50', 'Items per page');
expect(third).toBe('100', 'Items per page');
});
});
it('changes the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50', 'Items per page');
expect(pagination.totalPages.getText()).toContain('of 3', 'Total pages');
});
});
it('has page items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.items.count()).toBe(5);
});
});
it('changes the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clicktNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101', 'Range');
expect(pagination.currentPage.getText()).toContain('Page 3', 'Current page');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button');
expect(dataTable.getRowByContainingText('file-60.txt').isPresent())
.toBe(true, 'File not found on page');
});
});
it('navigates to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101', 'Range');
expect(dataTable.getRowByContainingText('file-30.txt').isPresent())
.toBe(true, 'File not found on page');
});
});
it('navigates to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clicktNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101', 'Range');
expect(dataTable.getRowByContainingText('file-12.txt').isPresent())
.toBe(true, 'File not found on page');
});
});
it('has one item on the last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clicktNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Single item on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5', 'Last page');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is not enabled');
});
});
});
});

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { promise } from 'protractor';
@ -52,6 +60,12 @@ export class FavoritesApi extends RepoApi {
.catch(this.handleError);
}
addFavoritesByIds(nodeType: string, ids: string[]): Promise<any[]> {
return ids.reduce((previous, current) => (
previous.then(() => this.addFavoriteById(nodeType, current))
), Promise.resolve());
}
getFavorite(api: RepoClient, name: string): Promise<any> {
return api.nodes.getNodeByPath(name)
.then((response) => {

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
export const NODE_TYPE_FILE = 'cm:content';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { NodeBodyCreate, NODE_TYPE_FILE, NODE_TYPE_FOLDER, NODE_TITLE, NODE_DESCRIPTION } from './node-body-create';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoApi } from '../repo-api';
@ -33,6 +41,12 @@ export class NodesApi extends RepoApi {
.catch(this.handleError);
}
getNodeDescription(name: string): Promise<string> {
return this.getNodeByPath(name)
.then(response => response.data.entry.properties['cm:description'])
.catch(() => Promise.resolve(''));
}
deleteNodeById(id: string, permanent: boolean = true): Promise<any> {
return this
.delete(`/nodes/${id}?permanent=${permanent}`)
@ -47,22 +61,16 @@ export class NodesApi extends RepoApi {
.catch(this.handleError);
}
getNodeDescription(name: string): Promise<string> {
let description = 'cm:description';
return this
.getNodeByPath(name)
.then((response: any): string => response.data.entry.properties[description])
.catch(this.handleError);
deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true): Promise<any[]> {
return names.reduce((previous, current) => (
previous.then(() => this.deleteNodeByPath(`${relativePath}/${current}`, permanent))
), Promise.resolve());
}
deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true): Promise<any> {
const deletions = names
.map((name: string): any => {
return this.deleteNodeByPath(`${relativePath}/${name}`, permanent);
});
return Promise.all(deletions);
deleteNodesById(ids: string[], permanent: boolean = true): Promise<any[]> {
return ids.reduce((previous, current) => (
previous.then(() => this.deleteNodeById(current, permanent))
), Promise.resolve());
}
// children

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
export class Person {

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoApi } from '../repo-api';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { RestClient, RestClientArgs, RestClientResponse } from '../../rest-client/rest-client';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoApi } from '../repo-api';
@ -28,6 +36,12 @@ export class SharedLinksApi extends RepoApi {
.catch(this.handleError);
}
shareFilesByIds(ids: string[]): Promise<any[]> {
return ids.reduce((previous, current) => (
previous.then(() => this.shareFileById(current))
), Promise.resolve());
}
getSharedLinks(): Promise<any> {
return this.get(`/shared-links`)
.catch(this.handleError);

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { SITE_VISIBILITY } from '../../../../configs';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoApi } from '../repo-api';
@ -35,7 +43,7 @@ export class SitesApi extends RepoApi {
.catch(this.handleError);
}
createSite(title: string, visibility: string, details?: Site): Promise<any> {
createOrUpdateSite(title: string, visibility: string, details?: Site): Promise<any> {
const site: Site = new Site(title, visibility, details);
const onSuccess = (response) => response;
const onError = (response) => {
@ -50,12 +58,31 @@ export class SitesApi extends RepoApi {
.catch(this.handleError);
}
createSite(title: string, visibility: string, details?: Site): Promise<any> {
const site: Site = new Site(title, visibility, details);
return this
.post(`/sites`, { data: site })
.catch(this.handleError);
}
createSites(titles: string[], visibility: string): Promise<any[]> {
return titles.reduce((previous, current) => (
previous.then(() => this.createSite(current, visibility))
), Promise.resolve());
}
deleteSite(id: string, permanent: boolean = true): Promise<any> {
return this
.delete(`/sites/${id}?permanent=${permanent}`)
.catch(this.handleError);
}
deleteSites(ids: string[], permanent: boolean = true): Promise<any[]> {
return ids.reduce((previous, current) => (
previous.then(() => this.deleteSite(current))
), Promise.resolve());
}
updateSiteMember(siteId: string, userId: string, role: string): Promise<any> {
return this
.put(`/sites/${siteId}/members/${userId}`, { data: { role } })

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { RepoApi } from '../repo-api';
@ -23,4 +31,24 @@ export class TrashcanApi extends RepoApi {
.delete(`/deleted-nodes/${id}`)
.catch(this.handleError);
}
getDeletedNodes(): Promise<any> {
return this
.get(`/deleted-nodes?maxItems=1000`)
.catch(this.handleError);
}
emptyTrash(): Promise<any> {
return this.getDeletedNodes()
.then(resp => {
return resp.data.list.entries.map(entries => entries.entry.id);
})
.then(ids => {
return ids.reduce((previous, current) => (
previous.then(() => this.permanentlyDelete(current))
), Promise.resolve());
})
.catch(this.handleError);
}
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 {

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { RepoClientAuth, RepoClientConfig } from './repo-client-models';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
/* tslint:disable */

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { log } from './console-logger';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
interface RequestConfig {

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Client } from 'node-rest-client';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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, promise } from 'protractor';

View File

@ -15,15 +15,13 @@ module.exports = function (config) {
files: [
{ pattern: './node_modules/hammerjs/hammer.js', watched: false },
{ pattern: './node_modules/@angular/material/prebuilt-themes/indigo-pink.css', watched: false },
{ pattern: './node_modules/ng2-alfresco-*/bundles/assets/ng2-alfresco-*/i18n/en.json', watched: false, served: true, included: false },
{ pattern: './node_modules/@alfresco/adf-core/bundles/assets/adf-core/i18n/en.json', watched: false, served: true, included: false },
{ pattern: './node_modules/@alfresco/adf-content-services/bundles/assets/adf-content-services/i18n/en.json', watched: false, served: true, included: false }
],
proxies: {
'/assets/ng2-alfresco-core/i18n/en.json': '/base/node_modules/ng2-alfresco-core/bundles/assets/ng2-alfresco-core/i18n/en.json',
'/assets/ng2-alfresco-datatable/i18n/en.json': '/base/node_modules/ng2-alfresco-datatable/bundles/assets/ng2-alfresco-datatable/i18n/en.json',
'/assets/ng2-alfresco-documentlist/i18n/en.json': '/base/node_modules/ng2-alfresco-documentlist/bundles/assets/ng2-alfresco-documentlist/i18n/en.json',
'/assets/ng2-alfresco-login/i18n/en.json': '/base/node_modules/ng2-alfresco-login/bundles/assets/ng2-alfresco-login/i18n/en.json',
'/assets/ng2-alfresco-upload/i18n/en.json': '/base/node_modules/ng2-alfresco-upload/bundles/assets/ng2-alfresco-upload/i18n/en.json',
'/assets/ng2-alfresco-search/i18n/en.json': '/base/node_modules/ng2-alfresco-search/bundles/assets/ng2-alfresco-search/i18n/en.json'
'/assets/adf-core/i18n/en.json': '/base/node_modules/@alfresco/adf-core/bundles/assets/adf-core/i18n/en.json',
'/assets/adf-content-services/i18n/en.json': '/base/node_modules/@alfresco/adf-content-services/bundles/assets/adf-content-services/i18n/en.json'
},
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser

View File

@ -1,13 +1,14 @@
{
"name": "alfresco-content-app",
"version": "0.1.0",
"license": "Apache-2.0",
"license": "LGPL-3.0",
"scripts": {
"ng": "ng",
"start": "npm run server-versions && ng serve --open",
"build": "npm run server-versions && ng build",
"build:prod": "npm run server-versions && ng build --prod",
"build:dev": "npm run server-versions && ng build && node postbuild-dev.js",
"build:tomcat": "npm run server-versions && ng build --base-href ./",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
@ -15,35 +16,33 @@
},
"private": true,
"dependencies": {
"@angular/animations": "4.4.5",
"@angular/cdk": "2.0.0-beta.12",
"@angular/common": "4.4.5",
"@angular/compiler": "4.4.5",
"@angular/core": "4.4.5",
"@angular/forms": "4.4.5",
"@angular/http": "4.4.5",
"@angular/material": "2.0.0-beta.12",
"@angular/platform-browser": "4.4.5",
"@angular/platform-browser-dynamic": "4.4.5",
"@angular/router": "4.4.5",
"@alfresco/adf-content-services": "2.0.0",
"@alfresco/adf-core": "2.0.0",
"@angular/animations": "5.0.0",
"@angular/cdk": "5.0.0-rc0",
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/core": "5.0.0",
"@angular/flex-layout": "2.0.0-beta.10",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/material": "5.0.0-rc0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@angular/router": "5.0.0",
"@ngx-translate/core": "8.0.0",
"alfresco-js-api": "1.10.0-beta6",
"core-js": "^2.4.1",
"alfresco-js-api": "2.0.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"ng2-alfresco-core": "1.10.0-beta6",
"ng2-alfresco-datatable": "1.10.0-beta6",
"ng2-alfresco-documentlist": "1.10.0-beta6",
"ng2-alfresco-login": "1.10.0-beta6",
"ng2-alfresco-search": "1.10.0-beta6",
"ng2-alfresco-upload": "1.10.0-beta6",
"ng2-alfresco-viewer": "1.10.0-beta6",
"pdfjs-dist": "1.8.557",
"rxjs": "5.1.0",
"zone.js": "^0.8.14"
"moment-es6": "1.0.0",
"pdfjs-dist": "1.5.404",
"rxjs": "5.5.2",
"web-animations-js": "^2.3.1",
"zone.js": "0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.7",
"@angular/compiler-cli": "4.4.5",
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "5.0.0",
"@angular/language-service": "4.4.5",
"@types/jasmine": "^2.5.53",
"@types/jasminewd2": "^2.0.2",
@ -64,6 +63,6 @@
"rimraf": "2.6.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
"typescript": "~2.4.2"
}
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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/>.
*/
var fs = require('fs');

View File

@ -7,32 +7,42 @@ const jasmineReporters = require('jasmine-reporters');
const projectRoot = path.resolve(__dirname);
const width = 1366;
const height = 768;
exports.config = {
allScriptsTimeout: 11000,
allScriptsTimeout: 30000,
specs: [
'./e2e/suites/authentication/*.test.ts',
'./e2e/suites/list-views/*.test.ts',
'./e2e/suites/application/page-titles.test.ts',
'./e2e/suites/navigation/side-navigation.test.ts',
'./e2e/suites/pagination/pagination.test.ts',
'./e2e/suites/pagination/*.test.ts',
'./e2e/suites/actions/*.test.ts'
],
capabilities: {
'browserName': 'chrome',
browserName: 'chrome',
chromeOptions: {
prefs: {
'credentials_enable_service': false
}
},
args: [ '--incognito', '--headless' ]
}
},
directConnect: true,
baseUrl: 'http://localhost:3000',
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
defaultTimeoutInterval: 50000,
print: function() {}
},
plugins: [{
package: 'jasmine2-protractor-utils',
disableHTMLReport: false,
@ -43,10 +53,14 @@ exports.config = {
htmlReportDir: `${projectRoot}/e2e-output/html-report/`,
screenshotPath: `${projectRoot}/e2e-output/screenshots/`
}],
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
browser.manage().window().setSize(width, height);
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
@ -57,5 +71,23 @@ exports.config = {
useFullTestName: false,
reportFailedUrl: true
}));
return browser.driver.executeScript(disableCSSAnimation);
function disableCSSAnimation() {
var css = '* {' +
'-webkit-transition-duration: 0s !important;' +
'transition-duration: 0s !important;' +
'-webkit-animation-duration: 0s !important;' +
'animation-duration: 0s !important;' +
'}',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
head.appendChild(style);
}
}
};

View File

@ -2,9 +2,9 @@
"ecmHost": "http://{hostname}{:port}",
"application": {
"name": "Alfresco Example Content Application",
"build": "1234"
"logo": "/assets/images/alfresco-logo-white.svg"
},
"logo": "alfresco-logo-white.svg",
"headerColor": "#2196F3",
"languagePicker": false,
"document-list": {
"supportedPageSizes": [
@ -121,6 +121,10 @@
{
"key": "ru",
"label": "Russian"
},
{
"key": "zh-CN",
"label": "Simplified Chinese"
}
]
}

View File

@ -1,40 +1,38 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { NgModule } from '@angular/core';
// ADF modules
import { CoreModule } from 'ng2-alfresco-core';
import { DataTableModule } from 'ng2-alfresco-datatable';
import { ViewerModule } from 'ng2-alfresco-viewer';
import { DocumentListModule } from 'ng2-alfresco-documentlist';
import { LoginModule } from 'ng2-alfresco-login';
import { UploadModule } from 'ng2-alfresco-upload';
import { SearchModule } from 'ng2-alfresco-search';
import { CoreModule } from '@alfresco/adf-core';
import { ContentModule } from '@alfresco/adf-content-services';
export function modules() {
return [
CoreModule,
DataTableModule,
DocumentListModule,
LoginModule,
SearchModule,
UploadModule,
ViewerModule
ContentModule
];
}

View File

@ -1,23 +1,31 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import { TranslationService, PageTitleService } from 'ng2-alfresco-core';
import { TranslationService, PageTitleService } from '@alfresco/adf-core';
@Component({
selector: 'app-root',

View File

@ -1,24 +1,32 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { TRANSLATION_PROVIDER } from 'ng2-alfresco-core';
import { TRANSLATION_PROVIDER } from '@alfresco/adf-core';
import { AdfModule } from './adf.module';
import { CommonModule } from './common/common.module';
@ -48,6 +56,7 @@ import { LocationLinkComponent } from './components/location-link/location-link.
imports: [
BrowserModule,
RouterModule.forRoot(APP_ROUTES, {
useHash: true,
enableTracing: false // enable for debug only
}),
AdfModule,

View File

@ -1,22 +1,30 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Routes } from '@angular/router';
import { AuthGuardEcm } from 'ng2-alfresco-core';
import { AuthGuardEcm } from '@alfresco/adf-core';
import { LayoutComponent } from './components/layout/layout.component';
@ -129,9 +137,8 @@ export const APP_ROUTES: Routes = [
component: GenericErrorComponent
}
],
canActivate: [
AuthGuardEcm
]
canActivateChild: [ AuthGuardEcm ],
canActivate: [ AuthGuardEcm ]
}
];

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { NgModule } from '@angular/core';
@ -29,7 +37,6 @@ import { NodeMoveDirective } from './directives/node-move.directive';
import { DownloadFileDirective } from './directives/node-download.directive';
import { NodeRestoreDirective } from './directives/node-restore.directive';
import { NodePermanentDeleteDirective } from './directives/node-permanent-delete.directive';
import { NodeFavoriteDirective } from './directives/node-favorite.directive';
import { ContentManagementService } from './services/content-management.service';
import { BrowsingFilesService } from './services/browsing-files.service';
@ -52,8 +59,7 @@ export function declarations() {
NodeMoveDirective,
DownloadFileDirective,
NodeRestoreDirective,
NodePermanentDeleteDirective,
NodeFavoriteDirective
NodePermanentDeleteDirective
];
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, DebugElement } from '@angular/core';
@ -21,8 +29,8 @@ import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs/Rx';
import { CoreModule, TranslationService, NodesApiService, NotificationService } from 'ng2-alfresco-core';
import { DocumentListModule } from 'ng2-alfresco-documentlist';
import { CoreModule, TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import { DocumentListModule } from '@alfresco/adf-content-services';
import { NodeActionsService } from '../services/node-actions.service';
import { ContentManagementService } from '../services/content-management.service';
@ -92,7 +100,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -112,7 +120,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_COPY.PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_COPY.PLURAL', 'APP.ACTIONS.UNDO', 10000
);
});
@ -131,7 +139,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_COPY.PARTIAL_SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_COPY.PARTIAL_SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -152,7 +160,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_COPY.PARTIAL_PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_COPY.PARTIAL_PLURAL', 'APP.ACTIONS.UNDO', 10000
);
});
@ -255,7 +263,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
expect(nodesApiService.deleteNode).toHaveBeenCalledWith(createdItems[0].entry.id, { permanent: true });
@ -279,7 +287,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_COPY.PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_COPY.PLURAL', 'APP.ACTIONS.UNDO', 10000
);
expect(spyOnDeleteNode).toHaveBeenCalled();
@ -300,7 +308,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(nodesApiService.deleteNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction['calls'].allArgs())
.toEqual([['APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'Undo', 10000],
.toEqual([['APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'APP.ACTIONS.UNDO', 10000],
['APP.MESSAGES.ERRORS.GENERIC', '', 3000]]);
});
@ -317,7 +325,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(nodesApiService.deleteNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction['calls'].allArgs())
.toEqual([['APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'Undo', 10000],
.toEqual([['APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'APP.ACTIONS.UNDO', 10000],
['APP.MESSAGES.ERRORS.GENERIC', '', 3000]]);
});
@ -334,7 +342,7 @@ describe('NodeCopyDirective', () => {
expect(service.copyNodes).toHaveBeenCalled();
expect(nodesApiService.deleteNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction['calls'].allArgs())
.toEqual([['APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'Undo', 10000],
.toEqual([['APP.MESSAGES.INFO.NODE_COPY.SINGULAR', 'APP.ACTIONS.UNDO', 10000],
['APP.MESSAGES.ERRORS.PERMISSION', '', 3000]]);
});
});

View File

@ -1,24 +1,32 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Directive, HostListener, Input } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { TranslationService, NodesApiService, NotificationService } from 'ng2-alfresco-core';
import { TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { NodeActionsService } from '../services/node-actions.service';
import { ContentManagementService } from '../services/content-management.service';
@ -96,7 +104,7 @@ export class NodeCopyDirective {
} catch (err) { /* Do nothing, keep the original message */ }
}
const undo = (numberOfCopiedItems > 0) ? 'Undo' : '';
const undo = (numberOfCopiedItems > 0) ? this.translation.translate.instant('APP.ACTIONS.UNDO') : '';
const withUndo = (numberOfCopiedItems > 0) ? '_WITH_UNDO' : '';
this.translation.get(i18nMessageString, { success: numberOfCopiedItems, failed: failedItems }).subscribe(message => {

View File

@ -1,27 +1,36 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { TestBed, ComponentFixture, fakeAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { CoreModule, TranslationService, NodesApiService, NotificationService } from 'ng2-alfresco-core';
import { CoreModule, TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import { Component, DebugElement } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { NodeDeleteDirective } from './node-delete.directive';
import { ContentManagementService } from '../services/content-management.service';
import { Observable } from 'rxjs/Rx';
@Component({
template: '<div [app-delete-node]="selection"></div>'
@ -83,7 +92,7 @@ describe('NodeDeleteDirective', () => {
element.triggerEventHandler('click', null);
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_DELETION.SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_DELETION.SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -112,7 +121,7 @@ describe('NodeDeleteDirective', () => {
element.triggerEventHandler('click', null);
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_DELETION.PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_DELETION.PLURAL', 'APP.ACTIONS.UNDO', 10000
);
});
@ -150,7 +159,7 @@ describe('NodeDeleteDirective', () => {
element.triggerEventHandler('click', null);
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_DELETION.PARTIAL_SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_DELETION.PARTIAL_SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -179,7 +188,7 @@ describe('NodeDeleteDirective', () => {
element.triggerEventHandler('click', null);
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_DELETION.PARTIAL_PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_DELETION.PARTIAL_PLURAL', 'APP.ACTIONS.UNDO', 10000
);
});
});

View File

@ -1,23 +1,31 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Directive, HostListener, Input } from '@angular/core';
import { TranslationService, NodesApiService, NotificationService } from 'ng2-alfresco-core';
import { TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { Observable } from 'rxjs/Rx';
@ -59,7 +67,7 @@ export class NodeDeleteDirective {
this.getDeleteMesssage(processedData)
.subscribe((message) => {
const withUndo = processedData.someSucceeded ? 'Undo' : '';
const withUndo = processedData.someSucceeded ? this.translation.translate.instant('APP.ACTIONS.UNDO') : '';
this.notification.openSnackMessageAction(message, withUndo, NodeDeleteDirective.DELETE_MESSAGE_DURATION)
.onAction()

View File

@ -1,23 +1,31 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { TestBed, ComponentFixture } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { CoreModule, AlfrescoApiService } from 'ng2-alfresco-core';
import { CoreModule, AlfrescoApiService } from '@alfresco/adf-core';
import { MatDialog } from '@angular/material';
import { Component, DebugElement } from '@angular/core';
import { DownloadFileDirective } from './node-download.directive';

View File

@ -1,24 +1,33 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Directive, Input, HostListener } from '@angular/core';
import { MatDialog } from '@angular/material';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { AlfrescoApiService, DownloadZipDialogComponent } from 'ng2-alfresco-core';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { DownloadZipDialogComponent } from '@alfresco/adf-content-services';
@Directive({
selector: '[app-download-node]'

View File

@ -1,332 +0,0 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { CoreModule, TranslationService, NodesApiService } from 'ng2-alfresco-core';
import { Component, DebugElement } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { AlfrescoApiService } from 'ng2-alfresco-core';
import { ContentManagementService } from '../services/content-management.service';
import { NodeFavoriteDirective } from './node-favorite.directive';
@Component({
template: '<div [app-favorite-node]="selection"></div>'
})
class TestComponent {
selection;
}
describe('NodeFavoriteDirective', () => {
let component: TestComponent;
let fixture: ComponentFixture<TestComponent>;
let element: DebugElement;
let directiveInstance;
let apiService;
let contentService;
let favoritesApi;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
CoreModule
],
declarations: [
TestComponent,
NodeFavoriteDirective
],
providers: [
ContentManagementService,
AlfrescoApiService
]
});
fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;
element = fixture.debugElement.query(By.directive(NodeFavoriteDirective));
directiveInstance = element.injector.get(NodeFavoriteDirective);
contentService = TestBed.get(ContentManagementService);
apiService = TestBed.get(AlfrescoApiService);
favoritesApi = apiService.getInstance().core.favoritesApi;
});
describe('selection input change event', () => {
it('does not call markFavoritesNodes() if input list is empty', () => {
spyOn(directiveInstance, 'markFavoritesNodes');
component.selection = [];
fixture.detectChanges();
expect(directiveInstance.markFavoritesNodes).not.toHaveBeenCalledWith();
});
it('calls markFavoritesNodes() on input change', () => {
spyOn(directiveInstance, 'markFavoritesNodes');
component.selection = [{ entry: { id: '1', name: 'name1' } }];
fixture.detectChanges();
expect(directiveInstance.markFavoritesNodes).toHaveBeenCalledWith(component.selection);
component.selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '1', name: 'name1' } }
];
fixture.detectChanges();
expect(directiveInstance.markFavoritesNodes).toHaveBeenCalledWith(component.selection);
});
});
describe('markFavoritesNodes()', () => {
let favoritesApiSpy;
beforeEach(() => {
favoritesApiSpy = spyOn(favoritesApi, 'getFavorite');
});
it('check each selected node if it is a favorite', fakeAsync(() => {
favoritesApiSpy.and.returnValue(Promise.resolve());
component.selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
];
fixture.detectChanges();
tick();
expect(favoritesApiSpy.calls.count()).toBe(2);
}));
it('it does not check processed node when another is unselected', fakeAsync(() => {
favoritesApiSpy.and.returnValue(Promise.resolve());
component.selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
];
fixture.detectChanges();
tick();
expect(directiveInstance.favorites.length).toBe(2);
expect(favoritesApiSpy.calls.count()).toBe(2);
favoritesApiSpy.calls.reset();
component.selection = [
{ entry: { id: '2', name: 'name2' } }
];
fixture.detectChanges();
tick();
expect(directiveInstance.favorites.length).toBe(1);
expect(favoritesApiSpy).not.toHaveBeenCalled();
}));
it('it does not check processed nodes when another is selected', fakeAsync(() => {
favoritesApiSpy.and.returnValue(Promise.resolve());
component.selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
];
fixture.detectChanges();
tick();
expect(directiveInstance.favorites.length).toBe(2);
expect(favoritesApiSpy.calls.count()).toBe(2);
favoritesApiSpy.calls.reset();
component.selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } },
{ entry: { id: '3', name: 'name3' } }
];
fixture.detectChanges();
tick();
expect(directiveInstance.favorites.length).toBe(3);
expect(favoritesApiSpy.calls.count()).toBe(1);
}));
});
describe('toggleFavorite()', () => {
let removeFavoriteSpy;
let addFavoriteSpy;
beforeEach(() => {
removeFavoriteSpy = spyOn(favoritesApi, 'removeFavoriteSite');
addFavoriteSpy = spyOn(favoritesApi, 'addFavorite');
});
it('does not perform action if favorites collection is empty', () => {
component.selection = [];
fixture.detectChanges();
element.triggerEventHandler('click', null);
expect(removeFavoriteSpy).not.toHaveBeenCalled();
expect(addFavoriteSpy).not.toHaveBeenCalled();
});
it('calls addFavorite() if none is a favorite', fakeAsync(() => {
addFavoriteSpy.and.returnValue(Promise.resolve());
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFavorite: false } },
{ entry: { id: '2', name: 'name2', isFavorite: false } }
];
element.triggerEventHandler('click', null);
tick();
expect(addFavoriteSpy.calls.argsFor(0)[1].length).toBe(2);
}));
it('calls addFavorite() on the node that is not a favorite in selection', fakeAsync(() => {
addFavoriteSpy.and.returnValue(Promise.resolve());
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFile: true, isFolder: false, isFavorite: false } },
{ entry: { id: '2', name: 'name2', isFile: true, isFolder: false, isFavorite: true } }
];
element.triggerEventHandler('click', null);
tick();
const callArgs = addFavoriteSpy.calls.argsFor(0)[1];
const callParameter = callArgs[0];
expect(callArgs.length).toBe(1);
expect(callParameter.target.file.guid).toBe('1');
}));
it('calls removeFavoriteSite() if all are favorites', fakeAsync(() => {
addFavoriteSpy.and.returnValue(Promise.resolve());
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFavorite: true } },
{ entry: { id: '2', name: 'name2', isFavorite: true } }
];
element.triggerEventHandler('click', null);
tick();
expect(removeFavoriteSpy.calls.count()).toBe(2);
}));
});
describe('getFavorite()', () => {
it('process node as favorite', fakeAsync(() => {
spyOn(favoritesApi, 'getFavorite').and.returnValue(Promise.resolve());
component.selection = [
{ entry: { id: '1', name: 'name1' } }
];
fixture.detectChanges();
tick();
expect(directiveInstance.favorites[0].entry.isFavorite).toBe(true);
}));
it('process node as not a favorite', fakeAsync(() => {
spyOn(favoritesApi, 'getFavorite').and.returnValue(Promise.reject(null));
component.selection = [
{ entry: { id: '1', name: 'name1' } }
];
fixture.detectChanges();
tick();
expect(directiveInstance.favorites[0].entry.isFavorite).toBe(false);
}));
});
describe('reset()', () => {
beforeEach(() => {
spyOn(favoritesApi, 'removeFavoriteSite').and.returnValue(Promise.resolve());
spyOn(favoritesApi, 'addFavorite').and.returnValue(Promise.resolve());
});
it('reset favorite collection after addFavorite()', fakeAsync(() => {
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFavorite: true } }
];
element.triggerEventHandler('click', null);
tick();
expect(directiveInstance.favorites.length).toBe(0);
}));
it('reset favorite collection after removeFavoriteSite()', fakeAsync(() => {
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFavorite: false } }
];
element.triggerEventHandler('click', null);
tick();
expect(directiveInstance.favorites.length).toBe(0);
}));
});
describe('hasFavorites()', () => {
it('returns false if favorites collection is empty', () => {
directiveInstance.favorites = [];
const hasFavorites = directiveInstance.hasFavorites();
expect(hasFavorites).toBe(false);
});
it('returns false if some are not favorite', () => {
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFavorite: true } },
{ entry: { id: '2', name: 'name2', isFavorite: false } }
];
const hasFavorites = directiveInstance.hasFavorites();
expect(hasFavorites).toBe(false);
});
it('returns true if all are favorite', () => {
directiveInstance.favorites = [
{ entry: { id: '1', name: 'name1', isFavorite: true } },
{ entry: { id: '2', name: 'name2', isFavorite: true } }
];
const hasFavorites = directiveInstance.hasFavorites();
expect(hasFavorites).toBe(true);
});
});
});

View File

@ -1,181 +0,0 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Directive, HostListener, Input, OnChanges } from '@angular/core';
import { AlfrescoApiService } from 'ng2-alfresco-core';
import { MinimalNodeEntity, FavoriteBody } from 'alfresco-js-api';
import { Observable } from 'rxjs/Rx';
import { ContentManagementService } from '../services/content-management.service';
@Directive({
selector: '[app-favorite-node]',
exportAs: 'favorite'
})
export class NodeFavoriteDirective implements OnChanges {
private favorites: any[] = [];
@Input('app-favorite-node')
selection: any[];
@HostListener('click')
onClick() {
this.toggleFavorite();
}
constructor(
public content: ContentManagementService,
private alfrescoApiService: AlfrescoApiService
) {}
ngOnChanges(changes) {
if (!changes.selection.currentValue.length) {
return;
}
this.markFavoritesNodes(changes.selection.currentValue);
}
toggleFavorite() {
if (!this.favorites.length) {
return;
}
const every = this.favorites.every((selected) => selected.entry.isFavorite);
if (every) {
const batch = this.favorites.map((selected) => {
// shared files have nodeId
const id = selected.entry.nodeId || selected.entry.id;
return Observable.of(this.alfrescoApiService.getInstance().core.favoritesApi.removeFavoriteSite('-me-', id));
});
Observable.forkJoin(batch)
.subscribe(() => {
this.content.toggleFavorite.next();
this.reset();
});
}
if (!every) {
const notFavorite = this.favorites.filter((node) => !node.entry.isFavorite);
const body: FavoriteBody[] = notFavorite.map((node) => this.createFavoriteBody(node));
Observable.from(this.alfrescoApiService.getInstance().core.favoritesApi.addFavorite('-me-', <any>body))
.subscribe(() => {
this.content.toggleFavorite.next();
this.reset();
});
}
}
markFavoritesNodes(selection) {
if (selection.length < this.favorites.length) {
const newFavorites = this.reduce(this.favorites, selection);
this.favorites = newFavorites;
}
const result = this.diff(selection, this.favorites);
const batch = this.getProcessBatch(result);
Observable.forkJoin(batch).subscribe((data) => this.favorites.push(...data));
}
hasFavorites(): boolean {
if (this.favorites && !this.favorites.length) {
return false;
}
return this.favorites.every((selected) => selected.entry.isFavorite);
}
private reset() {
this.favorites = [];
}
private getProcessBatch(selection): any[] {
return selection.map((selected) => this.getFavorite(selected));
}
private getFavorite(selected): Observable<any> {
const { name, isFile, isFolder } = selected.entry;
// shared files have nodeId
const id = selected.entry.nodeId || selected.entry.id;
const promise = this.alfrescoApiService.getInstance()
.core.favoritesApi.getFavorite('-me-', id);
return Observable.from(promise)
.map(() => ({
entry: {
id,
isFolder,
isFile,
name,
isFavorite: true
}
}))
.catch(() => {
return Observable.of({
entry: {
id,
isFolder,
isFile,
name,
isFavorite: false
}
});
});
}
private createFavoriteBody(node): FavoriteBody {
const type = this.getNodeType(node);
// shared files have nodeId
const id = node.entry.nodeId || node.entry.id;
return {
target: {
[type]: {
guid: id
}
}
};
}
private getNodeType(node): string {
// shared could only be files
if (!node.entry.isFile && !node.entry.isFolder) {
return 'file';
}
return node.entry.isFile ? 'file' : 'folder';
}
private diff(list, patch): any[] {
const ids = patch.map(item => item.entry.id);
return list.filter(item => ids.includes(item.entry.id) ? null : item);
}
private reduce(patch, comparator): any[] {
const ids = comparator.map(item => item.entry.id);
return patch.filter(item => ids.includes(item.entry.id) ? item : null);
}
}

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, DebugElement } from '@angular/core';
@ -21,8 +29,8 @@ import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs/Rx';
import { CoreModule, TranslationService, NodesApiService, NotificationService } from 'ng2-alfresco-core';
import { DocumentListModule } from 'ng2-alfresco-documentlist';
import { CoreModule, TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import { DocumentListModule } from '@alfresco/adf-content-services';
import { NodeActionsService } from '../services/node-actions.service';
import { ContentManagementService } from '../services/content-management.service';
@ -107,7 +115,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -132,7 +140,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_MOVE.PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_MOVE.PLURAL', 'APP.ACTIONS.UNDO', 10000
);
});
@ -155,7 +163,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -180,7 +188,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.PLURAL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.PLURAL', 'APP.ACTIONS.UNDO', 10000
);
});
@ -204,7 +212,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.FAIL', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.FAIL', 'APP.ACTIONS.UNDO', 10000
);
});
@ -228,7 +236,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction).toHaveBeenCalledWith(
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR', 'Undo', 10000
'APP.MESSAGES.INFO.NODE_MOVE.SINGULAR APP.MESSAGES.INFO.NODE_MOVE.PARTIAL.SINGULAR', 'APP.ACTIONS.UNDO', 10000
);
});
@ -348,7 +356,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodeAction)
.toHaveBeenCalledWith(movedItems.succeeded[0].itemMoved.entry, movedItems.succeeded[0].initialParentId);
expect(notificationService.openSnackMessageAction)
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000);
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000);
});
it('should move node back to initial parent, after succeeded move of a single file', () => {
@ -370,7 +378,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodeAction).toHaveBeenCalledWith(node.entry, initialParent);
expect(notificationService.openSnackMessageAction)
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000);
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000);
});
it('should restore deleted folder back to initial parent, after succeeded moving all its files', () => {
@ -396,7 +404,7 @@ describe('NodeMoveDirective', () => {
expect(nodesApiService.restoreNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction)
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000);
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000);
});
it('should notify when error occurs on Undo Move action', () => {
@ -422,7 +430,7 @@ describe('NodeMoveDirective', () => {
expect(nodesApiService.restoreNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction)
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000);
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000);
expect(notificationService.openSnackMessage)
.toHaveBeenCalledWith('APP.MESSAGES.ERRORS.GENERIC', 3000);
});
@ -449,7 +457,7 @@ describe('NodeMoveDirective', () => {
expect(nodesApiService.restoreNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction)
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000);
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000);
expect(notificationService.openSnackMessage)
.toHaveBeenCalledWith('APP.MESSAGES.ERRORS.GENERIC', 3000);
});
@ -477,7 +485,7 @@ describe('NodeMoveDirective', () => {
expect(service.moveNodes).toHaveBeenCalled();
expect(nodesApiService.restoreNode).toHaveBeenCalled();
expect(notificationService.openSnackMessageAction)
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'Undo', 10000);
.toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_MOVE.SINGULAR', 'APP.ACTIONS.UNDO', 10000);
expect(notificationService.openSnackMessage)
.toHaveBeenCalledWith('APP.MESSAGES.ERRORS.PERMISSION', 3000);
});

View File

@ -1,23 +1,31 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Directive, HostListener, Input } from '@angular/core';
import { TranslationService, NodesApiService, NotificationService } from 'ng2-alfresco-core';
import { TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { ContentManagementService } from '../services/content-management.service';
@ -46,7 +54,7 @@ export class NodeMoveDirective {
) {}
moveSelected() {
const permissionForMove: string = 'delete';
const permissionForMove = '!';
Observable.zip(
this.nodeActionsService.moveNodes(this.selection, permissionForMove),
@ -110,7 +118,7 @@ export class NodeMoveDirective {
errorMessage = this.getErrorMessage(info);
}
const undo = (succeeded + partiallySucceeded > 0) ? 'Undo' : '';
const undo = (succeeded + partiallySucceeded > 0) ? this.translation.translate.instant('APP.ACTIONS.UNDO') : '';
const withUndo = errorMessage ? '' : '_WITH_UNDO';
failedMessage = errorMessage ? errorMessage : failedMessage;

View File

@ -1,25 +1,33 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, DebugElement } from '@angular/core';
import { TestBed, ComponentFixture, async, fakeAsync, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs/Rx';
import { CoreModule, AlfrescoApiService, TranslationService, NotificationService } from 'ng2-alfresco-core';
import { CoreModule, AlfrescoApiService, TranslationService, NotificationService } from '@alfresco/adf-core';
import { NodePermanentDeleteDirective } from './node-permanent-delete.directive';

View File

@ -1,24 +1,32 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Directive, ElementRef, HostListener, Input } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { TranslationService, AlfrescoApiService, NotificationService } from 'ng2-alfresco-core';
import { TranslationService, AlfrescoApiService, NotificationService } from '@alfresco/adf-core';
import { MinimalNodeEntity, DeletedNodeEntry, PathInfoEntity } from 'alfresco-js-api';
@Directive({

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, DebugElement } from '@angular/core';
@ -21,7 +29,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { TestBed, ComponentFixture, async, fakeAsync, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs/Rx';
import { CoreModule, AlfrescoApiService, TranslationService, NotificationService } from 'ng2-alfresco-core';
import { CoreModule, AlfrescoApiService, TranslationService, NotificationService } from '@alfresco/adf-core';
import { NodeRestoreDirective } from './node-restore.directive';

View File

@ -1,25 +1,33 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { Directive, ElementRef, HostListener, Input } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs/Rx';
import { TranslationService, AlfrescoApiService, NotificationService } from 'ng2-alfresco-core';
import { TranslationService, AlfrescoApiService, NotificationService } from '@alfresco/adf-core';
import { MinimalNodeEntity, DeletedNodeEntry, PathInfoEntity, DeletedNodesPaging } from 'alfresco-js-api';
@Directive({
@ -236,7 +244,7 @@ export class NodeRestoreDirective {
private restoreNotification(): void {
const status = Object.assign({}, this.restoreProcessStatus);
const action = (status.oneSucceeded && !status.someFailed) ? 'View' : '';
const action = (status.oneSucceeded && !status.someFailed) ? this.translation.translate.instant('APP.ACTIONS.VIEW') : '';
this.getRestoreMessage()
.subscribe((message) => {

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { NgModule } from '@angular/core';

View File

@ -1,18 +1,26 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
* Alfresco Example Content Application
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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:
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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 { BrowsingFilesService } from './browsing-files.service';
@ -24,7 +32,7 @@ describe('BrowsingFilesService', () => {
service = new BrowsingFilesService();
});
it('subscribs to event', () => {
it('subscribes to event', () => {
const value: any = 'test-value';
service.onChangeParent.subscribe((result) => {

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