summaryrefslogtreecommitdiff
path: root/service/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'service/test/functional')
-rw-r--r--service/test/functional/features/environment.py43
-rw-r--r--service/test/functional/features/steps/attachments.py2
-rw-r--r--service/test/functional/features/steps/common.py2
-rw-r--r--service/test/functional/features/steps/data_setup.py4
4 files changed, 31 insertions, 20 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index b03c506e..981fd33e 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -40,34 +40,45 @@ def before_all(context):
context.browser = webdriver.PhantomJS()
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.set_page_load_timeout(60)
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')
+ context.host = userdata.get('host', 'http://localhost')
+ if 'localhost' in context.host:
+ _mock_user_agent(context)
+
+
+def _mock_user_agent(context):
ensure_server()
PixelatedSite.disable_csp_requests()
- client = AppTestClient()
- start_app_test_client(client, UserAgentMode(is_single_user=True))
- client.listenTCP(port=8889)
FeaturesResource.DISABLED_FEATURES.append('autoRefresh')
- context.client = client
- multi_user_client = AppTestClient()
- start_app_test_client(multi_user_client, UserAgentMode(is_single_user=False))
- multi_user_client.listenTCP(port=context.multi_user_port)
- context.multi_user_client = multi_user_client
+ context.single_user_url = _define_url(8889)
+ context.single_user_client = _start_user_agent(8889, is_single_user=True)
+
+ context.multi_user_url = _define_url(4568)
+ context.multi_user_client = _start_user_agent(4568, is_single_user=False)
+
+
+def _start_user_agent(port, is_single_user):
+ client = AppTestClient()
+ start_app_test_client(client, UserAgentMode(is_single_user=is_single_user))
+ client.listenTCP(port=port)
+ return client
+
+
+def _define_url(port):
+ return 'http://localhost:{port}'.format(port=port)
def after_all(context):
context.browser.quit()
- context.client.stop()
+ context.single_user_client.stop()
def before_feature(context, feature):
- context.browser.get(context.homepage_url)
+ context.browser.get(context.single_user_url)
def after_feature(context, feature):
@@ -103,8 +114,8 @@ def _slugify(string_):
def cleanup_all_mails(context):
@defer.inlineCallbacks
def _delete_all_mails():
- mails = yield context.client.mail_store.all_mails()
+ mails = yield context.single_user_client.mail_store.all_mails()
for mail in mails:
- yield context.client.mail_store.delete_mail(mail.ident)
+ yield context.single_user_client.mail_store.delete_mail(mail.ident)
return _delete_all_mails()
diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py
index 7a80c34f..43948016 100644
--- a/service/test/functional/features/steps/attachments.py
+++ b/service/test/functional/features/steps/attachments.py
@@ -51,7 +51,7 @@ def build_mail_with_attachment(subject):
@wait_for(timeout=10.0)
def load_mail_into_soledad(context, mail):
- return context.client.mail_store.add_mail('INBOX', mail.as_string())
+ return context.single_user_client.mail_store.add_mail('INBOX', mail.as_string())
@then(u'I see the mail has an attachment')
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index bbceb015..c3916313 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -188,4 +188,4 @@ def get_console_log(context):
def create_email(context):
input_mail = MailBuilder().build_input_mail()
- context.client.add_mail_to_inbox(input_mail)
+ context.single_user_client.add_mail_to_inbox(input_mail)
diff --git a/service/test/functional/features/steps/data_setup.py b/service/test/functional/features/steps/data_setup.py
index 167acf9a..3d28baed 100644
--- a/service/test/functional/features/steps/data_setup.py
+++ b/service/test/functional/features/steps/data_setup.py
@@ -26,8 +26,8 @@ def add_mail_impl(context):
input_mail = MailBuilder().with_subject(subject).build_input_mail()
- context.client.add_mail_to_inbox(input_mail)
- wait_for_condition(context, lambda _: context.client.search_engine.search(subject)[1] > 0, poll_frequency=0.1)
+ context.single_user_client.add_mail_to_inbox(input_mail)
+ wait_for_condition(context, lambda _: context.single_user_client.search_engine.search(subject)[1] > 0, poll_frequency=0.1)
context.last_subject = subject