From 1cf7eb07bd65212629fed63d7464d2e3fb80fa30 Mon Sep 17 00:00:00 2001 From: Maarten de Waard <maarten@greenhost.nl> Date: Wed, 2 Oct 2019 17:51:59 +0200 Subject: [PATCH] fix both the behave return code and the failing tests --- openappstack/__main__.py | 3 ++- openappstack/cluster.py | 1 - test/behave/features/nextcloud.feature | 10 ++++++---- test/behave/features/steps/login.py | 14 +++++++------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/openappstack/__main__.py b/openappstack/__main__.py index 64b7638d9..c9c6f32f3 100755 --- a/openappstack/__main__.py +++ b/openappstack/__main__.py @@ -296,11 +296,12 @@ def test(clus, args): log.info(command) command.append('-t {tag}'.format(tag=tag)) log.info('Running behave command %s', command) - behave_main(command) + return_code = behave_main(command) # Remove behave.ini so we don't leave secrets hanging around. os.remove(behave_ini) + sys.exit(return_code) def create_domain_records(domain, droplet_ip, subdomain=None): """ diff --git a/openappstack/cluster.py b/openappstack/cluster.py index 143c6e777..0b6b91dc1 100644 --- a/openappstack/cluster.py +++ b/openappstack/cluster.py @@ -199,7 +199,6 @@ class Cluster: behave_config['behave.userdata']['nextcloud.username'] = 'admin' behave_config['behave.userdata']['nextcloud.password'] = \ nextcloud_admin_password - behave_config['behave.userdata']['onlyoffice.url'] = \ 'https://office.{}/welcome'.format(self.domain) diff --git a/test/behave/features/nextcloud.feature b/test/behave/features/nextcloud.feature index 5fb9e6e43..2bdf762fa 100644 --- a/test/behave/features/nextcloud.feature +++ b/test/behave/features/nextcloud.feature @@ -4,6 +4,11 @@ Feature: Test nextcloud admin login I want to be able to login to nextcloud as the user admin And I want to be able to open a document in OnlyOffice +Scenario: Test OnlyOffice welcome screen + When I open the onlyoffice URL + Then I expect that element "#status-ok-icon" is visible + + Scenario: Open nextcloud When I open the nextcloud URL Then I wait on element "input#user" for 25000ms to be visible @@ -22,10 +27,7 @@ Scenario: Login to nextcloud Scenario: Close welcome to nextcloud modal When I close the nextcloud welcome wizard if it exists Then I wait on element "#firstrunwizard" for 1000ms to not exist - -Scenario: Test OnlyOffice welcome screen - When I open the onlyoffice URL - Then I expect that element "#status-ok-icon" is visible + And I wait on element ".actions a.button.new" for 5000ms to be visible Scenario: Create a new document in OnlyOffice When I click on the element ".actions a.button.new" diff --git a/test/behave/features/steps/login.py b/test/behave/features/steps/login.py index c662039c1..b45ad5b90 100644 --- a/test/behave/features/steps/login.py +++ b/test/behave/features/steps/login.py @@ -10,6 +10,13 @@ from behave_webdriver.steps import * def before_all(context): pass # login and save cookies here +@when(u'I open the onlyoffice URL') +@given(u'I open the onlyoffice URL') +def step_impl(context): + """Open onlyoffice URL.""" + print(context.nextcloud) + context.behave_driver.get(context.config.userdata.get('onlyoffice.url')) + @when(u'I open the nextcloud URL') @given(u'I open the nextcloud URL') def step_impl(context): @@ -23,13 +30,6 @@ def step_impl(context): """Open grafana URL.""" context.behave_driver.get(context.grafana['url']) -@when(u'I open the onlyoffice URL') -@given(u'I open the onlyoffice URL') -def step_impl(context): - """Open onlyoffice URL.""" - context.behave_driver.get(context.onlyoffice['url']) - - @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.""" -- GitLab