Commit Graph

419 Commits

Author SHA1 Message Date
Daniel Calviño Sánchez 593118204a Replace downloaded Selenium server with Docker container
Instead of downloading the Selenium server and requiring a specific
Firefox version to be installed in the system now the Selenium server is
run using one of the official Selenium Docker images, which provides
both the Selenium server and the appropriate version of Firefox.

Moreover, as it is run inside the Docker container, the web browser is
now run in headless mode; however, if needed, it can still be viewed
through VNC.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-21 14:24:32 +02:00
Daniel Calviño Sánchez 50dfca8d8a Make possible to specify a subset of the acceptance tests to run
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:57 +02:00
Daniel Calviño Sánchez ed7d63d16a Add acceptance test steps to Drone
Each acceptance test feature is run in its own Drone step. The container
of the step runs the acceptance tests themselves, but they require two
additional Drone services. One service provides the Selenium server that
performs the web browser actions specified by the tests, and the other
service provides the Nextcloud server that the tests will be run
against (due to security concerns the acceptance tests themselves can
not create Docker containers for the Nextcloud server as done when
running them in a local system, as if Drone containers had access to
Docker a malicious pull request could be used to take over the Drone
server).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:57 +02:00
Daniel Calviño Sánchez be96be09b5 Add general multiplier for find timeouts
Although the timeouts specified in the acceptance tests are enough in
most cases they may not be when running them in a slow system or
environment. For those situations a general multiplier for find
timeouts is added. It can be set in the "behat.yml" configuration file
to increase the timeout used in every find call (except those that used
a timeout of 0, as in those cases the element had to be already present
when finding it and whether the system is slow or not does not change
that).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:04 +02:00
Daniel Calviño Sánchez a7e1833cf3 Add the timeout in NoSuchElementException messages
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:04 +02:00
Daniel Calviño Sánchez ff7d1bf1e7 Add NextcloudTestServerHelper for Nextcloud servers in Drone services
Due to security concerns, the public Nextcloud server repository is not
set as "trusted" in Drone (otherwise a malicious pull request could be
used to take over the server), so it is not possible to create Docker
containers from the containers started by Drone. Therefore, the
Nextcloud server must be started as a service by Drone itself.

The NextcloudTestServerDroneHelper is added to manage from the
acceptance tests a Nextcloud test server running in a Drone service; to
be able to control the remote Nextcloud server the Drone service must
provide the Nextcloud server control server.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:04 +02:00
Daniel Calviño Sánchez c452390d59 Extract waiting for the server to start to the Utils class
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:04 +02:00
Daniel Calviño Sánchez 34510b73a2 Extract installation and configuration of the Nextcloud server
The installation and configuration of the Nextcloud server as expected
by the acceptance tests is extracted to its own script so it can be used
from any element that launches the acceptance tests.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:04 +02:00
Daniel Calviño Sánchez 7de82615ff Use NextcloudTestServerHelper in NextcloudTestServerContext
Instead of depending on a Nextcloud test server created through Docker,
NextcloudTestServerContext now uses the NextcloudTestServerHelper
interface. This makes possible to provide other implementations of the
interface for those cases in which using a Docker container is not a
valid approach, like in the continuous integration system of the public
repository due to security concerns.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez f10156f009 Extract NextcloudTestServerHelper interface
The NextcloudTestServerHelper interface provides the needed methods to
manage the Nextcloud server used in acceptance tests.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 4d71d37fe3 Reorganize method position inside class
For consistency with the rest of private methods in the class,
"isContainerRegistered" is moved below the only public method in which
it is used ("cleanUp").

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 03233b1d58 Hide methods not needed outside the class
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 8170b99561 Remove no longer needed methods
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez dead90f1cf Move all Docker-related logic to NextcloudTestServerDockerHelper
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 38efa97aa5 Rename methods to something less tied to its implementation
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez c4613733eb Add acceptance tests related to access levels
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 1203369ea6 Add acceptance tests related to login
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 6a15d9da9c Add script to set up and run the acceptance tests
The acceptance tests require several elements to be set up in order to
be run. Besides those PHP packages that it depends on, like Behat or
Mink, it requires a running Selenium server and a Docker image with the
Nextcloud server to be tested available in the system. The "run.sh"
script takes care of preparing all the needed elements and then run the
acceptance tests; once finished, either normally or due to an error, it
also cleans up the temporal elements created/started by the script and
the acceptance tests.

The Docker image with the Nextcloud server to be tested is created from
the Nextcloud code in the greatparent directory each time "run.sh" is
executed; the code is copied inside the image, so once the acceptance
tests are started the code in the greatparent directory can be modified
without affecting them. As it is based on the current code at the time
of the launch that image is created and destroyed each time the
acceptance tests are run. However, the image that it is based on, which
is created using "docker/nextcloud-local-parent/Dockerfile", does not
change between runs, so it is kept built in the system to speed up the
launch of acceptance tests.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez b22997796b Add wrappers to adapt the element finding system of Mink
Mink elements (including the document element) provide a
"find(selector, locator)" method to look for child elements in their web
browser session. The Locator class is added to be able to store the
selector and locator in a single object; it also provides a fluent API
to ease the definition of Mink locators, specially those using the
"named" selector.

The method "find(locator, timeout, timeoutStep)" is added to Actor
objects; it is simply a wrapper over Mink's "find(selector, locator)"
method, although it throws an exception if the element can not be found
instead of returning null, and it also makes possible to automatically
retry to find the element for certain amount of time.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 7c07f01d59 Add actors for test scenarios
An actor plays the role of an end-user in the test scenario. As such,
each actor has its own web browser session used to perform the actions
specified by the steps of the scenario. Only one actor is active at a
time in a test scenario, and the current actor can be set through the "I
act as XXX" step; from then on, all the steps are performed by that
actor, until a different actor is set by calling "I act as XXX" again.
If no actor was explicitly set in a scenario then the default actor,
unsurprisingly named "default", is the one used.

The ActorContext class is added to provide automatic support for all
that. To use the ActorContext, besides adding it to the context list in
"behat.yml", a Mink session for each actor used in the features must be
specified in "behat.yml". Once done other Contexts just need to
implement the ActorAwareInterface (which can be done simply by using the
ActorAware trait) to have access to the current Actor object of the test
scenario; as the Actor object provides its own session other Contexts do
not need to extend from RawMinkContext. The ActorContext is itself a
RawMinkContext, so it automatically receives the base URL of the
Nextcloud test server run by NextcloudTestServerContext and propagates
that base URL to all the actors.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 4c620f1fcb Add helper context to isolate the test server with Docker containers
Scenarios in acceptance tests must be independent one of each other.
That is, the execution of one scenario can not affect the execution of
another scenario, nor it can depend on the result of the execution of a
different scenario. Each scenario must be isolated and self-contained.
As the acceptance tests are run against a Nextcloud server the server
must be in a known and predefined initial state each time a scenario
begins.

The NextcloudTestServerContext is introduced to automatically set up the
Nextcloud test server for each scenario.

This can be achieved using Docker containers. Before an scenario begins
a new Docker container with a Nextcloud server is run; the scenario is
then run against the server provided by the container. When the scenario
ends the container is destroyed. As long as the Nextcloud server uses
local data storage each scenario is thus isolated from the rest.

The NextcloudTestServerContext also notifies its sibling RawMinkContexts
about the base URL of the Nextcloud test server being used in each
scenario.

Although it uses the Behat context system, NextcloudTestServerContext is
not really part of the acceptance tests, but a provider of core features
needed by them; it can be seen as part of a Nextcloud acceptance test
library. Therefore, those classes are stored in the "core" directory
instead of the "bootstrap" directory. Besides its own (quite limited)
autoload configuration, Behat also uses the Composer autoloader, so the
"core" directory has to be added there for its classes to be found by
Behat.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez b5fba56499 Add basic files for the automated acceptance test system
The acceptance tests verify that a Nextcloud server works as expected
from the point of view of an end-user. They are specified as user
stories using Behat paired with Mink, which provides web browser
automation.

Mink supports several browser emulators, but the system is set up to use
Selenium, as it is FOSS and the one that better reflects the use of a
web browser by an end-user (as, in fact, it controls real web browsers).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Lukas Reschke 66835476b5
Add support for ratelimiting via annotations
This allows adding rate limiting via annotations to controllers, as one example:

```
@UserRateThrottle(limit=5, period=100)
@AnonRateThrottle(limit=1, period=100)
```

Would mean that logged-in users can access the page 5 times within 100 seconds, and anonymous users 1 time within 100 seconds. If only an AnonRateThrottle is specified that one will also be applied to logged-in users.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-04-13 12:00:16 +02:00
Morris Jobke 4cf4d2f27e
Favorites integration tests for shared files
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-12 11:44:57 -05:00
Joas Schilling bd37021587
Fix casing of same origin frame option
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-12 12:37:32 +02:00
Vincent Petry d1081e7940
Add integration test for trashbin
Add test for basic deletion.
Add test when deleting from shared folder as recipient.
Add test to check that metadata stays when moving out of shared folder
as recipient.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-11 14:59:21 -05:00
Lukas Reschke 4cf61481e5
Clear opcode cache after config change
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-04-11 18:57:40 +02:00
Lukas Reschke b882f65fbb
Add integration tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-04-11 01:39:54 +02:00
Morris Jobke 4c60360bf7 Merge pull request #4221 from nextcloud/provisioning-api-for-account-info
Allow to change account info via provisioning api
2017-04-07 12:48:44 -05:00
Joas Schilling 3d628783d9
Allow to change account info via provisioning api
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-07 12:50:47 +02:00
Morris Jobke b084ceec3d Merge pull request #4224 from nextcloud/dont-list-on-public-calendar-endpoint
Don't list on public calendar endpoints
2017-04-05 20:55:39 -05:00
Lukas Reschke 63288ebc50
Don't list on public calendar endpoints
There is no need to allow listing here.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-04-05 22:43:05 +02:00
Lukas Reschke 1d3e391ad8
Add integration tests for token auth
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-04-05 17:58:33 +02:00
Roeland Jago Douma 04fc00fcdf
mergejs should print a newline between imports
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-31 17:06:38 +02:00
Robin Appelman 7d4c4224d1
fix setup of external storage integration tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-03-30 17:16:59 +02:00
Morris Jobke f9bc53146d
Fix unit tests
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-28 21:00:12 -06:00
Morris Jobke 6901b28f07
Split long running features/sharing-v1.feature into two smaller parts
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-28 16:46:56 -06:00
Roeland Jago Douma 4821c00ea8 Merge pull request #4004 from nextcloud/backport-27172
Remove SharedCache::getNumericStorageId to let CacheWrapper do it
2017-03-28 21:56:44 +02:00
Vincent Petry c54091d43b
Use authType BASIC for Sabre client in integration tests
This helps massively reduce the numerous useless 401 exceptions that
appears in the test log. These appear only because Sabre first connects
without any auth type to receive the challenge and then sends the
authentication data.

With this change it will directly use basic auth.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-24 12:40:14 -06:00
Lukas Reschke f94bc6f8bb Merge pull request #4013 from nextcloud/bundle_vendor_js
Bundle vendor js
2017-03-24 10:49:57 +01:00
Morris Jobke 9bd4c406e3
also install sinon
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-23 23:42:54 -06:00
Vincent Petry 46a32045d7
Update karma, use sinon from npm
Update karma library and use sinon JS library provided by
karma-jasmine-sinon instead of local file.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-23 23:35:41 -06:00
Morris Jobke 49d0507f5d Merge pull request #3879 from nextcloud/downstream-26915
Added integration tests for sharees using v2.php
2017-03-23 16:12:24 -06:00
Morris Jobke d2654c8aea Merge pull request #3965 from nextcloud/downstream-27343
Providing --path option to transfer-ownership
2017-03-23 15:20:53 -06:00
Roeland Jago Douma 588f47d498
Add CI step to verify merged vendor js
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-23 13:40:30 +01:00
Roeland Jago Douma eda98ed3df
Merge vendor js
There is a bunch of javascript we always load from vendors. This
combines this into 1 javascript file. Which reduces the number of
request by ~10.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-23 13:40:23 +01:00
Vincent Petry 89c42a76c3
Remove SharedCache::getNumericStorageId to let CacheWrapper do it
The CacheWrapper will properly forward the call to the wrapped cache.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-23 00:02:48 -06:00
Robin Appelman 1e707ef1db
add integration test to ensure that shares dont overwrite external storages
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-03-22 18:00:12 +01:00
Morris Jobke 209e3e39e2
Use proper bash test syntax
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-20 18:48:55 -06:00
Sujith H f654f29532
Providing --path option to transfer-ownership
This will help user to selectively move the folders
specified using --path option, instead of moving
entire folder under files directory.

Signed-off-by: Sujith H <sharidasan@owncloud.com>

Update the integration test for transfer-ownership

Update the integration test for transfer-ownership
as the new option --path is introduced in the command.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-03-20 18:29:21 -06:00