summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/test/functional/features/steps/search.py8
-rw-r--r--service/test/functional/features/steps/tag_list.py26
2 files changed, 21 insertions, 13 deletions
diff --git a/service/test/functional/features/steps/search.py b/service/test/functional/features/steps/search.py
index 2d9087d2..52cb54a2 100644
--- a/service/test/functional/features/steps/search.py
+++ b/service/test/functional/features/steps/search.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
from time import sleep
+from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from common import *
@@ -22,8 +23,11 @@ from common import *
@when('I search for a mail with the words "{search_term}"')
def impl(context, search_term):
search_field = find_element_by_css_selector(context, '#search-trigger input[type="search"]')
- search_field.send_keys(search_term)
- search_field.send_keys(Keys.ENTER)
+
+ ActionChains(context.browser)\
+ .send_keys_to_element(search_field, search_term)\
+ .send_keys_to_element(search_field, Keys.ENTER)\
+ .perform()
@then('I see one or more mails in the search results')
diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py
index 6bf50d6d..a3315835 100644
--- a/service/test/functional/features/steps/tag_list.py
+++ b/service/test/functional/features/steps/tag_list.py
@@ -33,26 +33,30 @@ def expand_side_nav(context):
toggle = find_element_by_class_name(context, 'side-nav-toggle')
toggle.click()
- wait_for_browser_javascript_execution(context)
-
@when('I select the tag \'{tag}\'')
def impl(context, tag):
wait_for_user_alert_to_disapear(context)
expand_side_nav(context)
- wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), timeout=20)
-
- wait_for_browser_javascript_execution(context)
-
- e = find_element_by_id(context, 'tag-%s' % tag)
- e.click()
+ # try this multiple times as there are some race conditions
+ try_again = 2
+ 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)
- wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, "#mail-list li span a[href*='%s']" % tag), timeout=20)
+ e = find_element_by_id(context, 'tag-%s' % tag)
+ e.click()
+ wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, "#mail-list li span a[href*='%s']" % tag), timeout=20)
+ success = True
+ except TimeoutException:
+ pass
+ finally:
+ try_again -= 1
-def wait_for_browser_javascript_execution(context):
- context.browser.execute_script('true') # execute something so that page hopefully is rendered
+ assert success
@when('I am in \'{tag}\'')