Commit Graph

14 Commits

Author SHA1 Message Date
Daniel Calviño Sánchez bc84aa0269 Include empty directories in the default state of acceptance tests
Before each scenario of the acceptance tests is run the Nextcloud server
is reset to a default state. To do this the full directory of the
Nextcloud server is commited to a local Git repository and then reset to
that commit when needed.

Unfortunately, Git does not support including empty directories in a
commit. Due to this, when the default state was restored, it could
happen that the file cache listed an empty directory that did not exist
because it was not properly restored (for example,
"data/appdata_*/css/icons"), and that in turn could lead to an error
when the directory was used.

Currently the only way to force Git to include an empty directory is to
add a dummy file to the directory (so it will no longer be empty,
but that should not be a problem in the affected directories, even if
the dummy file is not included in the file cache); although Git FAQ
suggests using a ".gitignore" file a ".keep" file was used instead, as
it conveys better its purpose.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-09-18 10:23:35 +02:00
Daniel Calviño Sánchez ea6b5063b5 Fix variable not replaced in "behat.yml" when default value was used
As "selenium.server" is a simulated variable it is not recognized by
Mink, so it must be always replaced by its value in "behat.yml" before
the file is parsed by Behat.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-06-28 17:32:38 +02:00
Daniel Calviño Sánchez e9012021fe Fix documentation
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-06-22 19:47:46 +02:00
Daniel Calviño Sánchez d70b6bc94b Set "wd_host" directly in "behat.yml" instead of through "BEHAT_PARAMS"
The "wd_host" parameter of Selenium2 sessions specify the URL used by
the Selenium driver to connect with the Selenium server. Thus, when the
Selenium server is at a different host or port than the default one (for
example, when run on Drone) the "wd_host" parameter must be set for each
of the Selenium2 sessions defined in "behat.yml".

The "BEHAT_PARAMS" environment variable, which extends the "behat.yml"
configuration file, was used for that. However, this required adding to
the "BEHAT_PARAMS" in "run-local.sh" each new session added to
"behat.yml", including those added in the acceptance tests of apps.

To address that limitation, this commit introduces a simulated variable,
"selenium.server"; just before the acceptance tests are run the
"selenium.server" variable in the "wd_host" parameter is replaced in the
"behat.yml" file used by the acceptance tests. Note that the file that
is modified is the one inside the Docker container used to run the
acceptance tests, so the original file is not touched.

Note that a simulated variable is needed because Behat does not support
overridding nor setting configuration parameters with environment
variables.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-06-22 19:46:44 +02:00
Daniel Calviño Sánchez 3bdb07320d Add workaround for parameter not available in Mink Extension
Due to a bug in the Mink Extension for Behat it is not possible to use
the "paths.base" parameter in the path to the custom Firefox profile.
"paths.base" is a special parameter in the Behat configuration that
refers to the directory in which "behat.yml" is stored. This comes in
very handy to set the path to custom Firefox profiles in the acceptance
tests for apps, as even if the "behat.yml" file belongs to an app its
paths are relative to the directory in which the tests are run, that is,
the "tests/acceptance" directory of the server.

Until the bug is fixed, just before the acceptance tests are run the
"paths.base" parameter in the path to the custom Firefox profile is
replaced by its value in the "behat.yml" file used by the acceptance
tests. Note that the file that is modified is the one inside the Docker
container used to run the acceptance tests, so the original file is not
touched.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-05-29 20:24:32 +02:00
Daniel Calviño Sánchez f4a64051b6 Extract path to configuration dir to its own variable
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-05-29 18:20:58 +02:00
Daniel Calviño Sánchez ea21fe2dbc Add support for setting the domain also when a specific helper is used
Before, the domain was automatically added assuming that the
NextcloudTestServerContext had no parameters defined in the Behat
configuration. However, in order to use a helper for Apache it would
need to be specified in the configuration with something like:

- NextcloudTestServerContext:
    nextcloudTestServerHelper: NextcloudTestServerLocalApacheHelper

The substitution now works both when a helper is specified and when it
is not; note, however, that providing custom parameters to the helper is
not supported, although they are not needed anyway so it is not really a
problem.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-04-09 21:50:30 +02:00
Daniel Calviño Sánchez a09b787a01 Install and configure Nextcloud server as www-data
Apache sub-processes are run as the www-data user, and they need to be
able to write to the "apps", "config" and "data" directories, so they
have to belong to that user, and therefore the Nextcloud server has to
be installed and configured too as the www-data user. The PHP built-in
web server will still be run as the root user, but in that case the
owner of those directories makes no difference, so this is compatible
with both cases.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-04-09 21:50:30 +02:00
Daniel Calviño Sánchez c8df4f5df4 Make possible to set the acceptance tests directory to use
When the acceptance tests were run they were always loaded from the
"tests/acceptance" directory of the Nextcloud server. Now it is possible
to set the directory used to look for the Behat configuration and the
Nextcloud installation script, which makes possible to run acceptance
tests for the apps too instead of only for the server (although if no
directory is explicitly given the tests for the server are the ones
run).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-04-06 21:56:12 +02:00
Daniel Calviño Sánchez c5cc1d80e6 Fix typo
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-03-27 16:48:19 +02:00
Daniel Calviño Sánchez c37329005e Add option to acceptance test runner to set the Selenium server
By default "127.0.0.1:4444" is used, so nothing needs to be set when the
acceptance tests and the Selenium server share the same network (like
when called by "run.sh").

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-07-20 07:56:51 +02:00
Daniel Calviño Sánchez 2fe8cad710 Add option to acceptance test runner to set the Nextcloud server domain
By default "127.0.0.1" is used, so nothing needs to be set when the
Selenium server and the Nextcloud test server share the same network
(like when called by "run.sh").

Besides passing the domain to the acceptance tests the Nextcloud test
server configuration must be modified to see the given domain as a
trusted domain; otherwise the access would be forbidden.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-07-20 07:54:39 +02:00
Daniel Calviño Sánchez 4fc9a7146b Add option to acceptance test runners to set a custom timeout multiplier
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-05-03 23:18:40 +02:00
Daniel Calviño Sánchez 2f80025ec2 Move acceptance tests from build/acceptance to tests/acceptance
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-21 14:44:29 +02:00