From 2b291aacde05151a0d2a0dccdbbd085f93f255a0 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 17 Feb 2017 13:26:47 -0200 Subject: [#907] Fix selectors to work with chromedriver --- service/test/functional/features/steps/attachments.py | 10 ++++++++-- service/test/functional/features/steps/tag_list.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index 8852b787..37fabb6a 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -13,6 +13,8 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . +import os + from email.MIMEMultipart import MIMEMultipart from email.mime.application import MIMEApplication from email.mime.text import MIMEText @@ -67,8 +69,10 @@ def find_icon(context): def upload_big_file(context): base_dir = "test/functional/features/files/" fname = "over_5mb.data" + path = os.path.abspath(os.path.join(base_dir, fname)) + context.browser.execute_script("$('#fileupload').removeAttr('hidden');") - fill_by_css_selector(context, '#fileupload', base_dir + fname) + fill_by_css_selector(context, '#fileupload', path) find_element_by_css_selector(context, '#upload-error-message') @@ -97,7 +101,9 @@ def should_not_show_upload_error_message(context): def upload_attachment(context): base_dir = "test/functional/features/files/" fname = "5mb.data" - fill_by_css_selector(context, '#fileupload', base_dir + fname) + path = os.path.abspath(os.path.join(base_dir, fname)) + + fill_by_css_selector(context, '#fileupload', path) attachment_list_item = find_element_by_css_selector(context, '#attachment-list-item li a') assert attachment_list_item.text == "%s (5.00 Mb)" % fname diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index daea416d..fcdf1e15 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -37,7 +37,7 @@ def expand_side_nav(context): if is_side_nav_expanded(context): return - toggle = find_element_by_class_name(context, 'side-nav-toggle') + toggle = find_element_by_css_selector(context, '.side-nav-toggle-icon i') toggle.click() -- cgit v1.2.3 From 85aa0455d5accb392cf6bc3b5fc44bc8b8da4350 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 17 Feb 2017 14:30:28 -0200 Subject: [#907] Add retry when tag reference was lost --- service/test/functional/features/steps/tag_list.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index fcdf1e15..2208a542 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -14,11 +14,10 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . from behave import when -from selenium.common.exceptions import TimeoutException +from selenium.common.exceptions import TimeoutException, StaleElementReferenceException from common import ( find_element_by_class_name, - find_element_by_id, find_element_by_css_selector, wait_for_user_alert_to_disapear) @@ -37,12 +36,11 @@ def expand_side_nav(context): if is_side_nav_expanded(context): return - toggle = find_element_by_css_selector(context, '.side-nav-toggle-icon i') - toggle.click() + find_element_by_css_selector(context, '.side-nav-toggle-icon i').click() @when('I select the tag \'{tag}\'') -def impl(context, tag): +def select_tag(context, tag): wait_for_user_alert_to_disapear(context) expand_side_nav(context) @@ -51,14 +49,10 @@ def impl(context, tag): success = False while (not success) and (try_again > 0): try: - find_element_by_css_selector(context, '#tag-%s' % tag) - - e = find_element_by_id(context, 'tag-%s' % tag) - e.click() - + find_element_by_css_selector(context, '#tag-%s' % tag).click() find_element_by_css_selector(context, ".mail-list-entry__item[href*='%s']" % tag) success = True - except TimeoutException: + except (TimeoutException, StaleElementReferenceException): pass finally: try_again -= 1 @@ -67,9 +61,8 @@ def impl(context, tag): @when('I am in \'{tag}\'') -def impl(context, tag): +def assert_in_tag(context, tag): expand_side_nav(context) - find_element_by_css_selector(context, '#tag-%s' % tag) - e = find_element_by_id(context, 'tag-%s' % tag) + e = find_element_by_css_selector(context, '#tag-%s' % tag) assert "selected" in e.get_attribute("class") -- cgit v1.2.3 From 200ba568e4c975cc5276676b2406170aa85dcad1 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 17 Feb 2017 15:47:01 -0200 Subject: [#907] Change default webdriver to chrome with @anikarni --- service/test/functional/features/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index d49016b6..821a762b 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -63,7 +63,7 @@ def before_all(context): def _setup_webdriver(context): - browser = context.config.userdata.get('webdriver', 'phantomjs') + browser = context.config.userdata.get('webdriver', 'chrome') supported_webdrivers = { 'phantomjs': webdriver.PhantomJS, 'firefox': webdriver.Firefox, -- cgit v1.2.3 From e560075b89668e4d8c12a89424ff5d7fab638475 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 17 Feb 2017 16:34:29 -0200 Subject: [#907] Change functional tests to check for visibility --- service/test/functional/features/steps/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index edfe2a50..3e1e995e 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -61,7 +61,7 @@ def _wait_until_elements_are_visible_by_locator(context, locator_tuple, timeout= def _wait_until_element_is_visible_by_locator(context, locator_tuple, timeout=TIMEOUT_IN_S): wait = WebDriverWait(context.browser, timeout) - wait.until(EC.presence_of_element_located(locator_tuple)) + wait.until(EC.visibility_of_element_located(locator_tuple)) return context.browser.find_element(locator_tuple[0], locator_tuple[1]) -- cgit v1.2.3 From 97cd3a2470e1de74a14fd4c1dad332a5a311e8eb Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 17 Feb 2017 16:49:54 -0200 Subject: [#907] Fix functional tests on snap --- service/test/functional/features/steps/tag_list.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index 2208a542..688636b2 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -49,7 +49,11 @@ def select_tag(context, tag): success = False while (not success) and (try_again > 0): try: - find_element_by_css_selector(context, '#tag-%s' % tag).click() + find_element_by_css_selector(context, '#tag-%s' % tag) + + e = find_element_by_css_selector(context, '#tag-%s' % tag) + e.click() + find_element_by_css_selector(context, ".mail-list-entry__item[href*='%s']" % tag) success = True except (TimeoutException, StaleElementReferenceException): @@ -58,11 +62,3 @@ def select_tag(context, tag): try_again -= 1 assert success - - -@when('I am in \'{tag}\'') -def assert_in_tag(context, tag): - expand_side_nav(context) - - e = find_element_by_css_selector(context, '#tag-%s' % tag) - assert "selected" in e.get_attribute("class") -- cgit v1.2.3 From 8177127b6b7282f816cb64595249ef1cb42ec0d8 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Fri, 17 Feb 2017 17:17:27 -0200 Subject: [#907] Click tag child on functional tests with @anikarni --- service/test/functional/features/steps/tag_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index 688636b2..e3382a61 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -51,7 +51,7 @@ def select_tag(context, tag): try: find_element_by_css_selector(context, '#tag-%s' % tag) - e = find_element_by_css_selector(context, '#tag-%s' % tag) + e = find_element_by_css_selector(context, '#tag-%s .tag-label' % tag) e.click() find_element_by_css_selector(context, ".mail-list-entry__item[href*='%s']" % tag) -- cgit v1.2.3 From bfd85dff6b086abae1c16014e318c89cba929b66 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Fri, 17 Feb 2017 09:57:19 -0200 Subject: [#907] Makes login page responsive --- service/test/functional/features/steps/login.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index 6ee521e9..fb8f08ef 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -29,13 +29,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', context.username) - fill_by_css_selector(context, 'input#password', password) + fill_by_css_selector(context, 'input[name="username"]', context.username) + fill_by_css_selector(context, 'input[name="password"]', password) @when(u'I click on the login button') def click_login(context): - find_element_by_css_selector(context, 'input[name="login"]').click() + find_element_by_css_selector(context, 'input[type="submit"]').click() @then(u'I should see the fancy interstitial') -- cgit v1.2.3 From 1e62467a7adfafe91025cf6c8955d54770e705aa Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Fri, 10 Mar 2017 11:25:40 -0300 Subject: |#000|Sriram| Fix functional test - get element by id rather than css selector for cc-bcc collapse --- service/test/functional/features/steps/compose.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/compose.py b/service/test/functional/features/steps/compose.py index 1dab1b6d..1b90052e 100644 --- a/service/test/functional/features/steps/compose.py +++ b/service/test/functional/features/steps/compose.py @@ -19,7 +19,9 @@ from behave import when from common import ( fill_by_css_selector, - find_element_by_css_selector) + find_element_by_css_selector, + find_element_by_id +) @when('I compose a message with') @@ -52,7 +54,7 @@ def send_impl(context): @when(u'I toggle the cc and bcc fields') def collapse_cc_bcc_fields(context): - cc_and_bcc_chevron = find_element_by_css_selector(context, '#cc-bcc-collapse') + cc_and_bcc_chevron = find_element_by_id(context, 'cc-bcc-collapse') cc_and_bcc_chevron.click() -- cgit v1.2.3 From 908806ee4d2e94c691f8fb7f4ada6d45e7e9a282 Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Fri, 10 Mar 2017 16:49:21 -0300 Subject: [#923] Fix functional test on login page --- service/test/functional/features/steps/login.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py index fb8f08ef..9ce37370 100644 --- a/service/test/functional/features/steps/login.py +++ b/service/test/functional/features/steps/login.py @@ -35,7 +35,7 @@ def enter_credentials(context, username, password): @when(u'I click on the login button') def click_login(context): - find_element_by_css_selector(context, 'input[type="submit"]').click() + find_element_by_css_selector(context, 'button[type="submit"]').click() @then(u'I should see the fancy interstitial') -- cgit v1.2.3