Merge pull request #667 from owncloud/enable-ui-tests

[WIP] Enable accounts ui tests
This commit is contained in:
Michael Barz
2020-10-09 17:12:25 +02:00
committed by GitHub
6 changed files with 179 additions and 14 deletions

View File

@@ -90,7 +90,7 @@ def getDependsOnAllTestPipelines(ctx):
'upload-coverage',
'localApiTests-owncloud-storage',
'localApiTests-ocis-storage',
] + getCoreApiTestPipelineNames() + getUITestSuiteNames()
] + getCoreApiTestPipelineNames() + getUITestSuiteNames() + ['accountsUITests']
return dependencies
@@ -142,6 +142,7 @@ def testPipelines(ctx):
pipelines.append(coreApiTests(ctx, config['apiTests']['coreBranch'], config['apiTests']['coreCommit'], runPart, config['apiTests']['numberOfParts'], 'ocis'))
pipelines += uiTests(ctx, config['uiTests']['phoenixBranch'], config['uiTests']['phoenixCommit'])
pipelines.append(accountsUITests(ctx, config['uiTests']['phoenixBranch'], config['uiTests']['phoenixCommit'], 'owncloud'))
return pipelines
def testing(ctx, module):
@@ -508,6 +509,164 @@ def uiTestPipeline(suiteName, phoenixBranch = 'master', phoenixCommit = '', stor
},
}
def accountsUITests(ctx, phoenixBranch, phoenixCommitId, storage):
return {
'kind': 'pipeline',
'type': 'docker',
'name': 'accountsUITests',
'platform': {
'os': 'linux',
'arch': 'amd64',
},
'steps': [
{
'name': 'build-ocis',
'image': 'webhippie/golang:1.13',
'pull': 'always',
'commands': [
'cd ocis',
'make build',
'mkdir -p /srv/app/ocis/bin',
'cp bin/ocis /srv/app/ocis/bin',
],
'volumes': [
{
'name': 'gopath',
'path': '/srv/app'
},
]
},
{
'name': 'ocis-server',
'image': 'webhippie/golang:1.13',
'pull': 'always',
'detach': True,
'environment' : {
#'OCIS_LOG_LEVEL': 'debug',
'STORAGE_STORAGE_HOME_DRIVER': '%s' % (storage),
'STORAGE_STORAGE_HOME_DATA_DRIVER': '%s' % (storage),
'STORAGE_STORAGE_OC_DRIVER': '%s' % (storage),
'STORAGE_STORAGE_OC_DATA_DRIVER': '%s' % (storage),
'STORAGE_STORAGE_HOME_DATA_TEMP_FOLDER': '/srv/app/tmp/',
'STORAGE_STORAGE_OCIS_ROOT': '/srv/app/tmp/ocis/storage/users',
'STORAGE_STORAGE_LOCAL_ROOT': '/srv/app/tmp/ocis/reva/root',
'STORAGE_STORAGE_OWNCLOUD_DATADIR': '/srv/app/tmp/ocis/owncloud/data',
'STORAGE_STORAGE_OC_DATA_TEMP_FOLDER': '/srv/app/tmp/',
'STORAGE_STORAGE_OWNCLOUD_REDIS_ADDR': 'redis:6379',
'STORAGE_OIDC_ISSUER': 'https://ocis-server:9200',
'STORAGE_LDAP_IDP': 'https://ocis-server:9200',
'PROXY_OIDC_ISSUER': 'https://ocis-server:9200',
'STORAGE_STORAGE_OC_DATA_SERVER_URL': 'http://ocis-server:9164/data',
'STORAGE_DATAGATEWAY_URL': 'https://ocis-server:9200/data',
'STORAGE_FRONTEND_URL': 'https://ocis-server:9200',
'PHOENIX_WEB_CONFIG': '/drone/src/accounts/ui/tests/config/drone/ocis-config.json',
'KONNECTD_IDENTIFIER_REGISTRATION_CONF': '/drone/src/accounts/ui/tests/config/drone/identifier-registration.yml',
'KONNECTD_ISS': 'https://ocis-server:9200',
'ACCOUNTS_STORAGE_DISK_PATH': '/srv/app/tmp/ocis-accounts', # Temporary workaround, don't use metadata storage
},
'commands': [
'mkdir -p /srv/app/tmp/reva',
# First run settings service because accounts need it to register the settings bundles
'/srv/app/ocis/bin/ocis settings &',
# Wait for the settings service to start
"while [[ \"$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9190)\" != \"404\" ]]; do sleep 2; done",
# Now start the accounts service
'/srv/app/ocis/bin/ocis accounts &',
# Wait for the accounts service to start
"while [[ \"$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9181)\" != \"404\" ]]; do sleep 2; done",
# Now run all the ocis services except the accounts and settings because they are already running
'/srv/app/ocis/bin/ocis server',
],
'volumes': [
{
'name': 'gopath',
'path': '/srv/app'
},
]
},
{
'name': 'WebUIAcceptanceTests',
'image': 'owncloudci/nodejs:10',
'pull': 'always',
'environment': {
'SERVER_HOST': 'https://ocis-server:9200',
'BACKEND_HOST': 'https://ocis-server:9200',
'RUN_ON_OCIS': 'true',
'OCIS_REVA_DATA_ROOT': '/srv/app/tmp/ocis/owncloud',
'OCIS_SKELETON_DIR': '/srv/app/testing/data/webUISkeleton',
'PHOENIX_CONFIG': '/drone/src/accounts/ui/tests/config/drone/ocis-config.json',
'TEST_TAGS': 'not @skipOnOCIS and not @skip',
'LOCAL_UPLOAD_DIR': '/uploads',
'PHOENIX_PATH': '/srv/app/phoenix',
'FEATURE_PATH': '/drone/src/accounts/ui/tests/acceptance/features',
'NODE_TLS_REJECT_UNAUTHORIZED': '0'
},
'commands': [
'git clone --depth=1 https://github.com/owncloud/testing.git /srv/app/testing',
'git clone -b %s --single-branch https://github.com/owncloud/phoenix /srv/app/phoenix' % (phoenixBranch),
'cd /srv/app/phoenix',
'git checkout %s' % (phoenixCommitId),
'cp -r /srv/app/phoenix/tests/acceptance/filesForUpload/* /uploads',
'yarn install-all',
'cd /drone/src/accounts',
'yarn install --all',
'make test-acceptance-webui'
],
'volumes': [
{
'name': 'gopath',
'path': '/srv/app',
},
{
'name': 'uploads',
'path': '/uploads'
}
],
},
],
'services': [
{
'name': 'redis',
'image': 'webhippie/redis',
'pull': 'always',
'environment': {
'REDIS_DATABASES': 1
},
},
{
'name': 'selenium',
'image': 'selenium/standalone-chrome-debug:3.141.59-20200326',
'pull': 'always',
'volumes': [
{
'name': 'uploads',
'path': '/uploads'
}
],
},
],
'volumes': [
{
'name': 'gopath',
'temp': {},
},
{
'name': 'uploads',
'temp': {}
}
],
'trigger': {
'ref': [
'refs/tags/v*',
'refs/pull/**',
],
},
}
def docker(ctx, arch):
return {
'kind': 'pipeline',

View File

File diff suppressed because one or more lines are too long

View File

@@ -17,12 +17,12 @@
</oc-grid>
</template>
<template v-else-if="hasFailed">
<oc-alert variation="warning" no-close class="oc-m">
<oc-alert variation="warning" no-close class="oc-m" id="accounts-list-loading-failed">
<oc-icon name="warning" variation="warning" class="uk-float-left oc-mr-s" />
<translate>You don't have permissions to manage accounts.</translate>
</oc-alert>
</template>
<oc-loader v-else />
<oc-loader id="accounts-list-loader" v-else />
</div>
</div>
</template>

View File

@@ -25,14 +25,20 @@ module.exports = {
},
selectRole: function (username, role) {
const roleTrigger =
util.format(this.elements.rowByUsername.selector, username) +
this.elements.rolesDropdownTrigger.selector
const roleSelector =
util.format(this.elements.rowByUsername.selector, username) +
util.format(this.elements.roleInRolesDropdown.selector, role)
return this
.click('@rolesDropdownTrigger')
.initAjaxCounters()
.waitForElementVisible(roleTrigger)
.click(roleTrigger)
.waitForElementVisible(roleSelector)
.click(roleSelector)
.waitForOutstandingAjaxCalls()
},
checkUsersRole: function (username, role) {
@@ -114,7 +120,7 @@ module.exports = {
locateStrategy: 'xpath'
},
roleInRolesDropdown: {
selector: '//label[contains(@class, "accounts-roles-dropdown-role") and normalize-space()="%s"]',
selector: '//label[contains(@class, "accounts-roles-dropdown-role")]/span[normalize-space()="%s"]',
locateStrategy: 'xpath'
},
rolesDropdownTrigger: {
@@ -122,11 +128,13 @@ module.exports = {
locateStrategy: 'xpath'
},
loadingAccountsList: {
selector: '//div[contains(@class, "oc-loader")]',
locateStrategy: 'xpath'
selector: '#accounts-list-loader'
},
loadingAccountsListFailed: {
selector: '#accounts-list-loading-failed'
},
rowCheckbox: {
selector: '//input[@class="oc-checkbox"]',
selector: '//input[contains(@class, "oc-checkbox")]',
locateStrategy: 'xpath'
},
batchActionDisable: {

View File

@@ -33,8 +33,7 @@ Then('the displayed role of user {string} should be {string} on the WebUI', func
Then('the user should not be able to see the accounts list on the WebUI', async function () {
return client.page.accountsPage()
.waitForAjaxCallsToStartAndFinish()
.waitForElementVisible('@loadingAccountsList')
.waitForElementNotPresent('@accountsListTable')
.waitForElementVisible('@loadingAccountsListFailed')
})
When('the user disables user/users {string} using the WebUI', function (usernames) {

View File

@@ -12,7 +12,6 @@
"apps": [
"files",
"draw-io",
"pdf-viewer",
"markdown-editor",
"media-viewer"
],