diff options
-rw-r--r-- | service/test/functional/features/steps/common.py | 6 | ||||
-rw-r--r-- | service/test/functional/features/steps/mail_list.py | 2 | ||||
-rw-r--r-- | service/test/functional/features/steps/mail_view.py | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index 015c24ef..26d049aa 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -34,6 +34,12 @@ def wait_for_user_alert_to_disapear(context): wait_until_element_is_invisible_by_locator(context, (By.ID, 'user-alerts')) +def wait_until_elements_are_visible_by_locator(context, locator_tuple): + wait = WebDriverWait(context.browser, 10) + 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): wait = WebDriverWait(context.browser, 10) wait.until(EC.visibility_of_element_located(locator_tuple)) diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py index a1c83848..6a764568 100644 --- a/service/test/functional/features/steps/mail_list.py +++ b/service/test/functional/features/steps/mail_list.py @@ -42,7 +42,7 @@ def impl(context): @when('I open the first mail in the mail list') def impl(context): - elements = context.browser.find_elements_by_xpath('//*[@id="mail-list"]//a') + elements = wait_until_elements_are_visible_by_locator(context, (By.XPATH, '//*[@id="mail-list"]//a')) context.current_mail_id = elements[0].get_attribute('href').split('/')[-1] elements[0].click() diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py index a127b62c..a7586931 100644 --- a/service/test/functional/features/steps/mail_view.py +++ b/service/test/functional/features/steps/mail_view.py @@ -32,6 +32,7 @@ def impl(context, expected_body): @then('that email has the \'{tag}\' tag') def impl(context, tag): + wait_until_element_is_visible_by_locator(context, (By.CSS, '#mail-view .tagsArea .tag')) elements = find_elements_by_css_selector(context, '#mail-view .tagsArea .tag') tags = [e.text for e in elements] assert_that(tags, has_item(tag.upper())) |