diff --git a/.drone.yml b/.drone.yml
index 523f6ebd151..3f744eecf6a 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -76,6 +76,24 @@ pipeline:
matrix:
TEST_SUITE: phpunit
+ webui-acceptance-tests:
+ image: owncloudci/php:${PHP_VERSION}
+ pull: true
+ environment:
+ - BROWSER=chrome
+ - SELENIUM_HOST=selenium
+ - SELENIUM_PORT=4444
+ - TEST_SERVER_URL=http://owncloud
+ - PLATFORM=Linux
+ - BEHAT_SUITE=${BEHAT_SUITE}
+ - MAILHOG_HOST=email
+ - APPS_TO_ENABLE=firstrunwizard
+ commands:
+ - make test-acceptance-webui
+ when:
+ matrix:
+ TEST_SUITE: web-acceptance
+
codecov:
image: plugins/codecov:2
secrets: [codecov_token]
@@ -137,6 +155,13 @@ services:
matrix:
NEED_SERVER: true
+ selenium:
+ image: selenium/standalone-chrome-debug:latest
+ pull: true
+ when:
+ matrix:
+ TEST_SUITE: web-acceptance
+
matrix:
include:
# owncloud-coding-standard
@@ -187,3 +212,44 @@ matrix:
DB_NAME: owncloud
NEED_CORE: true
NEED_INSTALL_APP: true
+
+ #webUI acceptance tests
+ - PHP_VERSION: 7.0
+ OC_VERSION: daily-stable10-qa
+ TEST_SUITE: web-acceptance
+ BEHAT_SUITE: webUIFirstrunwizard
+ DB_TYPE: mysql
+ DB_NAME: owncloud
+ NEED_CORE: true
+ NEED_SERVER: true
+ NEED_INSTALL_APP: true
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-stable10-qa
+ TEST_SUITE: web-acceptance
+ BEHAT_SUITE: webUIFirstrunwizard
+ DB_TYPE: mysql
+ DB_NAME: owncloud
+ NEED_CORE: true
+ NEED_SERVER: true
+ NEED_INSTALL_APP: true
+
+ - PHP_VERSION: 7.1
+ OC_VERSION: daily-master-qa
+ TEST_SUITE: web-acceptance
+ BEHAT_SUITE: webUIFirstrunwizard
+ DB_TYPE: mysql
+ DB_NAME: owncloud
+ NEED_CORE: true
+ NEED_SERVER: true
+ NEED_INSTALL_APP: true
+
+ - PHP_VERSION: 7.2
+ OC_VERSION: daily-master-qa
+ TEST_SUITE: web-acceptance
+ BEHAT_SUITE: webUIFirstrunwizard
+ DB_TYPE: mysql
+ DB_NAME: owncloud
+ NEED_CORE: true
+ NEED_SERVER: true
+ NEED_INSTALL_APP: true
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 270e93eaef9..011ad30e77f 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,9 @@ source_package_name=$(source_build_directory)/$(app_name)
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)
+# dependency folders (leave empty if not required)
+acceptance_test_deps=vendor-bin/behat/vendor
+
# signing
occ=$(CURDIR)/../../occ
private_key=$(HOME)/.owncloud/certificates/$(app_name).key
@@ -36,6 +39,7 @@ PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../l
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan
+BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
all: appstore
@@ -121,8 +125,8 @@ test-php-phpstan: vendor-bin/phpstan/vendor
.PHONY: test-acceptance-webui
test-acceptance-webui: ## Run webUI acceptance tests
-test-acceptance-webui:
- ../../tests/acceptance/run.sh --remote --type webUI
+test-acceptance-webui: $(acceptance_test_deps)
+ BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type webUI
#
# Dependency management
@@ -154,3 +158,9 @@ vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan
vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
@echo phpstan composer.lock is not up to date.
+
+vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/composer.lock
+ composer bin behat install --no-progress
+
+vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json
+ @echo behat composer.lock is not up to date.
\ No newline at end of file
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
new file mode 100644
index 00000000000..32d9b17ab5c
--- /dev/null
+++ b/tests/acceptance/config/behat.yml
@@ -0,0 +1,24 @@
+default:
+ autoload:
+ '': '%paths.base%/../features/bootstrap'
+
+ suites:
+ webUIFirstrunwizard:
+ paths:
+ - '%paths.base%/../features/webUIFirstrunwizard'
+ contexts:
+ - WebUIFirstrunwizardContext:
+ - WebUIGeneralContext:
+ - WebUILoginContext:
+ - FeatureContext: &common_feature_context_params
+ baseUrl: http://localhost:8080
+ adminUsername: admin
+ adminPassword: admin
+ regularUserPassword: 123456
+ ocPath: apps/testing/api/v1/occ
+ - OccContext:
+
+ extensions:
+ jarnaiz\JUnitFormatter\JUnitFormatterExtension:
+ filename: report.xml
+ outputDir: '%paths.base%/../output/'
diff --git a/tests/acceptance/features/bootstrap/WebUIFirstrunwizardContext.php b/tests/acceptance/features/bootstrap/WebUIFirstrunwizardContext.php
new file mode 100644
index 00000000000..db73d39e320
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/WebUIFirstrunwizardContext.php
@@ -0,0 +1,117 @@
+
+ * @copyright Copyright (c) 2019 Bhawana Prasain bhawana.prs@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+use Behat\Behat\Context\Context;
+use Behat\Behat\Hook\Scope\BeforeScenarioScope;
+use Behat\MinkExtension\Context\RawMinkContext;
+use Page\FirstrunwizardPage;
+
+require_once 'bootstrap.php';
+
+/**
+ * Context for First run wizard specific webUI steps
+ */
+class WebUIFirstrunwizardContext extends RawMinkContext implements Context {
+
+ /**
+ * @var FeatureContext
+ */
+ private $featureContext;
+
+ /**
+ * @var WebUIGeneralContext
+ */
+ private $webUIGeneralContext;
+
+ /**
+ * @var FirstrunwizardPage
+ */
+ private $firstrunwizardPage;
+
+ /**
+ * WebUIFirstrunwizardContext constructor.
+ *
+ * @param FirstrunwizardPage $firstrunwizardPage
+ */
+ public function __construct(FirstrunwizardPage $firstRunWizardPage) {
+ $this->firstRunWizardPage = $firstRunWizardPage;
+ }
+
+ /**
+ * @Then the user should see the firstrunwizard popup message
+ *
+ * @throws Exception
+ *
+ * @return void
+ */
+ public function theUserShouldSeeTheFirstrunwizardPopupMessage() {
+ $firstrunwizardScreen = $this->firstRunWizardPage->getWizardPopup();
+ if ($firstrunwizardScreen === null) {
+ throw new Exception("Could not find firstrunwizard popup");
+ }
+ if ($firstrunwizardScreen->isVisible() === false) {
+ throw new Exception("Firstrunwizard popup is not visible");
+ }
+ }
+
+ /**
+ * @Then the user should not see the firstrunwizard popup message
+ *
+ * @throws Exception
+ *
+ * @return void
+ */
+ public function theUserShouldNotNotSeeTheFirstrunwizardPopUpMessage() {
+ $firstrunwizardScreen = $this->firstRunWizardPage->getWizardPopup();
+
+ if ($firstrunwizardScreen !== null) {
+ if ($firstrunwizardScreen->isVisible() === true) {
+ throw new Exception("The firstrunwizard popup is not expected to appear but is present");
+ }
+ }
+ }
+
+ /**
+ * @When the user closes the firstrunwizard popup message
+ * @Given the user has closed the firstrunwizard popup message
+ *
+ * @return void
+ */
+ public function closeDialogBox() {
+ $this->firstRunWizardPage->closePopup();
+ }
+
+ /**
+ * @BeforeScenario
+ *
+ * @param BeforeScenarioScope $scope
+ *
+ * @return void
+ */
+ public function setUpScenario(BeforeScenarioScope $scope) {
+ // Get the environment
+ $environment = $scope->getEnvironment();
+ // Get all the contexts you need in this context
+ $this->featureContext = $environment->getContext('FeatureContext');
+ $this->webUIGeneralContext = $environment->getContext('WebUIGeneralContext');
+ }
+}
diff --git a/tests/acceptance/features/bootstrap/bootstrap.php b/tests/acceptance/features/bootstrap/bootstrap.php
new file mode 100644
index 00000000000..2a2e4ccaaa3
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/bootstrap.php
@@ -0,0 +1,34 @@
+
+ * @copyright Copyright (c) 2019 Artur Neumann info@jankaritech.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+require_once __DIR__ . '/../../../../../../tests/acceptance/features/bootstrap/bootstrap.php';
+
+$classLoader = new \Composer\Autoload\ClassLoader();
+$classLoader->addPsr4("Page\\", __DIR__ . "/../lib", true);
+$classLoader->addPsr4(
+ "", __DIR__ . "/../../../../../../tests/acceptance/features/bootstrap", true
+);
+
+//some tests need the guests app contexts
+$classLoader->addPsr4(
+ "", __DIR__ . "/../../../../../guests/tests/acceptance/features/bootstrap", true
+);
+$classLoader->register();
diff --git a/tests/acceptance/features/lib/FirstrunwizardPage.php b/tests/acceptance/features/lib/FirstrunwizardPage.php
new file mode 100644
index 00000000000..a07adfbbb2c
--- /dev/null
+++ b/tests/acceptance/features/lib/FirstrunwizardPage.php
@@ -0,0 +1,54 @@
+
+ * @copyright Copyright (c) Bhawana Prasain 2019 bhawana.prs@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+namespace Page;
+
+use \Behat\Mink\Element\NodeElement;
+
+/**
+ * Page object for Firstrunwizard
+ *
+ */
+
+class FirstrunwizardPage extends OwncloudPage {
+ protected $closeWizardXpath = "//*[@id='closeWizard']";
+ protected $firstrunwizardPopupXpath = "//*[@id='firstrunwizard']";
+
+ /**
+ * Closes Popup message from Firstrunwizard
+ *
+ * @return void
+ */
+ public function closePopup() {
+ $closeButton = $this->find("xpath", $this->closeWizardXpath);
+ $this->assertElementNotNull($closeButton, "no close button");
+ $closeButton->click();
+ $this->waitTillElementIsNull($this->closeWizardXpath);
+ }
+
+ /**
+ * @return NodeElement|null
+ */
+ public function getWizardPopup() {
+ return $this->find("xpath", $this->firstrunwizardPopupXpath);
+ }
+}
diff --git a/tests/acceptance/features/webUIFirstrunwizard/firstrunwizard.feature b/tests/acceptance/features/webUIFirstrunwizard/firstrunwizard.feature
new file mode 100644
index 00000000000..f3db201d875
--- /dev/null
+++ b/tests/acceptance/features/webUIFirstrunwizard/firstrunwizard.feature
@@ -0,0 +1,17 @@
+@webUI @insulated @disablePreviews
+Feature: first login wizard
+ As a user
+ I want to be informed about the basic features of ownCloud when I first log in
+ So that I can get a basic overview about ownCloud
+
+ Scenario: User logs in into ownCloud for the first time
+ Given user "user1" has been created with default attributes
+ When user "user1" logs in using the webUI
+ Then the user should see the firstrunwizard popup message
+
+ Scenario: Previously created user logs into ownCloud
+ Given user "user1" has been created with default attributes
+ When user "user1" logs in using the webUI
+ And the user closes the firstrunwizard popup message
+ And the user re-logs in as "user1" using the webUI
+ Then the user should not see the firstrunwizard popup message
diff --git a/tests/acceptance/features/webUIFirstrunwizard/resetAll.feature b/tests/acceptance/features/webUIFirstrunwizard/resetAll.feature
new file mode 100644
index 00000000000..a84110cb99c
--- /dev/null
+++ b/tests/acceptance/features/webUIFirstrunwizard/resetAll.feature
@@ -0,0 +1,31 @@
+@webUI @insulated @disablePreviews
+Feature: first login wizard is displayed again when the reset-all command has been run
+ As an administrator
+ I want to be able to reset the first run wizard display status for all users
+ So that I can force users to be shown the first run wizard popup again
+
+ Scenario: Administrator runs reset-all occ command after all the users log into ownCloud
+ Given user "user1" has been created with default attributes
+ And user "user2" has been created with default attributes
+ And user "user1" has logged in using the webUI
+ And the user has closed the firstrunwizard popup message
+ And the user has re-logged in as "user2" using the webUI
+ And the user has closed the firstrunwizard popup message
+ And the administrator has invoked occ command "firstrunwizard:reset-all"
+ When the user re-logs in as "user1" using the webUI
+ Then the user should see the firstrunwizard popup message
+ When the user closes the firstrunwizard popup message
+ And the user re-logs in as "user2" using the webUI
+ Then the user should see the firstrunwizard popup message
+
+ Scenario: Administrator runs reset-all occ command after some users log into ownCloud
+ Given user "user1" has been created with default attributes
+ And user "user2" has been created with default attributes
+ And user "user1" has logged in using the webUI
+ And the user has closed the firstrunwizard popup message
+ And the administrator has invoked occ command "firstrunwizard:reset-all"
+ When the user re-logs in as "user1" using the webUI
+ Then the user should see the firstrunwizard popup message
+ When the user closes the firstrunwizard popup message
+ And the user re-logs in as "user2" using the webUI
+ Then the user should see the firstrunwizard popup message
diff --git a/vendor-bin/behat/composer.json b/vendor-bin/behat/composer.json
new file mode 100644
index 00000000000..bf33598a1cc
--- /dev/null
+++ b/vendor-bin/behat/composer.json
@@ -0,0 +1,17 @@
+{
+ "config" : {
+ "platform": {
+ "php": "7.0.8"
+ }
+ },
+ "require": {
+ "behat/behat": "^3.0",
+ "behat/mink-extension": "^2.2",
+ "behat/mink-goutte-driver": "^1.2",
+ "behat/mink-selenium2-driver": "dev-master",
+ "jarnaiz/behat-junit-formatter": "^1.3",
+ "rdx/behat-variables": "^1.2",
+ "sensiolabs/behat-page-object-extension": "^2.0",
+ "symfony/translation": "^3.4"
+ }
+}