From e769bbefd79241c265226c739e953b0a4df5ab92 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Tue, 15 Dec 2020 14:51:01 +0100 Subject: [PATCH] Streamline settings tests --- .drone.star | 1 + accounts/ui/tests/run-acceptance-test.sh | 5 +- .../acceptance/features/settings.feature | 35 +++----- .../ui/tests/acceptance/helpers/language.js | 2 +- .../config/drone/identifier-registration.yml | 16 ---- .../ui/tests/config/drone/ocis-config.json | 27 ------ .../ui/tests/config/drone/proxy-config.json | 82 ------------------- settings/ui/tests/run-acceptance-test.sh | 9 +- 8 files changed, 19 insertions(+), 158 deletions(-) delete mode 100644 settings/ui/tests/config/drone/identifier-registration.yml delete mode 100644 settings/ui/tests/config/drone/ocis-config.json delete mode 100644 settings/ui/tests/config/drone/proxy-config.json diff --git a/.drone.star b/.drone.star index f3ceea31d9..64ffe33d81 100644 --- a/.drone.star +++ b/.drone.star @@ -1410,6 +1410,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes=[]): 'WEB_UI_CONFIG': '/drone/src/tests/config/drone/ocis-config.json', 'IDP_IDENTIFIER_REGISTRATION_CONF': '/drone/src/tests/config/drone/identifier-registration.yml', 'OCIS_LOG_LEVEL': 'warn', + 'SETTINGS_DATA_PATH': '/srv/app/tmp/ocis/settings', } # Pass in "default" accounts_hash_difficulty to not set this environment variable. diff --git a/accounts/ui/tests/run-acceptance-test.sh b/accounts/ui/tests/run-acceptance-test.sh index 1b3b990ab2..17dbf544c6 100755 --- a/accounts/ui/tests/run-acceptance-test.sh +++ b/accounts/ui/tests/run-acceptance-test.sh @@ -29,7 +29,7 @@ trap clean_up SIGHUP SIGINT SIGTERM if [ -z "$TEST_INFRA_DIRECTORY" ] then cleanup=true - testFolder=$(< /dev/urandom LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + testFolder=$(mktemp -d) printf "creating folder $testFolder for Test infrastructure setup\n\n" export TEST_INFRA_DIRECTORY=$testFolder fi @@ -46,11 +46,10 @@ clean_up() { trap clean_up SIGHUP SIGINT SIGTERM EXIT -cp -r "$WEB_PATH"/tests ./"$testFolder" +cp -r "$WEB_PATH"/tests "$testFolder" export SERVER_HOST=${SERVER_HOST:-https://localhost:9200} export BACKEND_HOST=${BACKEND_HOST:-https://localhost:9200} -export RUN_ON_OCIS='true' export TEST_TAGS=${TEST_TAGS:-"not @skip"} yarn run acceptance-tests "$1" diff --git a/settings/ui/tests/acceptance/features/settings.feature b/settings/ui/tests/acceptance/features/settings.feature index 104bcfe31c..ab68a00992 100644 --- a/settings/ui/tests/acceptance/features/settings.feature +++ b/settings/ui/tests/acceptance/features/settings.feature @@ -16,14 +16,24 @@ Feature: Set user specific settings When the user browses to the files page Then the files menu should be listed in language "English" - Scenario: changing the language + Scenario: changing the language (reactive and with page reload) Given user "user1" has logged in using the webUI And the user browses to the settings page When the user changes the language to "Deutsch" Then the setting "Language" should have value "Deutsch" When the user browses to the files page - And the user reloads the current page of the webUI Then the files menu should be listed in language "Deutsch" + And the account menu should be listed in language "Deutsch" + And the files header should be displayed in language "Deutsch" + When the user reloads the current page of the webUI + Then the files menu should be listed in language "Deutsch" + And the account menu should be listed in language "Deutsch" + And the files header should be displayed in language "Deutsch" + When the user browses to the settings page + And the user changes the language to "English" + And the user browses to the files page + When the user browses to the files page + Then the files menu should be listed in language "English" Scenario: changing the language only affects one user Given user "user2" has logged in using the webUI @@ -31,27 +41,6 @@ Feature: Set user specific settings When the user changes the language to "Español" Then the setting "Language" should have value "Español" When the user browses to the files page - And the user reloads the current page of the webUI Then the files menu should be listed in language "Español" When the user re-logs in as "user1" using the webUI - And the user reloads the current page of the webUI Then the files menu should be listed in language "English" - - Scenario: Check the accounts menu when the language is changed - Given user "user2" has logged in using the webUI - And the user browses to the settings page - When the user changes the language to "Deutsch" - And the user reloads the current page of the webUI - Then the setting "Language" should have value "Deutsch" - And the account menu should be listed in language "Deutsch" - When the user changes the language to "Français" - Then the account menu should be listed in language "Français" - - Scenario: Check the files table header menu when the language is changed - Given user "user2" has logged in using the webUI - And the user browses to the settings page - When the user changes the language to "Deutsch" - Then the setting "Language" should have value "Deutsch" - When the user browses to the files page - And the user reloads the current page of the webUI - Then the files header should be displayed in language "Deutsch" diff --git a/settings/ui/tests/acceptance/helpers/language.js b/settings/ui/tests/acceptance/helpers/language.js index 86deb39b57..4d00eaeeb7 100644 --- a/settings/ui/tests/acceptance/helpers/language.js +++ b/settings/ui/tests/acceptance/helpers/language.js @@ -32,7 +32,7 @@ const accountMenu = { 'Log out' ], Deutsch: [ - 'Profile', + 'Profil', 'Settings', 'Abmelden' ], diff --git a/settings/ui/tests/config/drone/identifier-registration.yml b/settings/ui/tests/config/drone/identifier-registration.yml deleted file mode 100644 index 7d4b98bc04..0000000000 --- a/settings/ui/tests/config/drone/identifier-registration.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- - -# OpenID Connect client registry. -clients: - - id: web - name: OCIS - application_type: web - insecure: yes - trusted: yes - redirect_uris: - - https://ocis-server:9200/oidc-callback.html - - https://ocis-server:9200/ - origins: - - https://ocis-server:9200 - -authorities: diff --git a/settings/ui/tests/config/drone/ocis-config.json b/settings/ui/tests/config/drone/ocis-config.json deleted file mode 100644 index 13328462a2..0000000000 --- a/settings/ui/tests/config/drone/ocis-config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "server": "https://ocis-server:9200", - "theme": "owncloud", - "version": "0.1.0", - "openIdConnect": { - "metadata_url": "https://ocis-server:9200/.well-known/openid-configuration", - "authority": "https://ocis-server:9200", - "client_id": "web", - "response_type": "code", - "scope": "openid profile email" - }, - "apps": [ - "files", - "draw-io", - "markdown-editor", - "media-viewer" - ], - "external_apps": [ - { - "id": "settings", - "path": "https://ocis-server:9200/settings.js", - "config": { - "url": "https://ocis-server:9200" - } - } - ] -} diff --git a/settings/ui/tests/config/drone/proxy-config.json b/settings/ui/tests/config/drone/proxy-config.json deleted file mode 100644 index a7d5ac7ca5..0000000000 --- a/settings/ui/tests/config/drone/proxy-config.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "HTTP": { - "Namespace": "com.owncloud" - }, - "policy_selector": { - "static": { - "policy": "reva" - } - }, - "policies": [ - { - "name": "reva", - "routes": [ - { - "endpoint": "/", - "backend": "http://localhost:9100" - }, - { - "endpoint": "/.well-known/", - "backend": "http://localhost:9130" - }, - { - "endpoint": "/konnect/", - "backend": "http://localhost:9130" - }, - { - "endpoint": "/signin/", - "backend": "http://localhost:9130" - }, - { - "endpoint": "/ocs/", - "backend": "http://localhost:9140" - }, - { - "type": "regex", - "endpoint": "/ocs/v[12].php/cloud/user", - "backend": "http://localhost:9110" - }, - { - "endpoint": "/remote.php/", - "backend": "http://localhost:9140" - }, - { - "endpoint": "/dav/", - "backend": "http://localhost:9140" - }, - { - "endpoint": "/webdav/", - "backend": "http://localhost:9140" - }, - { - "endpoint": "/status.php", - "backend": "http://localhost:9140" - }, - { - "endpoint": "/index.php/", - "backend": "http://localhost:9140" - }, - { - "endpoint": "/data", - "backend": "http://localhost:9140" - }, - { - "endpoint": "/api/v0/accounts", - "backend": "http://localhost:9181" - }, - { - "endpoint": "/accounts.js", - "backend": "http://localhost:9181" - }, - { - "endpoint": "/api/v0/settings", - "backend": "http://localhost:9190" - }, - { - "endpoint": "/settings.js", - "backend": "http://localhost:9190" - } - ] - } - ] -} diff --git a/settings/ui/tests/run-acceptance-test.sh b/settings/ui/tests/run-acceptance-test.sh index 53f732533b..17dbf544c6 100755 --- a/settings/ui/tests/run-acceptance-test.sh +++ b/settings/ui/tests/run-acceptance-test.sh @@ -14,7 +14,7 @@ fi if [ -z "$WEB_UI_CONFIG" ] then - echo "WEB_UI_CONFIG env variable is not set, cannot find ownCloud Web config file" + echo "WEB_UI_CONFIG env variable is not set, cannot find web config file" exit 1 fi @@ -29,7 +29,7 @@ trap clean_up SIGHUP SIGINT SIGTERM if [ -z "$TEST_INFRA_DIRECTORY" ] then cleanup=true - testFolder=$(cat < /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + testFolder=$(mktemp -d) printf "creating folder $testFolder for Test infrastructure setup\n\n" export TEST_INFRA_DIRECTORY=$testFolder fi @@ -46,13 +46,10 @@ clean_up() { trap clean_up SIGHUP SIGINT SIGTERM EXIT -cp -r "$WEB_PATH/tests" "./$testFolder" +cp -r "$WEB_PATH"/tests "$testFolder" -export NODE_TLS_REJECT_UNAUTHORIZED='0' export SERVER_HOST=${SERVER_HOST:-https://localhost:9200} export BACKEND_HOST=${BACKEND_HOST:-https://localhost:9200} -export OCIS_SETTINGS_STORE=${OCIS_SETTINGS_STORE:-"/var/tmp/ocis/settings"} -export RUN_ON_OCIS=true export TEST_TAGS=${TEST_TAGS:-"not @skip"} yarn run acceptance-tests "$1"