Skip to content

Commit

Permalink
Merge pull request owncloud#263 from owncloud/test-secure-view
Browse files Browse the repository at this point in the history
Add tests for secure view
  • Loading branch information
individual-it authored Jul 16, 2019
2 parents 980cd7c + f889662 commit 757a1d9
Show file tree
Hide file tree
Showing 10 changed files with 1,174 additions and 6 deletions.
60 changes: 59 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ 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
commands:
- make test-acceptance-webui
when:
matrix:
TEST_SUITE: web-acceptance

phan:
image: owncloudci/php:${PHP_VERSION}
pull: true
Expand Down Expand Up @@ -265,4 +282,45 @@ matrix:
DB_TYPE: mysql
DB_NAME: owncloud
NEED_CORE: true
NEED_INSTALL_APP: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: web-acceptance
BEHAT_SUITE: webUISecureView
DB_TYPE: mysql
DB_NAME: owncloud
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true

#PHP 7.1 with core master
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: web-acceptance
BEHAT_SUITE: webUISecureView
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: webUISecureView
DB_TYPE: mysql
DB_NAME: owncloud
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: web-acceptance
BEHAT_SUITE: webUISecureView
DB_TYPE: mysql
DB_NAME: owncloud
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true
29 changes: 24 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ package_name=$(app_name)
cert_dir=$(HOME)/.owncloud/certificates
occ=$(CURDIR)/../core/occ

# composer
composer_deps=vendor
acceptance_test_deps=vendor-bin/behat/vendor

appstore:
mkdir -p $(sign_dir)
rsync -a \
Expand Down Expand Up @@ -69,8 +73,10 @@ endif
PHPUNIT=php -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit"
PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit"
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHP_CODESNIFFER=vendor-bin/php_codesniffer/vendor/bin/phpcs
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

.DEFAULT_GOAL := help

Expand Down Expand Up @@ -140,8 +146,9 @@ test-php-unit-dbg: vendor/bin/phpunit

.PHONY: test-php-style
test-php-style: ## Run php-cs-fixer and check owncloud code-style
test-php-style: vendor-bin/owncloud-codestyle/vendor
test-php-style: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run
$(PHP_CODESNIFFER) --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance

.PHONY: test-php-style-fix
test-php-style-fix: ## Run php-cs-fixer and fix code style issues
Expand All @@ -160,13 +167,13 @@ test-php-phpstan: vendor-bin/phpstan/vendor

.PHONY: test-acceptance-api
test-acceptance-api: ## Run API acceptance tests
test-acceptance-api: vendor/bin/phpunit
../../tests/acceptance/run.sh --type api --remote
test-acceptance-api: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type api

.PHONY: test-acceptance-webui
test-acceptance-webui: ## Run webUI acceptance tests
test-acceptance-webui: vendor/bin/phpunit
../../tests/acceptance/run.sh --type webUI --remote
test-acceptance-webui: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type webUI

#
# Dependency management
Expand All @@ -190,6 +197,12 @@ vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-
vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
@echo owncloud-codestyle composer.lock is not up to date.

vendor-bin/php_codesniffer/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php_codesniffer/composer.lock
composer bin php_codesniffer install --no-progress

vendor-bin/php_codesniffer/composer.lock: vendor-bin/php_codesniffer/composer.json
@echo php_codesniffer composer.lock is not up to date.

vendor-bin/phan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phan/composer.lock
composer bin phan install --no-progress

Expand All @@ -201,3 +214,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.
80 changes: 80 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0"?>
<ruleset name="ownCloud Standard">
<description>ownCloud coding standard</description>
<arg name="colors" />
<arg value="sp" />

<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/3rdparty/*</exclude-pattern>

<!-- make sure we use tabs for indent and not spaces -->
<arg name="tab-width" value="4" />
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4" />
<property name="tabIndent" value="true" />
</properties>
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed" />
<exclude name="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed" />
</rule>

<rule ref="Generic.Files.LineLength">
<exclude name="Generic.Files.LineLength.TooLong" />
</rule>

<rule ref="PEAR">
<exclude name="Generic.Commenting.DocComment.ShortNotCapital" />
<exclude name="Generic.Commenting.DocComment.SpacingAfter" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Commenting.DocComment.TagValueIndent" />
<exclude name="Generic.Commenting.DocComment.ParamNotFirst" />
<exclude name="PEAR.Commenting.FileComment.IncompleteCopyright" />
<exclude name="PEAR.Commenting.FileComment.IncompleteLicense" />
<exclude name="PEAR.Commenting.FileComment.MissingVersion" />
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag" />
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingPackageTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment" />
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamName" />
<exclude
name="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
<exclude
name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />
<exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="PEAR.Functions.FunctionDeclaration.BraceOnSameLine" />
<exclude name="PEAR.Classes.ClassDeclaration.OpenBraceNewLine" />
</rule>
<rule ref="Zend.Files.ClosingTag"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
<rule ref="Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
<rule ref="Squiz.Commenting.DocCommentAlignment" />
<rule ref="Generic.WhiteSpace.ScopeIndent" />
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
<exclude
name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT" />
<exclude
name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE" />
</rule>
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
<rule ref="Generic.Classes.OpeningBraceSameLine" />

<!-- storage wrapper uses php function names to wrap them -->
<rule ref="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
<exclude-pattern>*/lib/storagewrapper.php</exclude-pattern>
</rule>

</ruleset>
27 changes: 27 additions & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
default:
autoload:
'': '%paths.base%/../features/bootstrap'

extensions:
jarnaiz\JUnitFormatter\JUnitFormatterExtension:
filename: report.xml
outputDir: '%paths.base%/../output/'

suites:
webUISecureView:
paths:
- '%paths.base%/../features/webUISecureView'
contexts:
- SecureViewContext:
- FeatureContext: &common_feature_context_params
baseUrl: http://localhost:8080
adminUsername: admin
adminPassword: admin
regularUserPassword: 123456
ocPath: apps/testing/api/v1/occ
- OccContext:
- WebUIFilesContext:
- WebUIGeneralContext:
- WebUILoginContext:
- WebUISharingContext:

Loading

0 comments on commit 757a1d9

Please sign in to comment.