diff --git a/test/login_logout/test/behave/features/environment.py b/test/login_logout/test/behave/features/environment.py index c095f75f1d164f43b1bd055b2f384a1271f02382..592d579371a2c89bb43680bd0cbc43f2eba7f323 100644 --- a/test/login_logout/test/behave/features/environment.py +++ b/test/login_logout/test/behave/features/environment.py @@ -38,8 +38,8 @@ def before_tag(context, tag): values = dict() userdata = context.config.userdata values['url'] = userdata.get('url') - values['logout_url'] = userdata.get('logout_url') - values['userinfo_url'] = userdata.get('userinfo_url') + values['logout'] = userdata.get('logout_url') + values['userinfo'] = userdata.get('userinfo_url') values['username'] = userdata.get('username') values['username2'] = userdata.get('username2') values['password'] = userdata.get('password') diff --git a/test/login_logout/test/behave/features/login.feature b/test/login_logout/test/behave/features/login.feature index 5d59884be2354d5e9ad9cd69807edb931a812a3d..065324d317024c36a1fd8f650790a4c92276c44b 100644 --- a/test/login_logout/test/behave/features/login.feature +++ b/test/login_logout/test/behave/features/login.feature @@ -4,7 +4,7 @@ Feature: Test login-provder function I want to be able to login to an OAS App Scenario: Open the oAuth application - When I open the URL + When I open the URL "url" Then I wait on element "input#username" for 1000ms to be visible Scenario: Login with a valid user with access to application @@ -21,20 +21,20 @@ Scenario: Login with a valid user with access to application And I expect that element "body" contains the text "access_token" Scenario: Get OpenID Connect userdata for testuser - Given I open the userinfo URL + Given I open the url "userinfo" Then I expect that the "preferred_username" in the json output is "username" And I expect that the "email" in the json output is "email" And I expect that the "openappstack_roles" in the json output contains "role" And I expect that the "name" in the json output is "username" Scenario: Logout - Given I open the logout URL + Given I open the URL "logout" Then I wait on element "input#username" for 1000ms to be visible And I expect that element "input#password" is visible And I expect that element "input#submit" is visible Scenario: Login with a valid user without access to an application - Given I open the URL + Given I open the URL "url" Then I wait on element "input#username" for 1000ms to be visible And I expect that element "input#password" is visible And I expect that element "input#submit" is visible diff --git a/test/login_logout/test/behave/features/steps/login.py b/test/login_logout/test/behave/features/steps/login.py index c79ca9f21bf300f340b6824106ca03bb637b1f60..da9147476f61df9f6fd9fb2184fce1720e6cb82d 100644 --- a/test/login_logout/test/behave/features/steps/login.py +++ b/test/login_logout/test/behave/features/steps/login.py @@ -10,24 +10,13 @@ from behave_webdriver.steps import * def before_all(context): pass # login and save cookies here -@when(u'I open the URL') -@given(u'I open the URL') -def step_impl(context): - """Open oauth client URL.""" - context.behave_driver.get(context.oauth['url']) - - -@when(u'I open the logout URL') -@given(u'I open the logout URL') -def step_impl(context): - """Logout by visitng the logout url""" - context.behave_driver.get(context.oauth['logout_url']) - -@when(u'I open the userinfo URL') -@given(u'I open the userinfo URL') -def step_impl(context): - """Logout by visitng the logout url""" - context.behave_driver.get(context.oauth['userinfo_url']) +@when(u'I open the URL "{url}"') +@given(u'I open the URL "{url}"') +def step_impl(context, url): + """Open URL.""" + if url in context.oauth: + url = context.oauth[url] + context.behave_driver.get(url) @when(u'I enter the "{attribute}" in the inputfield "{element}"') def step_impl(context, attribute, element):