Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
24 changes: 24 additions & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
@@ -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/'
117 changes: 117 additions & 0 deletions tests/acceptance/features/bootstrap/WebUIFirstrunwizardContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php
/**
* ownCloud
*
* @author Bhawana Prasain <bhawana.prs@gmail.com>
* @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 <http://www.gnu.org/licenses/>.
*
*/

use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\MinkExtension\Context\RawMinkContext;
use Page\FirstrunwizardPage;

require_once 'bootstrap.php';

/**
Comment thread
dpakach marked this conversation as resolved.
* 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) {
Comment thread
dpakach marked this conversation as resolved.
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
Comment thread
individual-it marked this conversation as resolved.
*/
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');
}
}
34 changes: 34 additions & 0 deletions tests/acceptance/features/bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* ownCloud
*
* @author Artur Neumann <info@jankaritech.com>
Comment thread
individual-it marked this conversation as resolved.
* @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 <http://www.gnu.org/licenses/>.
*
*/
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();
54 changes: 54 additions & 0 deletions tests/acceptance/features/lib/FirstrunwizardPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* ownCloud
*
* @author Bhawana Prasain <bhawana.prs@gmail.com>
* @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 <http://www.gnu.org/licenses/>.
*
*/

namespace Page;

use \Behat\Mink\Element\NodeElement;

/**
* Page object for Firstrunwizard
*
*/

class FirstrunwizardPage extends OwncloudPage {
protected $closeWizardXpath = "//*[@id='closeWizard']";
protected $firstrunwizardPopupXpath = "//*[@id='firstrunwizard']";

/**
Comment thread
dpakach marked this conversation as resolved.
* 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);
}
}
Original file line number Diff line number Diff line change
@@ -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

Comment thread
dpakach marked this conversation as resolved.
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
Loading