Add tests infrastructure and tests for ocis-accounts

This commit is contained in:
jasson99
2020-07-03 15:09:19 +05:45
parent b2d891c751
commit f924285cf8
12 changed files with 2021 additions and 50 deletions
@@ -0,0 +1,13 @@
Feature: Accounts
Scenario: list accounts
Given user "user1" has been created with default attributes
And user "user1" has logged in using the webUI
When the user browses to the accounts page
Then user "einstein" should be displayed in the accounts list on the WebUI
And user "konnectd" should be displayed in the accounts list on the WebUI
And user "marie" should be displayed in the accounts list on the WebUI
And user "reva" should be displayed in the accounts list on the WebUI
And user "richard" should be displayed in the accounts list on the WebUI
@@ -0,0 +1,41 @@
const util = require('util')
module.exports = {
url: function () {
return this.api.launchUrl + '/#/accounts'
},
commands: {
navigateAndWaitTillLoaded: async function () {
const url = this.url()
return this.navigate(url).waitForElementVisible('@accountsLabel')
},
accountsList: function () {
return this.waitForElementVisible('@accountsListTable')
},
isUserListed: async function (username) {
let user
const usernameInTable = util.format(this.elements.userInAccountsList.selector, username)
await this.useXpath().waitForElementVisible(usernameInTable)
.getText(usernameInTable, (result) => {
user = result
})
return user.value
}
},
elements: {
accountsLabel: {
selector: "//h1[normalize-space(.)='Accounts']",
locateStrategy: 'xpath'
},
accountsListTable: {
selector: "//table[@class='uk-table uk-table-middle uk-table-divider']",
locateStrategy: 'xpath'
},
userInAccountsList: {
selector: '//table//td[text()="%s"]',
locateStrategy: 'xpath'
}
}
}
@@ -0,0 +1,13 @@
const assert = require('assert')
const { client } = require('nightwatch-api')
const { When, Then } = require('cucumber')
When('the user browses to the accounts page', function () {
return client.page.accountsPage().navigateAndWaitTillLoaded()
})
Then('user {string} should be displayed in the accounts list on the WebUI', async function (username) {
await client.page.accountsPage().accountsList(username)
const userListed = await client.page.accountsPage().isUserListed(username)
return assert.strictEqual(userListed, username)
})
@@ -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:
+28
View File
@@ -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": "accounts",
"path": "https://ocis-server:9200/accounts.js",
"config": {
"url": "https://ocis-server:9200"
}
}
]
}
+73
View File
@@ -0,0 +1,73 @@
{
"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"
},
{
"endpoint": "/remote.php/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/dav/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/data/",
"backend": "http://localhost:9164"
},
{
"endpoint": "/webdav/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/status.php",
"backend": "http://localhost:9140"
},
{
"endpoint": "/index.php/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/api/v0/greet",
"backend": "http://hello:9105"
},
{
"endpoint": "/api/v0/accounts",
"backend": "http://localhost:9181"
},
{
"endpoint": "/accounts.js",
"backend": "http://localhost:9181"
}
]
}
]
}
+59
View File
@@ -0,0 +1,59 @@
#!/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=$(< /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 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"
status=$?
exit $status