Skip to content
Snippets Groups Projects
Verified Commit 39c96a51 authored by Varac's avatar Varac
Browse files

Add nextcloud behave test

parent 1b940021
No related branches found
No related tags found
No related merge requests found
......@@ -5,3 +5,5 @@
apk --no-cache add git
git clone https://code.greenhost.net/openappstack/bootstrap.git
cd bootstrap/test/behave
behave -D nextcloud.url=https://files.ci-20410.ci.openappstack.net \
-D nextcloud.admin.password=…
......@@ -22,6 +22,16 @@ def save_screenshot(context, step):
def before_all(context):
"""Run at the very beginning."""
userdata = context.config.userdata
context.nextcloud = {}
context.nextcloud['url'] = userdata.get('nextcloud.url')
context.nextcloud['username'] = \
userdata.get('nextcloud.username', 'admin')
context.nextcloud['password'] = \
userdata.get('nextcloud.password')
assert context.nextcloud['url'], 'Nextcloud url variable missing in userdata!'
assert context.nextcloud['username'], 'Nextcloud username variable missing in userdata!'
assert context.nextcloud['password'], 'Nextcloud password variable missing in userdata!'
headless = userdata.get('headless', 'False')
......
Feature: Test nextcloud admin login
As an OAS admin
I want to be able to login to nextcloud as the user admin
Scenario: Open nextcloud
When I open the nextcloud URL
Then I wait on element "input#user" for 25000ms to be visible
And I expect that element "input#user" is visible
Scenario: Login to nextcloud
Given the element "input#user" is visible
When I enter the "nextcloud" "username" in the inputfield "input#user"
When I enter the "nextcloud" "password" in the inputfield "input#password"
And I click on the button "input#submit"
Then I expect that the title is "Files - Nextcloud"
......@@ -3,13 +3,20 @@
from behave import given, when
from behave_webdriver.steps import *
@when(u'I open the nextcloud URL')
@given(u'I open the nextcloud URL')
def step_impl(context):
"""Login to nextcloud."""
context.behave_driver.get(context.nextcloud['url'])
@when(u'I enter the "{section}" "{user}" "{cred_type}" in the inputfield "{element}"')
def step_impl(context, section, user, cred_type, element):
@when(u'I enter the "{section}" "{cred_type}" in the inputfield "{element}"')
def step_impl(context, section, cred_type, element):
"""Enter username/password into login inputfields."""
elem = context.behave_driver.get_element(element)
elem.clear()
context_section = getattr(context, section)
value = context_section[user][cred_type]
print(context_section)
value = context_section[cred_type]
elem.send_keys(value)
......@@ -268,9 +268,19 @@ def write_behave_config(settings=None):
if settings is None:
with open(SETTINGS_FILE) as stream:
settings = yaml.safe_load(stream)
with open('./secrets/nextcloud_admin_password', 'r') as stream:
nextcloud_admin_password = yaml.safe_load(stream)
behave_config = configparser.ConfigParser()
behave_config['behave'] = {'stop': True}
behave_config['behave.userdata'] = {}
behave_config['behave.userdata']['nextcloud.url'] = \
'https://files.{}'.format(settings['domain'])
behave_config['behave.userdata']['nextcloud.username'] = 'admin'
behave_config['behave.userdata']['nextcloud.password'] = \
nextcloud_admin_password
with open('./behave/behave.ini', 'w') as configfile:
behave_config.write(configfile)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment