From a55252190f83a678e3b74c841e24512e78041b5a Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Fri, 25 Nov 2016 11:59:40 -0200 Subject: Changes print from command to function See: https://github.com/pixelated/project-issues/issues/380 --- service/test/functional/features/steps/common.py | 2 +- service/test/functional/features/steps/mail_list.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index ccad842c..a7800ee8 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -186,7 +186,7 @@ def get_console_log(context): for entry in logs: msg = entry['message'] if not (msg.startswith('x off') or msg.startswith('<- on')): - print entry['message'] + print(entry['message']) def create_email(context): diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py index 82faa7af..8ac9cb6b 100644 --- a/service/test/functional/features/steps/mail_list.py +++ b/service/test/functional/features/steps/mail_list.py @@ -18,7 +18,7 @@ from selenium.common.exceptions import NoSuchElementException def find_current_mail(context): - print 'searching for mail [%s]' % context.current_mail_id + print('searching for mail [%s]' % context.current_mail_id) return find_element_by_id(context, '%s' % context.current_mail_id) -- cgit v1.2.3 From 4fd50e650bbfa474f77daf63a44e08b6cb039679 Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Fri, 25 Nov 2016 13:55:02 -0200 Subject: Improves imports See: https://github.com/pixelated/project-issues/issues/380 --- .../test/functional/features/steps/attachments.py | 21 +++++++++++++-------- service/test/functional/features/steps/common.py | 9 +++++++-- service/test/functional/features/steps/compose.py | 7 ++++++- service/test/functional/features/steps/mail_list.py | 16 ++++++++++++++-- service/test/functional/features/steps/mail_view.py | 12 +++++++++++- service/test/functional/features/steps/search.py | 6 ++++-- service/test/functional/features/steps/tag_list.py | 10 +++++++++- 7 files changed, 64 insertions(+), 17 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index 28d88343..90812d2c 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -13,16 +13,21 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from email.mime.application import MIMEApplication -from time import sleep -from leap.bitmask.mail.mail import Message -from common import * -from test.support.integration import MailBuilder -from behave import given -from crochet import wait_for -from uuid import uuid4 from email.MIMEMultipart import MIMEMultipart +from email.mime.application import MIMEApplication from email.mime.text import MIMEText +from uuid import uuid4 + +from behave import given, then, when +from crochet import wait_for +from selenium.webdriver.common.by import By + +from common import ( + fill_by_css_selector, + find_element_by_css_selector, + find_elements_by_css_selector, + page_has_css, + wait_until_element_is_visible_by_locator) @given(u'I have a mail with an attachment in my inbox') diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index a7800ee8..4ffe40ce 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -13,11 +13,16 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . + +import time + +from selenium.common.exceptions import ( + StaleElementReferenceException, + TimeoutException) from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait -from selenium.common.exceptions import TimeoutException, StaleElementReferenceException -import time + from test.support.integration import MailBuilder LOADING = 'loading' diff --git a/service/test/functional/features/steps/compose.py b/service/test/functional/features/steps/compose.py index 67b1bd51..c72b25e2 100644 --- a/service/test/functional/features/steps/compose.py +++ b/service/test/functional/features/steps/compose.py @@ -16,7 +16,12 @@ from time import sleep from behave import when -from common import * +from selenium.webdriver.common.by import By + +from common import ( + fill_by_css_selector, + wait_until_element_is_visible_by_locator, + find_element_by_css_selector) @when('I compose a message with') diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py index 8ac9cb6b..7c880e8f 100644 --- a/service/test/functional/features/steps/mail_list.py +++ b/service/test/functional/features/steps/mail_list.py @@ -13,8 +13,20 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from common import * -from selenium.common.exceptions import NoSuchElementException + +from behave import when, then, given +from selenium.common.exceptions import TimeoutException +from selenium.webdriver.common.by import By + +from common import ( + ImplicitWait, + execute_ignoring_staleness, + find_element_by_id, + mail_list_with_subject_exists, + wait_for_condition, + wait_for_loading_to_finish, + wait_until_element_is_visible_by_locator, + wait_until_elements_are_visible_by_locator) def find_current_mail(context): diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py index 2db6dfc5..88ee5c5a 100644 --- a/service/test/functional/features/steps/mail_view.py +++ b/service/test/functional/features/steps/mail_view.py @@ -13,8 +13,18 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . + +from behave import then, when from selenium.webdriver.common.keys import Keys -from common import * +from selenium.webdriver.common.by import By + +from common import ( + click_button, + find_element_by_css_selector, + find_elements_by_css_selector, + reply_subject, + wait_until_button_is_visible, + wait_until_element_is_visible_by_locator) @then('I see that the subject reads \'{subject}\'') diff --git a/service/test/functional/features/steps/search.py b/service/test/functional/features/steps/search.py index 879e834d..5a6d2d1c 100644 --- a/service/test/functional/features/steps/search.py +++ b/service/test/functional/features/steps/search.py @@ -13,10 +13,12 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from selenium.webdriver import ActionChains +from behave import when, then +from selenium.webdriver import ActionChains from selenium.webdriver.common.keys import Keys -from common import * + +from common import find_element_by_css_selector, find_elements_by_css_selector @when('I search for a mail with the words "{search_term}"') diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index 8550a886..b9adea0a 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -13,7 +13,15 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -from common import * +from behave import when +from selenium.common.exceptions import TimeoutException +from selenium.webdriver.common.by import By + +from common import ( + find_element_by_class_name, + find_element_by_id, + wait_for_user_alert_to_disapear, + wait_until_element_is_visible_by_locator) def click_first_element_with_class(context, classname): -- cgit v1.2.3 From fcd6cdc105da48d36aaffb2d7fec5653b773d597 Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Fri, 25 Nov 2016 13:56:56 -0200 Subject: Removes unused variable See: https://github.com/pixelated/project-issues/issues/380 --- service/test/functional/features/steps/attachments.py | 1 - 1 file changed, 1 deletion(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index 90812d2c..7a80c34f 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -112,6 +112,5 @@ def click_remove_icon(context): @then(u'I should not see it attached') def assert_attachment_removed(context): - attachments_list_ul = find_elements_by_css_selector(context, '#attachment-list-item') attachments_list_li = context.browser.find_elements(By.CSS_SELECTOR, '#attachment-list-item li a') assert len(attachments_list_li) == 0 -- cgit v1.2.3 From 60c9020a11a88e07cb63ede737791bbeb8bbe6ec Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Mon, 28 Nov 2016 16:31:48 -0200 Subject: 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 --- service/test/functional/features/steps/common.py | 8 -------- service/test/functional/features/steps/login.py | 3 +-- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'service/test/functional/features/steps') 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') -- cgit v1.2.3 From cb95c9442032fc04f4530f2690f22611445c7565 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Tue, 29 Nov 2016 20:01:53 -0200 Subject: Improve atomicity of checkbox operations We were getting too much errors like "Element is no longer attached to the DOM". See: https://github.com/pixelated/project-issues/issues/381 --- .../test/functional/features/steps/mail_list.py | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py index 7c880e8f..23724bf2 100644 --- a/service/test/functional/features/steps/mail_list.py +++ b/service/test/functional/features/steps/mail_list.py @@ -22,6 +22,7 @@ from common import ( ImplicitWait, execute_ignoring_staleness, find_element_by_id, + find_element_by_css_selector, mail_list_with_subject_exists, wait_for_condition, wait_for_loading_to_finish, @@ -90,31 +91,28 @@ def impl(context): @given('I have mails') @then(u'I have mails') def impl(context): - emails = wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, '.mail-list-entry__item')) + emails = wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, '.mail-list-entry')) assert len(emails) > 0 @when('I mark the first unread email as read') def impl(context): - emails = wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, '.mail-list-entry')) + mail_id = find_element_by_css_selector( + context, '.mail-list-entry:not(.status-read)').get_attribute('id') + + find_element_by_css_selector(context, '#%s input' % mail_id).click() + find_element_by_id(context, 'mark-selected-as-read').click() - for email in emails: - if 'status-read' not in email.get_attribute('class'): - context.current_mail_id = email.get_attribute('id') # we need to get the mail id before manipulating the page - email.find_element_by_tag_name('input').click() - find_element_by_id(context, 'mark-selected-as-read').click() - break - wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, '#%s.status-read' % context.current_mail_id)) + find_element_by_css_selector(context, '#%s.status-read' % mail_id) @when('I delete the email') def impl(context): - def last_email(): - return wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '.mail-list-entry')) - mail = last_email() - context.current_mail_id = mail.get_attribute('id') - mail.find_element_by_tag_name('input').click() + mail_id = find_element_by_css_selector(context, '.mail-list-entry').get_attribute('id') + + find_element_by_css_selector(context, '#%s input' % mail_id).click() find_element_by_id(context, 'delete-selected').click() + _wait_for_mail_list_to_be_empty(context) -- cgit v1.2.3 From ab17f819d5b724b45927e559de7c5dc796cb7fa6 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 14:17:37 -0200 Subject: Extract user agent initialization Now the initialization and mocking of the user agent run only when using localhost. See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/attachments.py | 2 +- service/test/functional/features/steps/common.py | 2 +- service/test/functional/features/steps/data_setup.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'service/test/functional/features/steps') 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 -- cgit v1.2.3 From b6f60fd007efc84ef7cc2b63988448a61bbeb8d2 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 17:36:39 -0200 Subject: Add sign up smoke test See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/login.py | 2 +- service/test/functional/features/steps/signup.py | 45 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 service/test/functional/features/steps/signup.py (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index d1840900..a8db6f49 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -26,7 +26,7 @@ from common import ( @when(u'I open the login page') def login_page(context): - context.browser.get(context.multi_user_url + '/login') + context.browser.get(context.login_url) @when(u'I enter {username} and {password} as credentials') diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py new file mode 100644 index 00000000..1252017c --- /dev/null +++ b/service/test/functional/features/steps/signup.py @@ -0,0 +1,45 @@ +# +# Copyright (c) 2016 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see . + +import uuid +from behave import given, then, when + +from common import ( + fill_by_css_selector, + find_element_by_css_selector) + + +@given(u'a user is accessing the signup page') # noqa +def step_impl(context): + context.browser.get(context.signup_url) + + +@when(u'I enter username, password and password confirmation') # noqa +def step_impl(context): + fill_by_css_selector(context, '#srp_username', 'testuser_{}'.format(uuid.uuid4())) + fill_by_css_selector(context, '#srp_password', 'password') + fill_by_css_selector(context, '#srp_password_confirmation', 'password') + + +@when(u'I click on the signup button') # noqa +def step_impl(context): + find_element_by_css_selector(context, 'button[type=submit]').click() + + +@then(u'I should see the user control panel') # noqa +def step_impl(context): + text = find_element_by_css_selector(context, 'h1').text + assert text == 'user control panel' -- cgit v1.2.3 From a8a7362054f4b49ea1fbc00fe7b556e6e6ea4590 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 19:07:56 -0200 Subject: Add timeout to find by css selector See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/common.py | 20 +++++++------------- service/test/functional/features/steps/signup.py | 4 ++-- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index c3916313..2fd2ec4f 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -66,15 +66,9 @@ def wait_until_elements_are_visible_by_locator(context, locator_tuple, timeout=T return context.browser.find_elements(locator_tuple[0], locator_tuple[1]) -def wait_until_elements_are_visible_by_xpath(context, locator_tuple, timeout=TIMEOUT_IN_S): - wait = WebDriverWait(context.browser, timeout) - wait.until(EC.presence_of_all_elements_located(locator_tuple)) - return context.browser.find_elements(locator_tuple[0], locator_tuple[1]) - - def wait_until_element_is_visible_by_locator(context, locator_tuple, timeout=TIMEOUT_IN_S): wait = WebDriverWait(context.browser, timeout) - wait.until(EC.visibility_of_element_located(locator_tuple)) + wait.until(EC.presence_of_element_located(locator_tuple)) return context.browser.find_element(locator_tuple[0], locator_tuple[1]) @@ -88,8 +82,8 @@ def fill_by_xpath(context, xpath, text): field.send_keys(text) -def fill_by_css_selector(context, css_selector, text): - field = find_element_by_css_selector(context, css_selector) +def fill_by_css_selector(context, css_selector, text, timeout=TIMEOUT_IN_S): + field = find_element_by_css_selector(context, css_selector, timeout=timeout) field.send_keys(text) @@ -118,8 +112,8 @@ def find_element_by_id(context, id): return wait_until_element_is_visible_by_locator(context, (By.ID, id)) -def find_element_by_css_selector(context, css_selector): - return wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, css_selector)) +def find_element_by_css_selector(context, css_selector, timeout=TIMEOUT_IN_S): + return wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, css_selector), timeout=timeout) def find_element_by_class_name(context, class_name): @@ -130,8 +124,8 @@ def find_elements_by_css_selector(context, css_selector, timeout=TIMEOUT_IN_S): return wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, css_selector), timeout=timeout) -def find_elements_by_xpath(context, xpath): - return wait_until_elements_are_visible_by_xpath(context, (By.XPATH, xpath)) +def find_elements_by_xpath(context, xpath, timeout=TIMEOUT_IN_S): + return wait_until_elements_are_visible_by_locator(context, (By.XPATH, xpath), timeout=timeout) def find_element_containing_text(context, text, element_type='*'): diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py index 1252017c..1558004b 100644 --- a/service/test/functional/features/steps/signup.py +++ b/service/test/functional/features/steps/signup.py @@ -18,6 +18,7 @@ import uuid from behave import given, then, when from common import ( + element_should_have_content, fill_by_css_selector, find_element_by_css_selector) @@ -41,5 +42,4 @@ def step_impl(context): @then(u'I should see the user control panel') # noqa def step_impl(context): - text = find_element_by_css_selector(context, 'h1').text - assert text == 'user control panel' + element_should_have_content(context, 'h1', 'user control panel') -- cgit v1.2.3 From 8372b0127343df96cbe1ca33477ea0f197a873be Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 19:11:57 -0200 Subject: Add username to behave context See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/login.py | 13 ++++++------- service/test/functional/features/steps/signup.py | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index a8db6f49..e773c0b1 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -15,15 +15,14 @@ # along with Pixelated. If not, see . import time -from behave import when, then -from selenium.webdriver.common.by import By +from behave import given, when, then from common import ( fill_by_css_selector, - find_element_by_css_selector, - wait_until_element_is_visible_by_locator) + find_element_by_css_selector) +@given(u'a user is accessing the login page') @when(u'I open the login page') def login_page(context): context.browser.get(context.login_url) @@ -31,13 +30,13 @@ def login_page(context): @when(u'I enter {username} and {password} as credentials') def enter_credentials(context, username, password): - fill_by_css_selector(context, 'input#email', username) + fill_by_css_selector(context, 'input#email', context.username) fill_by_css_selector(context, 'input#password', password) @when(u'I click on the login button') def click_login(context): - login_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'input[name="login"]')) + login_button = find_element_by_css_selector(context, 'input[name="login"]') login_button.click() @@ -53,7 +52,7 @@ def _wait_for_interstitial_to_reload(): @when(u'I logout') def click_logout(context): - logout_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'ul#logout')) + logout_button = find_element_by_css_selector(context, 'ul#logout') logout_button.click() diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py index 1558004b..43480666 100644 --- a/service/test/functional/features/steps/signup.py +++ b/service/test/functional/features/steps/signup.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -import uuid from behave import given, then, when from common import ( @@ -30,7 +29,7 @@ def step_impl(context): @when(u'I enter username, password and password confirmation') # noqa def step_impl(context): - fill_by_css_selector(context, '#srp_username', 'testuser_{}'.format(uuid.uuid4())) + fill_by_css_selector(context, '#srp_username', context.username) fill_by_css_selector(context, '#srp_password', 'password') fill_by_css_selector(context, '#srp_password_confirmation', 'password') -- cgit v1.2.3 From 76ad8f023dfabb25e93f771e44164b06004cd7a4 Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Wed, 30 Nov 2016 22:20:23 -0200 Subject: Removes unused function See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/common.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index 2fd2ec4f..f2cab1a6 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -91,11 +91,6 @@ def take_screenshot(context, filename): context.browser.save_screenshot(filename) -def dump_source_to(context, filename): - with open(filename, 'w') as out: - out.write(context.browser.page_source.encode('utf8')) - - def page_has_css(context, css): try: find_element_by_css_selector(context, css) -- cgit v1.2.3 From ae32177eae55df41c91b83119c6beec91daa9e23 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Thu, 1 Dec 2016 16:02:35 -0200 Subject: Fix logout button reference to work on Firefox See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/login.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index e773c0b1..367228f8 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -36,13 +36,12 @@ def enter_credentials(context, username, password): @when(u'I click on the login button') def click_login(context): - login_button = find_element_by_css_selector(context, 'input[name="login"]') - login_button.click() + find_element_by_css_selector(context, 'input[name="login"]').click() @then(u'I should see the fancy interstitial') def step_impl(context): - assert find_element_by_css_selector(context, 'section#hive-section') + find_element_by_css_selector(context, 'section#hive-section') _wait_for_interstitial_to_reload() @@ -52,10 +51,9 @@ def _wait_for_interstitial_to_reload(): @when(u'I logout') def click_logout(context): - logout_button = find_element_by_css_selector(context, 'ul#logout') - logout_button.click() + find_element_by_css_selector(context, '#logout-form div').click() @then(u'I should see the login page') def see_login_page(context): - assert find_element_by_css_selector(context, 'form#login_form') + find_element_by_css_selector(context, 'form#login_form') -- cgit v1.2.3 From e4fd5581c91e97940fe893eda42a8f200d1e8d22 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Thu, 1 Dec 2016 16:08:22 -0200 Subject: Increase interstitial timeout We need a bigger timeout in order to test remotely See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/login.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'service/test/functional/features/steps') diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index 367228f8..b5e88608 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -46,7 +46,7 @@ def step_impl(context): def _wait_for_interstitial_to_reload(): - time.sleep(6) + time.sleep(10) @when(u'I logout') -- cgit v1.2.3