summaryrefslogtreecommitdiff
path: root/service/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'service/test/functional')
-rw-r--r--service/test/functional/features/steps/attachments.py12
-rw-r--r--service/test/functional/features/steps/common.py21
-rw-r--r--service/test/functional/features/steps/compose.py11
-rw-r--r--service/test/functional/features/steps/mail_list.py6
-rw-r--r--service/test/functional/features/steps/mail_view.py12
-rw-r--r--service/test/functional/features/steps/tag_list.py11
6 files changed, 29 insertions, 44 deletions
diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py
index 43948016..8852b787 100644
--- a/service/test/functional/features/steps/attachments.py
+++ b/service/test/functional/features/steps/attachments.py
@@ -20,14 +20,12 @@ 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)
+ page_has_css)
@given(u'I have a mail with an attachment in my inbox')
@@ -71,7 +69,7 @@ def upload_big_file(context):
fname = "over_5mb.data"
context.browser.execute_script("$('#fileupload').removeAttr('hidden');")
fill_by_css_selector(context, '#fileupload', base_dir + fname)
- wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#upload-error-message'))
+ find_element_by_css_selector(context, '#upload-error-message')
@then(u'I see an upload error message')
@@ -100,17 +98,17 @@ def upload_attachment(context):
base_dir = "test/functional/features/files/"
fname = "5mb.data"
fill_by_css_selector(context, '#fileupload', base_dir + fname)
- attachment_list_item = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#attachment-list-item li a'))
+ attachment_list_item = find_element_by_css_selector(context, '#attachment-list-item li a')
assert attachment_list_item.text == "%s (5.00 Mb)" % fname
@when(u'remove the file')
def click_remove_icon(context):
- remove_icon = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#attachment-list-item i.remove-icon'))
+ remove_icon = find_element_by_css_selector(context, '#attachment-list-item i.remove-icon')
remove_icon.click()
@then(u'I should not see it attached')
def assert_attachment_removed(context):
- attachments_list_li = context.browser.find_elements(By.CSS_SELECTOR, '#attachment-list-item li a')
+ attachments_list_li = context.browser.find_elements_by_css_selector('#attachment-list-item li a')
assert len(attachments_list_li) == 0
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index f21e9410..edfe2a50 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -45,11 +45,6 @@ def wait_until_element_is_invisible_by_locator(context, locator_tuple, timeout=T
wait.until(EC.invisibility_of_element_located(locator_tuple))
-def wait_until_element_is_deleted(context, locator_tuple, timeout=TIMEOUT_IN_S):
- wait = WebDriverWait(context.browser, timeout)
- wait.until(lambda s: len(s.find_elements(locator_tuple[0], locator_tuple[1])) == 0)
-
-
def wait_for_loading_to_finish(context, timeout=TIMEOUT_IN_S):
wait_until_element_is_invisible_by_locator(context, (By.ID, 'loading'), timeout)
@@ -58,13 +53,13 @@ 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_until_elements_are_visible_by_locator(context, locator_tuple, timeout=TIMEOUT_IN_S):
+def _wait_until_elements_are_visible_by_locator(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):
+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))
return context.browser.find_element(locator_tuple[0], locator_tuple[1])
@@ -98,27 +93,27 @@ def page_has_css(context, css):
def find_element_by_xpath(context, xpath):
- return wait_until_element_is_visible_by_locator(context, (By.XPATH, xpath))
+ return _wait_until_element_is_visible_by_locator(context, (By.XPATH, xpath))
def find_element_by_id(context, id):
- return wait_until_element_is_visible_by_locator(context, (By.ID, id))
+ return _wait_until_element_is_visible_by_locator(context, (By.ID, id))
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)
+ 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):
- return wait_until_element_is_visible_by_locator(context, (By.CLASS_NAME, class_name))
+ return _wait_until_element_is_visible_by_locator(context, (By.CLASS_NAME, class_name))
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)
+ return _wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, css_selector), timeout=timeout)
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)
+ 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/compose.py b/service/test/functional/features/steps/compose.py
index c72b25e2..1dab1b6d 100644
--- a/service/test/functional/features/steps/compose.py
+++ b/service/test/functional/features/steps/compose.py
@@ -16,17 +16,15 @@
from time import sleep
from behave import when
-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')
def impl(context):
- toggle = context.browser.find_element_by_id('compose-mails-trigger')
+ toggle = find_element_by_css_selector(context, '#compose-mails-trigger')
toggle.click()
for row in context.table:
@@ -48,18 +46,17 @@ def choose_impl(context, recipients_field, to_type):
@when('I send it')
def send_impl(context):
- send_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#send-button:enabled'))
+ send_button = find_element_by_css_selector(context, '#send-button:enabled')
send_button.click()
@when(u'I toggle the cc and bcc fields')
def collapse_cc_bcc_fields(context):
- cc_and_bcc_chevron = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#cc-bcc-collapse'))
+ cc_and_bcc_chevron = find_element_by_css_selector(context, '#cc-bcc-collapse')
cc_and_bcc_chevron.click()
def _enter_recipient(context, recipients_field, to_type):
recipients_field = recipients_field.lower()
- browser = context.browser
- field = browser.find_element_by_css_selector('#recipients-%s-area .tt-input' % recipients_field)
+ field = find_element_by_css_selector(context, '#recipients-%s-area .tt-input' % recipients_field)
field.send_keys(to_type)
diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py
index 9432a4d1..227aa9ed 100644
--- a/service/test/functional/features/steps/mail_list.py
+++ b/service/test/functional/features/steps/mail_list.py
@@ -16,7 +16,6 @@
from behave import when, then, given
from selenium.common.exceptions import TimeoutException
-from selenium.webdriver.common.by import By
from common import (
ImplicitWait,
@@ -26,8 +25,7 @@ from common import (
find_elements_by_css_selector,
mail_list_with_subject_exists,
wait_for_condition,
- wait_for_loading_to_finish,
- wait_until_elements_are_visible_by_locator)
+ wait_for_loading_to_finish)
def find_current_mail(context):
@@ -45,7 +43,7 @@ def open_current_mail(context):
def get_first_email(context):
- return wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, '.mail-list-entry__item'))[0]
+ return find_element_by_css_selector(context, '.mail-list-entry__item')
@then('I see that mail under the \'{tag}\' tag')
diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py
index 88ee5c5a..65959b70 100644
--- a/service/test/functional/features/steps/mail_view.py
+++ b/service/test/functional/features/steps/mail_view.py
@@ -16,15 +16,13 @@
from behave import then, when
from selenium.webdriver.common.keys import Keys
-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)
+ wait_until_button_is_visible)
@then('I see that the subject reads \'{subject}\'')
@@ -44,7 +42,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_SELECTOR, '#mail-view .tagsArea .tag'))
+ find_element_by_css_selector(context, '#mail-view .tagsArea .tag')
elements = find_elements_by_css_selector(context, '#mail-view .tagsArea .tag')
tags = [e.text for e in elements]
assert tag in tags
@@ -52,13 +50,13 @@ def impl(context, tag):
@when('I add the tag \'{tag}\' to that mail')
def impl(context, tag):
- b = wait_until_element_is_visible_by_locator(context, (By.ID, 'new-tag-button'))
+ b = find_element_by_css_selector(context, '#new-tag-button')
b.click()
- e = wait_until_element_is_visible_by_locator(context, (By.ID, 'new-tag-input'))
+ e = find_element_by_css_selector(context, '#new-tag-input')
e.send_keys(tag)
e.send_keys(Keys.ENTER)
- wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'li[data-tag=%s]' % tag))
+ find_element_by_css_selector(context, 'li[data-tag=%s]' % tag)
@when('I reply to it')
diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py
index b9adea0a..daea416d 100644
--- a/service/test/functional/features/steps/tag_list.py
+++ b/service/test/functional/features/steps/tag_list.py
@@ -15,13 +15,12 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
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)
+ find_element_by_css_selector,
+ wait_for_user_alert_to_disapear)
def click_first_element_with_class(context, classname):
@@ -52,12 +51,12 @@ def impl(context, tag):
success = False
while (not success) and (try_again > 0):
try:
- wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), timeout=20)
+ find_element_by_css_selector(context, '#tag-%s' % tag)
e = find_element_by_id(context, 'tag-%s' % tag)
e.click()
- wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, ".mail-list-entry__item[href*='%s']" % tag), timeout=20)
+ find_element_by_css_selector(context, ".mail-list-entry__item[href*='%s']" % tag)
success = True
except TimeoutException:
pass
@@ -71,6 +70,6 @@ def impl(context, tag):
def impl(context, tag):
expand_side_nav(context)
- wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), 20)
+ find_element_by_css_selector(context, '#tag-%s' % tag)
e = find_element_by_id(context, 'tag-%s' % tag)
assert "selected" in e.get_attribute("class")