Make possible to provide acceptance tests for apps #9114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now the acceptance tests were limited to the server and apps in the Nextcloud server repository. This pull request makes possible to use the acceptance tests framework also in apps on their own repository (as long as the app repository was cloned in the apps directory of a Nextcloud server repository, which can be easily done in Drone with some shell commands, and is probably the typical setup in a development machine).
Instead of always loading the Behat configuration from tests/acceptance now the directory can be explicitly set with the
--acceptance-tests-dir XXXoption. Therefore now apps can provide their own Behat configuration to load the features and context classes for the app, including context classes from the Nextcloud server, for example, to use the login steps. Note that the context classes for the Nextcloud server and the core acceptance test framework classes are automatically loaded; there is no need to explicitly set them in the Behat configuration of the app.In any case, the Behat configuration used in the app is exclusive for the app; it does not extend the Behat configuration from the Nextcloud server (even if I tried to avoid duplicating some configuration parameters, but after exploring every option I could think of I found no way to do that :-( ).
The installAndConfigureServer.sh script executed when the acceptance tests are setup must be provided too in the acceptance tests dir. In this case, however, it is possible to just call the installAndConfigureServer.sh from the acceptance tests of Nextcloud server; after doing that the script for the app will typically enable it so the app is already available when the acceptance tests are run.
All of the above can be seen more clearly in nextcloud/spreed#768, which is the pull request to add acceptance tests for Nextcloud Talk (please refer to the messages of the commits for further information).