mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-29 23:39:35 -05:00
Add 'settings/' from commit '230545a4a75b0611988fbcea51336a6c316d6a3d'
git-subtree-dir: settings git-subtree-mainline:c26f7b390agit-subtree-split:230545a4a7
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
Feature: Set user specific settings
|
||||
As a user
|
||||
I want to set user specific settings
|
||||
So that I can customize my OCIS experience to my liking
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes:
|
||||
| username |
|
||||
| user1 |
|
||||
| user2 |
|
||||
|
||||
Scenario: Check the default settings
|
||||
Given user "user1" has logged in using the webUI
|
||||
And the user browses to the settings page
|
||||
Then the setting "Language" should have value "Please select"
|
||||
When the user browses to the files page
|
||||
Then the files menu should be listed in language "English"
|
||||
|
||||
Scenario: changing the language
|
||||
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"
|
||||
|
||||
Scenario: changing the language only affects one user
|
||||
Given user "user2" has logged in using the webUI
|
||||
And the user browses to the settings page
|
||||
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"
|
||||
@@ -0,0 +1,96 @@
|
||||
const filesMenu = {
|
||||
English: [
|
||||
'All files',
|
||||
'Shared with me',
|
||||
'Shared with others',
|
||||
'Trash bin'
|
||||
],
|
||||
Deutsch: [
|
||||
'Alle Dateien',
|
||||
'Mit mir geteilt',
|
||||
'Mit anderen geteilt',
|
||||
'Papierkorb'
|
||||
],
|
||||
Español: [
|
||||
'Todos los archivos',
|
||||
'Compartido conmigo',
|
||||
'Compartido con otros',
|
||||
'Papelera de reciclaje'
|
||||
],
|
||||
Français: [
|
||||
'Tous les fichiers',
|
||||
'Partagé avec moi',
|
||||
'Partagé avec autres',
|
||||
'Corbeille'
|
||||
]
|
||||
}
|
||||
|
||||
const accountMenu = {
|
||||
English: [
|
||||
'Manage your account',
|
||||
'Log out'
|
||||
],
|
||||
Deutsch: [
|
||||
'Verwalten Sie Ihr Benutzerkonto',
|
||||
'Abmelden'
|
||||
],
|
||||
Español: [
|
||||
'Administra tu cuenta',
|
||||
'Salir'
|
||||
],
|
||||
Français: [
|
||||
'Modifier votre compte',
|
||||
'Se déconnecter'
|
||||
]
|
||||
}
|
||||
|
||||
const filesListHeaderMenu = {
|
||||
English: [
|
||||
'Name',
|
||||
'Size',
|
||||
'Updated',
|
||||
'Actions'
|
||||
],
|
||||
Deutsch: [
|
||||
'Name',
|
||||
'Größe',
|
||||
'Erneuert',
|
||||
'Aktionen'
|
||||
],
|
||||
Español: [
|
||||
'Nombre',
|
||||
'Tamaño',
|
||||
'Actualizado',
|
||||
'Acciones'
|
||||
],
|
||||
Français: [
|
||||
'Nom',
|
||||
'Taille',
|
||||
'Modifié',
|
||||
'Actions'
|
||||
]
|
||||
}
|
||||
|
||||
exports.getFilesMenuForLanguage = function (language) {
|
||||
const menuList = filesMenu[language]
|
||||
if (menuList === undefined) {
|
||||
throw new Error(`Menu for language ${language} is not available`)
|
||||
}
|
||||
return menuList
|
||||
}
|
||||
|
||||
exports.getUserMenuForLanguage = function (language) {
|
||||
const menuList = accountMenu[language]
|
||||
if (menuList === undefined) {
|
||||
throw new Error(`Menu for language ${language} is not available`)
|
||||
}
|
||||
return menuList
|
||||
}
|
||||
|
||||
exports.getFilesHeaderMenuForLanguage = function (language) {
|
||||
const menuList = filesListHeaderMenu[language]
|
||||
if (menuList === undefined) {
|
||||
throw new Error(`Menu for language ${language} is not available`)
|
||||
}
|
||||
return menuList
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
module.exports = {
|
||||
commands: {
|
||||
getMenuList: async function () {
|
||||
const menu = []
|
||||
await this.isVisible('@openNavigationBtn', (res) => {
|
||||
if (res.value) {
|
||||
this.click('@openNavigationBtn')
|
||||
}
|
||||
})
|
||||
await this.waitForElementVisible('@fileSidebarNavItem')
|
||||
await this.api
|
||||
.elements('@fileSidebarNavItem', result => {
|
||||
result.value.map(item => {
|
||||
this.api.elementIdText(item.ELEMENT, res => {
|
||||
menu.push(res.value)
|
||||
})
|
||||
})
|
||||
})
|
||||
return menu
|
||||
},
|
||||
getUserMenu: async function () {
|
||||
const menu = []
|
||||
await this
|
||||
.waitForElementVisible('@userMenuBtn')
|
||||
.click('@userMenuBtn')
|
||||
.waitForElementVisible('@userMenuContainer')
|
||||
await this.api
|
||||
.elements('@userMenuItem', result => {
|
||||
result.value.map(item => {
|
||||
this.api.elementIdText(item.ELEMENT, res => {
|
||||
menu.push(res.value)
|
||||
})
|
||||
})
|
||||
})
|
||||
await this
|
||||
.waitForElementVisible('@userMenuBtn')
|
||||
.click('@userMenuBtn')
|
||||
.waitForElementNotVisible('@userMenuContainer')
|
||||
return menu
|
||||
},
|
||||
getFileHeaderItems: async function () {
|
||||
const menu = []
|
||||
await this.waitForElementVisible('@fileTableHeaderItems')
|
||||
await this.api
|
||||
.elements('@fileTableHeaderItems', result => {
|
||||
result.value.map(item => {
|
||||
this.api.elementIdText(item.ELEMENT, res => {
|
||||
menu.push(res.value)
|
||||
})
|
||||
})
|
||||
})
|
||||
return menu
|
||||
}
|
||||
},
|
||||
|
||||
elements: {
|
||||
pageHeader: {
|
||||
selector: '.oc-page-title'
|
||||
},
|
||||
languageValue: {
|
||||
selector: "//button[@id='single-choice-toggle-profile-language']",
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
fileSidebarNavItem: {
|
||||
selector: '.oc-sidebar-nav-item'
|
||||
},
|
||||
openNavigationBtn: {
|
||||
selector: '//button[@aria-label="Open navigation menu"]',
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
userMenuBtn: {
|
||||
selector: '#_userMenuButton'
|
||||
},
|
||||
userMenuItem: {
|
||||
selector: '#account-info-container li'
|
||||
},
|
||||
userMenuContainer: {
|
||||
selector: '#account-info-container'
|
||||
},
|
||||
fileTableHeaderItems: {
|
||||
selector: '//*[@id="files-table-header"]//span[not(*) and not(ancestor::label)]',
|
||||
locateStrategy: 'xpath'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
const { client } = require('nightwatch-api')
|
||||
const util = require('util')
|
||||
|
||||
module.exports = {
|
||||
url: function () {
|
||||
return this.api.launchUrl + '/#/settings'
|
||||
},
|
||||
|
||||
commands: {
|
||||
navigateAndWaitTillLoaded: async function () {
|
||||
const url = this.url()
|
||||
await await this.navigate(url)
|
||||
while (true) {
|
||||
let found = false
|
||||
await this.waitForElementVisible('@pageHeader', 2000, 500, false)
|
||||
await this.api
|
||||
.elements('@pageHeader', result => {
|
||||
if (result.value.length) {
|
||||
found = true
|
||||
}
|
||||
})
|
||||
if (found) {
|
||||
break
|
||||
}
|
||||
await client.refresh()
|
||||
}
|
||||
return this.waitForElementVisible('@pageHeader')
|
||||
},
|
||||
|
||||
getSettingsValue: async function (key) {
|
||||
let output
|
||||
switch (key) {
|
||||
case 'Language':
|
||||
await this.waitForElementVisible('@languageValue')
|
||||
.getText('@languageValue', (result) => {
|
||||
output = result.value
|
||||
})
|
||||
break
|
||||
default:
|
||||
throw new Error('failed to find the setting')
|
||||
}
|
||||
return output
|
||||
},
|
||||
changeSettings: async function (key, value) {
|
||||
const selectXpath = util.format(this.elements.languageSelect.selector, value)
|
||||
switch (key) {
|
||||
case 'Language':
|
||||
await this.waitForElementVisible('@languageValue')
|
||||
.click('@languageValue')
|
||||
.useXpath()
|
||||
.waitForElementVisible(this.elements.languageDropdown.selector)
|
||||
.click(selectXpath)
|
||||
.waitForElementNotVisible(this.elements.languageDropdown.selector)
|
||||
.useCss()
|
||||
break
|
||||
default:
|
||||
throw new Error('failed to find the setting')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
elements: {
|
||||
pageHeader: {
|
||||
selector: '.oc-page-title'
|
||||
},
|
||||
languageValue: {
|
||||
selector: "//label[.='Language']/..//button[starts-with(@id, 'single-choice-toggle')]",
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
languageDropdown: {
|
||||
selector: "//label[.='Language']/..//div[starts-with(@id, 'single-choice-drop')]",
|
||||
locateStrategy: 'xpath'
|
||||
},
|
||||
languageSelect: {
|
||||
selector: "//label[.='Language']/..//div[starts-with(@id, 'single-choice-drop')]//label[normalize-space()='%s']",
|
||||
locateStrategy: 'xpath'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
const assert = require('assert')
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
const { client } = require('nightwatch-api')
|
||||
const { Given, When, Then, After } = require('cucumber')
|
||||
const languageHelper = require('../helpers/language')
|
||||
|
||||
Given('the user browses to the settings page', function () {
|
||||
return client.page.settingsPage().navigateAndWaitTillLoaded()
|
||||
})
|
||||
|
||||
Then('the setting {string} should have value {string}', async function (setting, result) {
|
||||
const actual = await client.page.settingsPage().getSettingsValue(setting)
|
||||
assert.strictEqual(actual, result, 'The setting value doesnt matches to ' + result)
|
||||
})
|
||||
|
||||
When('the user changes the language to {string}', async function (value) {
|
||||
await client.page.settingsPage().changeSettings('Language', value)
|
||||
})
|
||||
|
||||
Then('the files menu should be listed in language {string}', async function (language) {
|
||||
const menu = await client.page.filesPageSettingsContext().getMenuList()
|
||||
const expected = languageHelper.getFilesMenuForLanguage(language)
|
||||
assert.deepEqual(menu, expected, 'the menu list were not same')
|
||||
})
|
||||
|
||||
Then('the account menu should be listed in language {string}', async function (language) {
|
||||
const menu = await client.page.filesPageSettingsContext().getUserMenu()
|
||||
const expected = languageHelper.getUserMenuForLanguage(language)
|
||||
assert.deepEqual(menu, expected, 'the menu list were not same')
|
||||
})
|
||||
|
||||
Then('the files header should be displayed in language {string}', async function (language) {
|
||||
const items = await client.page.filesPageSettingsContext().getFileHeaderItems()
|
||||
const expected = languageHelper.getFilesHeaderMenuForLanguage(language)
|
||||
assert.deepEqual(items, expected, 'the menu list were not same')
|
||||
})
|
||||
|
||||
After(async function () {
|
||||
const directory = path.join(client.globals.settings_store, 'values')
|
||||
try {
|
||||
console.log('Elements')
|
||||
fs.readdirSync(directory).map(element => {
|
||||
console.log(element)
|
||||
})
|
||||
} catch (err) {
|
||||
console.log('Error while reading the settings values from file system... ')
|
||||
}
|
||||
try {
|
||||
fs.emptyDirSync(directory)
|
||||
} catch (err) {
|
||||
console.log('Error while clearing settings values from file system')
|
||||
console.log('No settings may have been changed by the tests')
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
# OpenID Connect client registry.
|
||||
clients:
|
||||
- id: phoenix
|
||||
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:
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"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": "phoenix",
|
||||
"response_type": "code",
|
||||
"scope": "openid profile email"
|
||||
},
|
||||
"apps": [
|
||||
"files",
|
||||
"draw-io",
|
||||
"pdf-viewer",
|
||||
"markdown-editor",
|
||||
"media-viewer"
|
||||
],
|
||||
"external_apps": [
|
||||
{
|
||||
"id": "settings",
|
||||
"path": "https://ocis-server:9200/settings.js",
|
||||
"config": {
|
||||
"url": "https://ocis-server:9200"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$PHOENIX_PATH" ]
|
||||
then
|
||||
echo "PHOENIX_PATH env variable is not set, cannot find files for tests infrastructure"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$OCIS_SKELETON_DIR" ]
|
||||
then
|
||||
echo "OCIS_SKELETON_DIR env variable is not set, cannot find skeleton directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PHOENIX_CONFIG" ]
|
||||
then
|
||||
echo "PHOENIX_CONFIG env variable is not set, cannot find phoenix config file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Features path not given, exiting test run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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)
|
||||
printf "creating folder $testFolder for Test infrastructure setup\n\n"
|
||||
export TEST_INFRA_DIRECTORY=$testFolder
|
||||
fi
|
||||
|
||||
clean_up() {
|
||||
if $cleanup
|
||||
then
|
||||
if [ -d "$testFolder" ]; then
|
||||
printf "\n\n\n\nDeleting folder $testFolder Test infrastructure setup..."
|
||||
rm -rf "$testFolder"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
trap clean_up SIGHUP SIGINT SIGTERM EXIT
|
||||
|
||||
cp -r "$PHOENIX_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"
|
||||
|
||||
status=$?
|
||||
exit $status
|
||||
Reference in New Issue
Block a user