Skip to content
Browse files

Pages: improve portal message functions.

  • Loading branch information...
1 parent bec1054 commit 957b13d53147a7054ccfb56c16d889e8320c7848 @jone jone committed
Showing with 11 additions and 3 deletions.
  1. +11 −3 ftw/testing/pages.py
View
14 ftw/testing/pages.py
@@ -74,6 +74,9 @@ def find_one_by_xpath(self, selector):
return elements.first
+ def normalize_whitespace(self, text):
+ return ' '.join(text.split())
+
class Plone(PageObject):
@@ -115,12 +118,17 @@ def get_template_class(self):
return template[0]
def portal_messages(self):
- return {'info': browser().find_by_css('.portalMessage.info dd')}
+ return {'info': browser().find_by_css('.portalMessage.info dd'),
+ 'warning': browser().find_by_css('.portalMessage.warning dd'),
+ 'error': browser().find_by_css('.portalMessage.error dd')}
def portal_text_messages(self):
messages = self.portal_messages()
- item_to_text = lambda item: item.text.strip()
- return {'info': map(item_to_text, messages['info'])}
+ item_to_text = lambda item: self.normalize_whitespace(
+ item.text.strip())
+ return {'info': map(item_to_text, messages['info']),
+ 'warning': map(item_to_text, messages['warning']),
+ 'error': map(item_to_text, messages['error'])}
def assert_portal_message(self, kind, message):
message = message.strip()

0 comments on commit 957b13d

Please sign in to comment.
Something went wrong with that request. Please try again.