Change new name to address PR comment.

This commit is contained in:
Daniel Swärd
2023-04-05 12:26:56 +02:00
parent 4217d4218a
commit 8911ca2e98
9 changed files with 418 additions and 4 deletions

View File

@@ -2054,7 +2054,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
"IDM_CREATE_DEMO_USERS": True,
"IDM_ADMIN_PASSWORD": "admin", # override the random admin password from `ocis init`
"FRONTEND_SEARCH_MIN_LENGTH": "2",
"OCIS_STORAGE_USERS_ASYNC_UPLOADS": True,
"OCIS_ASYNC_UPLOADS": True,
"OCIS_EVENTS_ENABLE_TLS": False,
"OCIS_DECOMPOSEDFS_METADATA_BACKEND": "messagepack",
}
@@ -2092,7 +2092,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
"APP_PROVIDER_WOPI_INSECURE": "true",
"APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL": "http://wopiserver:8880",
"APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL": "https://ocis-server:9200",
"OCIS_STORAGE_USERS_ASYNC_UPLOADS": True,
"OCIS_ASYNC_UPLOADS": True,
"OCIS_EVENTS_ENABLE_TLS": False,
"OCIS_DECOMPOSEDFS_METADATA_BACKEND": "messagepack",
}

View File

@@ -4,7 +4,7 @@ package config
type Events struct {
Endpoint string `yaml:"endpoint" env:"OCIS_EVENTS_ENDPOINT;SEARCH_EVENTS_ENDPOINT" desc:"The address of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture."`
Cluster string `yaml:"cluster" env:"OCIS_EVENTS_CLUSTER;SEARCH_EVENTS_CLUSTER" desc:"The clusterID of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture. Mandatory when using NATS as event system."`
AsyncUploads bool `yaml:"async_uploads" env:"OCIS_STORAGE_USERS_ASYNC_UPLOADS;STORAGE_USERS_OCIS_ASYNC_UPLOADS;SEARCH_EVENTS_ASYNC_UPLOADS" desc:"Enable asynchronous file uploads." deprecationVersion:"3.0" removalVersion:"3.1" deprecationInfo:"STORAGE_USERS_OCIS_ASYNC_UPLOADS changing name for consistency" deprecationReplacement:"OCIS_STORAGE_USERS_ASYNC_UPLOADS"`
AsyncUploads bool `yaml:"async_uploads" env:"OCIS_ASYNC_UPLOADS;STORAGE_USERS_OCIS_ASYNC_UPLOADS;SEARCH_EVENTS_ASYNC_UPLOADS" desc:"Enable asynchronous file uploads." deprecationVersion:"3.0" removalVersion:"3.1" deprecationInfo:"STORAGE_USERS_OCIS_ASYNC_UPLOADS changing name for consistency" deprecationReplacement:"OCIS_ASYNC_UPLOADS"`
NumConsumers int `yaml:"num_consumers" env:"SEARCH_EVENTS_NUM_CONSUMERS" desc:"The amount of concurrent event consumers to start. Event consumers are used for searching files. Multiple consumers increase parallelisation, but will also increase CPU and memory demands. The default value is 0."`
DebounceDuration int `yaml:"debounce_duration" env:"SEARCH_EVENTS_REINDEX_DEBOUNCE_DURATION" desc:"The duration in milliseconds the reindex debouncer waits before triggering a reindex of a space that was modified."`

View File

@@ -0,0 +1,46 @@
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 and without skeleton files in the server:
| username |
| user1 |
| user2 |
And user "user1" has created folder "simple-folder" in the server
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 "English"
When the user browses to the files page
Then the files menu should be listed in language "English"
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
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
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
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
Then the files menu should be listed in language "Español"
When the user re-logs in as "user1" using the webUI
Then the files menu should be listed in language "English"

View File

@@ -0,0 +1,112 @@
const filesMenu = {
English: [
'Personal',
'Shares',
'Spaces',
'Deleted files'
],
Deutsch: [
'Persönlich',
'Geteilt',
'Spaces',
'Gelöschte Dateien'
],
Español: [
'Personal',
'Shares',
'Spaces',
'Archivos borrados'
],
Français: [
'Personal',
'Shares',
'Spaces',
'Fichiers supprimés'
]
}
const accountMenu = {
English: [
'U\nuser1\nuser1@example.org',
'Settings',
'Log out',
'Personal storage\n0 B used'
],
Deutsch: [
'U\nuser1\nuser1@example.org',
'Einstellungen',
'Abmelden',
'Persönlicher Speicherplatz\n0 B verwendet'
],
Español: [
'U\nuser1\nuser1@example.org',
'Configuración',
'Salir',
'Personal storage\n0 B used'
],
Français: [
'U\nuser1\nuser1@example.org',
'Settings',
'Se déconnecter',
'Personal storage\n0 B used'
]
}
const filesListHeaderMenu = {
English: [
'Name',
'Shares',
'Size',
'Tags',
'Modified',
'Actions'
],
Deutsch: [
'Name',
'Geteilt',
'Größe',
'Schlagwörter',
'Bearbeitet',
'Aktionen'
],
Español: [
'Nombre',
'Shares',
'Tamaño',
'Tags',
'Modificado',
'Acciones'
],
Français: [
'Nom',
'Shares',
'Taille',
'Étiquettes',
'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
}

View File

@@ -0,0 +1,82 @@
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 undefined
})
})
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)
})
return undefined
})
})
await this
.click('@userMenuBtn')
.waitForElementNotPresent('@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 undefined
})
})
return menu
}
},
elements: {
pageHeader: {
selector: '.oc-page-title'
},
fileSidebarNavItem: {
selector: '.oc-sidebar-nav-item'
},
openNavigationBtn: {
selector: '.oc-app-navigation-toggle'
},
userMenuBtn: {
selector: '#_userMenuButton'
},
userMenuItem: {
selector: '#account-info-container li'
},
userMenuContainer: {
selector: '#account-info-container'
},
fileTableHeaderItems: {
selector: '//*[@id="files-space-table"]//th[not(.//div)]',
locateStrategy: 'xpath'
}
}
}

View File

@@ -0,0 +1,82 @@
const { client } = require('nightwatch-api')
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
let elemfound = true
switch (key) {
case 'Language':
// Language value is set to empty at beginning
// In that case just return false
await this.api.element('@languageValue', result => {
if (result.status < 0) {
elemfound = false
}
})
if (!elemfound) {
output = false
break
}
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) {
switch (key) {
case 'Language':
await this
.waitForElementVisible('@languageInput')
.setValue('@languageInput', value + '\n')
break
default:
throw new Error('failed to find the setting')
}
}
},
elements: {
pageHeader: {
selector: '.oc-page-title'
},
languageValue: {
selector: "//label[.='Language']/..//span[@class='vs__selected']",
locateStrategy: 'xpath'
},
languageInput: {
selector: "//label[.='Language']/..//input",
locateStrategy: 'xpath'
}
}
}

View File

@@ -0,0 +1,40 @@
const assert = require('assert')
const { client } = require('nightwatch-api')
const { Given, When, Then } = require('@cucumber/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)
})
Then('the setting {string} should not have any value', async function (setting) {
const actual = await client.page.settingsPage().getSettingsValue(setting)
assert.strictEqual(actual, false, 'The setting value was expected not to be present but was')
})
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.deepStrictEqual(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.deepStrictEqual(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.deepStrictEqual(items, expected, 'the menu list were not same')
})

View File

@@ -0,0 +1,52 @@
#!/bin/bash
if [ -z "$WEB_PATH" ]
then
echo "WEB_PATH env variable is not set, cannot find files for tests infrastructure"
exit 1
fi
if [ -z "$WEB_UI_CONFIG" ]
then
echo "WEB_UI_CONFIG env variable is not set, cannot find web 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=$(mktemp -d -p .)
printf "creating folder $testFolder for Test infrastructure setup\n\n"
export TEST_INFRA_DIRECTORY=$(realpath $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 $(ls -d "$WEB_PATH"/tests/acceptance/* | grep -v 'node_modules') "$testFolder"
export SERVER_HOST=${SERVER_HOST:-https://localhost:9200}
export BACKEND_HOST=${BACKEND_HOST:-https://localhost:9200}
export TEST_TAGS=${TEST_TAGS:-"not @skip"}
pnpm run acceptance-tests "$1"
status=$?
exit $status

View File

@@ -114,7 +114,7 @@ type OCISDriver struct {
MaxAcquireLockCycles int `yaml:"max_acquire_lock_cycles" env:"STORAGE_USERS_OCIS_MAX_ACQUIRE_LOCK_CYCLES" desc:"When trying to lock files, ocis will try this amount of times to acquire the lock before failing. After each try it will wait for an increasing amount of time. Values of 0 or below will be ignored and the default value of 20 will be used."`
LockCycleDurationFactor int `yaml:"lock_cycle_duration_factor" env:"STORAGE_USERS_OCIS_LOCK_CYCLE_DURATION_FACTOR" desc:"When trying to lock files, ocis will multiply the cycle with this factor and use it as a millisecond timeout. Values of 0 or below will be ignored and the default value of 30 will be used."`
MaxConcurrency int `yaml:"max_concurrency" env:"STORAGE_USERS_OCIS_MAX_CONCURRENCY" desc:"Maximum number of concurrent go-routines. Higher values can potentially get work done faster but will also cause more load on the system. Values of 0 or below will be ignored and the default value of 100 will be used."`
AsyncUploads bool `yaml:"async_uploads" env:"OCIS_STORAGE_USERS_ASYNC_UPLOADS;STORAGE_USERS_OCIS_ASYNC_UPLOADS" desc:"Enable asynchronous file uploads." deprecationVersion:"3.0" removalVersion:"3.1" deprecationInfo:"STORAGE_USERS_OCIS_ASYNC_UPLOADS changing name for consistency" deprecationReplacement:"OCIS_STORAGE_USERS_ASYNC_UPLOADS"`
AsyncUploads bool `yaml:"async_uploads" env:"OCIS_ASYNC_UPLOADS;STORAGE_USERS_OCIS_ASYNC_UPLOADS" desc:"Enable asynchronous file uploads." deprecationVersion:"3.0" removalVersion:"3.1" deprecationInfo:"STORAGE_USERS_OCIS_ASYNC_UPLOADS changing name for consistency" deprecationReplacement:"OCIS_ASYNC_UPLOADS"`
MaxQuota uint64 `yaml:"max_quota" env:"OCIS_SPACES_MAX_QUOTA;STORAGE_USERS_OCIS_MAX_QUOTA" desc:"Set a global max quota for spaces in bytes. A value of 0 equals unlimited. If not using the global OCIS_SPACES_MAX_QUOTA, you must define the FRONTEND_MAX_QUOTA in the frontend service."`
}