diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-11-28 16:31:48 -0200 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-11-29 16:45:06 -0200 |
commit | 60c9020a11a88e07cb63ede737791bbeb8bbe6ec (patch) | |
tree | 431ee1ac00bc23b0af2b6649136a76826581cd3d | |
parent | 708225d9c41f13b714286a755c22e0f31d6ef4c7 (diff) |
Convert URL constants to behave's userdata
Behave 1.2.5 introduces user-specific configuration data, which can be
used to override default values.
See: https://github.com/pixelated/project-issues/issues/380
-rw-r--r-- | service/test/functional/features/environment.py | 14 | ||||
-rw-r--r-- | service/test/functional/features/steps/common.py | 8 | ||||
-rw-r--r-- | service/test/functional/features/steps/login.py | 3 |
3 files changed, 9 insertions, 16 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index 614741d7..c98609f8 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -26,10 +26,7 @@ from pixelated.application import UserAgentMode from pixelated.config.site import PixelatedSite from pixelated.resources.features_resource import FeaturesResource from test.support.integration import AppTestClient -from steps.common import ( - DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S, - HOMEPAGE_URL, - MULTI_USER_PORT) +from steps.common import DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S setup() @@ -46,6 +43,11 @@ def start_app_test_client(client, mode): def before_all(context): + userdata = context.config.userdata + context.homepage_url = userdata.get('homepage_url', 'http://localhost:8889') + context.multi_user_port = userdata.getint('multi_user_port', default=4568) + context.multi_user_url = userdata.get('multi_user_url', 'http://localhost:4568') + ensure_server() PixelatedSite.disable_csp_requests() client = AppTestClient() @@ -56,7 +58,7 @@ def before_all(context): multi_user_client = AppTestClient() start_app_test_client(multi_user_client, UserAgentMode(is_single_user=False)) - multi_user_client.listenTCP(port=MULTI_USER_PORT) + multi_user_client.listenTCP(port=context.multi_user_port) context.multi_user_client = multi_user_client @@ -69,7 +71,7 @@ def before_feature(context, feature): context.browser.set_window_size(1280, 1024) context.browser.implicitly_wait(DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S) context.browser.set_page_load_timeout(60) # wait for data - context.browser.get(HOMEPAGE_URL) + context.browser.get(context.homepage_url) def after_step(context, step): diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index 4ffe40ce..bbceb015 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -25,18 +25,10 @@ from selenium.webdriver.support.wait import WebDriverWait from test.support.integration import MailBuilder -LOADING = 'loading' - TIMEOUT_IN_S = 20 DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S = 10.0 -HOMEPAGE_URL = 'http://localhost:8889/' - -MULTI_USER_PORT = 4568 - -MULTI_USER_URL = 'http://localhost:%d/' % MULTI_USER_PORT - class ImplicitWait(object): def __init__(self, context, timeout=5.0): diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index 2a653030..d1840900 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -21,13 +21,12 @@ from selenium.webdriver.common.by import By from common import ( fill_by_css_selector, find_element_by_css_selector, - MULTI_USER_URL, wait_until_element_is_visible_by_locator) @when(u'I open the login page') def login_page(context): - context.browser.get(MULTI_USER_URL + '/login') + context.browser.get(context.multi_user_url + '/login') @when(u'I enter {username} and {password} as credentials') |