diff options
Diffstat (limited to 'service/test/functional/features')
-rw-r--r-- | service/test/functional/features/steps/mail_list.py | 26 |
1 files changed, 12 insertions, 14 deletions
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) |