From aee74ce5144d098825f6fb1b4a46b68c0af2f841 Mon Sep 17 00:00:00 2001 From: kaeff Date: Mon, 17 Aug 2015 20:45:10 +0200 Subject: 2 attempts against flakiness of checkboxes_and_mailboxes 1) Explicitly load inbox to avoid test fails before mail appears 2) Use "loading..." notification to check whether deleting mail has already been completed checkboxes_and_mailboxes.feature spends a lot time waiting (even if the step is already executed logically) as one can see when running tests in Firefox. This test is a good candidate for speed optimization. --- service/test/functional/features/checkboxes_and_mailboxes.feature | 3 ++- service/test/functional/features/steps/common.py | 5 +++++ service/test/functional/features/steps/mail_list.py | 2 ++ service/test/functional/features/steps/search.py | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) (limited to 'service/test') diff --git a/service/test/functional/features/checkboxes_and_mailboxes.feature b/service/test/functional/features/checkboxes_and_mailboxes.feature index 47ea806d..09710040 100644 --- a/service/test/functional/features/checkboxes_and_mailboxes.feature +++ b/service/test/functional/features/checkboxes_and_mailboxes.feature @@ -21,7 +21,8 @@ Feature: Checkboxes Scenario: User has a list of emails in each mailboxes that needs to be managed Given I have a mail in my inbox - When I mark the first unread email as read + When I select the tag 'inbox' + And I mark the first unread email as read And I delete the email When I select the tag 'trash' Then the deleted mail is there diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index 96c51a6e..d77e9903 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -24,6 +24,8 @@ from twisted.internet import defer from test.support.integration import MailBuilder +LOADING = 'loading' + TIMEOUT_IN_S = 20 @@ -42,6 +44,9 @@ def wait_until_element_is_deleted(context, locator_tuple, timeout=TIMEOUT_IN_S): def wait_for_user_alert_to_disapear(context, timeout=TIMEOUT_IN_S): wait_until_element_is_invisible_by_locator(context, (By.ID, 'user-alerts'), timeout) +def wait_for_user_alert_to_appear_and_disapear(context, timeout=TIMEOUT_IN_S): + wait_until_element_is_visible_by_locator(context, (By.ID, LOADING), timeout) + wait_until_element_is_invisible_by_locator(context, (By.ID, LOADING), timeout) def wait_until_elements_are_visible_by_locator(context, locator_tuple, timeout=TIMEOUT_IN_S): spend_time_in_reactor() diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py index 0822cd75..2ab46bab 100644 --- a/service/test/functional/features/steps/mail_list.py +++ b/service/test/functional/features/steps/mail_list.py @@ -102,6 +102,8 @@ def impl(context): context.current_mail_id = last_email().get_attribute('id') last_email().find_element_by_tag_name('input').click() find_element_by_id(context, 'delete-selected').click() + wait_for_user_alert_to_appear_and_disapear(context) # Loading + wait_for_user_alert_to_disapear(context) # Success message spend_time_in_reactor() assert 0 == len(context.browser.find_element_by_id('mail-list').find_elements_by_tag_name('li')) diff --git a/service/test/functional/features/steps/search.py b/service/test/functional/features/steps/search.py index e653c3ed..cdd7bb61 100644 --- a/service/test/functional/features/steps/search.py +++ b/service/test/functional/features/steps/search.py @@ -23,6 +23,7 @@ from common import * def impl(context, search_term): search_field = find_element_by_css_selector(context, '#search-trigger input[type="search"]') search_field.send_keys(search_term) + sleep(5) search_field.send_keys(Keys.ENTER) sleep(1) -- cgit v1.2.3